@eyepop.ai/eyepop 0.10.0 → 0.12.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.
@@ -1,3 +1,17 @@
1
+ /*!
2
+ * The buffer module from node.js, for the browser.
3
+ *
4
+ * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
5
+ * @license MIT
6
+ */
7
+
8
+ /*!
9
+ * The buffer module from node.js, for the browser.
10
+ *
11
+ * @author Feross Aboukhadijeh <https://feross.org>
12
+ * @license MIT
13
+ */
14
+
1
15
  /*! Bundled license information:
2
16
 
3
17
  mime-db/index.js:
@@ -16,3 +30,7 @@ mime-types/index.js:
16
30
  * MIT Licensed
17
31
  *)
18
32
  */
33
+
34
+ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
35
+
36
+ /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
package/dist/index.d.mts CHANGED
@@ -19,11 +19,31 @@ declare enum EndpointState {
19
19
  StartingPop = "StartingPop",
20
20
  Error = "Error"
21
21
  }
22
- interface UploadParams {
23
- readonly filePath?: string | undefined;
24
- readonly file?: File | undefined;
25
- readonly mimeType?: string | undefined;
22
+ interface LiveIngress {
23
+ ingressId(): string;
24
+ close(): Promise<void>;
26
25
  }
26
+ interface IngressEvent {
27
+ readonly ingressId: string;
28
+ readonly event: "stream-ready" | "stream-ready";
29
+ }
30
+ interface FileSource {
31
+ readonly file: File;
32
+ }
33
+ interface StreamSource {
34
+ readonly stream: ReadableStream<Uint8Array>;
35
+ readonly mimeType: string;
36
+ }
37
+ interface PathSource {
38
+ readonly path: string;
39
+ }
40
+ interface LiveSource {
41
+ readonly ingressId: string;
42
+ }
43
+ interface UrlSource {
44
+ readonly url: string;
45
+ }
46
+ type Source = FileSource | StreamSource | PathSource | LiveSource | UrlSource;
27
47
  interface Prediction {
28
48
  timestamp: number;
29
49
  seconds: number;
@@ -74,6 +94,9 @@ interface PredictedKeyPoints {
74
94
  }
75
95
  interface PredictedKeyPoint extends Point3d, PredictedClass {
76
96
  }
97
+ interface ResultStream extends AsyncIterable<Prediction> {
98
+ cancel(): void;
99
+ }
77
100
 
78
101
  interface Authentication {
79
102
  /**
@@ -109,10 +132,6 @@ interface Options {
109
132
  logger?: Logger | undefined;
110
133
  }
111
134
 
112
- interface ResultStream extends AsyncIterable<Prediction> {
113
- cancel(): void;
114
- }
115
-
116
135
  declare class Endpoint {
117
136
  private _options;
118
137
  private _token;
@@ -124,17 +143,26 @@ declare class Endpoint {
124
143
  private _limit;
125
144
  private _state;
126
145
  private _stateChangeHandler;
146
+ private _ingressEventHandler;
147
+ private _ingressEventWs;
127
148
  private _logger;
128
149
  private readonly _requestLogger;
129
150
  constructor(options: Options);
130
151
  onStateChanged(handler: (fromState: EndpointState, toState: EndpointState) => void): Endpoint;
152
+ private startIngressWs;
153
+ onIngressEvent(handler: (event: IngressEvent) => void): Endpoint;
131
154
  state(): EndpointState;
132
155
  pendingJobs(): number;
133
156
  popName(): string | null;
134
157
  popId(): string | null;
135
158
  session(): Promise<SessionPlus>;
136
- upload(params: UploadParams): Promise<ResultStream>;
137
- loadFrom(location: string): Promise<ResultStream>;
159
+ liveIngress(stream: MediaStream): Promise<LiveIngress>;
160
+ process(source: Source): Promise<ResultStream>;
161
+ private uploadFile;
162
+ private uploadStream;
163
+ private uploadPath;
164
+ private loadFrom;
165
+ private loadLiveIngress;
138
166
  connect(): Promise<Endpoint>;
139
167
  private jobDone;
140
168
  private updateState;
@@ -161,7 +189,7 @@ declare class EyePopPlot {
161
189
  blank_color: string;
162
190
  };
163
191
  prediction(p: Prediction): void;
164
- object(obj: PredictedObject, x_scale: number, y_scale: number): void;
192
+ object(obj: PredictedObject, x_scale?: number, y_scale?: number): void;
165
193
  static toTitleCase(str: string): string;
166
194
  }
167
195
 
@@ -173,4 +201,4 @@ declare class EyePopSdk {
173
201
  static plot(context: CanvasRenderingContext2D): EyePopPlot;
174
202
  }
175
203
 
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 };
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 };
package/dist/index.d.ts CHANGED
@@ -19,11 +19,31 @@ declare enum EndpointState {
19
19
  StartingPop = "StartingPop",
20
20
  Error = "Error"
21
21
  }
22
- interface UploadParams {
23
- readonly filePath?: string | undefined;
24
- readonly file?: File | undefined;
25
- readonly mimeType?: string | undefined;
22
+ interface LiveIngress {
23
+ ingressId(): string;
24
+ close(): Promise<void>;
26
25
  }
26
+ interface IngressEvent {
27
+ readonly ingressId: string;
28
+ readonly event: "stream-ready" | "stream-ready";
29
+ }
30
+ interface FileSource {
31
+ readonly file: File;
32
+ }
33
+ interface StreamSource {
34
+ readonly stream: ReadableStream<Uint8Array>;
35
+ readonly mimeType: string;
36
+ }
37
+ interface PathSource {
38
+ readonly path: string;
39
+ }
40
+ interface LiveSource {
41
+ readonly ingressId: string;
42
+ }
43
+ interface UrlSource {
44
+ readonly url: string;
45
+ }
46
+ type Source = FileSource | StreamSource | PathSource | LiveSource | UrlSource;
27
47
  interface Prediction {
28
48
  timestamp: number;
29
49
  seconds: number;
@@ -74,6 +94,9 @@ interface PredictedKeyPoints {
74
94
  }
75
95
  interface PredictedKeyPoint extends Point3d, PredictedClass {
76
96
  }
97
+ interface ResultStream extends AsyncIterable<Prediction> {
98
+ cancel(): void;
99
+ }
77
100
 
78
101
  interface Authentication {
79
102
  /**
@@ -109,10 +132,6 @@ interface Options {
109
132
  logger?: Logger | undefined;
110
133
  }
111
134
 
112
- interface ResultStream extends AsyncIterable<Prediction> {
113
- cancel(): void;
114
- }
115
-
116
135
  declare class Endpoint {
117
136
  private _options;
118
137
  private _token;
@@ -124,17 +143,26 @@ declare class Endpoint {
124
143
  private _limit;
125
144
  private _state;
126
145
  private _stateChangeHandler;
146
+ private _ingressEventHandler;
147
+ private _ingressEventWs;
127
148
  private _logger;
128
149
  private readonly _requestLogger;
129
150
  constructor(options: Options);
130
151
  onStateChanged(handler: (fromState: EndpointState, toState: EndpointState) => void): Endpoint;
152
+ private startIngressWs;
153
+ onIngressEvent(handler: (event: IngressEvent) => void): Endpoint;
131
154
  state(): EndpointState;
132
155
  pendingJobs(): number;
133
156
  popName(): string | null;
134
157
  popId(): string | null;
135
158
  session(): Promise<SessionPlus>;
136
- upload(params: UploadParams): Promise<ResultStream>;
137
- loadFrom(location: string): Promise<ResultStream>;
159
+ liveIngress(stream: MediaStream): Promise<LiveIngress>;
160
+ process(source: Source): Promise<ResultStream>;
161
+ private uploadFile;
162
+ private uploadStream;
163
+ private uploadPath;
164
+ private loadFrom;
165
+ private loadLiveIngress;
138
166
  connect(): Promise<Endpoint>;
139
167
  private jobDone;
140
168
  private updateState;
@@ -161,7 +189,7 @@ declare class EyePopPlot {
161
189
  blank_color: string;
162
190
  };
163
191
  prediction(p: Prediction): void;
164
- object(obj: PredictedObject, x_scale: number, y_scale: number): void;
192
+ object(obj: PredictedObject, x_scale?: number, y_scale?: number): void;
165
193
  static toTitleCase(str: string): string;
166
194
  }
167
195
 
@@ -173,4 +201,4 @@ declare class EyePopSdk {
173
201
  static plot(context: CanvasRenderingContext2D): EyePopPlot;
174
202
  }
175
203
 
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 };
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 };