@retab/node 1.0.80 → 1.0.81

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.
@@ -0,0 +1,29 @@
1
+ import { CompositionClient, RequestOptions } from "../../../client.js";
2
+ import { EditRequest, EditResponse } from "../../../types.js";
3
+ export default class APIEditAgent extends CompositionClient {
4
+ constructor(client: CompositionClient);
5
+ /**
6
+ * Edit a document by detecting and filling form fields with provided instructions.
7
+ *
8
+ * This method performs:
9
+ * 1. Detection to identify form field bounding boxes
10
+ * 2. LLM inference to name and describe detected fields
11
+ * 3. LLM-based form filling using the provided instructions
12
+ * 4. Returns the filled document with form field values populated
13
+ *
14
+ * Supported document formats:
15
+ * - PDF: Native form field detection and filling
16
+ * - DOCX/DOC: Native editing to preserve styles and formatting
17
+ * - PPTX/PPT: Native editing for presentations
18
+ * - XLSX/XLS: Native editing for spreadsheets
19
+ *
20
+ * @param params - EditRequest containing:
21
+ * - instructions: Natural language instructions for filling (required)
22
+ * - document: MIMEData object with filename and base64 data URI (required)
23
+ * - model: LLM model for inference (default: "retab-small")
24
+ * @param options - Optional request options
25
+ * @returns EditResponse containing form_data (filled fields) and filled_document (MIMEData)
26
+ */
27
+ fill(params: EditRequest, options?: RequestOptions): Promise<EditResponse>;
28
+ }
29
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/api/edit/agent/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EACH,WAAW,EACX,YAAY,EAGf,MAAM,mBAAmB,CAAC;AAE3B,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,iBAAiB;gBAC3C,MAAM,EAAE,iBAAiB;IAIrC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;CASnF"}
@@ -0,0 +1,38 @@
1
+ import { CompositionClient } from "../../../client.js";
2
+ import { ZEditRequest, ZEditResponse, } from "../../../types.js";
3
+ export default class APIEditAgent extends CompositionClient {
4
+ constructor(client) {
5
+ super(client);
6
+ }
7
+ /**
8
+ * Edit a document by detecting and filling form fields with provided instructions.
9
+ *
10
+ * This method performs:
11
+ * 1. Detection to identify form field bounding boxes
12
+ * 2. LLM inference to name and describe detected fields
13
+ * 3. LLM-based form filling using the provided instructions
14
+ * 4. Returns the filled document with form field values populated
15
+ *
16
+ * Supported document formats:
17
+ * - PDF: Native form field detection and filling
18
+ * - DOCX/DOC: Native editing to preserve styles and formatting
19
+ * - PPTX/PPT: Native editing for presentations
20
+ * - XLSX/XLS: Native editing for spreadsheets
21
+ *
22
+ * @param params - EditRequest containing:
23
+ * - instructions: Natural language instructions for filling (required)
24
+ * - document: MIMEData object with filename and base64 data URI (required)
25
+ * - model: LLM model for inference (default: "retab-small")
26
+ * @param options - Optional request options
27
+ * @returns EditResponse containing form_data (filled fields) and filled_document (MIMEData)
28
+ */
29
+ async fill(params, options) {
30
+ return this._fetchJson(ZEditResponse, {
31
+ url: "/v1/edit/agent/fill",
32
+ method: "POST",
33
+ body: { ...(await ZEditRequest.parseAsync(params)), ...(options?.body || {}) },
34
+ params: options?.params,
35
+ headers: options?.headers,
36
+ });
37
+ }
38
+ }
@@ -1,34 +1,16 @@
1
- import { CompositionClient, RequestOptions } from "../../client.js";
2
- import { EditRequest, EditResponse } from "../../types.js";
1
+ import { CompositionClient } from "../../client.js";
3
2
  import APIEditTemplates from "./templates/client.js";
3
+ import APIEditAgent from "./agent/client.js";
4
+ /**
5
+ * Edit API client for document editing functionality.
6
+ *
7
+ * Sub-clients:
8
+ * - agent: Agent-based document editing (fill any document with AI)
9
+ * - templates: Template-based PDF form filling (for batch processing)
10
+ */
4
11
  export default class APIEdit extends CompositionClient {
12
+ agent: APIEditAgent;
5
13
  templates: APIEditTemplates;
6
14
  constructor(client: CompositionClient);
7
- /**
8
- * Edit a document by detecting and filling form fields with provided instructions.
9
- *
10
- * This method performs:
11
- * 1. Detection to identify form field bounding boxes
12
- * 2. LLM inference to name and describe detected fields
13
- * 3. LLM-based form filling using the provided instructions
14
- * 4. Returns the filled document with form field values populated
15
- *
16
- * Either `document` OR `template_id` must be provided, but not both.
17
- *
18
- * Supported document formats:
19
- * - PDF: Native form field detection and filling
20
- * - DOCX/DOC: Native editing to preserve styles and formatting
21
- * - PPTX/PPT: Native editing for presentations
22
- * - XLSX/XLS: Native editing for spreadsheets
23
- *
24
- * @param params - EditRequest containing:
25
- * - instructions: Natural language instructions for filling (required)
26
- * - document: MIMEData object, file path, Buffer, or Readable stream (optional, mutually exclusive with template_id)
27
- * - model: LLM model for inference (default: "retab-small")
28
- * - template_id: Template ID to use for filling with pre-defined form fields (optional, mutually exclusive with document)
29
- * @param options - Optional request options
30
- * @returns EditResponse containing form_data (filled fields) and filled_document (MIMEData)
31
- */
32
- fill_document(params: EditRequest, options?: RequestOptions): Promise<EditResponse>;
33
15
  }
34
16
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/api/edit/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EACH,WAAW,EACX,YAAY,EAGf,MAAM,gBAAgB,CAAC;AACxB,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AAErD,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,iBAAiB;IAC3C,SAAS,EAAE,gBAAgB,CAAC;gBAEvB,MAAM,EAAE,iBAAiB;IAKrC;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACG,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;CAS5F"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/api/edit/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AACrD,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,iBAAiB;IAC3C,KAAK,EAAE,YAAY,CAAC;IACpB,SAAS,EAAE,gBAAgB,CAAC;gBAEvB,MAAM,EAAE,iBAAiB;CAKxC"}
@@ -1,43 +1,17 @@
1
1
  import { CompositionClient } from "../../client.js";
2
- import { ZEditRequest, ZEditResponse, } from "../../types.js";
3
2
  import APIEditTemplates from "./templates/client.js";
3
+ import APIEditAgent from "./agent/client.js";
4
+ /**
5
+ * Edit API client for document editing functionality.
6
+ *
7
+ * Sub-clients:
8
+ * - agent: Agent-based document editing (fill any document with AI)
9
+ * - templates: Template-based PDF form filling (for batch processing)
10
+ */
4
11
  export default class APIEdit extends CompositionClient {
5
12
  constructor(client) {
6
13
  super(client);
14
+ this.agent = new APIEditAgent(this);
7
15
  this.templates = new APIEditTemplates(this);
8
16
  }
9
- /**
10
- * Edit a document by detecting and filling form fields with provided instructions.
11
- *
12
- * This method performs:
13
- * 1. Detection to identify form field bounding boxes
14
- * 2. LLM inference to name and describe detected fields
15
- * 3. LLM-based form filling using the provided instructions
16
- * 4. Returns the filled document with form field values populated
17
- *
18
- * Either `document` OR `template_id` must be provided, but not both.
19
- *
20
- * Supported document formats:
21
- * - PDF: Native form field detection and filling
22
- * - DOCX/DOC: Native editing to preserve styles and formatting
23
- * - PPTX/PPT: Native editing for presentations
24
- * - XLSX/XLS: Native editing for spreadsheets
25
- *
26
- * @param params - EditRequest containing:
27
- * - instructions: Natural language instructions for filling (required)
28
- * - document: MIMEData object, file path, Buffer, or Readable stream (optional, mutually exclusive with template_id)
29
- * - model: LLM model for inference (default: "retab-small")
30
- * - template_id: Template ID to use for filling with pre-defined form fields (optional, mutually exclusive with document)
31
- * @param options - Optional request options
32
- * @returns EditResponse containing form_data (filled fields) and filled_document (MIMEData)
33
- */
34
- async fill_document(params, options) {
35
- return this._fetchJson(ZEditResponse, {
36
- url: "/v1/edit/fill-document",
37
- method: "POST",
38
- body: { ...(await ZEditRequest.parseAsync(params)), ...(options?.body || {}) },
39
- params: options?.params,
40
- headers: options?.headers,
41
- });
42
- }
43
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@retab/node",
3
- "version": "1.0.80",
3
+ "version": "1.0.81",
4
4
  "description": "Retab official Node.js library",
5
5
  "main": "dist/index.js",
6
6
  "exports": {