@d0paminedriven/xlsxdown-wasm32-wasi 0.1.0 → 0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d0paminedriven/xlsxdown-wasm32-wasi",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "cpu": [
5
5
  "wasm32"
6
6
  ],
@@ -1441,6 +1441,11 @@ try {
1441
1441
  }
1442
1442
  export default __napiModule.exports
1443
1443
  export const XlsxDown = __napiModule.exports.XlsxDown
1444
+ export const CurrencySource = __napiModule.exports.CurrencySource
1445
+ export const DateOrder = __napiModule.exports.DateOrder
1446
+ export const EInvoiceStandard = __napiModule.exports.EInvoiceStandard
1447
+ export const InvoiceDocumentType = __napiModule.exports.InvoiceDocumentType
1448
+ export const InvoiceSource = __napiModule.exports.InvoiceSource
1444
1449
  export const NumberSubtype = __napiModule.exports.NumberSubtype
1445
1450
  export const spreadsheetCells = __napiModule.exports.spreadsheetCells
1446
1451
  export const spreadsheetCellsAsync = __napiModule.exports.spreadsheetCellsAsync
@@ -1,4 +1,4 @@
1
- // napi-rs-artifact-metadata:{"version":2,"rootEntry":"index.js","exports":["XlsxDown","NumberSubtype","spreadsheetCells","spreadsheetCellsAsync"],"managedRootEntries":["browser.js","index.js","xlsxdown-node.wasm","xlsxdown-node.debug.wasm"]}
1
+ // napi-rs-artifact-metadata:{"version":2,"rootEntry":"index.js","exports":["XlsxDown","CurrencySource","DateOrder","EInvoiceStandard","InvoiceDocumentType","InvoiceSource","NumberSubtype","spreadsheetCells","spreadsheetCellsAsync"],"managedRootEntries":["browser.js","index.js","xlsxdown-node.wasm","xlsxdown-node.debug.wasm"]}
2
2
  /* eslint-disable */
3
3
  /* auto-generated by NAPI-RS */
4
4
 
@@ -2298,6 +2298,11 @@ try {
2298
2298
  } catch {}
2299
2299
  module.exports = __napiModule.exports
2300
2300
  module.exports.XlsxDown = __napiModule.exports.XlsxDown
2301
+ module.exports.CurrencySource = __napiModule.exports.CurrencySource
2302
+ module.exports.DateOrder = __napiModule.exports.DateOrder
2303
+ module.exports.EInvoiceStandard = __napiModule.exports.EInvoiceStandard
2304
+ module.exports.InvoiceDocumentType = __napiModule.exports.InvoiceDocumentType
2305
+ module.exports.InvoiceSource = __napiModule.exports.InvoiceSource
2301
2306
  module.exports.NumberSubtype = __napiModule.exports.NumberSubtype
2302
2307
  module.exports.spreadsheetCells = __napiModule.exports.spreadsheetCells
2303
2308
  module.exports.spreadsheetCellsAsync = __napiModule.exports.spreadsheetCellsAsync
@@ -22,6 +22,55 @@ export declare class XlsxDown {
22
22
  spreadsheetCells(opts?: SpreadsheetOptions | undefined | null): Array<SheetCells>
23
23
  /** `spreadsheetCells` on a worker thread. */
24
24
  spreadsheetCellsAsync(opts?: SpreadsheetOptions | undefined | null): Promise<Array<SheetCells>>
25
+ /**
26
+ * The cells of the selected sheets keyed by row and then column, so a cell, or a whole row,
27
+ * is one lookup: `rows["12"]["C"]`.
28
+ */
29
+ spreadsheetGrid(opts?: SpreadsheetOptions | undefined | null): Array<SheetGrid>
30
+ /** `spreadsheetGrid` on a worker thread. */
31
+ spreadsheetGridAsync(opts?: SpreadsheetOptions | undefined | null): Promise<Array<SheetGrid>>
32
+ /**
33
+ * The selected sheets laid out as pages: each cell's text placed in its rectangle, broken
34
+ * into words and grouped into lines, every word naming its cell. Cells in hidden rows and
35
+ * columns are left off the page unless `hiddenCells` is set.
36
+ */
37
+ layout(opts?: SpreadsheetOptions | undefined | null): Array<SheetPage>
38
+ /** `layout` on a worker thread. */
39
+ layoutAsync(opts?: SpreadsheetOptions | undefined | null): Promise<Array<SheetPage>>
40
+ /** Invoice fields read from the workbook's visible sheets, each laid out as a page. */
41
+ invoice(opts?: InvoiceOptions | undefined | null): InvoiceResult
42
+ /** `invoice` on a worker thread. */
43
+ invoiceAsync(opts?: InvoiceOptions | undefined | null): Promise<InvoiceResult>
44
+ }
45
+
46
+ /** `value` is `lines` joined with `
47
+ `. */
48
+ export interface AddressField {
49
+ value: string
50
+ text: string
51
+ confidence: number
52
+ span?: FieldSpan
53
+ lines: Array<string>
54
+ }
55
+
56
+ /**
57
+ * An aircraft or engine the invoice relates to. Maintenance, parts and
58
+ * program invoices identify the asset by airframe (model, manufacturer serial
59
+ * number, registration) and/or by engine (model, engine serial number); one
60
+ * invoice can cover several assets, so `InvoiceFields.aircraft` is a list.
61
+ */
62
+ export interface AircraftReference {
63
+ /** Airframe model, e.g. "Challenger 350", "Global 6000", "Phenom 300". */
64
+ model?: StringField
65
+ /** Manufacturer serial number (MSN). */
66
+ serialNumber?: StringField
67
+ /** Registration / tail number, e.g. "N123AB", "C-GXYZ". */
68
+ registration?: StringField
69
+ /** Engine model, e.g. "BR710", "AE 3007", "PW308C". */
70
+ engineModel?: StringField
71
+ /** Engine serial number (ESN). */
72
+ engineSerialNumber?: StringField
73
+ span?: FieldSpan
25
74
  }
26
75
 
27
76
  /** A rectangle in the sheet frame: points, y up, with A1's top-left corner at `(0, height)`. */
@@ -32,12 +81,184 @@ export interface CellBox {
32
81
  y1: number
33
82
  }
34
83
 
84
+ /**
85
+ * Which tier named the currency: evidence on the page (an ISO code or an unambiguous glyph),
86
+ * content priors such as the vendor's country, the caller's option, or nothing.
87
+ */
88
+ export type CurrencySource = 'Page' | 'Content' | 'Option' | 'Unknown'
89
+
90
+ /** `value` is an ISO 8601 calendar date, `YYYY-MM-DD`. */
91
+ export interface DateField {
92
+ value: string
93
+ text: string
94
+ confidence: number
95
+ span?: FieldSpan
96
+ }
97
+
98
+ export type DateOrder = 'Auto' | 'MDY' | 'DMY' | 'YMD'
99
+
100
+ export type EInvoiceStandard = 'FacturX' | 'ZUGFeRD' | 'XRechnung' | 'UBL' | 'Unknown'
101
+
102
+ export interface EmbeddedInvoiceXml {
103
+ filename: string
104
+ standard: EInvoiceStandard
105
+ /**
106
+ * The guideline / customization identifier, e.g.
107
+ * `urn:cen.eu:en16931:2017#compliant#urn:factur-x.eu:1p0:basic`.
108
+ */
109
+ profile?: string
110
+ xml: string
111
+ }
112
+
113
+ /** Where a field was read from, in PDF user space on a 1-based page. */
114
+ export interface FieldSpan {
115
+ page: number
116
+ x0: number
117
+ y0: number
118
+ x1: number
119
+ y1: number
120
+ }
121
+
122
+ export type InvoiceDocumentType = 'Invoice' | 'CreditNote' | 'Unknown'
123
+
124
+ /**
125
+ * Field names mirror the de-facto vocabulary of common invoice extractors so
126
+ * consumers can swap sources with a thin mapper. Naming only: nothing here
127
+ * talks to any service.
128
+ */
129
+ export interface InvoiceFields {
130
+ vendorName?: StringField
131
+ vendorAddress?: AddressField
132
+ vendorTaxId?: StringField
133
+ vendorEmail?: StringField
134
+ vendorPhone?: StringField
135
+ vendorWebsite?: StringField
136
+ customerName?: StringField
137
+ customerId?: StringField
138
+ customerAddress?: AddressField
139
+ customerTaxId?: StringField
140
+ billingAddress?: AddressField
141
+ shippingAddress?: AddressField
142
+ remittanceAddress?: AddressField
143
+ invoiceId?: StringField
144
+ invoiceDate?: DateField
145
+ dueDate?: DateField
146
+ purchaseOrder?: StringField
147
+ paymentTerm?: StringField
148
+ serviceStartDate?: DateField
149
+ serviceEndDate?: DateField
150
+ currencyCode?: string
151
+ subTotal?: MoneyField
152
+ totalDiscount?: MoneyField
153
+ totalTax?: MoneyField
154
+ shippingCost?: MoneyField
155
+ invoiceTotal?: MoneyField
156
+ amountDue?: MoneyField
157
+ previousUnpaidBalance?: MoneyField
158
+ /** MRO work order / shop order the invoice bills against. */
159
+ workOrder?: StringField
160
+ /** Aircraft and engines the invoice relates to; empty when none is identified. */
161
+ aircraft: Array<AircraftReference>
162
+ taxDetails: Array<TaxDetail>
163
+ paymentDetails: Array<PaymentDetail>
164
+ items: Array<InvoiceItem>
165
+ }
166
+
167
+ export interface InvoiceItem {
168
+ description?: StringField
169
+ productCode?: StringField
170
+ quantity?: NumberField
171
+ unit?: StringField
172
+ unitPrice?: MoneyField
173
+ taxRate?: NumberField
174
+ tax?: MoneyField
175
+ discount?: MoneyField
176
+ date?: DateField
177
+ amount?: MoneyField
178
+ /** Absent when the item came from embedded XML (no page geometry). */
179
+ span?: FieldSpan
180
+ }
181
+
182
+ /**
183
+ * Options accepted by every invoice entry point. `preferEmbeddedXml` picks the embedded
184
+ * XML over the pages when both exist; `languages`, `currency`, `dateOrder` and
185
+ * `decimalSeparator` steer the page reader where the page leaves a choice;
186
+ * `includeCandidates` lists, in `warnings`, the candidates each field was chosen from;
187
+ * `includeLayout` is reserved.
188
+ */
189
+ export interface InvoiceOptions {
190
+ /** Label lexicons to enable; default `["en"]`. */
191
+ languages?: Array<string>
192
+ /** ISO 4217 hint when the page shows only symbols. */
193
+ currency?: string
194
+ dateOrder?: DateOrder
195
+ decimalSeparator?: "Auto" | "." | ","
196
+ /** Default `true`. Embedded Factur-X / ZUGFeRD / XRechnung / UBL XML is used when present. */
197
+ preferEmbeddedXml?: boolean
198
+ /** Reserved; accepted and ignored. */
199
+ includeLayout?: boolean
200
+ /**
201
+ * Default `false`. Lists, in `warnings`, the candidates each field was chosen from, with
202
+ * their scores.
203
+ */
204
+ includeCandidates?: boolean
205
+ }
206
+
207
+ export interface InvoiceResult {
208
+ source: InvoiceSource
209
+ documentType: InvoiceDocumentType
210
+ /** Document-level confidence, 0..1. */
211
+ confidence: number
212
+ fields: InvoiceFields
213
+ warnings: Array<string>
214
+ embeddedXml?: EmbeddedInvoiceXml
215
+ /** Which tier named `fields.currencyCode`; absent when no layout pass ran. */
216
+ currencySource?: CurrencySource
217
+ /** The evidence behind `documentType: CreditNote`; empty otherwise. */
218
+ creditSignals: Array<string>
219
+ }
220
+
221
+ /**
222
+ * Which extraction path produced the result: embedded XML, the page text (native, OCR,
223
+ * rendered or mixed), or `None` when the document had no readable
224
+ * pages and no embedded XML.
225
+ */
226
+ export type InvoiceSource = 'EmbeddedXml' | 'Native' | 'Ocr' | 'Rendered' | 'Mixed' | 'None'
227
+
228
+ /**
229
+ * Money as a JS number plus the exact printed text; `text` is authoritative
230
+ * when cents matter.
231
+ */
232
+ export interface MoneyField {
233
+ value: number
234
+ text: string
235
+ confidence: number
236
+ span?: FieldSpan
237
+ currencyCode?: string
238
+ currencySymbol?: string
239
+ }
240
+
241
+ export interface NumberField {
242
+ value: number
243
+ text: string
244
+ confidence: number
245
+ span?: FieldSpan
246
+ }
247
+
35
248
  /**
36
249
  * Whether a Number cell's value is a whole number JavaScript can hold exactly, or a fraction.
37
250
  * A percentage is a fraction (50% is 0.5); the subtype is about the value, not the format.
38
251
  */
39
252
  export type NumberSubtype = 'Integer' | 'Float'
40
253
 
254
+ export interface PaymentDetail {
255
+ iban?: StringField
256
+ swift?: StringField
257
+ bankName?: StringField
258
+ accountNumber?: StringField
259
+ routingNumber?: StringField
260
+ }
261
+
41
262
  /**
42
263
  * One cell of a worksheet: a discriminated union on `type` whose typed value is `value`
43
264
  * (none for `Blank`). A Number carries the full double plus its `subtype` and the
@@ -100,6 +321,69 @@ export interface SheetColumn {
100
321
  hidden: boolean
101
322
  }
102
323
 
324
+ /**
325
+ * One selected worksheet's cells keyed for lookup: `rows["12"]["C"]` is cell C12, and
326
+ * `rows["12"]` is the whole of row 12. Only non-empty cells are present, so a row or a column
327
+ * with nothing in it has no key.
328
+ */
329
+ export interface SheetGrid {
330
+ sheet: string
331
+ /** Position in the workbook, 0-based. */
332
+ index: number
333
+ hidden: boolean
334
+ /** The declared `<dimension>`, which a producer may overstate. */
335
+ dimension?: string
336
+ /** Merged ranges in A1 form. */
337
+ merges: Array<string>
338
+ warnings: Array<string>
339
+ /**
340
+ * Keyed by row number as a reference writes it (`"12"`), then by column letters (`"C"`), each
341
+ * in sheet order.
342
+ */
343
+ rows: Record<string, Record<string, SheetCell>>
344
+ }
345
+
346
+ /**
347
+ * Words sharing a baseline band, left to right. `firstWord` / `wordCount` address a contiguous
348
+ * slice of `SheetPage.words`.
349
+ */
350
+ export interface SheetLine {
351
+ text: string
352
+ x0: number
353
+ y0: number
354
+ x1: number
355
+ y1: number
356
+ firstWord: number
357
+ wordCount: number
358
+ }
359
+
360
+ /**
361
+ * One selected sheet laid out as a page: every cell's text placed inside the cell's rectangle,
362
+ * broken into words and grouped into lines, with the sheet facts a reader needs beside them.
363
+ */
364
+ export interface SheetPage {
365
+ /** 1-based, in selection order. */
366
+ page: number
367
+ sheet: string
368
+ /** Position in the workbook, 0-based. */
369
+ index: number
370
+ hidden: boolean
371
+ /** The declared `<dimension>`, which a producer may overstate. */
372
+ dimension?: string
373
+ printArea?: string
374
+ /** Merged ranges in A1 form. */
375
+ merges: Array<string>
376
+ /**
377
+ * The page's size in points: the print area when the sheet has one, else A1 to the last
378
+ * non-empty cell, with rows grown to fit their text.
379
+ */
380
+ width: number
381
+ height: number
382
+ words: Array<SheetWord>
383
+ lines: Array<SheetLine>
384
+ warnings: Array<string>
385
+ }
386
+
103
387
  /**
104
388
  * A row whose height differs from the sheet default (auto-fit growth included), or that is
105
389
  * hidden. 0-based.
@@ -111,6 +395,30 @@ export interface SheetRow {
111
395
  hidden: boolean
112
396
  }
113
397
 
398
+ /**
399
+ * One word of a sheet's logical page, with its box in the page frame: points, y up, the page's
400
+ * bottom-left corner at the origin.
401
+ */
402
+ export interface SheetWord {
403
+ text: string
404
+ x0: number
405
+ y0: number
406
+ x1: number
407
+ y1: number
408
+ /** Index into `SheetPage.lines`. */
409
+ line: number
410
+ /** The cell's font: its size in points, its name, and whether it is bold or italic. */
411
+ fontSize?: number
412
+ fontName?: string
413
+ bold?: boolean
414
+ italic?: boolean
415
+ /**
416
+ * The reference of the cell this word was laid out from (`"C3"`); the anchor for a merged
417
+ * range.
418
+ */
419
+ cell: string
420
+ }
421
+
114
422
  /**
115
423
  * The cells of a workbook buffer's selected sheets. Parses the buffer for this call; hold an
116
424
  * `XlsxDown` to read the same workbook more than once.
@@ -135,3 +443,18 @@ export interface SpreadsheetOptions {
135
443
  */
136
444
  hiddenCells?: boolean
137
445
  }
446
+
447
+ export interface StringField {
448
+ value: string
449
+ /** The exact source text the value was derived from. */
450
+ text: string
451
+ confidence: number
452
+ span?: FieldSpan
453
+ }
454
+
455
+ export interface TaxDetail {
456
+ rate?: NumberField
457
+ amount?: MoneyField
458
+ base?: MoneyField
459
+ category?: StringField
460
+ }
Binary file