@eyepop.ai/eyepop 0.22.0 → 1.0.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.
@@ -8656,19 +8656,33 @@ var require_mime_types = __commonJS({
8656
8656
  // index.ts
8657
8657
  var eyepop_exports = {};
8658
8658
  __export(eyepop_exports, {
8659
+ AbstractJob: () => AbstractJob,
8659
8660
  AnnotationType: () => AnnotationType,
8660
8661
  AssetStatus: () => AssetStatus,
8661
8662
  ChangeType: () => ChangeType,
8663
+ ContourType: () => ContourType,
8662
8664
  DataEndpoint: () => DataEndpoint,
8665
+ Endpoint: () => Endpoint,
8663
8666
  EndpointState: () => EndpointState,
8664
8667
  EyePop: () => EyePop,
8668
+ ForwardOperatorType: () => ForwardOperatorType,
8669
+ InferenceType: () => InferenceType,
8670
+ LoadFromJob: () => LoadFromJob,
8671
+ LoadLiveIngressJob: () => LoadLiveIngressJob,
8665
8672
  ModelFormat: () => ModelFormat,
8666
8673
  ModelPrecisionType: () => ModelPrecisionType,
8667
8674
  ModelStatus: () => ModelStatus,
8668
8675
  ModelType: () => ModelType,
8676
+ PopComponentType: () => PopComponentType,
8677
+ Semaphore: () => Semaphore,
8678
+ Stream: () => Stream,
8669
8679
  TranscodeMode: () => TranscodeMode,
8670
8680
  TransientPopId: () => TransientPopId,
8681
+ UploadJob: () => UploadJob,
8671
8682
  UserReview: () => UserReview,
8683
+ WebrtcBase: () => WebrtcBase,
8684
+ WebrtcWhep: () => WebrtcWhep,
8685
+ WebrtcWhip: () => WebrtcWhip,
8672
8686
  WorkerEndpoint: () => WorkerEndpoint,
8673
8687
  default: () => eyepop_default
8674
8688
  });
@@ -10098,79 +10112,41 @@ var WorkerEndpoint = class extends Endpoint {
10098
10112
  popName() {
10099
10113
  return this._popName;
10100
10114
  }
10101
- popComp() {
10115
+ pop() {
10102
10116
  if (this._pipeline) {
10103
- return this._pipeline.inferPipeline;
10117
+ return this._pipeline.pop || null;
10104
10118
  } else {
10105
10119
  return null;
10106
10120
  }
10107
10121
  }
10108
- postTransform() {
10109
- if (this._pipeline) {
10110
- return this._pipeline.postTransform;
10111
- } else {
10112
- return null;
10113
- }
10114
- }
10115
- async changePopComp(popComp) {
10116
- const client = this._client;
10117
- const baseUrl = this._baseUrl;
10118
- if (!baseUrl || !client) {
10119
- return Promise.reject("endpoint not connected, use connect() before changePopComp()");
10120
- }
10121
- const body = {
10122
- "pipeline": popComp
10123
- };
10124
- let response = await this.fetchWithRetry(async () => {
10125
- const session = await this.session();
10126
- let headers = {
10127
- "Authorization": `Bearer ${session.accessToken}`,
10128
- "Content-Type": "application/json"
10129
- };
10130
- const patch_url = `${session.baseUrl}/pipelines/${session.pipelineId}/inferencePipeline`;
10131
- return client.fetch(patch_url, {
10132
- method: "PATCH",
10133
- body: JSON.stringify(body),
10134
- headers
10135
- });
10136
- });
10137
- if (response.status != 204) {
10138
- const message = await response.text();
10139
- return Promise.reject(`Unexpected status ${response.status}: ${message}`);
10140
- }
10141
- if (this._pipeline) {
10142
- this._pipeline.inferPipeline = popComp;
10143
- }
10144
- }
10145
- async changePostTransform(postTransform) {
10122
+ async changePop(pop) {
10146
10123
  const client = this._client;
10147
10124
  const baseUrl = this._baseUrl;
10148
10125
  if (!baseUrl || !client) {
10149
10126
  return Promise.reject("endpoint not connected, use connect() before changePopComp()");
10150
10127
  }
10151
- postTransform = postTransform ? postTransform : null;
10152
- const body = {
10153
- "transform": postTransform
10154
- };
10155
10128
  let response = await this.fetchWithRetry(async () => {
10156
10129
  const session = await this.session();
10157
10130
  let headers = {
10158
10131
  "Authorization": `Bearer ${session.accessToken}`,
10159
10132
  "Content-Type": "application/json"
10160
10133
  };
10161
- const patch_url = `${session.baseUrl}/pipelines/${session.pipelineId}/postTransform`;
10134
+ const patch_url = `${session.baseUrl}/pipelines/${session.pipelineId}/pop`;
10135
+ this._requestLogger.debug("before PATCH %s - %s", patch_url, JSON.stringify(pop));
10162
10136
  return client.fetch(patch_url, {
10163
10137
  method: "PATCH",
10164
- body: JSON.stringify(body),
10138
+ body: JSON.stringify(pop),
10165
10139
  headers
10166
10140
  });
10167
10141
  });
10168
10142
  if (response.status != 204) {
10169
10143
  const message = await response.text();
10144
+ console.error(message);
10170
10145
  return Promise.reject(`Unexpected status ${response.status}: ${message}`);
10171
10146
  }
10147
+ this._requestLogger.debug("after PATCH pop");
10172
10148
  if (this._pipeline) {
10173
- this._pipeline.postTransform = postTransform;
10149
+ this._pipeline.pop = pop;
10174
10150
  }
10175
10151
  }
10176
10152
  popId() {
@@ -10435,7 +10411,7 @@ var WorkerEndpoint = class extends Endpoint {
10435
10411
  }
10436
10412
  }
10437
10413
  if (this.options().popId == "transient" /* Transient */) {
10438
- this._pipelineId = await this.startPopLessPipeline();
10414
+ this._pipelineId = await this.startTransientPipeline();
10439
10415
  this._popName = this.options().popId || null;
10440
10416
  } else {
10441
10417
  this._pipelineId = config.pipeline_id;
@@ -10483,32 +10459,23 @@ var WorkerEndpoint = class extends Endpoint {
10483
10459
  this.updateState();
10484
10460
  return Promise.resolve(this);
10485
10461
  }
10486
- async startPopLessPipeline() {
10462
+ async startTransientPipeline() {
10487
10463
  const client = this._client;
10488
10464
  const baseUrl = this._baseUrl;
10489
10465
  const sandboxId = this._sandboxId;
10490
10466
  if (client == null || baseUrl == null) {
10491
10467
  return Promise.reject("endpoint not initialized");
10492
10468
  }
10493
- let pipeline;
10494
- if (this._pipeline) {
10495
- pipeline = this._pipeline.inferPipeline;
10496
- } else {
10497
- pipeline = "identity";
10498
- }
10499
- let postTransform;
10500
- if (this._pipeline && this._pipeline.postTransform) {
10501
- postTransform = this._pipeline.postTransform;
10469
+ let pop;
10470
+ if (this._pipeline && this._pipeline.pop) {
10471
+ pop = this._pipeline.pop;
10502
10472
  } else {
10503
- postTransform = null;
10473
+ pop = {
10474
+ components: []
10475
+ };
10504
10476
  }
10505
10477
  const body = {
10506
- "inferPipelineDef": {
10507
- "pipeline": pipeline
10508
- },
10509
- "postTransformDef": {
10510
- "transform": postTransform
10511
- },
10478
+ "pop": pop,
10512
10479
  "source": {
10513
10480
  "sourceType": "NONE"
10514
10481
  },
@@ -11248,6 +11215,41 @@ var ModelPrecisionType = /* @__PURE__ */ ((ModelPrecisionType2) => {
11248
11215
  ModelPrecisionType2["uint8"] = "uint8";
11249
11216
  return ModelPrecisionType2;
11250
11217
  })(ModelPrecisionType || {});
11218
+ var PopComponentType = /* @__PURE__ */ ((PopComponentType2) => {
11219
+ PopComponentType2["FORWARD"] = "forward";
11220
+ PopComponentType2["INFERENCE"] = "inference";
11221
+ PopComponentType2["TRACING"] = "tracing";
11222
+ PopComponentType2["CONTOUR_FINDER"] = "contour_finder";
11223
+ PopComponentType2["COMPONENT_FINDER"] = "component_finder";
11224
+ return PopComponentType2;
11225
+ })(PopComponentType || {});
11226
+ var ForwardOperatorType = /* @__PURE__ */ ((ForwardOperatorType2) => {
11227
+ ForwardOperatorType2["FULL"] = "full";
11228
+ ForwardOperatorType2["CROP"] = "crop";
11229
+ ForwardOperatorType2["CROP_WITH_FULL_FALLBACK"] = "crop_with_full_fallback";
11230
+ return ForwardOperatorType2;
11231
+ })(ForwardOperatorType || {});
11232
+ var InferenceType = /* @__PURE__ */ ((InferenceType2) => {
11233
+ InferenceType2["IMAGE_CLASSIFICATION"] = "image_classification";
11234
+ InferenceType2["OBJECT_DETECTION"] = "object_detection";
11235
+ InferenceType2["KEY_POINTS"] = "key_points";
11236
+ InferenceType2["OCR"] = "ocr";
11237
+ InferenceType2["MESH"] = "mesh";
11238
+ InferenceType2["FEATURE_VECTOR"] = "feature_vector";
11239
+ InferenceType2["SEMANTIC_SEGMENTATION"] = "semantic_segmentation";
11240
+ InferenceType2["SEGMENTATION"] = "segmentation";
11241
+ return InferenceType2;
11242
+ })(InferenceType || {});
11243
+ var ContourType = /* @__PURE__ */ ((ContourType2) => {
11244
+ ContourType2["ALL_PIXELS"] = "all_pixels";
11245
+ ContourType2["POLYGON"] = "polygon";
11246
+ ContourType2["CONVEX_HULL"] = "convex_hull";
11247
+ ContourType2["HOUGH_CIRCLES"] = "hough_circles";
11248
+ ContourType2["CIRCLE"] = "circle";
11249
+ ContourType2["TRIANGLE"] = "triangle";
11250
+ ContourType2["RECTANGLE"] = "rectangle";
11251
+ return ContourType2;
11252
+ })(ContourType || {});
11251
11253
 
11252
11254
  // index.ts
11253
11255
  var readEnv = (env) => {
@@ -11345,19 +11347,33 @@ var EyePop;
11345
11347
  var eyepop_default = EyePop;
11346
11348
  // Annotate the CommonJS export names for ESM import in node:
11347
11349
  0 && (module.exports = {
11350
+ AbstractJob,
11348
11351
  AnnotationType,
11349
11352
  AssetStatus,
11350
11353
  ChangeType,
11354
+ ContourType,
11351
11355
  DataEndpoint,
11356
+ Endpoint,
11352
11357
  EndpointState,
11353
11358
  EyePop,
11359
+ ForwardOperatorType,
11360
+ InferenceType,
11361
+ LoadFromJob,
11362
+ LoadLiveIngressJob,
11354
11363
  ModelFormat,
11355
11364
  ModelPrecisionType,
11356
11365
  ModelStatus,
11357
11366
  ModelType,
11367
+ PopComponentType,
11368
+ Semaphore,
11369
+ Stream,
11358
11370
  TranscodeMode,
11359
11371
  TransientPopId,
11372
+ UploadJob,
11360
11373
  UserReview,
11374
+ WebrtcBase,
11375
+ WebrtcWhep,
11376
+ WebrtcWhip,
11361
11377
  WorkerEndpoint
11362
11378
  });
11363
11379
  /*! Bundled license information: