@eyepop.ai/eyepop 3.22.0 → 3.23.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.index.d.mts +67 -9
- package/dist/eyepop.index.d.ts +67 -9
- package/dist/eyepop.index.js +99 -21
- package/dist/eyepop.index.js.map +1 -1
- package/dist/eyepop.index.mjs +96 -21
- package/dist/eyepop.index.mjs.map +1 -1
- package/dist/eyepop.min.js +1 -1
- package/package.json +1 -1
package/dist/eyepop.index.mjs
CHANGED
|
@@ -9311,6 +9311,7 @@ function validateCamera(camera) {
|
|
|
9311
9311
|
var PredictionVersion = /* @__PURE__ */ ((PredictionVersion3) => {
|
|
9312
9312
|
PredictionVersion3[PredictionVersion3["V1"] = 1] = "V1";
|
|
9313
9313
|
PredictionVersion3[PredictionVersion3["V2"] = 2] = "V2";
|
|
9314
|
+
PredictionVersion3[PredictionVersion3["V3"] = 3] = "V3";
|
|
9314
9315
|
return PredictionVersion3;
|
|
9315
9316
|
})(PredictionVersion || {});
|
|
9316
9317
|
var DEFAULT_PREDICTION_VERSION = 2 /* V2 */;
|
|
@@ -9331,8 +9332,17 @@ var ForwardOperatorType = /* @__PURE__ */ ((ForwardOperatorType2) => {
|
|
|
9331
9332
|
ForwardOperatorType2["FULL"] = "full";
|
|
9332
9333
|
ForwardOperatorType2["CROP"] = "crop";
|
|
9333
9334
|
ForwardOperatorType2["CROP_WITH_FULL_FALLBACK"] = "crop_with_full_fallback";
|
|
9335
|
+
ForwardOperatorType2["SELECT_CROP"] = "select_crop";
|
|
9336
|
+
ForwardOperatorType2["SELECT_FULL"] = "select_full";
|
|
9334
9337
|
return ForwardOperatorType2;
|
|
9335
9338
|
})(ForwardOperatorType || {});
|
|
9339
|
+
var SelectMode = /* @__PURE__ */ ((SelectMode2) => {
|
|
9340
|
+
SelectMode2["MOST_RELEVANT"] = "most_relevant";
|
|
9341
|
+
return SelectMode2;
|
|
9342
|
+
})(SelectMode || {});
|
|
9343
|
+
function isSelectOperator(operator) {
|
|
9344
|
+
return operator?.type === "select_crop" /* SELECT_CROP */ || operator?.type === "select_full" /* SELECT_FULL */;
|
|
9345
|
+
}
|
|
9336
9346
|
var InferenceType = /* @__PURE__ */ ((InferenceType2) => {
|
|
9337
9347
|
InferenceType2["IMAGE_CLASSIFICATION"] = "image_classification";
|
|
9338
9348
|
InferenceType2["OBJECT_DETECTION"] = "object_detection";
|
|
@@ -9369,6 +9379,52 @@ function validatePop(pop) {
|
|
|
9369
9379
|
if (pop.defaults?.camera !== void 0) {
|
|
9370
9380
|
validateCamera(pop.defaults.camera);
|
|
9371
9381
|
}
|
|
9382
|
+
validateForwards(pop.components);
|
|
9383
|
+
}
|
|
9384
|
+
function popSelects(pop) {
|
|
9385
|
+
const selects = (components) => (components ?? []).some((component) => isSelectOperator(component.forward?.operator) || selects(component.forward?.targets));
|
|
9386
|
+
return selects(pop?.components);
|
|
9387
|
+
}
|
|
9388
|
+
function validateForwards(components) {
|
|
9389
|
+
for (const component of components ?? []) {
|
|
9390
|
+
const operator = component.forward?.operator;
|
|
9391
|
+
if (operator !== void 0) {
|
|
9392
|
+
validateSelectOperator(operator);
|
|
9393
|
+
}
|
|
9394
|
+
validateForwards(component.forward?.targets);
|
|
9395
|
+
}
|
|
9396
|
+
}
|
|
9397
|
+
function validateSelectOperator(operator) {
|
|
9398
|
+
if (!isSelectOperator(operator)) {
|
|
9399
|
+
if (operator.select !== void 0) {
|
|
9400
|
+
throw new Error("select is only valid with the select_crop or select_full operator");
|
|
9401
|
+
}
|
|
9402
|
+
return;
|
|
9403
|
+
}
|
|
9404
|
+
const select = operator.select;
|
|
9405
|
+
if (select === void 0) {
|
|
9406
|
+
throw new Error(`${operator.type} requires a select block`);
|
|
9407
|
+
}
|
|
9408
|
+
if (select.mode !== void 0 && select.mode !== "most_relevant" /* MOST_RELEVANT */) {
|
|
9409
|
+
throw new Error(`select mode ${select.mode} is not supported, the only mode is ${"most_relevant" /* MOST_RELEVANT */}`);
|
|
9410
|
+
}
|
|
9411
|
+
if (select.relevancyModel !== void 0 && select.relevancyModelUuid !== void 0) {
|
|
9412
|
+
throw new Error("select can only have one of relevancyModelUuid or relevancyModel");
|
|
9413
|
+
}
|
|
9414
|
+
if (select.minTrackLengthSeconds !== void 0 && select.minTrackLengthSeconds < 0) {
|
|
9415
|
+
throw new Error("select minTrackLengthSeconds cannot be negative");
|
|
9416
|
+
}
|
|
9417
|
+
if (select.intervalSeconds !== void 0 && select.intervalSeconds <= 0) {
|
|
9418
|
+
throw new Error("select intervalSeconds must be positive");
|
|
9419
|
+
}
|
|
9420
|
+
if (operator.crop !== void 0) {
|
|
9421
|
+
if (operator.type !== "select_crop" /* SELECT_CROP */) {
|
|
9422
|
+
throw new Error(`crop options are only valid with select_crop, not ${operator.type}`);
|
|
9423
|
+
}
|
|
9424
|
+
if (operator.crop.maxItems !== void 0) {
|
|
9425
|
+
throw new Error("select_crop forwards one detection per selection, maxItems does not apply");
|
|
9426
|
+
}
|
|
9427
|
+
}
|
|
9372
9428
|
}
|
|
9373
9429
|
|
|
9374
9430
|
// worker/webrtc_whip.ts
|
|
@@ -9821,8 +9877,8 @@ var UploadJob = class extends AbstractJob {
|
|
|
9821
9877
|
get [Symbol.toStringTag]() {
|
|
9822
9878
|
return "uploadJob";
|
|
9823
9879
|
}
|
|
9824
|
-
constructor(stream, mimeType, size, videoMode, params, getSession, client, requestLogger, uploadBodyFactory) {
|
|
9825
|
-
super(params, getSession, client, requestLogger);
|
|
9880
|
+
constructor(stream, mimeType, size, videoMode, params, getSession, client, requestLogger, uploadBodyFactory, version = DEFAULT_PREDICTION_VERSION) {
|
|
9881
|
+
super(params, getSession, client, requestLogger, version);
|
|
9826
9882
|
this._uploadStream = stream;
|
|
9827
9883
|
this._uploadBodyFactory = uploadBodyFactory;
|
|
9828
9884
|
this._mimeType = mimeType;
|
|
@@ -10015,8 +10071,8 @@ var UploadJob = class extends AbstractJob {
|
|
|
10015
10071
|
}
|
|
10016
10072
|
};
|
|
10017
10073
|
var LoadFromJob = class extends AbstractJob {
|
|
10018
|
-
constructor(location, params, getSession, client, requestLogger) {
|
|
10019
|
-
super(params, getSession, client, requestLogger);
|
|
10074
|
+
constructor(location, params, getSession, client, requestLogger, version = DEFAULT_PREDICTION_VERSION) {
|
|
10075
|
+
super(params, getSession, client, requestLogger, version);
|
|
10020
10076
|
this._location = location;
|
|
10021
10077
|
}
|
|
10022
10078
|
get [Symbol.toStringTag]() {
|
|
@@ -10062,8 +10118,8 @@ var UploadGroupJob = class extends AbstractJob {
|
|
|
10062
10118
|
get [Symbol.toStringTag]() {
|
|
10063
10119
|
return "uploadGroupJob";
|
|
10064
10120
|
}
|
|
10065
|
-
constructor(sources, params, getSession, client, requestLogger) {
|
|
10066
|
-
super(params, getSession, client, requestLogger);
|
|
10121
|
+
constructor(sources, params, getSession, client, requestLogger, version = DEFAULT_PREDICTION_VERSION) {
|
|
10122
|
+
super(params, getSession, client, requestLogger, version);
|
|
10067
10123
|
if (sources.length === 0) {
|
|
10068
10124
|
throw new Error("upload group requires at least one source");
|
|
10069
10125
|
}
|
|
@@ -10124,8 +10180,8 @@ var LoadFromGroupJob = class extends AbstractJob {
|
|
|
10124
10180
|
get [Symbol.toStringTag]() {
|
|
10125
10181
|
return "loadFromGroupJob";
|
|
10126
10182
|
}
|
|
10127
|
-
constructor(urls, params, getSession, client, requestLogger) {
|
|
10128
|
-
super(params, getSession, client, requestLogger);
|
|
10183
|
+
constructor(urls, params, getSession, client, requestLogger, version = DEFAULT_PREDICTION_VERSION) {
|
|
10184
|
+
super(params, getSession, client, requestLogger, version);
|
|
10129
10185
|
if (urls.length === 0) {
|
|
10130
10186
|
throw new Error("load from group requires at least one url");
|
|
10131
10187
|
}
|
|
@@ -10170,8 +10226,8 @@ var LoadFromGroupJob = class extends AbstractJob {
|
|
|
10170
10226
|
}
|
|
10171
10227
|
};
|
|
10172
10228
|
var LoadFromAssetUuidJob = class extends AbstractJob {
|
|
10173
|
-
constructor(assetUuid, params, getSession, client, requestLogger) {
|
|
10174
|
-
super(params, getSession, client, requestLogger);
|
|
10229
|
+
constructor(assetUuid, params, getSession, client, requestLogger, version = DEFAULT_PREDICTION_VERSION) {
|
|
10230
|
+
super(params, getSession, client, requestLogger, version);
|
|
10175
10231
|
this._assetUuid = assetUuid;
|
|
10176
10232
|
}
|
|
10177
10233
|
get [Symbol.toStringTag]() {
|
|
@@ -10211,8 +10267,8 @@ var LoadFromAssetUuidJob = class extends AbstractJob {
|
|
|
10211
10267
|
}
|
|
10212
10268
|
};
|
|
10213
10269
|
var LoadMediaStreamJob = class extends AbstractJob {
|
|
10214
|
-
constructor(mediaStream, params, getSession, client, requestLogger) {
|
|
10215
|
-
super(params, getSession, client, requestLogger);
|
|
10270
|
+
constructor(mediaStream, params, getSession, client, requestLogger, version = DEFAULT_PREDICTION_VERSION) {
|
|
10271
|
+
super(params, getSession, client, requestLogger, version);
|
|
10216
10272
|
this._mediaStream = mediaStream;
|
|
10217
10273
|
}
|
|
10218
10274
|
get [Symbol.toStringTag]() {
|
|
@@ -10856,6 +10912,14 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
|
|
|
10856
10912
|
}
|
|
10857
10913
|
return this.options().pop || null;
|
|
10858
10914
|
}
|
|
10915
|
+
/**
|
|
10916
|
+
* A select forward's results come only at V3. Only a Pop that selects asks
|
|
10917
|
+
* for it, so a worker too old to know V3 - which also rejects that Pop - is
|
|
10918
|
+
* never sent a version it would not accept.
|
|
10919
|
+
*/
|
|
10920
|
+
predictionVersion() {
|
|
10921
|
+
return popSelects(this.pop()) ? 3 /* V3 */ : DEFAULT_PREDICTION_VERSION;
|
|
10922
|
+
}
|
|
10859
10923
|
async changePop(pop) {
|
|
10860
10924
|
validatePop(pop);
|
|
10861
10925
|
if (this.options().popId == "transient" /* Transient */) {
|
|
@@ -10984,7 +11048,7 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
|
|
|
10984
11048
|
return { stream: streamSource.stream, mimeType: streamSource.mimeType };
|
|
10985
11049
|
})
|
|
10986
11050
|
);
|
|
10987
|
-
const job = new UploadGroupJob(sources, params, async () => this.session(), this._client, this._requestLogger);
|
|
11051
|
+
const job = new UploadGroupJob(sources, params, async () => this.session(), this._client, this._requestLogger, this.predictionVersion());
|
|
10988
11052
|
return job.start(
|
|
10989
11053
|
() => {
|
|
10990
11054
|
this.jobDone(job);
|
|
@@ -11016,7 +11080,7 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
|
|
|
11016
11080
|
stream,
|
|
11017
11081
|
mimeType: mimeTypes?.[i] ?? null
|
|
11018
11082
|
}));
|
|
11019
|
-
const job = new UploadGroupJob(sources, params, async () => this.session(), this._client, this._requestLogger);
|
|
11083
|
+
const job = new UploadGroupJob(sources, params, async () => this.session(), this._client, this._requestLogger, this.predictionVersion());
|
|
11020
11084
|
return job.start(
|
|
11021
11085
|
() => {
|
|
11022
11086
|
this.jobDone(job);
|
|
@@ -11041,7 +11105,7 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
|
|
|
11041
11105
|
await this._limit.acquire();
|
|
11042
11106
|
try {
|
|
11043
11107
|
this.updateState();
|
|
11044
|
-
const job = new LoadFromGroupJob(urls, params, async () => this.session(), this._client, this._requestLogger);
|
|
11108
|
+
const job = new LoadFromGroupJob(urls, params, async () => this.session(), this._client, this._requestLogger, this.predictionVersion());
|
|
11045
11109
|
return job.start(
|
|
11046
11110
|
() => {
|
|
11047
11111
|
this.jobDone(job);
|
|
@@ -11073,7 +11137,9 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
|
|
|
11073
11137
|
return this.session();
|
|
11074
11138
|
},
|
|
11075
11139
|
this._client,
|
|
11076
|
-
this._requestLogger
|
|
11140
|
+
this._requestLogger,
|
|
11141
|
+
void 0,
|
|
11142
|
+
this.predictionVersion()
|
|
11077
11143
|
);
|
|
11078
11144
|
return job.start(
|
|
11079
11145
|
() => {
|
|
@@ -11106,7 +11172,9 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
|
|
|
11106
11172
|
return this.session();
|
|
11107
11173
|
},
|
|
11108
11174
|
this._client,
|
|
11109
|
-
this._requestLogger
|
|
11175
|
+
this._requestLogger,
|
|
11176
|
+
void 0,
|
|
11177
|
+
this.predictionVersion()
|
|
11110
11178
|
);
|
|
11111
11179
|
return job.start(
|
|
11112
11180
|
() => {
|
|
@@ -11155,7 +11223,8 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
|
|
|
11155
11223
|
},
|
|
11156
11224
|
this._client,
|
|
11157
11225
|
this._requestLogger,
|
|
11158
|
-
uploadBodyFactory
|
|
11226
|
+
uploadBodyFactory,
|
|
11227
|
+
this.predictionVersion()
|
|
11159
11228
|
);
|
|
11160
11229
|
return job.start(
|
|
11161
11230
|
() => {
|
|
@@ -11193,7 +11262,8 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
|
|
|
11193
11262
|
return this.session();
|
|
11194
11263
|
},
|
|
11195
11264
|
this._client,
|
|
11196
|
-
this._requestLogger
|
|
11265
|
+
this._requestLogger,
|
|
11266
|
+
this.predictionVersion()
|
|
11197
11267
|
);
|
|
11198
11268
|
return job.start(
|
|
11199
11269
|
() => {
|
|
@@ -11223,7 +11293,8 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
|
|
|
11223
11293
|
return this.session();
|
|
11224
11294
|
},
|
|
11225
11295
|
this._client,
|
|
11226
|
-
this._requestLogger
|
|
11296
|
+
this._requestLogger,
|
|
11297
|
+
this.predictionVersion()
|
|
11227
11298
|
);
|
|
11228
11299
|
return job.start(
|
|
11229
11300
|
() => {
|
|
@@ -11253,7 +11324,8 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
|
|
|
11253
11324
|
return this.session();
|
|
11254
11325
|
},
|
|
11255
11326
|
this._client,
|
|
11256
|
-
this._requestLogger
|
|
11327
|
+
this._requestLogger,
|
|
11328
|
+
this.predictionVersion()
|
|
11257
11329
|
);
|
|
11258
11330
|
return job.start(
|
|
11259
11331
|
() => {
|
|
@@ -13410,6 +13482,7 @@ export {
|
|
|
13410
13482
|
PopComponentType,
|
|
13411
13483
|
PredictionVersion,
|
|
13412
13484
|
QUATERNION_TOLERANCE,
|
|
13485
|
+
SelectMode,
|
|
13413
13486
|
Semaphore,
|
|
13414
13487
|
Stream,
|
|
13415
13488
|
TaskMode,
|
|
@@ -13436,6 +13509,8 @@ export {
|
|
|
13436
13509
|
index_default as default,
|
|
13437
13510
|
encodeMultipartFormData,
|
|
13438
13511
|
getBaseUrl,
|
|
13512
|
+
isSelectOperator,
|
|
13513
|
+
popSelects,
|
|
13439
13514
|
randomMultipartBoundary,
|
|
13440
13515
|
readableStreamFromString,
|
|
13441
13516
|
resolveAuth,
|