@eyepop.ai/eyepop 0.12.0 → 0.14.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/index.d.mts CHANGED
@@ -19,8 +19,9 @@ declare enum EndpointState {
19
19
  StartingPop = "StartingPop",
20
20
  Error = "Error"
21
21
  }
22
- interface LiveIngress {
22
+ interface LiveMedia {
23
23
  ingressId(): string;
24
+ stream(): Promise<MediaStream>;
24
25
  close(): Promise<void>;
25
26
  }
26
27
  interface IngressEvent {
@@ -98,22 +99,32 @@ interface ResultStream extends AsyncIterable<Prediction> {
98
99
  cancel(): void;
99
100
  }
100
101
 
101
- interface Authentication {
102
+ interface Auth0Options {
103
+ domain: string;
104
+ clientId: string;
105
+ audience: string;
106
+ scope: string;
107
+ }
108
+ interface SecretKeyAuth {
102
109
  /**
103
110
  * Authentication secret for server side execution.
104
111
  * Defaults to process.env['EYEPOP_SECRET_KEY'].
105
112
  */
106
- secretKey?: string | undefined;
113
+ secretKey: string;
114
+ }
115
+ interface SessionAuth {
107
116
  /**
108
117
  * Temporary authentication token for client side execution.
109
118
  */
110
- session?: Session | undefined;
119
+ session: Session;
120
+ }
121
+ interface OAuth2Auth {
111
122
  /**
112
- * For development mode, attempt to fetch an session from a logged in EyePop user in the same browser session.
113
- * Either pass the Url of the dashboard, or true fro the default url 'https://dashboard.eyepop.ai/sdkauth'
123
+ * For development mode, authenticate with your dashboard.eyepop.ai account
114
124
  */
115
- oAuth?: true | string | undefined;
125
+ oAuth2: true | Auth0Options;
116
126
  }
127
+ type Authentication = undefined | SecretKeyAuth | SessionAuth | OAuth2Auth;
117
128
  interface Options {
118
129
  auth?: Authentication | undefined;
119
130
  /**
@@ -148,30 +159,31 @@ declare class Endpoint {
148
159
  private _logger;
149
160
  private readonly _requestLogger;
150
161
  constructor(options: Options);
151
- onStateChanged(handler: (fromState: EndpointState, toState: EndpointState) => void): Endpoint;
152
- private startIngressWs;
153
- onIngressEvent(handler: (event: IngressEvent) => void): Endpoint;
162
+ eyepopUrl(): string;
154
163
  state(): EndpointState;
155
164
  pendingJobs(): number;
156
165
  popName(): string | null;
157
166
  popId(): string | null;
167
+ onStateChanged(handler: (fromState: EndpointState, toState: EndpointState) => void): Endpoint;
168
+ onIngressEvent(handler: (event: IngressEvent) => void): Endpoint;
169
+ connect(): Promise<Endpoint>;
170
+ disconnect(wait?: boolean): Promise<void>;
158
171
  session(): Promise<SessionPlus>;
159
- liveIngress(stream: MediaStream): Promise<LiveIngress>;
172
+ liveIngress(stream: MediaStream): Promise<LiveMedia>;
173
+ liveEgress(ingressId: string): Promise<LiveMedia>;
160
174
  process(source: Source): Promise<ResultStream>;
175
+ private startIngressWs;
161
176
  private uploadFile;
162
177
  private uploadStream;
163
178
  private uploadPath;
164
179
  private loadFrom;
165
180
  private loadLiveIngress;
166
- connect(): Promise<Endpoint>;
167
181
  private jobDone;
168
182
  private updateState;
169
183
  private jobStatus;
170
184
  private reconnect;
171
- disconnect(wait?: boolean): Promise<void>;
172
- protected authorizationHeader(): Promise<string>;
185
+ private authorizationHeader;
173
186
  private currentAccessToken;
174
- eyepopUrl(): string;
175
187
  }
176
188
 
177
189
  declare class EyePopPlot {
@@ -194,11 +206,10 @@ declare class EyePopPlot {
194
206
  }
195
207
 
196
208
  declare class EyePopSdk {
197
- static defaultAuth: {
198
- secretKey: string | undefined;
199
- };
200
- static endpoint({ auth, popId, eyepopUrl, autoStart, stopJobs, jobQueueLength, logger, ...opts }?: Options): Endpoint;
209
+ private static readonly envSecretKey;
210
+ static defaultAuth: SecretKeyAuth | undefined;
211
+ static endpoint(opts?: Options): Endpoint;
201
212
  static plot(context: CanvasRenderingContext2D): EyePopPlot;
202
213
  }
203
214
 
204
- export { EndpointState, EyePopSdk, type FileSource, type IngressEvent, type LiveIngress, 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 UrlSource, EyePopSdk as default };
215
+ export { EndpointState, EyePopSdk, 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 UrlSource, EyePopSdk as default };
package/dist/index.d.ts CHANGED
@@ -19,8 +19,9 @@ declare enum EndpointState {
19
19
  StartingPop = "StartingPop",
20
20
  Error = "Error"
21
21
  }
22
- interface LiveIngress {
22
+ interface LiveMedia {
23
23
  ingressId(): string;
24
+ stream(): Promise<MediaStream>;
24
25
  close(): Promise<void>;
25
26
  }
26
27
  interface IngressEvent {
@@ -98,22 +99,32 @@ interface ResultStream extends AsyncIterable<Prediction> {
98
99
  cancel(): void;
99
100
  }
100
101
 
101
- interface Authentication {
102
+ interface Auth0Options {
103
+ domain: string;
104
+ clientId: string;
105
+ audience: string;
106
+ scope: string;
107
+ }
108
+ interface SecretKeyAuth {
102
109
  /**
103
110
  * Authentication secret for server side execution.
104
111
  * Defaults to process.env['EYEPOP_SECRET_KEY'].
105
112
  */
106
- secretKey?: string | undefined;
113
+ secretKey: string;
114
+ }
115
+ interface SessionAuth {
107
116
  /**
108
117
  * Temporary authentication token for client side execution.
109
118
  */
110
- session?: Session | undefined;
119
+ session: Session;
120
+ }
121
+ interface OAuth2Auth {
111
122
  /**
112
- * For development mode, attempt to fetch an session from a logged in EyePop user in the same browser session.
113
- * Either pass the Url of the dashboard, or true fro the default url 'https://dashboard.eyepop.ai/sdkauth'
123
+ * For development mode, authenticate with your dashboard.eyepop.ai account
114
124
  */
115
- oAuth?: true | string | undefined;
125
+ oAuth2: true | Auth0Options;
116
126
  }
127
+ type Authentication = undefined | SecretKeyAuth | SessionAuth | OAuth2Auth;
117
128
  interface Options {
118
129
  auth?: Authentication | undefined;
119
130
  /**
@@ -148,30 +159,31 @@ declare class Endpoint {
148
159
  private _logger;
149
160
  private readonly _requestLogger;
150
161
  constructor(options: Options);
151
- onStateChanged(handler: (fromState: EndpointState, toState: EndpointState) => void): Endpoint;
152
- private startIngressWs;
153
- onIngressEvent(handler: (event: IngressEvent) => void): Endpoint;
162
+ eyepopUrl(): string;
154
163
  state(): EndpointState;
155
164
  pendingJobs(): number;
156
165
  popName(): string | null;
157
166
  popId(): string | null;
167
+ onStateChanged(handler: (fromState: EndpointState, toState: EndpointState) => void): Endpoint;
168
+ onIngressEvent(handler: (event: IngressEvent) => void): Endpoint;
169
+ connect(): Promise<Endpoint>;
170
+ disconnect(wait?: boolean): Promise<void>;
158
171
  session(): Promise<SessionPlus>;
159
- liveIngress(stream: MediaStream): Promise<LiveIngress>;
172
+ liveIngress(stream: MediaStream): Promise<LiveMedia>;
173
+ liveEgress(ingressId: string): Promise<LiveMedia>;
160
174
  process(source: Source): Promise<ResultStream>;
175
+ private startIngressWs;
161
176
  private uploadFile;
162
177
  private uploadStream;
163
178
  private uploadPath;
164
179
  private loadFrom;
165
180
  private loadLiveIngress;
166
- connect(): Promise<Endpoint>;
167
181
  private jobDone;
168
182
  private updateState;
169
183
  private jobStatus;
170
184
  private reconnect;
171
- disconnect(wait?: boolean): Promise<void>;
172
- protected authorizationHeader(): Promise<string>;
185
+ private authorizationHeader;
173
186
  private currentAccessToken;
174
- eyepopUrl(): string;
175
187
  }
176
188
 
177
189
  declare class EyePopPlot {
@@ -194,11 +206,10 @@ declare class EyePopPlot {
194
206
  }
195
207
 
196
208
  declare class EyePopSdk {
197
- static defaultAuth: {
198
- secretKey: string | undefined;
199
- };
200
- static endpoint({ auth, popId, eyepopUrl, autoStart, stopJobs, jobQueueLength, logger, ...opts }?: Options): Endpoint;
209
+ private static readonly envSecretKey;
210
+ static defaultAuth: SecretKeyAuth | undefined;
211
+ static endpoint(opts?: Options): Endpoint;
201
212
  static plot(context: CanvasRenderingContext2D): EyePopPlot;
202
213
  }
203
214
 
204
- export { EndpointState, EyePopSdk, type FileSource, type IngressEvent, type LiveIngress, 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 UrlSource, EyePopSdk as default };
215
+ export { EndpointState, EyePopSdk, 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 UrlSource, EyePopSdk as default };