@retab/node 1.0.64 → 1.0.67

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/dist/types.d.ts CHANGED
@@ -1,9 +1,7 @@
1
1
  import { Readable } from "stream";
2
- import * as generated from "./generated_types";
3
2
  import { ZFieldItem, ZRefObject, ZRowList } from "./generated_types";
4
3
  export * from "./generated_types";
5
4
  import * as z from "zod";
6
- export * from "./schema_types";
7
5
  export declare function dataArray<Schema extends z.ZodType<any, any, any>>(schema: Schema): z.ZodType<z.output<Schema>[], z.ZodTypeDef, {
8
6
  data: z.input<Schema>[];
9
7
  }>;
@@ -29,29 +27,16 @@ export declare const ZMIMEData: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodType<
29
27
  }, {
30
28
  filename: string;
31
29
  url: string;
32
- }>>]>, any, string | {
30
+ }>>]>, any, string | Buffer<ArrayBufferLike> | Readable | {
33
31
  filename: string;
34
32
  url: string;
35
- } | Readable | Buffer<ArrayBufferLike>>;
33
+ }>;
36
34
  export type MIMEDataInput = z.input<typeof ZMIMEData>;
37
35
  export declare const ZJSONSchema: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodType<z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodTypeDef, z.ZodType<unknown, z.ZodTypeDef, unknown>>]>, Record<string, any>, string | Record<string, any> | z.ZodType<unknown, z.ZodTypeDef, unknown>>;
38
36
  export type JSONSchemaInput = z.input<typeof ZJSONSchema>;
39
37
  export type JSONSchema = z.output<(typeof ZJSONSchema)>;
40
- export declare const ZDocumentExtractRequest: z.ZodEffects<z.ZodObject<{
41
- document: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodType<Buffer<ArrayBufferLike>, z.ZodTypeDef, Buffer<ArrayBufferLike>>, z.ZodType<Readable, z.ZodTypeDef, Readable>, z.ZodLazy<z.ZodObject<{
42
- filename: z.ZodString;
43
- url: z.ZodString;
44
- }, "strip", z.ZodTypeAny, {
45
- filename: string;
46
- url: string;
47
- }, {
48
- filename: string;
49
- url: string;
50
- }>>]>, any, string | {
51
- filename: string;
52
- url: string;
53
- } | Readable | Buffer<ArrayBufferLike>>>;
54
- documents: z.ZodDefault<z.ZodArray<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodType<Buffer<ArrayBufferLike>, z.ZodTypeDef, Buffer<ArrayBufferLike>>, z.ZodType<Readable, z.ZodTypeDef, Readable>, z.ZodLazy<z.ZodObject<{
38
+ export declare const ZDocumentExtractRequest: z.ZodObject<{
39
+ document: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodType<Buffer<ArrayBufferLike>, z.ZodTypeDef, Buffer<ArrayBufferLike>>, z.ZodType<Readable, z.ZodTypeDef, Readable>, z.ZodLazy<z.ZodObject<{
55
40
  filename: z.ZodString;
56
41
  url: z.ZodString;
57
42
  }, "strip", z.ZodTypeAny, {
@@ -60,67 +45,53 @@ export declare const ZDocumentExtractRequest: z.ZodEffects<z.ZodObject<{
60
45
  }, {
61
46
  filename: string;
62
47
  url: string;
63
- }>>]>, any, string | {
48
+ }>>]>, any, string | Buffer<ArrayBufferLike> | Readable | {
64
49
  filename: string;
65
50
  url: string;
66
- } | Readable | Buffer<ArrayBufferLike>>, "many">>;
51
+ }>;
67
52
  json_schema: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodType<z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodTypeDef, z.ZodType<unknown, z.ZodTypeDef, unknown>>]>, Record<string, any>, string | Record<string, any> | z.ZodType<unknown, z.ZodTypeDef, unknown>>;
53
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
68
54
  image_resolution_dpi: z.ZodDefault<z.ZodNumber>;
69
55
  model: z.ZodString;
70
56
  temperature: z.ZodDefault<z.ZodNumber>;
71
- reasoning_effort: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodLiteral<"minimal">, z.ZodLiteral<"low">, z.ZodLiteral<"medium">, z.ZodLiteral<"high">]>>>>;
57
+ reasoning_effort: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodLiteral<"none">, z.ZodLiteral<"minimal">, z.ZodLiteral<"low">, z.ZodLiteral<"medium">, z.ZodLiteral<"high">]>>>>;
72
58
  n_consensus: z.ZodDefault<z.ZodNumber>;
73
59
  seed: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
74
60
  store: z.ZodDefault<z.ZodBoolean>;
75
- need_validation: z.ZodDefault<z.ZodBoolean>;
61
+ modality: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"text">, z.ZodLiteral<"image">, z.ZodLiteral<"native">]>>;
62
+ parallel_ocr_keys: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
63
+ extraction_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
76
64
  }, "strip", z.ZodTypeAny, {
65
+ metadata: Record<string, string>;
77
66
  json_schema: Record<string, any>;
78
67
  model: string;
79
68
  temperature: number;
80
- reasoning_effort: "low" | "high" | "minimal" | "medium" | null;
69
+ reasoning_effort: "low" | "high" | "none" | "minimal" | "medium" | null;
81
70
  image_resolution_dpi: number;
82
71
  n_consensus: number;
83
- documents: any[];
72
+ modality: "text" | "image" | "native";
84
73
  store: boolean;
85
- need_validation: boolean;
74
+ parallel_ocr_keys?: Record<string, string> | null | undefined;
75
+ extraction_id?: string | null | undefined;
86
76
  document?: any;
87
77
  seed?: number | null | undefined;
88
78
  }, {
89
79
  json_schema: string | Record<string, any> | z.ZodType<unknown, z.ZodTypeDef, unknown>;
90
80
  model: string;
91
- temperature?: number | undefined;
92
- reasoning_effort?: "low" | "high" | "minimal" | "medium" | null | undefined;
93
- image_resolution_dpi?: number | undefined;
94
- n_consensus?: number | undefined;
95
- documents?: (string | {
96
- filename: string;
97
- url: string;
98
- } | Readable | Buffer<ArrayBufferLike>)[] | undefined;
99
- document?: string | {
81
+ document: string | Buffer<ArrayBufferLike> | Readable | {
100
82
  filename: string;
101
83
  url: string;
102
- } | Readable | Buffer<ArrayBufferLike> | undefined;
103
- seed?: number | null | undefined;
104
- store?: boolean | undefined;
105
- need_validation?: boolean | undefined;
106
- }>, any, {
107
- json_schema: string | Record<string, any> | z.ZodType<unknown, z.ZodTypeDef, unknown>;
108
- model: string;
84
+ };
85
+ metadata?: Record<string, string> | undefined;
109
86
  temperature?: number | undefined;
110
- reasoning_effort?: "low" | "high" | "minimal" | "medium" | null | undefined;
87
+ reasoning_effort?: "low" | "high" | "none" | "minimal" | "medium" | null | undefined;
111
88
  image_resolution_dpi?: number | undefined;
112
89
  n_consensus?: number | undefined;
113
- documents?: (string | {
114
- filename: string;
115
- url: string;
116
- } | Readable | Buffer<ArrayBufferLike>)[] | undefined;
117
- document?: string | {
118
- filename: string;
119
- url: string;
120
- } | Readable | Buffer<ArrayBufferLike> | undefined;
90
+ modality?: "text" | "image" | "native" | undefined;
91
+ parallel_ocr_keys?: Record<string, string> | null | undefined;
92
+ extraction_id?: string | null | undefined;
121
93
  seed?: number | null | undefined;
122
94
  store?: boolean | undefined;
123
- need_validation?: boolean | undefined;
124
95
  }>;
125
96
  export type DocumentExtractRequest = z.input<typeof ZDocumentExtractRequest>;
126
97
  export declare const ZParseRequest: z.ZodObject<{
@@ -133,28 +104,25 @@ export declare const ZParseRequest: z.ZodObject<{
133
104
  }, {
134
105
  filename: string;
135
106
  url: string;
136
- }>>]>, any, string | {
107
+ }>>]>, any, string | Buffer<ArrayBufferLike> | Readable | {
137
108
  filename: string;
138
109
  url: string;
139
- } | Readable | Buffer<ArrayBufferLike>>;
110
+ }>;
140
111
  model: z.ZodDefault<z.ZodString>;
141
112
  table_parsing_format: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"markdown">, z.ZodLiteral<"yaml">, z.ZodLiteral<"html">, z.ZodLiteral<"json">]>>;
142
113
  image_resolution_dpi: z.ZodDefault<z.ZodNumber>;
143
- browser_canvas: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"A3">, z.ZodLiteral<"A4">, z.ZodLiteral<"A5">]>>;
144
114
  }, "strip", z.ZodTypeAny, {
145
115
  model: string;
146
116
  image_resolution_dpi: number;
147
- browser_canvas: "A3" | "A4" | "A5";
148
117
  table_parsing_format: "markdown" | "yaml" | "html" | "json";
149
118
  document?: any;
150
119
  }, {
151
- document: string | {
120
+ document: string | Buffer<ArrayBufferLike> | Readable | {
152
121
  filename: string;
153
122
  url: string;
154
- } | Readable | Buffer<ArrayBufferLike>;
123
+ };
155
124
  model?: string | undefined;
156
125
  image_resolution_dpi?: number | undefined;
157
- browser_canvas?: "A3" | "A4" | "A5" | undefined;
158
126
  table_parsing_format?: "markdown" | "yaml" | "html" | "json" | undefined;
159
127
  }>;
160
128
  export type ParseRequest = z.input<typeof ZParseRequest>;
@@ -168,26 +136,23 @@ export declare const ZDocumentCreateMessageRequest: z.ZodObject<{
168
136
  }, {
169
137
  filename: string;
170
138
  url: string;
171
- }>>]>, any, string | {
139
+ }>>]>, any, string | Buffer<ArrayBufferLike> | Readable | {
172
140
  filename: string;
173
141
  url: string;
174
- } | Readable | Buffer<ArrayBufferLike>>;
142
+ }>;
175
143
  image_resolution_dpi: z.ZodDefault<z.ZodNumber>;
176
- browser_canvas: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"A3">, z.ZodLiteral<"A4">, z.ZodLiteral<"A5">]>>;
177
144
  model: z.ZodDefault<z.ZodString>;
178
145
  }, "strip", z.ZodTypeAny, {
179
146
  model: string;
180
147
  image_resolution_dpi: number;
181
- browser_canvas: "A3" | "A4" | "A5";
182
148
  document?: any;
183
149
  }, {
184
- document: string | {
150
+ document: string | Buffer<ArrayBufferLike> | Readable | {
185
151
  filename: string;
186
152
  url: string;
187
- } | Readable | Buffer<ArrayBufferLike>;
153
+ };
188
154
  model?: string | undefined;
189
155
  image_resolution_dpi?: number | undefined;
190
- browser_canvas?: "A3" | "A4" | "A5" | undefined;
191
156
  }>;
192
157
  export type DocumentCreateMessageRequest = z.input<typeof ZDocumentCreateMessageRequest>;
193
158
  export declare const ZDocumentCreateInputRequest: z.ZodObject<{
@@ -200,29 +165,26 @@ export declare const ZDocumentCreateInputRequest: z.ZodObject<{
200
165
  }, {
201
166
  filename: string;
202
167
  url: string;
203
- }>>]>, any, string | {
168
+ }>>]>, any, string | Buffer<ArrayBufferLike> | Readable | {
204
169
  filename: string;
205
170
  url: string;
206
- } | Readable | Buffer<ArrayBufferLike>>;
171
+ }>;
207
172
  json_schema: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodType<z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodTypeDef, z.ZodType<unknown, z.ZodTypeDef, unknown>>]>, Record<string, any>, string | Record<string, any> | z.ZodType<unknown, z.ZodTypeDef, unknown>>;
208
173
  image_resolution_dpi: z.ZodDefault<z.ZodNumber>;
209
- browser_canvas: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"A3">, z.ZodLiteral<"A4">, z.ZodLiteral<"A5">]>>;
210
174
  model: z.ZodDefault<z.ZodString>;
211
175
  }, "strip", z.ZodTypeAny, {
212
176
  json_schema: Record<string, any>;
213
177
  model: string;
214
178
  image_resolution_dpi: number;
215
- browser_canvas: "A3" | "A4" | "A5";
216
179
  document?: any;
217
180
  }, {
218
181
  json_schema: string | Record<string, any> | z.ZodType<unknown, z.ZodTypeDef, unknown>;
219
- document: string | {
182
+ document: string | Buffer<ArrayBufferLike> | Readable | {
220
183
  filename: string;
221
184
  url: string;
222
- } | Readable | Buffer<ArrayBufferLike>;
185
+ };
223
186
  model?: string | undefined;
224
187
  image_resolution_dpi?: number | undefined;
225
- browser_canvas?: "A3" | "A4" | "A5" | undefined;
226
188
  }>;
227
189
  export type DocumentCreateInputRequest = z.input<typeof ZDocumentCreateInputRequest>;
228
190
  export declare const ZGenerateSchemaRequest: z.ZodObject<{
@@ -235,76 +197,37 @@ export declare const ZGenerateSchemaRequest: z.ZodObject<{
235
197
  }, {
236
198
  filename: string;
237
199
  url: string;
238
- }>>]>, any, string | {
200
+ }>>]>, any, string | Buffer<ArrayBufferLike> | Readable | {
239
201
  filename: string;
240
202
  url: string;
241
- } | Readable | Buffer<ArrayBufferLike>>, "many">;
203
+ }>, "many">;
242
204
  model: z.ZodDefault<z.ZodString>;
243
205
  temperature: z.ZodDefault<z.ZodNumber>;
244
- reasoning_effort: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodLiteral<"minimal">, z.ZodLiteral<"low">, z.ZodLiteral<"medium">, z.ZodLiteral<"high">]>>>>;
206
+ reasoning_effort: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodLiteral<"none">, z.ZodLiteral<"minimal">, z.ZodLiteral<"low">, z.ZodLiteral<"medium">, z.ZodLiteral<"high">]>>>>;
245
207
  instructions: z.ZodOptional<z.ZodNullable<z.ZodString>>;
246
208
  image_resolution_dpi: z.ZodDefault<z.ZodNumber>;
247
- browser_canvas: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"A3">, z.ZodLiteral<"A4">, z.ZodLiteral<"A5">]>>;
248
209
  stream: z.ZodDefault<z.ZodBoolean>;
249
210
  }, "strip", z.ZodTypeAny, {
250
211
  stream: boolean;
251
212
  model: string;
252
213
  temperature: number;
253
- reasoning_effort: "low" | "high" | "minimal" | "medium" | null;
214
+ reasoning_effort: "low" | "high" | "none" | "minimal" | "medium" | null;
254
215
  image_resolution_dpi: number;
255
- browser_canvas: "A3" | "A4" | "A5";
256
216
  documents: any[];
257
217
  instructions?: string | null | undefined;
258
218
  }, {
259
- documents: (string | {
219
+ documents: (string | Buffer<ArrayBufferLike> | Readable | {
260
220
  filename: string;
261
221
  url: string;
262
- } | Readable | Buffer<ArrayBufferLike>)[];
222
+ })[];
263
223
  stream?: boolean | undefined;
264
224
  model?: string | undefined;
265
225
  temperature?: number | undefined;
266
- reasoning_effort?: "low" | "high" | "minimal" | "medium" | null | undefined;
226
+ reasoning_effort?: "low" | "high" | "none" | "minimal" | "medium" | null | undefined;
267
227
  image_resolution_dpi?: number | undefined;
268
- browser_canvas?: "A3" | "A4" | "A5" | undefined;
269
228
  instructions?: string | null | undefined;
270
229
  }>;
271
230
  export type GenerateSchemaRequest = z.input<typeof ZGenerateSchemaRequest>;
272
- export declare const ZBaseProject: z.ZodObject<{
273
- json_schema: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodType<z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodTypeDef, z.ZodType<unknown, z.ZodTypeDef, unknown>>]>, Record<string, any>, string | Record<string, any> | z.ZodType<unknown, z.ZodTypeDef, unknown>>;
274
- id: z.ZodString;
275
- name: z.ZodDefault<z.ZodString>;
276
- updated_at: z.ZodString;
277
- sheets_integration: z.ZodOptional<z.ZodNullable<z.ZodLazy<z.ZodObject<{
278
- sheet_id: z.ZodString;
279
- spreadsheet_id: z.ZodString;
280
- }, "strip", z.ZodTypeAny, {
281
- sheet_id: string;
282
- spreadsheet_id: string;
283
- }, {
284
- sheet_id: string;
285
- spreadsheet_id: string;
286
- }>>>>;
287
- }, "strip", z.ZodTypeAny, {
288
- id: string;
289
- json_schema: Record<string, any>;
290
- name: string;
291
- updated_at: string;
292
- sheets_integration?: {
293
- sheet_id: string;
294
- spreadsheet_id: string;
295
- } | null | undefined;
296
- }, {
297
- id: string;
298
- json_schema: string | Record<string, any> | z.ZodType<unknown, z.ZodTypeDef, unknown>;
299
- updated_at: string;
300
- name?: string | undefined;
301
- sheets_integration?: {
302
- sheet_id: string;
303
- spreadsheet_id: string;
304
- } | null | undefined;
305
- }>;
306
- export type BaseProjectInput = z.input<typeof ZBaseProject>;
307
- export type BaseProject = z.output<typeof ZBaseProject>;
308
231
  export declare const ZCreateProjectRequest: z.ZodObject<{
309
232
  json_schema: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodType<z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodTypeDef, z.ZodType<unknown, z.ZodTypeDef, unknown>>]>, Record<string, any>, string | Record<string, any> | z.ZodType<unknown, z.ZodTypeDef, unknown>>;
310
233
  name: z.ZodString;
@@ -316,103 +239,6 @@ export declare const ZCreateProjectRequest: z.ZodObject<{
316
239
  name: string;
317
240
  }>;
318
241
  export type CreateProjectRequest = z.input<typeof ZCreateProjectRequest>;
319
- export declare const ZDocumentItem: z.ZodObject<{
320
- mime_data: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodType<Buffer<ArrayBufferLike>, z.ZodTypeDef, Buffer<ArrayBufferLike>>, z.ZodType<Readable, z.ZodTypeDef, Readable>, z.ZodLazy<z.ZodObject<{
321
- filename: z.ZodString;
322
- url: z.ZodString;
323
- }, "strip", z.ZodTypeAny, {
324
- filename: string;
325
- url: string;
326
- }, {
327
- filename: string;
328
- url: string;
329
- }>>]>, any, string | {
330
- filename: string;
331
- url: string;
332
- } | Readable | Buffer<ArrayBufferLike>>;
333
- annotation: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>;
334
- annotation_metadata: z.ZodOptional<z.ZodNullable<z.ZodLazy<z.ZodObject<{
335
- extraction_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
336
- likelihoods: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
337
- field_locations: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
338
- agentic_field_locations: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
339
- consensus_details: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodAny>, "many">>>;
340
- }, "strip", z.ZodTypeAny, {
341
- extraction_id?: string | null | undefined;
342
- likelihoods?: Record<string, any> | null | undefined;
343
- field_locations?: Record<string, any> | null | undefined;
344
- agentic_field_locations?: Record<string, any> | null | undefined;
345
- consensus_details?: Record<string, any>[] | null | undefined;
346
- }, {
347
- extraction_id?: string | null | undefined;
348
- likelihoods?: Record<string, any> | null | undefined;
349
- field_locations?: Record<string, any> | null | undefined;
350
- agentic_field_locations?: Record<string, any> | null | undefined;
351
- consensus_details?: Record<string, any>[] | null | undefined;
352
- }>>>>;
353
- playground_extraction: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>;
354
- playground_extraction_metadata: z.ZodOptional<z.ZodNullable<z.ZodLazy<z.ZodObject<{
355
- extraction_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
356
- likelihoods: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
357
- field_locations: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
358
- agentic_field_locations: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
359
- consensus_details: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodAny>, "many">>>;
360
- }, "strip", z.ZodTypeAny, {
361
- extraction_id?: string | null | undefined;
362
- likelihoods?: Record<string, any> | null | undefined;
363
- field_locations?: Record<string, any> | null | undefined;
364
- agentic_field_locations?: Record<string, any> | null | undefined;
365
- consensus_details?: Record<string, any>[] | null | undefined;
366
- }, {
367
- extraction_id?: string | null | undefined;
368
- likelihoods?: Record<string, any> | null | undefined;
369
- field_locations?: Record<string, any> | null | undefined;
370
- agentic_field_locations?: Record<string, any> | null | undefined;
371
- consensus_details?: Record<string, any>[] | null | undefined;
372
- }>>>>;
373
- }, "strip", z.ZodTypeAny, {
374
- annotation: Record<string, any>;
375
- playground_extraction: Record<string, any>;
376
- mime_data?: any;
377
- annotation_metadata?: {
378
- extraction_id?: string | null | undefined;
379
- likelihoods?: Record<string, any> | null | undefined;
380
- field_locations?: Record<string, any> | null | undefined;
381
- agentic_field_locations?: Record<string, any> | null | undefined;
382
- consensus_details?: Record<string, any>[] | null | undefined;
383
- } | null | undefined;
384
- playground_extraction_metadata?: {
385
- extraction_id?: string | null | undefined;
386
- likelihoods?: Record<string, any> | null | undefined;
387
- field_locations?: Record<string, any> | null | undefined;
388
- agentic_field_locations?: Record<string, any> | null | undefined;
389
- consensus_details?: Record<string, any>[] | null | undefined;
390
- } | null | undefined;
391
- }, {
392
- mime_data: string | {
393
- filename: string;
394
- url: string;
395
- } | Readable | Buffer<ArrayBufferLike>;
396
- annotation?: Record<string, any> | undefined;
397
- annotation_metadata?: {
398
- extraction_id?: string | null | undefined;
399
- likelihoods?: Record<string, any> | null | undefined;
400
- field_locations?: Record<string, any> | null | undefined;
401
- agentic_field_locations?: Record<string, any> | null | undefined;
402
- consensus_details?: Record<string, any>[] | null | undefined;
403
- } | null | undefined;
404
- playground_extraction?: Record<string, any> | undefined;
405
- playground_extraction_metadata?: {
406
- extraction_id?: string | null | undefined;
407
- likelihoods?: Record<string, any> | null | undefined;
408
- field_locations?: Record<string, any> | null | undefined;
409
- agentic_field_locations?: Record<string, any> | null | undefined;
410
- consensus_details?: Record<string, any>[] | null | undefined;
411
- } | null | undefined;
412
- }>;
413
- export type DocumentItemInput = z.input<typeof ZDocumentItem>;
414
- export type DocumentItem = z.output<typeof ZDocumentItem>;
415
- export declare const ZProjectLoose: z.ZodType<generated.Project>;
416
242
  export declare const ZModel: z.ZodLazy<z.ZodObject<{
417
243
  id: z.ZodString;
418
244
  created: z.ZodNumber;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,KAAK,SAAS,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACrE,cAAc,mBAAmB,CAAC;AAClC,OAAO,KAAK,CAAC,MAA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;AACF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE7E,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGxB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEzD,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGxC,CAAC;AACH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEzF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAItC,CAAC;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAErF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGjC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE3E,eAAO,MAAM,qBAAqB;;;;;;;;;EAGhC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAIzE,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;GAKf,CAAC;AACL,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC"}
package/dist/types.js CHANGED
@@ -6,7 +6,7 @@ import * as z from "zod";
6
6
  import { inferFileInfo } from "./mime";
7
7
  import fs from "fs";
8
8
  import { zodToJsonSchema } from 'zod-to-json-schema';
9
- export * from "./schema_types";
9
+ //export * from "./schema_types";
10
10
  export function dataArray(schema) {
11
11
  return z.object({ data: z.array(schema) }).transform((input) => input.data);
12
12
  }
@@ -66,19 +66,14 @@ export const ZJSONSchema = z.union([
66
66
  }
67
67
  });
68
68
  export const ZDocumentExtractRequest = z.object({
69
- // Keep everything except stream; allow both document and documents on input
70
- ...(({ stream, ...rest }) => rest)(generated.ZDocumentExtractRequest.schema.shape),
71
- // Accept a single document and make documents optional with a default
72
- document: ZMIMEData.optional(),
73
- documents: z.array(ZMIMEData).default([]),
69
+ // Keep everything except stream and document from generated types
70
+ ...(({ stream, document, metadata, ...rest }) => rest)(generated.ZDocumentExtractRequest.schema.shape),
71
+ // Accept a single document (required)
72
+ document: ZMIMEData,
74
73
  // Normalize json_schema inputs (paths/zod instances)
75
74
  json_schema: ZJSONSchema,
76
- }).transform((input) => {
77
- const { document, documents, ...rest } = input;
78
- if (document && (!documents || documents.length === 0)) {
79
- return { ...rest, documents: [document] };
80
- }
81
- return { ...rest, documents: documents || [] };
75
+ // Make metadata optional with empty object default
76
+ metadata: z.record(z.string(), z.string()).default({}),
82
77
  });
83
78
  export const ZParseRequest = z.object({
84
79
  ...generated.ZParseRequest.schema.shape,
@@ -97,23 +92,10 @@ export const ZGenerateSchemaRequest = z.object({
97
92
  ...generated.ZGenerateSchemaRequest.schema.shape,
98
93
  documents: ZMIMEData.array(),
99
94
  });
100
- export const ZBaseProject = z.object({
101
- ...generated.ZBaseProject.schema.shape,
102
- json_schema: ZJSONSchema,
103
- });
104
95
  export const ZCreateProjectRequest = z.object({
105
96
  ...generated.ZCreateProjectRequest.schema.shape,
106
97
  json_schema: ZJSONSchema,
107
98
  });
108
- export const ZDocumentItem = z.object({
109
- ...generated.ZDocumentItem.schema.shape,
110
- mime_data: ZMIMEData,
111
- });
112
- // Looser project schema to handle backends that omit arrays by default
113
- export const ZProjectLoose = z.lazy(() => (generated.ZBaseProject.schema).merge(z.object({
114
- documents: z.array(generated.ZProjectDocument).default([]),
115
- iterations: z.array(generated.ZIteration).default([]),
116
- })));
117
99
  export const ZModel = z.lazy(() => (z.object({
118
100
  id: z.string(),
119
101
  created: z.number(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@retab/node",
3
- "version": "1.0.64",
3
+ "version": "1.0.67",
4
4
  "description": "Retab official Node.js library",
5
5
  "main": "dist/index.js",
6
6
  "exports": {