js.documents 14.1.0 → 14.2.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 +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/convert/variant-bridges.cjs +2 -2
- package/dist/convert/variant-bridges.js +2 -2
- package/dist/csv/write.cjs +2 -2
- package/dist/csv/write.js +2 -2
- package/dist/{diagnostics-9twvwLNY.d.cts → diagnostics-CGWySzd-.d.cts} +1 -0
- package/dist/{diagnostics-9twvwLNY.d.ts → diagnostics-CGWySzd-.d.ts} +1 -0
- package/dist/edit/doc/table.cjs +3 -3
- package/dist/edit/doc/table.js +3 -3
- package/dist/edit/docx/content.cjs +1 -1
- package/dist/edit/docx/content.js +1 -1
- 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/markdown/table.cjs +3 -3
- package/dist/edit/markdown/table.js +3 -3
- package/dist/edit/odp/slide.d.cts +1 -1
- package/dist/edit/odp/slide.d.ts +1 -1
- package/dist/edit/ods/sheet.cjs +1 -1
- package/dist/edit/ods/sheet.js +1 -1
- package/dist/edit/odt/content.cjs +4 -2
- package/dist/edit/odt/content.d.cts +2 -2
- package/dist/edit/odt/content.d.ts +2 -2
- package/dist/edit/odt/content.js +4 -2
- package/dist/edit/odt/editor.d.cts +1 -1
- package/dist/edit/odt/editor.d.ts +1 -1
- package/dist/edit/odt/table.cjs +59 -4
- package/dist/edit/odt/table.d.cts +1 -1
- package/dist/edit/odt/table.d.ts +1 -1
- package/dist/edit/odt/table.js +59 -4
- package/dist/edit/pptx/content.cjs +12 -2
- package/dist/edit/pptx/content.d.cts +1 -1
- package/dist/edit/pptx/content.d.ts +1 -1
- package/dist/edit/pptx/content.js +12 -2
- package/dist/edit/pptx/diagnostics.cjs +4 -1
- package/dist/edit/pptx/diagnostics.d.cts +1 -1
- package/dist/edit/pptx/diagnostics.d.ts +1 -1
- package/dist/edit/pptx/diagnostics.js +4 -1
- package/dist/edit/table-grid.cjs +2 -2
- package/dist/edit/table-grid.js +2 -2
- 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/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/layout/engine.cjs +1 -1
- package/dist/layout/engine.js +1 -1
- package/dist/layout/reconstruct.cjs +6 -6
- package/dist/layout/reconstruct.js +6 -6
- package/dist/layout/shared.cjs +4 -3
- package/dist/layout/shared.js +4 -3
- package/dist/layout/slides.cjs +1 -1
- package/dist/layout/slides.js +1 -1
- package/dist/markdown/render.cjs +3 -3
- package/dist/markdown/render.js +3 -3
- 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/render.cjs +1 -1
- package/dist/odb/report/render.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/dist/{table-Cou5rKOo.d.ts → table-B5htMG3g.d.ts} +2 -0
- package/dist/{table-Bt9ahRyh.d.cts → table-DrE6jEWv.d.cts} +2 -0
- package/package.json +14 -14
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,
|
package/dist/hsqldb/script.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var HsqldbScriptParseError = class extends Error {
|
|
3
3
|
statement;
|
|
4
4
|
constructor(message, statement) {
|
|
5
|
-
super(`HSQLDB script parse error: ${message}
|
|
5
|
+
super(`HSQLDB script parse error: ${message} — in statement: ${truncateForMessage(statement)}`);
|
|
6
6
|
this.name = "HsqldbScriptParseError";
|
|
7
7
|
this.statement = statement;
|
|
8
8
|
}
|
|
@@ -390,7 +390,7 @@ function parseInsertInto(statement) {
|
|
|
390
390
|
if (statement.charAt(i) !== "(") throw new HsqldbScriptParseError(`INSERT INTO "${tableName}": expected "(" to start the VALUES tuple`, statement);
|
|
391
391
|
const { inner, next: afterTuple } = readBalancedParens(statement, i);
|
|
392
392
|
const trailing = statement.slice(afterTuple).trim();
|
|
393
|
-
if (trailing.length > 0) throw new HsqldbScriptParseError(`INSERT INTO "${tableName}": unexpected trailing content after the VALUES tuple ("${trailing}")
|
|
393
|
+
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);
|
|
394
394
|
return {
|
|
395
395
|
tableName,
|
|
396
396
|
explicitColumns,
|
package/dist/index.d.cts
CHANGED
|
@@ -47,7 +47,7 @@ import { OdgPage, PageImageInit, TextBoxInit } from "./edit/odg/page.cjs";
|
|
|
47
47
|
import { CreateOdgOptions, OdgEditor, createOdg, openOdg } from "./edit/odg/editor.cjs";
|
|
48
48
|
import { CreateEmptyOdgPackageOptions } from "./edit/odg/scaffold.cjs";
|
|
49
49
|
import { BuildOdpPackageOptions, buildOdpPackage } from "./edit/odp/content.cjs";
|
|
50
|
-
import { a as OdtTableRow, i as OdtTableCell, n as OdtCoveredTableCell, o as TableInit$2, r as OdtTable } from "./table-
|
|
50
|
+
import { a as OdtTableRow, i as OdtTableCell, n as OdtCoveredTableCell, o as TableInit$2, r as OdtTable } from "./table-DrE6jEWv.cjs";
|
|
51
51
|
import { OdpSlide, SlideImageInit, SlideTableInit, TextBoxInit as TextBoxInit$1 } from "./edit/odp/slide.cjs";
|
|
52
52
|
import { CreateOdpOptions, OdpEditor, createOdp, openOdp } from "./edit/odp/editor.cjs";
|
|
53
53
|
import { CreateEmptyOdpPackageOptions } from "./edit/odp/scaffold.cjs";
|
package/dist/index.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ import { OdgPage, PageImageInit, TextBoxInit } from "./edit/odg/page.js";
|
|
|
47
47
|
import { CreateOdgOptions, OdgEditor, createOdg, openOdg } from "./edit/odg/editor.js";
|
|
48
48
|
import { CreateEmptyOdgPackageOptions } from "./edit/odg/scaffold.js";
|
|
49
49
|
import { BuildOdpPackageOptions, buildOdpPackage } from "./edit/odp/content.js";
|
|
50
|
-
import { a as OdtTableRow, i as OdtTableCell, n as OdtCoveredTableCell, o as TableInit$2, r as OdtTable } from "./table-
|
|
50
|
+
import { a as OdtTableRow, i as OdtTableCell, n as OdtCoveredTableCell, o as TableInit$2, r as OdtTable } from "./table-B5htMG3g.js";
|
|
51
51
|
import { OdpSlide, SlideImageInit, SlideTableInit, TextBoxInit as TextBoxInit$1 } from "./edit/odp/slide.js";
|
|
52
52
|
import { CreateOdpOptions, OdpEditor, createOdp, openOdp } from "./edit/odp/editor.js";
|
|
53
53
|
import { CreateEmptyOdpPackageOptions } from "./edit/odp/scaffold.js";
|
package/dist/layout/engine.cjs
CHANGED
|
@@ -157,7 +157,7 @@ function layoutParagraphInCell(paragraph, cellLeftXDown, cellWidthPt, startYDown
|
|
|
157
157
|
return cursorYDown + (paragraph.spacingAfterPt ?? 0);
|
|
158
158
|
}
|
|
159
159
|
function layoutTableFlow(table, section, pages, state, contentLeftXDown, contentWidthPt, contentBottomYDown, measurer, listCounters) {
|
|
160
|
-
const gridWidthPt = table.
|
|
160
|
+
const gridWidthPt = table.columns.reduce((sum, c) => sum + c.widthPt, 0);
|
|
161
161
|
const scale = gridWidthPt > 0 ? contentWidthPt / gridWidthPt : 1;
|
|
162
162
|
for (const { row, anchors } of require_layout_shared.tableAnchorBoxes(table, scale)) {
|
|
163
163
|
const rowHeightPt = row.heightPt ?? require_layout_shared.estimateRowHeightPt(anchors, measurer);
|
package/dist/layout/engine.js
CHANGED
|
@@ -156,7 +156,7 @@ function layoutParagraphInCell(paragraph, cellLeftXDown, cellWidthPt, startYDown
|
|
|
156
156
|
return cursorYDown + (paragraph.spacingAfterPt ?? 0);
|
|
157
157
|
}
|
|
158
158
|
function layoutTableFlow(table, section, pages, state, contentLeftXDown, contentWidthPt, contentBottomYDown, measurer, listCounters) {
|
|
159
|
-
const gridWidthPt = table.
|
|
159
|
+
const gridWidthPt = table.columns.reduce((sum, c) => sum + c.widthPt, 0);
|
|
160
160
|
const scale = gridWidthPt > 0 ? contentWidthPt / gridWidthPt : 1;
|
|
161
161
|
for (const { row, anchors } of tableAnchorBoxes(table, scale)) {
|
|
162
162
|
const rowHeightPt = row.heightPt ?? estimateRowHeightPt(anchors, measurer);
|
|
@@ -1187,7 +1187,7 @@ function recoverTaggedTables(page, pageIndex, structure) {
|
|
|
1187
1187
|
const rows = [...rowsById.values()].sort((a, b) => a.row.order - b.row.order);
|
|
1188
1188
|
for (const row of rows) row.cells.sort((a, b) => a.cell.order - b.cell.order);
|
|
1189
1189
|
const columnCount = Math.max(...rows.map((row) => row.cells.length));
|
|
1190
|
-
const
|
|
1190
|
+
const columns = [];
|
|
1191
1191
|
for (let j = 0; j < columnCount; j++) {
|
|
1192
1192
|
let minX = Number.POSITIVE_INFINITY;
|
|
1193
1193
|
let maxX = Number.NEGATIVE_INFINITY;
|
|
@@ -1200,7 +1200,7 @@ function recoverTaggedTables(page, pageIndex, structure) {
|
|
|
1200
1200
|
}
|
|
1201
1201
|
}
|
|
1202
1202
|
const width = maxX - minX;
|
|
1203
|
-
|
|
1203
|
+
columns.push({ widthPt: width > 0 ? width : DEFAULT_COLUMN_WIDTH_FALLBACK_PT });
|
|
1204
1204
|
}
|
|
1205
1205
|
const allItems = cells.flatMap((cellEntry) => cellEntry.items);
|
|
1206
1206
|
const contentRows = rows.map((row) => {
|
|
@@ -1217,7 +1217,7 @@ function recoverTaggedTables(page, pageIndex, structure) {
|
|
|
1217
1217
|
const table = {
|
|
1218
1218
|
kind: "table",
|
|
1219
1219
|
rows: contentRows,
|
|
1220
|
-
|
|
1220
|
+
columns
|
|
1221
1221
|
};
|
|
1222
1222
|
require_layout_shared.stampFrame(table, pageIndex, box);
|
|
1223
1223
|
recovered.push({
|
|
@@ -1277,8 +1277,8 @@ function recoverTable(page, pageIndex) {
|
|
|
1277
1277
|
consumedText.add(item);
|
|
1278
1278
|
}
|
|
1279
1279
|
if (consumedText.size === 0) return;
|
|
1280
|
-
const
|
|
1281
|
-
for (let j = 0; j < columnCount; j++)
|
|
1280
|
+
const columns = [];
|
|
1281
|
+
for (let j = 0; j < columnCount; j++) columns.push({ widthPt: lattice.columnBoundariesAscPt[j + 1] - lattice.columnBoundariesAscPt[j] });
|
|
1282
1282
|
const positionedRows = [];
|
|
1283
1283
|
for (let i = 0; i < rowCount; i++) {
|
|
1284
1284
|
const positioned = [];
|
|
@@ -1327,7 +1327,7 @@ function recoverTable(page, pageIndex) {
|
|
|
1327
1327
|
const table = {
|
|
1328
1328
|
kind: "table",
|
|
1329
1329
|
rows,
|
|
1330
|
-
|
|
1330
|
+
columns
|
|
1331
1331
|
};
|
|
1332
1332
|
require_layout_shared.stampFrame(table, pageIndex, pdfBox);
|
|
1333
1333
|
return {
|
|
@@ -1186,7 +1186,7 @@ function recoverTaggedTables(page, pageIndex, structure) {
|
|
|
1186
1186
|
const rows = [...rowsById.values()].sort((a, b) => a.row.order - b.row.order);
|
|
1187
1187
|
for (const row of rows) row.cells.sort((a, b) => a.cell.order - b.cell.order);
|
|
1188
1188
|
const columnCount = Math.max(...rows.map((row) => row.cells.length));
|
|
1189
|
-
const
|
|
1189
|
+
const columns = [];
|
|
1190
1190
|
for (let j = 0; j < columnCount; j++) {
|
|
1191
1191
|
let minX = Number.POSITIVE_INFINITY;
|
|
1192
1192
|
let maxX = Number.NEGATIVE_INFINITY;
|
|
@@ -1199,7 +1199,7 @@ function recoverTaggedTables(page, pageIndex, structure) {
|
|
|
1199
1199
|
}
|
|
1200
1200
|
}
|
|
1201
1201
|
const width = maxX - minX;
|
|
1202
|
-
|
|
1202
|
+
columns.push({ widthPt: width > 0 ? width : DEFAULT_COLUMN_WIDTH_FALLBACK_PT });
|
|
1203
1203
|
}
|
|
1204
1204
|
const allItems = cells.flatMap((cellEntry) => cellEntry.items);
|
|
1205
1205
|
const contentRows = rows.map((row) => {
|
|
@@ -1216,7 +1216,7 @@ function recoverTaggedTables(page, pageIndex, structure) {
|
|
|
1216
1216
|
const table = {
|
|
1217
1217
|
kind: "table",
|
|
1218
1218
|
rows: contentRows,
|
|
1219
|
-
|
|
1219
|
+
columns
|
|
1220
1220
|
};
|
|
1221
1221
|
stampFrame(table, pageIndex, box);
|
|
1222
1222
|
recovered.push({
|
|
@@ -1276,8 +1276,8 @@ function recoverTable(page, pageIndex) {
|
|
|
1276
1276
|
consumedText.add(item);
|
|
1277
1277
|
}
|
|
1278
1278
|
if (consumedText.size === 0) return;
|
|
1279
|
-
const
|
|
1280
|
-
for (let j = 0; j < columnCount; j++)
|
|
1279
|
+
const columns = [];
|
|
1280
|
+
for (let j = 0; j < columnCount; j++) columns.push({ widthPt: lattice.columnBoundariesAscPt[j + 1] - lattice.columnBoundariesAscPt[j] });
|
|
1281
1281
|
const positionedRows = [];
|
|
1282
1282
|
for (let i = 0; i < rowCount; i++) {
|
|
1283
1283
|
const positioned = [];
|
|
@@ -1326,7 +1326,7 @@ function recoverTable(page, pageIndex) {
|
|
|
1326
1326
|
const table = {
|
|
1327
1327
|
kind: "table",
|
|
1328
1328
|
rows,
|
|
1329
|
-
|
|
1329
|
+
columns
|
|
1330
1330
|
};
|
|
1331
1331
|
stampFrame(table, pageIndex, pdfBox);
|
|
1332
1332
|
return {
|
package/dist/layout/shared.cjs
CHANGED
|
@@ -198,7 +198,7 @@ function decodeImageDimensions(format, bytes) {
|
|
|
198
198
|
};
|
|
199
199
|
}
|
|
200
200
|
function registerImage(block, images) {
|
|
201
|
-
if (block.format === "svg" || block.format === "gif") throw new Error(`registerImage: an image block in ${block.format} format cannot be laid out to PDF
|
|
201
|
+
if (block.format === "svg" || block.format === "gif") throw new Error(`registerImage: an image block in ${block.format} format cannot be laid out to PDF — pdf-codec's own LayoutImageAsset registry (and its writer, byte-codec's image encoders) supports png and jpeg only`);
|
|
202
202
|
const bytes = (0, ooxml_js.base64ToBytes)(block.base64);
|
|
203
203
|
const imageId = `img${(0, byte_codec.crc32)(bytes).toString(16)}`;
|
|
204
204
|
if (!(imageId in images)) {
|
|
@@ -221,12 +221,13 @@ function sumColumnWidthsPt(columnWidthsPt, startIndex, span) {
|
|
|
221
221
|
*/
|
|
222
222
|
function tableAnchorBoxes(table, scale) {
|
|
223
223
|
const positionsByRow = (0, document_schema_js.walkTableGrid)(table);
|
|
224
|
+
const columnWidthsPt = table.columns.map((column) => column.widthPt);
|
|
224
225
|
return table.rows.map((row, rowIndex) => ({
|
|
225
226
|
row,
|
|
226
227
|
anchors: positionsByRow[rowIndex].flatMap((position) => position.anchorRowIndex === void 0 ? [{
|
|
227
228
|
cell: position.cell,
|
|
228
|
-
xOffsetPt: sumColumnWidthsPt(
|
|
229
|
-
widthPt: sumColumnWidthsPt(
|
|
229
|
+
xOffsetPt: sumColumnWidthsPt(columnWidthsPt, 0, position.columnIndex) * scale,
|
|
230
|
+
widthPt: sumColumnWidthsPt(columnWidthsPt, position.columnIndex, (0, document_schema_js.tableCellColumnSpan)(position.cell)) * scale
|
|
230
231
|
}] : [])
|
|
231
232
|
}));
|
|
232
233
|
}
|
package/dist/layout/shared.js
CHANGED
|
@@ -197,7 +197,7 @@ function decodeImageDimensions(format, bytes) {
|
|
|
197
197
|
};
|
|
198
198
|
}
|
|
199
199
|
function registerImage(block, images) {
|
|
200
|
-
if (block.format === "svg" || block.format === "gif") throw new Error(`registerImage: an image block in ${block.format} format cannot be laid out to PDF
|
|
200
|
+
if (block.format === "svg" || block.format === "gif") throw new Error(`registerImage: an image block in ${block.format} format cannot be laid out to PDF — pdf-codec's own LayoutImageAsset registry (and its writer, byte-codec's image encoders) supports png and jpeg only`);
|
|
201
201
|
const bytes = base64ToBytes(block.base64);
|
|
202
202
|
const imageId = `img${crc32(bytes).toString(16)}`;
|
|
203
203
|
if (!(imageId in images)) {
|
|
@@ -220,12 +220,13 @@ function sumColumnWidthsPt(columnWidthsPt, startIndex, span) {
|
|
|
220
220
|
*/
|
|
221
221
|
function tableAnchorBoxes(table, scale) {
|
|
222
222
|
const positionsByRow = walkTableGrid(table);
|
|
223
|
+
const columnWidthsPt = table.columns.map((column) => column.widthPt);
|
|
223
224
|
return table.rows.map((row, rowIndex) => ({
|
|
224
225
|
row,
|
|
225
226
|
anchors: positionsByRow[rowIndex].flatMap((position) => position.anchorRowIndex === void 0 ? [{
|
|
226
227
|
cell: position.cell,
|
|
227
|
-
xOffsetPt: sumColumnWidthsPt(
|
|
228
|
-
widthPt: sumColumnWidthsPt(
|
|
228
|
+
xOffsetPt: sumColumnWidthsPt(columnWidthsPt, 0, position.columnIndex) * scale,
|
|
229
|
+
widthPt: sumColumnWidthsPt(columnWidthsPt, position.columnIndex, tableCellColumnSpan(position.cell)) * scale
|
|
229
230
|
}] : [])
|
|
230
231
|
}));
|
|
231
232
|
}
|
package/dist/layout/slides.cjs
CHANGED
|
@@ -79,7 +79,7 @@ function layoutParagraph(paragraph, contentLeftXDown, contentWidthPt, startYDown
|
|
|
79
79
|
}
|
|
80
80
|
function layoutTable(table, contentLeftXDown, contentWidthPt, startYDown, slideHeightPt, pageIndex, placement, measurer, out) {
|
|
81
81
|
let cursorYDown = startYDown;
|
|
82
|
-
const gridWidthPt = table.
|
|
82
|
+
const gridWidthPt = table.columns.reduce((sum, c) => sum + c.widthPt, 0);
|
|
83
83
|
const scale = gridWidthPt > 0 ? contentWidthPt / gridWidthPt : 1;
|
|
84
84
|
for (const { row, anchors } of require_layout_shared.tableAnchorBoxes(table, scale)) {
|
|
85
85
|
const rowHeightPt = row.heightPt ?? require_layout_shared.estimateRowHeightPt(anchors, measurer);
|
package/dist/layout/slides.js
CHANGED
|
@@ -78,7 +78,7 @@ function layoutParagraph(paragraph, contentLeftXDown, contentWidthPt, startYDown
|
|
|
78
78
|
}
|
|
79
79
|
function layoutTable(table, contentLeftXDown, contentWidthPt, startYDown, slideHeightPt, pageIndex, placement, measurer, out) {
|
|
80
80
|
let cursorYDown = startYDown;
|
|
81
|
-
const gridWidthPt = table.
|
|
81
|
+
const gridWidthPt = table.columns.reduce((sum, c) => sum + c.widthPt, 0);
|
|
82
82
|
const scale = gridWidthPt > 0 ? contentWidthPt / gridWidthPt : 1;
|
|
83
83
|
for (const { row, anchors } of tableAnchorBoxes(table, scale)) {
|
|
84
84
|
const rowHeightPt = row.heightPt ?? estimateRowHeightPt(anchors, measurer);
|
package/dist/markdown/render.cjs
CHANGED
|
@@ -115,17 +115,17 @@ function sheetToTable(sheet, sink) {
|
|
|
115
115
|
const visibleColumns = [];
|
|
116
116
|
for (let column = 0; column <= maxColumn; column += 1) if (!hiddenColumns.has(column)) visibleColumns.push(column);
|
|
117
117
|
const columnWidthByIndex = new Map(sheet.columns.map((column) => [column.index, column.widthPt]));
|
|
118
|
-
const
|
|
118
|
+
const columns = visibleColumns.map((column) => ({ widthPt: columnWidthByIndex.get(column) ?? DEFAULT_COLUMN_WIDTH_PT }));
|
|
119
119
|
const rows = visibleRows.map((row) => ({ cells: visibleColumns.map((column) => spreadsheetCellToTableCell(cellByPosition.get(`${String(row)}:${String(column)}`))) }));
|
|
120
120
|
sink({
|
|
121
121
|
severity: "info",
|
|
122
122
|
code: MarkdownRenderDiagnosticCodes.SPREADSHEET_SHEET_AS_TABLE,
|
|
123
|
-
message: `sheet "${sheet.name}" flattened to a ${String(rows.length)}x${String(
|
|
123
|
+
message: `sheet "${sheet.name}" flattened to a ${String(rows.length)}x${String(columns.length)} GFM table; its first row is rendered as the table header (a GFM table always has one, and a spreadsheet has no header/body distinction of its own)`
|
|
124
124
|
});
|
|
125
125
|
return {
|
|
126
126
|
kind: "table",
|
|
127
127
|
rows,
|
|
128
|
-
|
|
128
|
+
columns
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
131
|
function spreadsheetBlocks(document, sink) {
|
package/dist/markdown/render.js
CHANGED
|
@@ -114,17 +114,17 @@ function sheetToTable(sheet, sink) {
|
|
|
114
114
|
const visibleColumns = [];
|
|
115
115
|
for (let column = 0; column <= maxColumn; column += 1) if (!hiddenColumns.has(column)) visibleColumns.push(column);
|
|
116
116
|
const columnWidthByIndex = new Map(sheet.columns.map((column) => [column.index, column.widthPt]));
|
|
117
|
-
const
|
|
117
|
+
const columns = visibleColumns.map((column) => ({ widthPt: columnWidthByIndex.get(column) ?? DEFAULT_COLUMN_WIDTH_PT }));
|
|
118
118
|
const rows = visibleRows.map((row) => ({ cells: visibleColumns.map((column) => spreadsheetCellToTableCell(cellByPosition.get(`${String(row)}:${String(column)}`))) }));
|
|
119
119
|
sink({
|
|
120
120
|
severity: "info",
|
|
121
121
|
code: MarkdownRenderDiagnosticCodes.SPREADSHEET_SHEET_AS_TABLE,
|
|
122
|
-
message: `sheet "${sheet.name}" flattened to a ${String(rows.length)}x${String(
|
|
122
|
+
message: `sheet "${sheet.name}" flattened to a ${String(rows.length)}x${String(columns.length)} GFM table; its first row is rendered as the table header (a GFM table always has one, and a spreadsheet has no header/body distinction of its own)`
|
|
123
123
|
});
|
|
124
124
|
return {
|
|
125
125
|
kind: "table",
|
|
126
126
|
rows,
|
|
127
|
-
|
|
127
|
+
columns
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
130
|
function spreadsheetBlocks(document, sink) {
|
package/dist/metadata/write.cjs
CHANGED
|
@@ -21,12 +21,12 @@ function isRebuildFormat(format) {
|
|
|
21
21
|
}
|
|
22
22
|
function readContentForFormat(format, bytes, options) {
|
|
23
23
|
const content = require_codecs_registry.DOCUMENT_FORMAT_CODECS[format].content;
|
|
24
|
-
if (!content) throw new Error(`RebuildFormat '${format}' has no content codec in DOCUMENT_FORMAT_CODECS
|
|
24
|
+
if (!content) throw new Error(`RebuildFormat '${format}' has no content codec in DOCUMENT_FORMAT_CODECS — this is an internal invariant violation, not a caller error`);
|
|
25
25
|
return content.read(bytes, options);
|
|
26
26
|
}
|
|
27
27
|
function buildBytesForRebuildFormat(format, content) {
|
|
28
28
|
const codec = require_codecs_registry.DOCUMENT_FORMAT_CODECS[format].content;
|
|
29
|
-
if (!codec?.write) throw new Error(`RebuildFormat '${format}' has no content.write codec in DOCUMENT_FORMAT_CODECS
|
|
29
|
+
if (!codec?.write) throw new Error(`RebuildFormat '${format}' has no content.write codec in DOCUMENT_FORMAT_CODECS — this is an internal invariant violation, not a caller error`);
|
|
30
30
|
return require_model_bytes.requireArrayBufferBytes(codec.write(content));
|
|
31
31
|
}
|
|
32
32
|
function patchDocxMetadata(bytes, overrides, options) {
|
|
@@ -38,18 +38,18 @@ function patchDocxMetadata(bytes, overrides, options) {
|
|
|
38
38
|
function classifyWritePath(source, target) {
|
|
39
39
|
if (source === "pdf" && target === "pdf") return { kind: "pdf" };
|
|
40
40
|
if (source === "docx" && target === "docx") return { kind: "docx-patch" };
|
|
41
|
-
if (target === "odf" || source === "odf") return { errorMessage: "'odf' (a standalone formula document) is not a supported setDocumentMetadata source or target
|
|
42
|
-
if (target === "csv" || source === "csv") return { errorMessage: "'csv' is not a supported setDocumentMetadata source or target
|
|
43
|
-
if (target === "svg" || source === "svg") return { errorMessage: "'svg' is not a supported setDocumentMetadata source or target
|
|
44
|
-
if (target === "doc" || source === "doc") return { errorMessage: "'doc' is not a supported setDocumentMetadata source or target
|
|
45
|
-
if (target === "xls" || source === "xls") return { errorMessage: "'xls' is not a supported setDocumentMetadata source or target
|
|
46
|
-
if (target === "ppt" || source === "ppt") return { errorMessage: "'ppt' is not a supported setDocumentMetadata source or target
|
|
47
|
-
if (target === "epub" || source === "epub") return { errorMessage: "'epub' is not a supported setDocumentMetadata source or target
|
|
41
|
+
if (target === "odf" || source === "odf") return { errorMessage: "'odf' (a standalone formula document) is not a supported setDocumentMetadata source or target — it has no write path back out at all" };
|
|
42
|
+
if (target === "csv" || source === "csv") return { errorMessage: "'csv' is not a supported setDocumentMetadata source or target — RFC 4180 text has no metadata container, so a rebuild would silently drop the override. Convert to or from csv first, then patch metadata on the package format." };
|
|
43
|
+
if (target === "svg" || source === "svg") return { errorMessage: "'svg' is not a supported setDocumentMetadata source or target — this package's SVG metadata surface is the root <title> element alone, so an author/subject/keywords override would be silently dropped by the rebuild. Convert to or from svg first, then patch metadata on the package format." };
|
|
44
|
+
if (target === "doc" || source === "doc") return { errorMessage: "'doc' is not a supported setDocumentMetadata source or target — doc-codec's reader always returns empty metadata and its writer never references document.metadata at all, so a rebuild would silently drop the override. Convert to or from doc first, then patch metadata on the package format." };
|
|
45
|
+
if (target === "xls" || source === "xls") return { errorMessage: "'xls' is not a supported setDocumentMetadata source or target — xls-codec's reader always returns empty metadata and its writer never references document.metadata at all, so a rebuild would silently drop the override. Convert to or from xls first, then patch metadata on the package format." };
|
|
46
|
+
if (target === "ppt" || source === "ppt") return { errorMessage: "'ppt' is not a supported setDocumentMetadata source or target — ppt-codec's reader always returns empty metadata (document properties live in the compound file's own SummaryInformation stream, which it does not read) and its writer never references it either, so a rebuild would silently drop the override. Convert to or from ppt first, then patch metadata on the package format." };
|
|
47
|
+
if (target === "epub" || source === "epub") return { errorMessage: "'epub' is not a supported setDocumentMetadata source or target — epub-codec round-trips title/author/keywords/language through OPF Dublin Core elements, but 'subject' has no dc:description-equivalent mapping in either direction, so a rebuild would silently drop that one override. Convert to or from epub first, then patch metadata on the package format." };
|
|
48
48
|
const sourcePatchable = source === "docx" || isRebuildFormat(source);
|
|
49
49
|
const targetPatchable = target === "docx" || isRebuildFormat(target);
|
|
50
|
-
if (!sourcePatchable || !targetPatchable) return { errorMessage: `setDocumentMetadata only patches metadata in place; it does not convert format
|
|
51
|
-
if (source !== target) return { errorMessage: `setDocumentMetadata only patches metadata in place; it does not convert format
|
|
52
|
-
if (!isRebuildFormat(source)) throw new Error(`classifyWritePath: unreachable
|
|
50
|
+
if (!sourcePatchable || !targetPatchable) return { errorMessage: `setDocumentMetadata only patches metadata in place; it does not convert format — source ('${source}') and target ('${target}') must be the same format (or both 'pdf'). Convert first if you need a different target format.` };
|
|
51
|
+
if (source !== target) return { errorMessage: `setDocumentMetadata only patches metadata in place; it does not convert format — source ('${source}') and target ('${target}') must be the same format. Convert first if you need a different target format.` };
|
|
52
|
+
if (!isRebuildFormat(source)) throw new Error(`classifyWritePath: unreachable — '${source}' is patchable and matches its target but is neither 'docx' nor a RebuildFormat`);
|
|
53
53
|
return {
|
|
54
54
|
kind: "rebuild",
|
|
55
55
|
format: source
|
package/dist/metadata/write.js
CHANGED
|
@@ -20,12 +20,12 @@ function isRebuildFormat(format) {
|
|
|
20
20
|
}
|
|
21
21
|
function readContentForFormat(format, bytes, options) {
|
|
22
22
|
const content = DOCUMENT_FORMAT_CODECS[format].content;
|
|
23
|
-
if (!content) throw new Error(`RebuildFormat '${format}' has no content codec in DOCUMENT_FORMAT_CODECS
|
|
23
|
+
if (!content) throw new Error(`RebuildFormat '${format}' has no content codec in DOCUMENT_FORMAT_CODECS — this is an internal invariant violation, not a caller error`);
|
|
24
24
|
return content.read(bytes, options);
|
|
25
25
|
}
|
|
26
26
|
function buildBytesForRebuildFormat(format, content) {
|
|
27
27
|
const codec = DOCUMENT_FORMAT_CODECS[format].content;
|
|
28
|
-
if (!codec?.write) throw new Error(`RebuildFormat '${format}' has no content.write codec in DOCUMENT_FORMAT_CODECS
|
|
28
|
+
if (!codec?.write) throw new Error(`RebuildFormat '${format}' has no content.write codec in DOCUMENT_FORMAT_CODECS — this is an internal invariant violation, not a caller error`);
|
|
29
29
|
return requireArrayBufferBytes(codec.write(content));
|
|
30
30
|
}
|
|
31
31
|
function patchDocxMetadata(bytes, overrides, options) {
|
|
@@ -37,18 +37,18 @@ function patchDocxMetadata(bytes, overrides, options) {
|
|
|
37
37
|
function classifyWritePath(source, target) {
|
|
38
38
|
if (source === "pdf" && target === "pdf") return { kind: "pdf" };
|
|
39
39
|
if (source === "docx" && target === "docx") return { kind: "docx-patch" };
|
|
40
|
-
if (target === "odf" || source === "odf") return { errorMessage: "'odf' (a standalone formula document) is not a supported setDocumentMetadata source or target
|
|
41
|
-
if (target === "csv" || source === "csv") return { errorMessage: "'csv' is not a supported setDocumentMetadata source or target
|
|
42
|
-
if (target === "svg" || source === "svg") return { errorMessage: "'svg' is not a supported setDocumentMetadata source or target
|
|
43
|
-
if (target === "doc" || source === "doc") return { errorMessage: "'doc' is not a supported setDocumentMetadata source or target
|
|
44
|
-
if (target === "xls" || source === "xls") return { errorMessage: "'xls' is not a supported setDocumentMetadata source or target
|
|
45
|
-
if (target === "ppt" || source === "ppt") return { errorMessage: "'ppt' is not a supported setDocumentMetadata source or target
|
|
46
|
-
if (target === "epub" || source === "epub") return { errorMessage: "'epub' is not a supported setDocumentMetadata source or target
|
|
40
|
+
if (target === "odf" || source === "odf") return { errorMessage: "'odf' (a standalone formula document) is not a supported setDocumentMetadata source or target — it has no write path back out at all" };
|
|
41
|
+
if (target === "csv" || source === "csv") return { errorMessage: "'csv' is not a supported setDocumentMetadata source or target — RFC 4180 text has no metadata container, so a rebuild would silently drop the override. Convert to or from csv first, then patch metadata on the package format." };
|
|
42
|
+
if (target === "svg" || source === "svg") return { errorMessage: "'svg' is not a supported setDocumentMetadata source or target — this package's SVG metadata surface is the root <title> element alone, so an author/subject/keywords override would be silently dropped by the rebuild. Convert to or from svg first, then patch metadata on the package format." };
|
|
43
|
+
if (target === "doc" || source === "doc") return { errorMessage: "'doc' is not a supported setDocumentMetadata source or target — doc-codec's reader always returns empty metadata and its writer never references document.metadata at all, so a rebuild would silently drop the override. Convert to or from doc first, then patch metadata on the package format." };
|
|
44
|
+
if (target === "xls" || source === "xls") return { errorMessage: "'xls' is not a supported setDocumentMetadata source or target — xls-codec's reader always returns empty metadata and its writer never references document.metadata at all, so a rebuild would silently drop the override. Convert to or from xls first, then patch metadata on the package format." };
|
|
45
|
+
if (target === "ppt" || source === "ppt") return { errorMessage: "'ppt' is not a supported setDocumentMetadata source or target — ppt-codec's reader always returns empty metadata (document properties live in the compound file's own SummaryInformation stream, which it does not read) and its writer never references it either, so a rebuild would silently drop the override. Convert to or from ppt first, then patch metadata on the package format." };
|
|
46
|
+
if (target === "epub" || source === "epub") return { errorMessage: "'epub' is not a supported setDocumentMetadata source or target — epub-codec round-trips title/author/keywords/language through OPF Dublin Core elements, but 'subject' has no dc:description-equivalent mapping in either direction, so a rebuild would silently drop that one override. Convert to or from epub first, then patch metadata on the package format." };
|
|
47
47
|
const sourcePatchable = source === "docx" || isRebuildFormat(source);
|
|
48
48
|
const targetPatchable = target === "docx" || isRebuildFormat(target);
|
|
49
|
-
if (!sourcePatchable || !targetPatchable) return { errorMessage: `setDocumentMetadata only patches metadata in place; it does not convert format
|
|
50
|
-
if (source !== target) return { errorMessage: `setDocumentMetadata only patches metadata in place; it does not convert format
|
|
51
|
-
if (!isRebuildFormat(source)) throw new Error(`classifyWritePath: unreachable
|
|
49
|
+
if (!sourcePatchable || !targetPatchable) return { errorMessage: `setDocumentMetadata only patches metadata in place; it does not convert format — source ('${source}') and target ('${target}') must be the same format (or both 'pdf'). Convert first if you need a different target format.` };
|
|
50
|
+
if (source !== target) return { errorMessage: `setDocumentMetadata only patches metadata in place; it does not convert format — source ('${source}') and target ('${target}') must be the same format. Convert first if you need a different target format.` };
|
|
51
|
+
if (!isRebuildFormat(source)) throw new Error(`classifyWritePath: unreachable — '${source}' is patchable and matches its target but is neither 'docx' nor a RebuildFormat`);
|
|
52
52
|
return {
|
|
53
53
|
kind: "rebuild",
|
|
54
54
|
format: source
|
package/dist/odb/csv.cjs
CHANGED
|
@@ -5,7 +5,7 @@ const require_hsqldb_script = require("../hsqldb/script.cjs");
|
|
|
5
5
|
var OdbTableNotSpecifiedError = class extends Error {
|
|
6
6
|
availableTables;
|
|
7
7
|
constructor(availableTables) {
|
|
8
|
-
super(`odbToCsv: this .odb has more than one table (${availableTables.join(", ")})
|
|
8
|
+
super(`odbToCsv: this .odb has more than one table (${availableTables.join(", ")}) — pass { table: '<name>' } to select one`);
|
|
9
9
|
this.name = "OdbTableNotSpecifiedError";
|
|
10
10
|
this.availableTables = availableTables;
|
|
11
11
|
}
|
|
@@ -14,7 +14,7 @@ var OdbTableNotFoundError = class extends Error {
|
|
|
14
14
|
table;
|
|
15
15
|
availableTables;
|
|
16
16
|
constructor(table, availableTables) {
|
|
17
|
-
super(`odbToCsv: table "${table}" not found
|
|
17
|
+
super(`odbToCsv: table "${table}" not found — available table(s): ${availableTables.length === 0 ? "(none)" : availableTables.join(", ")}`);
|
|
18
18
|
this.name = "OdbTableNotFoundError";
|
|
19
19
|
this.table = table;
|
|
20
20
|
this.availableTables = availableTables;
|
package/dist/odb/csv.js
CHANGED
|
@@ -4,7 +4,7 @@ import { displayTextFor } from "../hsqldb/script.js";
|
|
|
4
4
|
var OdbTableNotSpecifiedError = class extends Error {
|
|
5
5
|
availableTables;
|
|
6
6
|
constructor(availableTables) {
|
|
7
|
-
super(`odbToCsv: this .odb has more than one table (${availableTables.join(", ")})
|
|
7
|
+
super(`odbToCsv: this .odb has more than one table (${availableTables.join(", ")}) — pass { table: '<name>' } to select one`);
|
|
8
8
|
this.name = "OdbTableNotSpecifiedError";
|
|
9
9
|
this.availableTables = availableTables;
|
|
10
10
|
}
|
|
@@ -13,7 +13,7 @@ var OdbTableNotFoundError = class extends Error {
|
|
|
13
13
|
table;
|
|
14
14
|
availableTables;
|
|
15
15
|
constructor(table, availableTables) {
|
|
16
|
-
super(`odbToCsv: table "${table}" not found
|
|
16
|
+
super(`odbToCsv: table "${table}" not found — available table(s): ${availableTables.length === 0 ? "(none)" : availableTables.join(", ")}`);
|
|
17
17
|
this.name = "OdbTableNotFoundError";
|
|
18
18
|
this.table = table;
|
|
19
19
|
this.availableTables = availableTables;
|
|
@@ -8,7 +8,7 @@ var RptFormulaUnsupportedError = class extends Error {
|
|
|
8
8
|
functionName;
|
|
9
9
|
formula;
|
|
10
10
|
constructor(functionName, formula) {
|
|
11
|
-
super(`Report Builder formula: rpt:${functionName} is not supported by this bounded formula engine
|
|
11
|
+
super(`Report Builder formula: rpt:${functionName} is not supported by this bounded formula engine — supported functions are HASCHANGED, LEFT, SUM, COUNT, AVG, MIN, MAX — in formula: ${truncateForMessage(formula)}`);
|
|
12
12
|
this.name = "RptFormulaUnsupportedError";
|
|
13
13
|
this.functionName = functionName;
|
|
14
14
|
this.formula = formula;
|
|
@@ -18,7 +18,7 @@ var RptFormulaParseError = class extends Error {
|
|
|
18
18
|
formula;
|
|
19
19
|
offset;
|
|
20
20
|
constructor(message, formula, offset) {
|
|
21
|
-
super(`Report Builder formula parse error at offset ${String(offset)}: ${message}
|
|
21
|
+
super(`Report Builder formula parse error at offset ${String(offset)}: ${message} — in formula: ${truncateForMessage(formula)}`);
|
|
22
22
|
this.name = "RptFormulaParseError";
|
|
23
23
|
this.formula = formula;
|
|
24
24
|
this.offset = offset;
|
|
@@ -27,7 +27,7 @@ var RptFormulaParseError = class extends Error {
|
|
|
27
27
|
var RptFormulaEvaluationError = class extends Error {
|
|
28
28
|
formula;
|
|
29
29
|
constructor(message, formula) {
|
|
30
|
-
super(`Report Builder formula evaluation error: ${message}
|
|
30
|
+
super(`Report Builder formula evaluation error: ${message} — in formula: ${truncateForMessage(formula)}`);
|
|
31
31
|
this.name = "RptFormulaEvaluationError";
|
|
32
32
|
this.formula = formula;
|
|
33
33
|
}
|
|
@@ -7,7 +7,7 @@ var RptFormulaUnsupportedError = class extends Error {
|
|
|
7
7
|
functionName;
|
|
8
8
|
formula;
|
|
9
9
|
constructor(functionName, formula) {
|
|
10
|
-
super(`Report Builder formula: rpt:${functionName} is not supported by this bounded formula engine
|
|
10
|
+
super(`Report Builder formula: rpt:${functionName} is not supported by this bounded formula engine — supported functions are HASCHANGED, LEFT, SUM, COUNT, AVG, MIN, MAX — in formula: ${truncateForMessage(formula)}`);
|
|
11
11
|
this.name = "RptFormulaUnsupportedError";
|
|
12
12
|
this.functionName = functionName;
|
|
13
13
|
this.formula = formula;
|
|
@@ -17,7 +17,7 @@ var RptFormulaParseError = class extends Error {
|
|
|
17
17
|
formula;
|
|
18
18
|
offset;
|
|
19
19
|
constructor(message, formula, offset) {
|
|
20
|
-
super(`Report Builder formula parse error at offset ${String(offset)}: ${message}
|
|
20
|
+
super(`Report Builder formula parse error at offset ${String(offset)}: ${message} — in formula: ${truncateForMessage(formula)}`);
|
|
21
21
|
this.name = "RptFormulaParseError";
|
|
22
22
|
this.formula = formula;
|
|
23
23
|
this.offset = offset;
|
|
@@ -26,7 +26,7 @@ var RptFormulaParseError = class extends Error {
|
|
|
26
26
|
var RptFormulaEvaluationError = class extends Error {
|
|
27
27
|
formula;
|
|
28
28
|
constructor(message, formula) {
|
|
29
|
-
super(`Report Builder formula evaluation error: ${message}
|
|
29
|
+
super(`Report Builder formula evaluation error: ${message} — in formula: ${truncateForMessage(formula)}`);
|
|
30
30
|
this.name = "RptFormulaEvaluationError";
|
|
31
31
|
this.formula = formula;
|
|
32
32
|
}
|
|
@@ -59,7 +59,7 @@ var PreparedReport = class {
|
|
|
59
59
|
for (const expression of this.groupExpressions) this.rejectAggregateDependency(expression, expression, /* @__PURE__ */ new Set());
|
|
60
60
|
}
|
|
61
61
|
rejectAggregateDependency(formula, expression, visiting) {
|
|
62
|
-
if (formula.kind === "aggregate") fail(`a group expression cannot depend on the aggregate rpt:${formula.aggregate}(${formula.reference.name})
|
|
62
|
+
if (formula.kind === "aggregate") fail(`a group expression cannot depend on the aggregate rpt:${formula.aggregate}(${formula.reference.name}) — an aggregate's own rows are defined by the very group boundaries this expression decides`, expression.text);
|
|
63
63
|
const resolved = matchNamed([...this.namedFunctions.values()], (candidate) => candidate.name, formula.reference.name)[0];
|
|
64
64
|
if (resolved === void 0) return;
|
|
65
65
|
if (visiting.has(resolved.name)) fail(`rpt:function "${resolved.name}" refers to itself, directly or through another function`, expression.text);
|
|
@@ -70,7 +70,7 @@ var PreparedReport = class {
|
|
|
70
70
|
if (cached !== void 0) return cached;
|
|
71
71
|
const functionMatches = matchNamed([...this.namedFunctions.values()], (candidate) => candidate.name, reference.name);
|
|
72
72
|
const columnMatches = matchNamed(this.columnNames, identity, reference.name);
|
|
73
|
-
if (functionMatches.length + columnMatches.length > 1) fail(`reference "${reference.name}" is ambiguous
|
|
73
|
+
if (functionMatches.length + columnMatches.length > 1) fail(`reference "${reference.name}" is ambiguous — it matches ${[...functionMatches.map((match) => `rpt:function ${match.name}`), ...columnMatches.map((match) => `column ${match}`)].join(", ")}`, formula);
|
|
74
74
|
const resolved = this.resolveSingleMatch(reference, functionMatches[0], columnMatches[0], formula);
|
|
75
75
|
this.resolutions.set(reference, resolved);
|
|
76
76
|
return resolved;
|
|
@@ -80,7 +80,7 @@ var PreparedReport = class {
|
|
|
80
80
|
kind: "function",
|
|
81
81
|
resolved: named
|
|
82
82
|
};
|
|
83
|
-
if (columnName === void 0) fail(`reference "${reference.name}" names neither a declared rpt:function nor a column of the report's own data
|
|
83
|
+
if (columnName === void 0) fail(`reference "${reference.name}" names neither a declared rpt:function nor a column of the report's own data — functions: ${this.namedFunctions.size === 0 ? "(none)" : [...this.namedFunctions.keys()].join(", ")}; columns: ${this.columnNames.length === 0 ? "(none)" : this.columnNames.join(", ")}`, formula);
|
|
84
84
|
return {
|
|
85
85
|
kind: "column",
|
|
86
86
|
index: this.columnNames.indexOf(columnName)
|
|
@@ -121,7 +121,7 @@ var RunState = class {
|
|
|
121
121
|
function textOf(value, formula, what) {
|
|
122
122
|
if (value.kind === "empty") return;
|
|
123
123
|
const key = require_odb_values.cellComparisonKey(value);
|
|
124
|
-
if (key?.valueClass !== "text") fail(`${what} requires a text value, but found a ${value.kind} value
|
|
124
|
+
if (key?.valueClass !== "text") fail(`${what} requires a text value, but found a ${value.kind} value — this engine does not format a number or a boolean into text, since a report's own number format lives in its band styles rather than in the formula`, formula);
|
|
125
125
|
return key.text;
|
|
126
126
|
}
|
|
127
127
|
var FormulaEvaluator = class {
|
|
@@ -58,7 +58,7 @@ var PreparedReport = class {
|
|
|
58
58
|
for (const expression of this.groupExpressions) this.rejectAggregateDependency(expression, expression, /* @__PURE__ */ new Set());
|
|
59
59
|
}
|
|
60
60
|
rejectAggregateDependency(formula, expression, visiting) {
|
|
61
|
-
if (formula.kind === "aggregate") fail(`a group expression cannot depend on the aggregate rpt:${formula.aggregate}(${formula.reference.name})
|
|
61
|
+
if (formula.kind === "aggregate") fail(`a group expression cannot depend on the aggregate rpt:${formula.aggregate}(${formula.reference.name}) — an aggregate's own rows are defined by the very group boundaries this expression decides`, expression.text);
|
|
62
62
|
const resolved = matchNamed([...this.namedFunctions.values()], (candidate) => candidate.name, formula.reference.name)[0];
|
|
63
63
|
if (resolved === void 0) return;
|
|
64
64
|
if (visiting.has(resolved.name)) fail(`rpt:function "${resolved.name}" refers to itself, directly or through another function`, expression.text);
|
|
@@ -69,7 +69,7 @@ var PreparedReport = class {
|
|
|
69
69
|
if (cached !== void 0) return cached;
|
|
70
70
|
const functionMatches = matchNamed([...this.namedFunctions.values()], (candidate) => candidate.name, reference.name);
|
|
71
71
|
const columnMatches = matchNamed(this.columnNames, identity, reference.name);
|
|
72
|
-
if (functionMatches.length + columnMatches.length > 1) fail(`reference "${reference.name}" is ambiguous
|
|
72
|
+
if (functionMatches.length + columnMatches.length > 1) fail(`reference "${reference.name}" is ambiguous — it matches ${[...functionMatches.map((match) => `rpt:function ${match.name}`), ...columnMatches.map((match) => `column ${match}`)].join(", ")}`, formula);
|
|
73
73
|
const resolved = this.resolveSingleMatch(reference, functionMatches[0], columnMatches[0], formula);
|
|
74
74
|
this.resolutions.set(reference, resolved);
|
|
75
75
|
return resolved;
|
|
@@ -79,7 +79,7 @@ var PreparedReport = class {
|
|
|
79
79
|
kind: "function",
|
|
80
80
|
resolved: named
|
|
81
81
|
};
|
|
82
|
-
if (columnName === void 0) fail(`reference "${reference.name}" names neither a declared rpt:function nor a column of the report's own data
|
|
82
|
+
if (columnName === void 0) fail(`reference "${reference.name}" names neither a declared rpt:function nor a column of the report's own data — functions: ${this.namedFunctions.size === 0 ? "(none)" : [...this.namedFunctions.keys()].join(", ")}; columns: ${this.columnNames.length === 0 ? "(none)" : this.columnNames.join(", ")}`, formula);
|
|
83
83
|
return {
|
|
84
84
|
kind: "column",
|
|
85
85
|
index: this.columnNames.indexOf(columnName)
|
|
@@ -120,7 +120,7 @@ var RunState = class {
|
|
|
120
120
|
function textOf(value, formula, what) {
|
|
121
121
|
if (value.kind === "empty") return;
|
|
122
122
|
const key = cellComparisonKey(value);
|
|
123
|
-
if (key?.valueClass !== "text") fail(`${what} requires a text value, but found a ${value.kind} value
|
|
123
|
+
if (key?.valueClass !== "text") fail(`${what} requires a text value, but found a ${value.kind} value — this engine does not format a number or a boolean into text, since a report's own number format lives in its band styles rather than in the formula`, formula);
|
|
124
124
|
return key.text;
|
|
125
125
|
}
|
|
126
126
|
var FormulaEvaluator = class {
|
|
@@ -63,7 +63,7 @@ var FormulaScanner = class {
|
|
|
63
63
|
const close = this.formula.indexOf("]", this.offset);
|
|
64
64
|
if (close < 0) {
|
|
65
65
|
this.offset = this.formula.length;
|
|
66
|
-
this.fail("unterminated column reference
|
|
66
|
+
this.fail("unterminated column reference — no closing \"]\"");
|
|
67
67
|
}
|
|
68
68
|
this.offset = close + 1;
|
|
69
69
|
return {
|
|
@@ -75,7 +75,7 @@ var FormulaScanner = class {
|
|
|
75
75
|
this.expect("\"", "the opening quote of a name reference");
|
|
76
76
|
let name = "";
|
|
77
77
|
for (;;) {
|
|
78
|
-
if (this.offset >= this.formula.length) this.fail("unterminated name reference
|
|
78
|
+
if (this.offset >= this.formula.length) this.fail("unterminated name reference — no closing double quote");
|
|
79
79
|
const character = this.formula.charAt(this.offset);
|
|
80
80
|
this.offset += 1;
|
|
81
81
|
if (character !== "\"") {
|
|
@@ -62,7 +62,7 @@ var FormulaScanner = class {
|
|
|
62
62
|
const close = this.formula.indexOf("]", this.offset);
|
|
63
63
|
if (close < 0) {
|
|
64
64
|
this.offset = this.formula.length;
|
|
65
|
-
this.fail("unterminated column reference
|
|
65
|
+
this.fail("unterminated column reference — no closing \"]\"");
|
|
66
66
|
}
|
|
67
67
|
this.offset = close + 1;
|
|
68
68
|
return {
|
|
@@ -74,7 +74,7 @@ var FormulaScanner = class {
|
|
|
74
74
|
this.expect("\"", "the opening quote of a name reference");
|
|
75
75
|
let name = "";
|
|
76
76
|
for (;;) {
|
|
77
|
-
if (this.offset >= this.formula.length) this.fail("unterminated name reference
|
|
77
|
+
if (this.offset >= this.formula.length) this.fail("unterminated name reference — no closing double quote");
|
|
78
78
|
const character = this.formula.charAt(this.offset);
|
|
79
79
|
this.offset += 1;
|
|
80
80
|
if (character !== "\"") {
|