@eyepop.ai/eyepop 3.17.2 → 3.18.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/README.md CHANGED
@@ -54,7 +54,6 @@ Create transient sessions with a pop when the worker endpoint is constructed. Th
54
54
 
55
55
  ```typescript
56
56
  import { EyePop } from '@eyepop.ai/eyepop'
57
-
58
57
  ;(async () => {
59
58
  const endpoint = await EyePop.workerEndpoint({
60
59
  pop: {
@@ -105,10 +104,20 @@ You can also pass the key explicitly from server-side configuration:
105
104
 
106
105
  ```typescript
107
106
  const endpoint = await EyePop.workerEndpoint({
108
- auth: { apiKey: process.env.EYEPOP_API_KEY },
107
+ apiKey: process.env.EYEPOP_API_KEY,
109
108
  }).connect()
110
109
  ```
111
110
 
111
+ `accessToken` is accepted as the same bearer credential shape:
112
+
113
+ ```typescript
114
+ const endpoint = await EyePop.workerEndpoint({
115
+ accessToken: process.env.EYEPOP_ACCESS_TOKEN,
116
+ }).connect()
117
+ ```
118
+
119
+ The nested `auth` option is still supported but deprecated. Pass `apiKey`, `accessToken`, `session`, or `oAuth2` at the top level for new code.
120
+
112
121
  ### Persistent Sessions
113
122
 
114
123
  If EyePop has provisioned a persistent worker session for your deployment, set `EYEPOP_SESSION_UUID` in the trusted server environment or pass `sessionUuid` explicitly.
@@ -120,7 +129,6 @@ export EYEPOP_SESSION_UUID=<your_session_uuid>
120
129
 
121
130
  ```typescript
122
131
  import { EyePop } from '@eyepop.ai/eyepop'
123
-
124
132
  ;(async () => {
125
133
  const endpoint = await EyePop.workerEndpoint({
126
134
  sessionUuid: process.env.EYEPOP_SESSION_UUID,
@@ -175,7 +183,7 @@ Dashboard users can run local browser demos with the current browser session:
175
183
  ```html
176
184
  <script>
177
185
  document.addEventListener('DOMContentLoaded', async () => {
178
- const endpoint = await EyePop.workerEndpoint({ auth: { oAuth2: true } }).connect()
186
+ const endpoint = await EyePop.workerEndpoint({ oAuth2: true }).connect()
179
187
  try {
180
188
  await endpoint.changePop({
181
189
  components: [
@@ -248,10 +256,7 @@ const stream2 = Readable.toWeb(fs.createReadStream('b.jpg'))
248
256
  const results = await endpoint.uploadStreamGroup([stream1, stream2], ['image/jpeg', 'image/jpeg'])
249
257
 
250
258
  // Remote URLs (the server fetches each)
251
- const results = await endpoint.loadFromGroup([
252
- 'https://example.com/a.jpg',
253
- 'https://example.com/b.jpg',
254
- ])
259
+ const results = await endpoint.loadFromGroup(['https://example.com/a.jpg', 'https://example.com/b.jpg'])
255
260
  ```
256
261
 
257
262
  Image order is preserved end-to-end. A group may contain **up to 16 images** (enforced server-side). The pop's ability must be multi-image-capable; a single-image ability handed a group returns an error.
@@ -69,6 +69,7 @@ interface Prediction extends StreamTime {
69
69
  meshs?: Array<PredictedMesh>;
70
70
  keyPoints?: Array<PredictedKeyPoints>;
71
71
  embeddings?: Array<PredictedEmbedding>;
72
+ details?: Array<Map<string, any>>;
72
73
  motions?: Array<PredictedMotion>;
73
74
  }
74
75
  interface PredictedClass {
@@ -114,6 +115,7 @@ interface PredictedObject extends PredictedClass {
114
115
  texts?: Array<PredictedText>;
115
116
  meshs?: Array<PredictedMesh>;
116
117
  keyPoints?: Array<PredictedKeyPoints>;
118
+ details?: Array<Map<string, any>>;
117
119
  }
118
120
  interface Point2d {
119
121
  x: number;
@@ -933,6 +935,12 @@ interface ApiKeyAuth {
933
935
  */
934
936
  apiKey: string;
935
937
  }
938
+ interface AccessTokenAuth {
939
+ /**
940
+ * Bearer token accepted by the compute API.
941
+ */
942
+ accessToken: string;
943
+ }
936
944
  interface SessionAuth {
937
945
  /**
938
946
  * Temporary authentication token for client side execution.
@@ -951,7 +959,10 @@ interface LocalAuth {
951
959
  */
952
960
  isLocal: true;
953
961
  }
954
- type Authentication = undefined | ApiKeyAuth | SessionAuth | OAuth2Auth | LocalAuth;
962
+ type Authentication = undefined | ApiKeyAuth | AccessTokenAuth | SessionAuth | OAuth2Auth | LocalAuth;
963
+ declare function resolveAuth(options: Options): Authentication;
964
+ declare function apiKeyCredential(auth: Authentication): string | undefined;
965
+ declare function accessTokenCredential(auth: Authentication): string | undefined;
955
966
  interface HttpClient {
956
967
  fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
957
968
  close(): Promise<void>;
@@ -962,6 +973,26 @@ interface PlatformSupport {
962
973
  resolvePath: (source: PathSource, logger: Logger) => Promise<StreamSource>;
963
974
  }
964
975
  interface Options {
976
+ /**
977
+ * Authentication api key for server side execution.
978
+ * Defaults to process.env['EYEPOP_API_KEY'].
979
+ */
980
+ apiKey?: string | undefined;
981
+ /**
982
+ * Bearer token accepted by the compute API.
983
+ */
984
+ accessToken?: string | undefined;
985
+ /**
986
+ * Temporary authentication token for client side execution.
987
+ */
988
+ session?: Session | undefined;
989
+ /**
990
+ * For development mode, authenticate with your dashboard.eyepop.ai account
991
+ */
992
+ oAuth2?: true | Auth0Options | undefined;
993
+ /**
994
+ * @deprecated Pass apiKey, accessToken, session, or oAuth2 at the top level.
995
+ */
965
996
  auth?: Authentication | undefined;
966
997
  eyepopUrl?: string | undefined;
967
998
  jobQueueLength?: number;
@@ -1467,4 +1498,4 @@ declare namespace EyePop {
1467
1498
  function dataEndpoint(opts?: DataOptions): DataEndpoint;
1468
1499
  }
1469
1500
 
1470
- export { type AbilityAliasEntry, AbstractJob, type AliasResolution, type Annotation, AnnotationInclusionMode, AnnotationType, type ApiKeyAuth, type Area, AreaType, ArtifactType, type Asset, type AssetImport, AssetInclusionMode, AssetStatus, AssetUrlType, type AssetUuidSource, type Auth0Options, type Authentication, type AutoAnnotate, type AutoAnnotateParams, type AutoAnnotatePrompt, AutoAnnotateStatus, AutoAnnotateTask, type AutoPromptConfig, type AutoTask, type BaseArea, type BaseComponent, type BaseTask, type Box, type ChangeEvent, ChangeType, type ClassificationTask, type ComponentFinderComponent, type ComponentParams, type Contour, type ContourArea, type ContourFinderComponent, ContourType, type CreateWorkflow, type CreateWorkflowConfig, DEFAULT_PREDICTION_VERSION, DataApiType, DataEndpoint, type DataOptions, type DataSession, type Dataset, type DatasetAutoAnnotate, type DatasetAutoAnnotateCreate, type DatasetAutoAnnotateUpdate, type DatasetCreate, type DatasetHeroAssetUpdate, type DatasetParent, type DatasetUpdate, type DatasetVersion, type DatasetVersionAssetStats, type DownloadResponse, Endpoint, EndpointState, type EvaluateConfig, type EvaluateFilter, type EvaluateRequest, type EvaluateResponse, type EvaluateRunInfo, EvaluationStatus, ExportedBy, EyePop, EyepopLineDecoder, type FileSource, type ForwardComponent, ForwardOperatorType, type HttpClient, type InferRequest, type InferRunInfo, type InferRuntimeConfig, type InferenceComponent, InferenceType, type ListWorkFlowItem, type ListWorkFlowItemMetadata, type ListWorkflowItemMetadataLabels, LoadFromAssetUuidJob, LoadFromGroupJob, LoadFromJob, LoadMediaStreamJob, type LocalAuth, type Mask, type MediaStreamSource, type Model, type ModelCreate, type ModelExport, ModelExportStatus, ModelFormat, type ModelMetrics, ModelPrecisionType, type ModelSample, ModelStatus, ModelTask, type ModelTrainingProgress, ModelTrainingStage, ModelType, type ModelUpdate, type MotionDetectConfig, MotionModel, type MultipartContent, type MultipartPart, type OAuth2Auth, type OnChangeEvent, type Options, type PathSource, type PlatformSupport, type Point2d, type Point3d, type Pop, type PopComponent, PopComponentType, type PopCrop, type PopForward, type PopForwardOperator, type PredictedClass, type PredictedEmbedding, type PredictedKeyPoint, type PredictedKeyPoints, type PredictedMesh, type PredictedMotion, type PredictedObject, type PredictedText, type Prediction, PredictionVersion, type ProcessParams, type ProcessRequest, type QcAiHubExportParams, type RectangleArea, type ResultStream, type Roi, Semaphore, type Session, type SessionAuth, type Source, Stream, type StreamEvent, type StreamSource, type StreamTime, TaskMode, TaskType, type TimeSpan, type TrackingComponent, TranscodeMode, type TransformInto, TransientPopId, UploadGroupJob, UploadJob, type UploadSource, type UrlSource, UserReview, VideoMode, type VlmAbility, type VlmAbilityCreate, type VlmAbilityGroup, type VlmAbilityGroupCreate, type VlmAbilityGroupUpdate, VlmAbilityStatus, type VlmAbilityUpdate, WebrtcBase, WebrtcWhep, WebrtcWhip, WorkerEndpoint, type WorkerOptions, type WorkerSession, type Workflow, WorkflowPhase, EyePop as default, encodeMultipartFormData, getBaseUrl, randomMultipartBoundary, readableStreamFromString };
1501
+ export { type AbilityAliasEntry, AbstractJob, type AccessTokenAuth, type AliasResolution, type Annotation, AnnotationInclusionMode, AnnotationType, type ApiKeyAuth, type Area, AreaType, ArtifactType, type Asset, type AssetImport, AssetInclusionMode, AssetStatus, AssetUrlType, type AssetUuidSource, type Auth0Options, type Authentication, type AutoAnnotate, type AutoAnnotateParams, type AutoAnnotatePrompt, AutoAnnotateStatus, AutoAnnotateTask, type AutoPromptConfig, type AutoTask, type BaseArea, type BaseComponent, type BaseTask, type Box, type ChangeEvent, ChangeType, type ClassificationTask, type ComponentFinderComponent, type ComponentParams, type Contour, type ContourArea, type ContourFinderComponent, ContourType, type CreateWorkflow, type CreateWorkflowConfig, DEFAULT_PREDICTION_VERSION, DataApiType, DataEndpoint, type DataOptions, type DataSession, type Dataset, type DatasetAutoAnnotate, type DatasetAutoAnnotateCreate, type DatasetAutoAnnotateUpdate, type DatasetCreate, type DatasetHeroAssetUpdate, type DatasetParent, type DatasetUpdate, type DatasetVersion, type DatasetVersionAssetStats, type DownloadResponse, Endpoint, EndpointState, type EvaluateConfig, type EvaluateFilter, type EvaluateRequest, type EvaluateResponse, type EvaluateRunInfo, EvaluationStatus, ExportedBy, EyePop, EyepopLineDecoder, type FileSource, type ForwardComponent, ForwardOperatorType, type HttpClient, type InferRequest, type InferRunInfo, type InferRuntimeConfig, type InferenceComponent, InferenceType, type ListWorkFlowItem, type ListWorkFlowItemMetadata, type ListWorkflowItemMetadataLabels, LoadFromAssetUuidJob, LoadFromGroupJob, LoadFromJob, LoadMediaStreamJob, type LocalAuth, type Mask, type MediaStreamSource, type Model, type ModelCreate, type ModelExport, ModelExportStatus, ModelFormat, type ModelMetrics, ModelPrecisionType, type ModelSample, ModelStatus, ModelTask, type ModelTrainingProgress, ModelTrainingStage, ModelType, type ModelUpdate, type MotionDetectConfig, MotionModel, type MultipartContent, type MultipartPart, type OAuth2Auth, type OnChangeEvent, type Options, type PathSource, type PlatformSupport, type Point2d, type Point3d, type Pop, type PopComponent, PopComponentType, type PopCrop, type PopForward, type PopForwardOperator, type PredictedClass, type PredictedEmbedding, type PredictedKeyPoint, type PredictedKeyPoints, type PredictedMesh, type PredictedMotion, type PredictedObject, type PredictedText, type Prediction, PredictionVersion, type ProcessParams, type ProcessRequest, type QcAiHubExportParams, type RectangleArea, type ResultStream, type Roi, Semaphore, type Session, type SessionAuth, type Source, Stream, type StreamEvent, type StreamSource, type StreamTime, TaskMode, TaskType, type TimeSpan, type TrackingComponent, TranscodeMode, type TransformInto, TransientPopId, UploadGroupJob, UploadJob, type UploadSource, type UrlSource, UserReview, VideoMode, type VlmAbility, type VlmAbilityCreate, type VlmAbilityGroup, type VlmAbilityGroupCreate, type VlmAbilityGroupUpdate, VlmAbilityStatus, type VlmAbilityUpdate, WebrtcBase, WebrtcWhep, WebrtcWhip, WorkerEndpoint, type WorkerOptions, type WorkerSession, type Workflow, WorkflowPhase, accessTokenCredential, apiKeyCredential, EyePop as default, encodeMultipartFormData, getBaseUrl, randomMultipartBoundary, readableStreamFromString, resolveAuth };
@@ -69,6 +69,7 @@ interface Prediction extends StreamTime {
69
69
  meshs?: Array<PredictedMesh>;
70
70
  keyPoints?: Array<PredictedKeyPoints>;
71
71
  embeddings?: Array<PredictedEmbedding>;
72
+ details?: Array<Map<string, any>>;
72
73
  motions?: Array<PredictedMotion>;
73
74
  }
74
75
  interface PredictedClass {
@@ -114,6 +115,7 @@ interface PredictedObject extends PredictedClass {
114
115
  texts?: Array<PredictedText>;
115
116
  meshs?: Array<PredictedMesh>;
116
117
  keyPoints?: Array<PredictedKeyPoints>;
118
+ details?: Array<Map<string, any>>;
117
119
  }
118
120
  interface Point2d {
119
121
  x: number;
@@ -933,6 +935,12 @@ interface ApiKeyAuth {
933
935
  */
934
936
  apiKey: string;
935
937
  }
938
+ interface AccessTokenAuth {
939
+ /**
940
+ * Bearer token accepted by the compute API.
941
+ */
942
+ accessToken: string;
943
+ }
936
944
  interface SessionAuth {
937
945
  /**
938
946
  * Temporary authentication token for client side execution.
@@ -951,7 +959,10 @@ interface LocalAuth {
951
959
  */
952
960
  isLocal: true;
953
961
  }
954
- type Authentication = undefined | ApiKeyAuth | SessionAuth | OAuth2Auth | LocalAuth;
962
+ type Authentication = undefined | ApiKeyAuth | AccessTokenAuth | SessionAuth | OAuth2Auth | LocalAuth;
963
+ declare function resolveAuth(options: Options): Authentication;
964
+ declare function apiKeyCredential(auth: Authentication): string | undefined;
965
+ declare function accessTokenCredential(auth: Authentication): string | undefined;
955
966
  interface HttpClient {
956
967
  fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
957
968
  close(): Promise<void>;
@@ -962,6 +973,26 @@ interface PlatformSupport {
962
973
  resolvePath: (source: PathSource, logger: Logger) => Promise<StreamSource>;
963
974
  }
964
975
  interface Options {
976
+ /**
977
+ * Authentication api key for server side execution.
978
+ * Defaults to process.env['EYEPOP_API_KEY'].
979
+ */
980
+ apiKey?: string | undefined;
981
+ /**
982
+ * Bearer token accepted by the compute API.
983
+ */
984
+ accessToken?: string | undefined;
985
+ /**
986
+ * Temporary authentication token for client side execution.
987
+ */
988
+ session?: Session | undefined;
989
+ /**
990
+ * For development mode, authenticate with your dashboard.eyepop.ai account
991
+ */
992
+ oAuth2?: true | Auth0Options | undefined;
993
+ /**
994
+ * @deprecated Pass apiKey, accessToken, session, or oAuth2 at the top level.
995
+ */
965
996
  auth?: Authentication | undefined;
966
997
  eyepopUrl?: string | undefined;
967
998
  jobQueueLength?: number;
@@ -1467,4 +1498,4 @@ declare namespace EyePop {
1467
1498
  function dataEndpoint(opts?: DataOptions): DataEndpoint;
1468
1499
  }
1469
1500
 
1470
- export { type AbilityAliasEntry, AbstractJob, type AliasResolution, type Annotation, AnnotationInclusionMode, AnnotationType, type ApiKeyAuth, type Area, AreaType, ArtifactType, type Asset, type AssetImport, AssetInclusionMode, AssetStatus, AssetUrlType, type AssetUuidSource, type Auth0Options, type Authentication, type AutoAnnotate, type AutoAnnotateParams, type AutoAnnotatePrompt, AutoAnnotateStatus, AutoAnnotateTask, type AutoPromptConfig, type AutoTask, type BaseArea, type BaseComponent, type BaseTask, type Box, type ChangeEvent, ChangeType, type ClassificationTask, type ComponentFinderComponent, type ComponentParams, type Contour, type ContourArea, type ContourFinderComponent, ContourType, type CreateWorkflow, type CreateWorkflowConfig, DEFAULT_PREDICTION_VERSION, DataApiType, DataEndpoint, type DataOptions, type DataSession, type Dataset, type DatasetAutoAnnotate, type DatasetAutoAnnotateCreate, type DatasetAutoAnnotateUpdate, type DatasetCreate, type DatasetHeroAssetUpdate, type DatasetParent, type DatasetUpdate, type DatasetVersion, type DatasetVersionAssetStats, type DownloadResponse, Endpoint, EndpointState, type EvaluateConfig, type EvaluateFilter, type EvaluateRequest, type EvaluateResponse, type EvaluateRunInfo, EvaluationStatus, ExportedBy, EyePop, EyepopLineDecoder, type FileSource, type ForwardComponent, ForwardOperatorType, type HttpClient, type InferRequest, type InferRunInfo, type InferRuntimeConfig, type InferenceComponent, InferenceType, type ListWorkFlowItem, type ListWorkFlowItemMetadata, type ListWorkflowItemMetadataLabels, LoadFromAssetUuidJob, LoadFromGroupJob, LoadFromJob, LoadMediaStreamJob, type LocalAuth, type Mask, type MediaStreamSource, type Model, type ModelCreate, type ModelExport, ModelExportStatus, ModelFormat, type ModelMetrics, ModelPrecisionType, type ModelSample, ModelStatus, ModelTask, type ModelTrainingProgress, ModelTrainingStage, ModelType, type ModelUpdate, type MotionDetectConfig, MotionModel, type MultipartContent, type MultipartPart, type OAuth2Auth, type OnChangeEvent, type Options, type PathSource, type PlatformSupport, type Point2d, type Point3d, type Pop, type PopComponent, PopComponentType, type PopCrop, type PopForward, type PopForwardOperator, type PredictedClass, type PredictedEmbedding, type PredictedKeyPoint, type PredictedKeyPoints, type PredictedMesh, type PredictedMotion, type PredictedObject, type PredictedText, type Prediction, PredictionVersion, type ProcessParams, type ProcessRequest, type QcAiHubExportParams, type RectangleArea, type ResultStream, type Roi, Semaphore, type Session, type SessionAuth, type Source, Stream, type StreamEvent, type StreamSource, type StreamTime, TaskMode, TaskType, type TimeSpan, type TrackingComponent, TranscodeMode, type TransformInto, TransientPopId, UploadGroupJob, UploadJob, type UploadSource, type UrlSource, UserReview, VideoMode, type VlmAbility, type VlmAbilityCreate, type VlmAbilityGroup, type VlmAbilityGroupCreate, type VlmAbilityGroupUpdate, VlmAbilityStatus, type VlmAbilityUpdate, WebrtcBase, WebrtcWhep, WebrtcWhip, WorkerEndpoint, type WorkerOptions, type WorkerSession, type Workflow, WorkflowPhase, EyePop as default, encodeMultipartFormData, getBaseUrl, randomMultipartBoundary, readableStreamFromString };
1501
+ export { type AbilityAliasEntry, AbstractJob, type AccessTokenAuth, type AliasResolution, type Annotation, AnnotationInclusionMode, AnnotationType, type ApiKeyAuth, type Area, AreaType, ArtifactType, type Asset, type AssetImport, AssetInclusionMode, AssetStatus, AssetUrlType, type AssetUuidSource, type Auth0Options, type Authentication, type AutoAnnotate, type AutoAnnotateParams, type AutoAnnotatePrompt, AutoAnnotateStatus, AutoAnnotateTask, type AutoPromptConfig, type AutoTask, type BaseArea, type BaseComponent, type BaseTask, type Box, type ChangeEvent, ChangeType, type ClassificationTask, type ComponentFinderComponent, type ComponentParams, type Contour, type ContourArea, type ContourFinderComponent, ContourType, type CreateWorkflow, type CreateWorkflowConfig, DEFAULT_PREDICTION_VERSION, DataApiType, DataEndpoint, type DataOptions, type DataSession, type Dataset, type DatasetAutoAnnotate, type DatasetAutoAnnotateCreate, type DatasetAutoAnnotateUpdate, type DatasetCreate, type DatasetHeroAssetUpdate, type DatasetParent, type DatasetUpdate, type DatasetVersion, type DatasetVersionAssetStats, type DownloadResponse, Endpoint, EndpointState, type EvaluateConfig, type EvaluateFilter, type EvaluateRequest, type EvaluateResponse, type EvaluateRunInfo, EvaluationStatus, ExportedBy, EyePop, EyepopLineDecoder, type FileSource, type ForwardComponent, ForwardOperatorType, type HttpClient, type InferRequest, type InferRunInfo, type InferRuntimeConfig, type InferenceComponent, InferenceType, type ListWorkFlowItem, type ListWorkFlowItemMetadata, type ListWorkflowItemMetadataLabels, LoadFromAssetUuidJob, LoadFromGroupJob, LoadFromJob, LoadMediaStreamJob, type LocalAuth, type Mask, type MediaStreamSource, type Model, type ModelCreate, type ModelExport, ModelExportStatus, ModelFormat, type ModelMetrics, ModelPrecisionType, type ModelSample, ModelStatus, ModelTask, type ModelTrainingProgress, ModelTrainingStage, ModelType, type ModelUpdate, type MotionDetectConfig, MotionModel, type MultipartContent, type MultipartPart, type OAuth2Auth, type OnChangeEvent, type Options, type PathSource, type PlatformSupport, type Point2d, type Point3d, type Pop, type PopComponent, PopComponentType, type PopCrop, type PopForward, type PopForwardOperator, type PredictedClass, type PredictedEmbedding, type PredictedKeyPoint, type PredictedKeyPoints, type PredictedMesh, type PredictedMotion, type PredictedObject, type PredictedText, type Prediction, PredictionVersion, type ProcessParams, type ProcessRequest, type QcAiHubExportParams, type RectangleArea, type ResultStream, type Roi, Semaphore, type Session, type SessionAuth, type Source, Stream, type StreamEvent, type StreamSource, type StreamTime, TaskMode, TaskType, type TimeSpan, type TrackingComponent, TranscodeMode, type TransformInto, TransientPopId, UploadGroupJob, UploadJob, type UploadSource, type UrlSource, UserReview, VideoMode, type VlmAbility, type VlmAbilityCreate, type VlmAbilityGroup, type VlmAbilityGroupCreate, type VlmAbilityGroupUpdate, VlmAbilityStatus, type VlmAbilityUpdate, WebrtcBase, WebrtcWhep, WebrtcWhip, WorkerEndpoint, type WorkerOptions, type WorkerSession, type Workflow, WorkflowPhase, accessTokenCredential, apiKeyCredential, EyePop as default, encodeMultipartFormData, getBaseUrl, randomMultipartBoundary, readableStreamFromString, resolveAuth };
@@ -8709,14 +8709,51 @@ __export(index_exports, {
8709
8709
  WebrtcWhip: () => WebrtcWhip,
8710
8710
  WorkerEndpoint: () => WorkerEndpoint,
8711
8711
  WorkflowPhase: () => WorkflowPhase,
8712
+ accessTokenCredential: () => accessTokenCredential,
8713
+ apiKeyCredential: () => apiKeyCredential,
8712
8714
  default: () => index_default,
8713
8715
  encodeMultipartFormData: () => encodeMultipartFormData,
8714
8716
  getBaseUrl: () => getBaseUrl,
8715
8717
  randomMultipartBoundary: () => randomMultipartBoundary,
8716
- readableStreamFromString: () => readableStreamFromString
8718
+ readableStreamFromString: () => readableStreamFromString,
8719
+ resolveAuth: () => resolveAuth
8717
8720
  });
8718
8721
  module.exports = __toCommonJS(index_exports);
8719
8722
 
8723
+ // options.ts
8724
+ function nonEmptyCredential(value) {
8725
+ return value && value.length > 0 ? value : void 0;
8726
+ }
8727
+ function resolveAuth(options) {
8728
+ const apiKey = nonEmptyCredential(options.apiKey);
8729
+ if (apiKey !== void 0) {
8730
+ return { apiKey };
8731
+ }
8732
+ const accessToken = nonEmptyCredential(options.accessToken);
8733
+ if (accessToken !== void 0) {
8734
+ return { accessToken };
8735
+ }
8736
+ if (options.session !== void 0) {
8737
+ return { session: options.session };
8738
+ }
8739
+ if (options.oAuth2 !== void 0) {
8740
+ return { oAuth2: options.oAuth2 };
8741
+ }
8742
+ return options.auth;
8743
+ }
8744
+ function apiKeyCredential(auth) {
8745
+ if (auth === void 0) {
8746
+ return void 0;
8747
+ }
8748
+ return nonEmptyCredential(auth.apiKey);
8749
+ }
8750
+ function accessTokenCredential(auth) {
8751
+ if (auth === void 0) {
8752
+ return void 0;
8753
+ }
8754
+ return nonEmptyCredential(auth.accessToken);
8755
+ }
8756
+
8720
8757
  // compute/compute_session.ts
8721
8758
  var SESSION_DEAD = /* @__PURE__ */ new Set(["error" /* ERROR */, "failed" /* FAILED */, "stopped" /* STOPPED */, "pipeline_error" /* PIPELINE_ERROR */, "unknown" /* UNKNOWN */]);
8722
8759
  var CHECK_FOR_IS_READY_INTERVAL = 250;
@@ -10555,17 +10592,19 @@ var Endpoint = class {
10555
10592
  if (!this._options.eyepopUrl) {
10556
10593
  return Promise.reject("option eyepopUrl or environment variable EYEPOP_URL is required");
10557
10594
  }
10558
- if (this._options.auth === void 0) {
10595
+ const auth = resolveAuth(this._options);
10596
+ if (auth === void 0) {
10559
10597
  return Promise.reject("cannot connect without defined auth option");
10560
10598
  }
10561
- if (this._options.auth.session !== void 0) {
10562
- this._token = this._options.auth.session.accessToken;
10563
- this._expire_token_time = this._options.auth.session.validUntil / 1e3;
10564
- } else if (this._options.auth.oAuth2 !== void 0) {
10565
- } else if (this._options.auth.apiKey !== void 0) {
10566
- } else if (this._options.auth.isLocal !== void 0) {
10599
+ if (auth.session !== void 0) {
10600
+ this._token = auth.session.accessToken;
10601
+ this._expire_token_time = auth.session.validUntil / 1e3;
10602
+ } else if (auth.oAuth2 !== void 0) {
10603
+ } else if (accessTokenCredential(auth) !== void 0) {
10604
+ } else if (apiKeyCredential(auth) !== void 0) {
10605
+ } else if (auth.isLocal !== void 0) {
10567
10606
  } else {
10568
- return Promise.reject("option apiKey or environment variable EYEPOP_API_KEY is required");
10607
+ return Promise.reject("option apiKey/accessToken or environment variable EYEPOP_API_KEY is required");
10569
10608
  }
10570
10609
  if (this._options.platformSupport?.createHttpClient !== void 0) {
10571
10610
  this._client = await this._options.platformSupport.createHttpClient(this._requestLogger);
@@ -10639,7 +10678,7 @@ var Endpoint = class {
10639
10678
  throw new Error("reconnect() not implemented");
10640
10679
  }
10641
10680
  async authorizationHeader() {
10642
- if (this._options.auth.isLocal !== void 0) {
10681
+ if (resolveAuth(this._options)?.isLocal !== void 0) {
10643
10682
  return `Implicit`;
10644
10683
  }
10645
10684
  return `Bearer ${await this.currentAccessToken()}`;
@@ -10649,19 +10688,27 @@ var Endpoint = class {
10649
10688
  if (!this._token || this._expire_token_time < now) {
10650
10689
  this.updateState("Authenticating" /* Authenticating */);
10651
10690
  try {
10691
+ const auth = resolveAuth(this._options);
10652
10692
  if (!this._client) {
10653
10693
  return Promise.reject("endpoint not connected");
10654
- } else if (this._options.auth.isLocal !== void 0) {
10694
+ } else if (auth?.isLocal !== void 0) {
10655
10695
  this._token = "implicit";
10656
10696
  this._expire_token_time = Number.MAX_VALUE;
10657
- } else if (this._options.auth.session !== void 0) {
10697
+ } else if (auth?.session !== void 0) {
10658
10698
  return Promise.reject("temporary access token expired");
10659
- } else if (this._options.auth.oAuth2 !== void 0 && this._options.eyepopUrl) {
10660
- const session = await authenticateBrowserSession(this._options.auth.oAuth2, this._options);
10699
+ } else if (auth?.oAuth2 !== void 0 && this._options.eyepopUrl) {
10700
+ const session = await authenticateBrowserSession(auth.oAuth2, this._options);
10661
10701
  this._token = session.accessToken;
10662
10702
  this._expire_token_time = session.validUntil / 1e3;
10663
- } else if (this._options.auth.apiKey !== void 0 && this._options.eyepopUrl) {
10664
- const headers = { "Authorization": `Bearer ${this._options.auth.apiKey}` };
10703
+ } else if (accessTokenCredential(auth) !== void 0) {
10704
+ this._token = accessTokenCredential(auth);
10705
+ this._expire_token_time = Number.MAX_VALUE;
10706
+ } else if (this._options.eyepopUrl) {
10707
+ const credential = apiKeyCredential(auth);
10708
+ if (credential === void 0) {
10709
+ return Promise.reject("no valid auth option");
10710
+ }
10711
+ const headers = { Authorization: `Bearer ${credential}` };
10665
10712
  const post_url = `${this.eyepopUrl()}/v1/auth/authenticate`;
10666
10713
  const response = await this._client.fetch(post_url, {
10667
10714
  method: "POST",
@@ -10806,7 +10853,7 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
10806
10853
  }
10807
10854
  }
10808
10855
  _authenticationHeaders(session) {
10809
- return this._options.auth.isLocal !== void 0 ? {} : { Authorization: `Bearer ${session.accessToken}` };
10856
+ return resolveAuth(this._options)?.isLocal !== void 0 ? {} : { Authorization: `Bearer ${session.accessToken}` };
10810
10857
  }
10811
10858
  /**
10812
10859
  * @deprecated Pop ids are only retained for backwards compatibility.
@@ -10877,13 +10924,7 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
10877
10924
  return { stream: streamSource.stream, mimeType: streamSource.mimeType };
10878
10925
  })
10879
10926
  );
10880
- const job = new UploadGroupJob(
10881
- sources,
10882
- params,
10883
- async () => this.session(),
10884
- this._client,
10885
- this._requestLogger
10886
- );
10927
+ const job = new UploadGroupJob(sources, params, async () => this.session(), this._client, this._requestLogger);
10887
10928
  return job.start(
10888
10929
  () => {
10889
10930
  this.jobDone(job);
@@ -10914,13 +10955,7 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
10914
10955
  stream,
10915
10956
  mimeType: mimeTypes?.[i] ?? null
10916
10957
  }));
10917
- const job = new UploadGroupJob(
10918
- sources,
10919
- params,
10920
- async () => this.session(),
10921
- this._client,
10922
- this._requestLogger
10923
- );
10958
+ const job = new UploadGroupJob(sources, params, async () => this.session(), this._client, this._requestLogger);
10924
10959
  return job.start(
10925
10960
  () => {
10926
10961
  this.jobDone(job);
@@ -10944,13 +10979,7 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
10944
10979
  await this._limit.acquire();
10945
10980
  try {
10946
10981
  this.updateState();
10947
- const job = new LoadFromGroupJob(
10948
- urls,
10949
- params,
10950
- async () => this.session(),
10951
- this._client,
10952
- this._requestLogger
10953
- );
10982
+ const job = new LoadFromGroupJob(urls, params, async () => this.session(), this._client, this._requestLogger);
10954
10983
  return job.start(
10955
10984
  () => {
10956
10985
  this.jobDone(job);
@@ -11453,11 +11482,13 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
11453
11482
  return super.authorizationHeader();
11454
11483
  }
11455
11484
  async computeAuthorizationHeader() {
11456
- if (this.options().auth.isLocal !== void 0) {
11485
+ const auth = resolveAuth(this.options());
11486
+ if (auth?.isLocal !== void 0) {
11457
11487
  return "Implicit";
11458
11488
  }
11459
- if (this.options().auth.apiKey !== void 0) {
11460
- return `Bearer ${this.options().auth.apiKey}`;
11489
+ const credential = apiKeyCredential(auth) ?? accessTokenCredential(auth);
11490
+ if (credential !== void 0) {
11491
+ return `Bearer ${credential}`;
11461
11492
  }
11462
11493
  return super.authorizationHeader();
11463
11494
  }
@@ -11908,8 +11939,8 @@ var DataEndpoint = class extends Endpoint {
11908
11939
  this._accountId = options.accountId || null;
11909
11940
  this._account_event_handlers = [];
11910
11941
  this._dataset_uuid_to_event_handlers = /* @__PURE__ */ new Map();
11911
- const sessionAuth = options.auth;
11912
- if (sessionAuth.session !== void 0) {
11942
+ const sessionAuth = resolveAuth(options);
11943
+ if (sessionAuth?.session !== void 0) {
11913
11944
  const dataSession = sessionAuth.session;
11914
11945
  if (dataSession.accountId) {
11915
11946
  this._accountId = dataSession.accountId;
@@ -12837,11 +12868,11 @@ var EyePop;
12837
12868
  opts.eyepopUrl = "http://127.0.0.1:8080";
12838
12869
  }
12839
12870
  _fill_default_options(opts);
12840
- if (opts.auth === void 0) {
12871
+ if (resolveAuth(opts) === void 0) {
12841
12872
  if (opts.isLocalMode) {
12842
12873
  opts.auth = { isLocal: true };
12843
12874
  } else {
12844
- throw new Error("auth option or EYEPOP_API_KEY environment variable is required");
12875
+ throw new Error("apiKey/accessToken/session/oAuth2 option or EYEPOP_API_KEY environment variable is required");
12845
12876
  }
12846
12877
  }
12847
12878
  if (opts.sessionUuid === void 0) {
@@ -12865,11 +12896,12 @@ var EyePop;
12865
12896
  if (opts.stopJobs === void 0) {
12866
12897
  opts.stopJobs = true;
12867
12898
  }
12868
- if (opts.auth !== void 0) {
12869
- if (opts.auth.session !== void 0) {
12870
- if (opts.auth.session !== void 0) {
12871
- if (opts.auth.session.popId) {
12872
- opts.popId = opts.auth.session.popId;
12899
+ const auth = resolveAuth(opts);
12900
+ if (auth !== void 0) {
12901
+ if (auth.session !== void 0) {
12902
+ if (auth.session !== void 0) {
12903
+ if (auth.session.popId) {
12904
+ opts.popId = auth.session.popId;
12873
12905
  }
12874
12906
  }
12875
12907
  }
@@ -12879,16 +12911,17 @@ var EyePop;
12879
12911
  EyePop2.workerEndpoint = workerEndpoint;
12880
12912
  function dataEndpoint(opts = {}) {
12881
12913
  _fill_default_options(opts);
12882
- if (opts.auth === void 0) {
12883
- throw new Error("auth option or EYEPOP_API_KEY environment variable is required");
12914
+ const auth = resolveAuth(opts);
12915
+ if (auth === void 0) {
12916
+ throw new Error("apiKey/accessToken/session/oAuth2 option or EYEPOP_API_KEY environment variable is required");
12884
12917
  }
12885
12918
  if (opts.accountId === void 0) {
12886
12919
  opts.accountId = readEnv("EYEPOP_ACCOUNT_ID");
12887
12920
  }
12888
- if (opts.auth.session !== void 0) {
12889
- if (opts.auth.session !== void 0) {
12890
- if (opts.auth.session.accountId) {
12891
- opts.accountId = opts.auth.session.accountId;
12921
+ if (auth.session !== void 0) {
12922
+ if (auth.session !== void 0) {
12923
+ if (auth.session.accountId) {
12924
+ opts.accountId = auth.session.accountId;
12892
12925
  }
12893
12926
  }
12894
12927
  }
@@ -12896,11 +12929,12 @@ var EyePop;
12896
12929
  }
12897
12930
  EyePop2.dataEndpoint = dataEndpoint;
12898
12931
  function _fill_default_options(opts) {
12899
- if (!opts.auth) {
12900
- opts.auth = defaultAuth;
12932
+ if (resolveAuth(opts) === void 0 && defaultAuth) {
12933
+ opts.apiKey = defaultAuth.apiKey;
12901
12934
  }
12902
- if (!opts.eyepopUrl && opts.auth && opts.auth.session && opts.auth.session.eyepopUrl) {
12903
- opts.eyepopUrl = opts.auth.session.eyepopUrl;
12935
+ const auth = resolveAuth(opts);
12936
+ if (!opts.eyepopUrl && auth && auth.session && auth.session.eyepopUrl) {
12937
+ opts.eyepopUrl = auth.session.eyepopUrl;
12904
12938
  }
12905
12939
  if (!opts.eyepopUrl) {
12906
12940
  opts.eyepopUrl = readEnv("EYEPOP_URL");
@@ -12908,27 +12942,28 @@ var EyePop;
12908
12942
  if (!opts.eyepopUrl) {
12909
12943
  opts.eyepopUrl = "https://compute.eyepop.ai";
12910
12944
  }
12911
- if (opts.auth) {
12912
- if (opts.auth.oAuth2 !== void 0) {
12913
- if (typeof opts.auth.oAuth2 === "boolean") {
12914
- if (opts.eyepopUrl && opts.eyepopUrl.match(/https:(.*).staging.eyepop.xyz/i)) {
12915
- opts.auth = {
12916
- oAuth2: {
12917
- domain: "dev-eyepop.us.auth0.com",
12918
- clientId: "jktx3YO2UnbkNPvr05PQWf26t1kNTJyg",
12919
- audience: "https://dev-app.eyepop.ai",
12920
- scope: "admin:clouds access:inference-api access:datasets"
12921
- }
12922
- };
12945
+ if (auth) {
12946
+ if (auth.oAuth2 !== void 0) {
12947
+ if (typeof auth.oAuth2 === "boolean") {
12948
+ const oAuth2 = opts.eyepopUrl && opts.eyepopUrl.match(/https:(.*).staging.eyepop.xyz/i) ? {
12949
+ oAuth2: {
12950
+ domain: "dev-eyepop.us.auth0.com",
12951
+ clientId: "jktx3YO2UnbkNPvr05PQWf26t1kNTJyg",
12952
+ audience: "https://dev-app.eyepop.ai",
12953
+ scope: "admin:clouds access:inference-api access:datasets"
12954
+ }
12955
+ } : {
12956
+ oAuth2: {
12957
+ domain: "eyepop.us.auth0.com",
12958
+ clientId: "Lb9ubA9Hf3jlaqWLUx8XgA0zvotgViCl",
12959
+ audience: "https://api.eyepop.ai",
12960
+ scope: "admin:clouds access:inference-api access:datasets"
12961
+ }
12962
+ };
12963
+ if (opts.oAuth2 !== void 0) {
12964
+ opts.oAuth2 = oAuth2.oAuth2;
12923
12965
  } else {
12924
- opts.auth = {
12925
- oAuth2: {
12926
- domain: "eyepop.us.auth0.com",
12927
- clientId: "Lb9ubA9Hf3jlaqWLUx8XgA0zvotgViCl",
12928
- audience: "https://api.eyepop.ai",
12929
- scope: "admin:clouds access:inference-api access:datasets"
12930
- }
12931
- };
12966
+ opts.auth = oAuth2;
12932
12967
  }
12933
12968
  }
12934
12969
  }
@@ -12994,10 +13029,13 @@ var index_default = EyePop;
12994
13029
  WebrtcWhip,
12995
13030
  WorkerEndpoint,
12996
13031
  WorkflowPhase,
13032
+ accessTokenCredential,
13033
+ apiKeyCredential,
12997
13034
  encodeMultipartFormData,
12998
13035
  getBaseUrl,
12999
13036
  randomMultipartBoundary,
13000
- readableStreamFromString
13037
+ readableStreamFromString,
13038
+ resolveAuth
13001
13039
  });
13002
13040
  /*! Bundled license information:
13003
13041