@eyepop.ai/eyepop 0.14.0 → 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} +46 -173
- package/dist/eyepop.index.js.map +1 -0
- package/dist/{index.mjs → eyepop.index.mjs} +41 -168
- package/dist/eyepop.index.mjs.map +1 -0
- package/dist/eyepop.min.js +1 -1
- package/package.json +15 -44
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
|
@@ -10,9 +10,9 @@ var __commonJS = (cb, mod) => function __require2() {
|
|
|
10
10
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
// node_modules/mime-db/db.json
|
|
13
|
+
// ../../node_modules/mime-db/db.json
|
|
14
14
|
var require_db = __commonJS({
|
|
15
|
-
"node_modules/mime-db/db.json"(exports, module) {
|
|
15
|
+
"../../node_modules/mime-db/db.json"(exports, module) {
|
|
16
16
|
module.exports = {
|
|
17
17
|
"application/1d-interleaved-parityfec": {
|
|
18
18
|
source: "iana"
|
|
@@ -8535,17 +8535,17 @@ var require_db = __commonJS({
|
|
|
8535
8535
|
}
|
|
8536
8536
|
});
|
|
8537
8537
|
|
|
8538
|
-
// node_modules/mime-db/index.js
|
|
8538
|
+
// ../../node_modules/mime-db/index.js
|
|
8539
8539
|
var require_mime_db = __commonJS({
|
|
8540
|
-
"node_modules/mime-db/index.js"(exports, module) {
|
|
8540
|
+
"../../node_modules/mime-db/index.js"(exports, module) {
|
|
8541
8541
|
"use strict";
|
|
8542
8542
|
module.exports = require_db();
|
|
8543
8543
|
}
|
|
8544
8544
|
});
|
|
8545
8545
|
|
|
8546
|
-
// node_modules/mime-types/index.js
|
|
8546
|
+
// ../../node_modules/mime-types/index.js
|
|
8547
8547
|
var require_mime_types = __commonJS({
|
|
8548
|
-
"node_modules/mime-types/index.js"(exports) {
|
|
8548
|
+
"../../node_modules/mime-types/index.js"(exports) {
|
|
8549
8549
|
"use strict";
|
|
8550
8550
|
var db = require_mime_db();
|
|
8551
8551
|
var extname = __require("path").extname;
|
|
@@ -8634,7 +8634,7 @@ var require_mime_types = __commonJS({
|
|
|
8634
8634
|
}
|
|
8635
8635
|
});
|
|
8636
8636
|
|
|
8637
|
-
//
|
|
8637
|
+
// types.ts
|
|
8638
8638
|
var EndpointState = /* @__PURE__ */ ((EndpointState2) => {
|
|
8639
8639
|
EndpointState2["Idle"] = "Idle";
|
|
8640
8640
|
EndpointState2["Busy"] = "Busy";
|
|
@@ -8645,7 +8645,7 @@ var EndpointState = /* @__PURE__ */ ((EndpointState2) => {
|
|
|
8645
8645
|
return EndpointState2;
|
|
8646
8646
|
})(EndpointState || {});
|
|
8647
8647
|
|
|
8648
|
-
//
|
|
8648
|
+
// streaming.ts
|
|
8649
8649
|
var Stream = class _Stream {
|
|
8650
8650
|
constructor(iterator, controller) {
|
|
8651
8651
|
this.iterator = iterator;
|
|
@@ -8896,7 +8896,7 @@ function readableStreamAsyncIterable(stream) {
|
|
|
8896
8896
|
};
|
|
8897
8897
|
}
|
|
8898
8898
|
|
|
8899
|
-
//
|
|
8899
|
+
// jobs.ts
|
|
8900
8900
|
var AbstractJob = class {
|
|
8901
8901
|
constructor(getSession, client, requestLogger) {
|
|
8902
8902
|
this._responseStream = null;
|
|
@@ -9069,7 +9069,7 @@ var LoadLiveIngressJob = class extends AbstractJob {
|
|
|
9069
9069
|
}
|
|
9070
9070
|
};
|
|
9071
9071
|
|
|
9072
|
-
//
|
|
9072
|
+
// shims/http_client.ts
|
|
9073
9073
|
var createHttpClient;
|
|
9074
9074
|
if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
9075
9075
|
class HttpClient2 {
|
|
@@ -9108,7 +9108,7 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9108
9108
|
};
|
|
9109
9109
|
}
|
|
9110
9110
|
|
|
9111
|
-
//
|
|
9111
|
+
// semaphore.ts
|
|
9112
9112
|
var Semaphore = class {
|
|
9113
9113
|
/**
|
|
9114
9114
|
* Creates a semaphore.
|
|
@@ -9236,7 +9236,7 @@ var Semaphore = class {
|
|
|
9236
9236
|
}
|
|
9237
9237
|
};
|
|
9238
9238
|
|
|
9239
|
-
// node_modules/uuid/dist/esm-node/rng.js
|
|
9239
|
+
// ../../node_modules/uuid/dist/esm-node/rng.js
|
|
9240
9240
|
import crypto from "crypto";
|
|
9241
9241
|
var rnds8Pool = new Uint8Array(256);
|
|
9242
9242
|
var poolPtr = rnds8Pool.length;
|
|
@@ -9248,7 +9248,7 @@ function rng() {
|
|
|
9248
9248
|
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
9249
9249
|
}
|
|
9250
9250
|
|
|
9251
|
-
// node_modules/uuid/dist/esm-node/stringify.js
|
|
9251
|
+
// ../../node_modules/uuid/dist/esm-node/stringify.js
|
|
9252
9252
|
var byteToHex = [];
|
|
9253
9253
|
for (let i = 0; i < 256; ++i) {
|
|
9254
9254
|
byteToHex.push((i + 256).toString(16).slice(1));
|
|
@@ -9257,13 +9257,13 @@ function unsafeStringify(arr, offset = 0) {
|
|
|
9257
9257
|
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]];
|
|
9258
9258
|
}
|
|
9259
9259
|
|
|
9260
|
-
// node_modules/uuid/dist/esm-node/native.js
|
|
9260
|
+
// ../../node_modules/uuid/dist/esm-node/native.js
|
|
9261
9261
|
import crypto2 from "crypto";
|
|
9262
9262
|
var native_default = {
|
|
9263
9263
|
randomUUID: crypto2.randomUUID
|
|
9264
9264
|
};
|
|
9265
9265
|
|
|
9266
|
-
// node_modules/uuid/dist/esm-node/v4.js
|
|
9266
|
+
// ../../node_modules/uuid/dist/esm-node/v4.js
|
|
9267
9267
|
function v4(options, buf, offset) {
|
|
9268
9268
|
if (native_default.randomUUID && !buf && !options) {
|
|
9269
9269
|
return native_default.randomUUID();
|
|
@@ -9283,7 +9283,7 @@ function v4(options, buf, offset) {
|
|
|
9283
9283
|
}
|
|
9284
9284
|
var v4_default = v4;
|
|
9285
9285
|
|
|
9286
|
-
//
|
|
9286
|
+
// webrtc_base.ts
|
|
9287
9287
|
import path from "path";
|
|
9288
9288
|
var WebrtcBase = class _WebrtcBase {
|
|
9289
9289
|
constructor(getSession, client, ingressId, urlBasePath, requestLogger) {
|
|
@@ -9524,8 +9524,8 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9524
9524
|
}
|
|
9525
9525
|
};
|
|
9526
9526
|
|
|
9527
|
-
//
|
|
9528
|
-
var WebrtcWhip = class
|
|
9527
|
+
// webrtc_whip.ts
|
|
9528
|
+
var WebrtcWhip = class extends WebrtcBase {
|
|
9529
9529
|
constructor(stream, getSession, client, requestLogger) {
|
|
9530
9530
|
super(getSession, client, v4_default().toString(), "/liveIngress/whip", requestLogger);
|
|
9531
9531
|
this._stream = stream;
|
|
@@ -9557,17 +9557,6 @@ var WebrtcWhip = class _WebrtcWhip extends WebrtcBase {
|
|
|
9557
9557
|
if (!this._pc) {
|
|
9558
9558
|
throw new Error("onLocalOffer no peer connection");
|
|
9559
9559
|
}
|
|
9560
|
-
answer = new RTCSessionDescription({
|
|
9561
|
-
type: "answer",
|
|
9562
|
-
sdp: _WebrtcWhip.editAnswer(
|
|
9563
|
-
answer.sdp,
|
|
9564
|
-
"h264/90000",
|
|
9565
|
-
void 0,
|
|
9566
|
-
5e3,
|
|
9567
|
-
void 0,
|
|
9568
|
-
true
|
|
9569
|
-
)
|
|
9570
|
-
});
|
|
9571
9560
|
await this._pc.setRemoteDescription(new RTCSessionDescription(answer));
|
|
9572
9561
|
if (this._queuedCandidates.length !== 0) {
|
|
9573
9562
|
await this.sendLocalCandidates(this._queuedCandidates);
|
|
@@ -9621,7 +9610,7 @@ var WebrtcWhip = class _WebrtcWhip extends WebrtcBase {
|
|
|
9621
9610
|
}
|
|
9622
9611
|
};
|
|
9623
9612
|
|
|
9624
|
-
//
|
|
9613
|
+
// webrtc_whep.ts
|
|
9625
9614
|
var WebrtcWhep = class extends WebrtcBase {
|
|
9626
9615
|
constructor(ingressId, getSession, client, requestLogger) {
|
|
9627
9616
|
super(getSession, client, ingressId, "/liveIngress/whep", requestLogger);
|
|
@@ -9707,7 +9696,7 @@ var WebrtcWhep = class extends WebrtcBase {
|
|
|
9707
9696
|
}
|
|
9708
9697
|
};
|
|
9709
9698
|
|
|
9710
|
-
//
|
|
9699
|
+
// shims/local_file.ts
|
|
9711
9700
|
var resolvePath;
|
|
9712
9701
|
if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
9713
9702
|
resolvePath = async (source) => {
|
|
@@ -9727,10 +9716,10 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9727
9716
|
};
|
|
9728
9717
|
}
|
|
9729
9718
|
|
|
9730
|
-
//
|
|
9719
|
+
// endpoint.ts
|
|
9731
9720
|
import { pino } from "pino";
|
|
9732
9721
|
|
|
9733
|
-
//
|
|
9722
|
+
// shims/browser_session.ts
|
|
9734
9723
|
import { createAuth0Client } from "@auth0/auth0-spa-js";
|
|
9735
9724
|
var authenticateBrowserSession;
|
|
9736
9725
|
if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
@@ -9765,7 +9754,7 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9765
9754
|
};
|
|
9766
9755
|
}
|
|
9767
9756
|
|
|
9768
|
-
//
|
|
9757
|
+
// endpoint.ts
|
|
9769
9758
|
var Endpoint = class {
|
|
9770
9759
|
constructor(options) {
|
|
9771
9760
|
this._options = options;
|
|
@@ -10014,7 +10003,6 @@ var Endpoint = class {
|
|
|
10014
10003
|
}
|
|
10015
10004
|
async uploadPath(source) {
|
|
10016
10005
|
if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
|
|
10017
|
-
console.log(this);
|
|
10018
10006
|
throw new Error("endpoint not connected, use connect() before process()");
|
|
10019
10007
|
}
|
|
10020
10008
|
await this._limit.acquire();
|
|
@@ -10213,133 +10201,25 @@ var Endpoint = class {
|
|
|
10213
10201
|
}
|
|
10214
10202
|
};
|
|
10215
10203
|
|
|
10216
|
-
//
|
|
10217
|
-
var _EyePopPlot = class _EyePopPlot {
|
|
10218
|
-
constructor(context) {
|
|
10219
|
-
this._context = context;
|
|
10220
|
-
const textSize = Math.floor(Math.max(1, 0.03 * Math.min(context.canvas.width, context.canvas.height)));
|
|
10221
|
-
this._font = textSize + "px Poppins";
|
|
10222
|
-
}
|
|
10223
|
-
prediction(p) {
|
|
10224
|
-
if (p && p.objects) {
|
|
10225
|
-
const x_scale = this._context.canvas.width / p.source_width;
|
|
10226
|
-
const y_scale = this._context.canvas.height / p.source_height;
|
|
10227
|
-
for (let i = 0; i < p.objects.length; i++) {
|
|
10228
|
-
this.object(p.objects[i], x_scale, y_scale);
|
|
10229
|
-
}
|
|
10230
|
-
}
|
|
10231
|
-
}
|
|
10232
|
-
object(obj, x_scale = 1, y_scale = 1) {
|
|
10233
|
-
const context = this._context;
|
|
10234
|
-
const x = obj.x * x_scale;
|
|
10235
|
-
const y = obj.y * y_scale;
|
|
10236
|
-
const w = obj.width * x_scale;
|
|
10237
|
-
const h = obj.height * y_scale;
|
|
10238
|
-
context.beginPath();
|
|
10239
|
-
context.rect(obj.x, obj.y, obj.width, obj.height);
|
|
10240
|
-
context.lineWidth = 1;
|
|
10241
|
-
context.strokeStyle = _EyePopPlot.colors.opacity_color;
|
|
10242
|
-
context.fillStyle = _EyePopPlot.colors.opacity_color;
|
|
10243
|
-
context.fill();
|
|
10244
|
-
context.stroke();
|
|
10245
|
-
const mindim = Math.min(obj.height, obj.width);
|
|
10246
|
-
let corner_size = Math.max(15, mindim / 5.33333);
|
|
10247
|
-
var corners = [
|
|
10248
|
-
//top left corner
|
|
10249
|
-
[{ x, y: y + corner_size }, { x, y }, { x: x + corner_size, y }],
|
|
10250
|
-
//bottom left corner
|
|
10251
|
-
[{ x, y: y + h - corner_size }, { x, y: y + h }, { x: x + corner_size, y: y + h }],
|
|
10252
|
-
//top right corner
|
|
10253
|
-
[{ x: x + w - corner_size, y }, { x: x + w, y }, { x: x + w, y: y + corner_size }],
|
|
10254
|
-
//bottom right corner
|
|
10255
|
-
[{ x: x + w, y: y + h - corner_size }, { x: x + w, y: y + h }, { x: x + w - corner_size, y: y + h }]
|
|
10256
|
-
];
|
|
10257
|
-
corners.forEach((corner) => {
|
|
10258
|
-
context.beginPath();
|
|
10259
|
-
context.moveTo(corner[0].x, corner[0].y);
|
|
10260
|
-
context.lineTo(corner[1].x, corner[1].y);
|
|
10261
|
-
context.lineTo(corner[2].x, corner[2].y);
|
|
10262
|
-
context.strokeStyle = _EyePopPlot.colors.primary_color;
|
|
10263
|
-
context.lineWidth = 1;
|
|
10264
|
-
context.stroke();
|
|
10265
|
-
});
|
|
10266
|
-
const padding = Math.max(mindim * 0.02, 5);
|
|
10267
|
-
corner_size = corner_size - padding;
|
|
10268
|
-
var corners2 = [
|
|
10269
|
-
//2nd top left corner
|
|
10270
|
-
[{ x: x + padding, y: y + padding + corner_size }, {
|
|
10271
|
-
x: x + padding,
|
|
10272
|
-
y: y + padding
|
|
10273
|
-
}, { x: x + padding + corner_size, y: y + padding }],
|
|
10274
|
-
//2nd bottom left corner
|
|
10275
|
-
[{ x: x + padding, y: y - padding + h - corner_size }, {
|
|
10276
|
-
x: x + padding,
|
|
10277
|
-
y: y - padding + h
|
|
10278
|
-
}, { x: x + padding + corner_size, y: y - padding + h }],
|
|
10279
|
-
//2nd top right corner
|
|
10280
|
-
[{ x: x - padding + w - corner_size, y: y + padding }, {
|
|
10281
|
-
x: x - padding + w,
|
|
10282
|
-
y: y + padding
|
|
10283
|
-
}, { x: x - padding + w, y: y + padding + corner_size }],
|
|
10284
|
-
//2nd bottom right corner
|
|
10285
|
-
[{ x: x - padding + w, y: y - padding + h - corner_size }, {
|
|
10286
|
-
x: x - padding + w,
|
|
10287
|
-
y: y - padding + h
|
|
10288
|
-
}, { x: x - padding + w - corner_size, y: y - padding + h }]
|
|
10289
|
-
];
|
|
10290
|
-
corners2.forEach((corner) => {
|
|
10291
|
-
context.beginPath();
|
|
10292
|
-
context.moveTo(corner[0].x, corner[0].y);
|
|
10293
|
-
context.lineTo(corner[1].x, corner[1].y);
|
|
10294
|
-
context.lineTo(corner[2].x, corner[2].y);
|
|
10295
|
-
context.strokeStyle = _EyePopPlot.colors.secondary_color;
|
|
10296
|
-
context.lineWidth = 1;
|
|
10297
|
-
context.stroke();
|
|
10298
|
-
});
|
|
10299
|
-
let trackingLabel = "";
|
|
10300
|
-
if (obj.traceId) {
|
|
10301
|
-
trackingLabel = `#${obj.traceId}`;
|
|
10302
|
-
}
|
|
10303
|
-
context.font = this._font;
|
|
10304
|
-
context.fillStyle = "#ffffff";
|
|
10305
|
-
context.textAlign = "left";
|
|
10306
|
-
context.textBaseline = "top";
|
|
10307
|
-
context.fillText(_EyePopPlot.toTitleCase(obj.classLabel + " " + trackingLabel), obj.x + 1.5 * padding, obj.y + 1.5 * padding);
|
|
10308
|
-
}
|
|
10309
|
-
static toTitleCase(str) {
|
|
10310
|
-
if (!str)
|
|
10311
|
-
return "";
|
|
10312
|
-
return str.replace(/\w\S*/g, function(txt) {
|
|
10313
|
-
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
|
|
10314
|
-
});
|
|
10315
|
-
}
|
|
10316
|
-
};
|
|
10317
|
-
_EyePopPlot.colors = {
|
|
10318
|
-
primary_color: "#2fa7d7",
|
|
10319
|
-
secondary_color: "#94e0ff",
|
|
10320
|
-
right_color: "#a1f542",
|
|
10321
|
-
left_color: "#e32740",
|
|
10322
|
-
opacity_color: "rgba(47, 167, 215, 0.2)",
|
|
10323
|
-
white: "#FFFFFF",
|
|
10324
|
-
black: "#111111",
|
|
10325
|
-
blank_color: "#000000"
|
|
10326
|
-
};
|
|
10327
|
-
var EyePopPlot = _EyePopPlot;
|
|
10328
|
-
|
|
10329
|
-
// src/index.ts
|
|
10204
|
+
// index.ts
|
|
10330
10205
|
var readEnv = (env) => {
|
|
10331
10206
|
if (typeof process !== "undefined") {
|
|
10332
10207
|
return process.env?.[env] ?? void 0;
|
|
10333
10208
|
}
|
|
10334
10209
|
return void 0;
|
|
10335
10210
|
};
|
|
10336
|
-
var
|
|
10337
|
-
|
|
10211
|
+
var EyePop;
|
|
10212
|
+
((EyePop2) => {
|
|
10213
|
+
const envSecretKey = readEnv("EYEPOP_SECRET_KEY");
|
|
10214
|
+
const defaultAuth = envSecretKey ? {
|
|
10215
|
+
secretKey: envSecretKey
|
|
10216
|
+
} : void 0;
|
|
10217
|
+
function endpoint(opts = {}) {
|
|
10338
10218
|
if (typeof opts.auth == "undefined") {
|
|
10339
|
-
if (typeof
|
|
10219
|
+
if (typeof defaultAuth == "undefined") {
|
|
10340
10220
|
throw new Error("auth option or EYEPOP_SECRET_KEY environment variable is required");
|
|
10341
10221
|
}
|
|
10342
|
-
opts.auth =
|
|
10222
|
+
opts.auth = defaultAuth;
|
|
10343
10223
|
}
|
|
10344
10224
|
if (typeof opts.popId == "undefined") {
|
|
10345
10225
|
opts.popId = readEnv("EYEPOP_POP_ID");
|
|
@@ -10387,23 +10267,16 @@ var _EyePopSdk = class _EyePopSdk {
|
|
|
10387
10267
|
opts.eyepopUrl = opts.auth.session.eyepopUrl;
|
|
10388
10268
|
}
|
|
10389
10269
|
}
|
|
10390
|
-
const
|
|
10391
|
-
return
|
|
10270
|
+
const endpoint2 = new Endpoint(opts);
|
|
10271
|
+
return endpoint2;
|
|
10392
10272
|
}
|
|
10393
|
-
|
|
10394
|
-
|
|
10395
|
-
|
|
10396
|
-
};
|
|
10397
|
-
_EyePopSdk.envSecretKey = readEnv("EYEPOP_SECRET_KEY");
|
|
10398
|
-
_EyePopSdk.defaultAuth = _EyePopSdk.envSecretKey ? {
|
|
10399
|
-
secretKey: _EyePopSdk.envSecretKey
|
|
10400
|
-
} : void 0;
|
|
10401
|
-
var EyePopSdk = _EyePopSdk;
|
|
10402
|
-
var src_default = EyePopSdk;
|
|
10273
|
+
EyePop2.endpoint = endpoint;
|
|
10274
|
+
})(EyePop || (EyePop = {}));
|
|
10275
|
+
var eyepop_default = EyePop;
|
|
10403
10276
|
export {
|
|
10404
10277
|
EndpointState,
|
|
10405
|
-
|
|
10406
|
-
|
|
10278
|
+
EyePop,
|
|
10279
|
+
eyepop_default as default
|
|
10407
10280
|
};
|
|
10408
10281
|
/*! Bundled license information:
|
|
10409
10282
|
|
|
@@ -10423,4 +10296,4 @@ mime-types/index.js:
|
|
|
10423
10296
|
* MIT Licensed
|
|
10424
10297
|
*)
|
|
10425
10298
|
*/
|
|
10426
|
-
//# sourceMappingURL=index.mjs.map
|
|
10299
|
+
//# sourceMappingURL=eyepop.index.mjs.map
|