@eyepop.ai/eyepop 0.9.0 → 0.9.2

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