js.documents 14.1.0 → 14.1.1
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 +8 -8
- package/dist/bin-dispatch.cjs +1 -1
- package/dist/bin-dispatch.d.cts +3 -3
- package/dist/bin-dispatch.d.ts +3 -3
- package/dist/bin-dispatch.js +1 -1
- package/dist/convert/composition.cjs +1 -1
- package/dist/convert/composition.js +1 -1
- package/dist/convert/convert.cjs +1 -1
- package/dist/convert/convert.js +1 -1
- package/dist/convert/document-fonts.cjs +1 -1
- package/dist/convert/document-fonts.js +1 -1
- package/dist/convert/from-package.cjs +2 -2
- package/dist/convert/from-package.js +2 -2
- package/dist/csv/write.cjs +2 -2
- package/dist/csv/write.js +2 -2
- package/dist/edit/docx/image.cjs +1 -1
- package/dist/edit/docx/image.js +1 -1
- package/dist/edit/docx/paragraph.cjs +1 -1
- package/dist/edit/docx/paragraph.js +1 -1
- package/dist/edit/ods/sheet.cjs +1 -1
- package/dist/edit/ods/sheet.js +1 -1
- package/dist/edit/pptx/content.cjs +1 -1
- package/dist/edit/pptx/content.js +1 -1
- package/dist/firebird/backup.cjs +4 -4
- package/dist/firebird/backup.js +4 -4
- package/dist/firebird/data.cjs +2 -2
- package/dist/firebird/data.js +2 -2
- package/dist/hsqldb/binary-script.cjs +3 -3
- package/dist/hsqldb/binary-script.js +3 -3
- package/dist/hsqldb/cache.cjs +2 -2
- package/dist/hsqldb/cache.js +2 -2
- package/dist/hsqldb/rowformat.cjs +2 -2
- package/dist/hsqldb/rowformat.js +2 -2
- package/dist/hsqldb/script.cjs +2 -2
- package/dist/hsqldb/script.js +2 -2
- package/dist/layout/shared.cjs +1 -1
- package/dist/layout/shared.js +1 -1
- package/dist/metadata/write.cjs +12 -12
- package/dist/metadata/write.js +12 -12
- package/dist/odb/csv.cjs +2 -2
- package/dist/odb/csv.js +2 -2
- package/dist/odb/formula/errors.cjs +3 -3
- package/dist/odb/formula/errors.js +3 -3
- package/dist/odb/formula/evaluate.cjs +4 -4
- package/dist/odb/formula/evaluate.js +4 -4
- package/dist/odb/formula/parser.cjs +2 -2
- package/dist/odb/formula/parser.js +2 -2
- package/dist/odb/read.cjs +9 -9
- package/dist/odb/read.js +9 -9
- package/dist/odb/report/content.cjs +1 -1
- package/dist/odb/report/content.js +1 -1
- package/dist/odb/report/source.cjs +1 -1
- package/dist/odb/report/source.js +1 -1
- package/dist/odb/sql/errors.cjs +3 -3
- package/dist/odb/sql/errors.js +3 -3
- package/dist/odb/sql/evaluate.cjs +9 -9
- package/dist/odb/sql/evaluate.js +9 -9
- package/dist/odb/sql/parser.cjs +2 -2
- package/dist/odb/sql/parser.js +2 -2
- package/dist/package-codec.cjs +1 -1
- package/dist/package-codec.js +1 -1
- package/dist/svg/write.cjs +2 -2
- package/dist/svg/write.js +2 -2
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -167,13 +167,13 @@ const pdfFromOdg = odgToPdf(odgBytes);
|
|
|
167
167
|
const odgBytes2 = pdfToOdg(pdfFromOdg);
|
|
168
168
|
|
|
169
169
|
const pdfFromOds = odsToPdf(odsBytes);
|
|
170
|
-
const odsBytes2 = pdfToOds(pdfFromOds); // recovers what was printed, then heuristically re-types it
|
|
170
|
+
const odsBytes2 = pdfToOds(pdfFromOds); // recovers what was printed, then heuristically re-types it — see Fidelity
|
|
171
171
|
|
|
172
172
|
const pdfFromXlsx = xlsxToPdf(xlsxBytes); // composes xlsxToOds -> odsToPdf internally
|
|
173
173
|
const xlsxBytes2 = pdfToXlsx(pdfFromXlsx); // composes pdfToOds -> odsToXlsx internally
|
|
174
174
|
|
|
175
175
|
const pdfFromMarkdown = markdownToPdf(markdownBytes);
|
|
176
|
-
const markdownBytes2 = pdfToMarkdown(pdfFromMarkdown); // the lossiest conversion in the whole package
|
|
176
|
+
const markdownBytes2 = pdfToMarkdown(pdfFromMarkdown); // the lossiest conversion in the whole package — see Fidelity; it does carry page boundaries (one '<!-- page break -->' marker per page) and rank-inferred heading levels
|
|
177
177
|
|
|
178
178
|
const pdfFromCsv = csvToPdf(csvBytes); // composes csvToOds -> odsToPdf internally
|
|
179
179
|
const csvBytes2 = pdfToCsv(pdfFromCsv); // composes pdfToOds -> odsToCsv internally; recovers what was printed, then heuristically re-types it
|
|
@@ -214,7 +214,7 @@ const docxBytes = odtToDocx(odtBytes);
|
|
|
214
214
|
const odtBytes2 = docxToOdt(docxBytes);
|
|
215
215
|
|
|
216
216
|
const docxFromMarkdown = markdownToDocx(markdownBytes);
|
|
217
|
-
const markdownBytes3 = docxToMarkdown(docxFromMarkdown); // colour, font family/size, and explicit alignment have no markdown source construct
|
|
217
|
+
const markdownBytes3 = docxToMarkdown(docxFromMarkdown); // colour, font family/size, and explicit alignment have no markdown source construct — dropped on this hop
|
|
218
218
|
```
|
|
219
219
|
|
|
220
220
|
Each takes an optional `{ signal }` — no `onSubstitution`/`sink`, since there is no font substitution or PDF-parse degradation. `odtToDocx`/`markdownToDocx`/`docxToOdt`/`docxToMarkdown` additionally take `onMathDiagnostic`, called per formula construct that degraded crossing the bridge. The csv-sourced bridges (`csvToOds`, `csvToXlsx`, `csvToMarkdown`, `csvToPdf`) take `{ delimiter }` — `'\t'` parses the same format as TSV, since a delimiter is a parse option, not a different document format — and `onCellTypeInference`, the per-decision audit channel the read shares with `pdfToOds`. The csv-target bridges (`odsToCsv`, `xlsxToCsv`, `markdownToCsv`, `pdfToCsv`) take `{ delimiter, sheet }`: csv has no second sheet, so writing a multi-sheet source refuses with `CsvSheetNotSpecifiedError` naming every sheet until a caller selects one. The svg-sourced bridges (`svgToOdg`, `svgToPdf`) take `onSvgDiagnostic`, the reader's per-scope-limit channel; the svg-target bridges (`odgToSvg`, `pdfToSvg`) take `{ page, onSvgDiagnostic }`: an svg is a single drawing, so writing a multi-page source refuses with `SvgMultiPageNotSpecifiedError` naming the page count until `{ page }` selects one (an index, because drawing pages are anonymous where sheets are named).
|
|
@@ -254,7 +254,7 @@ import { docxToPdf } from "documents.js";
|
|
|
254
254
|
|
|
255
255
|
const pdfBytes = docxToPdf(docxBytes, {
|
|
256
256
|
onDocument: (pkg) => {
|
|
257
|
-
console.log(pkg.kind); // 'wordprocessing'
|
|
257
|
+
console.log(pkg.kind); // 'wordprocessing' — the document kind rides the tree's root
|
|
258
258
|
console.log(pkg.pages?.length); // populated for every X-to-PDF/PDF-to-X conversion
|
|
259
259
|
const content = flattenTree(pkg); // the flat ContentDocument, fully materialised
|
|
260
260
|
const block =
|
|
@@ -358,7 +358,7 @@ const patchedBytes = setDocumentMetadata("docx", "docx", docxBytes, {
|
|
|
358
358
|
import { readNativeDocumentTree } from "documents.js";
|
|
359
359
|
|
|
360
360
|
const tree = readNativeDocumentTree("xlsx", xlsxBytes);
|
|
361
|
-
console.log(tree.kind); // 'spreadsheet'
|
|
361
|
+
console.log(tree.kind); // 'spreadsheet' — the workbook's own shape, never a projection through some other target
|
|
362
362
|
```
|
|
363
363
|
|
|
364
364
|
Every module under `src/` is deep-importable by package-relative path:
|
|
@@ -525,7 +525,7 @@ page.addPath({
|
|
|
525
525
|
},
|
|
526
526
|
],
|
|
527
527
|
fill: { r: 1, g: 1, b: 0 },
|
|
528
|
-
}); // a genuine Bezier curve
|
|
528
|
+
}); // a genuine Bezier curve — writes a real svg:d/svg:viewBox pair, not a polygon approximation
|
|
529
529
|
page.addTextBox({
|
|
530
530
|
frame: { xPt: 20, yPt: 200, widthPt: 300, heightPt: 30 },
|
|
531
531
|
text: "A label on top",
|
|
@@ -802,7 +802,7 @@ The package is layered from generic primitives outward to the two conversion dir
|
|
|
802
802
|
- **`src/omml/`** — the MathML ⇄ OMML structural translator, both directions. `write.ts` covers the identical construct set `src/mathml/layout.ts` typesets; `read.ts` covers strictly more (reads what Word authored, not just what this package writes). Lives outside `src/mathml/` because its I/O type is `ooxml.js`'s `XmlElement` and `src/mathml/` imports no package.
|
|
803
803
|
- **`src/ooxml/`** — thin adapters over `ooxml.js`'s own flat `readDocxContent`/`readPptxContent` readers, wrapping results into `ContentDocument`. `docx/formula.ts` is the one local reading pass (splicing OOXML math equations). `docx/extras.ts`'s `readDocxExtras` returns comments/footnotes/header-footer parts, section header/footer references, and numbering.
|
|
804
804
|
- **`src/odf/`** — ODF-side counterparts: `readOdtContent`/`readOdpContent`/`readOdsContent`/`readOdgContent` are thin adapters over `odf.js`. `formula/read.ts`/`formula/detect.ts` handle embedded formula detection (genuinely new work with no `odf.js`-side equivalent).
|
|
805
|
-
- **`src/ppt/`** — the one legacy-binary-format adapter with a genuine wrap of its own: `ppt-codec`'s `readPptContent`/`writePptContent` operate on the flat `{ metadata, slides }` shape (mirroring `ooxml.js`'s/`odf.js`'s own upstream flat readers), not a full `'presentation'`-kind `ContentDocument` directly, so `read.ts`/`write.ts` do the envelope wrap/unwrap `src/ooxml/pptx/read.ts`/`src/odf/odp/read.ts` also do for their own formats
|
|
805
|
+
- **`src/ppt/`** — the one legacy-binary-format adapter with a genuine wrap of its own: `ppt-codec`'s `readPptContent`/`writePptContent` operate on the flat `{ metadata, slides }` shape (mirroring `ooxml.js`'s/`odf.js`'s own upstream flat readers), not a full `'presentation'`-kind `ContentDocument` directly, so `read.ts`/`write.ts` do the envelope wrap/unwrap `src/ooxml/pptx/read.ts`/`src/odf/odp/read.ts` also do for their own formats — minus the formula/vector-recovery passes those two run, since `ppt-codec` has no upstream equivalent to splice in. `doc` and `xls` need no equivalent module: `doc-codec`'s `readDocContent`/`writeDocContent` and `xls-codec`'s `readXlsContent`/`writeXlsContent` already read/write a real `ContentDocument` directly (the latter over `XlsContentDocument`, a plain narrowed alias), so both are called straight from `src/codecs/read.ts`/`src/codecs/registry.ts`/`src/convert/composition.ts`, exactly like `rtf-codec`'s own pair.
|
|
806
806
|
- **`src/latex/`** — the LaTeX presentation → `MathExpression` lowering: `temml.ts` is the pinned-parser boundary (exact-version temml, its internal parse API guarded behind structural type guards), `lower.ts` the mechanical rules and their degradations, `symbols.ts` the glyph/command map and the prose definition scanner, `rational.ts` the exact-rational helpers, `lint.ts` the coherence lint. See [LaTeX lowering into the semantic core](#latex-lowering-into-the-semantic-core).
|
|
807
807
|
- **`src/markdown/`** — third adapter family, via `markdown-codec`. `readMarkdownContent` passes `readMarkdownContent`'s (markdown-codec's flat reader, so named since that package's 4.0.0; the bare `readMarkdown` name is now its tree-form `DocumentTree` reader) result through the math-lowering pass (`math.ts` — markdown-codec's preserved `$$` display blocks and `\( \)` inline spans become two-layer formula blocks, with the document's symbol table seeded from its own prose). `buildMarkdownText` wraps `writeMarkdownContent`, reconstructing markdown math syntax from formula blocks carrying a presentation layer. `text.ts` is the byte↔text boundary. `MarkdownEditor` holds a mutable in-memory `ContentDocument`.
|
|
808
808
|
- **`src/csv/`** — fourth adapter family, sharing the spreadsheet variant with xlsx/ods. `records.ts` is the RFC 4180 record parser/writer (one shared `quoteCsvField`, also used by the `.odb` CSV exporter); `text.ts` is the byte↔text boundary, working the character encoding out from the bytes through [byte-codec](../byte-codec/README.md#text-decoding) rather than assuming UTF-8, so Excel's own windows-1252 export reads, and refusing bytes that are not text at all; `read.ts` turns records into a spreadsheet `ContentDocument` (first record as verbatim string header, data cells through the same cell-typing heuristic `pdfToOds` uses); `write.ts` turns one sheet of a spreadsheet `ContentDocument` back into records via each cell's `displayText`. TSV is the same format with `{ delimiter: '\t' }` on either side.
|
|
@@ -825,7 +825,7 @@ pnpm build # turbo run _build (tsdown -> dist/ (ESM + CJS + .d.ts))
|
|
|
825
825
|
pnpm typecheck # turbo run _typecheck _typecheck:node
|
|
826
826
|
pnpm lint # turbo run _lint (eslint . --fix --cache --max-warnings 0)
|
|
827
827
|
pnpm test # turbo run _test (vitest run --project unit)
|
|
828
|
-
pnpm test:workers # turbo run _test:workers (vitest run --config vitest.workers.config.ts
|
|
828
|
+
pnpm test:workers # turbo run _test:workers (vitest run --config vitest.workers.config.ts — Cloudflare Workers runtime)
|
|
829
829
|
pnpm test:watch # vitest --project unit
|
|
830
830
|
pnpm test:smoke # turbo run _test:smoke (rebuilds dist/, verifies ESM/CJS parity, real round trips across all conversions, font resolution, from the built CJS bundle)
|
|
831
831
|
```
|
package/dist/bin-dispatch.cjs
CHANGED
|
@@ -26,7 +26,7 @@ function detectPackageManager(userAgent) {
|
|
|
26
26
|
return "npm";
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* Resolves a launcher invocation into the companion package to run and the runner argument list to spawn it with. A bare invocation or any args that are not the `mcp` dispatch token run the interactive CLI; `mcp` launches the server. `cli` is the explicit escape hatch for the one collision a dispatcher that reserves a subcommand name necessarily has: a leading bare `mcp` is intercepted as "launch the server", so targeting a CLI command on a file literally named `mcp` needs `documents.js cli mcp`. document-cli's own commands never start with `mcp`, so the collision is narrow in practice
|
|
29
|
+
* Resolves a launcher invocation into the companion package to run and the runner argument list to spawn it with. A bare invocation or any args that are not the `mcp` dispatch token run the interactive CLI; `mcp` launches the server. `cli` is the explicit escape hatch for the one collision a dispatcher that reserves a subcommand name necessarily has: a leading bare `mcp` is intercepted as "launch the server", so targeting a CLI command on a file literally named `mcp` needs `documents.js cli mcp`. document-cli's own commands never start with `mcp`, so the collision is narrow in practice — the same "dispatcher reserves a subcommand name" model `git` uses.
|
|
30
30
|
*/
|
|
31
31
|
function resolveBinDispatch(argv, userAgent) {
|
|
32
32
|
const head = argv[0];
|
package/dist/bin-dispatch.d.cts
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
interface BinDispatch {
|
|
3
3
|
/** The npm package the launcher resolves and invokes. */
|
|
4
4
|
readonly pkg: "document-cli" | "document-mcp";
|
|
5
|
-
/** The executable to spawn
|
|
5
|
+
/** The executable to spawn — each JS package manager's own download-and-run command. */
|
|
6
6
|
readonly command: "npx" | "pnpm" | "yarn" | "bunx";
|
|
7
|
-
/** Arguments after the command itself
|
|
7
|
+
/** Arguments after the command itself — begins with the manager's fetch flags, then the package name, then the passthrough args. */
|
|
8
8
|
readonly runnerArgs: readonly string[];
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* Resolves a launcher invocation into the companion package to run and the runner argument list to spawn it with. A bare invocation or any args that are not the `mcp` dispatch token run the interactive CLI; `mcp` launches the server. `cli` is the explicit escape hatch for the one collision a dispatcher that reserves a subcommand name necessarily has: a leading bare `mcp` is intercepted as "launch the server", so targeting a CLI command on a file literally named `mcp` needs `documents.js cli mcp`. document-cli's own commands never start with `mcp`, so the collision is narrow in practice
|
|
11
|
+
* Resolves a launcher invocation into the companion package to run and the runner argument list to spawn it with. A bare invocation or any args that are not the `mcp` dispatch token run the interactive CLI; `mcp` launches the server. `cli` is the explicit escape hatch for the one collision a dispatcher that reserves a subcommand name necessarily has: a leading bare `mcp` is intercepted as "launch the server", so targeting a CLI command on a file literally named `mcp` needs `documents.js cli mcp`. document-cli's own commands never start with `mcp`, so the collision is narrow in practice — the same "dispatcher reserves a subcommand name" model `git` uses.
|
|
12
12
|
*/
|
|
13
13
|
declare function resolveBinDispatch(argv: readonly string[], userAgent: string | undefined): BinDispatch;
|
|
14
14
|
//#endregion
|
package/dist/bin-dispatch.d.ts
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
interface BinDispatch {
|
|
3
3
|
/** The npm package the launcher resolves and invokes. */
|
|
4
4
|
readonly pkg: "document-cli" | "document-mcp";
|
|
5
|
-
/** The executable to spawn
|
|
5
|
+
/** The executable to spawn — each JS package manager's own download-and-run command. */
|
|
6
6
|
readonly command: "npx" | "pnpm" | "yarn" | "bunx";
|
|
7
|
-
/** Arguments after the command itself
|
|
7
|
+
/** Arguments after the command itself — begins with the manager's fetch flags, then the package name, then the passthrough args. */
|
|
8
8
|
readonly runnerArgs: readonly string[];
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* Resolves a launcher invocation into the companion package to run and the runner argument list to spawn it with. A bare invocation or any args that are not the `mcp` dispatch token run the interactive CLI; `mcp` launches the server. `cli` is the explicit escape hatch for the one collision a dispatcher that reserves a subcommand name necessarily has: a leading bare `mcp` is intercepted as "launch the server", so targeting a CLI command on a file literally named `mcp` needs `documents.js cli mcp`. document-cli's own commands never start with `mcp`, so the collision is narrow in practice
|
|
11
|
+
* Resolves a launcher invocation into the companion package to run and the runner argument list to spawn it with. A bare invocation or any args that are not the `mcp` dispatch token run the interactive CLI; `mcp` launches the server. `cli` is the explicit escape hatch for the one collision a dispatcher that reserves a subcommand name necessarily has: a leading bare `mcp` is intercepted as "launch the server", so targeting a CLI command on a file literally named `mcp` needs `documents.js cli mcp`. document-cli's own commands never start with `mcp`, so the collision is narrow in practice — the same "dispatcher reserves a subcommand name" model `git` uses.
|
|
12
12
|
*/
|
|
13
13
|
declare function resolveBinDispatch(argv: readonly string[], userAgent: string | undefined): BinDispatch;
|
|
14
14
|
//#endregion
|
package/dist/bin-dispatch.js
CHANGED
|
@@ -25,7 +25,7 @@ function detectPackageManager(userAgent) {
|
|
|
25
25
|
return "npm";
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
* Resolves a launcher invocation into the companion package to run and the runner argument list to spawn it with. A bare invocation or any args that are not the `mcp` dispatch token run the interactive CLI; `mcp` launches the server. `cli` is the explicit escape hatch for the one collision a dispatcher that reserves a subcommand name necessarily has: a leading bare `mcp` is intercepted as "launch the server", so targeting a CLI command on a file literally named `mcp` needs `documents.js cli mcp`. document-cli's own commands never start with `mcp`, so the collision is narrow in practice
|
|
28
|
+
* Resolves a launcher invocation into the companion package to run and the runner argument list to spawn it with. A bare invocation or any args that are not the `mcp` dispatch token run the interactive CLI; `mcp` launches the server. `cli` is the explicit escape hatch for the one collision a dispatcher that reserves a subcommand name necessarily has: a leading bare `mcp` is intercepted as "launch the server", so targeting a CLI command on a file literally named `mcp` needs `documents.js cli mcp`. document-cli's own commands never start with `mcp`, so the collision is narrow in practice — the same "dispatcher reserves a subcommand name" model `git` uses.
|
|
29
29
|
*/
|
|
30
30
|
function resolveBinDispatch(argv, userAgent) {
|
|
31
31
|
const head = argv[0];
|
|
@@ -99,7 +99,7 @@ function latin1ToBytes(text) {
|
|
|
99
99
|
const bytes = new Uint8Array(text.length);
|
|
100
100
|
for (let index = 0; index < text.length; index += 1) {
|
|
101
101
|
const code = text.charCodeAt(index);
|
|
102
|
-
if (code > 255) throw new TypeError(`latin1ToBytes: character at index ${String(index)} is U+${code.toString(16).toUpperCase().padStart(4, "0")}, above U+00FF
|
|
102
|
+
if (code > 255) throw new TypeError(`latin1ToBytes: character at index ${String(index)} is U+${code.toString(16).toUpperCase().padStart(4, "0")}, above U+00FF — this string no longer holds the file's original bytes`);
|
|
103
103
|
bytes[index] = code;
|
|
104
104
|
}
|
|
105
105
|
return bytes;
|
|
@@ -98,7 +98,7 @@ function latin1ToBytes(text) {
|
|
|
98
98
|
const bytes = new Uint8Array(text.length);
|
|
99
99
|
for (let index = 0; index < text.length; index += 1) {
|
|
100
100
|
const code = text.charCodeAt(index);
|
|
101
|
-
if (code > 255) throw new TypeError(`latin1ToBytes: character at index ${String(index)} is U+${code.toString(16).toUpperCase().padStart(4, "0")}, above U+00FF
|
|
101
|
+
if (code > 255) throw new TypeError(`latin1ToBytes: character at index ${String(index)} is U+${code.toString(16).toUpperCase().padStart(4, "0")}, above U+00FF — this string no longer holds the file's original bytes`);
|
|
102
102
|
bytes[index] = code;
|
|
103
103
|
}
|
|
104
104
|
return bytes;
|
package/dist/convert/convert.cjs
CHANGED
|
@@ -188,7 +188,7 @@ function markdownToCsv(bytes, options) {
|
|
|
188
188
|
var OdmUnresolvedSectionError = class extends Error {
|
|
189
189
|
hrefs;
|
|
190
190
|
constructor(hrefs) {
|
|
191
|
-
super(`odmToPdf: ${hrefs.length} chapter section(s) could not be resolved
|
|
191
|
+
super(`odmToPdf: ${hrefs.length} chapter section(s) could not be resolved — no inline content and no resolveSubDocument result for: ${hrefs.join(", ")}`);
|
|
192
192
|
this.name = "OdmUnresolvedSectionError";
|
|
193
193
|
this.hrefs = hrefs;
|
|
194
194
|
}
|
package/dist/convert/convert.js
CHANGED
|
@@ -187,7 +187,7 @@ function markdownToCsv(bytes, options) {
|
|
|
187
187
|
var OdmUnresolvedSectionError = class extends Error {
|
|
188
188
|
hrefs;
|
|
189
189
|
constructor(hrefs) {
|
|
190
|
-
super(`odmToPdf: ${hrefs.length} chapter section(s) could not be resolved
|
|
190
|
+
super(`odmToPdf: ${hrefs.length} chapter section(s) could not be resolved — no inline content and no resolveSubDocument result for: ${hrefs.join(", ")}`);
|
|
191
191
|
this.name = "OdmUnresolvedSectionError";
|
|
192
192
|
this.hrefs = hrefs;
|
|
193
193
|
}
|
|
@@ -17,7 +17,7 @@ function isFontSourceFormat(format) {
|
|
|
17
17
|
var UnsupportedFontSourceFormatError = class extends Error {
|
|
18
18
|
format;
|
|
19
19
|
constructor(format) {
|
|
20
|
-
super(`'${format}' documents carry no source-embedded font faces to extract
|
|
20
|
+
super(`'${format}' documents carry no source-embedded font faces to extract — expected one of docx, pptx, odt, odp, ods, odg`);
|
|
21
21
|
this.name = "UnsupportedFontSourceFormatError";
|
|
22
22
|
this.format = format;
|
|
23
23
|
}
|
|
@@ -16,7 +16,7 @@ function isFontSourceFormat(format) {
|
|
|
16
16
|
var UnsupportedFontSourceFormatError = class extends Error {
|
|
17
17
|
format;
|
|
18
18
|
constructor(format) {
|
|
19
|
-
super(`'${format}' documents carry no source-embedded font faces to extract
|
|
19
|
+
super(`'${format}' documents carry no source-embedded font faces to extract — expected one of docx, pptx, odt, odp, ods, odg`);
|
|
20
20
|
this.name = "UnsupportedFontSourceFormatError";
|
|
21
21
|
this.format = format;
|
|
22
22
|
}
|
|
@@ -15,7 +15,7 @@ let pdf_codec = require("pdf-codec");
|
|
|
15
15
|
//#region src/convert/from-package.ts
|
|
16
16
|
function buildDocumentBytes(pkg, target) {
|
|
17
17
|
if (target === "pdf") {
|
|
18
|
-
if (pkg.pages === void 0) throw new Error("this DocumentTree has no pages
|
|
18
|
+
if (pkg.pages === void 0) throw new Error("this DocumentTree has no pages — only a package dumped from a <format>-to-pdf or pdf-to-<format> conversion carries them; a bridge conversion's own dump (e.g. odt-to-docx) never does, so 'pdf' is not a reachable target from it");
|
|
19
19
|
const { document: layout, formulas, fonts } = packageToLayout(pkg);
|
|
20
20
|
return (0, pdf_codec.writePdf)(layout, formulas.length > 0 ? {
|
|
21
21
|
formulas,
|
|
@@ -24,7 +24,7 @@ function buildDocumentBytes(pkg, target) {
|
|
|
24
24
|
}
|
|
25
25
|
if (require_convert_capability.READ_ONLY_FORMATS.has(target)) throw new Error(`'${target}' is a read-only format: it cannot be built from a DocumentTree, because there is no ContentDocument-to-${target} builder`);
|
|
26
26
|
const content = require_codecs_registry.DOCUMENT_FORMAT_CODECS[target].content;
|
|
27
|
-
if (!content?.write) throw new Error(`DocumentFormat '${target}' has no content.write codec in DOCUMENT_FORMAT_CODECS, is not 'pdf', and is not read-only
|
|
27
|
+
if (!content?.write) throw new Error(`DocumentFormat '${target}' has no content.write codec in DOCUMENT_FORMAT_CODECS, is not 'pdf', and is not read-only — this is an internal invariant violation, not a caller error`);
|
|
28
28
|
return require_model_bytes.requireArrayBufferBytes(content.write((0, document_schema_js.flattenTree)(pkg)));
|
|
29
29
|
}
|
|
30
30
|
function pageOfFrame(state, frame) {
|
|
@@ -14,7 +14,7 @@ import { LAYOUT_FORMAT_VERSION, createFontMeasurer, createFontRegistry, loadMath
|
|
|
14
14
|
//#region src/convert/from-package.ts
|
|
15
15
|
function buildDocumentBytes(pkg, target) {
|
|
16
16
|
if (target === "pdf") {
|
|
17
|
-
if (pkg.pages === void 0) throw new Error("this DocumentTree has no pages
|
|
17
|
+
if (pkg.pages === void 0) throw new Error("this DocumentTree has no pages — only a package dumped from a <format>-to-pdf or pdf-to-<format> conversion carries them; a bridge conversion's own dump (e.g. odt-to-docx) never does, so 'pdf' is not a reachable target from it");
|
|
18
18
|
const { document: layout, formulas, fonts } = packageToLayout(pkg);
|
|
19
19
|
return writePdf(layout, formulas.length > 0 ? {
|
|
20
20
|
formulas,
|
|
@@ -23,7 +23,7 @@ function buildDocumentBytes(pkg, target) {
|
|
|
23
23
|
}
|
|
24
24
|
if (READ_ONLY_FORMATS.has(target)) throw new Error(`'${target}' is a read-only format: it cannot be built from a DocumentTree, because there is no ContentDocument-to-${target} builder`);
|
|
25
25
|
const content = DOCUMENT_FORMAT_CODECS[target].content;
|
|
26
|
-
if (!content?.write) throw new Error(`DocumentFormat '${target}' has no content.write codec in DOCUMENT_FORMAT_CODECS, is not 'pdf', and is not read-only
|
|
26
|
+
if (!content?.write) throw new Error(`DocumentFormat '${target}' has no content.write codec in DOCUMENT_FORMAT_CODECS, is not 'pdf', and is not read-only — this is an internal invariant violation, not a caller error`);
|
|
27
27
|
return requireArrayBufferBytes(content.write(flattenTree(pkg)));
|
|
28
28
|
}
|
|
29
29
|
function pageOfFrame(state, frame) {
|
package/dist/csv/write.cjs
CHANGED
|
@@ -12,7 +12,7 @@ var CsvUnsupportedDocumentKindError = class extends Error {
|
|
|
12
12
|
var CsvSheetNotSpecifiedError = class extends Error {
|
|
13
13
|
availableSheets;
|
|
14
14
|
constructor(availableSheets) {
|
|
15
|
-
super(`buildCsvText: this document has more than one sheet (${availableSheets.join(", ")})
|
|
15
|
+
super(`buildCsvText: this document has more than one sheet (${availableSheets.join(", ")}) — pass { sheet: '<name>' } to select one`);
|
|
16
16
|
this.name = "CsvSheetNotSpecifiedError";
|
|
17
17
|
this.availableSheets = availableSheets;
|
|
18
18
|
}
|
|
@@ -21,7 +21,7 @@ var CsvSheetNotFoundError = class extends Error {
|
|
|
21
21
|
sheet;
|
|
22
22
|
availableSheets;
|
|
23
23
|
constructor(sheet, availableSheets) {
|
|
24
|
-
super(`buildCsvText: sheet "${sheet}" not found
|
|
24
|
+
super(`buildCsvText: sheet "${sheet}" not found — available sheet(s): ${availableSheets.length === 0 ? "(none)" : availableSheets.join(", ")}`);
|
|
25
25
|
this.name = "CsvSheetNotFoundError";
|
|
26
26
|
this.sheet = sheet;
|
|
27
27
|
this.availableSheets = availableSheets;
|
package/dist/csv/write.js
CHANGED
|
@@ -11,7 +11,7 @@ var CsvUnsupportedDocumentKindError = class extends Error {
|
|
|
11
11
|
var CsvSheetNotSpecifiedError = class extends Error {
|
|
12
12
|
availableSheets;
|
|
13
13
|
constructor(availableSheets) {
|
|
14
|
-
super(`buildCsvText: this document has more than one sheet (${availableSheets.join(", ")})
|
|
14
|
+
super(`buildCsvText: this document has more than one sheet (${availableSheets.join(", ")}) — pass { sheet: '<name>' } to select one`);
|
|
15
15
|
this.name = "CsvSheetNotSpecifiedError";
|
|
16
16
|
this.availableSheets = availableSheets;
|
|
17
17
|
}
|
|
@@ -20,7 +20,7 @@ var CsvSheetNotFoundError = class extends Error {
|
|
|
20
20
|
sheet;
|
|
21
21
|
availableSheets;
|
|
22
22
|
constructor(sheet, availableSheets) {
|
|
23
|
-
super(`buildCsvText: sheet "${sheet}" not found
|
|
23
|
+
super(`buildCsvText: sheet "${sheet}" not found — available sheet(s): ${availableSheets.length === 0 ? "(none)" : availableSheets.join(", ")}`);
|
|
24
24
|
this.name = "CsvSheetNotFoundError";
|
|
25
25
|
this.sheet = sheet;
|
|
26
26
|
this.availableSheets = availableSheets;
|
package/dist/edit/docx/image.cjs
CHANGED
|
@@ -4,7 +4,7 @@ const require_model_units = require("../../model/units.cjs");
|
|
|
4
4
|
const require_opc_media = require("../../opc/media.cjs");
|
|
5
5
|
//#region src/edit/docx/image.ts
|
|
6
6
|
function assertDocxWritableImageFormat(format) {
|
|
7
|
-
if (format === "svg") throw new Error("buildDocxPackage: an image block in svg format has no OOXML blip this writer can produce (WordprocessingML's a:blip only references a raster part Word decodes directly
|
|
7
|
+
if (format === "svg") throw new Error("buildDocxPackage: an image block in svg format has no OOXML blip this writer can produce (WordprocessingML's a:blip only references a raster part Word decodes directly — png/jpeg/gif)");
|
|
8
8
|
}
|
|
9
9
|
const DRAWING_NS = {
|
|
10
10
|
wp: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",
|
package/dist/edit/docx/image.js
CHANGED
|
@@ -3,7 +3,7 @@ import { ptToEmu } from "../../model/units.js";
|
|
|
3
3
|
import { addImageMedia } from "../../opc/media.js";
|
|
4
4
|
//#region src/edit/docx/image.ts
|
|
5
5
|
function assertDocxWritableImageFormat(format) {
|
|
6
|
-
if (format === "svg") throw new Error("buildDocxPackage: an image block in svg format has no OOXML blip this writer can produce (WordprocessingML's a:blip only references a raster part Word decodes directly
|
|
6
|
+
if (format === "svg") throw new Error("buildDocxPackage: an image block in svg format has no OOXML blip this writer can produce (WordprocessingML's a:blip only references a raster part Word decodes directly — png/jpeg/gif)");
|
|
7
7
|
}
|
|
8
8
|
const DRAWING_NS = {
|
|
9
9
|
wp: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",
|
|
@@ -204,7 +204,7 @@ var DocxParagraph = class {
|
|
|
204
204
|
if (existing !== void 0) require_xml_edit.removeChild(pPr.children, existing);
|
|
205
205
|
return;
|
|
206
206
|
}
|
|
207
|
-
if (value.numId === void 0) throw new Error("DocxParagraph.list requires a numId
|
|
207
|
+
if (value.numId === void 0) throw new Error("DocxParagraph.list requires a numId — buildDocxPackage mints one for memberships that lack it; set numId explicitly (see src/edit/docx/numbering.ts)");
|
|
208
208
|
const numPr = require_xml_edit.getOrCreateChildElement(pPr, "w:numPr", require_edit_docx_props.PPR_ORDER, () => require_xml_fragment.el("w:numPr"));
|
|
209
209
|
numPr.children = [require_xml_fragment.el("w:ilvl", { "w:val": String(value.level) }), require_xml_fragment.el("w:numId", { "w:val": value.numId })];
|
|
210
210
|
}
|
|
@@ -203,7 +203,7 @@ var DocxParagraph = class {
|
|
|
203
203
|
if (existing !== void 0) removeChild(pPr.children, existing);
|
|
204
204
|
return;
|
|
205
205
|
}
|
|
206
|
-
if (value.numId === void 0) throw new Error("DocxParagraph.list requires a numId
|
|
206
|
+
if (value.numId === void 0) throw new Error("DocxParagraph.list requires a numId — buildDocxPackage mints one for memberships that lack it; set numId explicitly (see src/edit/docx/numbering.ts)");
|
|
207
207
|
const numPr = getOrCreateChildElement(pPr, "w:numPr", PPR_ORDER, () => el("w:numPr"));
|
|
208
208
|
numPr.children = [el("w:ilvl", { "w:val": String(value.level) }), el("w:numId", { "w:val": value.numId })];
|
|
209
209
|
}
|
package/dist/edit/ods/sheet.cjs
CHANGED
|
@@ -65,7 +65,7 @@ var OdsSheet = class {
|
|
|
65
65
|
cell(row, column) {
|
|
66
66
|
const tableElement = this.live();
|
|
67
67
|
const node = require_edit_ods_address.resolveCellNode(tableElement, row, column);
|
|
68
|
-
if (node.tag === "table:covered-table-cell") throw new Error(`cell (${row}, ${column}) is covered by a merged range
|
|
68
|
+
if (node.tag === "table:covered-table-cell") throw new Error(`cell (${row}, ${column}) is covered by a merged range — address the merge's own anchor cell instead`);
|
|
69
69
|
require_edit_ods_column_row.ensureColumnDefaultWidth(this.pkg, tableElement, column);
|
|
70
70
|
require_edit_ods_column_row.ensureRowDefaultHeight(this.pkg, tableElement, row);
|
|
71
71
|
return new require_edit_ods_cell.OdsCell(node, this.pkg);
|
package/dist/edit/ods/sheet.js
CHANGED
|
@@ -64,7 +64,7 @@ var OdsSheet = class {
|
|
|
64
64
|
cell(row, column) {
|
|
65
65
|
const tableElement = this.live();
|
|
66
66
|
const node = resolveCellNode(tableElement, row, column);
|
|
67
|
-
if (node.tag === "table:covered-table-cell") throw new Error(`cell (${row}, ${column}) is covered by a merged range
|
|
67
|
+
if (node.tag === "table:covered-table-cell") throw new Error(`cell (${row}, ${column}) is covered by a merged range — address the merge's own anchor cell instead`);
|
|
68
68
|
ensureColumnDefaultWidth(this.pkg, tableElement, column);
|
|
69
69
|
ensureRowDefaultHeight(this.pkg, tableElement, row);
|
|
70
70
|
return new OdsCell(node, this.pkg);
|
|
@@ -45,7 +45,7 @@ function appendShape(slide, shape, options) {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
if (shape.blocks.length === 1 && onlyBlock?.kind === "image") {
|
|
48
|
-
if (onlyBlock.format === "svg") throw new Error("buildPptxPackage: an image block in svg format has no OOXML blip this writer can produce (PresentationML's a:blip only references a raster part PowerPoint decodes directly
|
|
48
|
+
if (onlyBlock.format === "svg") throw new Error("buildPptxPackage: an image block in svg format has no OOXML blip this writer can produce (PresentationML's a:blip only references a raster part PowerPoint decodes directly — png/jpeg/gif)");
|
|
49
49
|
const imageShape = slide.addImage({
|
|
50
50
|
frame: shape.frame,
|
|
51
51
|
format: onlyBlock.format,
|
|
@@ -44,7 +44,7 @@ function appendShape(slide, shape, options) {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
if (shape.blocks.length === 1 && onlyBlock?.kind === "image") {
|
|
47
|
-
if (onlyBlock.format === "svg") throw new Error("buildPptxPackage: an image block in svg format has no OOXML blip this writer can produce (PresentationML's a:blip only references a raster part PowerPoint decodes directly
|
|
47
|
+
if (onlyBlock.format === "svg") throw new Error("buildPptxPackage: an image block in svg format has no OOXML blip this writer can produce (PresentationML's a:blip only references a raster part PowerPoint decodes directly — png/jpeg/gif)");
|
|
48
48
|
const imageShape = slide.addImage({
|
|
49
49
|
frame: shape.frame,
|
|
50
50
|
format: onlyBlock.format,
|
package/dist/firebird/backup.cjs
CHANGED
|
@@ -61,7 +61,7 @@ function readBurpHeader(reader) {
|
|
|
61
61
|
default: reader.skipAttributeValue();
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
if (backupFormatVersion === void 0) throw new FirebirdBackupFormatError("the leading rec_burp record had no att_backup_format attribute
|
|
64
|
+
if (backupFormatVersion === void 0) throw new FirebirdBackupFormatError("the leading rec_burp record had no att_backup_format attribute — not a recognisable gbak backup stream");
|
|
65
65
|
return {
|
|
66
66
|
backupFormatVersion,
|
|
67
67
|
transportable,
|
|
@@ -88,10 +88,10 @@ function relationToColumns(relation) {
|
|
|
88
88
|
function readFirebirdBackup(bytes) {
|
|
89
89
|
const reader = new require_firebird_reader.FirebirdBackupReader(bytes);
|
|
90
90
|
const leadingRecordType = reader.readTag();
|
|
91
|
-
if (leadingRecordType !== 0) throw new FirebirdBackupFormatError(`expected the stream to open with rec_burp (tag 0), found tag ${leadingRecordType}
|
|
91
|
+
if (leadingRecordType !== 0) throw new FirebirdBackupFormatError(`expected the stream to open with rec_burp (tag 0), found tag ${leadingRecordType} — not a recognisable gbak backup stream`);
|
|
92
92
|
const { backupFormatVersion, transportable, compressed } = readBurpHeader(reader);
|
|
93
|
-
if (backupFormatVersion !== 10) throw new FirebirdBackupFormatError(`backup format version ${backupFormatVersion} is not supported
|
|
94
|
-
if (!transportable) throw new FirebirdBackupFormatError("backup is in non-transportable (native binary) row format (att_backup_transportable=false)
|
|
93
|
+
if (backupFormatVersion !== 10) throw new FirebirdBackupFormatError(`backup format version ${backupFormatVersion} is not supported — this reader has only been built and verified against format version 10 (Firebird 3.0-era gbak output). Refusing to guess at a different format's own attribute/record shape rather than risk silently misdecoding it.`);
|
|
94
|
+
if (!transportable) throw new FirebirdBackupFormatError("backup is in non-transportable (native binary) row format (att_backup_transportable=false) — this reader only decodes the transportable/XDR row encoding, the one every real fixture it was built against actually uses (gbak's own default).");
|
|
95
95
|
let pageSizeBytes;
|
|
96
96
|
const schema = /* @__PURE__ */ new Map();
|
|
97
97
|
const relationsInOrder = [];
|
package/dist/firebird/backup.js
CHANGED
|
@@ -60,7 +60,7 @@ function readBurpHeader(reader) {
|
|
|
60
60
|
default: reader.skipAttributeValue();
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
if (backupFormatVersion === void 0) throw new FirebirdBackupFormatError("the leading rec_burp record had no att_backup_format attribute
|
|
63
|
+
if (backupFormatVersion === void 0) throw new FirebirdBackupFormatError("the leading rec_burp record had no att_backup_format attribute — not a recognisable gbak backup stream");
|
|
64
64
|
return {
|
|
65
65
|
backupFormatVersion,
|
|
66
66
|
transportable,
|
|
@@ -87,10 +87,10 @@ function relationToColumns(relation) {
|
|
|
87
87
|
function readFirebirdBackup(bytes) {
|
|
88
88
|
const reader = new FirebirdBackupReader(bytes);
|
|
89
89
|
const leadingRecordType = reader.readTag();
|
|
90
|
-
if (leadingRecordType !== 0) throw new FirebirdBackupFormatError(`expected the stream to open with rec_burp (tag 0), found tag ${leadingRecordType}
|
|
90
|
+
if (leadingRecordType !== 0) throw new FirebirdBackupFormatError(`expected the stream to open with rec_burp (tag 0), found tag ${leadingRecordType} — not a recognisable gbak backup stream`);
|
|
91
91
|
const { backupFormatVersion, transportable, compressed } = readBurpHeader(reader);
|
|
92
|
-
if (backupFormatVersion !== 10) throw new FirebirdBackupFormatError(`backup format version ${backupFormatVersion} is not supported
|
|
93
|
-
if (!transportable) throw new FirebirdBackupFormatError("backup is in non-transportable (native binary) row format (att_backup_transportable=false)
|
|
92
|
+
if (backupFormatVersion !== 10) throw new FirebirdBackupFormatError(`backup format version ${backupFormatVersion} is not supported — this reader has only been built and verified against format version 10 (Firebird 3.0-era gbak output). Refusing to guess at a different format's own attribute/record shape rather than risk silently misdecoding it.`);
|
|
93
|
+
if (!transportable) throw new FirebirdBackupFormatError("backup is in non-transportable (native binary) row format (att_backup_transportable=false) — this reader only decodes the transportable/XDR row encoding, the one every real fixture it was built against actually uses (gbak's own default).");
|
|
94
94
|
let pageSizeBytes;
|
|
95
95
|
const schema = /* @__PURE__ */ new Map();
|
|
96
96
|
const relationsInOrder = [];
|
package/dist/firebird/data.cjs
CHANGED
|
@@ -22,7 +22,7 @@ var FirebirdDataParseError = class extends Error {
|
|
|
22
22
|
var FirebirdCompositeRecordUnsupportedError = class extends Error {
|
|
23
23
|
recordType;
|
|
24
24
|
constructor(recordType, context) {
|
|
25
|
-
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)
|
|
25
|
+
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`);
|
|
26
26
|
this.name = "FirebirdCompositeRecordUnsupportedError";
|
|
27
27
|
this.recordType = recordType;
|
|
28
28
|
}
|
|
@@ -198,7 +198,7 @@ function decodeRowValues(fields, payload) {
|
|
|
198
198
|
case "int128":
|
|
199
199
|
case "dec64":
|
|
200
200
|
case "dec128":
|
|
201
|
-
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)
|
|
201
|
+
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`);
|
|
202
202
|
}
|
|
203
203
|
for (let i = 0; i < storedFields.length; i++) if (xdr.readInt16() !== 0) rawValues[i] = { kind: "empty" };
|
|
204
204
|
return rawValues.map((value) => value ?? { kind: "empty" });
|
package/dist/firebird/data.js
CHANGED
|
@@ -21,7 +21,7 @@ var FirebirdDataParseError = class extends Error {
|
|
|
21
21
|
var FirebirdCompositeRecordUnsupportedError = class extends Error {
|
|
22
22
|
recordType;
|
|
23
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)
|
|
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
25
|
this.name = "FirebirdCompositeRecordUnsupportedError";
|
|
26
26
|
this.recordType = recordType;
|
|
27
27
|
}
|
|
@@ -197,7 +197,7 @@ function decodeRowValues(fields, payload) {
|
|
|
197
197
|
case "int128":
|
|
198
198
|
case "dec64":
|
|
199
199
|
case "dec128":
|
|
200
|
-
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)
|
|
200
|
+
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`);
|
|
201
201
|
}
|
|
202
202
|
for (let i = 0; i < storedFields.length; i++) if (xdr.readInt16() !== 0) rawValues[i] = { kind: "empty" };
|
|
203
203
|
return rawValues.map((value) => value ?? { kind: "empty" });
|
|
@@ -72,14 +72,14 @@ function readResultMetaData(reader) {
|
|
|
72
72
|
function readDdlStatements(reader) {
|
|
73
73
|
const recordStart = reader.position;
|
|
74
74
|
const recordLength = reader.readInt32("the leading DDL result record's own length");
|
|
75
|
-
if (recordLength <= 4) throw new HsqldbBinaryScriptParseError(`the leading DDL result record declares an implausible length ${recordLength}
|
|
75
|
+
if (recordLength <= 4) throw new HsqldbBinaryScriptParseError(`the leading DDL result record declares an implausible length ${recordLength} — not a recognisable HSQLDB binary script`, recordStart);
|
|
76
76
|
const mode = reader.readInt32("the DDL result's own mode");
|
|
77
|
-
if (mode !== RESULT_MODE_DATA) throw new HsqldbBinaryScriptParseError(`the leading record has Result mode ${mode}, not the DATA mode (${RESULT_MODE_DATA}) a script's own DDL result always carries
|
|
77
|
+
if (mode !== RESULT_MODE_DATA) throw new HsqldbBinaryScriptParseError(`the leading record has Result mode ${mode}, not the DATA mode (${RESULT_MODE_DATA}) a script's own DDL result always carries — not a recognisable HSQLDB binary script`, recordStart);
|
|
78
78
|
reader.readInt32("the DDL result's own database id");
|
|
79
79
|
reader.readInt32("the DDL result's own session id");
|
|
80
80
|
const columnTypes = readResultMetaData(reader);
|
|
81
81
|
const firstColumnType = columnTypes[0];
|
|
82
|
-
if (columnTypes.length !== 1 || firstColumnType !== SQL_TYPE_VARCHAR) throw new HsqldbBinaryScriptParseError(`the DDL result has ${columnTypes.length} column(s) of type [${columnTypes.join(", ")}]
|
|
82
|
+
if (columnTypes.length !== 1 || firstColumnType !== SQL_TYPE_VARCHAR) throw new HsqldbBinaryScriptParseError(`the DDL result has ${columnTypes.length} column(s) of type [${columnTypes.join(", ")}] — a script's own DDL result is always the single VARCHAR "COMMAND" column DatabaseScript.getScript builds`, recordStart);
|
|
83
83
|
const rowCount = reader.readInt32("the DDL result's own row count");
|
|
84
84
|
if (rowCount < 0) throw new HsqldbBinaryScriptParseError(`the DDL result declares a negative row count ${rowCount}`, reader.position);
|
|
85
85
|
const statements = [];
|
|
@@ -71,14 +71,14 @@ function readResultMetaData(reader) {
|
|
|
71
71
|
function readDdlStatements(reader) {
|
|
72
72
|
const recordStart = reader.position;
|
|
73
73
|
const recordLength = reader.readInt32("the leading DDL result record's own length");
|
|
74
|
-
if (recordLength <= 4) throw new HsqldbBinaryScriptParseError(`the leading DDL result record declares an implausible length ${recordLength}
|
|
74
|
+
if (recordLength <= 4) throw new HsqldbBinaryScriptParseError(`the leading DDL result record declares an implausible length ${recordLength} — not a recognisable HSQLDB binary script`, recordStart);
|
|
75
75
|
const mode = reader.readInt32("the DDL result's own mode");
|
|
76
|
-
if (mode !== RESULT_MODE_DATA) throw new HsqldbBinaryScriptParseError(`the leading record has Result mode ${mode}, not the DATA mode (${RESULT_MODE_DATA}) a script's own DDL result always carries
|
|
76
|
+
if (mode !== RESULT_MODE_DATA) throw new HsqldbBinaryScriptParseError(`the leading record has Result mode ${mode}, not the DATA mode (${RESULT_MODE_DATA}) a script's own DDL result always carries — not a recognisable HSQLDB binary script`, recordStart);
|
|
77
77
|
reader.readInt32("the DDL result's own database id");
|
|
78
78
|
reader.readInt32("the DDL result's own session id");
|
|
79
79
|
const columnTypes = readResultMetaData(reader);
|
|
80
80
|
const firstColumnType = columnTypes[0];
|
|
81
|
-
if (columnTypes.length !== 1 || firstColumnType !== SQL_TYPE_VARCHAR) throw new HsqldbBinaryScriptParseError(`the DDL result has ${columnTypes.length} column(s) of type [${columnTypes.join(", ")}]
|
|
81
|
+
if (columnTypes.length !== 1 || firstColumnType !== SQL_TYPE_VARCHAR) throw new HsqldbBinaryScriptParseError(`the DDL result has ${columnTypes.length} column(s) of type [${columnTypes.join(", ")}] — a script's own DDL result is always the single VARCHAR "COMMAND" column DatabaseScript.getScript builds`, recordStart);
|
|
82
82
|
const rowCount = reader.readInt32("the DDL result's own row count");
|
|
83
83
|
if (rowCount < 0) throw new HsqldbBinaryScriptParseError(`the DDL result declares a negative row count ${rowCount}`, reader.position);
|
|
84
84
|
const statements = [];
|
package/dist/hsqldb/cache.cjs
CHANGED
|
@@ -13,7 +13,7 @@ function parseHsqldbProperties(text) {
|
|
|
13
13
|
props.set(line.slice(0, eq).trim(), line.slice(eq + 1).trim());
|
|
14
14
|
}
|
|
15
15
|
const compatibleVersion = props.get("hsqldb.compatible_version");
|
|
16
|
-
if (compatibleVersion !== void 0 && !SUPPORTED_COMPATIBLE_VERSION_PREFIXES.some((prefix) => compatibleVersion.startsWith(prefix))) throw new require_hsqldb_rowformat.HsqldbRowFormatError(`database/properties declares hsqldb.compatible_version "${compatibleVersion}"
|
|
16
|
+
if (compatibleVersion !== void 0 && !SUPPORTED_COMPATIBLE_VERSION_PREFIXES.some((prefix) => compatibleVersion.startsWith(prefix))) throw new require_hsqldb_rowformat.HsqldbRowFormatError(`database/properties declares hsqldb.compatible_version "${compatibleVersion}" — this decoder is scoped to the HSQLDB 1.7.x/1.8.x CACHED-table row-store format (the version LibreOffice's own embedded driver ships) and does not know this version's own on-disk row-store layout`);
|
|
17
17
|
return {
|
|
18
18
|
cacheFileScale: Number(props.get("hsqldb.cache_file_scale") ?? "1") === 1 ? 1 : 8,
|
|
19
19
|
compatibleVersion
|
|
@@ -33,7 +33,7 @@ function parseHsqldbIndexRoots(scriptText) {
|
|
|
33
33
|
const tokensText = match[2] ?? "";
|
|
34
34
|
const tableName = unquoteIdentifier(rawName).toUpperCase();
|
|
35
35
|
const tokens = tokensText.trim().length === 0 ? [] : tokensText.trim().split(/\s+/);
|
|
36
|
-
if (tokens.length < 2) throw new require_hsqldb_rowformat.HsqldbRowFormatError(`table "${tableName}"'s SET TABLE...INDEX line has ${tokens.length} token(s)
|
|
36
|
+
if (tokens.length < 2) throw new require_hsqldb_rowformat.HsqldbRowFormatError(`table "${tableName}"'s SET TABLE...INDEX line has ${tokens.length} token(s) — every such line carries at least one index root position followed by the table's own identity-sequence value`);
|
|
37
37
|
const indexCount = tokens.length - 1;
|
|
38
38
|
const rootToken = tokens[0] ?? "";
|
|
39
39
|
const rootPosition = Number(rootToken);
|
package/dist/hsqldb/cache.js
CHANGED
|
@@ -12,7 +12,7 @@ function parseHsqldbProperties(text) {
|
|
|
12
12
|
props.set(line.slice(0, eq).trim(), line.slice(eq + 1).trim());
|
|
13
13
|
}
|
|
14
14
|
const compatibleVersion = props.get("hsqldb.compatible_version");
|
|
15
|
-
if (compatibleVersion !== void 0 && !SUPPORTED_COMPATIBLE_VERSION_PREFIXES.some((prefix) => compatibleVersion.startsWith(prefix))) throw new HsqldbRowFormatError(`database/properties declares hsqldb.compatible_version "${compatibleVersion}"
|
|
15
|
+
if (compatibleVersion !== void 0 && !SUPPORTED_COMPATIBLE_VERSION_PREFIXES.some((prefix) => compatibleVersion.startsWith(prefix))) throw new HsqldbRowFormatError(`database/properties declares hsqldb.compatible_version "${compatibleVersion}" — this decoder is scoped to the HSQLDB 1.7.x/1.8.x CACHED-table row-store format (the version LibreOffice's own embedded driver ships) and does not know this version's own on-disk row-store layout`);
|
|
16
16
|
return {
|
|
17
17
|
cacheFileScale: Number(props.get("hsqldb.cache_file_scale") ?? "1") === 1 ? 1 : 8,
|
|
18
18
|
compatibleVersion
|
|
@@ -32,7 +32,7 @@ function parseHsqldbIndexRoots(scriptText) {
|
|
|
32
32
|
const tokensText = match[2] ?? "";
|
|
33
33
|
const tableName = unquoteIdentifier(rawName).toUpperCase();
|
|
34
34
|
const tokens = tokensText.trim().length === 0 ? [] : tokensText.trim().split(/\s+/);
|
|
35
|
-
if (tokens.length < 2) throw new HsqldbRowFormatError(`table "${tableName}"'s SET TABLE...INDEX line has ${tokens.length} token(s)
|
|
35
|
+
if (tokens.length < 2) throw new HsqldbRowFormatError(`table "${tableName}"'s SET TABLE...INDEX line has ${tokens.length} token(s) — every such line carries at least one index root position followed by the table's own identity-sequence value`);
|
|
36
36
|
const indexCount = tokens.length - 1;
|
|
37
37
|
const rootToken = tokens[0] ?? "";
|
|
38
38
|
const rootPosition = Number(rootToken);
|
|
@@ -41,9 +41,9 @@ const LEADING_WORD_RE = /^([A-Za-z_][A-Za-z0-9_]*)/;
|
|
|
41
41
|
function resolveHsqldbTypeCode(declaredType) {
|
|
42
42
|
const word = LEADING_WORD_RE.exec(declaredType.trim())?.[1]?.toUpperCase();
|
|
43
43
|
if (word === void 0) throw new HsqldbRowFormatError(`cannot resolve a SQL type name from column type clause "${declaredType}"`);
|
|
44
|
-
if (UNSUPPORTED_SQL_TYPE_NAMES.has(word)) throw new HsqldbRowFormatError(`column type "${word}" has no document-schema.js ContentCellValue equivalent (binary/object column types are not representable)
|
|
44
|
+
if (UNSUPPORTED_SQL_TYPE_NAMES.has(word)) throw new HsqldbRowFormatError(`column type "${word}" has no document-schema.js ContentCellValue equivalent (binary/object column types are not representable) — from declared type "${declaredType}"`);
|
|
45
45
|
const code = SQL_TYPE_NAME_TO_CODE[word];
|
|
46
|
-
if (code === void 0) throw new HsqldbRowFormatError(`unrecognised HSQLDB column type "${word}"
|
|
46
|
+
if (code === void 0) throw new HsqldbRowFormatError(`unrecognised HSQLDB column type "${word}" — from declared type "${declaredType}"`);
|
|
47
47
|
return code;
|
|
48
48
|
}
|
|
49
49
|
var HsqldbDataCursor = class {
|
package/dist/hsqldb/rowformat.js
CHANGED
|
@@ -40,9 +40,9 @@ const LEADING_WORD_RE = /^([A-Za-z_][A-Za-z0-9_]*)/;
|
|
|
40
40
|
function resolveHsqldbTypeCode(declaredType) {
|
|
41
41
|
const word = LEADING_WORD_RE.exec(declaredType.trim())?.[1]?.toUpperCase();
|
|
42
42
|
if (word === void 0) throw new HsqldbRowFormatError(`cannot resolve a SQL type name from column type clause "${declaredType}"`);
|
|
43
|
-
if (UNSUPPORTED_SQL_TYPE_NAMES.has(word)) throw new HsqldbRowFormatError(`column type "${word}" has no document-schema.js ContentCellValue equivalent (binary/object column types are not representable)
|
|
43
|
+
if (UNSUPPORTED_SQL_TYPE_NAMES.has(word)) throw new HsqldbRowFormatError(`column type "${word}" has no document-schema.js ContentCellValue equivalent (binary/object column types are not representable) — from declared type "${declaredType}"`);
|
|
44
44
|
const code = SQL_TYPE_NAME_TO_CODE[word];
|
|
45
|
-
if (code === void 0) throw new HsqldbRowFormatError(`unrecognised HSQLDB column type "${word}"
|
|
45
|
+
if (code === void 0) throw new HsqldbRowFormatError(`unrecognised HSQLDB column type "${word}" — from declared type "${declaredType}"`);
|
|
46
46
|
return code;
|
|
47
47
|
}
|
|
48
48
|
var HsqldbDataCursor = class {
|
package/dist/hsqldb/script.cjs
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
var HsqldbScriptParseError = class extends Error {
|
|
4
4
|
statement;
|
|
5
5
|
constructor(message, statement) {
|
|
6
|
-
super(`HSQLDB script parse error: ${message}
|
|
6
|
+
super(`HSQLDB script parse error: ${message} — in statement: ${truncateForMessage(statement)}`);
|
|
7
7
|
this.name = "HsqldbScriptParseError";
|
|
8
8
|
this.statement = statement;
|
|
9
9
|
}
|
|
@@ -391,7 +391,7 @@ function parseInsertInto(statement) {
|
|
|
391
391
|
if (statement.charAt(i) !== "(") throw new HsqldbScriptParseError(`INSERT INTO "${tableName}": expected "(" to start the VALUES tuple`, statement);
|
|
392
392
|
const { inner, next: afterTuple } = readBalancedParens(statement, i);
|
|
393
393
|
const trailing = statement.slice(afterTuple).trim();
|
|
394
|
-
if (trailing.length > 0) throw new HsqldbScriptParseError(`INSERT INTO "${tableName}": unexpected trailing content after the VALUES tuple ("${trailing}")
|
|
394
|
+
if (trailing.length > 0) throw new HsqldbScriptParseError(`INSERT INTO "${tableName}": unexpected trailing content after the VALUES tuple ("${trailing}") — multiple tuples per INSERT are outside this bounded parser's scope`, statement);
|
|
395
395
|
return {
|
|
396
396
|
tableName,
|
|
397
397
|
explicitColumns,
|