@eyepop.ai/eyepop 0.16.3 → 0.17.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 +31 -8
- package/dist/eyepop.index.d.ts +31 -8
- package/dist/eyepop.index.js +68 -41
- package/dist/eyepop.index.js.map +1 -1
- package/dist/eyepop.index.mjs +68 -41
- package/dist/eyepop.index.mjs.map +1 -1
- package/dist/eyepop.min.js +1 -1
- package/package.json +1 -1
package/dist/eyepop.index.d.mts
CHANGED
|
@@ -44,6 +44,17 @@ interface UrlSource {
|
|
|
44
44
|
readonly url: string;
|
|
45
45
|
}
|
|
46
46
|
type Source = FileSource | StreamSource | PathSource | LiveSource | UrlSource;
|
|
47
|
+
interface Box {
|
|
48
|
+
readonly topLeft: Point2d;
|
|
49
|
+
readonly bottomRight: Point2d;
|
|
50
|
+
}
|
|
51
|
+
interface Roi {
|
|
52
|
+
readonly points: Point2d[] | undefined;
|
|
53
|
+
readonly boxes: Box[] | undefined;
|
|
54
|
+
}
|
|
55
|
+
interface SourceParams {
|
|
56
|
+
readonly roi: Roi | undefined;
|
|
57
|
+
}
|
|
47
58
|
interface StreamTime {
|
|
48
59
|
timestamp: number;
|
|
49
60
|
seconds: number;
|
|
@@ -65,6 +76,16 @@ interface PredictedClass {
|
|
|
65
76
|
classLabel: string;
|
|
66
77
|
category: string;
|
|
67
78
|
}
|
|
79
|
+
interface Contour {
|
|
80
|
+
points: Array<Point2d>;
|
|
81
|
+
cutouts: Array<Array<Point2d>>;
|
|
82
|
+
}
|
|
83
|
+
interface Mask {
|
|
84
|
+
bitmap: string;
|
|
85
|
+
width: number;
|
|
86
|
+
height: number;
|
|
87
|
+
stride: number;
|
|
88
|
+
}
|
|
68
89
|
interface PredictedObject extends PredictedClass {
|
|
69
90
|
traceId: number | undefined;
|
|
70
91
|
x: number;
|
|
@@ -72,12 +93,14 @@ interface PredictedObject extends PredictedClass {
|
|
|
72
93
|
width: number;
|
|
73
94
|
height: number;
|
|
74
95
|
orientation: number;
|
|
75
|
-
outline: Array<Point2d
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
96
|
+
outline: Array<Point2d> | undefined;
|
|
97
|
+
contours: Array<Contour> | undefined;
|
|
98
|
+
mask: Mask | undefined;
|
|
99
|
+
objects: Array<PredictedObject> | undefined;
|
|
100
|
+
classes: Array<PredictedClass> | undefined;
|
|
101
|
+
labels: Array<string> | undefined;
|
|
102
|
+
meshs: Array<PredictedMesh> | undefined;
|
|
103
|
+
keyPoints: Array<PredictedKeyPoints> | undefined;
|
|
81
104
|
}
|
|
82
105
|
interface Point2d {
|
|
83
106
|
x: number;
|
|
@@ -175,7 +198,7 @@ declare class Endpoint {
|
|
|
175
198
|
session(): Promise<SessionPlus>;
|
|
176
199
|
liveIngress(stream: MediaStream): Promise<LiveMedia>;
|
|
177
200
|
liveEgress(ingressId: string): Promise<LiveMedia>;
|
|
178
|
-
process(source: Source): Promise<ResultStream>;
|
|
201
|
+
process(source: Source, params?: SourceParams | undefined): Promise<ResultStream>;
|
|
179
202
|
private startIngressWs;
|
|
180
203
|
private uploadFile;
|
|
181
204
|
private uploadStream;
|
|
@@ -194,4 +217,4 @@ declare namespace EyePop {
|
|
|
194
217
|
function endpoint(opts?: Options): Endpoint;
|
|
195
218
|
}
|
|
196
219
|
|
|
197
|
-
export { EndpointState, EyePop, type FileSource, type IngressEvent, type LiveMedia, type LiveSource, type PathSource, type Point2d, type Point3d, type PredictedClass, type PredictedKeyPoint, type PredictedKeyPoints, type PredictedMesh, type PredictedObject, type Prediction, type ResultStream, type Session, type Source, type StreamSource, type StreamTime, type UrlSource, EyePop as default };
|
|
220
|
+
export { type Contour, EndpointState, EyePop, type FileSource, type IngressEvent, type LiveMedia, type LiveSource, type PathSource, type Point2d, type Point3d, type PredictedClass, type PredictedKeyPoint, type PredictedKeyPoints, type PredictedMesh, type PredictedObject, type Prediction, type ResultStream, type Session, type Source, type StreamSource, type StreamTime, type UrlSource, EyePop as default };
|
package/dist/eyepop.index.d.ts
CHANGED
|
@@ -44,6 +44,17 @@ interface UrlSource {
|
|
|
44
44
|
readonly url: string;
|
|
45
45
|
}
|
|
46
46
|
type Source = FileSource | StreamSource | PathSource | LiveSource | UrlSource;
|
|
47
|
+
interface Box {
|
|
48
|
+
readonly topLeft: Point2d;
|
|
49
|
+
readonly bottomRight: Point2d;
|
|
50
|
+
}
|
|
51
|
+
interface Roi {
|
|
52
|
+
readonly points: Point2d[] | undefined;
|
|
53
|
+
readonly boxes: Box[] | undefined;
|
|
54
|
+
}
|
|
55
|
+
interface SourceParams {
|
|
56
|
+
readonly roi: Roi | undefined;
|
|
57
|
+
}
|
|
47
58
|
interface StreamTime {
|
|
48
59
|
timestamp: number;
|
|
49
60
|
seconds: number;
|
|
@@ -65,6 +76,16 @@ interface PredictedClass {
|
|
|
65
76
|
classLabel: string;
|
|
66
77
|
category: string;
|
|
67
78
|
}
|
|
79
|
+
interface Contour {
|
|
80
|
+
points: Array<Point2d>;
|
|
81
|
+
cutouts: Array<Array<Point2d>>;
|
|
82
|
+
}
|
|
83
|
+
interface Mask {
|
|
84
|
+
bitmap: string;
|
|
85
|
+
width: number;
|
|
86
|
+
height: number;
|
|
87
|
+
stride: number;
|
|
88
|
+
}
|
|
68
89
|
interface PredictedObject extends PredictedClass {
|
|
69
90
|
traceId: number | undefined;
|
|
70
91
|
x: number;
|
|
@@ -72,12 +93,14 @@ interface PredictedObject extends PredictedClass {
|
|
|
72
93
|
width: number;
|
|
73
94
|
height: number;
|
|
74
95
|
orientation: number;
|
|
75
|
-
outline: Array<Point2d
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
96
|
+
outline: Array<Point2d> | undefined;
|
|
97
|
+
contours: Array<Contour> | undefined;
|
|
98
|
+
mask: Mask | undefined;
|
|
99
|
+
objects: Array<PredictedObject> | undefined;
|
|
100
|
+
classes: Array<PredictedClass> | undefined;
|
|
101
|
+
labels: Array<string> | undefined;
|
|
102
|
+
meshs: Array<PredictedMesh> | undefined;
|
|
103
|
+
keyPoints: Array<PredictedKeyPoints> | undefined;
|
|
81
104
|
}
|
|
82
105
|
interface Point2d {
|
|
83
106
|
x: number;
|
|
@@ -175,7 +198,7 @@ declare class Endpoint {
|
|
|
175
198
|
session(): Promise<SessionPlus>;
|
|
176
199
|
liveIngress(stream: MediaStream): Promise<LiveMedia>;
|
|
177
200
|
liveEgress(ingressId: string): Promise<LiveMedia>;
|
|
178
|
-
process(source: Source): Promise<ResultStream>;
|
|
201
|
+
process(source: Source, params?: SourceParams | undefined): Promise<ResultStream>;
|
|
179
202
|
private startIngressWs;
|
|
180
203
|
private uploadFile;
|
|
181
204
|
private uploadStream;
|
|
@@ -194,4 +217,4 @@ declare namespace EyePop {
|
|
|
194
217
|
function endpoint(opts?: Options): Endpoint;
|
|
195
218
|
}
|
|
196
219
|
|
|
197
|
-
export { EndpointState, EyePop, type FileSource, type IngressEvent, type LiveMedia, type LiveSource, type PathSource, type Point2d, type Point3d, type PredictedClass, type PredictedKeyPoint, type PredictedKeyPoints, type PredictedMesh, type PredictedObject, type Prediction, type ResultStream, type Session, type Source, type StreamSource, type StreamTime, type UrlSource, EyePop as default };
|
|
220
|
+
export { type Contour, EndpointState, EyePop, type FileSource, type IngressEvent, type LiveMedia, type LiveSource, type PathSource, type Point2d, type Point3d, type PredictedClass, type PredictedKeyPoint, type PredictedKeyPoints, type PredictedMesh, type PredictedObject, type Prediction, type ResultStream, type Session, type Source, type StreamSource, type StreamTime, type UrlSource, EyePop as default };
|
package/dist/eyepop.index.js
CHANGED
|
@@ -8927,10 +8927,11 @@ function readableStreamAsyncIterable(stream) {
|
|
|
8927
8927
|
|
|
8928
8928
|
// jobs.ts
|
|
8929
8929
|
var AbstractJob = class {
|
|
8930
|
-
constructor(getSession, client, requestLogger) {
|
|
8930
|
+
constructor(params, getSession, client, requestLogger) {
|
|
8931
8931
|
this._responseStream = null;
|
|
8932
8932
|
this._controller = new AbortController();
|
|
8933
8933
|
this._getSession = getSession;
|
|
8934
|
+
this._params = params ?? null;
|
|
8934
8935
|
this._client = client;
|
|
8935
8936
|
this._requestLogger = requestLogger;
|
|
8936
8937
|
}
|
|
@@ -9004,36 +9005,60 @@ var UploadJob = class extends AbstractJob {
|
|
|
9004
9005
|
get [Symbol.toStringTag]() {
|
|
9005
9006
|
return "uploadJob";
|
|
9006
9007
|
}
|
|
9007
|
-
constructor(stream, mimeType, getSession, client, requestLogger) {
|
|
9008
|
-
super(getSession, client, requestLogger);
|
|
9008
|
+
constructor(stream, mimeType, params, getSession, client, requestLogger) {
|
|
9009
|
+
super(params, getSession, client, requestLogger);
|
|
9009
9010
|
this._uploadStream = stream;
|
|
9010
9011
|
this._mimeType = mimeType;
|
|
9011
9012
|
}
|
|
9012
9013
|
async startJob() {
|
|
9013
9014
|
const session = await this._getSession();
|
|
9014
|
-
const headers = {
|
|
9015
|
-
"Authorization": `Bearer ${session.accessToken}`,
|
|
9016
|
-
"Accept": "application/jsonl",
|
|
9017
|
-
"Content-Type": this._mimeType
|
|
9018
|
-
};
|
|
9019
9015
|
const postUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=sync`;
|
|
9020
|
-
|
|
9021
|
-
|
|
9022
|
-
|
|
9023
|
-
|
|
9024
|
-
|
|
9025
|
-
|
|
9026
|
-
|
|
9027
|
-
"
|
|
9028
|
-
|
|
9029
|
-
|
|
9030
|
-
|
|
9016
|
+
let response;
|
|
9017
|
+
if (this._params) {
|
|
9018
|
+
this._requestLogger.debug("before POST %s with multipart body because of params");
|
|
9019
|
+
const params = JSON.stringify(this._params);
|
|
9020
|
+
const paramBlob = new Blob([params], { type: "application/json" });
|
|
9021
|
+
const formData = new FormData();
|
|
9022
|
+
formData.append("params", paramBlob);
|
|
9023
|
+
formData.append("file", this._uploadStream);
|
|
9024
|
+
const headers = {
|
|
9025
|
+
"Authorization": `Bearer ${session.accessToken}`,
|
|
9026
|
+
"Accept": "application/jsonl"
|
|
9027
|
+
};
|
|
9028
|
+
response = await this._client.fetch(postUrl, {
|
|
9029
|
+
headers,
|
|
9030
|
+
method: "POST",
|
|
9031
|
+
body: formData,
|
|
9032
|
+
signal: this._controller.signal,
|
|
9033
|
+
// @ts-ignore
|
|
9034
|
+
"duplex": "half",
|
|
9035
|
+
dispatcher: this._dispatcher
|
|
9036
|
+
});
|
|
9037
|
+
this._requestLogger.debug("after POST %s with multipart body because of params");
|
|
9038
|
+
} else {
|
|
9039
|
+
this._requestLogger.debug("before POST %s with stream as body");
|
|
9040
|
+
const headers = {
|
|
9041
|
+
"Authorization": `Bearer ${session.accessToken}`,
|
|
9042
|
+
"Accept": "application/jsonl",
|
|
9043
|
+
"Content-Type": this._mimeType
|
|
9044
|
+
};
|
|
9045
|
+
response = await this._client.fetch(postUrl, {
|
|
9046
|
+
headers,
|
|
9047
|
+
method: "POST",
|
|
9048
|
+
body: this._uploadStream,
|
|
9049
|
+
signal: this._controller.signal,
|
|
9050
|
+
// @ts-ignore
|
|
9051
|
+
"duplex": "half",
|
|
9052
|
+
dispatcher: this._dispatcher
|
|
9053
|
+
});
|
|
9054
|
+
this._requestLogger.debug("after POST %s with stream as body");
|
|
9055
|
+
}
|
|
9031
9056
|
return response;
|
|
9032
9057
|
}
|
|
9033
9058
|
};
|
|
9034
9059
|
var LoadFromJob = class extends AbstractJob {
|
|
9035
|
-
constructor(location, getSession, client, requestLogger) {
|
|
9036
|
-
super(getSession, client, requestLogger);
|
|
9060
|
+
constructor(location, params, getSession, client, requestLogger) {
|
|
9061
|
+
super(params, getSession, client, requestLogger);
|
|
9037
9062
|
this._location = location;
|
|
9038
9063
|
}
|
|
9039
9064
|
get [Symbol.toStringTag]() {
|
|
@@ -9042,7 +9067,8 @@ var LoadFromJob = class extends AbstractJob {
|
|
|
9042
9067
|
async startJob() {
|
|
9043
9068
|
const body = {
|
|
9044
9069
|
"sourceType": "URL",
|
|
9045
|
-
"url": this._location
|
|
9070
|
+
"url": this._location,
|
|
9071
|
+
"params": this._params
|
|
9046
9072
|
};
|
|
9047
9073
|
const session = await this._getSession();
|
|
9048
9074
|
const headers = {
|
|
@@ -9065,8 +9091,8 @@ var LoadFromJob = class extends AbstractJob {
|
|
|
9065
9091
|
}
|
|
9066
9092
|
};
|
|
9067
9093
|
var LoadLiveIngressJob = class extends AbstractJob {
|
|
9068
|
-
constructor(ingressId, getSession, client, requestLogger) {
|
|
9069
|
-
super(getSession, client, requestLogger);
|
|
9094
|
+
constructor(ingressId, params, getSession, client, requestLogger) {
|
|
9095
|
+
super(params, getSession, client, requestLogger);
|
|
9070
9096
|
this._ingressId = ingressId;
|
|
9071
9097
|
}
|
|
9072
9098
|
get [Symbol.toStringTag]() {
|
|
@@ -9075,7 +9101,8 @@ var LoadLiveIngressJob = class extends AbstractJob {
|
|
|
9075
9101
|
async startJob() {
|
|
9076
9102
|
const body = {
|
|
9077
9103
|
"sourceType": "LIVE_INGRESS",
|
|
9078
|
-
"liveIngressId": this._ingressId
|
|
9104
|
+
"liveIngressId": this._ingressId,
|
|
9105
|
+
"params": this._params
|
|
9079
9106
|
};
|
|
9080
9107
|
const session = await this._getSession();
|
|
9081
9108
|
const headers = {
|
|
@@ -9938,17 +9965,17 @@ var Endpoint = class {
|
|
|
9938
9965
|
}, this._client, this._requestLogger);
|
|
9939
9966
|
return whep.start();
|
|
9940
9967
|
}
|
|
9941
|
-
async process(source) {
|
|
9968
|
+
async process(source, params = void 0) {
|
|
9942
9969
|
if (source.file !== void 0) {
|
|
9943
|
-
return this.uploadFile(source);
|
|
9970
|
+
return this.uploadFile(source, params);
|
|
9944
9971
|
} else if (source.stream !== void 0) {
|
|
9945
|
-
return this.uploadStream(source);
|
|
9972
|
+
return this.uploadStream(source, params);
|
|
9946
9973
|
} else if (source.path !== void 0) {
|
|
9947
|
-
return this.uploadPath(source);
|
|
9974
|
+
return this.uploadPath(source, params);
|
|
9948
9975
|
} else if (source.url !== void 0) {
|
|
9949
|
-
return this.loadFrom(source);
|
|
9976
|
+
return this.loadFrom(source, params);
|
|
9950
9977
|
} else if (source.ingressId !== void 0) {
|
|
9951
|
-
return this.loadLiveIngress(source);
|
|
9978
|
+
return this.loadLiveIngress(source, params);
|
|
9952
9979
|
} else {
|
|
9953
9980
|
return Promise.reject("unknown source type");
|
|
9954
9981
|
}
|
|
@@ -9990,14 +10017,14 @@ var Endpoint = class {
|
|
|
9990
10017
|
this.updateState();
|
|
9991
10018
|
}
|
|
9992
10019
|
}
|
|
9993
|
-
async uploadFile(source) {
|
|
10020
|
+
async uploadFile(source, params) {
|
|
9994
10021
|
if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
|
|
9995
10022
|
return Promise.reject("endpoint not connected, use connect() before upload()");
|
|
9996
10023
|
}
|
|
9997
10024
|
await this._limit.acquire();
|
|
9998
10025
|
try {
|
|
9999
10026
|
this.updateState();
|
|
10000
|
-
const job = new UploadJob(source.file, source.file.type, async () => {
|
|
10027
|
+
const job = new UploadJob(source.file, source.file.type, params, async () => {
|
|
10001
10028
|
return this.session();
|
|
10002
10029
|
}, this._client, this._requestLogger);
|
|
10003
10030
|
return job.start(() => {
|
|
@@ -10010,14 +10037,14 @@ var Endpoint = class {
|
|
|
10010
10037
|
throw e;
|
|
10011
10038
|
}
|
|
10012
10039
|
}
|
|
10013
|
-
async uploadStream(source) {
|
|
10040
|
+
async uploadStream(source, params) {
|
|
10014
10041
|
if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
|
|
10015
10042
|
return Promise.reject("endpoint not connected, use connect() before upload()");
|
|
10016
10043
|
}
|
|
10017
10044
|
await this._limit.acquire();
|
|
10018
10045
|
try {
|
|
10019
10046
|
this.updateState();
|
|
10020
|
-
const job = new UploadJob(source.stream, source.mimeType, async () => {
|
|
10047
|
+
const job = new UploadJob(source.stream, source.mimeType, params, async () => {
|
|
10021
10048
|
return this.session();
|
|
10022
10049
|
}, this._client, this._requestLogger);
|
|
10023
10050
|
return job.start(() => {
|
|
@@ -10030,7 +10057,7 @@ var Endpoint = class {
|
|
|
10030
10057
|
throw e;
|
|
10031
10058
|
}
|
|
10032
10059
|
}
|
|
10033
|
-
async uploadPath(source) {
|
|
10060
|
+
async uploadPath(source, params) {
|
|
10034
10061
|
if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
|
|
10035
10062
|
throw new Error("endpoint not connected, use connect() before process()");
|
|
10036
10063
|
}
|
|
@@ -10038,7 +10065,7 @@ var Endpoint = class {
|
|
|
10038
10065
|
try {
|
|
10039
10066
|
this.updateState();
|
|
10040
10067
|
const streamSource = await resolvePath(source);
|
|
10041
|
-
const job = new UploadJob(streamSource.stream, streamSource.mimeType, async () => {
|
|
10068
|
+
const job = new UploadJob(streamSource.stream, streamSource.mimeType, params, async () => {
|
|
10042
10069
|
return this.session();
|
|
10043
10070
|
}, this._client, this._requestLogger);
|
|
10044
10071
|
return job.start(() => {
|
|
@@ -10051,14 +10078,14 @@ var Endpoint = class {
|
|
|
10051
10078
|
throw e;
|
|
10052
10079
|
}
|
|
10053
10080
|
}
|
|
10054
|
-
async loadFrom(source) {
|
|
10081
|
+
async loadFrom(source, params) {
|
|
10055
10082
|
if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
|
|
10056
10083
|
throw new Error("endpoint not connected, use connect() before loadFrom()");
|
|
10057
10084
|
}
|
|
10058
10085
|
await this._limit.acquire();
|
|
10059
10086
|
try {
|
|
10060
10087
|
this.updateState();
|
|
10061
|
-
const job = new LoadFromJob(source.url, async () => {
|
|
10088
|
+
const job = new LoadFromJob(source.url, params, async () => {
|
|
10062
10089
|
return this.session();
|
|
10063
10090
|
}, this._client, this._requestLogger);
|
|
10064
10091
|
return job.start(() => {
|
|
@@ -10071,14 +10098,14 @@ var Endpoint = class {
|
|
|
10071
10098
|
throw e;
|
|
10072
10099
|
}
|
|
10073
10100
|
}
|
|
10074
|
-
async loadLiveIngress(source) {
|
|
10101
|
+
async loadLiveIngress(source, params) {
|
|
10075
10102
|
if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
|
|
10076
10103
|
throw new Error("endpoint not connected, use connect() before loadLiveIngress()");
|
|
10077
10104
|
}
|
|
10078
10105
|
await this._limit.acquire();
|
|
10079
10106
|
try {
|
|
10080
10107
|
this.updateState();
|
|
10081
|
-
const job = new LoadLiveIngressJob(source.ingressId, async () => {
|
|
10108
|
+
const job = new LoadLiveIngressJob(source.ingressId, params, async () => {
|
|
10082
10109
|
return this.session();
|
|
10083
10110
|
}, this._client, this._requestLogger);
|
|
10084
10111
|
return job.start(() => {
|