@eyepop.ai/eyepop 0.9.1 → 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.
package/dist/index.d.mts CHANGED
@@ -1,28 +1,15 @@
1
1
  import { Logger } from 'pino';
2
- import stream from 'node:stream';
3
2
  import { CanvasRenderingContext2D } from 'canvas';
4
3
 
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;
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;
24
12
  }
25
-
26
13
  interface Prediction {
27
14
  timestamp: number;
28
15
  seconds: number;
@@ -74,33 +61,56 @@ interface PredictedKeyPoints {
74
61
  interface PredictedKeyPoint extends Point3d, PredictedClass {
75
62
  }
76
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
+
77
90
  interface ResultStream extends AsyncIterable<Prediction> {
78
91
  cancel(): void;
79
92
  }
80
93
 
81
- interface UploadParams {
82
- readonly filePath?: string | undefined;
83
- readonly stream?: stream.Readable | undefined;
84
- readonly mimeType?: string | undefined;
85
- }
86
94
  declare class Endpoint {
87
- private static readonly MAX_CONNECTIONS;
88
95
  private _options;
89
96
  private _token;
90
97
  private _expire_token_time;
91
98
  private _baseUrl;
92
99
  private _pipelineId;
93
- private _dispatcher;
100
+ private _popName;
101
+ private _client;
94
102
  private _limit;
95
103
  private _logger;
96
- private _requestLogger;
104
+ private readonly _requestLogger;
97
105
  constructor(options: Options);
106
+ popName(): string | null;
107
+ session(): Promise<Session>;
98
108
  upload(params: UploadParams): Promise<ResultStream>;
99
109
  loadFrom(location: string): Promise<ResultStream>;
100
110
  connect(): Promise<Endpoint>;
101
111
  disconnect(wait?: boolean): Promise<void>;
102
112
  protected authorizationHeader(): Promise<string>;
103
- private accessToken;
113
+ private currentAccessToken;
104
114
  private eyepopUrl;
105
115
  }
106
116
 
@@ -124,7 +134,7 @@ declare class EyePopPlot {
124
134
  }
125
135
 
126
136
  declare class EyePopSdk {
127
- static endpoint({ secretKey, popId, eyepopUrl, autoStart, stopJobs, jobQueueLength, logger, ...opts }?: Options): Endpoint;
137
+ static endpoint({ secretKey, session, popId, eyepopUrl, autoStart, stopJobs, jobQueueLength, logger, ...opts }?: Options): Endpoint;
128
138
  static plot(context: CanvasRenderingContext2D): EyePopPlot;
129
139
  }
130
140
 
package/dist/index.d.ts CHANGED
@@ -1,28 +1,15 @@
1
1
  import { Logger } from 'pino';
2
- import stream from 'node:stream';
3
2
  import { CanvasRenderingContext2D } from 'canvas';
4
3
 
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;
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;
24
12
  }
25
-
26
13
  interface Prediction {
27
14
  timestamp: number;
28
15
  seconds: number;
@@ -74,33 +61,56 @@ interface PredictedKeyPoints {
74
61
  interface PredictedKeyPoint extends Point3d, PredictedClass {
75
62
  }
76
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
+
77
90
  interface ResultStream extends AsyncIterable<Prediction> {
78
91
  cancel(): void;
79
92
  }
80
93
 
81
- interface UploadParams {
82
- readonly filePath?: string | undefined;
83
- readonly stream?: stream.Readable | undefined;
84
- readonly mimeType?: string | undefined;
85
- }
86
94
  declare class Endpoint {
87
- private static readonly MAX_CONNECTIONS;
88
95
  private _options;
89
96
  private _token;
90
97
  private _expire_token_time;
91
98
  private _baseUrl;
92
99
  private _pipelineId;
93
- private _dispatcher;
100
+ private _popName;
101
+ private _client;
94
102
  private _limit;
95
103
  private _logger;
96
- private _requestLogger;
104
+ private readonly _requestLogger;
97
105
  constructor(options: Options);
106
+ popName(): string | null;
107
+ session(): Promise<Session>;
98
108
  upload(params: UploadParams): Promise<ResultStream>;
99
109
  loadFrom(location: string): Promise<ResultStream>;
100
110
  connect(): Promise<Endpoint>;
101
111
  disconnect(wait?: boolean): Promise<void>;
102
112
  protected authorizationHeader(): Promise<string>;
103
- private accessToken;
113
+ private currentAccessToken;
104
114
  private eyepopUrl;
105
115
  }
106
116
 
@@ -124,7 +134,7 @@ declare class EyePopPlot {
124
134
  }
125
135
 
126
136
  declare class EyePopSdk {
127
- static endpoint({ secretKey, popId, eyepopUrl, autoStart, stopJobs, jobQueueLength, logger, ...opts }?: Options): Endpoint;
137
+ static endpoint({ secretKey, session, popId, eyepopUrl, autoStart, stopJobs, jobQueueLength, logger, ...opts }?: Options): Endpoint;
128
138
  static plot(context: CanvasRenderingContext2D): EyePopPlot;
129
139
  }
130
140