documents.js 1.57.0 → 1.58.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/README.md +38 -0
- package/dist/blr-types-CYYC3yYU.d.cts +35 -0
- package/dist/blr-types-CYYC3yYU.d.ts +35 -0
- package/dist/cell-CNHPsDEk.d.cts +17 -0
- package/dist/cell-CNHPsDEk.d.ts +17 -0
- package/dist/color-71eoF1Up.d.cts +2 -0
- package/dist/color-Bo228AY2.d.ts +2 -0
- package/dist/convert/codec.cjs +51 -0
- package/dist/convert/codec.d.cts +13 -0
- package/dist/convert/codec.d.ts +13 -0
- package/dist/convert/codec.js +42 -0
- package/dist/convert/convert.cjs +443 -0
- package/dist/convert/convert.d.cts +55 -0
- package/dist/convert/convert.d.ts +55 -0
- package/dist/convert/convert.js +419 -0
- package/dist/convert/local.cjs +393 -0
- package/dist/convert/local.d.cts +5 -0
- package/dist/convert/local.d.ts +5 -0
- package/dist/convert/local.js +392 -0
- package/dist/convert/port.cjs +0 -0
- package/dist/convert/port.d.cts +34 -0
- package/dist/convert/port.d.ts +34 -0
- package/dist/convert/port.js +0 -0
- package/dist/edit/docx/content.cjs +71 -0
- package/dist/edit/docx/content.d.cts +6 -0
- package/dist/edit/docx/content.d.ts +6 -0
- package/dist/edit/docx/content.js +70 -0
- package/dist/edit/docx/editor.cjs +116 -0
- package/dist/edit/docx/editor.d.cts +23 -0
- package/dist/edit/docx/editor.d.ts +23 -0
- package/dist/edit/docx/editor.js +113 -0
- package/dist/edit/docx/image.cjs +74 -0
- package/dist/edit/docx/image.d.cts +2 -0
- package/dist/edit/docx/image.d.ts +2 -0
- package/dist/edit/docx/image.js +72 -0
- package/dist/edit/docx/paragraph.cjs +132 -0
- package/dist/edit/docx/paragraph.d.cts +40 -0
- package/dist/edit/docx/paragraph.d.ts +40 -0
- package/dist/edit/docx/paragraph.js +130 -0
- package/dist/edit/docx/props.cjs +132 -0
- package/dist/edit/docx/props.d.cts +20 -0
- package/dist/edit/docx/props.d.ts +20 -0
- package/dist/edit/docx/props.js +117 -0
- package/dist/edit/docx/run.cjs +143 -0
- package/dist/edit/docx/run.d.cts +2 -0
- package/dist/edit/docx/run.d.ts +2 -0
- package/dist/edit/docx/run.js +141 -0
- package/dist/edit/docx/scaffold.cjs +97 -0
- package/dist/edit/docx/scaffold.d.cts +5 -0
- package/dist/edit/docx/scaffold.d.ts +5 -0
- package/dist/edit/docx/scaffold.js +96 -0
- package/dist/edit/docx/table.cjs +99 -0
- package/dist/edit/docx/table.d.cts +34 -0
- package/dist/edit/docx/table.d.ts +34 -0
- package/dist/edit/docx/table.js +95 -0
- package/dist/edit/odg/content.cjs +65 -0
- package/dist/edit/odg/content.d.cts +6 -0
- package/dist/edit/odg/content.d.ts +6 -0
- package/dist/edit/odg/content.js +64 -0
- package/dist/edit/odg/editor.cjs +96 -0
- package/dist/edit/odg/editor.d.cts +19 -0
- package/dist/edit/odg/editor.d.ts +19 -0
- package/dist/edit/odg/editor.js +93 -0
- package/dist/edit/odg/page.cjs +70 -0
- package/dist/edit/odg/page.d.cts +34 -0
- package/dist/edit/odg/page.d.ts +34 -0
- package/dist/edit/odg/page.js +69 -0
- package/dist/edit/odg/scaffold.cjs +106 -0
- package/dist/edit/odg/scaffold.d.cts +7 -0
- package/dist/edit/odg/scaffold.d.ts +7 -0
- package/dist/edit/odg/scaffold.js +103 -0
- package/dist/edit/odg/style.cjs +83 -0
- package/dist/edit/odg/style.d.cts +14 -0
- package/dist/edit/odg/style.d.ts +14 -0
- package/dist/edit/odg/style.js +78 -0
- package/dist/edit/odg/svg-path.cjs +30 -0
- package/dist/edit/odg/svg-path.d.cts +7 -0
- package/dist/edit/odg/svg-path.d.ts +7 -0
- package/dist/edit/odg/svg-path.js +27 -0
- package/dist/edit/odg/vector.cjs +208 -0
- package/dist/edit/odg/vector.d.cts +2 -0
- package/dist/edit/odg/vector.d.ts +2 -0
- package/dist/edit/odg/vector.js +201 -0
- package/dist/edit/odp/content.cjs +42 -0
- package/dist/edit/odp/content.d.cts +6 -0
- package/dist/edit/odp/content.d.ts +6 -0
- package/dist/edit/odp/content.js +41 -0
- package/dist/edit/odp/editor.cjs +113 -0
- package/dist/edit/odp/editor.d.cts +20 -0
- package/dist/edit/odp/editor.d.ts +20 -0
- package/dist/edit/odp/editor.js +110 -0
- package/dist/edit/odp/image.cjs +10 -0
- package/dist/edit/odp/image.d.cts +2 -0
- package/dist/edit/odp/image.d.ts +2 -0
- package/dist/edit/odp/image.js +9 -0
- package/dist/edit/odp/scaffold.cjs +108 -0
- package/dist/edit/odp/scaffold.d.cts +7 -0
- package/dist/edit/odp/scaffold.d.ts +7 -0
- package/dist/edit/odp/scaffold.js +105 -0
- package/dist/edit/odp/shape.cjs +133 -0
- package/dist/edit/odp/shape.d.cts +2 -0
- package/dist/edit/odp/shape.d.ts +2 -0
- package/dist/edit/odp/shape.js +130 -0
- package/dist/edit/odp/slide.cjs +80 -0
- package/dist/edit/odp/slide.d.cts +31 -0
- package/dist/edit/odp/slide.d.ts +31 -0
- package/dist/edit/odp/slide.js +79 -0
- package/dist/edit/ods/address.cjs +108 -0
- package/dist/edit/ods/address.d.cts +15 -0
- package/dist/edit/ods/address.d.ts +15 -0
- package/dist/edit/ods/address.js +97 -0
- package/dist/edit/ods/cell.cjs +177 -0
- package/dist/edit/ods/cell.d.cts +2 -0
- package/dist/edit/ods/cell.d.ts +2 -0
- package/dist/edit/ods/cell.js +176 -0
- package/dist/edit/ods/content.cjs +26 -0
- package/dist/edit/ods/content.d.cts +6 -0
- package/dist/edit/ods/content.d.ts +6 -0
- package/dist/edit/ods/content.js +25 -0
- package/dist/edit/ods/editor.cjs +84 -0
- package/dist/edit/ods/editor.d.cts +17 -0
- package/dist/edit/ods/editor.d.ts +17 -0
- package/dist/edit/ods/editor.js +81 -0
- package/dist/edit/ods/print-settings.cjs +90 -0
- package/dist/edit/ods/print-settings.d.cts +7 -0
- package/dist/edit/ods/print-settings.d.ts +7 -0
- package/dist/edit/ods/print-settings.js +88 -0
- package/dist/edit/ods/scaffold.cjs +129 -0
- package/dist/edit/ods/scaffold.d.cts +9 -0
- package/dist/edit/ods/scaffold.d.ts +9 -0
- package/dist/edit/ods/scaffold.js +124 -0
- package/dist/edit/ods/sheet.cjs +70 -0
- package/dist/edit/ods/sheet.d.cts +22 -0
- package/dist/edit/ods/sheet.d.ts +22 -0
- package/dist/edit/ods/sheet.js +69 -0
- package/dist/edit/odt/automatic-styles.cjs +49 -0
- package/dist/edit/odt/automatic-styles.d.cts +8 -0
- package/dist/edit/odt/automatic-styles.d.ts +8 -0
- package/dist/edit/odt/automatic-styles.js +45 -0
- package/dist/edit/odt/content.cjs +110 -0
- package/dist/edit/odt/content.d.cts +9 -0
- package/dist/edit/odt/content.d.ts +9 -0
- package/dist/edit/odt/content.js +108 -0
- package/dist/edit/odt/editor.cjs +98 -0
- package/dist/edit/odt/editor.d.cts +25 -0
- package/dist/edit/odt/editor.d.ts +25 -0
- package/dist/edit/odt/editor.js +95 -0
- package/dist/edit/odt/list.cjs +82 -0
- package/dist/edit/odt/list.d.cts +2 -0
- package/dist/edit/odt/list.d.ts +2 -0
- package/dist/edit/odt/list.js +79 -0
- package/dist/edit/odt/paragraph.cjs +84 -0
- package/dist/edit/odt/paragraph.d.cts +2 -0
- package/dist/edit/odt/paragraph.d.ts +2 -0
- package/dist/edit/odt/paragraph.js +82 -0
- package/dist/edit/odt/props.cjs +26 -0
- package/dist/edit/odt/props.d.cts +7 -0
- package/dist/edit/odt/props.d.ts +7 -0
- package/dist/edit/odt/props.js +23 -0
- package/dist/edit/odt/run.cjs +82 -0
- package/dist/edit/odt/run.d.cts +2 -0
- package/dist/edit/odt/run.d.ts +2 -0
- package/dist/edit/odt/run.js +80 -0
- package/dist/edit/odt/scaffold.cjs +109 -0
- package/dist/edit/odt/scaffold.d.cts +5 -0
- package/dist/edit/odt/scaffold.d.ts +5 -0
- package/dist/edit/odt/scaffold.js +108 -0
- package/dist/edit/odt/table.cjs +123 -0
- package/dist/edit/odt/table.d.cts +37 -0
- package/dist/edit/odt/table.d.ts +37 -0
- package/dist/edit/odt/table.js +119 -0
- package/dist/edit/pptx/content.cjs +49 -0
- package/dist/edit/pptx/content.d.cts +6 -0
- package/dist/edit/pptx/content.d.ts +6 -0
- package/dist/edit/pptx/content.js +48 -0
- package/dist/edit/pptx/editor.cjs +187 -0
- package/dist/edit/pptx/editor.d.cts +20 -0
- package/dist/edit/pptx/editor.d.ts +20 -0
- package/dist/edit/pptx/editor.js +184 -0
- package/dist/edit/pptx/image.cjs +27 -0
- package/dist/edit/pptx/image.d.cts +2 -0
- package/dist/edit/pptx/image.d.ts +2 -0
- package/dist/edit/pptx/image.js +26 -0
- package/dist/edit/pptx/scaffold.cjs +292 -0
- package/dist/edit/pptx/scaffold.d.cts +13 -0
- package/dist/edit/pptx/scaffold.d.ts +13 -0
- package/dist/edit/pptx/scaffold.js +283 -0
- package/dist/edit/pptx/shape.cjs +182 -0
- package/dist/edit/pptx/shape.d.cts +2 -0
- package/dist/edit/pptx/shape.d.ts +2 -0
- package/dist/edit/pptx/shape.js +179 -0
- package/dist/edit/pptx/slide.cjs +146 -0
- package/dist/edit/pptx/slide.d.cts +33 -0
- package/dist/edit/pptx/slide.d.ts +33 -0
- package/dist/edit/pptx/slide.js +145 -0
- package/dist/firebird/backup.cjs +150 -0
- package/dist/firebird/backup.d.cts +21 -0
- package/dist/firebird/backup.d.ts +21 -0
- package/dist/firebird/backup.js +145 -0
- package/dist/firebird/blr-types.cjs +118 -0
- package/dist/firebird/blr-types.d.cts +2 -0
- package/dist/firebird/blr-types.d.ts +2 -0
- package/dist/firebird/blr-types.js +90 -0
- package/dist/firebird/data.cjs +231 -0
- package/dist/firebird/data.d.cts +17 -0
- package/dist/firebird/data.d.ts +17 -0
- package/dist/firebird/data.js +228 -0
- package/dist/firebird/date.cjs +63 -0
- package/dist/firebird/date.d.cts +17 -0
- package/dist/firebird/date.d.ts +17 -0
- package/dist/firebird/date.js +58 -0
- package/dist/firebird/reader.cjs +157 -0
- package/dist/firebird/reader.d.cts +2 -0
- package/dist/firebird/reader.d.ts +2 -0
- package/dist/firebird/reader.js +154 -0
- package/dist/firebird/schema.cjs +91 -0
- package/dist/firebird/schema.d.cts +2 -0
- package/dist/firebird/schema.d.ts +2 -0
- package/dist/firebird/schema.js +89 -0
- package/dist/geometry-DvwdrIij.d.cts +5 -0
- package/dist/geometry-DvwdrIij.d.ts +5 -0
- package/dist/hsqldb/cache.cjs +88 -0
- package/dist/hsqldb/cache.d.cts +13 -0
- package/dist/hsqldb/cache.d.ts +13 -0
- package/dist/hsqldb/cache.js +84 -0
- package/dist/hsqldb/rowformat.cjs +222 -0
- package/dist/hsqldb/rowformat.d.cts +21 -0
- package/dist/hsqldb/rowformat.d.ts +21 -0
- package/dist/hsqldb/rowformat.js +218 -0
- package/dist/hsqldb/script.cjs +450 -0
- package/dist/hsqldb/script.d.cts +19 -0
- package/dist/hsqldb/script.d.ts +19 -0
- package/dist/hsqldb/script.js +447 -0
- package/dist/image-B-xQWYYS.d.ts +16 -0
- package/dist/image-BZDy72Jb.d.cts +16 -0
- package/dist/image-BfRLAD9B.d.cts +18 -0
- package/dist/image-BfRLAD9B.d.ts +18 -0
- package/dist/image-CeqwL-Qs.d.ts +14 -0
- package/dist/image-DWX6cNOD.d.cts +14 -0
- package/dist/index.cjs +201 -10863
- package/dist/index.d.cts +71 -1406
- package/dist/index.d.ts +71 -1406
- package/dist/index.js +67 -10727
- package/dist/layout/drawing.cjs +117 -0
- package/dist/layout/drawing.d.cts +13 -0
- package/dist/layout/drawing.d.ts +13 -0
- package/dist/layout/drawing.js +116 -0
- package/dist/layout/engine.cjs +216 -0
- package/dist/layout/engine.d.cts +19 -0
- package/dist/layout/engine.d.ts +19 -0
- package/dist/layout/engine.js +215 -0
- package/dist/layout/reconstruct.cjs +809 -0
- package/dist/layout/reconstruct.d.cts +12 -0
- package/dist/layout/reconstruct.d.ts +12 -0
- package/dist/layout/reconstruct.js +805 -0
- package/dist/layout/shared.cjs +104 -0
- package/dist/layout/shared.d.cts +15 -0
- package/dist/layout/shared.d.ts +15 -0
- package/dist/layout/shared.js +96 -0
- package/dist/layout/sheets.cjs +413 -0
- package/dist/layout/sheets.d.cts +14 -0
- package/dist/layout/sheets.d.ts +14 -0
- package/dist/layout/sheets.js +414 -0
- package/dist/layout/slides.cjs +194 -0
- package/dist/layout/slides.d.cts +25 -0
- package/dist/layout/slides.d.ts +25 -0
- package/dist/layout/slides.js +192 -0
- package/dist/list-BuBM9rwQ.d.cts +24 -0
- package/dist/list-CvKxhy3y.d.ts +24 -0
- package/dist/mathml/compose.cjs +53 -0
- package/dist/mathml/compose.d.cts +8 -0
- package/dist/mathml/compose.d.ts +8 -0
- package/dist/mathml/compose.js +49 -0
- package/dist/mathml/layout-types.cjs +0 -0
- package/dist/mathml/layout-types.d.cts +50 -0
- package/dist/mathml/layout-types.d.ts +50 -0
- package/dist/mathml/layout-types.js +0 -0
- package/dist/mathml/layout.cjs +373 -0
- package/dist/mathml/layout.d.cts +24 -0
- package/dist/mathml/layout.d.ts +24 -0
- package/dist/mathml/layout.js +371 -0
- package/dist/mathml/length.cjs +41 -0
- package/dist/mathml/length.d.cts +4 -0
- package/dist/mathml/length.d.ts +4 -0
- package/dist/mathml/length.js +40 -0
- package/dist/mathml/metrics.cjs +0 -0
- package/dist/mathml/metrics.d.cts +44 -0
- package/dist/mathml/metrics.d.ts +44 -0
- package/dist/mathml/metrics.js +0 -0
- package/dist/mathml/nodes.cjs +39 -0
- package/dist/mathml/nodes.d.cts +2 -0
- package/dist/mathml/nodes.d.ts +2 -0
- package/dist/mathml/nodes.js +32 -0
- package/dist/mathml/operators.cjs +189 -0
- package/dist/mathml/operators.d.cts +13 -0
- package/dist/mathml/operators.d.ts +13 -0
- package/dist/mathml/operators.js +188 -0
- package/dist/mathml/radical.cjs +46 -0
- package/dist/mathml/radical.d.cts +10 -0
- package/dist/mathml/radical.d.ts +10 -0
- package/dist/mathml/radical.js +45 -0
- package/dist/mathml/variant.cjs +1160 -0
- package/dist/mathml/variant.d.cts +7 -0
- package/dist/mathml/variant.d.ts +7 -0
- package/dist/mathml/variant.js +1157 -0
- package/dist/model/bytes.cjs +88 -0
- package/dist/model/bytes.d.cts +12 -0
- package/dist/model/bytes.d.ts +12 -0
- package/dist/model/bytes.js +80 -0
- package/dist/model/color.cjs +26 -0
- package/dist/model/color.d.cts +2 -0
- package/dist/model/color.d.ts +2 -0
- package/dist/model/color.js +2 -0
- package/dist/model/content.cjs +34 -0
- package/dist/model/content.d.cts +362 -0
- package/dist/model/content.d.ts +362 -0
- package/dist/model/content.js +32 -0
- package/dist/model/formula.cjs +0 -0
- package/dist/model/formula.d.cts +8 -0
- package/dist/model/formula.d.ts +8 -0
- package/dist/model/formula.js +0 -0
- package/dist/model/geometry.cjs +55 -0
- package/dist/model/geometry.d.cts +2 -0
- package/dist/model/geometry.d.ts +2 -0
- package/dist/model/geometry.js +12 -0
- package/dist/model/style.cjs +20 -0
- package/dist/model/style.d.cts +2 -0
- package/dist/model/style.d.ts +2 -0
- package/dist/model/style.js +2 -0
- package/dist/model/units.cjs +55 -0
- package/dist/model/units.d.cts +20 -0
- package/dist/model/units.d.ts +20 -0
- package/dist/model/units.js +38 -0
- package/dist/nodes-pArN9ilm.d.cts +27 -0
- package/dist/nodes-pArN9ilm.d.ts +27 -0
- package/dist/odb/csv.cjs +48 -0
- package/dist/odb/csv.d.cts +14 -0
- package/dist/odb/csv.d.ts +14 -0
- package/dist/odb/csv.js +45 -0
- package/dist/odb/read.cjs +87 -0
- package/dist/odb/read.d.cts +15 -0
- package/dist/odb/read.d.ts +15 -0
- package/dist/odb/read.js +85 -0
- package/dist/odb/spreadsheet.cjs +68 -0
- package/dist/odb/spreadsheet.d.cts +6 -0
- package/dist/odb/spreadsheet.d.ts +6 -0
- package/dist/odb/spreadsheet.js +67 -0
- package/dist/odf/formula/detect.cjs +29 -0
- package/dist/odf/formula/detect.d.cts +12 -0
- package/dist/odf/formula/detect.d.ts +12 -0
- package/dist/odf/formula/detect.js +28 -0
- package/dist/odf/formula/placeholder.cjs +37 -0
- package/dist/odf/formula/placeholder.d.cts +14 -0
- package/dist/odf/formula/placeholder.d.ts +14 -0
- package/dist/odf/formula/placeholder.js +36 -0
- package/dist/odf/formula/read.cjs +32 -0
- package/dist/odf/formula/read.d.cts +11 -0
- package/dist/odf/formula/read.d.ts +11 -0
- package/dist/odf/formula/read.js +30 -0
- package/dist/odf/odg/read.cjs +15 -0
- package/dist/odf/odg/read.d.cts +6 -0
- package/dist/odf/odg/read.d.ts +6 -0
- package/dist/odf/odg/read.js +14 -0
- package/dist/odf/odp/read.cjs +45 -0
- package/dist/odf/odp/read.d.cts +11 -0
- package/dist/odf/odp/read.d.ts +11 -0
- package/dist/odf/odp/read.js +44 -0
- package/dist/odf/ods/read.cjs +15 -0
- package/dist/odf/ods/read.d.cts +6 -0
- package/dist/odf/ods/read.d.ts +6 -0
- package/dist/odf/ods/read.js +14 -0
- package/dist/odf/odt/read.cjs +43 -0
- package/dist/odf/odt/read.d.cts +11 -0
- package/dist/odf/odt/read.d.ts +11 -0
- package/dist/odf/odt/read.js +42 -0
- package/dist/odf-package/manifest.cjs +62 -0
- package/dist/odf-package/manifest.d.cts +2 -0
- package/dist/odf-package/manifest.d.ts +2 -0
- package/dist/odf-package/manifest.js +2 -0
- package/dist/odf-package/media.cjs +34 -0
- package/dist/odf-package/media.d.cts +8 -0
- package/dist/odf-package/media.d.ts +8 -0
- package/dist/odf-package/media.js +34 -0
- package/dist/ooxml/docx/read.cjs +15 -0
- package/dist/ooxml/docx/read.d.cts +6 -0
- package/dist/ooxml/docx/read.d.ts +6 -0
- package/dist/ooxml/docx/read.js +14 -0
- package/dist/ooxml/pptx/read.cjs +15 -0
- package/dist/ooxml/pptx/read.d.cts +6 -0
- package/dist/ooxml/pptx/read.d.ts +6 -0
- package/dist/ooxml/pptx/read.js +14 -0
- package/dist/opc/content-types.cjs +47 -0
- package/dist/opc/content-types.d.cts +7 -0
- package/dist/opc/content-types.d.ts +7 -0
- package/dist/opc/content-types.js +44 -0
- package/dist/opc/media.cjs +45 -0
- package/dist/opc/media.d.cts +10 -0
- package/dist/opc/media.d.ts +10 -0
- package/dist/opc/media.js +44 -0
- package/dist/opc/paths.cjs +28 -0
- package/dist/opc/paths.d.cts +5 -0
- package/dist/opc/paths.d.ts +5 -0
- package/dist/opc/paths.js +26 -0
- package/dist/opc/rels.cjs +47 -0
- package/dist/opc/rels.d.cts +10 -0
- package/dist/opc/rels.d.ts +10 -0
- package/dist/opc/rels.js +46 -0
- package/dist/paragraph-BXbXKPy3.d.cts +30 -0
- package/dist/paragraph-CoUi_88j.d.ts +30 -0
- package/dist/ports/abort.cjs +7 -0
- package/dist/ports/abort.d.cts +4 -0
- package/dist/ports/abort.d.ts +4 -0
- package/dist/ports/abort.js +6 -0
- package/dist/ports/clock.cjs +9 -0
- package/dist/ports/clock.d.cts +8 -0
- package/dist/ports/clock.d.ts +8 -0
- package/dist/ports/clock.js +7 -0
- package/dist/reader-DP0Mbaj4.d.cts +41 -0
- package/dist/reader-DP0Mbaj4.d.ts +41 -0
- package/dist/run-B3GNScJH.d.cts +38 -0
- package/dist/run-CJfh8rv3.d.ts +38 -0
- package/dist/run-D2rTWHbt.d.ts +38 -0
- package/dist/run-F8JN7Vy4.d.cts +38 -0
- package/dist/schema-Acco3Ezi.d.cts +22 -0
- package/dist/schema-VkAA6pF5.d.ts +22 -0
- package/dist/shape-BUfjw5eZ.d.cts +35 -0
- package/dist/shape-BfN3m52m.d.ts +30 -0
- package/dist/shape-CN2ycxOo.d.cts +30 -0
- package/dist/shape-CTkl6kt8.d.ts +35 -0
- package/dist/style-DkamR3aY.d.cts +2 -0
- package/dist/style-DkamR3aY.d.ts +2 -0
- package/dist/vector-ClohqsOe.d.cts +76 -0
- package/dist/vector-ClohqsOe.d.ts +76 -0
- package/dist/xml/edit.cjs +65 -0
- package/dist/xml/edit.d.cts +12 -0
- package/dist/xml/edit.d.ts +12 -0
- package/dist/xml/edit.js +57 -0
- package/dist/xml/entities.cjs +12 -0
- package/dist/xml/entities.d.cts +5 -0
- package/dist/xml/entities.d.ts +5 -0
- package/dist/xml/entities.js +10 -0
- package/dist/xml/fragment.cjs +22 -0
- package/dist/xml/fragment.d.cts +6 -0
- package/dist/xml/fragment.d.ts +6 -0
- package/dist/xml/fragment.js +20 -0
- package/dist/xml/odf-text.cjs +53 -0
- package/dist/xml/odf-text.d.cts +6 -0
- package/dist/xml/odf-text.d.ts +6 -0
- package/dist/xml/odf-text.js +51 -0
- package/dist/xml/query.cjs +33 -0
- package/dist/xml/query.d.cts +12 -0
- package/dist/xml/query.d.ts +12 -0
- package/dist/xml/query.js +29 -0
- package/package.json +9 -1
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
//#region src/firebird/blr-types.ts
|
|
2
|
+
const BLR_SHORT = 7;
|
|
3
|
+
const BLR_LONG = 8;
|
|
4
|
+
const BLR_QUAD = 9;
|
|
5
|
+
const BLR_FLOAT = 10;
|
|
6
|
+
const BLR_D_FLOAT = 11;
|
|
7
|
+
const BLR_SQL_DATE = 12;
|
|
8
|
+
const BLR_SQL_TIME = 13;
|
|
9
|
+
const BLR_TEXT = 14;
|
|
10
|
+
const BLR_TEXT2 = 15;
|
|
11
|
+
const BLR_INT64 = 16;
|
|
12
|
+
const BLR_BOOL = 23;
|
|
13
|
+
const BLR_DEC64 = 24;
|
|
14
|
+
const BLR_DEC128 = 25;
|
|
15
|
+
const BLR_INT128 = 26;
|
|
16
|
+
const BLR_DOUBLE = 27;
|
|
17
|
+
const BLR_SQL_TIME_TZ = 28;
|
|
18
|
+
const BLR_TIMESTAMP_TZ = 29;
|
|
19
|
+
const BLR_EX_TIME_TZ = 30;
|
|
20
|
+
const BLR_EX_TIMESTAMP_TZ = 31;
|
|
21
|
+
const BLR_TIMESTAMP = 35;
|
|
22
|
+
const BLR_VARYING = 37;
|
|
23
|
+
const BLR_VARYING2 = 38;
|
|
24
|
+
const BLR_CSTRING = 40;
|
|
25
|
+
const BLR_CSTRING2 = 41;
|
|
26
|
+
const BLR_BLOB = 261;
|
|
27
|
+
const BLR_TO_PHYSICAL_TYPE = /* @__PURE__ */ new Map([
|
|
28
|
+
[7, "short"],
|
|
29
|
+
[8, "long"],
|
|
30
|
+
[9, "quad"],
|
|
31
|
+
[10, "real"],
|
|
32
|
+
[11, "double"],
|
|
33
|
+
[12, "sql_date"],
|
|
34
|
+
[13, "sql_time"],
|
|
35
|
+
[14, "text"],
|
|
36
|
+
[15, "text"],
|
|
37
|
+
[16, "int64"],
|
|
38
|
+
[23, "boolean"],
|
|
39
|
+
[24, "dec64"],
|
|
40
|
+
[25, "dec128"],
|
|
41
|
+
[26, "int128"],
|
|
42
|
+
[27, "double"],
|
|
43
|
+
[28, "unsupported-tz"],
|
|
44
|
+
[29, "unsupported-tz"],
|
|
45
|
+
[30, "unsupported-tz"],
|
|
46
|
+
[31, "unsupported-tz"],
|
|
47
|
+
[35, "timestamp"],
|
|
48
|
+
[37, "varying"],
|
|
49
|
+
[38, "varying"],
|
|
50
|
+
[40, "cstring"],
|
|
51
|
+
[41, "cstring"],
|
|
52
|
+
[261, "blob"]
|
|
53
|
+
]);
|
|
54
|
+
var FirebirdUnsupportedFieldTypeError = class extends Error {
|
|
55
|
+
blrType;
|
|
56
|
+
constructor(blrType) {
|
|
57
|
+
super(`Firebird backup: field has BLR type ${blrType}, which is not a recognised column datatype opcode for a Firebird-embedded .odb's own user/system tables`);
|
|
58
|
+
this.name = "FirebirdUnsupportedFieldTypeError";
|
|
59
|
+
this.blrType = blrType;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
function decodeBlrType(blrType) {
|
|
63
|
+
const physical = BLR_TO_PHYSICAL_TYPE.get(blrType);
|
|
64
|
+
if (physical === void 0) throw new FirebirdUnsupportedFieldTypeError(blrType);
|
|
65
|
+
return physical;
|
|
66
|
+
}
|
|
67
|
+
function describeFieldType(physical, lengthBytes, scale, characterLength) {
|
|
68
|
+
switch (physical) {
|
|
69
|
+
case "short": return scale === 0 ? "SMALLINT" : `NUMERIC(4,${-scale})`;
|
|
70
|
+
case "long": return scale === 0 ? "INTEGER" : `NUMERIC(9,${-scale})`;
|
|
71
|
+
case "int64": return scale === 0 ? "BIGINT" : `NUMERIC(18,${-scale})`;
|
|
72
|
+
case "real": return "FLOAT";
|
|
73
|
+
case "double": return "DOUBLE PRECISION";
|
|
74
|
+
case "sql_date": return "DATE";
|
|
75
|
+
case "sql_time": return "TIME";
|
|
76
|
+
case "timestamp": return "TIMESTAMP";
|
|
77
|
+
case "text": return `CHAR(${characterLength ?? lengthBytes})`;
|
|
78
|
+
case "varying": return `VARCHAR(${characterLength ?? lengthBytes})`;
|
|
79
|
+
case "cstring": return `CSTRING(${characterLength ?? lengthBytes})`;
|
|
80
|
+
case "boolean": return "BOOLEAN";
|
|
81
|
+
case "blob": return "BLOB";
|
|
82
|
+
case "quad": return "ARRAY";
|
|
83
|
+
case "int128": return `NUMERIC(38,${-scale})`;
|
|
84
|
+
case "dec64": return "DECFLOAT(16)";
|
|
85
|
+
case "dec128": return "DECFLOAT(34)";
|
|
86
|
+
case "unsupported-tz": return "TIMESTAMP/TIME WITH TIME ZONE";
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
90
|
+
export { BLR_BLOB, BLR_BOOL, BLR_CSTRING, BLR_CSTRING2, BLR_DEC128, BLR_DEC64, BLR_DOUBLE, BLR_D_FLOAT, BLR_EX_TIMESTAMP_TZ, BLR_EX_TIME_TZ, BLR_FLOAT, BLR_INT128, BLR_INT64, BLR_LONG, BLR_QUAD, BLR_SHORT, BLR_SQL_DATE, BLR_SQL_TIME, BLR_SQL_TIME_TZ, BLR_TEXT, BLR_TEXT2, BLR_TIMESTAMP, BLR_TIMESTAMP_TZ, BLR_VARYING, BLR_VARYING2, FirebirdUnsupportedFieldTypeError, decodeBlrType, describeFieldType };
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_firebird_reader = require("./reader.cjs");
|
|
3
|
+
const require_firebird_date = require("./date.cjs");
|
|
4
|
+
//#region src/firebird/data.ts
|
|
5
|
+
const REC_DATA = 6;
|
|
6
|
+
const REC_BLOB = 7;
|
|
7
|
+
const REC_RELATION_END = 9;
|
|
8
|
+
const REC_GEN_ID = 18;
|
|
9
|
+
const REC_INDEX = 5;
|
|
10
|
+
const REC_TRIGGER = 13;
|
|
11
|
+
const ATT_RELATION_NAME = 1;
|
|
12
|
+
const ATT_DATA_LENGTH = 1;
|
|
13
|
+
const ATT_DATA_DATA = 2;
|
|
14
|
+
const ATT_XDR_LENGTH = 17;
|
|
15
|
+
var FirebirdDataParseError = class extends Error {
|
|
16
|
+
constructor(message) {
|
|
17
|
+
super(`Firebird backup data parse error: ${message}`);
|
|
18
|
+
this.name = "FirebirdDataParseError";
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var FirebirdCompositeRecordUnsupportedError = class extends Error {
|
|
22
|
+
recordType;
|
|
23
|
+
constructor(recordType, context) {
|
|
24
|
+
super(`Firebird backup: encountered record type ${recordType} while ${context}, which this reader's own bounded implementation does not know how to skip safely (its own attribute/sub-record shape has not been verified against a real fixture) -- refusing to guess rather than risk silently desynchronising the rest of the stream`);
|
|
25
|
+
this.name = "FirebirdCompositeRecordUnsupportedError";
|
|
26
|
+
this.recordType = recordType;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
function skipBlobRecord(reader) {
|
|
30
|
+
let segmentCount;
|
|
31
|
+
for (;;) {
|
|
32
|
+
const attribute = reader.readTag();
|
|
33
|
+
if (attribute === 0) break;
|
|
34
|
+
if (attribute === 5) segmentCount = reader.readInt32Attribute();
|
|
35
|
+
else if (attribute === 7) {
|
|
36
|
+
const count = segmentCount ?? 0;
|
|
37
|
+
for (let i = 0; i < count; i++) {
|
|
38
|
+
const length = reader.readBlobSegmentLength();
|
|
39
|
+
reader.readRawPayload(length);
|
|
40
|
+
}
|
|
41
|
+
} else reader.skipAttributeValue();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function decodeRowValues(fields, payload) {
|
|
45
|
+
const storedFields = fields.filter((field) => !field.computed);
|
|
46
|
+
const xdr = new require_firebird_reader.XdrReader(payload);
|
|
47
|
+
const rawValues = [];
|
|
48
|
+
for (const field of storedFields) switch (field.physicalType) {
|
|
49
|
+
case "short":
|
|
50
|
+
rawValues.push({
|
|
51
|
+
kind: "number",
|
|
52
|
+
value: field.scale === 0 ? xdr.readInt16() : xdr.readInt16() * 10 ** field.scale
|
|
53
|
+
});
|
|
54
|
+
break;
|
|
55
|
+
case "long":
|
|
56
|
+
rawValues.push({
|
|
57
|
+
kind: "number",
|
|
58
|
+
value: field.scale === 0 ? xdr.readInt32() : xdr.readInt32() * 10 ** field.scale
|
|
59
|
+
});
|
|
60
|
+
break;
|
|
61
|
+
case "int64": {
|
|
62
|
+
const raw = xdr.readInt64();
|
|
63
|
+
const scaled = field.scale === 0 ? Number(raw) : Number(raw) * 10 ** field.scale;
|
|
64
|
+
rawValues.push({
|
|
65
|
+
kind: "number",
|
|
66
|
+
value: scaled
|
|
67
|
+
});
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
case "real":
|
|
71
|
+
rawValues.push({
|
|
72
|
+
kind: "number",
|
|
73
|
+
value: xdr.readFloat()
|
|
74
|
+
});
|
|
75
|
+
break;
|
|
76
|
+
case "double":
|
|
77
|
+
rawValues.push({
|
|
78
|
+
kind: "number",
|
|
79
|
+
value: xdr.readDouble()
|
|
80
|
+
});
|
|
81
|
+
break;
|
|
82
|
+
case "sql_date": {
|
|
83
|
+
const days = xdr.readInt32();
|
|
84
|
+
rawValues.push({
|
|
85
|
+
kind: "date",
|
|
86
|
+
value: require_firebird_date.formatFirebirdDate(days)
|
|
87
|
+
});
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
case "sql_time": {
|
|
91
|
+
const ticks = xdr.readInt32() >>> 0;
|
|
92
|
+
rawValues.push({
|
|
93
|
+
kind: "time",
|
|
94
|
+
value: require_firebird_date.formatFirebirdTime(ticks)
|
|
95
|
+
});
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
case "timestamp": {
|
|
99
|
+
const days = xdr.readInt32();
|
|
100
|
+
const ticks = xdr.readInt32() >>> 0;
|
|
101
|
+
rawValues.push({
|
|
102
|
+
kind: "date",
|
|
103
|
+
value: require_firebird_date.formatFirebirdTimestamp(days, ticks)
|
|
104
|
+
});
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
case "text": {
|
|
108
|
+
const bytes = xdr.readOpaque(field.lengthBytes);
|
|
109
|
+
rawValues.push({
|
|
110
|
+
kind: "string",
|
|
111
|
+
value: new TextDecoder("utf-8").decode(bytes).replace(/\s+$/, "")
|
|
112
|
+
});
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
case "varying": {
|
|
116
|
+
const stringLength = xdr.readInt16();
|
|
117
|
+
const bytes = xdr.readOpaque(stringLength);
|
|
118
|
+
rawValues.push({
|
|
119
|
+
kind: "string",
|
|
120
|
+
value: new TextDecoder("utf-8").decode(bytes)
|
|
121
|
+
});
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
case "cstring": {
|
|
125
|
+
const stringLength = xdr.readInt16();
|
|
126
|
+
const bytes = xdr.readOpaque(stringLength);
|
|
127
|
+
rawValues.push({
|
|
128
|
+
kind: "string",
|
|
129
|
+
value: new TextDecoder("utf-8").decode(bytes)
|
|
130
|
+
});
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
case "boolean": {
|
|
134
|
+
const bytes = xdr.readOpaque(field.lengthBytes);
|
|
135
|
+
rawValues.push({
|
|
136
|
+
kind: "boolean",
|
|
137
|
+
value: (bytes[0] ?? 0) !== 0
|
|
138
|
+
});
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
case "blob":
|
|
142
|
+
xdr.readInt32();
|
|
143
|
+
xdr.readInt32();
|
|
144
|
+
rawValues.push({ kind: "empty" });
|
|
145
|
+
break;
|
|
146
|
+
case "quad":
|
|
147
|
+
xdr.readInt32();
|
|
148
|
+
xdr.readInt32();
|
|
149
|
+
rawValues.push({ kind: "empty" });
|
|
150
|
+
break;
|
|
151
|
+
case "int128":
|
|
152
|
+
case "dec64":
|
|
153
|
+
case "dec128":
|
|
154
|
+
case "unsupported-tz": throw new FirebirdDataParseError(`column "${field.name}" has physical type "${field.physicalType}", which this reader's own bounded implementation does not decode (FB4+-only types not exercised by this reader's Firebird 3.0-era real fixture) -- see the README's .odb Tier 3 Fidelity note`);
|
|
155
|
+
}
|
|
156
|
+
for (let i = 0; i < storedFields.length; i++) if (xdr.readInt16() !== 0) rawValues[i] = { kind: "empty" };
|
|
157
|
+
return rawValues.map((value) => value ?? { kind: "empty" });
|
|
158
|
+
}
|
|
159
|
+
function readRowGroup(reader, relation, compressed) {
|
|
160
|
+
const rows = [];
|
|
161
|
+
let terminator;
|
|
162
|
+
for (;;) {
|
|
163
|
+
const lengthTag = reader.readTag();
|
|
164
|
+
if (lengthTag !== ATT_DATA_LENGTH) throw new FirebirdDataParseError(`relation "${relation.name}": expected att_data_length (tag ${ATT_DATA_LENGTH}), found tag ${lengthTag}`);
|
|
165
|
+
let xdrLength = reader.readInt32Attribute();
|
|
166
|
+
const maybeXdrTag = reader.readTag();
|
|
167
|
+
if (maybeXdrTag === ATT_XDR_LENGTH) xdrLength = reader.readInt32Attribute();
|
|
168
|
+
else if (maybeXdrTag !== ATT_DATA_DATA) throw new FirebirdDataParseError(`relation "${relation.name}": expected att_xdr_length or att_data_data, found tag ${maybeXdrTag}`);
|
|
169
|
+
if (maybeXdrTag !== ATT_DATA_DATA) {
|
|
170
|
+
const dataTag = reader.readTag();
|
|
171
|
+
if (dataTag !== ATT_DATA_DATA) throw new FirebirdDataParseError(`relation "${relation.name}": expected att_data_data (tag ${ATT_DATA_DATA}), found tag ${dataTag}`);
|
|
172
|
+
}
|
|
173
|
+
const payload = compressed ? reader.readCompressedPayload(xdrLength) : reader.readRawPayload(xdrLength);
|
|
174
|
+
rows.push(decodeRowValues(relation.fields, payload));
|
|
175
|
+
let next = reader.readTag();
|
|
176
|
+
while (next === REC_BLOB) {
|
|
177
|
+
skipBlobRecord(reader);
|
|
178
|
+
next = reader.readTag();
|
|
179
|
+
}
|
|
180
|
+
if (next !== REC_DATA) {
|
|
181
|
+
terminator = next;
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return {
|
|
186
|
+
rows,
|
|
187
|
+
terminator
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
function readRelationData(reader, schema, compressed) {
|
|
191
|
+
let name;
|
|
192
|
+
for (;;) {
|
|
193
|
+
const attribute = reader.readTag();
|
|
194
|
+
if (attribute === 0) break;
|
|
195
|
+
if (attribute === ATT_RELATION_NAME) name = reader.readTextAttribute();
|
|
196
|
+
else reader.skipAttributeValue();
|
|
197
|
+
}
|
|
198
|
+
if (name === void 0) throw new FirebirdDataParseError("a rec_relation_data record had no att_relation_name attribute");
|
|
199
|
+
const relation = schema.get(name);
|
|
200
|
+
if (relation === void 0) throw new FirebirdDataParseError(`rec_relation_data references relation "${name}", which no earlier rec_relation declared`);
|
|
201
|
+
const rows = [];
|
|
202
|
+
let recordType = reader.readTag();
|
|
203
|
+
for (;;) {
|
|
204
|
+
if (recordType === REC_RELATION_END) break;
|
|
205
|
+
if (recordType === REC_DATA) {
|
|
206
|
+
const group = readRowGroup(reader, relation, compressed);
|
|
207
|
+
rows.push(...group.rows);
|
|
208
|
+
recordType = group.terminator;
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
if (recordType === REC_GEN_ID) {
|
|
212
|
+
reader.readAttributeBytes();
|
|
213
|
+
recordType = reader.readTag();
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
if (recordType === REC_INDEX || recordType === REC_TRIGGER) {
|
|
217
|
+
reader.skipFlatRecordAttributes();
|
|
218
|
+
recordType = reader.readTag();
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
throw new FirebirdCompositeRecordUnsupportedError(recordType, `reading relation data for "${name}"`);
|
|
222
|
+
}
|
|
223
|
+
return {
|
|
224
|
+
relationName: name,
|
|
225
|
+
rows
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
//#endregion
|
|
229
|
+
exports.FirebirdCompositeRecordUnsupportedError = FirebirdCompositeRecordUnsupportedError;
|
|
230
|
+
exports.FirebirdDataParseError = FirebirdDataParseError;
|
|
231
|
+
exports.readRelationData = readRelationData;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { n as FirebirdBackupReader } from "../reader-DP0Mbaj4.cjs";
|
|
2
|
+
import { n as FirebirdRelation } from "../schema-Acco3Ezi.cjs";
|
|
3
|
+
import { ContentCellValue } from "document-schema.js";
|
|
4
|
+
//#region src/firebird/data.d.ts
|
|
5
|
+
declare class FirebirdDataParseError extends Error {
|
|
6
|
+
constructor(message: string);
|
|
7
|
+
}
|
|
8
|
+
declare class FirebirdCompositeRecordUnsupportedError extends Error {
|
|
9
|
+
readonly recordType: number;
|
|
10
|
+
constructor(recordType: number, context: string);
|
|
11
|
+
}
|
|
12
|
+
declare function readRelationData(reader: FirebirdBackupReader, schema: ReadonlyMap<string, FirebirdRelation>, compressed: boolean): {
|
|
13
|
+
relationName: string;
|
|
14
|
+
rows: ContentCellValue[][];
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { FirebirdCompositeRecordUnsupportedError, FirebirdDataParseError, readRelationData };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { n as FirebirdBackupReader } from "../reader-DP0Mbaj4.js";
|
|
2
|
+
import { n as FirebirdRelation } from "../schema-VkAA6pF5.js";
|
|
3
|
+
import { ContentCellValue } from "document-schema.js";
|
|
4
|
+
//#region src/firebird/data.d.ts
|
|
5
|
+
declare class FirebirdDataParseError extends Error {
|
|
6
|
+
constructor(message: string);
|
|
7
|
+
}
|
|
8
|
+
declare class FirebirdCompositeRecordUnsupportedError extends Error {
|
|
9
|
+
readonly recordType: number;
|
|
10
|
+
constructor(recordType: number, context: string);
|
|
11
|
+
}
|
|
12
|
+
declare function readRelationData(reader: FirebirdBackupReader, schema: ReadonlyMap<string, FirebirdRelation>, compressed: boolean): {
|
|
13
|
+
relationName: string;
|
|
14
|
+
rows: ContentCellValue[][];
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { FirebirdCompositeRecordUnsupportedError, FirebirdDataParseError, readRelationData };
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { XdrReader } from "./reader.js";
|
|
2
|
+
import { formatFirebirdDate, formatFirebirdTime, formatFirebirdTimestamp } from "./date.js";
|
|
3
|
+
//#region src/firebird/data.ts
|
|
4
|
+
const REC_DATA = 6;
|
|
5
|
+
const REC_BLOB = 7;
|
|
6
|
+
const REC_RELATION_END = 9;
|
|
7
|
+
const REC_GEN_ID = 18;
|
|
8
|
+
const REC_INDEX = 5;
|
|
9
|
+
const REC_TRIGGER = 13;
|
|
10
|
+
const ATT_RELATION_NAME = 1;
|
|
11
|
+
const ATT_DATA_LENGTH = 1;
|
|
12
|
+
const ATT_DATA_DATA = 2;
|
|
13
|
+
const ATT_XDR_LENGTH = 17;
|
|
14
|
+
var FirebirdDataParseError = class extends Error {
|
|
15
|
+
constructor(message) {
|
|
16
|
+
super(`Firebird backup data parse error: ${message}`);
|
|
17
|
+
this.name = "FirebirdDataParseError";
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
var FirebirdCompositeRecordUnsupportedError = class extends Error {
|
|
21
|
+
recordType;
|
|
22
|
+
constructor(recordType, context) {
|
|
23
|
+
super(`Firebird backup: encountered record type ${recordType} while ${context}, which this reader's own bounded implementation does not know how to skip safely (its own attribute/sub-record shape has not been verified against a real fixture) -- refusing to guess rather than risk silently desynchronising the rest of the stream`);
|
|
24
|
+
this.name = "FirebirdCompositeRecordUnsupportedError";
|
|
25
|
+
this.recordType = recordType;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
function skipBlobRecord(reader) {
|
|
29
|
+
let segmentCount;
|
|
30
|
+
for (;;) {
|
|
31
|
+
const attribute = reader.readTag();
|
|
32
|
+
if (attribute === 0) break;
|
|
33
|
+
if (attribute === 5) segmentCount = reader.readInt32Attribute();
|
|
34
|
+
else if (attribute === 7) {
|
|
35
|
+
const count = segmentCount ?? 0;
|
|
36
|
+
for (let i = 0; i < count; i++) {
|
|
37
|
+
const length = reader.readBlobSegmentLength();
|
|
38
|
+
reader.readRawPayload(length);
|
|
39
|
+
}
|
|
40
|
+
} else reader.skipAttributeValue();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function decodeRowValues(fields, payload) {
|
|
44
|
+
const storedFields = fields.filter((field) => !field.computed);
|
|
45
|
+
const xdr = new XdrReader(payload);
|
|
46
|
+
const rawValues = [];
|
|
47
|
+
for (const field of storedFields) switch (field.physicalType) {
|
|
48
|
+
case "short":
|
|
49
|
+
rawValues.push({
|
|
50
|
+
kind: "number",
|
|
51
|
+
value: field.scale === 0 ? xdr.readInt16() : xdr.readInt16() * 10 ** field.scale
|
|
52
|
+
});
|
|
53
|
+
break;
|
|
54
|
+
case "long":
|
|
55
|
+
rawValues.push({
|
|
56
|
+
kind: "number",
|
|
57
|
+
value: field.scale === 0 ? xdr.readInt32() : xdr.readInt32() * 10 ** field.scale
|
|
58
|
+
});
|
|
59
|
+
break;
|
|
60
|
+
case "int64": {
|
|
61
|
+
const raw = xdr.readInt64();
|
|
62
|
+
const scaled = field.scale === 0 ? Number(raw) : Number(raw) * 10 ** field.scale;
|
|
63
|
+
rawValues.push({
|
|
64
|
+
kind: "number",
|
|
65
|
+
value: scaled
|
|
66
|
+
});
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
case "real":
|
|
70
|
+
rawValues.push({
|
|
71
|
+
kind: "number",
|
|
72
|
+
value: xdr.readFloat()
|
|
73
|
+
});
|
|
74
|
+
break;
|
|
75
|
+
case "double":
|
|
76
|
+
rawValues.push({
|
|
77
|
+
kind: "number",
|
|
78
|
+
value: xdr.readDouble()
|
|
79
|
+
});
|
|
80
|
+
break;
|
|
81
|
+
case "sql_date": {
|
|
82
|
+
const days = xdr.readInt32();
|
|
83
|
+
rawValues.push({
|
|
84
|
+
kind: "date",
|
|
85
|
+
value: formatFirebirdDate(days)
|
|
86
|
+
});
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
case "sql_time": {
|
|
90
|
+
const ticks = xdr.readInt32() >>> 0;
|
|
91
|
+
rawValues.push({
|
|
92
|
+
kind: "time",
|
|
93
|
+
value: formatFirebirdTime(ticks)
|
|
94
|
+
});
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
case "timestamp": {
|
|
98
|
+
const days = xdr.readInt32();
|
|
99
|
+
const ticks = xdr.readInt32() >>> 0;
|
|
100
|
+
rawValues.push({
|
|
101
|
+
kind: "date",
|
|
102
|
+
value: formatFirebirdTimestamp(days, ticks)
|
|
103
|
+
});
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
case "text": {
|
|
107
|
+
const bytes = xdr.readOpaque(field.lengthBytes);
|
|
108
|
+
rawValues.push({
|
|
109
|
+
kind: "string",
|
|
110
|
+
value: new TextDecoder("utf-8").decode(bytes).replace(/\s+$/, "")
|
|
111
|
+
});
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
case "varying": {
|
|
115
|
+
const stringLength = xdr.readInt16();
|
|
116
|
+
const bytes = xdr.readOpaque(stringLength);
|
|
117
|
+
rawValues.push({
|
|
118
|
+
kind: "string",
|
|
119
|
+
value: new TextDecoder("utf-8").decode(bytes)
|
|
120
|
+
});
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
case "cstring": {
|
|
124
|
+
const stringLength = xdr.readInt16();
|
|
125
|
+
const bytes = xdr.readOpaque(stringLength);
|
|
126
|
+
rawValues.push({
|
|
127
|
+
kind: "string",
|
|
128
|
+
value: new TextDecoder("utf-8").decode(bytes)
|
|
129
|
+
});
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
case "boolean": {
|
|
133
|
+
const bytes = xdr.readOpaque(field.lengthBytes);
|
|
134
|
+
rawValues.push({
|
|
135
|
+
kind: "boolean",
|
|
136
|
+
value: (bytes[0] ?? 0) !== 0
|
|
137
|
+
});
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
case "blob":
|
|
141
|
+
xdr.readInt32();
|
|
142
|
+
xdr.readInt32();
|
|
143
|
+
rawValues.push({ kind: "empty" });
|
|
144
|
+
break;
|
|
145
|
+
case "quad":
|
|
146
|
+
xdr.readInt32();
|
|
147
|
+
xdr.readInt32();
|
|
148
|
+
rawValues.push({ kind: "empty" });
|
|
149
|
+
break;
|
|
150
|
+
case "int128":
|
|
151
|
+
case "dec64":
|
|
152
|
+
case "dec128":
|
|
153
|
+
case "unsupported-tz": throw new FirebirdDataParseError(`column "${field.name}" has physical type "${field.physicalType}", which this reader's own bounded implementation does not decode (FB4+-only types not exercised by this reader's Firebird 3.0-era real fixture) -- see the README's .odb Tier 3 Fidelity note`);
|
|
154
|
+
}
|
|
155
|
+
for (let i = 0; i < storedFields.length; i++) if (xdr.readInt16() !== 0) rawValues[i] = { kind: "empty" };
|
|
156
|
+
return rawValues.map((value) => value ?? { kind: "empty" });
|
|
157
|
+
}
|
|
158
|
+
function readRowGroup(reader, relation, compressed) {
|
|
159
|
+
const rows = [];
|
|
160
|
+
let terminator;
|
|
161
|
+
for (;;) {
|
|
162
|
+
const lengthTag = reader.readTag();
|
|
163
|
+
if (lengthTag !== ATT_DATA_LENGTH) throw new FirebirdDataParseError(`relation "${relation.name}": expected att_data_length (tag ${ATT_DATA_LENGTH}), found tag ${lengthTag}`);
|
|
164
|
+
let xdrLength = reader.readInt32Attribute();
|
|
165
|
+
const maybeXdrTag = reader.readTag();
|
|
166
|
+
if (maybeXdrTag === ATT_XDR_LENGTH) xdrLength = reader.readInt32Attribute();
|
|
167
|
+
else if (maybeXdrTag !== ATT_DATA_DATA) throw new FirebirdDataParseError(`relation "${relation.name}": expected att_xdr_length or att_data_data, found tag ${maybeXdrTag}`);
|
|
168
|
+
if (maybeXdrTag !== ATT_DATA_DATA) {
|
|
169
|
+
const dataTag = reader.readTag();
|
|
170
|
+
if (dataTag !== ATT_DATA_DATA) throw new FirebirdDataParseError(`relation "${relation.name}": expected att_data_data (tag ${ATT_DATA_DATA}), found tag ${dataTag}`);
|
|
171
|
+
}
|
|
172
|
+
const payload = compressed ? reader.readCompressedPayload(xdrLength) : reader.readRawPayload(xdrLength);
|
|
173
|
+
rows.push(decodeRowValues(relation.fields, payload));
|
|
174
|
+
let next = reader.readTag();
|
|
175
|
+
while (next === REC_BLOB) {
|
|
176
|
+
skipBlobRecord(reader);
|
|
177
|
+
next = reader.readTag();
|
|
178
|
+
}
|
|
179
|
+
if (next !== REC_DATA) {
|
|
180
|
+
terminator = next;
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return {
|
|
185
|
+
rows,
|
|
186
|
+
terminator
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
function readRelationData(reader, schema, compressed) {
|
|
190
|
+
let name;
|
|
191
|
+
for (;;) {
|
|
192
|
+
const attribute = reader.readTag();
|
|
193
|
+
if (attribute === 0) break;
|
|
194
|
+
if (attribute === ATT_RELATION_NAME) name = reader.readTextAttribute();
|
|
195
|
+
else reader.skipAttributeValue();
|
|
196
|
+
}
|
|
197
|
+
if (name === void 0) throw new FirebirdDataParseError("a rec_relation_data record had no att_relation_name attribute");
|
|
198
|
+
const relation = schema.get(name);
|
|
199
|
+
if (relation === void 0) throw new FirebirdDataParseError(`rec_relation_data references relation "${name}", which no earlier rec_relation declared`);
|
|
200
|
+
const rows = [];
|
|
201
|
+
let recordType = reader.readTag();
|
|
202
|
+
for (;;) {
|
|
203
|
+
if (recordType === REC_RELATION_END) break;
|
|
204
|
+
if (recordType === REC_DATA) {
|
|
205
|
+
const group = readRowGroup(reader, relation, compressed);
|
|
206
|
+
rows.push(...group.rows);
|
|
207
|
+
recordType = group.terminator;
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
if (recordType === REC_GEN_ID) {
|
|
211
|
+
reader.readAttributeBytes();
|
|
212
|
+
recordType = reader.readTag();
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
if (recordType === REC_INDEX || recordType === REC_TRIGGER) {
|
|
216
|
+
reader.skipFlatRecordAttributes();
|
|
217
|
+
recordType = reader.readTag();
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
throw new FirebirdCompositeRecordUnsupportedError(recordType, `reading relation data for "${name}"`);
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
relationName: name,
|
|
224
|
+
rows
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
//#endregion
|
|
228
|
+
export { FirebirdCompositeRecordUnsupportedError, FirebirdDataParseError, readRelationData };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/firebird/date.ts
|
|
3
|
+
const ISC_TIME_SECONDS_PRECISION = 1e4;
|
|
4
|
+
function decodeFirebirdDate(days) {
|
|
5
|
+
let nday = days + 2400001 - 1721119;
|
|
6
|
+
const century = Math.floor((4 * nday - 1) / 146097);
|
|
7
|
+
nday = 4 * nday - 1 - 146097 * century;
|
|
8
|
+
let day = Math.floor(nday / 4);
|
|
9
|
+
nday = Math.floor((4 * day + 3) / 1461);
|
|
10
|
+
day = 4 * day + 3 - 1461 * nday;
|
|
11
|
+
day = Math.floor((day + 4) / 4);
|
|
12
|
+
let month = Math.floor((5 * day - 3) / 153);
|
|
13
|
+
day = 5 * day - 3 - 153 * month;
|
|
14
|
+
day = Math.floor((day + 5) / 5);
|
|
15
|
+
let year = 100 * century + nday;
|
|
16
|
+
if (month < 10) month += 3;
|
|
17
|
+
else {
|
|
18
|
+
month -= 9;
|
|
19
|
+
year += 1;
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
year,
|
|
23
|
+
month,
|
|
24
|
+
day
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function decodeFirebirdTime(ticks) {
|
|
28
|
+
let remaining = ticks;
|
|
29
|
+
const hours = Math.floor(remaining / (3600 * ISC_TIME_SECONDS_PRECISION));
|
|
30
|
+
remaining %= 3600 * ISC_TIME_SECONDS_PRECISION;
|
|
31
|
+
const minutes = Math.floor(remaining / (60 * ISC_TIME_SECONDS_PRECISION));
|
|
32
|
+
remaining %= 60 * ISC_TIME_SECONDS_PRECISION;
|
|
33
|
+
return {
|
|
34
|
+
hours,
|
|
35
|
+
minutes,
|
|
36
|
+
seconds: Math.floor(remaining / ISC_TIME_SECONDS_PRECISION),
|
|
37
|
+
fractions: remaining % ISC_TIME_SECONDS_PRECISION
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function pad2(value) {
|
|
41
|
+
return String(value).padStart(2, "0");
|
|
42
|
+
}
|
|
43
|
+
function pad4(value) {
|
|
44
|
+
return String(value).padStart(4, "0");
|
|
45
|
+
}
|
|
46
|
+
function formatFirebirdDate(days) {
|
|
47
|
+
const { year, month, day } = decodeFirebirdDate(days);
|
|
48
|
+
return `${pad4(year)}-${pad2(month)}-${pad2(day)}`;
|
|
49
|
+
}
|
|
50
|
+
function formatFirebirdTime(ticks) {
|
|
51
|
+
const { hours, minutes, seconds, fractions } = decodeFirebirdTime(ticks);
|
|
52
|
+
const millis = Math.round(fractions / 10);
|
|
53
|
+
return `${pad2(hours)}:${pad2(minutes)}:${pad2(seconds)}.${String(millis).padStart(3, "0")}`;
|
|
54
|
+
}
|
|
55
|
+
function formatFirebirdTimestamp(days, ticks) {
|
|
56
|
+
return `${formatFirebirdDate(days)} ${formatFirebirdTime(ticks)}`;
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
exports.decodeFirebirdDate = decodeFirebirdDate;
|
|
60
|
+
exports.decodeFirebirdTime = decodeFirebirdTime;
|
|
61
|
+
exports.formatFirebirdDate = formatFirebirdDate;
|
|
62
|
+
exports.formatFirebirdTime = formatFirebirdTime;
|
|
63
|
+
exports.formatFirebirdTimestamp = formatFirebirdTimestamp;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/firebird/date.d.ts
|
|
2
|
+
declare function decodeFirebirdDate(days: number): {
|
|
3
|
+
year: number;
|
|
4
|
+
month: number;
|
|
5
|
+
day: number;
|
|
6
|
+
};
|
|
7
|
+
declare function decodeFirebirdTime(ticks: number): {
|
|
8
|
+
hours: number;
|
|
9
|
+
minutes: number;
|
|
10
|
+
seconds: number;
|
|
11
|
+
fractions: number;
|
|
12
|
+
};
|
|
13
|
+
declare function formatFirebirdDate(days: number): string;
|
|
14
|
+
declare function formatFirebirdTime(ticks: number): string;
|
|
15
|
+
declare function formatFirebirdTimestamp(days: number, ticks: number): string;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { decodeFirebirdDate, decodeFirebirdTime, formatFirebirdDate, formatFirebirdTime, formatFirebirdTimestamp };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/firebird/date.d.ts
|
|
2
|
+
declare function decodeFirebirdDate(days: number): {
|
|
3
|
+
year: number;
|
|
4
|
+
month: number;
|
|
5
|
+
day: number;
|
|
6
|
+
};
|
|
7
|
+
declare function decodeFirebirdTime(ticks: number): {
|
|
8
|
+
hours: number;
|
|
9
|
+
minutes: number;
|
|
10
|
+
seconds: number;
|
|
11
|
+
fractions: number;
|
|
12
|
+
};
|
|
13
|
+
declare function formatFirebirdDate(days: number): string;
|
|
14
|
+
declare function formatFirebirdTime(ticks: number): string;
|
|
15
|
+
declare function formatFirebirdTimestamp(days: number, ticks: number): string;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { decodeFirebirdDate, decodeFirebirdTime, formatFirebirdDate, formatFirebirdTime, formatFirebirdTimestamp };
|