@eyepop.ai/eyepop 1.9.2 → 1.11.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 -107
- package/dist/eyepop.index.d.mts +37 -6
- package/dist/eyepop.index.d.ts +37 -6
- package/dist/eyepop.index.js +288 -229
- package/dist/eyepop.index.js.map +1 -1
- package/dist/eyepop.index.mjs +286 -229
- package/dist/eyepop.index.mjs.map +1 -1
- package/dist/eyepop.min.js +1 -1
- package/dist/eyepop.min.js.LICENSE.txt +0 -9
- package/package.json +45 -43
package/dist/eyepop.index.mjs
CHANGED
|
@@ -8755,10 +8755,7 @@ var Stream = class _Stream {
|
|
|
8755
8755
|
}
|
|
8756
8756
|
};
|
|
8757
8757
|
};
|
|
8758
|
-
return [
|
|
8759
|
-
new _Stream(() => teeIterator(left), this.controller),
|
|
8760
|
-
new _Stream(() => teeIterator(right), this.controller)
|
|
8761
|
-
];
|
|
8758
|
+
return [new _Stream(() => teeIterator(left), this.controller), new _Stream(() => teeIterator(right), this.controller)];
|
|
8762
8759
|
}
|
|
8763
8760
|
/**
|
|
8764
8761
|
* Converts this stream to a newline-separated ReadableStream of
|
|
@@ -8842,13 +8839,9 @@ var _LineDecoder = class _LineDecoder {
|
|
|
8842
8839
|
this.textDecoder ?? (this.textDecoder = new TextDecoder("utf8"));
|
|
8843
8840
|
return this.textDecoder.decode(bytes);
|
|
8844
8841
|
}
|
|
8845
|
-
throw new Error(
|
|
8846
|
-
`Unexpected: received non-Uint8Array/ArrayBuffer (${bytes.constructor.name}) in a web platform. Please report this error.`
|
|
8847
|
-
);
|
|
8842
|
+
throw new Error(`Unexpected: received non-Uint8Array/ArrayBuffer (${bytes.constructor.name}) in a web platform. Please report this error.`);
|
|
8848
8843
|
}
|
|
8849
|
-
throw new Error(
|
|
8850
|
-
`Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.`
|
|
8851
|
-
);
|
|
8844
|
+
throw new Error(`Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.`);
|
|
8852
8845
|
}
|
|
8853
8846
|
flush() {
|
|
8854
8847
|
if (!this.buffer.length && !this.trailingCR) {
|
|
@@ -8904,13 +8897,9 @@ var AbstractJob = class {
|
|
|
8904
8897
|
if (!this._responseStream) {
|
|
8905
8898
|
throw Error("logical bug");
|
|
8906
8899
|
}
|
|
8907
|
-
return Stream.iterFromReadableStream(
|
|
8908
|
-
this.
|
|
8909
|
-
|
|
8910
|
-
async (event) => {
|
|
8911
|
-
return await this.onEvent(event);
|
|
8912
|
-
}
|
|
8913
|
-
);
|
|
8900
|
+
return Stream.iterFromReadableStream(this._responseStream, this._controller, async (event) => {
|
|
8901
|
+
return await this.onEvent(event);
|
|
8902
|
+
});
|
|
8914
8903
|
}
|
|
8915
8904
|
async startJob() {
|
|
8916
8905
|
return Promise.reject("abstract class");
|
|
@@ -9004,8 +8993,8 @@ var UploadJob = class extends AbstractJob {
|
|
|
9004
8993
|
formData.append("params", paramBlob);
|
|
9005
8994
|
formData.append("file", this._uploadStream);
|
|
9006
8995
|
const headers = {
|
|
9007
|
-
|
|
9008
|
-
|
|
8996
|
+
...session.authenticationHeaders(),
|
|
8997
|
+
Accept: "application/jsonl"
|
|
9009
8998
|
};
|
|
9010
8999
|
request = this._client.fetch(postUrl, {
|
|
9011
9000
|
headers,
|
|
@@ -9018,8 +9007,8 @@ var UploadJob = class extends AbstractJob {
|
|
|
9018
9007
|
} else {
|
|
9019
9008
|
this._requestLogger.debug("before POST %s with stream as body", postUrl);
|
|
9020
9009
|
const headers = {
|
|
9021
|
-
|
|
9022
|
-
|
|
9010
|
+
...session.authenticationHeaders(),
|
|
9011
|
+
Accept: "application/jsonl",
|
|
9023
9012
|
"Content-Type": this._mimeType
|
|
9024
9013
|
};
|
|
9025
9014
|
request = this._client.fetch(postUrl, {
|
|
@@ -9052,8 +9041,8 @@ var UploadJob = class extends AbstractJob {
|
|
|
9052
9041
|
if (this._needsFullDuplex) {
|
|
9053
9042
|
const prepareUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/prepareSource?timeout=10s`;
|
|
9054
9043
|
const headers = {
|
|
9055
|
-
|
|
9056
|
-
|
|
9044
|
+
...session.authenticationHeaders(),
|
|
9045
|
+
Accept: "application/jsonl"
|
|
9057
9046
|
};
|
|
9058
9047
|
this._requestLogger.debug("before POST %s to prepare full duplex upload", prepareUrl);
|
|
9059
9048
|
response = await this._client.fetch(prepareUrl, {
|
|
@@ -9074,8 +9063,8 @@ var UploadJob = class extends AbstractJob {
|
|
|
9074
9063
|
formData.append("params", paramBlob);
|
|
9075
9064
|
formData.append("file", this._uploadStream);
|
|
9076
9065
|
const headers = {
|
|
9077
|
-
|
|
9078
|
-
|
|
9066
|
+
...session.authenticationHeaders(),
|
|
9067
|
+
Accept: "application/jsonl"
|
|
9079
9068
|
};
|
|
9080
9069
|
response = await this._client.fetch(postUrl, {
|
|
9081
9070
|
headers,
|
|
@@ -9089,8 +9078,8 @@ var UploadJob = class extends AbstractJob {
|
|
|
9089
9078
|
} else {
|
|
9090
9079
|
this._requestLogger.debug("before POST %s with stream as body", postUrl);
|
|
9091
9080
|
const headers = {
|
|
9092
|
-
|
|
9093
|
-
|
|
9081
|
+
...session.authenticationHeaders(),
|
|
9082
|
+
Accept: "application/jsonl",
|
|
9094
9083
|
"Content-Type": this._mimeType
|
|
9095
9084
|
};
|
|
9096
9085
|
response = await this._client.fetch(postUrl, {
|
|
@@ -9121,13 +9110,13 @@ var LoadFromJob = class extends AbstractJob {
|
|
|
9121
9110
|
return Promise.reject("session.baseUrl must not ne null");
|
|
9122
9111
|
}
|
|
9123
9112
|
const body = {
|
|
9124
|
-
|
|
9125
|
-
|
|
9126
|
-
|
|
9113
|
+
sourceType: "URL",
|
|
9114
|
+
url: this._location,
|
|
9115
|
+
params: this._params
|
|
9127
9116
|
};
|
|
9128
9117
|
const headers = {
|
|
9129
|
-
|
|
9130
|
-
|
|
9118
|
+
...session.authenticationHeaders(),
|
|
9119
|
+
Accept: "application/jsonl",
|
|
9131
9120
|
"Content-Type": "application/json"
|
|
9132
9121
|
};
|
|
9133
9122
|
const patchUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=sync`;
|
|
@@ -9156,13 +9145,13 @@ var LoadLiveIngressJob = class extends AbstractJob {
|
|
|
9156
9145
|
return Promise.reject("session.baseUrl must not ne null");
|
|
9157
9146
|
}
|
|
9158
9147
|
const body = {
|
|
9159
|
-
|
|
9160
|
-
|
|
9161
|
-
|
|
9148
|
+
sourceType: "LIVE_INGRESS",
|
|
9149
|
+
liveIngressId: this._ingressId,
|
|
9150
|
+
params: this._params
|
|
9162
9151
|
};
|
|
9163
9152
|
const headers = {
|
|
9164
|
-
|
|
9165
|
-
|
|
9153
|
+
...session.authenticationHeaders(),
|
|
9154
|
+
Accept: "application/jsonl",
|
|
9166
9155
|
"Content-Type": "application/json"
|
|
9167
9156
|
};
|
|
9168
9157
|
const patchUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=preempt&processing=sync`;
|
|
@@ -9178,52 +9167,8 @@ var LoadLiveIngressJob = class extends AbstractJob {
|
|
|
9178
9167
|
}
|
|
9179
9168
|
};
|
|
9180
9169
|
|
|
9181
|
-
//
|
|
9182
|
-
import
|
|
9183
|
-
var rnds8Pool = new Uint8Array(256);
|
|
9184
|
-
var poolPtr = rnds8Pool.length;
|
|
9185
|
-
function rng() {
|
|
9186
|
-
if (poolPtr > rnds8Pool.length - 16) {
|
|
9187
|
-
crypto.randomFillSync(rnds8Pool);
|
|
9188
|
-
poolPtr = 0;
|
|
9189
|
-
}
|
|
9190
|
-
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
9191
|
-
}
|
|
9192
|
-
|
|
9193
|
-
// ../../node_modules/uuid/dist/esm-node/stringify.js
|
|
9194
|
-
var byteToHex = [];
|
|
9195
|
-
for (let i = 0; i < 256; ++i) {
|
|
9196
|
-
byteToHex.push((i + 256).toString(16).slice(1));
|
|
9197
|
-
}
|
|
9198
|
-
function unsafeStringify(arr, offset = 0) {
|
|
9199
|
-
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
9200
|
-
}
|
|
9201
|
-
|
|
9202
|
-
// ../../node_modules/uuid/dist/esm-node/native.js
|
|
9203
|
-
import crypto2 from "crypto";
|
|
9204
|
-
var native_default = {
|
|
9205
|
-
randomUUID: crypto2.randomUUID
|
|
9206
|
-
};
|
|
9207
|
-
|
|
9208
|
-
// ../../node_modules/uuid/dist/esm-node/v4.js
|
|
9209
|
-
function v4(options, buf, offset) {
|
|
9210
|
-
if (native_default.randomUUID && !buf && !options) {
|
|
9211
|
-
return native_default.randomUUID();
|
|
9212
|
-
}
|
|
9213
|
-
options = options || {};
|
|
9214
|
-
const rnds = options.random || (options.rng || rng)();
|
|
9215
|
-
rnds[6] = rnds[6] & 15 | 64;
|
|
9216
|
-
rnds[8] = rnds[8] & 63 | 128;
|
|
9217
|
-
if (buf) {
|
|
9218
|
-
offset = offset || 0;
|
|
9219
|
-
for (let i = 0; i < 16; ++i) {
|
|
9220
|
-
buf[offset + i] = rnds[i];
|
|
9221
|
-
}
|
|
9222
|
-
return buf;
|
|
9223
|
-
}
|
|
9224
|
-
return unsafeStringify(rnds);
|
|
9225
|
-
}
|
|
9226
|
-
var v4_default = v4;
|
|
9170
|
+
// worker/webrtc_whip.ts
|
|
9171
|
+
import { v4 as uuidv4 } from "uuid";
|
|
9227
9172
|
|
|
9228
9173
|
// worker/webrtc_base.ts
|
|
9229
9174
|
import path from "path";
|
|
@@ -9263,7 +9208,7 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9263
9208
|
const ingressUrl = new URL(this._urlPath, session.baseUrl);
|
|
9264
9209
|
this._requestLogger.debug("before POST: %s", ingressUrl);
|
|
9265
9210
|
const headers = {
|
|
9266
|
-
|
|
9211
|
+
...session.authenticationHeaders(),
|
|
9267
9212
|
"Content-Type": "application/sdp"
|
|
9268
9213
|
};
|
|
9269
9214
|
const response = await this._client.fetch(ingressUrl, {
|
|
@@ -9276,10 +9221,12 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9276
9221
|
}
|
|
9277
9222
|
this._eTag = response.headers.get("ETag") ?? "";
|
|
9278
9223
|
this._location = response.headers.get("Location");
|
|
9279
|
-
return this.onRemoteAnswer(
|
|
9280
|
-
|
|
9281
|
-
|
|
9282
|
-
|
|
9224
|
+
return this.onRemoteAnswer(
|
|
9225
|
+
new RTCSessionDescription({
|
|
9226
|
+
type: "answer",
|
|
9227
|
+
sdp: await response.text()
|
|
9228
|
+
})
|
|
9229
|
+
);
|
|
9283
9230
|
}
|
|
9284
9231
|
async sendLocalCandidates(candidates) {
|
|
9285
9232
|
if (!this._offerData) {
|
|
@@ -9295,7 +9242,7 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9295
9242
|
const ingressUrl = new URL(urlPath, session.baseUrl);
|
|
9296
9243
|
this._requestLogger.debug("before PATCH: %s", ingressUrl);
|
|
9297
9244
|
const headers = {
|
|
9298
|
-
|
|
9245
|
+
...session.authenticationHeaders(),
|
|
9299
9246
|
"Content-Type": "application/trickle-ice-sdpfrag",
|
|
9300
9247
|
"If-Match": this._eTag
|
|
9301
9248
|
};
|
|
@@ -9469,18 +9416,15 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9469
9416
|
// worker/webrtc_whip.ts
|
|
9470
9417
|
var WebrtcWhip = class extends WebrtcBase {
|
|
9471
9418
|
constructor(stream, getSession, client, requestLogger) {
|
|
9472
|
-
super(getSession, client,
|
|
9419
|
+
super(getSession, client, uuidv4().toString(), "/liveIngress/whip", requestLogger);
|
|
9473
9420
|
this._stream = stream;
|
|
9474
9421
|
}
|
|
9475
9422
|
async start() {
|
|
9476
9423
|
const session = await this._getSession();
|
|
9477
9424
|
const ingressUrl = new URL(this._urlPath, session.baseUrl);
|
|
9478
9425
|
this._requestLogger.debug("before GET: %s", ingressUrl);
|
|
9479
|
-
const headers = {
|
|
9480
|
-
"Authorization": `Bearer ${session.accessToken}`
|
|
9481
|
-
};
|
|
9482
9426
|
const response = await this._client.fetch(ingressUrl, {
|
|
9483
|
-
headers,
|
|
9427
|
+
headers: session.authenticationHeaders(),
|
|
9484
9428
|
method: "GET"
|
|
9485
9429
|
});
|
|
9486
9430
|
if (response.status >= 300) {
|
|
@@ -9580,11 +9524,8 @@ var WebrtcWhep = class extends WebrtcBase {
|
|
|
9580
9524
|
const session = await this._getSession();
|
|
9581
9525
|
const egressUrl = new URL(this._urlPath, session.baseUrl);
|
|
9582
9526
|
this._requestLogger.debug("before GET: %s", egressUrl);
|
|
9583
|
-
const headers = {
|
|
9584
|
-
"Authorization": `Bearer ${session.accessToken}`
|
|
9585
|
-
};
|
|
9586
9527
|
const response = await this._client.fetch(egressUrl, {
|
|
9587
|
-
headers,
|
|
9528
|
+
headers: session.authenticationHeaders(),
|
|
9588
9529
|
method: "GET"
|
|
9589
9530
|
});
|
|
9590
9531
|
if (response.status >= 300) {
|
|
@@ -9686,7 +9627,7 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9686
9627
|
constructor() {
|
|
9687
9628
|
}
|
|
9688
9629
|
async fetch(input, init) {
|
|
9689
|
-
return fetch(input, init);
|
|
9630
|
+
return await fetch(input, init);
|
|
9690
9631
|
}
|
|
9691
9632
|
async close() {
|
|
9692
9633
|
}
|
|
@@ -9702,7 +9643,7 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9702
9643
|
async fetch(input, init) {
|
|
9703
9644
|
init || (init = {});
|
|
9704
9645
|
init.dispatcher = this.agent;
|
|
9705
|
-
return fetch(input, init);
|
|
9646
|
+
return await fetch(input, init);
|
|
9706
9647
|
}
|
|
9707
9648
|
async close() {
|
|
9708
9649
|
return this.agent.close();
|
|
@@ -9980,6 +9921,7 @@ var Endpoint = class {
|
|
|
9980
9921
|
this._expire_token_time = this._options.auth.session.validUntil / 1e3;
|
|
9981
9922
|
} else if (this._options.auth.oAuth2 !== void 0) {
|
|
9982
9923
|
} else if (this._options.auth.secretKey !== void 0) {
|
|
9924
|
+
} else if (this._options.auth.isLocal !== void 0) {
|
|
9983
9925
|
} else {
|
|
9984
9926
|
return Promise.reject("option secretKey or environment variable EYEPOP_SECRET_KEY is required");
|
|
9985
9927
|
}
|
|
@@ -10017,7 +9959,7 @@ var Endpoint = class {
|
|
|
10017
9959
|
while (true) {
|
|
10018
9960
|
try {
|
|
10019
9961
|
const response = await fetcher();
|
|
10020
|
-
if (response.
|
|
9962
|
+
if (response.ok) {
|
|
10021
9963
|
return response;
|
|
10022
9964
|
} else {
|
|
10023
9965
|
const handler = this._statusRetryHandlers.get(response.status);
|
|
@@ -10026,10 +9968,10 @@ var Endpoint = class {
|
|
|
10026
9968
|
if (retries--) {
|
|
10027
9969
|
this._requestLogger.info("received %d response, retry", response.status);
|
|
10028
9970
|
} else {
|
|
10029
|
-
return
|
|
9971
|
+
return response;
|
|
10030
9972
|
}
|
|
10031
9973
|
} else {
|
|
10032
|
-
return
|
|
9974
|
+
return response;
|
|
10033
9975
|
}
|
|
10034
9976
|
}
|
|
10035
9977
|
} catch (error) {
|
|
@@ -10051,6 +9993,9 @@ var Endpoint = class {
|
|
|
10051
9993
|
throw new Error("reconnect() not implemented");
|
|
10052
9994
|
}
|
|
10053
9995
|
async authorizationHeader() {
|
|
9996
|
+
if (this._options.auth.isLocal !== void 0) {
|
|
9997
|
+
return `Implicit`;
|
|
9998
|
+
}
|
|
10054
9999
|
return `Bearer ${await this.currentAccessToken()}`;
|
|
10055
10000
|
}
|
|
10056
10001
|
async currentAccessToken() {
|
|
@@ -10060,6 +10005,9 @@ var Endpoint = class {
|
|
|
10060
10005
|
try {
|
|
10061
10006
|
if (!this._client) {
|
|
10062
10007
|
return Promise.reject("endpoint not connected");
|
|
10008
|
+
} else if (this._options.auth.isLocal !== void 0) {
|
|
10009
|
+
this._token = "implicit";
|
|
10010
|
+
this._expire_token_time = Number.MAX_VALUE;
|
|
10063
10011
|
} else if (this._options.auth.session !== void 0) {
|
|
10064
10012
|
return Promise.reject("temporary access token expired");
|
|
10065
10013
|
} else if (this._options.auth.oAuth2 !== void 0 && this._options.eyepopUrl) {
|
|
@@ -10068,7 +10016,7 @@ var Endpoint = class {
|
|
|
10068
10016
|
this._expire_token_time = session.validUntil / 1e3;
|
|
10069
10017
|
} else if (this._options.auth.secretKey !== void 0 && this._options.eyepopUrl) {
|
|
10070
10018
|
const secretKeyAuth = this._options.auth;
|
|
10071
|
-
const body = {
|
|
10019
|
+
const body = { secret_key: secretKeyAuth.secretKey };
|
|
10072
10020
|
const headers = { "Content-Type": "application/json" };
|
|
10073
10021
|
const post_url = `${this.eyepopUrl()}/authentication/token`;
|
|
10074
10022
|
this._requestLogger.debug("before POST %s", post_url);
|
|
@@ -10117,7 +10065,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10117
10065
|
this._ingressEventWs = null;
|
|
10118
10066
|
this._sandboxId = null;
|
|
10119
10067
|
const sessionAuth = options.auth;
|
|
10120
|
-
if (sessionAuth.session !== void 0) {
|
|
10068
|
+
if (sessionAuth !== void 0 && sessionAuth.session !== void 0) {
|
|
10121
10069
|
const workerSession = sessionAuth.session;
|
|
10122
10070
|
if (workerSession.sandboxId) {
|
|
10123
10071
|
this._sandboxId = workerSession.sandboxId;
|
|
@@ -10129,10 +10077,26 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10129
10077
|
return this._options;
|
|
10130
10078
|
}
|
|
10131
10079
|
async disconnect(wait = true) {
|
|
10080
|
+
if (this.options().popId == "transient" /* Transient */ && this._pipelineId) {
|
|
10081
|
+
const deleteUrl = `${this._baseUrl}/pipelines/${this._pipelineId}`;
|
|
10082
|
+
const headers = {
|
|
10083
|
+
Authorization: await this.authorizationHeader()
|
|
10084
|
+
};
|
|
10085
|
+
this._requestLogger.debug("before DELETE %s", deleteUrl);
|
|
10086
|
+
let response = await this._client?.fetch(deleteUrl, {
|
|
10087
|
+
method: "DELETE",
|
|
10088
|
+
headers
|
|
10089
|
+
});
|
|
10090
|
+
this._requestLogger.debug("after DELETE %s", deleteUrl);
|
|
10091
|
+
if (response?.status != 204) {
|
|
10092
|
+
const message = await response?.text();
|
|
10093
|
+
this._logger.info(`stoppping pipeline failed, status ${response?.status}: ${message}`);
|
|
10094
|
+
}
|
|
10095
|
+
}
|
|
10132
10096
|
if (this._sandboxId && this._baseUrl) {
|
|
10133
10097
|
const sandboxUrl = `${this._baseUrl}/sandboxes/${this._sandboxId}`;
|
|
10134
10098
|
const headers = {
|
|
10135
|
-
|
|
10099
|
+
Authorization: await this.authorizationHeader()
|
|
10136
10100
|
};
|
|
10137
10101
|
this._requestLogger.debug("before DELETE %s", sandboxUrl);
|
|
10138
10102
|
let response = await this._client?.fetch(sandboxUrl, {
|
|
@@ -10142,7 +10106,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10142
10106
|
this._requestLogger.debug("after DELETE %s", sandboxUrl);
|
|
10143
10107
|
if (response?.status != 204) {
|
|
10144
10108
|
const message = await response?.text();
|
|
10145
|
-
|
|
10109
|
+
this._logger.info(`disconnecting sandbox failed, status ${response?.status}: ${message}`);
|
|
10146
10110
|
}
|
|
10147
10111
|
this._sandboxId = null;
|
|
10148
10112
|
}
|
|
@@ -10167,7 +10131,8 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10167
10131
|
popId: this.options().popId,
|
|
10168
10132
|
baseUrl: this._baseUrl,
|
|
10169
10133
|
pipelineId: this._pipelineId,
|
|
10170
|
-
sandboxId: this._sandboxId ?? void 0
|
|
10134
|
+
sandboxId: this._sandboxId ?? void 0,
|
|
10135
|
+
authenticationHeaders: () => this._authenticationHeaders(session)
|
|
10171
10136
|
};
|
|
10172
10137
|
}
|
|
10173
10138
|
popName() {
|
|
@@ -10189,12 +10154,12 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10189
10154
|
let response = await this.fetchWithRetry(async () => {
|
|
10190
10155
|
const session = await this.session();
|
|
10191
10156
|
let headers = {
|
|
10192
|
-
"
|
|
10193
|
-
|
|
10157
|
+
"Content-Type": "application/json",
|
|
10158
|
+
...this._authenticationHeaders(session)
|
|
10194
10159
|
};
|
|
10195
10160
|
const patch_url = `${session.baseUrl}/pipelines/${session.pipelineId}/pop`;
|
|
10196
10161
|
this._requestLogger.debug("before PATCH %s - %s", patch_url, JSON.stringify(pop));
|
|
10197
|
-
return client.fetch(patch_url, {
|
|
10162
|
+
return await client.fetch(patch_url, {
|
|
10198
10163
|
method: "PATCH",
|
|
10199
10164
|
body: JSON.stringify(pop),
|
|
10200
10165
|
headers
|
|
@@ -10202,7 +10167,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10202
10167
|
});
|
|
10203
10168
|
if (response.status != 204) {
|
|
10204
10169
|
const message = await response.text();
|
|
10205
|
-
console.error(message);
|
|
10206
10170
|
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
10207
10171
|
}
|
|
10208
10172
|
this._requestLogger.debug("after PATCH pop");
|
|
@@ -10210,6 +10174,9 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10210
10174
|
this._pipeline.pop = pop;
|
|
10211
10175
|
}
|
|
10212
10176
|
}
|
|
10177
|
+
_authenticationHeaders(session) {
|
|
10178
|
+
return this._options.auth.isLocal !== void 0 ? {} : { Authorization: `Bearer ${session.accessToken}` };
|
|
10179
|
+
}
|
|
10213
10180
|
/**
|
|
10214
10181
|
* @deprecated use pop() instead
|
|
10215
10182
|
*/
|
|
@@ -10230,13 +10197,13 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10230
10197
|
return Promise.reject("endpoint not connected, use connect() before changePopComp()");
|
|
10231
10198
|
}
|
|
10232
10199
|
const body = {
|
|
10233
|
-
|
|
10234
|
-
|
|
10200
|
+
pipeline: popComp,
|
|
10201
|
+
modelRefs
|
|
10235
10202
|
};
|
|
10236
10203
|
let response = await this.fetchWithRetry(async () => {
|
|
10237
10204
|
const session = await this.session();
|
|
10238
10205
|
let headers = {
|
|
10239
|
-
|
|
10206
|
+
...this._authenticationHeaders(session),
|
|
10240
10207
|
"Content-Type": "application/json"
|
|
10241
10208
|
};
|
|
10242
10209
|
const patch_url = `${session.baseUrl}/pipelines/${session.pipelineId}/inferencePipeline`;
|
|
@@ -10248,7 +10215,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10248
10215
|
});
|
|
10249
10216
|
if (response.status != 204) {
|
|
10250
10217
|
const message = await response.text();
|
|
10251
|
-
console.error(message);
|
|
10252
10218
|
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
10253
10219
|
}
|
|
10254
10220
|
if (this._pipeline) {
|
|
@@ -10276,12 +10242,12 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10276
10242
|
return Promise.reject("endpoint not connected, use connect() before changePopComp()");
|
|
10277
10243
|
}
|
|
10278
10244
|
const body = {
|
|
10279
|
-
|
|
10245
|
+
transform: postTransform
|
|
10280
10246
|
};
|
|
10281
10247
|
let response = await this.fetchWithRetry(async () => {
|
|
10282
10248
|
const session = await this.session();
|
|
10283
10249
|
let headers = {
|
|
10284
|
-
|
|
10250
|
+
...this._authenticationHeaders(session),
|
|
10285
10251
|
"Content-Type": "application/json"
|
|
10286
10252
|
};
|
|
10287
10253
|
const patch_url = `${session.baseUrl}/pipelines/${session.pipelineId}/postTransform`;
|
|
@@ -10314,18 +10280,28 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10314
10280
|
if (!this._baseUrl || !this._client) {
|
|
10315
10281
|
return Promise.reject("endpoint not connected, use connect() before ingress()");
|
|
10316
10282
|
}
|
|
10317
|
-
const whip = new WebrtcWhip(
|
|
10318
|
-
|
|
10319
|
-
|
|
10283
|
+
const whip = new WebrtcWhip(
|
|
10284
|
+
stream,
|
|
10285
|
+
async () => {
|
|
10286
|
+
return this.session();
|
|
10287
|
+
},
|
|
10288
|
+
this._client,
|
|
10289
|
+
this._requestLogger
|
|
10290
|
+
);
|
|
10320
10291
|
return whip.start();
|
|
10321
10292
|
}
|
|
10322
10293
|
async liveEgress(ingressId) {
|
|
10323
10294
|
if (!this._baseUrl || !this._client) {
|
|
10324
10295
|
return Promise.reject("endpoint not connected, use connect() before ingress()");
|
|
10325
10296
|
}
|
|
10326
|
-
const whep = new WebrtcWhep(
|
|
10327
|
-
|
|
10328
|
-
|
|
10297
|
+
const whep = new WebrtcWhep(
|
|
10298
|
+
ingressId,
|
|
10299
|
+
async () => {
|
|
10300
|
+
return this.session();
|
|
10301
|
+
},
|
|
10302
|
+
this._client,
|
|
10303
|
+
this._requestLogger
|
|
10304
|
+
);
|
|
10329
10305
|
return whep.start();
|
|
10330
10306
|
}
|
|
10331
10307
|
async process(source, params = void 0) {
|
|
@@ -10352,7 +10328,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10352
10328
|
const session = await this.session();
|
|
10353
10329
|
let response = await this.fetchWithRetry(async () => {
|
|
10354
10330
|
const headers = {
|
|
10355
|
-
|
|
10331
|
+
...this._authenticationHeaders(session)
|
|
10356
10332
|
};
|
|
10357
10333
|
const getTokenUrl = `${session.baseUrl}/liveIngress/events/token`;
|
|
10358
10334
|
return client.fetch(getTokenUrl, { headers });
|
|
@@ -10381,14 +10357,24 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10381
10357
|
await this._limit.acquire();
|
|
10382
10358
|
try {
|
|
10383
10359
|
this.updateState();
|
|
10384
|
-
const job = new UploadJob(
|
|
10385
|
-
|
|
10386
|
-
|
|
10387
|
-
|
|
10388
|
-
|
|
10389
|
-
|
|
10390
|
-
|
|
10391
|
-
|
|
10360
|
+
const job = new UploadJob(
|
|
10361
|
+
source.file,
|
|
10362
|
+
source.file.type,
|
|
10363
|
+
params,
|
|
10364
|
+
async () => {
|
|
10365
|
+
return this.session();
|
|
10366
|
+
},
|
|
10367
|
+
this._client,
|
|
10368
|
+
this._requestLogger
|
|
10369
|
+
);
|
|
10370
|
+
return job.start(
|
|
10371
|
+
() => {
|
|
10372
|
+
this.jobDone(job);
|
|
10373
|
+
},
|
|
10374
|
+
(statusCode) => {
|
|
10375
|
+
this.jobStatus(job, statusCode);
|
|
10376
|
+
}
|
|
10377
|
+
);
|
|
10392
10378
|
} catch (e) {
|
|
10393
10379
|
this._limit.release();
|
|
10394
10380
|
throw e;
|
|
@@ -10401,14 +10387,24 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10401
10387
|
await this._limit.acquire();
|
|
10402
10388
|
try {
|
|
10403
10389
|
this.updateState();
|
|
10404
|
-
const job = new UploadJob(
|
|
10405
|
-
|
|
10406
|
-
|
|
10407
|
-
|
|
10408
|
-
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
|
|
10390
|
+
const job = new UploadJob(
|
|
10391
|
+
source.stream,
|
|
10392
|
+
source.mimeType,
|
|
10393
|
+
params,
|
|
10394
|
+
async () => {
|
|
10395
|
+
return this.session();
|
|
10396
|
+
},
|
|
10397
|
+
this._client,
|
|
10398
|
+
this._requestLogger
|
|
10399
|
+
);
|
|
10400
|
+
return job.start(
|
|
10401
|
+
() => {
|
|
10402
|
+
this.jobDone(job);
|
|
10403
|
+
},
|
|
10404
|
+
(statusCode) => {
|
|
10405
|
+
this.jobStatus(job, statusCode);
|
|
10406
|
+
}
|
|
10407
|
+
);
|
|
10412
10408
|
} catch (e) {
|
|
10413
10409
|
this._limit.release();
|
|
10414
10410
|
throw e;
|
|
@@ -10422,14 +10418,24 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10422
10418
|
try {
|
|
10423
10419
|
this.updateState();
|
|
10424
10420
|
const streamSource = await resolvePath(source);
|
|
10425
|
-
const job = new UploadJob(
|
|
10426
|
-
|
|
10427
|
-
|
|
10428
|
-
|
|
10429
|
-
|
|
10430
|
-
|
|
10431
|
-
|
|
10432
|
-
|
|
10421
|
+
const job = new UploadJob(
|
|
10422
|
+
streamSource.stream,
|
|
10423
|
+
streamSource.mimeType,
|
|
10424
|
+
params,
|
|
10425
|
+
async () => {
|
|
10426
|
+
return this.session();
|
|
10427
|
+
},
|
|
10428
|
+
this._client,
|
|
10429
|
+
this._requestLogger
|
|
10430
|
+
);
|
|
10431
|
+
return job.start(
|
|
10432
|
+
() => {
|
|
10433
|
+
this.jobDone(job);
|
|
10434
|
+
},
|
|
10435
|
+
(statusCode) => {
|
|
10436
|
+
this.jobStatus(job, statusCode);
|
|
10437
|
+
}
|
|
10438
|
+
);
|
|
10433
10439
|
} catch (e) {
|
|
10434
10440
|
this._limit.release();
|
|
10435
10441
|
throw e;
|
|
@@ -10442,14 +10448,23 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10442
10448
|
await this._limit.acquire();
|
|
10443
10449
|
try {
|
|
10444
10450
|
this.updateState();
|
|
10445
|
-
const job = new LoadFromJob(
|
|
10446
|
-
|
|
10447
|
-
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
this.
|
|
10452
|
-
|
|
10451
|
+
const job = new LoadFromJob(
|
|
10452
|
+
source.url,
|
|
10453
|
+
params,
|
|
10454
|
+
async () => {
|
|
10455
|
+
return this.session();
|
|
10456
|
+
},
|
|
10457
|
+
this._client,
|
|
10458
|
+
this._requestLogger
|
|
10459
|
+
);
|
|
10460
|
+
return job.start(
|
|
10461
|
+
() => {
|
|
10462
|
+
this.jobDone(job);
|
|
10463
|
+
},
|
|
10464
|
+
(statusCode) => {
|
|
10465
|
+
this.jobStatus(job, statusCode);
|
|
10466
|
+
}
|
|
10467
|
+
);
|
|
10453
10468
|
} catch (e) {
|
|
10454
10469
|
this._limit.release();
|
|
10455
10470
|
throw e;
|
|
@@ -10462,14 +10477,23 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10462
10477
|
await this._limit.acquire();
|
|
10463
10478
|
try {
|
|
10464
10479
|
this.updateState();
|
|
10465
|
-
const job = new LoadLiveIngressJob(
|
|
10466
|
-
|
|
10467
|
-
|
|
10468
|
-
|
|
10469
|
-
|
|
10470
|
-
|
|
10471
|
-
this.
|
|
10472
|
-
|
|
10480
|
+
const job = new LoadLiveIngressJob(
|
|
10481
|
+
source.ingressId,
|
|
10482
|
+
params,
|
|
10483
|
+
async () => {
|
|
10484
|
+
return this.session();
|
|
10485
|
+
},
|
|
10486
|
+
this._client,
|
|
10487
|
+
this._requestLogger
|
|
10488
|
+
);
|
|
10489
|
+
return job.start(
|
|
10490
|
+
() => {
|
|
10491
|
+
this.jobDone(job);
|
|
10492
|
+
},
|
|
10493
|
+
(statusCode) => {
|
|
10494
|
+
this.jobStatus(job, statusCode);
|
|
10495
|
+
}
|
|
10496
|
+
);
|
|
10473
10497
|
} catch (e) {
|
|
10474
10498
|
this._limit.release();
|
|
10475
10499
|
throw e;
|
|
@@ -10497,7 +10521,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10497
10521
|
config_url = `${this.eyepopUrl()}/pops/${this.options().popId}/config?auto_start=false`;
|
|
10498
10522
|
}
|
|
10499
10523
|
const headers = {
|
|
10500
|
-
|
|
10524
|
+
Authorization: await this.authorizationHeader()
|
|
10501
10525
|
};
|
|
10502
10526
|
this.updateState("FetchConfig" /* FetchConfig */);
|
|
10503
10527
|
this._requestLogger.debug("before GET %s", config_url);
|
|
@@ -10506,7 +10530,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10506
10530
|
this._requestLogger.debug("after GET %s: 401, about to retry with fresh access token", config_url);
|
|
10507
10531
|
this.statusHandler401(response.status);
|
|
10508
10532
|
const headers2 = {
|
|
10509
|
-
|
|
10533
|
+
Authorization: await this.authorizationHeader()
|
|
10510
10534
|
};
|
|
10511
10535
|
this.updateState("FetchConfig" /* FetchConfig */);
|
|
10512
10536
|
response = await this._client.fetch(config_url, {
|
|
@@ -10528,7 +10552,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10528
10552
|
const auto_start_config_url = `${this.eyepopUrl()}/pops/${this.options().popId}/config?auto_start=true`;
|
|
10529
10553
|
this._requestLogger.debug("pop was not running, trying to autostart with: %s", auto_start_config_url);
|
|
10530
10554
|
const headers2 = {
|
|
10531
|
-
|
|
10555
|
+
Authorization: await this.authorizationHeader()
|
|
10532
10556
|
};
|
|
10533
10557
|
response = await this._client.fetch(auto_start_config_url, {
|
|
10534
10558
|
headers: headers2
|
|
@@ -10546,7 +10570,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10546
10570
|
this._baseUrl = this._baseUrl.replace(/\/+$/, "");
|
|
10547
10571
|
if (this.options().isSandbox && this._sandboxId === null) {
|
|
10548
10572
|
const headers3 = {
|
|
10549
|
-
|
|
10573
|
+
Authorization: await this.authorizationHeader()
|
|
10550
10574
|
};
|
|
10551
10575
|
const createSandboxUrl = `${this._baseUrl}/sandboxes`;
|
|
10552
10576
|
this._requestLogger.debug("before POST %s", createSandboxUrl);
|
|
@@ -10577,7 +10601,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10577
10601
|
this._baseUrl = this._baseUrl.replace(/\/+$/, "");
|
|
10578
10602
|
const get_url = `${this._baseUrl}/pipelines/${this._pipelineId}`;
|
|
10579
10603
|
const headers2 = {
|
|
10580
|
-
|
|
10604
|
+
Authorization: await this.authorizationHeader()
|
|
10581
10605
|
};
|
|
10582
10606
|
this._requestLogger.debug("before GET %s", get_url);
|
|
10583
10607
|
let response2 = await this._client.fetch(get_url, {
|
|
@@ -10591,9 +10615,9 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10591
10615
|
this._requestLogger.debug("after GET %s", get_url);
|
|
10592
10616
|
this._pipeline = await response2.json();
|
|
10593
10617
|
if (this.options().stopJobs) {
|
|
10594
|
-
const body = {
|
|
10618
|
+
const body = { sourceType: "NONE" };
|
|
10595
10619
|
const headers3 = {
|
|
10596
|
-
|
|
10620
|
+
Authorization: await this.authorizationHeader()
|
|
10597
10621
|
};
|
|
10598
10622
|
const stop_url = `${this._baseUrl}/pipelines/${this._pipeline.id}/source?mode=preempt&processing=sync`;
|
|
10599
10623
|
let response3 = await this._client.fetch(stop_url, {
|
|
@@ -10629,13 +10653,13 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10629
10653
|
};
|
|
10630
10654
|
}
|
|
10631
10655
|
const body = {
|
|
10632
|
-
|
|
10633
|
-
|
|
10634
|
-
|
|
10656
|
+
pop,
|
|
10657
|
+
source: {
|
|
10658
|
+
sourceType: "NONE"
|
|
10635
10659
|
},
|
|
10636
|
-
|
|
10637
|
-
|
|
10638
|
-
|
|
10660
|
+
idleTimeoutSeconds: 30,
|
|
10661
|
+
logging: ["out_meta"],
|
|
10662
|
+
videoOutput: "no_output"
|
|
10639
10663
|
};
|
|
10640
10664
|
let post_url;
|
|
10641
10665
|
if (sandboxId) {
|
|
@@ -10646,7 +10670,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10646
10670
|
let response = await this.fetchWithRetry(async () => {
|
|
10647
10671
|
let headers = {
|
|
10648
10672
|
"Content-Type": "application/json",
|
|
10649
|
-
|
|
10673
|
+
Authorization: await this.authorizationHeader()
|
|
10650
10674
|
};
|
|
10651
10675
|
this._requestLogger.debug("before POST %s", post_url);
|
|
10652
10676
|
return client.fetch(post_url, {
|
|
@@ -10679,7 +10703,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10679
10703
|
let response = await this.fetchWithRetry(async () => {
|
|
10680
10704
|
const session = await this.session();
|
|
10681
10705
|
let headers = {
|
|
10682
|
-
|
|
10706
|
+
...this._authenticationHeaders(session),
|
|
10683
10707
|
"Content-Type": "application/json"
|
|
10684
10708
|
};
|
|
10685
10709
|
this._requestLogger.debug("before GET %s", get_path);
|
|
@@ -10709,7 +10733,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10709
10733
|
let response = await this.fetchWithRetry(async () => {
|
|
10710
10734
|
const session = await this.session();
|
|
10711
10735
|
let headers = {
|
|
10712
|
-
|
|
10736
|
+
...this._authenticationHeaders(session),
|
|
10713
10737
|
"Content-Type": "application/json"
|
|
10714
10738
|
};
|
|
10715
10739
|
this._requestLogger.debug("before GET %s", get_path);
|
|
@@ -10739,7 +10763,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10739
10763
|
let response = await this.fetchWithRetry(async () => {
|
|
10740
10764
|
const session = await this.session();
|
|
10741
10765
|
let headers = {
|
|
10742
|
-
|
|
10766
|
+
...this._authenticationHeaders(session),
|
|
10743
10767
|
"Content-Type": "application/json"
|
|
10744
10768
|
};
|
|
10745
10769
|
this._requestLogger.debug("before PUT %s", put_url);
|
|
@@ -10771,7 +10795,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10771
10795
|
let response = await this.fetchWithRetry(async () => {
|
|
10772
10796
|
const session = await this.session();
|
|
10773
10797
|
let headers = {
|
|
10774
|
-
|
|
10798
|
+
...this._authenticationHeaders(session),
|
|
10775
10799
|
"Content-Type": "application/json"
|
|
10776
10800
|
};
|
|
10777
10801
|
this._requestLogger.debug("before POST %s", post_url);
|
|
@@ -10805,7 +10829,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10805
10829
|
let response = await this.fetchWithRetry(async () => {
|
|
10806
10830
|
const session = await this.session();
|
|
10807
10831
|
let headers = {
|
|
10808
|
-
|
|
10832
|
+
...this._authenticationHeaders(session),
|
|
10809
10833
|
"Content-Type": "application/json"
|
|
10810
10834
|
};
|
|
10811
10835
|
this._requestLogger.debug("before DELETE %s", delete_url);
|
|
@@ -10906,6 +10930,11 @@ var UserReview = /* @__PURE__ */ ((UserReview2) => {
|
|
|
10906
10930
|
UserReview2["unknown"] = "unknown";
|
|
10907
10931
|
return UserReview2;
|
|
10908
10932
|
})(UserReview || {});
|
|
10933
|
+
var AutoAnnotateTask = /* @__PURE__ */ ((AutoAnnotateTask2) => {
|
|
10934
|
+
AutoAnnotateTask2["object_detection"] = "object_detection";
|
|
10935
|
+
AutoAnnotateTask2["image_classification"] = "image_classification";
|
|
10936
|
+
return AutoAnnotateTask2;
|
|
10937
|
+
})(AutoAnnotateTask || {});
|
|
10909
10938
|
var TranscodeMode = /* @__PURE__ */ ((TranscodeMode2) => {
|
|
10910
10939
|
TranscodeMode2["original"] = "original";
|
|
10911
10940
|
TranscodeMode2["image_original_size"] = "image_original_size";
|
|
@@ -10921,6 +10950,11 @@ var ModelType = /* @__PURE__ */ ((ModelType2) => {
|
|
|
10921
10950
|
ModelType2["epdet_b1"] = "epdet_b1";
|
|
10922
10951
|
return ModelType2;
|
|
10923
10952
|
})(ModelType || {});
|
|
10953
|
+
var ModelTask = /* @__PURE__ */ ((ModelTask2) => {
|
|
10954
|
+
ModelTask2["object_detection"] = "object_detection";
|
|
10955
|
+
ModelTask2["image_classification"] = "image_classification";
|
|
10956
|
+
return ModelTask2;
|
|
10957
|
+
})(ModelTask || {});
|
|
10924
10958
|
var ModelStatus = /* @__PURE__ */ ((ModelStatus2) => {
|
|
10925
10959
|
ModelStatus2["error"] = "error";
|
|
10926
10960
|
ModelStatus2["draft"] = "draft";
|
|
@@ -11020,7 +11054,7 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11020
11054
|
}
|
|
11021
11055
|
const config_url = `${this.eyepopUrl()}/data/config?account_uuid=${this._accountId}`;
|
|
11022
11056
|
let headers = {
|
|
11023
|
-
|
|
11057
|
+
Authorization: await this.authorizationHeader()
|
|
11024
11058
|
};
|
|
11025
11059
|
this.updateState("FetchConfig" /* FetchConfig */);
|
|
11026
11060
|
this._requestLogger.debug("before GET %s", config_url);
|
|
@@ -11029,7 +11063,7 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11029
11063
|
this._requestLogger.debug("after GET %s: 401, about to retry with fresh access token", config_url);
|
|
11030
11064
|
this.statusHandler401(response.status);
|
|
11031
11065
|
headers = {
|
|
11032
|
-
|
|
11066
|
+
Authorization: await this.authorizationHeader()
|
|
11033
11067
|
};
|
|
11034
11068
|
this.updateState("FetchConfig" /* FetchConfig */);
|
|
11035
11069
|
response = await this._client.fetch(config_url, {
|
|
@@ -11054,7 +11088,7 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11054
11088
|
const client = this._client;
|
|
11055
11089
|
const url = urlJoin(this._baseUrl, "security", "check?set_cookie=true");
|
|
11056
11090
|
const headers2 = {
|
|
11057
|
-
|
|
11091
|
+
Authorization: await this.authorizationHeader()
|
|
11058
11092
|
};
|
|
11059
11093
|
response = await client.fetch(url, {
|
|
11060
11094
|
headers: headers2
|
|
@@ -11141,7 +11175,7 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11141
11175
|
const session = await this.session();
|
|
11142
11176
|
const headers = {
|
|
11143
11177
|
"Content-Type": "application/json",
|
|
11144
|
-
...disableAuth ? {} : {
|
|
11178
|
+
...disableAuth ? {} : { Authorization: `Bearer ${session.accessToken}` },
|
|
11145
11179
|
...options.headers || {}
|
|
11146
11180
|
};
|
|
11147
11181
|
if (!options.body) {
|
|
@@ -11556,6 +11590,13 @@ var readEnv = (env) => {
|
|
|
11556
11590
|
}
|
|
11557
11591
|
return void 0;
|
|
11558
11592
|
};
|
|
11593
|
+
var stringToBooleanSafe = (str) => {
|
|
11594
|
+
if (typeof str == "undefined") {
|
|
11595
|
+
return false;
|
|
11596
|
+
}
|
|
11597
|
+
const loweCaseStr = str.toLowerCase();
|
|
11598
|
+
return loweCaseStr == "true" || loweCaseStr == "yes";
|
|
11599
|
+
};
|
|
11559
11600
|
var EyePop;
|
|
11560
11601
|
((EyePop2) => {
|
|
11561
11602
|
const envSecretKey = readEnv("EYEPOP_SECRET_KEY");
|
|
@@ -11564,20 +11605,32 @@ var EyePop;
|
|
|
11564
11605
|
} : void 0;
|
|
11565
11606
|
EyePop2.endpoint = workerEndpoint;
|
|
11566
11607
|
function workerEndpoint(opts = {}) {
|
|
11567
|
-
|
|
11568
|
-
|
|
11569
|
-
|
|
11608
|
+
if (opts.isLocalMode === void 0) {
|
|
11609
|
+
opts.isLocalMode = stringToBooleanSafe(readEnv("EYEPOP_LOCAL_MODE"));
|
|
11610
|
+
}
|
|
11611
|
+
_fill_default_options(opts, opts.isLocalMode ? "http://127.0.0.1:8080/standalone" : void 0);
|
|
11612
|
+
if (opts.auth === void 0) {
|
|
11613
|
+
if (opts.isLocalMode) {
|
|
11614
|
+
opts.auth = { isLocal: true };
|
|
11615
|
+
} else {
|
|
11616
|
+
throw new Error("auth option or EYEPOP_SECRET_KEY environment variable is required");
|
|
11617
|
+
}
|
|
11570
11618
|
}
|
|
11571
|
-
if (
|
|
11619
|
+
if (opts.popId === void 0) {
|
|
11620
|
+
opts.popId = readEnv("EYEPOP_POP_ID") || "transient" /* Transient */;
|
|
11621
|
+
}
|
|
11622
|
+
if (opts.autoStart === void 0) {
|
|
11572
11623
|
opts.autoStart = true;
|
|
11573
11624
|
}
|
|
11574
|
-
if (
|
|
11625
|
+
if (opts.stopJobs === void 0) {
|
|
11575
11626
|
opts.stopJobs = true;
|
|
11576
11627
|
}
|
|
11577
|
-
if (opts.auth
|
|
11628
|
+
if (opts.auth !== void 0) {
|
|
11578
11629
|
if (opts.auth.session !== void 0) {
|
|
11579
|
-
if (opts.auth.session
|
|
11580
|
-
|
|
11630
|
+
if (opts.auth.session !== void 0) {
|
|
11631
|
+
if (opts.auth.session.popId) {
|
|
11632
|
+
opts.popId = opts.auth.session.popId;
|
|
11633
|
+
}
|
|
11581
11634
|
}
|
|
11582
11635
|
}
|
|
11583
11636
|
}
|
|
@@ -11586,7 +11639,10 @@ var EyePop;
|
|
|
11586
11639
|
EyePop2.workerEndpoint = workerEndpoint;
|
|
11587
11640
|
function dataEndpoint(opts = {}) {
|
|
11588
11641
|
_fill_default_options(opts);
|
|
11589
|
-
if (
|
|
11642
|
+
if (opts.auth === void 0) {
|
|
11643
|
+
throw new Error("auth option or EYEPOP_SECRET_KEY environment variable is required");
|
|
11644
|
+
}
|
|
11645
|
+
if (opts.accountId === void 0) {
|
|
11590
11646
|
opts.accountId = readEnv("EYEPOP_ACCOUNT_ID");
|
|
11591
11647
|
}
|
|
11592
11648
|
if (opts.auth.session !== void 0) {
|
|
@@ -11599,45 +11655,44 @@ var EyePop;
|
|
|
11599
11655
|
return new DataEndpoint(opts);
|
|
11600
11656
|
}
|
|
11601
11657
|
EyePop2.dataEndpoint = dataEndpoint;
|
|
11602
|
-
function _fill_default_options(opts) {
|
|
11603
|
-
if (
|
|
11604
|
-
if (typeof defaultAuth == "undefined") {
|
|
11605
|
-
throw new Error("auth option or EYEPOP_SECRET_KEY environment variable is required");
|
|
11606
|
-
}
|
|
11658
|
+
function _fill_default_options(opts, default_eyepop_url = "https://api.eyepop.ai") {
|
|
11659
|
+
if (opts.auth === void 0) {
|
|
11607
11660
|
opts.auth = defaultAuth;
|
|
11608
11661
|
}
|
|
11609
|
-
if (
|
|
11610
|
-
opts.eyepopUrl = readEnv("EYEPOP_URL") ||
|
|
11662
|
+
if (opts.eyepopUrl === void 0) {
|
|
11663
|
+
opts.eyepopUrl = readEnv("EYEPOP_URL") || default_eyepop_url;
|
|
11611
11664
|
}
|
|
11612
|
-
if (
|
|
11665
|
+
if (opts.jobQueueLength === void 0) {
|
|
11613
11666
|
opts.jobQueueLength = 1024;
|
|
11614
11667
|
}
|
|
11615
|
-
if (
|
|
11616
|
-
if (
|
|
11617
|
-
if (opts.
|
|
11618
|
-
opts.
|
|
11619
|
-
|
|
11620
|
-
|
|
11621
|
-
|
|
11622
|
-
|
|
11623
|
-
|
|
11624
|
-
|
|
11625
|
-
|
|
11626
|
-
|
|
11627
|
-
|
|
11628
|
-
|
|
11629
|
-
|
|
11630
|
-
|
|
11631
|
-
|
|
11632
|
-
|
|
11633
|
-
|
|
11634
|
-
|
|
11668
|
+
if (opts.auth !== void 0) {
|
|
11669
|
+
if (opts.auth.oAuth2 !== void 0) {
|
|
11670
|
+
if (typeof opts.auth.oAuth2 === "boolean") {
|
|
11671
|
+
if (opts.eyepopUrl.startsWith("https://web-api.staging.eyepop.xyz")) {
|
|
11672
|
+
opts.auth = {
|
|
11673
|
+
oAuth2: {
|
|
11674
|
+
domain: "dev-eyepop.us.auth0.com",
|
|
11675
|
+
clientId: "jktx3YO2UnbkNPvr05PQWf26t1kNTJyg",
|
|
11676
|
+
audience: "https://dev-app.eyepop.ai",
|
|
11677
|
+
scope: "admin:clouds access:inference-api access:datasets"
|
|
11678
|
+
}
|
|
11679
|
+
};
|
|
11680
|
+
} else {
|
|
11681
|
+
opts.auth = {
|
|
11682
|
+
oAuth2: {
|
|
11683
|
+
domain: "eyepop.us.auth0.com",
|
|
11684
|
+
clientId: "Lb9ubA9Hf3jlaqWLUx8XgA0zvotgViCl",
|
|
11685
|
+
audience: "https://api.eyepop.ai",
|
|
11686
|
+
scope: "admin:clouds access:inference-api access:datasets"
|
|
11687
|
+
}
|
|
11688
|
+
};
|
|
11689
|
+
}
|
|
11635
11690
|
}
|
|
11636
11691
|
}
|
|
11637
|
-
|
|
11638
|
-
|
|
11639
|
-
|
|
11640
|
-
|
|
11692
|
+
if (opts.auth.session !== void 0) {
|
|
11693
|
+
if (opts.auth.session.eyepopUrl) {
|
|
11694
|
+
opts.eyepopUrl = opts.auth.session.eyepopUrl;
|
|
11695
|
+
}
|
|
11641
11696
|
}
|
|
11642
11697
|
}
|
|
11643
11698
|
}
|
|
@@ -11648,6 +11703,7 @@ export {
|
|
|
11648
11703
|
AnnotationType,
|
|
11649
11704
|
ArtifactType,
|
|
11650
11705
|
AssetStatus,
|
|
11706
|
+
AutoAnnotateTask,
|
|
11651
11707
|
ChangeType,
|
|
11652
11708
|
ContourType,
|
|
11653
11709
|
DataEndpoint,
|
|
@@ -11663,6 +11719,7 @@ export {
|
|
|
11663
11719
|
ModelFormat,
|
|
11664
11720
|
ModelPrecisionType,
|
|
11665
11721
|
ModelStatus,
|
|
11722
|
+
ModelTask,
|
|
11666
11723
|
ModelTrainingStage,
|
|
11667
11724
|
ModelType,
|
|
11668
11725
|
PopComponentType,
|