@eyepop.ai/eyepop 1.9.1 → 1.10.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/README.md +152 -106
- package/dist/eyepop.index.d.mts +14 -3
- package/dist/eyepop.index.d.ts +14 -3
- package/dist/eyepop.index.js +271 -182
- package/dist/eyepop.index.js.map +1 -1
- package/dist/eyepop.index.mjs +271 -182
- package/dist/eyepop.index.mjs.map +1 -1
- package/dist/eyepop.min.js +1 -1
- package/package.json +47 -43
package/dist/eyepop.index.js
CHANGED
|
@@ -8815,10 +8815,7 @@ var Stream = class _Stream {
|
|
|
8815
8815
|
}
|
|
8816
8816
|
};
|
|
8817
8817
|
};
|
|
8818
|
-
return [
|
|
8819
|
-
new _Stream(() => teeIterator(left), this.controller),
|
|
8820
|
-
new _Stream(() => teeIterator(right), this.controller)
|
|
8821
|
-
];
|
|
8818
|
+
return [new _Stream(() => teeIterator(left), this.controller), new _Stream(() => teeIterator(right), this.controller)];
|
|
8822
8819
|
}
|
|
8823
8820
|
/**
|
|
8824
8821
|
* Converts this stream to a newline-separated ReadableStream of
|
|
@@ -8902,13 +8899,9 @@ var _LineDecoder = class _LineDecoder {
|
|
|
8902
8899
|
this.textDecoder ?? (this.textDecoder = new TextDecoder("utf8"));
|
|
8903
8900
|
return this.textDecoder.decode(bytes);
|
|
8904
8901
|
}
|
|
8905
|
-
throw new Error(
|
|
8906
|
-
`Unexpected: received non-Uint8Array/ArrayBuffer (${bytes.constructor.name}) in a web platform. Please report this error.`
|
|
8907
|
-
);
|
|
8902
|
+
throw new Error(`Unexpected: received non-Uint8Array/ArrayBuffer (${bytes.constructor.name}) in a web platform. Please report this error.`);
|
|
8908
8903
|
}
|
|
8909
|
-
throw new Error(
|
|
8910
|
-
`Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.`
|
|
8911
|
-
);
|
|
8904
|
+
throw new Error(`Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.`);
|
|
8912
8905
|
}
|
|
8913
8906
|
flush() {
|
|
8914
8907
|
if (!this.buffer.length && !this.trailingCR) {
|
|
@@ -8964,13 +8957,9 @@ var AbstractJob = class {
|
|
|
8964
8957
|
if (!this._responseStream) {
|
|
8965
8958
|
throw Error("logical bug");
|
|
8966
8959
|
}
|
|
8967
|
-
return Stream.iterFromReadableStream(
|
|
8968
|
-
this.
|
|
8969
|
-
|
|
8970
|
-
async (event) => {
|
|
8971
|
-
return await this.onEvent(event);
|
|
8972
|
-
}
|
|
8973
|
-
);
|
|
8960
|
+
return Stream.iterFromReadableStream(this._responseStream, this._controller, async (event) => {
|
|
8961
|
+
return await this.onEvent(event);
|
|
8962
|
+
});
|
|
8974
8963
|
}
|
|
8975
8964
|
async startJob() {
|
|
8976
8965
|
return Promise.reject("abstract class");
|
|
@@ -9064,8 +9053,8 @@ var UploadJob = class extends AbstractJob {
|
|
|
9064
9053
|
formData.append("params", paramBlob);
|
|
9065
9054
|
formData.append("file", this._uploadStream);
|
|
9066
9055
|
const headers = {
|
|
9067
|
-
|
|
9068
|
-
|
|
9056
|
+
...session.authenticationHeaders(),
|
|
9057
|
+
Accept: "application/jsonl"
|
|
9069
9058
|
};
|
|
9070
9059
|
request = this._client.fetch(postUrl, {
|
|
9071
9060
|
headers,
|
|
@@ -9078,8 +9067,8 @@ var UploadJob = class extends AbstractJob {
|
|
|
9078
9067
|
} else {
|
|
9079
9068
|
this._requestLogger.debug("before POST %s with stream as body", postUrl);
|
|
9080
9069
|
const headers = {
|
|
9081
|
-
|
|
9082
|
-
|
|
9070
|
+
...session.authenticationHeaders(),
|
|
9071
|
+
Accept: "application/jsonl",
|
|
9083
9072
|
"Content-Type": this._mimeType
|
|
9084
9073
|
};
|
|
9085
9074
|
request = this._client.fetch(postUrl, {
|
|
@@ -9112,8 +9101,8 @@ var UploadJob = class extends AbstractJob {
|
|
|
9112
9101
|
if (this._needsFullDuplex) {
|
|
9113
9102
|
const prepareUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/prepareSource?timeout=10s`;
|
|
9114
9103
|
const headers = {
|
|
9115
|
-
|
|
9116
|
-
|
|
9104
|
+
...session.authenticationHeaders(),
|
|
9105
|
+
Accept: "application/jsonl"
|
|
9117
9106
|
};
|
|
9118
9107
|
this._requestLogger.debug("before POST %s to prepare full duplex upload", prepareUrl);
|
|
9119
9108
|
response = await this._client.fetch(prepareUrl, {
|
|
@@ -9134,8 +9123,8 @@ var UploadJob = class extends AbstractJob {
|
|
|
9134
9123
|
formData.append("params", paramBlob);
|
|
9135
9124
|
formData.append("file", this._uploadStream);
|
|
9136
9125
|
const headers = {
|
|
9137
|
-
|
|
9138
|
-
|
|
9126
|
+
...session.authenticationHeaders(),
|
|
9127
|
+
Accept: "application/jsonl"
|
|
9139
9128
|
};
|
|
9140
9129
|
response = await this._client.fetch(postUrl, {
|
|
9141
9130
|
headers,
|
|
@@ -9149,8 +9138,8 @@ var UploadJob = class extends AbstractJob {
|
|
|
9149
9138
|
} else {
|
|
9150
9139
|
this._requestLogger.debug("before POST %s with stream as body", postUrl);
|
|
9151
9140
|
const headers = {
|
|
9152
|
-
|
|
9153
|
-
|
|
9141
|
+
...session.authenticationHeaders(),
|
|
9142
|
+
Accept: "application/jsonl",
|
|
9154
9143
|
"Content-Type": this._mimeType
|
|
9155
9144
|
};
|
|
9156
9145
|
response = await this._client.fetch(postUrl, {
|
|
@@ -9181,13 +9170,13 @@ var LoadFromJob = class extends AbstractJob {
|
|
|
9181
9170
|
return Promise.reject("session.baseUrl must not ne null");
|
|
9182
9171
|
}
|
|
9183
9172
|
const body = {
|
|
9184
|
-
|
|
9185
|
-
|
|
9186
|
-
|
|
9173
|
+
sourceType: "URL",
|
|
9174
|
+
url: this._location,
|
|
9175
|
+
params: this._params
|
|
9187
9176
|
};
|
|
9188
9177
|
const headers = {
|
|
9189
|
-
|
|
9190
|
-
|
|
9178
|
+
...session.authenticationHeaders(),
|
|
9179
|
+
Accept: "application/jsonl",
|
|
9191
9180
|
"Content-Type": "application/json"
|
|
9192
9181
|
};
|
|
9193
9182
|
const patchUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=sync`;
|
|
@@ -9216,13 +9205,13 @@ var LoadLiveIngressJob = class extends AbstractJob {
|
|
|
9216
9205
|
return Promise.reject("session.baseUrl must not ne null");
|
|
9217
9206
|
}
|
|
9218
9207
|
const body = {
|
|
9219
|
-
|
|
9220
|
-
|
|
9221
|
-
|
|
9208
|
+
sourceType: "LIVE_INGRESS",
|
|
9209
|
+
liveIngressId: this._ingressId,
|
|
9210
|
+
params: this._params
|
|
9222
9211
|
};
|
|
9223
9212
|
const headers = {
|
|
9224
|
-
|
|
9225
|
-
|
|
9213
|
+
...session.authenticationHeaders(),
|
|
9214
|
+
Accept: "application/jsonl",
|
|
9226
9215
|
"Content-Type": "application/json"
|
|
9227
9216
|
};
|
|
9228
9217
|
const patchUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=preempt&processing=sync`;
|
|
@@ -9323,7 +9312,7 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9323
9312
|
const ingressUrl = new URL(this._urlPath, session.baseUrl);
|
|
9324
9313
|
this._requestLogger.debug("before POST: %s", ingressUrl);
|
|
9325
9314
|
const headers = {
|
|
9326
|
-
|
|
9315
|
+
...session.authenticationHeaders(),
|
|
9327
9316
|
"Content-Type": "application/sdp"
|
|
9328
9317
|
};
|
|
9329
9318
|
const response = await this._client.fetch(ingressUrl, {
|
|
@@ -9336,10 +9325,12 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9336
9325
|
}
|
|
9337
9326
|
this._eTag = response.headers.get("ETag") ?? "";
|
|
9338
9327
|
this._location = response.headers.get("Location");
|
|
9339
|
-
return this.onRemoteAnswer(
|
|
9340
|
-
|
|
9341
|
-
|
|
9342
|
-
|
|
9328
|
+
return this.onRemoteAnswer(
|
|
9329
|
+
new RTCSessionDescription({
|
|
9330
|
+
type: "answer",
|
|
9331
|
+
sdp: await response.text()
|
|
9332
|
+
})
|
|
9333
|
+
);
|
|
9343
9334
|
}
|
|
9344
9335
|
async sendLocalCandidates(candidates) {
|
|
9345
9336
|
if (!this._offerData) {
|
|
@@ -9355,7 +9346,7 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9355
9346
|
const ingressUrl = new URL(urlPath, session.baseUrl);
|
|
9356
9347
|
this._requestLogger.debug("before PATCH: %s", ingressUrl);
|
|
9357
9348
|
const headers = {
|
|
9358
|
-
|
|
9349
|
+
...session.authenticationHeaders(),
|
|
9359
9350
|
"Content-Type": "application/trickle-ice-sdpfrag",
|
|
9360
9351
|
"If-Match": this._eTag
|
|
9361
9352
|
};
|
|
@@ -9536,11 +9527,8 @@ var WebrtcWhip = class extends WebrtcBase {
|
|
|
9536
9527
|
const session = await this._getSession();
|
|
9537
9528
|
const ingressUrl = new URL(this._urlPath, session.baseUrl);
|
|
9538
9529
|
this._requestLogger.debug("before GET: %s", ingressUrl);
|
|
9539
|
-
const headers = {
|
|
9540
|
-
"Authorization": `Bearer ${session.accessToken}`
|
|
9541
|
-
};
|
|
9542
9530
|
const response = await this._client.fetch(ingressUrl, {
|
|
9543
|
-
headers,
|
|
9531
|
+
headers: session.authenticationHeaders(),
|
|
9544
9532
|
method: "GET"
|
|
9545
9533
|
});
|
|
9546
9534
|
if (response.status >= 300) {
|
|
@@ -9640,11 +9628,8 @@ var WebrtcWhep = class extends WebrtcBase {
|
|
|
9640
9628
|
const session = await this._getSession();
|
|
9641
9629
|
const egressUrl = new URL(this._urlPath, session.baseUrl);
|
|
9642
9630
|
this._requestLogger.debug("before GET: %s", egressUrl);
|
|
9643
|
-
const headers = {
|
|
9644
|
-
"Authorization": `Bearer ${session.accessToken}`
|
|
9645
|
-
};
|
|
9646
9631
|
const response = await this._client.fetch(egressUrl, {
|
|
9647
|
-
headers,
|
|
9632
|
+
headers: session.authenticationHeaders(),
|
|
9648
9633
|
method: "GET"
|
|
9649
9634
|
});
|
|
9650
9635
|
if (response.status >= 300) {
|
|
@@ -9746,7 +9731,7 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9746
9731
|
constructor() {
|
|
9747
9732
|
}
|
|
9748
9733
|
async fetch(input, init) {
|
|
9749
|
-
return fetch(input, init);
|
|
9734
|
+
return await fetch(input, init);
|
|
9750
9735
|
}
|
|
9751
9736
|
async close() {
|
|
9752
9737
|
}
|
|
@@ -9762,7 +9747,7 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9762
9747
|
async fetch(input, init) {
|
|
9763
9748
|
init || (init = {});
|
|
9764
9749
|
init.dispatcher = this.agent;
|
|
9765
|
-
return fetch(input, init);
|
|
9750
|
+
return await fetch(input, init);
|
|
9766
9751
|
}
|
|
9767
9752
|
async close() {
|
|
9768
9753
|
return this.agent.close();
|
|
@@ -10040,6 +10025,7 @@ var Endpoint = class {
|
|
|
10040
10025
|
this._expire_token_time = this._options.auth.session.validUntil / 1e3;
|
|
10041
10026
|
} else if (this._options.auth.oAuth2 !== void 0) {
|
|
10042
10027
|
} else if (this._options.auth.secretKey !== void 0) {
|
|
10028
|
+
} else if (this._options.auth.isLocal !== void 0) {
|
|
10043
10029
|
} else {
|
|
10044
10030
|
return Promise.reject("option secretKey or environment variable EYEPOP_SECRET_KEY is required");
|
|
10045
10031
|
}
|
|
@@ -10077,7 +10063,7 @@ var Endpoint = class {
|
|
|
10077
10063
|
while (true) {
|
|
10078
10064
|
try {
|
|
10079
10065
|
const response = await fetcher();
|
|
10080
|
-
if (response.
|
|
10066
|
+
if (response.ok) {
|
|
10081
10067
|
return response;
|
|
10082
10068
|
} else {
|
|
10083
10069
|
const handler = this._statusRetryHandlers.get(response.status);
|
|
@@ -10086,10 +10072,10 @@ var Endpoint = class {
|
|
|
10086
10072
|
if (retries--) {
|
|
10087
10073
|
this._requestLogger.info("received %d response, retry", response.status);
|
|
10088
10074
|
} else {
|
|
10089
|
-
return
|
|
10075
|
+
return response;
|
|
10090
10076
|
}
|
|
10091
10077
|
} else {
|
|
10092
|
-
return
|
|
10078
|
+
return response;
|
|
10093
10079
|
}
|
|
10094
10080
|
}
|
|
10095
10081
|
} catch (error) {
|
|
@@ -10111,6 +10097,9 @@ var Endpoint = class {
|
|
|
10111
10097
|
throw new Error("reconnect() not implemented");
|
|
10112
10098
|
}
|
|
10113
10099
|
async authorizationHeader() {
|
|
10100
|
+
if (this._options.auth.isLocal !== void 0) {
|
|
10101
|
+
return `Implicit`;
|
|
10102
|
+
}
|
|
10114
10103
|
return `Bearer ${await this.currentAccessToken()}`;
|
|
10115
10104
|
}
|
|
10116
10105
|
async currentAccessToken() {
|
|
@@ -10120,6 +10109,9 @@ var Endpoint = class {
|
|
|
10120
10109
|
try {
|
|
10121
10110
|
if (!this._client) {
|
|
10122
10111
|
return Promise.reject("endpoint not connected");
|
|
10112
|
+
} else if (this._options.auth.isLocal !== void 0) {
|
|
10113
|
+
this._token = "implicit";
|
|
10114
|
+
this._expire_token_time = Number.MAX_VALUE;
|
|
10123
10115
|
} else if (this._options.auth.session !== void 0) {
|
|
10124
10116
|
return Promise.reject("temporary access token expired");
|
|
10125
10117
|
} else if (this._options.auth.oAuth2 !== void 0 && this._options.eyepopUrl) {
|
|
@@ -10128,7 +10120,7 @@ var Endpoint = class {
|
|
|
10128
10120
|
this._expire_token_time = session.validUntil / 1e3;
|
|
10129
10121
|
} else if (this._options.auth.secretKey !== void 0 && this._options.eyepopUrl) {
|
|
10130
10122
|
const secretKeyAuth = this._options.auth;
|
|
10131
|
-
const body = {
|
|
10123
|
+
const body = { secret_key: secretKeyAuth.secretKey };
|
|
10132
10124
|
const headers = { "Content-Type": "application/json" };
|
|
10133
10125
|
const post_url = `${this.eyepopUrl()}/authentication/token`;
|
|
10134
10126
|
this._requestLogger.debug("before POST %s", post_url);
|
|
@@ -10177,7 +10169,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10177
10169
|
this._ingressEventWs = null;
|
|
10178
10170
|
this._sandboxId = null;
|
|
10179
10171
|
const sessionAuth = options.auth;
|
|
10180
|
-
if (sessionAuth.session !== void 0) {
|
|
10172
|
+
if (sessionAuth !== void 0 && sessionAuth.session !== void 0) {
|
|
10181
10173
|
const workerSession = sessionAuth.session;
|
|
10182
10174
|
if (workerSession.sandboxId) {
|
|
10183
10175
|
this._sandboxId = workerSession.sandboxId;
|
|
@@ -10189,10 +10181,26 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10189
10181
|
return this._options;
|
|
10190
10182
|
}
|
|
10191
10183
|
async disconnect(wait = true) {
|
|
10184
|
+
if (this.options().popId == "transient" /* Transient */ && this._pipelineId) {
|
|
10185
|
+
const deleteUrl = `${this._baseUrl}/pipelines/${this._pipelineId}`;
|
|
10186
|
+
const headers = {
|
|
10187
|
+
Authorization: await this.authorizationHeader()
|
|
10188
|
+
};
|
|
10189
|
+
this._requestLogger.debug("before DELETE %s", deleteUrl);
|
|
10190
|
+
let response = await this._client?.fetch(deleteUrl, {
|
|
10191
|
+
method: "DELETE",
|
|
10192
|
+
headers
|
|
10193
|
+
});
|
|
10194
|
+
this._requestLogger.debug("after DELETE %s", deleteUrl);
|
|
10195
|
+
if (response?.status != 204) {
|
|
10196
|
+
const message = await response?.text();
|
|
10197
|
+
this._logger.info(`stoppping pipeline failed, status ${response?.status}: ${message}`);
|
|
10198
|
+
}
|
|
10199
|
+
}
|
|
10192
10200
|
if (this._sandboxId && this._baseUrl) {
|
|
10193
10201
|
const sandboxUrl = `${this._baseUrl}/sandboxes/${this._sandboxId}`;
|
|
10194
10202
|
const headers = {
|
|
10195
|
-
|
|
10203
|
+
Authorization: await this.authorizationHeader()
|
|
10196
10204
|
};
|
|
10197
10205
|
this._requestLogger.debug("before DELETE %s", sandboxUrl);
|
|
10198
10206
|
let response = await this._client?.fetch(sandboxUrl, {
|
|
@@ -10202,7 +10210,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10202
10210
|
this._requestLogger.debug("after DELETE %s", sandboxUrl);
|
|
10203
10211
|
if (response?.status != 204) {
|
|
10204
10212
|
const message = await response?.text();
|
|
10205
|
-
|
|
10213
|
+
this._logger.info(`disconnecting sandbox failed, status ${response?.status}: ${message}`);
|
|
10206
10214
|
}
|
|
10207
10215
|
this._sandboxId = null;
|
|
10208
10216
|
}
|
|
@@ -10227,7 +10235,8 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10227
10235
|
popId: this.options().popId,
|
|
10228
10236
|
baseUrl: this._baseUrl,
|
|
10229
10237
|
pipelineId: this._pipelineId,
|
|
10230
|
-
sandboxId: this._sandboxId ?? void 0
|
|
10238
|
+
sandboxId: this._sandboxId ?? void 0,
|
|
10239
|
+
authenticationHeaders: () => this._authenticationHeaders(session)
|
|
10231
10240
|
};
|
|
10232
10241
|
}
|
|
10233
10242
|
popName() {
|
|
@@ -10249,12 +10258,12 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10249
10258
|
let response = await this.fetchWithRetry(async () => {
|
|
10250
10259
|
const session = await this.session();
|
|
10251
10260
|
let headers = {
|
|
10252
|
-
"
|
|
10253
|
-
|
|
10261
|
+
"Content-Type": "application/json",
|
|
10262
|
+
...this._authenticationHeaders(session)
|
|
10254
10263
|
};
|
|
10255
10264
|
const patch_url = `${session.baseUrl}/pipelines/${session.pipelineId}/pop`;
|
|
10256
10265
|
this._requestLogger.debug("before PATCH %s - %s", patch_url, JSON.stringify(pop));
|
|
10257
|
-
return client.fetch(patch_url, {
|
|
10266
|
+
return await client.fetch(patch_url, {
|
|
10258
10267
|
method: "PATCH",
|
|
10259
10268
|
body: JSON.stringify(pop),
|
|
10260
10269
|
headers
|
|
@@ -10262,7 +10271,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10262
10271
|
});
|
|
10263
10272
|
if (response.status != 204) {
|
|
10264
10273
|
const message = await response.text();
|
|
10265
|
-
console.error(message);
|
|
10266
10274
|
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
10267
10275
|
}
|
|
10268
10276
|
this._requestLogger.debug("after PATCH pop");
|
|
@@ -10270,6 +10278,9 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10270
10278
|
this._pipeline.pop = pop;
|
|
10271
10279
|
}
|
|
10272
10280
|
}
|
|
10281
|
+
_authenticationHeaders(session) {
|
|
10282
|
+
return this._options.auth.isLocal !== void 0 ? {} : { Authorization: `Bearer ${session.accessToken}` };
|
|
10283
|
+
}
|
|
10273
10284
|
/**
|
|
10274
10285
|
* @deprecated use pop() instead
|
|
10275
10286
|
*/
|
|
@@ -10290,13 +10301,13 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10290
10301
|
return Promise.reject("endpoint not connected, use connect() before changePopComp()");
|
|
10291
10302
|
}
|
|
10292
10303
|
const body = {
|
|
10293
|
-
|
|
10294
|
-
|
|
10304
|
+
pipeline: popComp,
|
|
10305
|
+
modelRefs
|
|
10295
10306
|
};
|
|
10296
10307
|
let response = await this.fetchWithRetry(async () => {
|
|
10297
10308
|
const session = await this.session();
|
|
10298
10309
|
let headers = {
|
|
10299
|
-
|
|
10310
|
+
...this._authenticationHeaders(session),
|
|
10300
10311
|
"Content-Type": "application/json"
|
|
10301
10312
|
};
|
|
10302
10313
|
const patch_url = `${session.baseUrl}/pipelines/${session.pipelineId}/inferencePipeline`;
|
|
@@ -10308,7 +10319,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10308
10319
|
});
|
|
10309
10320
|
if (response.status != 204) {
|
|
10310
10321
|
const message = await response.text();
|
|
10311
|
-
console.error(message);
|
|
10312
10322
|
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
10313
10323
|
}
|
|
10314
10324
|
if (this._pipeline) {
|
|
@@ -10336,12 +10346,12 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10336
10346
|
return Promise.reject("endpoint not connected, use connect() before changePopComp()");
|
|
10337
10347
|
}
|
|
10338
10348
|
const body = {
|
|
10339
|
-
|
|
10349
|
+
transform: postTransform
|
|
10340
10350
|
};
|
|
10341
10351
|
let response = await this.fetchWithRetry(async () => {
|
|
10342
10352
|
const session = await this.session();
|
|
10343
10353
|
let headers = {
|
|
10344
|
-
|
|
10354
|
+
...this._authenticationHeaders(session),
|
|
10345
10355
|
"Content-Type": "application/json"
|
|
10346
10356
|
};
|
|
10347
10357
|
const patch_url = `${session.baseUrl}/pipelines/${session.pipelineId}/postTransform`;
|
|
@@ -10374,18 +10384,28 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10374
10384
|
if (!this._baseUrl || !this._client) {
|
|
10375
10385
|
return Promise.reject("endpoint not connected, use connect() before ingress()");
|
|
10376
10386
|
}
|
|
10377
|
-
const whip = new WebrtcWhip(
|
|
10378
|
-
|
|
10379
|
-
|
|
10387
|
+
const whip = new WebrtcWhip(
|
|
10388
|
+
stream,
|
|
10389
|
+
async () => {
|
|
10390
|
+
return this.session();
|
|
10391
|
+
},
|
|
10392
|
+
this._client,
|
|
10393
|
+
this._requestLogger
|
|
10394
|
+
);
|
|
10380
10395
|
return whip.start();
|
|
10381
10396
|
}
|
|
10382
10397
|
async liveEgress(ingressId) {
|
|
10383
10398
|
if (!this._baseUrl || !this._client) {
|
|
10384
10399
|
return Promise.reject("endpoint not connected, use connect() before ingress()");
|
|
10385
10400
|
}
|
|
10386
|
-
const whep = new WebrtcWhep(
|
|
10387
|
-
|
|
10388
|
-
|
|
10401
|
+
const whep = new WebrtcWhep(
|
|
10402
|
+
ingressId,
|
|
10403
|
+
async () => {
|
|
10404
|
+
return this.session();
|
|
10405
|
+
},
|
|
10406
|
+
this._client,
|
|
10407
|
+
this._requestLogger
|
|
10408
|
+
);
|
|
10389
10409
|
return whep.start();
|
|
10390
10410
|
}
|
|
10391
10411
|
async process(source, params = void 0) {
|
|
@@ -10412,7 +10432,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10412
10432
|
const session = await this.session();
|
|
10413
10433
|
let response = await this.fetchWithRetry(async () => {
|
|
10414
10434
|
const headers = {
|
|
10415
|
-
|
|
10435
|
+
...this._authenticationHeaders(session)
|
|
10416
10436
|
};
|
|
10417
10437
|
const getTokenUrl = `${session.baseUrl}/liveIngress/events/token`;
|
|
10418
10438
|
return client.fetch(getTokenUrl, { headers });
|
|
@@ -10441,14 +10461,24 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10441
10461
|
await this._limit.acquire();
|
|
10442
10462
|
try {
|
|
10443
10463
|
this.updateState();
|
|
10444
|
-
const job = new UploadJob(
|
|
10445
|
-
|
|
10446
|
-
|
|
10447
|
-
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
|
|
10464
|
+
const job = new UploadJob(
|
|
10465
|
+
source.file,
|
|
10466
|
+
source.file.type,
|
|
10467
|
+
params,
|
|
10468
|
+
async () => {
|
|
10469
|
+
return this.session();
|
|
10470
|
+
},
|
|
10471
|
+
this._client,
|
|
10472
|
+
this._requestLogger
|
|
10473
|
+
);
|
|
10474
|
+
return job.start(
|
|
10475
|
+
() => {
|
|
10476
|
+
this.jobDone(job);
|
|
10477
|
+
},
|
|
10478
|
+
(statusCode) => {
|
|
10479
|
+
this.jobStatus(job, statusCode);
|
|
10480
|
+
}
|
|
10481
|
+
);
|
|
10452
10482
|
} catch (e) {
|
|
10453
10483
|
this._limit.release();
|
|
10454
10484
|
throw e;
|
|
@@ -10461,14 +10491,24 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10461
10491
|
await this._limit.acquire();
|
|
10462
10492
|
try {
|
|
10463
10493
|
this.updateState();
|
|
10464
|
-
const job = new UploadJob(
|
|
10465
|
-
|
|
10466
|
-
|
|
10467
|
-
|
|
10468
|
-
|
|
10469
|
-
|
|
10470
|
-
|
|
10471
|
-
|
|
10494
|
+
const job = new UploadJob(
|
|
10495
|
+
source.stream,
|
|
10496
|
+
source.mimeType,
|
|
10497
|
+
params,
|
|
10498
|
+
async () => {
|
|
10499
|
+
return this.session();
|
|
10500
|
+
},
|
|
10501
|
+
this._client,
|
|
10502
|
+
this._requestLogger
|
|
10503
|
+
);
|
|
10504
|
+
return job.start(
|
|
10505
|
+
() => {
|
|
10506
|
+
this.jobDone(job);
|
|
10507
|
+
},
|
|
10508
|
+
(statusCode) => {
|
|
10509
|
+
this.jobStatus(job, statusCode);
|
|
10510
|
+
}
|
|
10511
|
+
);
|
|
10472
10512
|
} catch (e) {
|
|
10473
10513
|
this._limit.release();
|
|
10474
10514
|
throw e;
|
|
@@ -10482,14 +10522,24 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10482
10522
|
try {
|
|
10483
10523
|
this.updateState();
|
|
10484
10524
|
const streamSource = await resolvePath(source);
|
|
10485
|
-
const job = new UploadJob(
|
|
10486
|
-
|
|
10487
|
-
|
|
10488
|
-
|
|
10489
|
-
|
|
10490
|
-
|
|
10491
|
-
|
|
10492
|
-
|
|
10525
|
+
const job = new UploadJob(
|
|
10526
|
+
streamSource.stream,
|
|
10527
|
+
streamSource.mimeType,
|
|
10528
|
+
params,
|
|
10529
|
+
async () => {
|
|
10530
|
+
return this.session();
|
|
10531
|
+
},
|
|
10532
|
+
this._client,
|
|
10533
|
+
this._requestLogger
|
|
10534
|
+
);
|
|
10535
|
+
return job.start(
|
|
10536
|
+
() => {
|
|
10537
|
+
this.jobDone(job);
|
|
10538
|
+
},
|
|
10539
|
+
(statusCode) => {
|
|
10540
|
+
this.jobStatus(job, statusCode);
|
|
10541
|
+
}
|
|
10542
|
+
);
|
|
10493
10543
|
} catch (e) {
|
|
10494
10544
|
this._limit.release();
|
|
10495
10545
|
throw e;
|
|
@@ -10502,14 +10552,23 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10502
10552
|
await this._limit.acquire();
|
|
10503
10553
|
try {
|
|
10504
10554
|
this.updateState();
|
|
10505
|
-
const job = new LoadFromJob(
|
|
10506
|
-
|
|
10507
|
-
|
|
10508
|
-
|
|
10509
|
-
|
|
10510
|
-
|
|
10511
|
-
this.
|
|
10512
|
-
|
|
10555
|
+
const job = new LoadFromJob(
|
|
10556
|
+
source.url,
|
|
10557
|
+
params,
|
|
10558
|
+
async () => {
|
|
10559
|
+
return this.session();
|
|
10560
|
+
},
|
|
10561
|
+
this._client,
|
|
10562
|
+
this._requestLogger
|
|
10563
|
+
);
|
|
10564
|
+
return job.start(
|
|
10565
|
+
() => {
|
|
10566
|
+
this.jobDone(job);
|
|
10567
|
+
},
|
|
10568
|
+
(statusCode) => {
|
|
10569
|
+
this.jobStatus(job, statusCode);
|
|
10570
|
+
}
|
|
10571
|
+
);
|
|
10513
10572
|
} catch (e) {
|
|
10514
10573
|
this._limit.release();
|
|
10515
10574
|
throw e;
|
|
@@ -10522,14 +10581,23 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10522
10581
|
await this._limit.acquire();
|
|
10523
10582
|
try {
|
|
10524
10583
|
this.updateState();
|
|
10525
|
-
const job = new LoadLiveIngressJob(
|
|
10526
|
-
|
|
10527
|
-
|
|
10528
|
-
|
|
10529
|
-
|
|
10530
|
-
|
|
10531
|
-
this.
|
|
10532
|
-
|
|
10584
|
+
const job = new LoadLiveIngressJob(
|
|
10585
|
+
source.ingressId,
|
|
10586
|
+
params,
|
|
10587
|
+
async () => {
|
|
10588
|
+
return this.session();
|
|
10589
|
+
},
|
|
10590
|
+
this._client,
|
|
10591
|
+
this._requestLogger
|
|
10592
|
+
);
|
|
10593
|
+
return job.start(
|
|
10594
|
+
() => {
|
|
10595
|
+
this.jobDone(job);
|
|
10596
|
+
},
|
|
10597
|
+
(statusCode) => {
|
|
10598
|
+
this.jobStatus(job, statusCode);
|
|
10599
|
+
}
|
|
10600
|
+
);
|
|
10533
10601
|
} catch (e) {
|
|
10534
10602
|
this._limit.release();
|
|
10535
10603
|
throw e;
|
|
@@ -10557,7 +10625,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10557
10625
|
config_url = `${this.eyepopUrl()}/pops/${this.options().popId}/config?auto_start=false`;
|
|
10558
10626
|
}
|
|
10559
10627
|
const headers = {
|
|
10560
|
-
|
|
10628
|
+
Authorization: await this.authorizationHeader()
|
|
10561
10629
|
};
|
|
10562
10630
|
this.updateState("FetchConfig" /* FetchConfig */);
|
|
10563
10631
|
this._requestLogger.debug("before GET %s", config_url);
|
|
@@ -10566,7 +10634,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10566
10634
|
this._requestLogger.debug("after GET %s: 401, about to retry with fresh access token", config_url);
|
|
10567
10635
|
this.statusHandler401(response.status);
|
|
10568
10636
|
const headers2 = {
|
|
10569
|
-
|
|
10637
|
+
Authorization: await this.authorizationHeader()
|
|
10570
10638
|
};
|
|
10571
10639
|
this.updateState("FetchConfig" /* FetchConfig */);
|
|
10572
10640
|
response = await this._client.fetch(config_url, {
|
|
@@ -10588,7 +10656,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10588
10656
|
const auto_start_config_url = `${this.eyepopUrl()}/pops/${this.options().popId}/config?auto_start=true`;
|
|
10589
10657
|
this._requestLogger.debug("pop was not running, trying to autostart with: %s", auto_start_config_url);
|
|
10590
10658
|
const headers2 = {
|
|
10591
|
-
|
|
10659
|
+
Authorization: await this.authorizationHeader()
|
|
10592
10660
|
};
|
|
10593
10661
|
response = await this._client.fetch(auto_start_config_url, {
|
|
10594
10662
|
headers: headers2
|
|
@@ -10606,7 +10674,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10606
10674
|
this._baseUrl = this._baseUrl.replace(/\/+$/, "");
|
|
10607
10675
|
if (this.options().isSandbox && this._sandboxId === null) {
|
|
10608
10676
|
const headers3 = {
|
|
10609
|
-
|
|
10677
|
+
Authorization: await this.authorizationHeader()
|
|
10610
10678
|
};
|
|
10611
10679
|
const createSandboxUrl = `${this._baseUrl}/sandboxes`;
|
|
10612
10680
|
this._requestLogger.debug("before POST %s", createSandboxUrl);
|
|
@@ -10637,7 +10705,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10637
10705
|
this._baseUrl = this._baseUrl.replace(/\/+$/, "");
|
|
10638
10706
|
const get_url = `${this._baseUrl}/pipelines/${this._pipelineId}`;
|
|
10639
10707
|
const headers2 = {
|
|
10640
|
-
|
|
10708
|
+
Authorization: await this.authorizationHeader()
|
|
10641
10709
|
};
|
|
10642
10710
|
this._requestLogger.debug("before GET %s", get_url);
|
|
10643
10711
|
let response2 = await this._client.fetch(get_url, {
|
|
@@ -10651,9 +10719,9 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10651
10719
|
this._requestLogger.debug("after GET %s", get_url);
|
|
10652
10720
|
this._pipeline = await response2.json();
|
|
10653
10721
|
if (this.options().stopJobs) {
|
|
10654
|
-
const body = {
|
|
10722
|
+
const body = { sourceType: "NONE" };
|
|
10655
10723
|
const headers3 = {
|
|
10656
|
-
|
|
10724
|
+
Authorization: await this.authorizationHeader()
|
|
10657
10725
|
};
|
|
10658
10726
|
const stop_url = `${this._baseUrl}/pipelines/${this._pipeline.id}/source?mode=preempt&processing=sync`;
|
|
10659
10727
|
let response3 = await this._client.fetch(stop_url, {
|
|
@@ -10689,13 +10757,13 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10689
10757
|
};
|
|
10690
10758
|
}
|
|
10691
10759
|
const body = {
|
|
10692
|
-
|
|
10693
|
-
|
|
10694
|
-
|
|
10760
|
+
pop,
|
|
10761
|
+
source: {
|
|
10762
|
+
sourceType: "NONE"
|
|
10695
10763
|
},
|
|
10696
|
-
|
|
10697
|
-
|
|
10698
|
-
|
|
10764
|
+
idleTimeoutSeconds: 30,
|
|
10765
|
+
logging: ["out_meta"],
|
|
10766
|
+
videoOutput: "no_output"
|
|
10699
10767
|
};
|
|
10700
10768
|
let post_url;
|
|
10701
10769
|
if (sandboxId) {
|
|
@@ -10706,7 +10774,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10706
10774
|
let response = await this.fetchWithRetry(async () => {
|
|
10707
10775
|
let headers = {
|
|
10708
10776
|
"Content-Type": "application/json",
|
|
10709
|
-
|
|
10777
|
+
Authorization: await this.authorizationHeader()
|
|
10710
10778
|
};
|
|
10711
10779
|
this._requestLogger.debug("before POST %s", post_url);
|
|
10712
10780
|
return client.fetch(post_url, {
|
|
@@ -10739,7 +10807,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10739
10807
|
let response = await this.fetchWithRetry(async () => {
|
|
10740
10808
|
const session = await this.session();
|
|
10741
10809
|
let headers = {
|
|
10742
|
-
|
|
10810
|
+
...this._authenticationHeaders(session),
|
|
10743
10811
|
"Content-Type": "application/json"
|
|
10744
10812
|
};
|
|
10745
10813
|
this._requestLogger.debug("before GET %s", get_path);
|
|
@@ -10769,7 +10837,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10769
10837
|
let response = await this.fetchWithRetry(async () => {
|
|
10770
10838
|
const session = await this.session();
|
|
10771
10839
|
let headers = {
|
|
10772
|
-
|
|
10840
|
+
...this._authenticationHeaders(session),
|
|
10773
10841
|
"Content-Type": "application/json"
|
|
10774
10842
|
};
|
|
10775
10843
|
this._requestLogger.debug("before GET %s", get_path);
|
|
@@ -10799,7 +10867,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10799
10867
|
let response = await this.fetchWithRetry(async () => {
|
|
10800
10868
|
const session = await this.session();
|
|
10801
10869
|
let headers = {
|
|
10802
|
-
|
|
10870
|
+
...this._authenticationHeaders(session),
|
|
10803
10871
|
"Content-Type": "application/json"
|
|
10804
10872
|
};
|
|
10805
10873
|
this._requestLogger.debug("before PUT %s", put_url);
|
|
@@ -10831,7 +10899,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10831
10899
|
let response = await this.fetchWithRetry(async () => {
|
|
10832
10900
|
const session = await this.session();
|
|
10833
10901
|
let headers = {
|
|
10834
|
-
|
|
10902
|
+
...this._authenticationHeaders(session),
|
|
10835
10903
|
"Content-Type": "application/json"
|
|
10836
10904
|
};
|
|
10837
10905
|
this._requestLogger.debug("before POST %s", post_url);
|
|
@@ -10865,7 +10933,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10865
10933
|
let response = await this.fetchWithRetry(async () => {
|
|
10866
10934
|
const session = await this.session();
|
|
10867
10935
|
let headers = {
|
|
10868
|
-
|
|
10936
|
+
...this._authenticationHeaders(session),
|
|
10869
10937
|
"Content-Type": "application/json"
|
|
10870
10938
|
};
|
|
10871
10939
|
this._requestLogger.debug("before DELETE %s", delete_url);
|
|
@@ -11080,7 +11148,7 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11080
11148
|
}
|
|
11081
11149
|
const config_url = `${this.eyepopUrl()}/data/config?account_uuid=${this._accountId}`;
|
|
11082
11150
|
let headers = {
|
|
11083
|
-
|
|
11151
|
+
Authorization: await this.authorizationHeader()
|
|
11084
11152
|
};
|
|
11085
11153
|
this.updateState("FetchConfig" /* FetchConfig */);
|
|
11086
11154
|
this._requestLogger.debug("before GET %s", config_url);
|
|
@@ -11089,7 +11157,7 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11089
11157
|
this._requestLogger.debug("after GET %s: 401, about to retry with fresh access token", config_url);
|
|
11090
11158
|
this.statusHandler401(response.status);
|
|
11091
11159
|
headers = {
|
|
11092
|
-
|
|
11160
|
+
Authorization: await this.authorizationHeader()
|
|
11093
11161
|
};
|
|
11094
11162
|
this.updateState("FetchConfig" /* FetchConfig */);
|
|
11095
11163
|
response = await this._client.fetch(config_url, {
|
|
@@ -11114,7 +11182,7 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11114
11182
|
const client = this._client;
|
|
11115
11183
|
const url = urlJoin(this._baseUrl, "security", "check?set_cookie=true");
|
|
11116
11184
|
const headers2 = {
|
|
11117
|
-
|
|
11185
|
+
Authorization: await this.authorizationHeader()
|
|
11118
11186
|
};
|
|
11119
11187
|
response = await client.fetch(url, {
|
|
11120
11188
|
headers: headers2
|
|
@@ -11201,7 +11269,7 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11201
11269
|
const session = await this.session();
|
|
11202
11270
|
const headers = {
|
|
11203
11271
|
"Content-Type": "application/json",
|
|
11204
|
-
...disableAuth ? {} : {
|
|
11272
|
+
...disableAuth ? {} : { Authorization: `Bearer ${session.accessToken}` },
|
|
11205
11273
|
...options.headers || {}
|
|
11206
11274
|
};
|
|
11207
11275
|
if (!options.body) {
|
|
@@ -11616,6 +11684,13 @@ var readEnv = (env) => {
|
|
|
11616
11684
|
}
|
|
11617
11685
|
return void 0;
|
|
11618
11686
|
};
|
|
11687
|
+
var stringToBooleanSafe = (str) => {
|
|
11688
|
+
if (typeof str == "undefined") {
|
|
11689
|
+
return false;
|
|
11690
|
+
}
|
|
11691
|
+
const loweCaseStr = str.toLowerCase();
|
|
11692
|
+
return loweCaseStr == "true" || loweCaseStr == "yes";
|
|
11693
|
+
};
|
|
11619
11694
|
var EyePop;
|
|
11620
11695
|
((EyePop2) => {
|
|
11621
11696
|
const envSecretKey = readEnv("EYEPOP_SECRET_KEY");
|
|
@@ -11624,20 +11699,32 @@ var EyePop;
|
|
|
11624
11699
|
} : void 0;
|
|
11625
11700
|
EyePop2.endpoint = workerEndpoint;
|
|
11626
11701
|
function workerEndpoint(opts = {}) {
|
|
11627
|
-
|
|
11628
|
-
|
|
11629
|
-
opts.popId = readEnv("EYEPOP_POP_ID");
|
|
11702
|
+
if (opts.isLocalMode === void 0) {
|
|
11703
|
+
opts.isLocalMode = stringToBooleanSafe(readEnv("EYEPOP_LOCAL_MODE"));
|
|
11630
11704
|
}
|
|
11631
|
-
|
|
11705
|
+
_fill_default_options(opts, opts.isLocalMode ? "http://127.0.0.1:8080/standalone" : void 0);
|
|
11706
|
+
if (opts.auth === void 0) {
|
|
11707
|
+
if (opts.isLocalMode) {
|
|
11708
|
+
opts.auth = { isLocal: true };
|
|
11709
|
+
} else {
|
|
11710
|
+
throw new Error("auth option or EYEPOP_SECRET_KEY environment variable is required");
|
|
11711
|
+
}
|
|
11712
|
+
}
|
|
11713
|
+
if (opts.popId === void 0) {
|
|
11714
|
+
opts.popId = readEnv("EYEPOP_POP_ID") || "transient" /* Transient */;
|
|
11715
|
+
}
|
|
11716
|
+
if (opts.autoStart === void 0) {
|
|
11632
11717
|
opts.autoStart = true;
|
|
11633
11718
|
}
|
|
11634
|
-
if (
|
|
11719
|
+
if (opts.stopJobs === void 0) {
|
|
11635
11720
|
opts.stopJobs = true;
|
|
11636
11721
|
}
|
|
11637
|
-
if (opts.auth
|
|
11722
|
+
if (opts.auth !== void 0) {
|
|
11638
11723
|
if (opts.auth.session !== void 0) {
|
|
11639
|
-
if (opts.auth.session
|
|
11640
|
-
|
|
11724
|
+
if (opts.auth.session !== void 0) {
|
|
11725
|
+
if (opts.auth.session.popId) {
|
|
11726
|
+
opts.popId = opts.auth.session.popId;
|
|
11727
|
+
}
|
|
11641
11728
|
}
|
|
11642
11729
|
}
|
|
11643
11730
|
}
|
|
@@ -11646,7 +11733,10 @@ var EyePop;
|
|
|
11646
11733
|
EyePop2.workerEndpoint = workerEndpoint;
|
|
11647
11734
|
function dataEndpoint(opts = {}) {
|
|
11648
11735
|
_fill_default_options(opts);
|
|
11649
|
-
if (
|
|
11736
|
+
if (opts.auth === void 0) {
|
|
11737
|
+
throw new Error("auth option or EYEPOP_SECRET_KEY environment variable is required");
|
|
11738
|
+
}
|
|
11739
|
+
if (opts.accountId === void 0) {
|
|
11650
11740
|
opts.accountId = readEnv("EYEPOP_ACCOUNT_ID");
|
|
11651
11741
|
}
|
|
11652
11742
|
if (opts.auth.session !== void 0) {
|
|
@@ -11659,45 +11749,44 @@ var EyePop;
|
|
|
11659
11749
|
return new DataEndpoint(opts);
|
|
11660
11750
|
}
|
|
11661
11751
|
EyePop2.dataEndpoint = dataEndpoint;
|
|
11662
|
-
function _fill_default_options(opts) {
|
|
11663
|
-
if (
|
|
11664
|
-
if (typeof defaultAuth == "undefined") {
|
|
11665
|
-
throw new Error("auth option or EYEPOP_SECRET_KEY environment variable is required");
|
|
11666
|
-
}
|
|
11752
|
+
function _fill_default_options(opts, default_eyepop_url = "https://api.eyepop.ai") {
|
|
11753
|
+
if (opts.auth === void 0) {
|
|
11667
11754
|
opts.auth = defaultAuth;
|
|
11668
11755
|
}
|
|
11669
|
-
if (
|
|
11670
|
-
opts.eyepopUrl = readEnv("EYEPOP_URL") ||
|
|
11756
|
+
if (opts.eyepopUrl === void 0) {
|
|
11757
|
+
opts.eyepopUrl = readEnv("EYEPOP_URL") || default_eyepop_url;
|
|
11671
11758
|
}
|
|
11672
|
-
if (
|
|
11759
|
+
if (opts.jobQueueLength === void 0) {
|
|
11673
11760
|
opts.jobQueueLength = 1024;
|
|
11674
11761
|
}
|
|
11675
|
-
if (
|
|
11676
|
-
if (
|
|
11677
|
-
if (opts.
|
|
11678
|
-
opts.
|
|
11679
|
-
|
|
11680
|
-
|
|
11681
|
-
|
|
11682
|
-
|
|
11683
|
-
|
|
11684
|
-
|
|
11685
|
-
|
|
11686
|
-
|
|
11687
|
-
|
|
11688
|
-
|
|
11689
|
-
|
|
11690
|
-
|
|
11691
|
-
|
|
11692
|
-
|
|
11693
|
-
|
|
11694
|
-
|
|
11762
|
+
if (opts.auth !== void 0) {
|
|
11763
|
+
if (opts.auth.oAuth2 !== void 0) {
|
|
11764
|
+
if (typeof opts.auth.oAuth2 === "boolean") {
|
|
11765
|
+
if (opts.eyepopUrl.startsWith("https://web-api.staging.eyepop.xyz")) {
|
|
11766
|
+
opts.auth = {
|
|
11767
|
+
oAuth2: {
|
|
11768
|
+
domain: "dev-eyepop.us.auth0.com",
|
|
11769
|
+
clientId: "jktx3YO2UnbkNPvr05PQWf26t1kNTJyg",
|
|
11770
|
+
audience: "https://dev-app.eyepop.ai",
|
|
11771
|
+
scope: "admin:clouds access:inference-api access:datasets"
|
|
11772
|
+
}
|
|
11773
|
+
};
|
|
11774
|
+
} else {
|
|
11775
|
+
opts.auth = {
|
|
11776
|
+
oAuth2: {
|
|
11777
|
+
domain: "eyepop.us.auth0.com",
|
|
11778
|
+
clientId: "Lb9ubA9Hf3jlaqWLUx8XgA0zvotgViCl",
|
|
11779
|
+
audience: "https://api.eyepop.ai",
|
|
11780
|
+
scope: "admin:clouds access:inference-api access:datasets"
|
|
11781
|
+
}
|
|
11782
|
+
};
|
|
11783
|
+
}
|
|
11695
11784
|
}
|
|
11696
11785
|
}
|
|
11697
|
-
|
|
11698
|
-
|
|
11699
|
-
|
|
11700
|
-
|
|
11786
|
+
if (opts.auth.session !== void 0) {
|
|
11787
|
+
if (opts.auth.session.eyepopUrl) {
|
|
11788
|
+
opts.eyepopUrl = opts.auth.session.eyepopUrl;
|
|
11789
|
+
}
|
|
11701
11790
|
}
|
|
11702
11791
|
}
|
|
11703
11792
|
}
|