@eyepop.ai/eyepop 0.9.1 → 0.10.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.min.js +2 -0
- package/dist/eyepop.min.js.LICENSE.txt +18 -0
- package/dist/index.d.mts +79 -34
- package/dist/index.d.ts +79 -34
- package/dist/index.js +547 -177
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +546 -188
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
import { Logger } from 'pino';
|
|
2
|
-
import stream from 'node:stream';
|
|
3
2
|
import { CanvasRenderingContext2D } from 'canvas';
|
|
4
3
|
|
|
5
|
-
interface
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
4
|
+
interface Session {
|
|
5
|
+
readonly eyepopUrl: string;
|
|
6
|
+
readonly popId: string;
|
|
7
|
+
readonly accessToken: string;
|
|
8
|
+
readonly validUntil: number;
|
|
9
|
+
}
|
|
10
|
+
interface SessionPlus extends Session {
|
|
11
|
+
readonly baseUrl: string;
|
|
12
|
+
readonly pipelineId: string;
|
|
13
|
+
}
|
|
14
|
+
declare enum EndpointState {
|
|
15
|
+
Idle = "Idle",
|
|
16
|
+
Busy = "Busy",
|
|
17
|
+
Authenticating = "Authenticating",
|
|
18
|
+
FetchConfig = "FetchConfig",
|
|
19
|
+
StartingPop = "StartingPop",
|
|
20
|
+
Error = "Error"
|
|
21
|
+
}
|
|
22
|
+
interface UploadParams {
|
|
23
|
+
readonly filePath?: string | undefined;
|
|
24
|
+
readonly file?: File | undefined;
|
|
25
|
+
readonly mimeType?: string | undefined;
|
|
24
26
|
}
|
|
25
|
-
|
|
26
27
|
interface Prediction {
|
|
27
28
|
timestamp: number;
|
|
28
29
|
seconds: number;
|
|
@@ -74,34 +75,75 @@ interface PredictedKeyPoints {
|
|
|
74
75
|
interface PredictedKeyPoint extends Point3d, PredictedClass {
|
|
75
76
|
}
|
|
76
77
|
|
|
78
|
+
interface Authentication {
|
|
79
|
+
/**
|
|
80
|
+
* Authentication secret for server side execution.
|
|
81
|
+
* Defaults to process.env['EYEPOP_SECRET_KEY'].
|
|
82
|
+
*/
|
|
83
|
+
secretKey?: string | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Temporary authentication token for client side execution.
|
|
86
|
+
*/
|
|
87
|
+
session?: Session | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* For development mode, attempt to fetch an session from a logged in EyePop user in the same browser session.
|
|
90
|
+
* Either pass the Url of the dashboard, or true fro the default url 'https://dashboard.eyepop.ai/sdkauth'
|
|
91
|
+
*/
|
|
92
|
+
oAuth?: true | string | undefined;
|
|
93
|
+
}
|
|
94
|
+
interface Options {
|
|
95
|
+
auth?: Authentication | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Defaults to process.env['EYEPOP_POP_ID'].
|
|
98
|
+
*/
|
|
99
|
+
popId?: string | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* Override the default base URL for the API, e.g., "https://api.eyepop.ai/"
|
|
102
|
+
*
|
|
103
|
+
* Defaults to process.env['EYEPOP_URL'].
|
|
104
|
+
*/
|
|
105
|
+
eyepopUrl?: string;
|
|
106
|
+
autoStart?: boolean;
|
|
107
|
+
stopJobs?: boolean;
|
|
108
|
+
jobQueueLength?: number;
|
|
109
|
+
logger?: Logger | undefined;
|
|
110
|
+
}
|
|
111
|
+
|
|
77
112
|
interface ResultStream extends AsyncIterable<Prediction> {
|
|
78
113
|
cancel(): void;
|
|
79
114
|
}
|
|
80
115
|
|
|
81
|
-
interface UploadParams {
|
|
82
|
-
readonly filePath?: string | undefined;
|
|
83
|
-
readonly stream?: stream.Readable | undefined;
|
|
84
|
-
readonly mimeType?: string | undefined;
|
|
85
|
-
}
|
|
86
116
|
declare class Endpoint {
|
|
87
|
-
private static readonly MAX_CONNECTIONS;
|
|
88
117
|
private _options;
|
|
89
118
|
private _token;
|
|
90
119
|
private _expire_token_time;
|
|
91
120
|
private _baseUrl;
|
|
92
121
|
private _pipelineId;
|
|
93
|
-
private
|
|
122
|
+
private _popName;
|
|
123
|
+
private _client;
|
|
94
124
|
private _limit;
|
|
125
|
+
private _state;
|
|
126
|
+
private _stateChangeHandler;
|
|
95
127
|
private _logger;
|
|
96
|
-
private _requestLogger;
|
|
128
|
+
private readonly _requestLogger;
|
|
97
129
|
constructor(options: Options);
|
|
130
|
+
onStateChanged(handler: (fromState: EndpointState, toState: EndpointState) => void): Endpoint;
|
|
131
|
+
state(): EndpointState;
|
|
132
|
+
pendingJobs(): number;
|
|
133
|
+
popName(): string | null;
|
|
134
|
+
popId(): string | null;
|
|
135
|
+
session(): Promise<SessionPlus>;
|
|
98
136
|
upload(params: UploadParams): Promise<ResultStream>;
|
|
99
137
|
loadFrom(location: string): Promise<ResultStream>;
|
|
100
138
|
connect(): Promise<Endpoint>;
|
|
139
|
+
private jobDone;
|
|
140
|
+
private updateState;
|
|
141
|
+
private jobStatus;
|
|
142
|
+
private reconnect;
|
|
101
143
|
disconnect(wait?: boolean): Promise<void>;
|
|
102
144
|
protected authorizationHeader(): Promise<string>;
|
|
103
|
-
private
|
|
104
|
-
|
|
145
|
+
private currentAccessToken;
|
|
146
|
+
eyepopUrl(): string;
|
|
105
147
|
}
|
|
106
148
|
|
|
107
149
|
declare class EyePopPlot {
|
|
@@ -119,13 +161,16 @@ declare class EyePopPlot {
|
|
|
119
161
|
blank_color: string;
|
|
120
162
|
};
|
|
121
163
|
prediction(p: Prediction): void;
|
|
122
|
-
object(obj: PredictedObject): void;
|
|
164
|
+
object(obj: PredictedObject, x_scale: number, y_scale: number): void;
|
|
123
165
|
static toTitleCase(str: string): string;
|
|
124
166
|
}
|
|
125
167
|
|
|
126
168
|
declare class EyePopSdk {
|
|
127
|
-
static
|
|
169
|
+
static defaultAuth: {
|
|
170
|
+
secretKey: string | undefined;
|
|
171
|
+
};
|
|
172
|
+
static endpoint({ auth, popId, eyepopUrl, autoStart, stopJobs, jobQueueLength, logger, ...opts }?: Options): Endpoint;
|
|
128
173
|
static plot(context: CanvasRenderingContext2D): EyePopPlot;
|
|
129
174
|
}
|
|
130
175
|
|
|
131
|
-
export { EyePopSdk };
|
|
176
|
+
export { EndpointState, EyePopSdk, type Point2d, type Point3d, type PredictedClass, type PredictedKeyPoint, type PredictedKeyPoints, type PredictedMesh, type PredictedObject, type Prediction, type Session, type UploadParams, EyePopSdk as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
import { Logger } from 'pino';
|
|
2
|
-
import stream from 'node:stream';
|
|
3
2
|
import { CanvasRenderingContext2D } from 'canvas';
|
|
4
3
|
|
|
5
|
-
interface
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
4
|
+
interface Session {
|
|
5
|
+
readonly eyepopUrl: string;
|
|
6
|
+
readonly popId: string;
|
|
7
|
+
readonly accessToken: string;
|
|
8
|
+
readonly validUntil: number;
|
|
9
|
+
}
|
|
10
|
+
interface SessionPlus extends Session {
|
|
11
|
+
readonly baseUrl: string;
|
|
12
|
+
readonly pipelineId: string;
|
|
13
|
+
}
|
|
14
|
+
declare enum EndpointState {
|
|
15
|
+
Idle = "Idle",
|
|
16
|
+
Busy = "Busy",
|
|
17
|
+
Authenticating = "Authenticating",
|
|
18
|
+
FetchConfig = "FetchConfig",
|
|
19
|
+
StartingPop = "StartingPop",
|
|
20
|
+
Error = "Error"
|
|
21
|
+
}
|
|
22
|
+
interface UploadParams {
|
|
23
|
+
readonly filePath?: string | undefined;
|
|
24
|
+
readonly file?: File | undefined;
|
|
25
|
+
readonly mimeType?: string | undefined;
|
|
24
26
|
}
|
|
25
|
-
|
|
26
27
|
interface Prediction {
|
|
27
28
|
timestamp: number;
|
|
28
29
|
seconds: number;
|
|
@@ -74,34 +75,75 @@ interface PredictedKeyPoints {
|
|
|
74
75
|
interface PredictedKeyPoint extends Point3d, PredictedClass {
|
|
75
76
|
}
|
|
76
77
|
|
|
78
|
+
interface Authentication {
|
|
79
|
+
/**
|
|
80
|
+
* Authentication secret for server side execution.
|
|
81
|
+
* Defaults to process.env['EYEPOP_SECRET_KEY'].
|
|
82
|
+
*/
|
|
83
|
+
secretKey?: string | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Temporary authentication token for client side execution.
|
|
86
|
+
*/
|
|
87
|
+
session?: Session | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* For development mode, attempt to fetch an session from a logged in EyePop user in the same browser session.
|
|
90
|
+
* Either pass the Url of the dashboard, or true fro the default url 'https://dashboard.eyepop.ai/sdkauth'
|
|
91
|
+
*/
|
|
92
|
+
oAuth?: true | string | undefined;
|
|
93
|
+
}
|
|
94
|
+
interface Options {
|
|
95
|
+
auth?: Authentication | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Defaults to process.env['EYEPOP_POP_ID'].
|
|
98
|
+
*/
|
|
99
|
+
popId?: string | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* Override the default base URL for the API, e.g., "https://api.eyepop.ai/"
|
|
102
|
+
*
|
|
103
|
+
* Defaults to process.env['EYEPOP_URL'].
|
|
104
|
+
*/
|
|
105
|
+
eyepopUrl?: string;
|
|
106
|
+
autoStart?: boolean;
|
|
107
|
+
stopJobs?: boolean;
|
|
108
|
+
jobQueueLength?: number;
|
|
109
|
+
logger?: Logger | undefined;
|
|
110
|
+
}
|
|
111
|
+
|
|
77
112
|
interface ResultStream extends AsyncIterable<Prediction> {
|
|
78
113
|
cancel(): void;
|
|
79
114
|
}
|
|
80
115
|
|
|
81
|
-
interface UploadParams {
|
|
82
|
-
readonly filePath?: string | undefined;
|
|
83
|
-
readonly stream?: stream.Readable | undefined;
|
|
84
|
-
readonly mimeType?: string | undefined;
|
|
85
|
-
}
|
|
86
116
|
declare class Endpoint {
|
|
87
|
-
private static readonly MAX_CONNECTIONS;
|
|
88
117
|
private _options;
|
|
89
118
|
private _token;
|
|
90
119
|
private _expire_token_time;
|
|
91
120
|
private _baseUrl;
|
|
92
121
|
private _pipelineId;
|
|
93
|
-
private
|
|
122
|
+
private _popName;
|
|
123
|
+
private _client;
|
|
94
124
|
private _limit;
|
|
125
|
+
private _state;
|
|
126
|
+
private _stateChangeHandler;
|
|
95
127
|
private _logger;
|
|
96
|
-
private _requestLogger;
|
|
128
|
+
private readonly _requestLogger;
|
|
97
129
|
constructor(options: Options);
|
|
130
|
+
onStateChanged(handler: (fromState: EndpointState, toState: EndpointState) => void): Endpoint;
|
|
131
|
+
state(): EndpointState;
|
|
132
|
+
pendingJobs(): number;
|
|
133
|
+
popName(): string | null;
|
|
134
|
+
popId(): string | null;
|
|
135
|
+
session(): Promise<SessionPlus>;
|
|
98
136
|
upload(params: UploadParams): Promise<ResultStream>;
|
|
99
137
|
loadFrom(location: string): Promise<ResultStream>;
|
|
100
138
|
connect(): Promise<Endpoint>;
|
|
139
|
+
private jobDone;
|
|
140
|
+
private updateState;
|
|
141
|
+
private jobStatus;
|
|
142
|
+
private reconnect;
|
|
101
143
|
disconnect(wait?: boolean): Promise<void>;
|
|
102
144
|
protected authorizationHeader(): Promise<string>;
|
|
103
|
-
private
|
|
104
|
-
|
|
145
|
+
private currentAccessToken;
|
|
146
|
+
eyepopUrl(): string;
|
|
105
147
|
}
|
|
106
148
|
|
|
107
149
|
declare class EyePopPlot {
|
|
@@ -119,13 +161,16 @@ declare class EyePopPlot {
|
|
|
119
161
|
blank_color: string;
|
|
120
162
|
};
|
|
121
163
|
prediction(p: Prediction): void;
|
|
122
|
-
object(obj: PredictedObject): void;
|
|
164
|
+
object(obj: PredictedObject, x_scale: number, y_scale: number): void;
|
|
123
165
|
static toTitleCase(str: string): string;
|
|
124
166
|
}
|
|
125
167
|
|
|
126
168
|
declare class EyePopSdk {
|
|
127
|
-
static
|
|
169
|
+
static defaultAuth: {
|
|
170
|
+
secretKey: string | undefined;
|
|
171
|
+
};
|
|
172
|
+
static endpoint({ auth, popId, eyepopUrl, autoStart, stopJobs, jobQueueLength, logger, ...opts }?: Options): Endpoint;
|
|
128
173
|
static plot(context: CanvasRenderingContext2D): EyePopPlot;
|
|
129
174
|
}
|
|
130
175
|
|
|
131
|
-
export { EyePopSdk };
|
|
176
|
+
export { EndpointState, EyePopSdk, type Point2d, type Point3d, type PredictedClass, type PredictedKeyPoint, type PredictedKeyPoints, type PredictedMesh, type PredictedObject, type Prediction, type Session, type UploadParams, EyePopSdk as default };
|