@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.mjs
CHANGED
|
@@ -8997,7 +8997,6 @@ var UploadJob = class extends AbstractJob {
|
|
|
8997
8997
|
const videoModeQuery = this._videoMode ? `&videoMode=${this._videoMode}` : "";
|
|
8998
8998
|
const postUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=async&sourceId=${event.source_id}${videoModeQuery}`;
|
|
8999
8999
|
if (this._params) {
|
|
9000
|
-
this._requestLogger.debug(`before POST ${postUrl} with multipart body because of params`);
|
|
9001
9000
|
const params = JSON.stringify(this._params);
|
|
9002
9001
|
const paramBlob = new Blob([params], { type: "application/json" });
|
|
9003
9002
|
const formData = new FormData();
|
|
@@ -9014,10 +9013,10 @@ var UploadJob = class extends AbstractJob {
|
|
|
9014
9013
|
body: formData,
|
|
9015
9014
|
signal: this._controller.signal,
|
|
9016
9015
|
// @ts-ignore
|
|
9017
|
-
duplex: "half"
|
|
9016
|
+
duplex: "half",
|
|
9017
|
+
eyepop: { responseStreaming: true }
|
|
9018
9018
|
});
|
|
9019
9019
|
} else {
|
|
9020
|
-
this._requestLogger.debug(`before POST ${postUrl} with stream as body`);
|
|
9021
9020
|
const headers = {
|
|
9022
9021
|
...session.authenticationHeaders(),
|
|
9023
9022
|
Accept: "application/jsonl",
|
|
@@ -9032,7 +9031,8 @@ var UploadJob = class extends AbstractJob {
|
|
|
9032
9031
|
body: this._uploadStream,
|
|
9033
9032
|
signal: this._controller.signal,
|
|
9034
9033
|
// @ts-ignore
|
|
9035
|
-
duplex: "half"
|
|
9034
|
+
duplex: "half",
|
|
9035
|
+
eyepop: { responseStreaming: true }
|
|
9036
9036
|
});
|
|
9037
9037
|
}
|
|
9038
9038
|
request.then(async (value) => {
|
|
@@ -9041,8 +9041,6 @@ var UploadJob = class extends AbstractJob {
|
|
|
9041
9041
|
}
|
|
9042
9042
|
}).catch((reason) => {
|
|
9043
9043
|
this._requestLogger.debug(`error ${reason} for POST ${postUrl}`);
|
|
9044
|
-
}).finally(() => {
|
|
9045
|
-
this._requestLogger.debug(`after POST ${postUrl}`);
|
|
9046
9044
|
});
|
|
9047
9045
|
}
|
|
9048
9046
|
return Promise.resolve();
|
|
@@ -9059,20 +9057,18 @@ var UploadJob = class extends AbstractJob {
|
|
|
9059
9057
|
...session.authenticationHeaders(),
|
|
9060
9058
|
Accept: "application/jsonl"
|
|
9061
9059
|
};
|
|
9062
|
-
this._requestLogger.debug(`before POST ${prepareUrl} to prepare full duplex upload`);
|
|
9063
9060
|
response = await this._client.fetch(prepareUrl, {
|
|
9064
9061
|
headers,
|
|
9065
9062
|
method: "POST",
|
|
9066
9063
|
signal: this._controller.signal,
|
|
9067
9064
|
// @ts-ignore
|
|
9068
|
-
duplex: "half"
|
|
9065
|
+
duplex: "half",
|
|
9066
|
+
eyepop: { responseStreaming: true }
|
|
9069
9067
|
});
|
|
9070
|
-
this._requestLogger.debug(`after POST ${prepareUrl} to prepare full duplex upload ${response.status} ${response.statusText}`);
|
|
9071
9068
|
} else {
|
|
9072
9069
|
const videoModeQuery = this._videoMode ? `&videoMode=${this._videoMode}` : "";
|
|
9073
9070
|
const postUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=sync${videoModeQuery}`;
|
|
9074
9071
|
if (this._params) {
|
|
9075
|
-
this._requestLogger.debug(`before POST ${postUrl} with multipart body because of params`);
|
|
9076
9072
|
const params = JSON.stringify(this._params);
|
|
9077
9073
|
const paramBlob = new Blob([params], { type: "application/json" });
|
|
9078
9074
|
const formData = new FormData();
|
|
@@ -9089,11 +9085,10 @@ var UploadJob = class extends AbstractJob {
|
|
|
9089
9085
|
body: formData,
|
|
9090
9086
|
signal: this._controller.signal,
|
|
9091
9087
|
// @ts-ignore
|
|
9092
|
-
duplex: "half"
|
|
9088
|
+
duplex: "half",
|
|
9089
|
+
eyepop: { responseStreaming: true }
|
|
9093
9090
|
});
|
|
9094
|
-
this._requestLogger.debug(`after POST ${postUrl} with multipart body because of params)`);
|
|
9095
9091
|
} else {
|
|
9096
|
-
this._requestLogger.debug(`before POST ${postUrl} with stream as body`);
|
|
9097
9092
|
const headers = {
|
|
9098
9093
|
...session.authenticationHeaders(),
|
|
9099
9094
|
Accept: "application/jsonl",
|
|
@@ -9110,7 +9105,6 @@ var UploadJob = class extends AbstractJob {
|
|
|
9110
9105
|
// @ts-ignore
|
|
9111
9106
|
duplex: "half"
|
|
9112
9107
|
});
|
|
9113
|
-
this._requestLogger.debug(`after POST ${postUrl} with stream as body`);
|
|
9114
9108
|
}
|
|
9115
9109
|
}
|
|
9116
9110
|
return response;
|
|
@@ -9140,15 +9134,14 @@ var LoadFromJob = class extends AbstractJob {
|
|
|
9140
9134
|
"Content-Type": "application/json"
|
|
9141
9135
|
};
|
|
9142
9136
|
const patchUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=sync`;
|
|
9143
|
-
this.
|
|
9144
|
-
const response = await this._client.fetch(patchUrl, {
|
|
9137
|
+
return await this._client.fetch(patchUrl, {
|
|
9145
9138
|
headers,
|
|
9146
9139
|
method: "PATCH",
|
|
9147
9140
|
body: JSON.stringify(body),
|
|
9148
|
-
signal: this._controller.signal
|
|
9141
|
+
signal: this._controller.signal,
|
|
9142
|
+
// @ts-ignore
|
|
9143
|
+
eyepop: { responseStreaming: true }
|
|
9149
9144
|
});
|
|
9150
|
-
this._requestLogger.debug("after PATCH %s with url %s as source", patchUrl, this._location);
|
|
9151
|
-
return response;
|
|
9152
9145
|
}
|
|
9153
9146
|
};
|
|
9154
9147
|
var LoadLiveIngressJob = class extends AbstractJob {
|
|
@@ -9175,15 +9168,14 @@ var LoadLiveIngressJob = class extends AbstractJob {
|
|
|
9175
9168
|
"Content-Type": "application/json"
|
|
9176
9169
|
};
|
|
9177
9170
|
const patchUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=preempt&processing=sync`;
|
|
9178
|
-
this.
|
|
9179
|
-
const response = await this._client.fetch(patchUrl, {
|
|
9171
|
+
return await this._client.fetch(patchUrl, {
|
|
9180
9172
|
headers,
|
|
9181
9173
|
method: "PATCH",
|
|
9182
9174
|
body: JSON.stringify(body),
|
|
9183
|
-
signal: this._controller.signal
|
|
9175
|
+
signal: this._controller.signal,
|
|
9176
|
+
// @ts-ignore
|
|
9177
|
+
eyepop: { responseStreaming: true }
|
|
9184
9178
|
});
|
|
9185
|
-
this._requestLogger.debug("after PATCH %s with url %s as source", patchUrl, this._ingressId);
|
|
9186
|
-
return response;
|
|
9187
9179
|
}
|
|
9188
9180
|
};
|
|
9189
9181
|
|
|
@@ -9241,7 +9233,6 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9241
9233
|
await this._pc.setLocalDescription(offer);
|
|
9242
9234
|
const session = await this._getSession();
|
|
9243
9235
|
const ingressUrl = this.gresUrl(session);
|
|
9244
|
-
this._requestLogger.debug("before POST: %s", ingressUrl);
|
|
9245
9236
|
const headers = {
|
|
9246
9237
|
...session.authenticationHeaders(),
|
|
9247
9238
|
"Content-Type": "application/sdp"
|
|
@@ -9256,12 +9247,10 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9256
9247
|
}
|
|
9257
9248
|
this._eTag = response.headers.get("ETag") ?? "";
|
|
9258
9249
|
this._location = response.headers.get("Location");
|
|
9259
|
-
return this.onRemoteAnswer(
|
|
9260
|
-
|
|
9261
|
-
|
|
9262
|
-
|
|
9263
|
-
})
|
|
9264
|
-
);
|
|
9250
|
+
return await this.onRemoteAnswer(new RTCSessionDescription({
|
|
9251
|
+
type: "answer",
|
|
9252
|
+
sdp: await response.text()
|
|
9253
|
+
}));
|
|
9265
9254
|
}
|
|
9266
9255
|
async sendLocalCandidates(candidates) {
|
|
9267
9256
|
if (!this._offerData) {
|
|
@@ -9270,7 +9259,6 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9270
9259
|
let urlPath = void 0;
|
|
9271
9260
|
const session = await this._getSession();
|
|
9272
9261
|
const ingressUrl = this.gresUrl(session, this._location);
|
|
9273
|
-
this._requestLogger.debug("before PATCH: %s", ingressUrl);
|
|
9274
9262
|
const headers = {
|
|
9275
9263
|
...session.authenticationHeaders(),
|
|
9276
9264
|
"Content-Type": "application/trickle-ice-sdpfrag",
|
|
@@ -9452,7 +9440,6 @@ var WebrtcWhip = class extends WebrtcBase {
|
|
|
9452
9440
|
async start() {
|
|
9453
9441
|
const session = await this._getSession();
|
|
9454
9442
|
const ingressUrl = this.gresUrl(session);
|
|
9455
|
-
this._requestLogger.debug("before GET: %s", ingressUrl);
|
|
9456
9443
|
const response = await this._client.fetch(ingressUrl, {
|
|
9457
9444
|
headers: session.authenticationHeaders(),
|
|
9458
9445
|
method: "GET"
|
|
@@ -9460,7 +9447,7 @@ var WebrtcWhip = class extends WebrtcBase {
|
|
|
9460
9447
|
if (response.status >= 300) {
|
|
9461
9448
|
return Promise.reject(`unknown status code for GET '${ingressUrl}': ${response.status} (${response.statusText})`);
|
|
9462
9449
|
}
|
|
9463
|
-
return this.onIceServers(response);
|
|
9450
|
+
return await this.onIceServers(response);
|
|
9464
9451
|
}
|
|
9465
9452
|
async stream() {
|
|
9466
9453
|
if (this._stream) {
|
|
@@ -9553,7 +9540,6 @@ var WebrtcWhep = class extends WebrtcBase {
|
|
|
9553
9540
|
async start() {
|
|
9554
9541
|
const session = await this._getSession();
|
|
9555
9542
|
const egressUrl = this.gresUrl(session);
|
|
9556
|
-
this._requestLogger.debug("before GET: %s", egressUrl);
|
|
9557
9543
|
const response = await this._client.fetch(egressUrl, {
|
|
9558
9544
|
headers: session.authenticationHeaders(),
|
|
9559
9545
|
method: "GET"
|
|
@@ -9585,10 +9571,10 @@ var WebrtcWhep = class extends WebrtcBase {
|
|
|
9585
9571
|
pc.addTransceiver("video", { direction });
|
|
9586
9572
|
pc.onicecandidate = (evt) => this.onLocalCandidate(evt);
|
|
9587
9573
|
this._pc = pc;
|
|
9588
|
-
this._requestLogger.info(
|
|
9574
|
+
this._requestLogger.info(`onIceServers ${pc.iceConnectionState}`);
|
|
9589
9575
|
return new Promise(async (resolve, reject) => {
|
|
9590
9576
|
pc.ontrack = (evt) => {
|
|
9591
|
-
this._requestLogger.debug(
|
|
9577
|
+
this._requestLogger.debug(`new track: ${evt.track.kind}`);
|
|
9592
9578
|
this._stream = evt.streams[0];
|
|
9593
9579
|
resolve(this);
|
|
9594
9580
|
};
|
|
@@ -9596,11 +9582,11 @@ var WebrtcWhep = class extends WebrtcBase {
|
|
|
9596
9582
|
switch (pc.iceConnectionState) {
|
|
9597
9583
|
case "failed":
|
|
9598
9584
|
case "disconnected":
|
|
9599
|
-
this._requestLogger.debug("disconnected");
|
|
9585
|
+
this._requestLogger.debug("oniceconnectionstatechange disconnected");
|
|
9600
9586
|
reject(`peer connection: ${pc.iceConnectionState}`);
|
|
9601
9587
|
break;
|
|
9602
9588
|
case "connected":
|
|
9603
|
-
this._requestLogger.debug("connected");
|
|
9589
|
+
this._requestLogger.debug("oniceconnectionstatechange connected");
|
|
9604
9590
|
break;
|
|
9605
9591
|
}
|
|
9606
9592
|
};
|
|
@@ -9615,88 +9601,6 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9615
9601
|
resolvePath = async (source, logger) => {
|
|
9616
9602
|
throw new DOMException("resolving a path to a file is not supported in browser");
|
|
9617
9603
|
};
|
|
9618
|
-
} else if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
9619
|
-
let RNFAName = "react-native-file-access";
|
|
9620
|
-
let RNFA;
|
|
9621
|
-
let RNFALoadError;
|
|
9622
|
-
try {
|
|
9623
|
-
RNFA = __require(RNFAName);
|
|
9624
|
-
} catch (e) {
|
|
9625
|
-
RNFALoadError = e;
|
|
9626
|
-
}
|
|
9627
|
-
let EFSName = "expo-file-system";
|
|
9628
|
-
let EFS;
|
|
9629
|
-
let EFSLoadError;
|
|
9630
|
-
try {
|
|
9631
|
-
EFS = __require(EFSName);
|
|
9632
|
-
} catch (e) {
|
|
9633
|
-
EFSLoadError = e;
|
|
9634
|
-
}
|
|
9635
|
-
resolvePath = async (source, logger) => {
|
|
9636
|
-
if (RNFA?.FileSystem?.readFileChunk !== void 0) {
|
|
9637
|
-
logger.debug("Using react-native-file-access to read local file");
|
|
9638
|
-
const bufferSize = 1024 * 1024;
|
|
9639
|
-
let pos = 0;
|
|
9640
|
-
const size = (await RNFA.FileSystem.stat(source.path)).size;
|
|
9641
|
-
let eof = false;
|
|
9642
|
-
const stream = new ReadableStream({
|
|
9643
|
-
async pull(controller) {
|
|
9644
|
-
if (eof) {
|
|
9645
|
-
return;
|
|
9646
|
-
}
|
|
9647
|
-
const chunkSize = Math.min(bufferSize, size - pos);
|
|
9648
|
-
const chunkAsB64 = await RNFA.FileSystem.readFileChunk(source.path, pos, chunkSize, "base64");
|
|
9649
|
-
if (chunkAsB64.length > 0) {
|
|
9650
|
-
const chunk = Buffer.from(chunkAsB64, "base64").subarray(0, chunkSize);
|
|
9651
|
-
controller.enqueue(chunk);
|
|
9652
|
-
pos += chunk.length;
|
|
9653
|
-
} else {
|
|
9654
|
-
eof = true;
|
|
9655
|
-
controller.close();
|
|
9656
|
-
}
|
|
9657
|
-
}
|
|
9658
|
-
});
|
|
9659
|
-
return {
|
|
9660
|
-
stream,
|
|
9661
|
-
size,
|
|
9662
|
-
mimeType: source.mimeType || "image/*"
|
|
9663
|
-
};
|
|
9664
|
-
}
|
|
9665
|
-
if (EFS?.readAsStringAsync !== void 0) {
|
|
9666
|
-
logger.debug("Using expo-file-system to read local file");
|
|
9667
|
-
const bufferSize = 1024 * 1024;
|
|
9668
|
-
const size = (await EFS.getInfoAsync(`file://${source.path}`)).size;
|
|
9669
|
-
let pos = 0;
|
|
9670
|
-
let eof = false;
|
|
9671
|
-
const stream = new ReadableStream({
|
|
9672
|
-
async pull(controller) {
|
|
9673
|
-
if (eof) {
|
|
9674
|
-
return;
|
|
9675
|
-
}
|
|
9676
|
-
const chunkSize = Math.min(bufferSize, size - pos);
|
|
9677
|
-
const chunkAsB64 = await EFS.readAsStringAsync(`file://${source.path}`, {
|
|
9678
|
-
length: chunkSize,
|
|
9679
|
-
position: pos,
|
|
9680
|
-
encoding: "base64"
|
|
9681
|
-
});
|
|
9682
|
-
if (chunkAsB64) {
|
|
9683
|
-
const chunk = Buffer.from(chunkAsB64, "base64");
|
|
9684
|
-
controller.enqueue(chunk);
|
|
9685
|
-
pos += chunk.length;
|
|
9686
|
-
} else {
|
|
9687
|
-
eof = true;
|
|
9688
|
-
controller.close();
|
|
9689
|
-
}
|
|
9690
|
-
}
|
|
9691
|
-
});
|
|
9692
|
-
return {
|
|
9693
|
-
stream,
|
|
9694
|
-
size,
|
|
9695
|
-
mimeType: source.mimeType || "image/*"
|
|
9696
|
-
};
|
|
9697
|
-
}
|
|
9698
|
-
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()`);
|
|
9699
|
-
};
|
|
9700
9604
|
} else {
|
|
9701
9605
|
let iteratorToStream = function(iterator) {
|
|
9702
9606
|
return new ReadableStream({
|
|
@@ -9732,534 +9636,51 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9732
9636
|
}
|
|
9733
9637
|
var iteratorToStream2;
|
|
9734
9638
|
|
|
9735
|
-
// shims/rn_http_header_parser.ts
|
|
9736
|
-
var startLine = /^[A-Z_]+(\/\d\.\d)? /;
|
|
9737
|
-
var requestLine = /^([A-Z_]+) (.+) [A-Z]+\/(\d)\.(\d)$/;
|
|
9738
|
-
var statusLine = /^[A-Z]+\/(\d)\.(\d) (\d{3}) (.*)$/;
|
|
9739
|
-
function parseHttpHeader(lines, onlyHeaders) {
|
|
9740
|
-
var line = lines[0];
|
|
9741
|
-
var match;
|
|
9742
|
-
if (onlyHeaders && startLine.test(line)) {
|
|
9743
|
-
return parseHeaders(lines);
|
|
9744
|
-
} else if ((match = line.match(requestLine)) !== null) {
|
|
9745
|
-
return {
|
|
9746
|
-
method: match[1],
|
|
9747
|
-
url: match[2],
|
|
9748
|
-
version: { major: parseInt(match[3], 10), minor: parseInt(match[4], 10) },
|
|
9749
|
-
headers: parseHeaders(lines)
|
|
9750
|
-
};
|
|
9751
|
-
} else if ((match = line.match(statusLine)) !== null) {
|
|
9752
|
-
return {
|
|
9753
|
-
version: { major: parseInt(match[1], 10), minor: parseInt(match[2], 10) },
|
|
9754
|
-
statusCode: parseInt(match[3], 10),
|
|
9755
|
-
statusMessage: match[4],
|
|
9756
|
-
headers: parseHeaders(lines)
|
|
9757
|
-
};
|
|
9758
|
-
} else {
|
|
9759
|
-
return parseHeaders(lines);
|
|
9760
|
-
}
|
|
9761
|
-
}
|
|
9762
|
-
function parseHeaders(lines) {
|
|
9763
|
-
var headers = {};
|
|
9764
|
-
var i = 0;
|
|
9765
|
-
var line = lines[i];
|
|
9766
|
-
var index, name, value;
|
|
9767
|
-
if (startLine.test(line)) {
|
|
9768
|
-
line = line[++i];
|
|
9769
|
-
}
|
|
9770
|
-
while (line) {
|
|
9771
|
-
if (line[0] === " " || line[0] === " ") {
|
|
9772
|
-
value += " " + line.trim();
|
|
9773
|
-
i++;
|
|
9774
|
-
if (i < lines.length) {
|
|
9775
|
-
line = lines[i];
|
|
9776
|
-
} else {
|
|
9777
|
-
line = "";
|
|
9778
|
-
}
|
|
9779
|
-
continue;
|
|
9780
|
-
}
|
|
9781
|
-
if (name && value) {
|
|
9782
|
-
addHeaderLine(name, value, headers);
|
|
9783
|
-
}
|
|
9784
|
-
index = line.indexOf(":");
|
|
9785
|
-
name = line.substr(0, index);
|
|
9786
|
-
value = line.substr(index + 1).trim();
|
|
9787
|
-
i++;
|
|
9788
|
-
if (i < lines.length) {
|
|
9789
|
-
line = lines[i];
|
|
9790
|
-
} else {
|
|
9791
|
-
line = "";
|
|
9792
|
-
}
|
|
9793
|
-
}
|
|
9794
|
-
if (name && value) {
|
|
9795
|
-
addHeaderLine(name, value, headers);
|
|
9796
|
-
}
|
|
9797
|
-
return headers;
|
|
9798
|
-
}
|
|
9799
|
-
function addHeaderLine(field, value, dest) {
|
|
9800
|
-
field = field.toLowerCase();
|
|
9801
|
-
switch (field) {
|
|
9802
|
-
// Array headers:
|
|
9803
|
-
case "set-cookie":
|
|
9804
|
-
if (dest[field] !== void 0) {
|
|
9805
|
-
dest[field].push(value);
|
|
9806
|
-
} else {
|
|
9807
|
-
dest[field] = [value];
|
|
9808
|
-
}
|
|
9809
|
-
break;
|
|
9810
|
-
// list is taken from:
|
|
9811
|
-
// https://mxr.mozilla.org/mozilla/source/netwerk/protocol/http/src/nsHttpHeaderArray.cpp
|
|
9812
|
-
case "content-type":
|
|
9813
|
-
case "content-length":
|
|
9814
|
-
case "user-agent":
|
|
9815
|
-
case "referer":
|
|
9816
|
-
case "host":
|
|
9817
|
-
case "authorization":
|
|
9818
|
-
case "proxy-authorization":
|
|
9819
|
-
case "if-modified-since":
|
|
9820
|
-
case "if-unmodified-since":
|
|
9821
|
-
case "from":
|
|
9822
|
-
case "location":
|
|
9823
|
-
case "max-forwards":
|
|
9824
|
-
case "retry-after":
|
|
9825
|
-
case "etag":
|
|
9826
|
-
case "last-modified":
|
|
9827
|
-
case "server":
|
|
9828
|
-
case "age":
|
|
9829
|
-
case "expires":
|
|
9830
|
-
if (dest[field] === void 0) dest[field] = value;
|
|
9831
|
-
break;
|
|
9832
|
-
default:
|
|
9833
|
-
if (typeof dest[field] === "string") {
|
|
9834
|
-
dest[field] += ", " + value;
|
|
9835
|
-
} else {
|
|
9836
|
-
dest[field] = value;
|
|
9837
|
-
}
|
|
9838
|
-
}
|
|
9839
|
-
}
|
|
9840
|
-
|
|
9841
|
-
// shims/rn_http_response_parser.ts
|
|
9842
|
-
var ResponseParser = class {
|
|
9843
|
-
constructor(logger, resolve, reject) {
|
|
9844
|
-
this.responseChunkRemainder = 0;
|
|
9845
|
-
this.logger = logger;
|
|
9846
|
-
this.resolve = resolve;
|
|
9847
|
-
this.reject = reject;
|
|
9848
|
-
this.error = null;
|
|
9849
|
-
this.responseReadBuffer = void 0;
|
|
9850
|
-
this.responseState = 0 /* RECEIVING_HEADER */;
|
|
9851
|
-
this.pullController = void 0;
|
|
9852
|
-
this.pullResolve = void 0;
|
|
9853
|
-
this.pullReject = void 0;
|
|
9854
|
-
}
|
|
9855
|
-
processResponseReadBuffer(data) {
|
|
9856
|
-
if (this.error) {
|
|
9857
|
-
this.logger.info(`RN http streamed response, received ${data.length} bytes in error mode`);
|
|
9858
|
-
return false;
|
|
9859
|
-
}
|
|
9860
|
-
if (this.responseReadBuffer) {
|
|
9861
|
-
this.responseReadBuffer = Buffer.concat([this.responseReadBuffer, data]);
|
|
9862
|
-
} else {
|
|
9863
|
-
this.responseReadBuffer = Buffer.from(data.subarray());
|
|
9864
|
-
}
|
|
9865
|
-
if (this.responseState === 3 /* RECEIVING_COMPLETED */) {
|
|
9866
|
-
if (this.pullController) {
|
|
9867
|
-
this.pullController.close();
|
|
9868
|
-
if (this.pullResolve) {
|
|
9869
|
-
this.pullResolve();
|
|
9870
|
-
}
|
|
9871
|
-
}
|
|
9872
|
-
return false;
|
|
9873
|
-
} else if (this.responseState === 0 /* RECEIVING_HEADER */) {
|
|
9874
|
-
const headerEnd = this.responseReadBuffer.indexOf("\r\n\r\n");
|
|
9875
|
-
if (headerEnd >= 0) {
|
|
9876
|
-
let headerChunk = this.responseReadBuffer.subarray(0, headerEnd + 4);
|
|
9877
|
-
this.responseReadBuffer = Buffer.from(this.responseReadBuffer.subarray(headerEnd + 4));
|
|
9878
|
-
const maxHeaderLines = 128;
|
|
9879
|
-
let responseHeaderLines = [];
|
|
9880
|
-
const lineDecoder = new EyepopLineDecoder();
|
|
9881
|
-
for (const line of lineDecoder.decode(headerChunk)) {
|
|
9882
|
-
if (line.length > 0) {
|
|
9883
|
-
responseHeaderLines.push(line);
|
|
9884
|
-
if (responseHeaderLines.length > maxHeaderLines) {
|
|
9885
|
-
this.error = `Response header exceeds ${maxHeaderLines} lines`;
|
|
9886
|
-
this.reject(this.error);
|
|
9887
|
-
return false;
|
|
9888
|
-
}
|
|
9889
|
-
}
|
|
9890
|
-
}
|
|
9891
|
-
let responseHeader = parseHttpHeader(responseHeaderLines, false);
|
|
9892
|
-
if (responseHeader.statusCode === void 0) {
|
|
9893
|
-
this.logger.warn(`Could not find status header in HTTP response ${JSON.stringify(responseHeader)}`);
|
|
9894
|
-
this.reject("missing status header in HTTP response");
|
|
9895
|
-
return false;
|
|
9896
|
-
}
|
|
9897
|
-
const headers = new Headers(responseHeader.headers);
|
|
9898
|
-
if (headers.has("transfer-encoding")) {
|
|
9899
|
-
if (headers.get("transfer-encoding")?.toLowerCase() === "chunked") {
|
|
9900
|
-
this.responseState = 2 /* RECEIVING_BODY_CHUNKED */;
|
|
9901
|
-
this.responseChunkRemainder = 0;
|
|
9902
|
-
} else {
|
|
9903
|
-
this.error = `Response with unsupported transfer-encoding '${headers.get("transfer-encoding")}'`;
|
|
9904
|
-
this.reject(this.error);
|
|
9905
|
-
return false;
|
|
9906
|
-
}
|
|
9907
|
-
} else if (headers.has("content-length")) {
|
|
9908
|
-
this.responseState = 1 /* RECEIVING_BODY */;
|
|
9909
|
-
this.responseChunkRemainder = parseInt(headers.get("content-length") || "-1");
|
|
9910
|
-
} else {
|
|
9911
|
-
this.responseState = 2 /* RECEIVING_BODY_CHUNKED */;
|
|
9912
|
-
this.responseChunkRemainder = 0;
|
|
9913
|
-
}
|
|
9914
|
-
const responseBody = new ReadableStream({
|
|
9915
|
-
pull: (controller) => {
|
|
9916
|
-
if (this.error || this.responseState == 3 /* RECEIVING_COMPLETED */) {
|
|
9917
|
-
return;
|
|
9918
|
-
}
|
|
9919
|
-
if (this.pull(controller)) {
|
|
9920
|
-
return;
|
|
9921
|
-
}
|
|
9922
|
-
return new Promise((resolve, reject) => {
|
|
9923
|
-
if (this.pullController) {
|
|
9924
|
-
if (this.pullReject) {
|
|
9925
|
-
this.pullReject("pull, we got a pending controller already");
|
|
9926
|
-
}
|
|
9927
|
-
}
|
|
9928
|
-
this.pullController = controller;
|
|
9929
|
-
this.pullResolve = resolve;
|
|
9930
|
-
this.pullReject = reject;
|
|
9931
|
-
});
|
|
9932
|
-
},
|
|
9933
|
-
cancel: (reason) => {
|
|
9934
|
-
if (!this.error) {
|
|
9935
|
-
this.error = `cancelled: ${reason}`;
|
|
9936
|
-
this.reject(this.error);
|
|
9937
|
-
}
|
|
9938
|
-
}
|
|
9939
|
-
});
|
|
9940
|
-
this.resolve(new Response(responseBody, {
|
|
9941
|
-
status: responseHeader.statusCode,
|
|
9942
|
-
statusText: responseHeader.statusText,
|
|
9943
|
-
headers
|
|
9944
|
-
}));
|
|
9945
|
-
}
|
|
9946
|
-
} else if (this.pullController) {
|
|
9947
|
-
if (this.pull(this.pullController)) {
|
|
9948
|
-
this.pullController = void 0;
|
|
9949
|
-
if (this.pullResolve) {
|
|
9950
|
-
this.pullResolve();
|
|
9951
|
-
}
|
|
9952
|
-
this.pullResolve = void 0;
|
|
9953
|
-
this.pullReject = void 0;
|
|
9954
|
-
}
|
|
9955
|
-
}
|
|
9956
|
-
return true;
|
|
9957
|
-
}
|
|
9958
|
-
pull(controller) {
|
|
9959
|
-
if (this.responseState == 3 /* RECEIVING_COMPLETED */) {
|
|
9960
|
-
controller.close();
|
|
9961
|
-
return false;
|
|
9962
|
-
}
|
|
9963
|
-
if (this.responseReadBuffer === void 0) {
|
|
9964
|
-
return false;
|
|
9965
|
-
}
|
|
9966
|
-
if (this.responseState == 1 /* RECEIVING_BODY */) {
|
|
9967
|
-
controller.enqueue(this.responseReadBuffer);
|
|
9968
|
-
this.responseChunkRemainder -= this.responseReadBuffer.length;
|
|
9969
|
-
this.responseReadBuffer = void 0;
|
|
9970
|
-
if (this.responseChunkRemainder <= 0) {
|
|
9971
|
-
this.responseState = 3 /* RECEIVING_COMPLETED */;
|
|
9972
|
-
controller.close();
|
|
9973
|
-
}
|
|
9974
|
-
return true;
|
|
9975
|
-
} else if (this.responseState == 2 /* RECEIVING_BODY_CHUNKED */) {
|
|
9976
|
-
while (this.responseReadBuffer.length > 1) {
|
|
9977
|
-
if (this.responseChunkRemainder == 0) {
|
|
9978
|
-
let chunkHeaderEnd = 0;
|
|
9979
|
-
while (this.responseReadBuffer.length >= 2 && chunkHeaderEnd == 0) {
|
|
9980
|
-
chunkHeaderEnd = this.responseReadBuffer.indexOf("\r\n");
|
|
9981
|
-
if (chunkHeaderEnd == 0) {
|
|
9982
|
-
this.responseReadBuffer = Buffer.from(this.responseReadBuffer.subarray(2));
|
|
9983
|
-
}
|
|
9984
|
-
}
|
|
9985
|
-
if (chunkHeaderEnd > 0) {
|
|
9986
|
-
this.responseChunkRemainder = parseInt(Buffer.from(this.responseReadBuffer, 0, chunkHeaderEnd).toString("utf8"), 16);
|
|
9987
|
-
this.responseReadBuffer = Buffer.from(this.responseReadBuffer.subarray(chunkHeaderEnd + 2));
|
|
9988
|
-
if (this.responseChunkRemainder <= 0) {
|
|
9989
|
-
this.responseState = 3 /* RECEIVING_COMPLETED */;
|
|
9990
|
-
controller.close();
|
|
9991
|
-
return true;
|
|
9992
|
-
}
|
|
9993
|
-
} else if (this.responseReadBuffer.length > 64) {
|
|
9994
|
-
this.error = "Cannot find chunked encoding header within 64 bytes, given up";
|
|
9995
|
-
controller.error(this.error);
|
|
9996
|
-
}
|
|
9997
|
-
}
|
|
9998
|
-
if (this.responseChunkRemainder > 0 && this.responseReadBuffer.length > 0) {
|
|
9999
|
-
const chunk = Buffer.from(this.responseReadBuffer.subarray(0, this.responseChunkRemainder));
|
|
10000
|
-
this.responseReadBuffer = Buffer.from(this.responseReadBuffer.subarray(this.responseChunkRemainder));
|
|
10001
|
-
controller.enqueue(chunk);
|
|
10002
|
-
this.responseChunkRemainder -= chunk.length;
|
|
10003
|
-
return true;
|
|
10004
|
-
} else {
|
|
10005
|
-
break;
|
|
10006
|
-
}
|
|
10007
|
-
}
|
|
10008
|
-
} else {
|
|
10009
|
-
this.error = `Received more data in wrong state ${this.responseState}`;
|
|
10010
|
-
controller.error(this.error);
|
|
10011
|
-
}
|
|
10012
|
-
return false;
|
|
10013
|
-
}
|
|
10014
|
-
};
|
|
10015
|
-
|
|
10016
|
-
// shims/rn_streaming_fetch.ts
|
|
10017
|
-
async function reactNativeStreamingFetch(url, method, headers, body, contentLength, sockets, logger) {
|
|
10018
|
-
const isHttps = url.protocol == "https:";
|
|
10019
|
-
const port = url.port ? parseInt(url.port) : isHttps ? 443 : 80;
|
|
10020
|
-
return new Promise((resolve, reject) => {
|
|
10021
|
-
const connectOptions = {
|
|
10022
|
-
port,
|
|
10023
|
-
host: url.hostname,
|
|
10024
|
-
reuseAddress: true
|
|
10025
|
-
};
|
|
10026
|
-
const clientSocket = new sockets.Socket();
|
|
10027
|
-
const client = isHttps ? new sockets.TLSSocket(clientSocket) : clientSocket;
|
|
10028
|
-
let error;
|
|
10029
|
-
const responseParser = new ResponseParser(logger, resolve, (reason) => {
|
|
10030
|
-
error = reason;
|
|
10031
|
-
reject(error);
|
|
10032
|
-
client.destroy();
|
|
10033
|
-
});
|
|
10034
|
-
client.on("data", function(data) {
|
|
10035
|
-
responseParser.processResponseReadBuffer(data);
|
|
10036
|
-
});
|
|
10037
|
-
client.on("error", function(err) {
|
|
10038
|
-
logger.info(`error: ${err}`);
|
|
10039
|
-
if (!error) {
|
|
10040
|
-
error = err;
|
|
10041
|
-
reject(error);
|
|
10042
|
-
}
|
|
10043
|
-
client.destroy();
|
|
10044
|
-
});
|
|
10045
|
-
client.on("close", function() {
|
|
10046
|
-
if (!error) {
|
|
10047
|
-
error = "socket closed";
|
|
10048
|
-
reject(error);
|
|
10049
|
-
}
|
|
10050
|
-
});
|
|
10051
|
-
client.connect(connectOptions, async () => {
|
|
10052
|
-
const headerLines = [
|
|
10053
|
-
`${method} ${url.pathname}${url.search} HTTP/1.1\r
|
|
10054
|
-
`,
|
|
10055
|
-
`Host: ${url.host}\r
|
|
10056
|
-
`
|
|
10057
|
-
];
|
|
10058
|
-
headers.forEach((value, key) => {
|
|
10059
|
-
headerLines.push(`${key}: ${value}\r
|
|
10060
|
-
`);
|
|
10061
|
-
});
|
|
10062
|
-
headerLines.push("\r\n");
|
|
10063
|
-
const textEncoder = new TextEncoder();
|
|
10064
|
-
const headerChunk = headerLines.join("");
|
|
10065
|
-
const bodyReader = body ? body.getReader() : void 0;
|
|
10066
|
-
let headerEnqueued = false;
|
|
10067
|
-
let eof = false;
|
|
10068
|
-
const readableHeaderChunkedBody = new ReadableStream({
|
|
10069
|
-
async pull(controller) {
|
|
10070
|
-
if (!headerEnqueued) {
|
|
10071
|
-
controller.enqueue(headerChunk);
|
|
10072
|
-
headerEnqueued = true;
|
|
10073
|
-
return;
|
|
10074
|
-
}
|
|
10075
|
-
if (eof) {
|
|
10076
|
-
controller.close();
|
|
10077
|
-
return;
|
|
10078
|
-
}
|
|
10079
|
-
if (!bodyReader) {
|
|
10080
|
-
controller.close();
|
|
10081
|
-
return;
|
|
10082
|
-
}
|
|
10083
|
-
const chunk = await bodyReader.read();
|
|
10084
|
-
if (chunk.value) {
|
|
10085
|
-
let outputChunk;
|
|
10086
|
-
if (contentLength) {
|
|
10087
|
-
outputChunk = chunk.value;
|
|
10088
|
-
} else {
|
|
10089
|
-
outputChunk = Buffer.concat([
|
|
10090
|
-
textEncoder.encode(`${chunk.value.length.toString(16)}\r
|
|
10091
|
-
`),
|
|
10092
|
-
chunk.value,
|
|
10093
|
-
textEncoder.encode(`\r
|
|
10094
|
-
`)
|
|
10095
|
-
]);
|
|
10096
|
-
}
|
|
10097
|
-
controller.enqueue(outputChunk);
|
|
10098
|
-
} else if (chunk.done) {
|
|
10099
|
-
if (!contentLength) {
|
|
10100
|
-
controller.enqueue(Buffer.from(`0\r
|
|
10101
|
-
\r
|
|
10102
|
-
`, "utf8"));
|
|
10103
|
-
}
|
|
10104
|
-
eof = true;
|
|
10105
|
-
}
|
|
10106
|
-
}
|
|
10107
|
-
});
|
|
10108
|
-
const readableHeaderChunkedBodyReader = readableHeaderChunkedBody.getReader();
|
|
10109
|
-
const pipeChunk = async () => {
|
|
10110
|
-
while (true) {
|
|
10111
|
-
try {
|
|
10112
|
-
const chunk = await readableHeaderChunkedBodyReader.read();
|
|
10113
|
-
if (chunk.value) {
|
|
10114
|
-
if (!client.write(chunk.value)) {
|
|
10115
|
-
break;
|
|
10116
|
-
}
|
|
10117
|
-
} else if (chunk.done) {
|
|
10118
|
-
break;
|
|
10119
|
-
}
|
|
10120
|
-
} catch (e) {
|
|
10121
|
-
logger.error(e);
|
|
10122
|
-
break;
|
|
10123
|
-
}
|
|
10124
|
-
}
|
|
10125
|
-
};
|
|
10126
|
-
client.on("drain", pipeChunk);
|
|
10127
|
-
await pipeChunk();
|
|
10128
|
-
});
|
|
10129
|
-
});
|
|
10130
|
-
}
|
|
10131
|
-
|
|
10132
9639
|
// shims/http_client.ts
|
|
10133
9640
|
var createHttpClient;
|
|
9641
|
+
function logLineFromRequest(input, init) {
|
|
9642
|
+
const url = input instanceof Request ? input.url : input;
|
|
9643
|
+
const method = input instanceof Request ? input.method : init?.method || (init?.body !== void 0 ? "POST" : "GET");
|
|
9644
|
+
return `${method} ${url}`;
|
|
9645
|
+
}
|
|
10134
9646
|
if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
10135
9647
|
class BrowserHttpClient {
|
|
10136
|
-
constructor() {
|
|
10137
|
-
}
|
|
10138
|
-
async fetch(input, init) {
|
|
10139
|
-
return await fetch(input, init);
|
|
10140
|
-
}
|
|
10141
|
-
async close() {
|
|
10142
|
-
}
|
|
10143
|
-
isFullDuplex() {
|
|
10144
|
-
return false;
|
|
10145
|
-
}
|
|
10146
|
-
}
|
|
10147
|
-
createHttpClient = async (logger) => {
|
|
10148
|
-
logger.debug("Using browser fetch as http client");
|
|
10149
|
-
return new BrowserHttpClient();
|
|
10150
|
-
};
|
|
10151
|
-
} else if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
10152
|
-
let RNName = "react-native";
|
|
10153
|
-
let RN;
|
|
10154
|
-
let TcpSocketsName = "react-native-tcp-socket";
|
|
10155
|
-
let TcpSockets;
|
|
10156
|
-
let TcpSocketsError;
|
|
10157
|
-
try {
|
|
10158
|
-
RN = __require(RNName);
|
|
10159
|
-
TcpSockets = __require(TcpSocketsName);
|
|
10160
|
-
if (TcpSockets?.TLSSocket) {
|
|
10161
|
-
if (!RN?.NativeModules?.TcpSockets) {
|
|
10162
|
-
TcpSockets = void 0;
|
|
10163
|
-
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`);
|
|
10164
|
-
}
|
|
10165
|
-
}
|
|
10166
|
-
} catch (e) {
|
|
10167
|
-
TcpSocketsError = e;
|
|
10168
|
-
}
|
|
10169
|
-
class ReactNativeHttpClient {
|
|
10170
9648
|
constructor(logger) {
|
|
10171
|
-
this.
|
|
9649
|
+
this._logger = logger;
|
|
10172
9650
|
}
|
|
10173
9651
|
async fetch(input, init) {
|
|
10174
|
-
|
|
10175
|
-
|
|
10176
|
-
|
|
10177
|
-
|
|
10178
|
-
|
|
10179
|
-
}
|
|
10180
|
-
} else if (init?.body instanceof ReadableStream) {
|
|
10181
|
-
streamBody = init.body;
|
|
10182
|
-
}
|
|
10183
|
-
if (streamBody) {
|
|
10184
|
-
if (TcpSockets?.TLSSocket !== void 0) {
|
|
10185
|
-
let url;
|
|
10186
|
-
let method;
|
|
10187
|
-
let headers;
|
|
10188
|
-
if (input instanceof Request) {
|
|
10189
|
-
url = new URL(input.url);
|
|
10190
|
-
method = input.method;
|
|
10191
|
-
headers = input.headers;
|
|
10192
|
-
} else {
|
|
10193
|
-
if (input instanceof URL) {
|
|
10194
|
-
url = input;
|
|
10195
|
-
} else {
|
|
10196
|
-
url = new URL(input);
|
|
10197
|
-
}
|
|
10198
|
-
method = init?.method || "POST";
|
|
10199
|
-
headers = new Headers(init?.headers);
|
|
10200
|
-
}
|
|
10201
|
-
let contentLength = void 0;
|
|
10202
|
-
if (headers.has("content-length")) {
|
|
10203
|
-
contentLength = parseInt(headers.get("content-length") || "");
|
|
10204
|
-
} else {
|
|
10205
|
-
headers.append("Transfer-Encoding", "chunked");
|
|
10206
|
-
}
|
|
10207
|
-
return await reactNativeStreamingFetch(
|
|
10208
|
-
url,
|
|
10209
|
-
method,
|
|
10210
|
-
headers,
|
|
10211
|
-
streamBody,
|
|
10212
|
-
contentLength,
|
|
10213
|
-
TcpSockets,
|
|
10214
|
-
this.logger
|
|
10215
|
-
);
|
|
10216
|
-
} else {
|
|
10217
|
-
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.`);
|
|
10218
|
-
try {
|
|
10219
|
-
const chunks = [];
|
|
10220
|
-
const reader = streamBody.getReader();
|
|
10221
|
-
while (true) {
|
|
10222
|
-
const { done, value } = await reader.read();
|
|
10223
|
-
if (done) {
|
|
10224
|
-
break;
|
|
10225
|
-
}
|
|
10226
|
-
chunks.push(value);
|
|
10227
|
-
}
|
|
10228
|
-
if (input instanceof Request) {
|
|
10229
|
-
input = new Request(input, { body: Buffer.concat(chunks) });
|
|
10230
|
-
} else {
|
|
10231
|
-
init.body = Buffer.concat(chunks);
|
|
10232
|
-
}
|
|
10233
|
-
} catch (e) {
|
|
10234
|
-
return Promise.reject(e);
|
|
10235
|
-
}
|
|
10236
|
-
}
|
|
10237
|
-
}
|
|
10238
|
-
init.reactNative = { textStreaming: true };
|
|
10239
|
-
return await fetch(input, init);
|
|
9652
|
+
const logLine = logLineFromRequest(input, init);
|
|
9653
|
+
this._logger.debug(`Browser fetch() BEFORE ${logLine}`);
|
|
9654
|
+
const response = await fetch(input, init);
|
|
9655
|
+
this._logger.debug(`AFTER ${logLine} -> ${response.status}`);
|
|
9656
|
+
return response;
|
|
10240
9657
|
}
|
|
10241
9658
|
async close() {
|
|
10242
9659
|
}
|
|
10243
9660
|
isFullDuplex() {
|
|
10244
|
-
return
|
|
9661
|
+
return false;
|
|
10245
9662
|
}
|
|
10246
9663
|
}
|
|
10247
9664
|
createHttpClient = async (logger) => {
|
|
10248
|
-
|
|
10249
|
-
return new ReactNativeHttpClient(logger);
|
|
9665
|
+
return new BrowserHttpClient(logger);
|
|
10250
9666
|
};
|
|
10251
9667
|
} else {
|
|
10252
9668
|
class NodeHttpClient {
|
|
10253
|
-
constructor(agent) {
|
|
10254
|
-
this.
|
|
9669
|
+
constructor(agent, logger) {
|
|
9670
|
+
this._agent = agent;
|
|
9671
|
+
this._logger = logger;
|
|
10255
9672
|
}
|
|
10256
9673
|
async fetch(input, init) {
|
|
10257
9674
|
init || (init = {});
|
|
10258
|
-
init.dispatcher = this.
|
|
10259
|
-
|
|
9675
|
+
init.dispatcher = this._agent;
|
|
9676
|
+
const logLine = logLineFromRequest(input, init);
|
|
9677
|
+
this._logger.debug(`Node fetch() BEFORE ${logLine}`);
|
|
9678
|
+
const response = await fetch(input, init);
|
|
9679
|
+
this._logger.debug(`AFTER ${logLine} -> ${response.status}`);
|
|
9680
|
+
return response;
|
|
10260
9681
|
}
|
|
10261
9682
|
async close() {
|
|
10262
|
-
return this.
|
|
9683
|
+
return this._agent.close();
|
|
10263
9684
|
}
|
|
10264
9685
|
isFullDuplex() {
|
|
10265
9686
|
return false;
|
|
@@ -10274,7 +9695,7 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
10274
9695
|
pipelining: 0
|
|
10275
9696
|
});
|
|
10276
9697
|
logger.debug("Using node fetch with undici agent as http client");
|
|
10277
|
-
return new NodeHttpClient(agent);
|
|
9698
|
+
return new NodeHttpClient(agent, logger);
|
|
10278
9699
|
};
|
|
10279
9700
|
}
|
|
10280
9701
|
|
|
@@ -10545,7 +9966,11 @@ var Endpoint = class {
|
|
|
10545
9966
|
} else {
|
|
10546
9967
|
return Promise.reject("option secretKey or environment variable EYEPOP_SECRET_KEY is required");
|
|
10547
9968
|
}
|
|
10548
|
-
this.
|
|
9969
|
+
if (this._options.platformSupport?.createHttpClient !== void 0) {
|
|
9970
|
+
this._client = await this._options.platformSupport.createHttpClient(this._requestLogger);
|
|
9971
|
+
} else {
|
|
9972
|
+
this._client = await createHttpClient(this._requestLogger);
|
|
9973
|
+
}
|
|
10549
9974
|
return await this.reconnect();
|
|
10550
9975
|
}
|
|
10551
9976
|
async disconnect(wait = true) {
|
|
@@ -10639,7 +10064,6 @@ var Endpoint = class {
|
|
|
10639
10064
|
const body = { secret_key: secretKeyAuth.secretKey };
|
|
10640
10065
|
const headers = { "Content-Type": "application/json" };
|
|
10641
10066
|
const post_url = `${this.eyepopUrl()}/authentication/token`;
|
|
10642
|
-
this._requestLogger.debug("before POST %s", post_url);
|
|
10643
10067
|
const response = await this._client.fetch(post_url, {
|
|
10644
10068
|
method: "POST",
|
|
10645
10069
|
headers,
|
|
@@ -10649,7 +10073,6 @@ var Endpoint = class {
|
|
|
10649
10073
|
const message = await response.text();
|
|
10650
10074
|
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
10651
10075
|
}
|
|
10652
|
-
this._requestLogger.debug("after POST %s", post_url);
|
|
10653
10076
|
const data = await response.json();
|
|
10654
10077
|
const token = data;
|
|
10655
10078
|
this._token = token.access_token;
|
|
@@ -10702,12 +10125,10 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10702
10125
|
const headers = {
|
|
10703
10126
|
Authorization: await this.authorizationHeader()
|
|
10704
10127
|
};
|
|
10705
|
-
this._requestLogger.debug("before DELETE %s", deleteUrl);
|
|
10706
10128
|
let response = await this._client?.fetch(deleteUrl, {
|
|
10707
10129
|
method: "DELETE",
|
|
10708
10130
|
headers
|
|
10709
10131
|
});
|
|
10710
|
-
this._requestLogger.debug("after DELETE %s", deleteUrl);
|
|
10711
10132
|
if (response?.status != 204) {
|
|
10712
10133
|
const message = await response?.text();
|
|
10713
10134
|
this._logger.info(`stoppping pipeline failed, status ${response?.status}: ${message}`);
|
|
@@ -10718,12 +10139,10 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10718
10139
|
const headers = {
|
|
10719
10140
|
Authorization: await this.authorizationHeader()
|
|
10720
10141
|
};
|
|
10721
|
-
this._requestLogger.debug("before DELETE %s", sandboxUrl);
|
|
10722
10142
|
let response = await this._client?.fetch(sandboxUrl, {
|
|
10723
10143
|
method: "DELETE",
|
|
10724
10144
|
headers
|
|
10725
10145
|
});
|
|
10726
|
-
this._requestLogger.debug("after DELETE %s", sandboxUrl);
|
|
10727
10146
|
if (response?.status != 204) {
|
|
10728
10147
|
const message = await response?.text();
|
|
10729
10148
|
this._logger.info(`disconnecting sandbox failed, status ${response?.status}: ${message}`);
|
|
@@ -10769,7 +10188,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10769
10188
|
const client = this._client;
|
|
10770
10189
|
const baseUrl = this._baseUrl;
|
|
10771
10190
|
if (!baseUrl || !client) {
|
|
10772
|
-
return Promise.reject("endpoint not connected, use connect()
|
|
10191
|
+
return Promise.reject("endpoint not connected, use connect()");
|
|
10773
10192
|
}
|
|
10774
10193
|
let response = await this.fetchWithRetry(async () => {
|
|
10775
10194
|
const session = await this.session();
|
|
@@ -10778,7 +10197,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10778
10197
|
...this._authenticationHeaders(session)
|
|
10779
10198
|
};
|
|
10780
10199
|
const patch_url = `${session.baseUrl}/pipelines/${session.pipelineId}/pop`;
|
|
10781
|
-
this._requestLogger.debug("before PATCH %s - %s", patch_url, JSON.stringify(pop));
|
|
10782
10200
|
return await client.fetch(patch_url, {
|
|
10783
10201
|
method: "PATCH",
|
|
10784
10202
|
body: JSON.stringify(pop),
|
|
@@ -10789,7 +10207,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10789
10207
|
const message = await response.text();
|
|
10790
10208
|
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
10791
10209
|
}
|
|
10792
|
-
this._requestLogger.debug("after PATCH pop");
|
|
10793
10210
|
if (this._pipeline) {
|
|
10794
10211
|
this._pipeline.pop = pop;
|
|
10795
10212
|
}
|
|
@@ -10814,7 +10231,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10814
10231
|
const client = this._client;
|
|
10815
10232
|
const baseUrl = this._baseUrl;
|
|
10816
10233
|
if (!baseUrl || !client) {
|
|
10817
|
-
return Promise.reject("endpoint not connected, use connect()
|
|
10234
|
+
return Promise.reject("endpoint not connected, use connect()");
|
|
10818
10235
|
}
|
|
10819
10236
|
const body = {
|
|
10820
10237
|
pipeline: popComp,
|
|
@@ -10859,7 +10276,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10859
10276
|
const client = this._client;
|
|
10860
10277
|
const baseUrl = this._baseUrl;
|
|
10861
10278
|
if (!baseUrl || !client) {
|
|
10862
|
-
return Promise.reject("endpoint not connected, use connect()
|
|
10279
|
+
return Promise.reject("endpoint not connected, use connect()");
|
|
10863
10280
|
}
|
|
10864
10281
|
const body = {
|
|
10865
10282
|
transform: postTransform
|
|
@@ -10898,7 +10315,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10898
10315
|
}
|
|
10899
10316
|
async liveIngress(stream) {
|
|
10900
10317
|
if (!this._baseUrl || !this._client) {
|
|
10901
|
-
return Promise.reject("endpoint not connected, use connect()
|
|
10318
|
+
return Promise.reject("endpoint not connected, use connect()");
|
|
10902
10319
|
}
|
|
10903
10320
|
const whip = new WebrtcWhip(
|
|
10904
10321
|
stream,
|
|
@@ -10912,7 +10329,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10912
10329
|
}
|
|
10913
10330
|
async liveEgress(ingressId) {
|
|
10914
10331
|
if (!this._baseUrl || !this._client) {
|
|
10915
|
-
return Promise.reject("endpoint not connected, use connect()
|
|
10332
|
+
return Promise.reject("endpoint not connected, use connect()");
|
|
10916
10333
|
}
|
|
10917
10334
|
const whep = new WebrtcWhep(
|
|
10918
10335
|
ingressId,
|
|
@@ -10972,7 +10389,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10972
10389
|
}
|
|
10973
10390
|
async uploadFile(source, params) {
|
|
10974
10391
|
if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
|
|
10975
|
-
return Promise.reject("endpoint not connected, use connect()
|
|
10392
|
+
return Promise.reject("endpoint not connected, use connect()");
|
|
10976
10393
|
}
|
|
10977
10394
|
await this._limit.acquire();
|
|
10978
10395
|
try {
|
|
@@ -11004,7 +10421,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11004
10421
|
}
|
|
11005
10422
|
async uploadStream(source, params) {
|
|
11006
10423
|
if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
|
|
11007
|
-
return Promise.reject("endpoint not connected, use connect()
|
|
10424
|
+
return Promise.reject("endpoint not connected, use connect()");
|
|
11008
10425
|
}
|
|
11009
10426
|
await this._limit.acquire();
|
|
11010
10427
|
try {
|
|
@@ -11036,12 +10453,17 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11036
10453
|
}
|
|
11037
10454
|
async uploadPath(source, params) {
|
|
11038
10455
|
if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
|
|
11039
|
-
throw new Error("endpoint not connected, use connect()
|
|
10456
|
+
throw new Error("endpoint not connected, use connect()");
|
|
11040
10457
|
}
|
|
11041
10458
|
await this._limit.acquire();
|
|
11042
10459
|
try {
|
|
11043
10460
|
this.updateState();
|
|
11044
|
-
|
|
10461
|
+
let streamSource;
|
|
10462
|
+
if (this._options.platformSupport?.resolvePath) {
|
|
10463
|
+
streamSource = await this._options.platformSupport.resolvePath(source, this._logger);
|
|
10464
|
+
} else {
|
|
10465
|
+
streamSource = await resolvePath(source, this._logger);
|
|
10466
|
+
}
|
|
11045
10467
|
const job = new UploadJob(
|
|
11046
10468
|
streamSource.stream,
|
|
11047
10469
|
streamSource.mimeType,
|
|
@@ -11074,7 +10496,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11074
10496
|
}, params);
|
|
11075
10497
|
}
|
|
11076
10498
|
if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
|
|
11077
|
-
throw new Error("endpoint not connected, use connect()
|
|
10499
|
+
throw new Error("endpoint not connected, use connect()");
|
|
11078
10500
|
}
|
|
11079
10501
|
await this._limit.acquire();
|
|
11080
10502
|
try {
|
|
@@ -11103,7 +10525,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11103
10525
|
}
|
|
11104
10526
|
async loadLiveIngress(source, params) {
|
|
11105
10527
|
if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
|
|
11106
|
-
throw new Error("endpoint not connected, use connect()
|
|
10528
|
+
throw new Error("endpoint not connected, use connect()");
|
|
11107
10529
|
}
|
|
11108
10530
|
await this._limit.acquire();
|
|
11109
10531
|
try {
|
|
@@ -11155,10 +10577,9 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11155
10577
|
Authorization: await this.authorizationHeader()
|
|
11156
10578
|
};
|
|
11157
10579
|
this.updateState("FetchConfig" /* FetchConfig */);
|
|
11158
|
-
this._requestLogger.debug("before GET %s", config_url);
|
|
11159
10580
|
let response = await this._client.fetch(config_url, { headers });
|
|
11160
10581
|
if (response.status == 401) {
|
|
11161
|
-
this._requestLogger.debug("
|
|
10582
|
+
this._requestLogger.debug("GET %s: 401, about to retry with fresh access token", config_url);
|
|
11162
10583
|
this.statusHandler401(response.status);
|
|
11163
10584
|
const headers2 = {
|
|
11164
10585
|
Authorization: await this.authorizationHeader()
|
|
@@ -11178,7 +10599,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11178
10599
|
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
11179
10600
|
}
|
|
11180
10601
|
let config = await response.json();
|
|
11181
|
-
this._requestLogger.debug("after GET %s", config_url);
|
|
11182
10602
|
if (!config.base_url && this.options().autoStart) {
|
|
11183
10603
|
const auto_start_config_url = `${this.eyepopUrl()}/pops/${this.options().popId}/config?auto_start=true`;
|
|
11184
10604
|
this._requestLogger.debug("pop was not running, trying to autostart with: %s", auto_start_config_url);
|
|
@@ -11204,7 +10624,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11204
10624
|
Authorization: await this.authorizationHeader()
|
|
11205
10625
|
};
|
|
11206
10626
|
const createSandboxUrl = `${this._baseUrl}/sandboxes`;
|
|
11207
|
-
this._requestLogger.debug("before POST %s", createSandboxUrl);
|
|
11208
10627
|
const response3 = await this._client.fetch(createSandboxUrl, {
|
|
11209
10628
|
method: "POST",
|
|
11210
10629
|
headers: headers3
|
|
@@ -11214,7 +10633,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11214
10633
|
return Promise.reject(`Unexpected status ${response3.status}: ${message}`);
|
|
11215
10634
|
}
|
|
11216
10635
|
const responseJson = await response3.json();
|
|
11217
|
-
this._requestLogger.debug("after POST %s", createSandboxUrl);
|
|
11218
10636
|
if (responseJson) {
|
|
11219
10637
|
this._sandboxId = responseJson;
|
|
11220
10638
|
}
|
|
@@ -11234,7 +10652,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11234
10652
|
const headers2 = {
|
|
11235
10653
|
Authorization: await this.authorizationHeader()
|
|
11236
10654
|
};
|
|
11237
|
-
this._requestLogger.debug("before GET %s", get_url);
|
|
11238
10655
|
let response2 = await this._client.fetch(get_url, {
|
|
11239
10656
|
method: "GET",
|
|
11240
10657
|
headers: headers2
|
|
@@ -11243,7 +10660,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11243
10660
|
const message = await response2.text();
|
|
11244
10661
|
return Promise.reject(`Unexpected status ${response2.status}: ${message}`);
|
|
11245
10662
|
}
|
|
11246
|
-
this._requestLogger.debug("after GET %s", get_url);
|
|
11247
10663
|
this._pipeline = await response2.json();
|
|
11248
10664
|
if (this.options().stopJobs) {
|
|
11249
10665
|
const body = { sourceType: "NONE" };
|
|
@@ -11304,7 +10720,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11304
10720
|
"Content-Type": "application/json",
|
|
11305
10721
|
Authorization: await this.authorizationHeader()
|
|
11306
10722
|
};
|
|
11307
|
-
this._requestLogger.debug("before POST %s", post_url);
|
|
11308
10723
|
return client.fetch(post_url, {
|
|
11309
10724
|
method: "POST",
|
|
11310
10725
|
body: JSON.stringify(body),
|
|
@@ -11316,7 +10731,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11316
10731
|
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
11317
10732
|
}
|
|
11318
10733
|
const result = await response.json();
|
|
11319
|
-
this._requestLogger.debug("after POST %s", post_url);
|
|
11320
10734
|
return result["id"];
|
|
11321
10735
|
}
|
|
11322
10736
|
async manifest() {
|
|
@@ -11324,7 +10738,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11324
10738
|
const client = this._client;
|
|
11325
10739
|
const baseUrl = this._baseUrl;
|
|
11326
10740
|
if (!baseUrl || !client) {
|
|
11327
|
-
return Promise.reject("endpoint not connected, use connect()
|
|
10741
|
+
return Promise.reject("endpoint not connected, use connect()");
|
|
11328
10742
|
}
|
|
11329
10743
|
let get_path;
|
|
11330
10744
|
if (this._sandboxId === null) {
|
|
@@ -11338,23 +10752,20 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11338
10752
|
...this._authenticationHeaders(session),
|
|
11339
10753
|
"Content-Type": "application/json"
|
|
11340
10754
|
};
|
|
11341
|
-
this._requestLogger.debug("before GET %s", get_path);
|
|
11342
10755
|
return client.fetch(get_path, { headers });
|
|
11343
10756
|
});
|
|
11344
10757
|
if (!response.ok) {
|
|
11345
10758
|
const message = await response.text();
|
|
11346
10759
|
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
11347
10760
|
}
|
|
11348
|
-
|
|
11349
|
-
this._requestLogger.debug("after GET %s", get_path);
|
|
11350
|
-
return result;
|
|
10761
|
+
return await response.json();
|
|
11351
10762
|
}
|
|
11352
10763
|
async models() {
|
|
11353
10764
|
this._logger.warn("listModels for development use only");
|
|
11354
10765
|
const client = this._client;
|
|
11355
10766
|
const baseUrl = this._baseUrl;
|
|
11356
10767
|
if (!baseUrl || !client) {
|
|
11357
|
-
return Promise.reject("endpoint not connected, use connect()
|
|
10768
|
+
return Promise.reject("endpoint not connected, use connect()");
|
|
11358
10769
|
}
|
|
11359
10770
|
let get_path;
|
|
11360
10771
|
if (this._sandboxId === null) {
|
|
@@ -11368,7 +10779,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11368
10779
|
...this._authenticationHeaders(session),
|
|
11369
10780
|
"Content-Type": "application/json"
|
|
11370
10781
|
};
|
|
11371
|
-
this._requestLogger.debug("before GET %s", get_path);
|
|
11372
10782
|
return client.fetch(get_path, { headers });
|
|
11373
10783
|
});
|
|
11374
10784
|
if (!response.ok) {
|
|
@@ -11376,7 +10786,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11376
10786
|
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
11377
10787
|
}
|
|
11378
10788
|
const result = await response.json();
|
|
11379
|
-
this._requestLogger.debug("after GET %s", get_path);
|
|
11380
10789
|
return result;
|
|
11381
10790
|
}
|
|
11382
10791
|
async changeManifest(manifests) {
|
|
@@ -11384,7 +10793,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11384
10793
|
const client = this._client;
|
|
11385
10794
|
const baseUrl = this._baseUrl;
|
|
11386
10795
|
if (!baseUrl || !client) {
|
|
11387
|
-
return Promise.reject("endpoint not connected, use connect()
|
|
10796
|
+
return Promise.reject("endpoint not connected, use connect()");
|
|
11388
10797
|
}
|
|
11389
10798
|
let put_url;
|
|
11390
10799
|
if (this._sandboxId === null) {
|
|
@@ -11398,7 +10807,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11398
10807
|
...this._authenticationHeaders(session),
|
|
11399
10808
|
"Content-Type": "application/json"
|
|
11400
10809
|
};
|
|
11401
|
-
this._requestLogger.debug("before PUT %s", put_url);
|
|
11402
10810
|
return client.fetch(put_url, {
|
|
11403
10811
|
method: "PUT",
|
|
11404
10812
|
body: JSON.stringify(manifests),
|
|
@@ -11409,14 +10817,13 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11409
10817
|
const message = await response.text();
|
|
11410
10818
|
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
11411
10819
|
}
|
|
11412
|
-
this._requestLogger.debug("after PUT %s", put_url);
|
|
11413
10820
|
}
|
|
11414
10821
|
async loadModel(model) {
|
|
11415
10822
|
this._logger.warn("loadModel for development use only");
|
|
11416
10823
|
const client = this._client;
|
|
11417
10824
|
const baseUrl = this._baseUrl;
|
|
11418
10825
|
if (!baseUrl || !client) {
|
|
11419
|
-
return Promise.reject("endpoint not connected, use connect()
|
|
10826
|
+
return Promise.reject("endpoint not connected, use connect()");
|
|
11420
10827
|
}
|
|
11421
10828
|
let post_url;
|
|
11422
10829
|
if (this._sandboxId === null) {
|
|
@@ -11430,7 +10837,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11430
10837
|
...this._authenticationHeaders(session),
|
|
11431
10838
|
"Content-Type": "application/json"
|
|
11432
10839
|
};
|
|
11433
|
-
this._requestLogger.debug("before POST %s", post_url);
|
|
11434
10840
|
return client.fetch(post_url, {
|
|
11435
10841
|
method: "POST",
|
|
11436
10842
|
body: JSON.stringify(model),
|
|
@@ -11441,16 +10847,14 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11441
10847
|
const message = await response.text();
|
|
11442
10848
|
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
11443
10849
|
}
|
|
11444
|
-
|
|
11445
|
-
this._requestLogger.debug("after POST %s", post_url);
|
|
11446
|
-
return result;
|
|
10850
|
+
return await response.json();
|
|
11447
10851
|
}
|
|
11448
10852
|
async unloadModel(modelId) {
|
|
11449
10853
|
this._logger.warn("purgeModel for development use only");
|
|
11450
10854
|
const client = this._client;
|
|
11451
10855
|
const baseUrl = this._baseUrl;
|
|
11452
10856
|
if (!baseUrl || !client) {
|
|
11453
|
-
return Promise.reject("endpoint not connected, use connect()
|
|
10857
|
+
return Promise.reject("endpoint not connected, use connect()");
|
|
11454
10858
|
}
|
|
11455
10859
|
let delete_url;
|
|
11456
10860
|
if (this._sandboxId === null) {
|
|
@@ -11464,14 +10868,12 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11464
10868
|
...this._authenticationHeaders(session),
|
|
11465
10869
|
"Content-Type": "application/json"
|
|
11466
10870
|
};
|
|
11467
|
-
this._requestLogger.debug("before DELETE %s", delete_url);
|
|
11468
10871
|
return client.fetch(delete_url, { method: "DELETE", headers });
|
|
11469
10872
|
});
|
|
11470
10873
|
if (!response.ok) {
|
|
11471
10874
|
const message = await response.text();
|
|
11472
10875
|
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
11473
10876
|
}
|
|
11474
|
-
this._requestLogger.debug("after DELETE %s", delete_url);
|
|
11475
10877
|
}
|
|
11476
10878
|
};
|
|
11477
10879
|
|
|
@@ -11689,10 +11091,9 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11689
11091
|
Authorization: await this.authorizationHeader()
|
|
11690
11092
|
};
|
|
11691
11093
|
this.updateState("FetchConfig" /* FetchConfig */);
|
|
11692
|
-
this._requestLogger.debug("before GET %s", config_url);
|
|
11693
11094
|
let response = await this._client.fetch(config_url, { headers });
|
|
11694
11095
|
if (response.status == 401) {
|
|
11695
|
-
this._requestLogger.debug("
|
|
11096
|
+
this._requestLogger.debug("GET %s: 401, about to retry with fresh access token", config_url);
|
|
11696
11097
|
this.statusHandler401(response.status);
|
|
11697
11098
|
headers = {
|
|
11698
11099
|
Authorization: await this.authorizationHeader()
|
|
@@ -11708,7 +11109,6 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11708
11109
|
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
11709
11110
|
}
|
|
11710
11111
|
let config = await response.json();
|
|
11711
|
-
this._requestLogger.debug("after GET %s", config_url);
|
|
11712
11112
|
const baseUrl = new URL(config.base_url, this.eyepopUrl());
|
|
11713
11113
|
this._baseUrl = baseUrl.toString();
|
|
11714
11114
|
if (this.options().disableWs) {
|