@eyepop.ai/eyepop 0.9.0 → 0.9.1
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/index.d.mts +131 -0
- package/dist/index.d.ts +131 -0
- package/dist/index.js +9388 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +9381 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +1 -1
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { Logger } from 'pino';
|
|
2
|
+
import stream from 'node:stream';
|
|
3
|
+
import { CanvasRenderingContext2D } from 'canvas';
|
|
4
|
+
|
|
5
|
+
interface Options {
|
|
6
|
+
/**
|
|
7
|
+
* Defaults to process.env['EYEPOP_SECRET_KEY'].
|
|
8
|
+
*/
|
|
9
|
+
secretKey?: string | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Defaults to process.env['EYEPOP_POP_ID'].
|
|
12
|
+
*/
|
|
13
|
+
popId?: string | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Override the default base URL for the API, e.g., "https://api.eyepop.ai/"
|
|
16
|
+
*
|
|
17
|
+
* Defaults to process.env['EYEPOP_URL'].
|
|
18
|
+
*/
|
|
19
|
+
eyepopUrl?: string;
|
|
20
|
+
autoStart?: boolean;
|
|
21
|
+
stopJobs?: boolean;
|
|
22
|
+
jobQueueLength?: number;
|
|
23
|
+
logger?: Logger | undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface Prediction {
|
|
27
|
+
timestamp: number;
|
|
28
|
+
seconds: number;
|
|
29
|
+
offset: number;
|
|
30
|
+
source_width: number;
|
|
31
|
+
source_height: number;
|
|
32
|
+
source_id: string;
|
|
33
|
+
objects: Array<PredictedObject>;
|
|
34
|
+
classes: Array<PredictedClass>;
|
|
35
|
+
labels: Array<string>;
|
|
36
|
+
meshs: Array<PredictedMesh>;
|
|
37
|
+
keyPoints: Array<PredictedKeyPoints>;
|
|
38
|
+
}
|
|
39
|
+
interface PredictedClass {
|
|
40
|
+
id: number;
|
|
41
|
+
confidence: number;
|
|
42
|
+
classLabel: string;
|
|
43
|
+
}
|
|
44
|
+
interface PredictedObject extends PredictedClass {
|
|
45
|
+
traceId: number | undefined;
|
|
46
|
+
x: number;
|
|
47
|
+
y: number;
|
|
48
|
+
width: number;
|
|
49
|
+
height: number;
|
|
50
|
+
orientation: number;
|
|
51
|
+
outline: Array<Point2d>;
|
|
52
|
+
objects: Array<PredictedObject>;
|
|
53
|
+
classes: Array<PredictedClass>;
|
|
54
|
+
labels: Array<string>;
|
|
55
|
+
meshs: Array<PredictedMesh>;
|
|
56
|
+
keyPoints: Array<PredictedKeyPoints>;
|
|
57
|
+
}
|
|
58
|
+
interface Point2d {
|
|
59
|
+
x: number;
|
|
60
|
+
y: number;
|
|
61
|
+
}
|
|
62
|
+
interface PredictedMesh {
|
|
63
|
+
id: number;
|
|
64
|
+
confidence: number;
|
|
65
|
+
points: Array<Point3d>;
|
|
66
|
+
}
|
|
67
|
+
interface Point3d extends Point2d {
|
|
68
|
+
z: number | undefined;
|
|
69
|
+
}
|
|
70
|
+
interface PredictedKeyPoints {
|
|
71
|
+
type: string;
|
|
72
|
+
points: Array<PredictedKeyPoint>;
|
|
73
|
+
}
|
|
74
|
+
interface PredictedKeyPoint extends Point3d, PredictedClass {
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
interface ResultStream extends AsyncIterable<Prediction> {
|
|
78
|
+
cancel(): void;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
interface UploadParams {
|
|
82
|
+
readonly filePath?: string | undefined;
|
|
83
|
+
readonly stream?: stream.Readable | undefined;
|
|
84
|
+
readonly mimeType?: string | undefined;
|
|
85
|
+
}
|
|
86
|
+
declare class Endpoint {
|
|
87
|
+
private static readonly MAX_CONNECTIONS;
|
|
88
|
+
private _options;
|
|
89
|
+
private _token;
|
|
90
|
+
private _expire_token_time;
|
|
91
|
+
private _baseUrl;
|
|
92
|
+
private _pipelineId;
|
|
93
|
+
private _dispatcher;
|
|
94
|
+
private _limit;
|
|
95
|
+
private _logger;
|
|
96
|
+
private _requestLogger;
|
|
97
|
+
constructor(options: Options);
|
|
98
|
+
upload(params: UploadParams): Promise<ResultStream>;
|
|
99
|
+
loadFrom(location: string): Promise<ResultStream>;
|
|
100
|
+
connect(): Promise<Endpoint>;
|
|
101
|
+
disconnect(wait?: boolean): Promise<void>;
|
|
102
|
+
protected authorizationHeader(): Promise<string>;
|
|
103
|
+
private accessToken;
|
|
104
|
+
private eyepopUrl;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
declare class EyePopPlot {
|
|
108
|
+
private _context;
|
|
109
|
+
private _font;
|
|
110
|
+
constructor(context: CanvasRenderingContext2D);
|
|
111
|
+
static colors: {
|
|
112
|
+
primary_color: string;
|
|
113
|
+
secondary_color: string;
|
|
114
|
+
right_color: string;
|
|
115
|
+
left_color: string;
|
|
116
|
+
opacity_color: string;
|
|
117
|
+
white: string;
|
|
118
|
+
black: string;
|
|
119
|
+
blank_color: string;
|
|
120
|
+
};
|
|
121
|
+
prediction(p: Prediction): void;
|
|
122
|
+
object(obj: PredictedObject): void;
|
|
123
|
+
static toTitleCase(str: string): string;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
declare class EyePopSdk {
|
|
127
|
+
static endpoint({ secretKey, popId, eyepopUrl, autoStart, stopJobs, jobQueueLength, logger, ...opts }?: Options): Endpoint;
|
|
128
|
+
static plot(context: CanvasRenderingContext2D): EyePopPlot;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export { EyePopSdk };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { Logger } from 'pino';
|
|
2
|
+
import stream from 'node:stream';
|
|
3
|
+
import { CanvasRenderingContext2D } from 'canvas';
|
|
4
|
+
|
|
5
|
+
interface Options {
|
|
6
|
+
/**
|
|
7
|
+
* Defaults to process.env['EYEPOP_SECRET_KEY'].
|
|
8
|
+
*/
|
|
9
|
+
secretKey?: string | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Defaults to process.env['EYEPOP_POP_ID'].
|
|
12
|
+
*/
|
|
13
|
+
popId?: string | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Override the default base URL for the API, e.g., "https://api.eyepop.ai/"
|
|
16
|
+
*
|
|
17
|
+
* Defaults to process.env['EYEPOP_URL'].
|
|
18
|
+
*/
|
|
19
|
+
eyepopUrl?: string;
|
|
20
|
+
autoStart?: boolean;
|
|
21
|
+
stopJobs?: boolean;
|
|
22
|
+
jobQueueLength?: number;
|
|
23
|
+
logger?: Logger | undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface Prediction {
|
|
27
|
+
timestamp: number;
|
|
28
|
+
seconds: number;
|
|
29
|
+
offset: number;
|
|
30
|
+
source_width: number;
|
|
31
|
+
source_height: number;
|
|
32
|
+
source_id: string;
|
|
33
|
+
objects: Array<PredictedObject>;
|
|
34
|
+
classes: Array<PredictedClass>;
|
|
35
|
+
labels: Array<string>;
|
|
36
|
+
meshs: Array<PredictedMesh>;
|
|
37
|
+
keyPoints: Array<PredictedKeyPoints>;
|
|
38
|
+
}
|
|
39
|
+
interface PredictedClass {
|
|
40
|
+
id: number;
|
|
41
|
+
confidence: number;
|
|
42
|
+
classLabel: string;
|
|
43
|
+
}
|
|
44
|
+
interface PredictedObject extends PredictedClass {
|
|
45
|
+
traceId: number | undefined;
|
|
46
|
+
x: number;
|
|
47
|
+
y: number;
|
|
48
|
+
width: number;
|
|
49
|
+
height: number;
|
|
50
|
+
orientation: number;
|
|
51
|
+
outline: Array<Point2d>;
|
|
52
|
+
objects: Array<PredictedObject>;
|
|
53
|
+
classes: Array<PredictedClass>;
|
|
54
|
+
labels: Array<string>;
|
|
55
|
+
meshs: Array<PredictedMesh>;
|
|
56
|
+
keyPoints: Array<PredictedKeyPoints>;
|
|
57
|
+
}
|
|
58
|
+
interface Point2d {
|
|
59
|
+
x: number;
|
|
60
|
+
y: number;
|
|
61
|
+
}
|
|
62
|
+
interface PredictedMesh {
|
|
63
|
+
id: number;
|
|
64
|
+
confidence: number;
|
|
65
|
+
points: Array<Point3d>;
|
|
66
|
+
}
|
|
67
|
+
interface Point3d extends Point2d {
|
|
68
|
+
z: number | undefined;
|
|
69
|
+
}
|
|
70
|
+
interface PredictedKeyPoints {
|
|
71
|
+
type: string;
|
|
72
|
+
points: Array<PredictedKeyPoint>;
|
|
73
|
+
}
|
|
74
|
+
interface PredictedKeyPoint extends Point3d, PredictedClass {
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
interface ResultStream extends AsyncIterable<Prediction> {
|
|
78
|
+
cancel(): void;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
interface UploadParams {
|
|
82
|
+
readonly filePath?: string | undefined;
|
|
83
|
+
readonly stream?: stream.Readable | undefined;
|
|
84
|
+
readonly mimeType?: string | undefined;
|
|
85
|
+
}
|
|
86
|
+
declare class Endpoint {
|
|
87
|
+
private static readonly MAX_CONNECTIONS;
|
|
88
|
+
private _options;
|
|
89
|
+
private _token;
|
|
90
|
+
private _expire_token_time;
|
|
91
|
+
private _baseUrl;
|
|
92
|
+
private _pipelineId;
|
|
93
|
+
private _dispatcher;
|
|
94
|
+
private _limit;
|
|
95
|
+
private _logger;
|
|
96
|
+
private _requestLogger;
|
|
97
|
+
constructor(options: Options);
|
|
98
|
+
upload(params: UploadParams): Promise<ResultStream>;
|
|
99
|
+
loadFrom(location: string): Promise<ResultStream>;
|
|
100
|
+
connect(): Promise<Endpoint>;
|
|
101
|
+
disconnect(wait?: boolean): Promise<void>;
|
|
102
|
+
protected authorizationHeader(): Promise<string>;
|
|
103
|
+
private accessToken;
|
|
104
|
+
private eyepopUrl;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
declare class EyePopPlot {
|
|
108
|
+
private _context;
|
|
109
|
+
private _font;
|
|
110
|
+
constructor(context: CanvasRenderingContext2D);
|
|
111
|
+
static colors: {
|
|
112
|
+
primary_color: string;
|
|
113
|
+
secondary_color: string;
|
|
114
|
+
right_color: string;
|
|
115
|
+
left_color: string;
|
|
116
|
+
opacity_color: string;
|
|
117
|
+
white: string;
|
|
118
|
+
black: string;
|
|
119
|
+
blank_color: string;
|
|
120
|
+
};
|
|
121
|
+
prediction(p: Prediction): void;
|
|
122
|
+
object(obj: PredictedObject): void;
|
|
123
|
+
static toTitleCase(str: string): string;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
declare class EyePopSdk {
|
|
127
|
+
static endpoint({ secretKey, popId, eyepopUrl, autoStart, stopJobs, jobQueueLength, logger, ...opts }?: Options): Endpoint;
|
|
128
|
+
static plot(context: CanvasRenderingContext2D): EyePopPlot;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export { EyePopSdk };
|