@eyepop.ai/eyepop 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eyepop.min.js +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +65 -40
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +65 -40
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -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}`,
|
|
@@ -10034,6 +10043,7 @@ var Endpoint = class {
|
|
|
10034
10043
|
}
|
|
10035
10044
|
async uploadPath(source) {
|
|
10036
10045
|
if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
|
|
10046
|
+
console.log(this);
|
|
10037
10047
|
throw new Error("endpoint not connected, use connect() before process()");
|
|
10038
10048
|
}
|
|
10039
10049
|
await this._limit.acquire();
|
|
@@ -10167,7 +10177,8 @@ var Endpoint = class {
|
|
|
10167
10177
|
}
|
|
10168
10178
|
config = await response.json();
|
|
10169
10179
|
}
|
|
10170
|
-
|
|
10180
|
+
const baseUrl = new URL(config.base_url, this.eyepopUrl());
|
|
10181
|
+
this._baseUrl = baseUrl.toString();
|
|
10171
10182
|
this._pipelineId = config.pipeline_id;
|
|
10172
10183
|
this._popName = config.name;
|
|
10173
10184
|
this._requestLogger.debug("after GET %s: %s / %s", config_url, this._baseUrl, this._pipelineId);
|
|
@@ -10352,46 +10363,60 @@ var readEnv = (env) => {
|
|
|
10352
10363
|
return void 0;
|
|
10353
10364
|
};
|
|
10354
10365
|
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
|
-
};
|
|
10366
|
+
static endpoint(opts = {}) {
|
|
10367
|
+
if (typeof opts.auth == "undefined") {
|
|
10368
|
+
if (typeof _EyePopSdk.defaultAuth == "undefined") {
|
|
10369
|
+
throw new Error("auth option or EYEPOP_SECRET_KEY environment variable is required");
|
|
10375
10370
|
}
|
|
10371
|
+
opts.auth = _EyePopSdk.defaultAuth;
|
|
10372
|
+
}
|
|
10373
|
+
if (typeof opts.popId == "undefined") {
|
|
10374
|
+
opts.popId = readEnv("EYEPOP_POP_ID");
|
|
10375
|
+
}
|
|
10376
|
+
if (typeof opts.eyepopUrl == "undefined") {
|
|
10377
|
+
opts.eyepopUrl = readEnv("EYEPOP_URL") || "https://api.eyepop.ai";
|
|
10378
|
+
}
|
|
10379
|
+
if (typeof opts.autoStart == "undefined") {
|
|
10380
|
+
opts.autoStart = true;
|
|
10381
|
+
}
|
|
10382
|
+
if (typeof opts.stopJobs == "undefined") {
|
|
10383
|
+
opts.stopJobs = true;
|
|
10384
|
+
}
|
|
10385
|
+
if (typeof opts.jobQueueLength == "undefined") {
|
|
10386
|
+
opts.jobQueueLength = 1024;
|
|
10376
10387
|
}
|
|
10377
|
-
if (auth.
|
|
10378
|
-
if (auth.
|
|
10379
|
-
|
|
10388
|
+
if (typeof opts.auth.oAuth2 != "undefined" && opts.popId) {
|
|
10389
|
+
if (typeof opts.auth.oAuth2 === "boolean") {
|
|
10390
|
+
if (opts.eyepopUrl.startsWith("https://staging-api.eyepop.ai")) {
|
|
10391
|
+
opts.auth = {
|
|
10392
|
+
oAuth2: {
|
|
10393
|
+
domain: "dev-eyepop.us.auth0.com",
|
|
10394
|
+
clientId: "jktx3YO2UnbkNPvr05PQWf26t1kNTJyg",
|
|
10395
|
+
audience: "https://dev-app.eyepop.ai",
|
|
10396
|
+
scope: "admin:clouds"
|
|
10397
|
+
}
|
|
10398
|
+
};
|
|
10399
|
+
} else {
|
|
10400
|
+
opts.auth = {
|
|
10401
|
+
oAuth2: {
|
|
10402
|
+
domain: "eyepop.us.auth0.com",
|
|
10403
|
+
clientId: "Lb9ubA9Hf3jlaqWLUx8XgA0zvotgViCl",
|
|
10404
|
+
audience: "https://api.eyepop.ai",
|
|
10405
|
+
scope: "admin:clouds"
|
|
10406
|
+
}
|
|
10407
|
+
};
|
|
10408
|
+
}
|
|
10380
10409
|
}
|
|
10381
|
-
|
|
10382
|
-
|
|
10410
|
+
}
|
|
10411
|
+
if (opts.auth.session !== void 0) {
|
|
10412
|
+
if (opts.auth.session.popId) {
|
|
10413
|
+
opts.popId = opts.auth.session.popId;
|
|
10414
|
+
}
|
|
10415
|
+
if (opts.auth.session.eyepopUrl) {
|
|
10416
|
+
opts.eyepopUrl = opts.auth.session.eyepopUrl;
|
|
10383
10417
|
}
|
|
10384
10418
|
}
|
|
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);
|
|
10419
|
+
const endpoint = new Endpoint(opts);
|
|
10395
10420
|
return endpoint;
|
|
10396
10421
|
}
|
|
10397
10422
|
static plot(context) {
|