mindee 5.2.0 → 5.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Mindee Node.js API Library Changelog
2
2
 
3
+ ## v5.3.0 - 2026-05-07
4
+ ### Changes
5
+ * :sparkles: Add support for extraction in crop, split, and classify products
6
+
7
+
3
8
  ## v5.2.0 - 2026-04-14
4
9
  ### Changes
5
10
  * :sparkles: add support for crop operation for V2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindee",
3
- "version": "5.2.0",
3
+ "version": "5.3.0",
4
4
  "description": "Mindee Client Library for Node.js",
5
5
  "author": {
6
6
  "name": "Mindee",
@@ -21,6 +21,7 @@ export async function extractCrops(inputSource, crops, quality) {
21
21
  if (crops.length === 0) {
22
22
  throw new MindeeError("No crop indexes provided.");
23
23
  }
24
+ await inputSource.init();
24
25
  logger.debug("Extracting crops: " + crops.join(", "));
25
26
  const polygonsByPage = new Map();
26
27
  for (const crop of crops) {
@@ -23,6 +23,7 @@ export async function extractSplits(inputSource, splits) {
23
23
  if (pageGroups.length === 0) {
24
24
  throw new MindeeError("No valid split indexes provided.");
25
25
  }
26
+ await inputSource.init();
26
27
  logger.debug("Extracting splits: " + splits.join(", "));
27
28
  const pdfExtractor = new PdfExtractor(inputSource);
28
29
  await pdfExtractor.init();
@@ -1,6 +1,14 @@
1
1
  import { StringDict } from "../../../../parsing/stringDict.js";
2
2
  import { BaseField } from "./baseField.js";
3
3
  export declare class SimpleField extends BaseField {
4
+ /**
5
+ * The untyped value of the field.
6
+ *
7
+ * This is usually not what you want, look at the typed accessors instead:
8
+ * - stringValue
9
+ * - numberValue
10
+ * - booleanValue
11
+ */
4
12
  readonly value: string | number | boolean | null;
5
13
  constructor(serverResponse: StringDict, indentLevel?: number);
6
14
  /**
@@ -1,9 +1,17 @@
1
1
  import { StringDict } from "../../../parsing/index.js";
2
+ import { ExtractionResponse } from "../../../v2/product/index.js";
2
3
  /**
3
4
  * Document level classification.
4
5
  */
5
6
  export declare class ClassificationClassifier {
7
+ /**
8
+ * The document type, as identified on given classification values.
9
+ */
6
10
  documentType: string;
11
+ /**
12
+ * The extraction response associated with the classification.
13
+ */
14
+ extractionResponse?: ExtractionResponse;
7
15
  constructor(serverResponse: StringDict);
8
16
  toString(): string;
9
17
  }
@@ -1,9 +1,13 @@
1
+ import { ExtractionResponse } from "../../../v2/product/index.js";
1
2
  /**
2
3
  * Document level classification.
3
4
  */
4
5
  export class ClassificationClassifier {
5
6
  constructor(serverResponse) {
6
7
  this.documentType = serverResponse["document_type"];
8
+ this.extractionResponse = serverResponse["extraction_response"]
9
+ ? new ExtractionResponse(serverResponse["extraction_response"])
10
+ : undefined;
7
11
  }
8
12
  toString() {
9
13
  return `Document Type: ${this.documentType}`;
@@ -2,9 +2,20 @@ import { FieldLocation } from "../../../v2/parsing/inference/field/index.js";
2
2
  import { StringDict } from "../../../parsing/index.js";
3
3
  import { LocalInputSource } from "../../../input/index.js";
4
4
  import { ExtractedImage } from "../../../image/index.js";
5
+ import { ExtractionResponse } from "../../../v2/product/index.js";
5
6
  export declare class CropItem {
7
+ /**
8
+ * Type or classification of the detected object.
9
+ */
6
10
  objectType: string;
11
+ /**
12
+ * Location that includes cropping coordinates for the detected object, within the source document.
13
+ */
7
14
  location: FieldLocation;
15
+ /**
16
+ * The extraction response associated with the crop.
17
+ */
18
+ extractionResponse?: ExtractionResponse;
8
19
  constructor(serverResponse: StringDict);
9
20
  toString(): string;
10
21
  /**
@@ -1,9 +1,13 @@
1
1
  import { FieldLocation } from "../../../v2/parsing/inference/field/index.js";
2
2
  import { extractCrops } from "../../../v2/fileOperations/crop.js";
3
+ import { ExtractionResponse } from "../../../v2/product/index.js";
3
4
  export class CropItem {
4
5
  constructor(serverResponse) {
5
6
  this.objectType = serverResponse["object_type"];
6
7
  this.location = new FieldLocation(serverResponse["location"]);
8
+ this.extractionResponse = serverResponse["extraction_response"]
9
+ ? new ExtractionResponse(serverResponse["extraction_response"])
10
+ : undefined;
7
11
  }
8
12
  toString() {
9
13
  return `* :Location: ${this.location}\n :Object Type: ${this.objectType}`;
@@ -1,5 +1,6 @@
1
1
  import { StringDict } from "../../../parsing/index.js";
2
2
  import { LocalInputSource } from "../../../input/index.js";
3
+ import { ExtractionResponse } from "../../../v2/product/index.js";
3
4
  /**
4
5
  * Split inference result.
5
6
  */
@@ -13,6 +14,10 @@ export declare class SplitRange {
13
14
  * The document type, as identified on given classification values.
14
15
  */
15
16
  documentType: string;
17
+ /**
18
+ * The extraction response associated with the split.
19
+ */
20
+ extractionResponse?: ExtractionResponse;
16
21
  constructor(serverResponse: StringDict);
17
22
  toString(): string;
18
23
  /**
@@ -1,4 +1,5 @@
1
1
  import { expandRange, extractSplits } from "../../../v2/fileOperations/split.js";
2
+ import { ExtractionResponse } from "../../../v2/product/index.js";
2
3
  /**
3
4
  * Split inference result.
4
5
  */
@@ -6,6 +7,9 @@ export class SplitRange {
6
7
  constructor(serverResponse) {
7
8
  this.pageRange = serverResponse["page_range"];
8
9
  this.documentType = serverResponse["document_type"];
10
+ this.extractionResponse = serverResponse["extraction_response"]
11
+ ? new ExtractionResponse(serverResponse["extraction_response"])
12
+ : undefined;
9
13
  }
10
14
  toString() {
11
15
  const pageRange = this.pageRange.join(",");