@eyepop.ai/eyepop 0.14.1 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -68
- package/dist/{index.d.mts → eyepop.index.d.mts} +6 -26
- package/dist/{index.d.ts → eyepop.index.d.ts} +6 -26
- package/dist/{index.js → eyepop.index.js} +45 -161
- package/dist/eyepop.index.js.map +1 -0
- package/dist/{index.mjs → eyepop.index.mjs} +40 -156
- package/dist/eyepop.index.mjs.map +1 -0
- package/dist/eyepop.min.js +1 -1
- package/package.json +15 -45
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
|
@@ -30,9 +30,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
));
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
|
|
33
|
-
// node_modules/mime-db/db.json
|
|
33
|
+
// ../../node_modules/mime-db/db.json
|
|
34
34
|
var require_db = __commonJS({
|
|
35
|
-
"node_modules/mime-db/db.json"(exports2, module2) {
|
|
35
|
+
"../../node_modules/mime-db/db.json"(exports2, module2) {
|
|
36
36
|
module2.exports = {
|
|
37
37
|
"application/1d-interleaved-parityfec": {
|
|
38
38
|
source: "iana"
|
|
@@ -8555,17 +8555,17 @@ var require_db = __commonJS({
|
|
|
8555
8555
|
}
|
|
8556
8556
|
});
|
|
8557
8557
|
|
|
8558
|
-
// node_modules/mime-db/index.js
|
|
8558
|
+
// ../../node_modules/mime-db/index.js
|
|
8559
8559
|
var require_mime_db = __commonJS({
|
|
8560
|
-
"node_modules/mime-db/index.js"(exports2, module2) {
|
|
8560
|
+
"../../node_modules/mime-db/index.js"(exports2, module2) {
|
|
8561
8561
|
"use strict";
|
|
8562
8562
|
module2.exports = require_db();
|
|
8563
8563
|
}
|
|
8564
8564
|
});
|
|
8565
8565
|
|
|
8566
|
-
// node_modules/mime-types/index.js
|
|
8566
|
+
// ../../node_modules/mime-types/index.js
|
|
8567
8567
|
var require_mime_types = __commonJS({
|
|
8568
|
-
"node_modules/mime-types/index.js"(exports2) {
|
|
8568
|
+
"../../node_modules/mime-types/index.js"(exports2) {
|
|
8569
8569
|
"use strict";
|
|
8570
8570
|
var db = require_mime_db();
|
|
8571
8571
|
var extname = require("path").extname;
|
|
@@ -8654,16 +8654,16 @@ var require_mime_types = __commonJS({
|
|
|
8654
8654
|
}
|
|
8655
8655
|
});
|
|
8656
8656
|
|
|
8657
|
-
//
|
|
8658
|
-
var
|
|
8659
|
-
__export(
|
|
8657
|
+
// index.ts
|
|
8658
|
+
var eyepop_exports = {};
|
|
8659
|
+
__export(eyepop_exports, {
|
|
8660
8660
|
EndpointState: () => EndpointState,
|
|
8661
|
-
|
|
8662
|
-
default: () =>
|
|
8661
|
+
EyePop: () => EyePop,
|
|
8662
|
+
default: () => eyepop_default
|
|
8663
8663
|
});
|
|
8664
|
-
module.exports = __toCommonJS(
|
|
8664
|
+
module.exports = __toCommonJS(eyepop_exports);
|
|
8665
8665
|
|
|
8666
|
-
//
|
|
8666
|
+
// types.ts
|
|
8667
8667
|
var EndpointState = /* @__PURE__ */ ((EndpointState2) => {
|
|
8668
8668
|
EndpointState2["Idle"] = "Idle";
|
|
8669
8669
|
EndpointState2["Busy"] = "Busy";
|
|
@@ -8674,7 +8674,7 @@ var EndpointState = /* @__PURE__ */ ((EndpointState2) => {
|
|
|
8674
8674
|
return EndpointState2;
|
|
8675
8675
|
})(EndpointState || {});
|
|
8676
8676
|
|
|
8677
|
-
//
|
|
8677
|
+
// streaming.ts
|
|
8678
8678
|
var Stream = class _Stream {
|
|
8679
8679
|
constructor(iterator, controller) {
|
|
8680
8680
|
this.iterator = iterator;
|
|
@@ -8925,7 +8925,7 @@ function readableStreamAsyncIterable(stream) {
|
|
|
8925
8925
|
};
|
|
8926
8926
|
}
|
|
8927
8927
|
|
|
8928
|
-
//
|
|
8928
|
+
// jobs.ts
|
|
8929
8929
|
var AbstractJob = class {
|
|
8930
8930
|
constructor(getSession, client, requestLogger) {
|
|
8931
8931
|
this._responseStream = null;
|
|
@@ -9098,7 +9098,7 @@ var LoadLiveIngressJob = class extends AbstractJob {
|
|
|
9098
9098
|
}
|
|
9099
9099
|
};
|
|
9100
9100
|
|
|
9101
|
-
//
|
|
9101
|
+
// shims/http_client.ts
|
|
9102
9102
|
var createHttpClient;
|
|
9103
9103
|
if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
9104
9104
|
class HttpClient2 {
|
|
@@ -9137,7 +9137,7 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9137
9137
|
};
|
|
9138
9138
|
}
|
|
9139
9139
|
|
|
9140
|
-
//
|
|
9140
|
+
// semaphore.ts
|
|
9141
9141
|
var Semaphore = class {
|
|
9142
9142
|
/**
|
|
9143
9143
|
* Creates a semaphore.
|
|
@@ -9265,7 +9265,7 @@ var Semaphore = class {
|
|
|
9265
9265
|
}
|
|
9266
9266
|
};
|
|
9267
9267
|
|
|
9268
|
-
// node_modules/uuid/dist/esm-node/rng.js
|
|
9268
|
+
// ../../node_modules/uuid/dist/esm-node/rng.js
|
|
9269
9269
|
var import_crypto = __toESM(require("crypto"));
|
|
9270
9270
|
var rnds8Pool = new Uint8Array(256);
|
|
9271
9271
|
var poolPtr = rnds8Pool.length;
|
|
@@ -9277,7 +9277,7 @@ function rng() {
|
|
|
9277
9277
|
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
9278
9278
|
}
|
|
9279
9279
|
|
|
9280
|
-
// node_modules/uuid/dist/esm-node/stringify.js
|
|
9280
|
+
// ../../node_modules/uuid/dist/esm-node/stringify.js
|
|
9281
9281
|
var byteToHex = [];
|
|
9282
9282
|
for (let i = 0; i < 256; ++i) {
|
|
9283
9283
|
byteToHex.push((i + 256).toString(16).slice(1));
|
|
@@ -9286,13 +9286,13 @@ function unsafeStringify(arr, offset = 0) {
|
|
|
9286
9286
|
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]];
|
|
9287
9287
|
}
|
|
9288
9288
|
|
|
9289
|
-
// node_modules/uuid/dist/esm-node/native.js
|
|
9289
|
+
// ../../node_modules/uuid/dist/esm-node/native.js
|
|
9290
9290
|
var import_crypto2 = __toESM(require("crypto"));
|
|
9291
9291
|
var native_default = {
|
|
9292
9292
|
randomUUID: import_crypto2.default.randomUUID
|
|
9293
9293
|
};
|
|
9294
9294
|
|
|
9295
|
-
// node_modules/uuid/dist/esm-node/v4.js
|
|
9295
|
+
// ../../node_modules/uuid/dist/esm-node/v4.js
|
|
9296
9296
|
function v4(options, buf, offset) {
|
|
9297
9297
|
if (native_default.randomUUID && !buf && !options) {
|
|
9298
9298
|
return native_default.randomUUID();
|
|
@@ -9312,7 +9312,7 @@ function v4(options, buf, offset) {
|
|
|
9312
9312
|
}
|
|
9313
9313
|
var v4_default = v4;
|
|
9314
9314
|
|
|
9315
|
-
//
|
|
9315
|
+
// webrtc_base.ts
|
|
9316
9316
|
var import_path = __toESM(require("path"));
|
|
9317
9317
|
var WebrtcBase = class _WebrtcBase {
|
|
9318
9318
|
constructor(getSession, client, ingressId, urlBasePath, requestLogger) {
|
|
@@ -9553,7 +9553,7 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9553
9553
|
}
|
|
9554
9554
|
};
|
|
9555
9555
|
|
|
9556
|
-
//
|
|
9556
|
+
// webrtc_whip.ts
|
|
9557
9557
|
var WebrtcWhip = class extends WebrtcBase {
|
|
9558
9558
|
constructor(stream, getSession, client, requestLogger) {
|
|
9559
9559
|
super(getSession, client, v4_default().toString(), "/liveIngress/whip", requestLogger);
|
|
@@ -9639,7 +9639,7 @@ var WebrtcWhip = class extends WebrtcBase {
|
|
|
9639
9639
|
}
|
|
9640
9640
|
};
|
|
9641
9641
|
|
|
9642
|
-
//
|
|
9642
|
+
// webrtc_whep.ts
|
|
9643
9643
|
var WebrtcWhep = class extends WebrtcBase {
|
|
9644
9644
|
constructor(ingressId, getSession, client, requestLogger) {
|
|
9645
9645
|
super(getSession, client, ingressId, "/liveIngress/whep", requestLogger);
|
|
@@ -9725,7 +9725,7 @@ var WebrtcWhep = class extends WebrtcBase {
|
|
|
9725
9725
|
}
|
|
9726
9726
|
};
|
|
9727
9727
|
|
|
9728
|
-
//
|
|
9728
|
+
// shims/local_file.ts
|
|
9729
9729
|
var resolvePath;
|
|
9730
9730
|
if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
9731
9731
|
resolvePath = async (source) => {
|
|
@@ -9745,10 +9745,10 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9745
9745
|
};
|
|
9746
9746
|
}
|
|
9747
9747
|
|
|
9748
|
-
//
|
|
9748
|
+
// endpoint.ts
|
|
9749
9749
|
var import_pino = require("pino");
|
|
9750
9750
|
|
|
9751
|
-
//
|
|
9751
|
+
// shims/browser_session.ts
|
|
9752
9752
|
var import_auth0_spa_js = require("@auth0/auth0-spa-js");
|
|
9753
9753
|
var authenticateBrowserSession;
|
|
9754
9754
|
if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
@@ -9783,7 +9783,7 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9783
9783
|
};
|
|
9784
9784
|
}
|
|
9785
9785
|
|
|
9786
|
-
//
|
|
9786
|
+
// endpoint.ts
|
|
9787
9787
|
var Endpoint = class {
|
|
9788
9788
|
constructor(options) {
|
|
9789
9789
|
this._options = options;
|
|
@@ -10032,7 +10032,6 @@ var Endpoint = class {
|
|
|
10032
10032
|
}
|
|
10033
10033
|
async uploadPath(source) {
|
|
10034
10034
|
if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
|
|
10035
|
-
console.log(this);
|
|
10036
10035
|
throw new Error("endpoint not connected, use connect() before process()");
|
|
10037
10036
|
}
|
|
10038
10037
|
await this._limit.acquire();
|
|
@@ -10231,133 +10230,25 @@ var Endpoint = class {
|
|
|
10231
10230
|
}
|
|
10232
10231
|
};
|
|
10233
10232
|
|
|
10234
|
-
//
|
|
10235
|
-
var _EyePopPlot = class _EyePopPlot {
|
|
10236
|
-
constructor(context) {
|
|
10237
|
-
this._context = context;
|
|
10238
|
-
const textSize = Math.floor(Math.max(1, 0.03 * Math.min(context.canvas.width, context.canvas.height)));
|
|
10239
|
-
this._font = textSize + "px Poppins";
|
|
10240
|
-
}
|
|
10241
|
-
prediction(p) {
|
|
10242
|
-
if (p && p.objects) {
|
|
10243
|
-
const x_scale = this._context.canvas.width / p.source_width;
|
|
10244
|
-
const y_scale = this._context.canvas.height / p.source_height;
|
|
10245
|
-
for (let i = 0; i < p.objects.length; i++) {
|
|
10246
|
-
this.object(p.objects[i], x_scale, y_scale);
|
|
10247
|
-
}
|
|
10248
|
-
}
|
|
10249
|
-
}
|
|
10250
|
-
object(obj, x_scale = 1, y_scale = 1) {
|
|
10251
|
-
const context = this._context;
|
|
10252
|
-
const x = obj.x * x_scale;
|
|
10253
|
-
const y = obj.y * y_scale;
|
|
10254
|
-
const w = obj.width * x_scale;
|
|
10255
|
-
const h = obj.height * y_scale;
|
|
10256
|
-
context.beginPath();
|
|
10257
|
-
context.rect(obj.x, obj.y, obj.width, obj.height);
|
|
10258
|
-
context.lineWidth = 1;
|
|
10259
|
-
context.strokeStyle = _EyePopPlot.colors.opacity_color;
|
|
10260
|
-
context.fillStyle = _EyePopPlot.colors.opacity_color;
|
|
10261
|
-
context.fill();
|
|
10262
|
-
context.stroke();
|
|
10263
|
-
const mindim = Math.min(obj.height, obj.width);
|
|
10264
|
-
let corner_size = Math.max(15, mindim / 5.33333);
|
|
10265
|
-
var corners = [
|
|
10266
|
-
//top left corner
|
|
10267
|
-
[{ x, y: y + corner_size }, { x, y }, { x: x + corner_size, y }],
|
|
10268
|
-
//bottom left corner
|
|
10269
|
-
[{ x, y: y + h - corner_size }, { x, y: y + h }, { x: x + corner_size, y: y + h }],
|
|
10270
|
-
//top right corner
|
|
10271
|
-
[{ x: x + w - corner_size, y }, { x: x + w, y }, { x: x + w, y: y + corner_size }],
|
|
10272
|
-
//bottom right corner
|
|
10273
|
-
[{ x: x + w, y: y + h - corner_size }, { x: x + w, y: y + h }, { x: x + w - corner_size, y: y + h }]
|
|
10274
|
-
];
|
|
10275
|
-
corners.forEach((corner) => {
|
|
10276
|
-
context.beginPath();
|
|
10277
|
-
context.moveTo(corner[0].x, corner[0].y);
|
|
10278
|
-
context.lineTo(corner[1].x, corner[1].y);
|
|
10279
|
-
context.lineTo(corner[2].x, corner[2].y);
|
|
10280
|
-
context.strokeStyle = _EyePopPlot.colors.primary_color;
|
|
10281
|
-
context.lineWidth = 1;
|
|
10282
|
-
context.stroke();
|
|
10283
|
-
});
|
|
10284
|
-
const padding = Math.max(mindim * 0.02, 5);
|
|
10285
|
-
corner_size = corner_size - padding;
|
|
10286
|
-
var corners2 = [
|
|
10287
|
-
//2nd top left corner
|
|
10288
|
-
[{ x: x + padding, y: y + padding + corner_size }, {
|
|
10289
|
-
x: x + padding,
|
|
10290
|
-
y: y + padding
|
|
10291
|
-
}, { x: x + padding + corner_size, y: y + padding }],
|
|
10292
|
-
//2nd bottom left corner
|
|
10293
|
-
[{ x: x + padding, y: y - padding + h - corner_size }, {
|
|
10294
|
-
x: x + padding,
|
|
10295
|
-
y: y - padding + h
|
|
10296
|
-
}, { x: x + padding + corner_size, y: y - padding + h }],
|
|
10297
|
-
//2nd top right corner
|
|
10298
|
-
[{ x: x - padding + w - corner_size, y: y + padding }, {
|
|
10299
|
-
x: x - padding + w,
|
|
10300
|
-
y: y + padding
|
|
10301
|
-
}, { x: x - padding + w, y: y + padding + corner_size }],
|
|
10302
|
-
//2nd bottom right corner
|
|
10303
|
-
[{ x: x - padding + w, y: y - padding + h - corner_size }, {
|
|
10304
|
-
x: x - padding + w,
|
|
10305
|
-
y: y - padding + h
|
|
10306
|
-
}, { x: x - padding + w - corner_size, y: y - padding + h }]
|
|
10307
|
-
];
|
|
10308
|
-
corners2.forEach((corner) => {
|
|
10309
|
-
context.beginPath();
|
|
10310
|
-
context.moveTo(corner[0].x, corner[0].y);
|
|
10311
|
-
context.lineTo(corner[1].x, corner[1].y);
|
|
10312
|
-
context.lineTo(corner[2].x, corner[2].y);
|
|
10313
|
-
context.strokeStyle = _EyePopPlot.colors.secondary_color;
|
|
10314
|
-
context.lineWidth = 1;
|
|
10315
|
-
context.stroke();
|
|
10316
|
-
});
|
|
10317
|
-
let trackingLabel = "";
|
|
10318
|
-
if (obj.traceId) {
|
|
10319
|
-
trackingLabel = `#${obj.traceId}`;
|
|
10320
|
-
}
|
|
10321
|
-
context.font = this._font;
|
|
10322
|
-
context.fillStyle = "#ffffff";
|
|
10323
|
-
context.textAlign = "left";
|
|
10324
|
-
context.textBaseline = "top";
|
|
10325
|
-
context.fillText(_EyePopPlot.toTitleCase(obj.classLabel + " " + trackingLabel), obj.x + 1.5 * padding, obj.y + 1.5 * padding);
|
|
10326
|
-
}
|
|
10327
|
-
static toTitleCase(str) {
|
|
10328
|
-
if (!str)
|
|
10329
|
-
return "";
|
|
10330
|
-
return str.replace(/\w\S*/g, function(txt) {
|
|
10331
|
-
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
|
|
10332
|
-
});
|
|
10333
|
-
}
|
|
10334
|
-
};
|
|
10335
|
-
_EyePopPlot.colors = {
|
|
10336
|
-
primary_color: "#2fa7d7",
|
|
10337
|
-
secondary_color: "#94e0ff",
|
|
10338
|
-
right_color: "#a1f542",
|
|
10339
|
-
left_color: "#e32740",
|
|
10340
|
-
opacity_color: "rgba(47, 167, 215, 0.2)",
|
|
10341
|
-
white: "#FFFFFF",
|
|
10342
|
-
black: "#111111",
|
|
10343
|
-
blank_color: "#000000"
|
|
10344
|
-
};
|
|
10345
|
-
var EyePopPlot = _EyePopPlot;
|
|
10346
|
-
|
|
10347
|
-
// src/index.ts
|
|
10233
|
+
// index.ts
|
|
10348
10234
|
var readEnv = (env) => {
|
|
10349
10235
|
if (typeof process !== "undefined") {
|
|
10350
10236
|
return process.env?.[env] ?? void 0;
|
|
10351
10237
|
}
|
|
10352
10238
|
return void 0;
|
|
10353
10239
|
};
|
|
10354
|
-
var
|
|
10355
|
-
|
|
10240
|
+
var EyePop;
|
|
10241
|
+
((EyePop2) => {
|
|
10242
|
+
const envSecretKey = readEnv("EYEPOP_SECRET_KEY");
|
|
10243
|
+
const defaultAuth = envSecretKey ? {
|
|
10244
|
+
secretKey: envSecretKey
|
|
10245
|
+
} : void 0;
|
|
10246
|
+
function endpoint(opts = {}) {
|
|
10356
10247
|
if (typeof opts.auth == "undefined") {
|
|
10357
|
-
if (typeof
|
|
10248
|
+
if (typeof defaultAuth == "undefined") {
|
|
10358
10249
|
throw new Error("auth option or EYEPOP_SECRET_KEY environment variable is required");
|
|
10359
10250
|
}
|
|
10360
|
-
opts.auth =
|
|
10251
|
+
opts.auth = defaultAuth;
|
|
10361
10252
|
}
|
|
10362
10253
|
if (typeof opts.popId == "undefined") {
|
|
10363
10254
|
opts.popId = readEnv("EYEPOP_POP_ID");
|
|
@@ -10405,23 +10296,16 @@ var _EyePopSdk = class _EyePopSdk {
|
|
|
10405
10296
|
opts.eyepopUrl = opts.auth.session.eyepopUrl;
|
|
10406
10297
|
}
|
|
10407
10298
|
}
|
|
10408
|
-
const
|
|
10409
|
-
return
|
|
10299
|
+
const endpoint2 = new Endpoint(opts);
|
|
10300
|
+
return endpoint2;
|
|
10410
10301
|
}
|
|
10411
|
-
|
|
10412
|
-
|
|
10413
|
-
|
|
10414
|
-
};
|
|
10415
|
-
_EyePopSdk.envSecretKey = readEnv("EYEPOP_SECRET_KEY");
|
|
10416
|
-
_EyePopSdk.defaultAuth = _EyePopSdk.envSecretKey ? {
|
|
10417
|
-
secretKey: _EyePopSdk.envSecretKey
|
|
10418
|
-
} : void 0;
|
|
10419
|
-
var EyePopSdk = _EyePopSdk;
|
|
10420
|
-
var src_default = EyePopSdk;
|
|
10302
|
+
EyePop2.endpoint = endpoint;
|
|
10303
|
+
})(EyePop || (EyePop = {}));
|
|
10304
|
+
var eyepop_default = EyePop;
|
|
10421
10305
|
// Annotate the CommonJS export names for ESM import in node:
|
|
10422
10306
|
0 && (module.exports = {
|
|
10423
10307
|
EndpointState,
|
|
10424
|
-
|
|
10308
|
+
EyePop
|
|
10425
10309
|
});
|
|
10426
10310
|
/*! Bundled license information:
|
|
10427
10311
|
|
|
@@ -10441,4 +10325,4 @@ mime-types/index.js:
|
|
|
10441
10325
|
* MIT Licensed
|
|
10442
10326
|
*)
|
|
10443
10327
|
*/
|
|
10444
|
-
//# sourceMappingURL=index.js.map
|
|
10328
|
+
//# sourceMappingURL=eyepop.index.js.map
|