@eyepop.ai/eyepop 0.13.0 → 0.14.1
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.min.js +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +66 -52
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +66 -52
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -208,7 +208,7 @@ declare class EyePopPlot {
|
|
|
208
208
|
declare class EyePopSdk {
|
|
209
209
|
private static readonly envSecretKey;
|
|
210
210
|
static defaultAuth: SecretKeyAuth | undefined;
|
|
211
|
-
static endpoint(
|
|
211
|
+
static endpoint(opts?: Options): Endpoint;
|
|
212
212
|
static plot(context: CanvasRenderingContext2D): EyePopPlot;
|
|
213
213
|
}
|
|
214
214
|
|
package/dist/index.d.ts
CHANGED
|
@@ -208,7 +208,7 @@ declare class EyePopPlot {
|
|
|
208
208
|
declare class EyePopSdk {
|
|
209
209
|
private static readonly envSecretKey;
|
|
210
210
|
static defaultAuth: SecretKeyAuth | undefined;
|
|
211
|
-
static endpoint(
|
|
211
|
+
static endpoint(opts?: Options): Endpoint;
|
|
212
212
|
static plot(context: CanvasRenderingContext2D): EyePopPlot;
|
|
213
213
|
}
|
|
214
214
|
|
package/dist/index.js
CHANGED
|
@@ -8619,11 +8619,11 @@ var require_mime_types = __commonJS({
|
|
|
8619
8619
|
}
|
|
8620
8620
|
return exts[0];
|
|
8621
8621
|
}
|
|
8622
|
-
function lookup(
|
|
8623
|
-
if (!
|
|
8622
|
+
function lookup(path2) {
|
|
8623
|
+
if (!path2 || typeof path2 !== "string") {
|
|
8624
8624
|
return false;
|
|
8625
8625
|
}
|
|
8626
|
-
var extension2 = extname("x." +
|
|
8626
|
+
var extension2 = extname("x." + path2).toLowerCase().substr(1);
|
|
8627
8627
|
if (!extension2) {
|
|
8628
8628
|
return false;
|
|
8629
8629
|
}
|
|
@@ -9313,6 +9313,7 @@ function v4(options, buf, offset) {
|
|
|
9313
9313
|
var v4_default = v4;
|
|
9314
9314
|
|
|
9315
9315
|
// src/webrtc_base.ts
|
|
9316
|
+
var import_path = __toESM(require("path"));
|
|
9316
9317
|
var WebrtcBase = class _WebrtcBase {
|
|
9317
9318
|
constructor(getSession, client, ingressId, urlBasePath, requestLogger) {
|
|
9318
9319
|
this._getSession = getSession;
|
|
@@ -9322,6 +9323,7 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9322
9323
|
this._urlPath = `${urlBasePath}/${this._ingressId}`;
|
|
9323
9324
|
this._pc = null;
|
|
9324
9325
|
this._eTag = "";
|
|
9326
|
+
this._location = null;
|
|
9325
9327
|
this._queuedCandidates = [];
|
|
9326
9328
|
this._offerData = null;
|
|
9327
9329
|
}
|
|
@@ -9360,6 +9362,7 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9360
9362
|
return Promise.reject(`unknown status code for POST '${ingressUrl}': ${response.status} (${response.statusText})`);
|
|
9361
9363
|
}
|
|
9362
9364
|
this._eTag = response.headers.get("ETag") ?? "";
|
|
9365
|
+
this._location = response.headers.get("Location");
|
|
9363
9366
|
return this.onRemoteAnswer(new RTCSessionDescription({
|
|
9364
9367
|
type: "answer",
|
|
9365
9368
|
sdp: await response.text()
|
|
@@ -9369,8 +9372,14 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9369
9372
|
if (!this._offerData) {
|
|
9370
9373
|
throw new Error("sendLocalCandidates no offerData");
|
|
9371
9374
|
}
|
|
9375
|
+
let urlPath = void 0;
|
|
9372
9376
|
const session = await this._getSession();
|
|
9373
|
-
|
|
9377
|
+
if (this._location) {
|
|
9378
|
+
urlPath = import_path.default.join(this._urlPath, this._location);
|
|
9379
|
+
} else {
|
|
9380
|
+
urlPath = this._urlPath;
|
|
9381
|
+
}
|
|
9382
|
+
const ingressUrl = new URL(urlPath, session.baseUrl);
|
|
9374
9383
|
this._requestLogger.debug("before PATCH: %s", ingressUrl);
|
|
9375
9384
|
const headers = {
|
|
9376
9385
|
"Authorization": `Bearer ${session.accessToken}`,
|
|
@@ -9545,7 +9554,7 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9545
9554
|
};
|
|
9546
9555
|
|
|
9547
9556
|
// src/webrtc_whip.ts
|
|
9548
|
-
var WebrtcWhip = class
|
|
9557
|
+
var WebrtcWhip = class extends WebrtcBase {
|
|
9549
9558
|
constructor(stream, getSession, client, requestLogger) {
|
|
9550
9559
|
super(getSession, client, v4_default().toString(), "/liveIngress/whip", requestLogger);
|
|
9551
9560
|
this._stream = stream;
|
|
@@ -9577,17 +9586,6 @@ var WebrtcWhip = class _WebrtcWhip extends WebrtcBase {
|
|
|
9577
9586
|
if (!this._pc) {
|
|
9578
9587
|
throw new Error("onLocalOffer no peer connection");
|
|
9579
9588
|
}
|
|
9580
|
-
answer = new RTCSessionDescription({
|
|
9581
|
-
type: "answer",
|
|
9582
|
-
sdp: _WebrtcWhip.editAnswer(
|
|
9583
|
-
answer.sdp,
|
|
9584
|
-
"h264/90000",
|
|
9585
|
-
void 0,
|
|
9586
|
-
5e3,
|
|
9587
|
-
void 0,
|
|
9588
|
-
true
|
|
9589
|
-
)
|
|
9590
|
-
});
|
|
9591
9589
|
await this._pc.setRemoteDescription(new RTCSessionDescription(answer));
|
|
9592
9590
|
if (this._queuedCandidates.length !== 0) {
|
|
9593
9591
|
await this.sendLocalCandidates(this._queuedCandidates);
|
|
@@ -10034,6 +10032,7 @@ var Endpoint = class {
|
|
|
10034
10032
|
}
|
|
10035
10033
|
async uploadPath(source) {
|
|
10036
10034
|
if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
|
|
10035
|
+
console.log(this);
|
|
10037
10036
|
throw new Error("endpoint not connected, use connect() before process()");
|
|
10038
10037
|
}
|
|
10039
10038
|
await this._limit.acquire();
|
|
@@ -10167,7 +10166,8 @@ var Endpoint = class {
|
|
|
10167
10166
|
}
|
|
10168
10167
|
config = await response.json();
|
|
10169
10168
|
}
|
|
10170
|
-
|
|
10169
|
+
const baseUrl = new URL(config.base_url, this.eyepopUrl());
|
|
10170
|
+
this._baseUrl = baseUrl.toString();
|
|
10171
10171
|
this._pipelineId = config.pipeline_id;
|
|
10172
10172
|
this._popName = config.name;
|
|
10173
10173
|
this._requestLogger.debug("after GET %s: %s / %s", config_url, this._baseUrl, this._pipelineId);
|
|
@@ -10352,46 +10352,60 @@ var readEnv = (env) => {
|
|
|
10352
10352
|
return void 0;
|
|
10353
10353
|
};
|
|
10354
10354
|
var _EyePopSdk = class _EyePopSdk {
|
|
10355
|
-
static endpoint({
|
|
10356
|
-
auth
|
|
10357
|
-
|
|
10358
|
-
|
|
10359
|
-
autoStart = true,
|
|
10360
|
-
stopJobs = true,
|
|
10361
|
-
jobQueueLength = 1024,
|
|
10362
|
-
logger,
|
|
10363
|
-
...opts
|
|
10364
|
-
} = {}) {
|
|
10365
|
-
if (auth.oAuth2 !== void 0 && popId) {
|
|
10366
|
-
if (typeof auth.oAuth2 === "boolean") {
|
|
10367
|
-
auth = {
|
|
10368
|
-
oAuth2: {
|
|
10369
|
-
domain: "eyepop.us.auth0.com",
|
|
10370
|
-
clientId: "Lb9ubA9Hf3jlaqWLUx8XgA0zvotgViCl",
|
|
10371
|
-
audience: "https://api.eyepop.ai",
|
|
10372
|
-
scope: "admin:clouds"
|
|
10373
|
-
}
|
|
10374
|
-
};
|
|
10355
|
+
static endpoint(opts = {}) {
|
|
10356
|
+
if (typeof opts.auth == "undefined") {
|
|
10357
|
+
if (typeof _EyePopSdk.defaultAuth == "undefined") {
|
|
10358
|
+
throw new Error("auth option or EYEPOP_SECRET_KEY environment variable is required");
|
|
10375
10359
|
}
|
|
10360
|
+
opts.auth = _EyePopSdk.defaultAuth;
|
|
10361
|
+
}
|
|
10362
|
+
if (typeof opts.popId == "undefined") {
|
|
10363
|
+
opts.popId = readEnv("EYEPOP_POP_ID");
|
|
10364
|
+
}
|
|
10365
|
+
if (typeof opts.eyepopUrl == "undefined") {
|
|
10366
|
+
opts.eyepopUrl = readEnv("EYEPOP_URL") || "https://api.eyepop.ai";
|
|
10367
|
+
}
|
|
10368
|
+
if (typeof opts.autoStart == "undefined") {
|
|
10369
|
+
opts.autoStart = true;
|
|
10370
|
+
}
|
|
10371
|
+
if (typeof opts.stopJobs == "undefined") {
|
|
10372
|
+
opts.stopJobs = true;
|
|
10376
10373
|
}
|
|
10377
|
-
if (
|
|
10378
|
-
|
|
10379
|
-
|
|
10374
|
+
if (typeof opts.jobQueueLength == "undefined") {
|
|
10375
|
+
opts.jobQueueLength = 1024;
|
|
10376
|
+
}
|
|
10377
|
+
if (typeof opts.auth.oAuth2 != "undefined" && opts.popId) {
|
|
10378
|
+
if (typeof opts.auth.oAuth2 === "boolean") {
|
|
10379
|
+
if (opts.eyepopUrl.startsWith("https://staging-api.eyepop.ai")) {
|
|
10380
|
+
opts.auth = {
|
|
10381
|
+
oAuth2: {
|
|
10382
|
+
domain: "dev-eyepop.us.auth0.com",
|
|
10383
|
+
clientId: "jktx3YO2UnbkNPvr05PQWf26t1kNTJyg",
|
|
10384
|
+
audience: "https://dev-app.eyepop.ai",
|
|
10385
|
+
scope: "admin:clouds"
|
|
10386
|
+
}
|
|
10387
|
+
};
|
|
10388
|
+
} else {
|
|
10389
|
+
opts.auth = {
|
|
10390
|
+
oAuth2: {
|
|
10391
|
+
domain: "eyepop.us.auth0.com",
|
|
10392
|
+
clientId: "Lb9ubA9Hf3jlaqWLUx8XgA0zvotgViCl",
|
|
10393
|
+
audience: "https://api.eyepop.ai",
|
|
10394
|
+
scope: "admin:clouds"
|
|
10395
|
+
}
|
|
10396
|
+
};
|
|
10397
|
+
}
|
|
10380
10398
|
}
|
|
10381
|
-
|
|
10382
|
-
|
|
10399
|
+
}
|
|
10400
|
+
if (opts.auth.session !== void 0) {
|
|
10401
|
+
if (opts.auth.session.popId) {
|
|
10402
|
+
opts.popId = opts.auth.session.popId;
|
|
10403
|
+
}
|
|
10404
|
+
if (opts.auth.session.eyepopUrl) {
|
|
10405
|
+
opts.eyepopUrl = opts.auth.session.eyepopUrl;
|
|
10383
10406
|
}
|
|
10384
10407
|
}
|
|
10385
|
-
const
|
|
10386
|
-
auth,
|
|
10387
|
-
popId,
|
|
10388
|
-
eyepopUrl: eyepopUrl ?? "https://api.eyepop.ai",
|
|
10389
|
-
autoStart,
|
|
10390
|
-
stopJobs,
|
|
10391
|
-
jobQueueLength,
|
|
10392
|
-
logger
|
|
10393
|
-
};
|
|
10394
|
-
const endpoint = new Endpoint(options);
|
|
10408
|
+
const endpoint = new Endpoint(opts);
|
|
10395
10409
|
return endpoint;
|
|
10396
10410
|
}
|
|
10397
10411
|
static plot(context) {
|