js.documents 14.0.3 → 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/diagnostics-9twvwLNY.d.cts +17 -0
- package/dist/diagnostics-9twvwLNY.d.ts +17 -0
- 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 +9 -3
- package/dist/edit/pptx/content.d.cts +2 -0
- package/dist/edit/pptx/content.d.ts +2 -0
- package/dist/edit/pptx/content.js +9 -3
- package/dist/edit/pptx/diagnostics.cjs +7 -0
- package/dist/edit/pptx/diagnostics.d.cts +2 -0
- package/dist/edit/pptx/diagnostics.d.ts +2 -0
- package/dist/edit/pptx/diagnostics.js +5 -0
- 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/dist/odb/read.js
CHANGED
|
@@ -7,7 +7,7 @@ import { base64ToBytes, readManifest, readOdbInventory } from "odf.js";
|
|
|
7
7
|
var OdbNoEmbeddedDataSourceError = class extends Error {
|
|
8
8
|
url;
|
|
9
9
|
constructor(url) {
|
|
10
|
-
super(url === void 0 ? "readOdbTables: this .odb package has no embedded data source
|
|
10
|
+
super(url === void 0 ? "readOdbTables: this .odb package has no embedded data source — its office:database has no db:data-source/db:connection-data at all, so embedded vs external cannot be determined" : `readOdbTables: this .odb package has no embedded data source — its connection ("${url}") points at an external datasource (MySQL/PostgreSQL/JDBC/ODBC or similar), which is permanently out of scope for readOdbTables`);
|
|
11
11
|
this.name = "OdbNoEmbeddedDataSourceError";
|
|
12
12
|
this.url = url;
|
|
13
13
|
}
|
|
@@ -52,17 +52,17 @@ function readOdbTables(pkg, options) {
|
|
|
52
52
|
const engine = url.slice(14);
|
|
53
53
|
if (engine === "firebird") {
|
|
54
54
|
const firebirdPart = pkg.parts[DATABASE_FIREBIRD_PART];
|
|
55
|
-
if (firebirdPart === void 0) throw new OdbUnsupportedFormatError("unrecognised-engine", `an embedded Firebird engine with no ${DATABASE_FIREBIRD_PART} part
|
|
56
|
-
if (firebirdPart.kind !== "binary") throw new Error(`readOdbTables: ${DATABASE_FIREBIRD_PART} is not a binary part (found kind "${firebirdPart.kind}")
|
|
55
|
+
if (firebirdPart === void 0) throw new OdbUnsupportedFormatError("unrecognised-engine", `an embedded Firebird engine with no ${DATABASE_FIREBIRD_PART} part — an unrecognised embedded storage shape`);
|
|
56
|
+
if (firebirdPart.kind !== "binary") throw new Error(`readOdbTables: ${DATABASE_FIREBIRD_PART} is not a binary part (found kind "${firebirdPart.kind}") — malformed .odb package`);
|
|
57
57
|
const backupBytes = base64ToBytes(firebirdPart.base64);
|
|
58
58
|
return readFirebirdBackup(backupBytes).tables;
|
|
59
59
|
}
|
|
60
60
|
if (engine !== "hsqldb") throw new OdbUnsupportedFormatError("unrecognised-engine", `the embedded "${engine}" database engine`);
|
|
61
61
|
const manifestEntry = readManifest(pkg).entries.find((entry) => entry.fullPath === DATABASE_SCRIPT_PART);
|
|
62
|
-
if (manifestEntry !== void 0 && isXmlMediaType(manifestEntry.mediaType)) throw new Error(`readOdbTables: ${DATABASE_SCRIPT_PART} is declared as an XML sub-document in the manifest (media type "${manifestEntry.mediaType}")
|
|
62
|
+
if (manifestEntry !== void 0 && isXmlMediaType(manifestEntry.mediaType)) throw new Error(`readOdbTables: ${DATABASE_SCRIPT_PART} is declared as an XML sub-document in the manifest (media type "${manifestEntry.mediaType}") — not a recognised HSQLDB script part`);
|
|
63
63
|
const scriptPart = pkg.parts[DATABASE_SCRIPT_PART];
|
|
64
|
-
if (scriptPart === void 0) throw new OdbUnsupportedFormatError("unrecognised-engine", `an embedded HSQLDB engine with no ${DATABASE_SCRIPT_PART} part
|
|
65
|
-
if (scriptPart.kind !== "binary") throw new Error(`readOdbTables: ${DATABASE_SCRIPT_PART} is not a binary part (found kind "${scriptPart.kind}")
|
|
64
|
+
if (scriptPart === void 0) throw new OdbUnsupportedFormatError("unrecognised-engine", `an embedded HSQLDB engine with no ${DATABASE_SCRIPT_PART} part — an unrecognised embedded storage shape`);
|
|
65
|
+
if (scriptPart.kind !== "binary") throw new Error(`readOdbTables: ${DATABASE_SCRIPT_PART} is not a binary part (found kind "${scriptPart.kind}") — malformed .odb package`);
|
|
66
66
|
const scriptBytes = base64ToBytes(scriptPart.base64);
|
|
67
67
|
const classification = classifyScriptBytes(scriptBytes);
|
|
68
68
|
if (classification !== "text") {
|
|
@@ -76,10 +76,10 @@ function readOdbTables(pkg, options) {
|
|
|
76
76
|
function withCachedTableRows(pkg, tables, scriptText, options) {
|
|
77
77
|
const dataPart = pkg.parts[DATABASE_DATA_PART];
|
|
78
78
|
if (dataPart === void 0) return tables;
|
|
79
|
-
if (dataPart.kind !== "binary") throw new Error(`readOdbTables: ${DATABASE_DATA_PART} is not a binary part (found kind "${dataPart.kind}")
|
|
79
|
+
if (dataPart.kind !== "binary") throw new Error(`readOdbTables: ${DATABASE_DATA_PART} is not a binary part (found kind "${dataPart.kind}") — malformed .odb package`);
|
|
80
80
|
const propertiesPart = pkg.parts[DATABASE_PROPERTIES_PART];
|
|
81
|
-
if (propertiesPart === void 0) throw new Error(`readOdbTables: ${DATABASE_DATA_PART} is present but ${DATABASE_PROPERTIES_PART} is not
|
|
82
|
-
if (propertiesPart.kind !== "binary") throw new Error(`readOdbTables: ${DATABASE_PROPERTIES_PART} is not a binary part (found kind "${propertiesPart.kind}")
|
|
81
|
+
if (propertiesPart === void 0) throw new Error(`readOdbTables: ${DATABASE_DATA_PART} is present but ${DATABASE_PROPERTIES_PART} is not — malformed .odb package (a CACHED-table row store always ships alongside its own properties file, which this decoder needs for the cache file's own scale)`);
|
|
82
|
+
if (propertiesPart.kind !== "binary") throw new Error(`readOdbTables: ${DATABASE_PROPERTIES_PART} is not a binary part (found kind "${propertiesPart.kind}") — malformed .odb package`);
|
|
83
83
|
const dataBytes = base64ToBytes(dataPart.base64);
|
|
84
84
|
const propertiesText = new TextDecoder("utf-8", { fatal: true }).decode(base64ToBytes(propertiesPart.base64));
|
|
85
85
|
return decodeHsqldbCachedTables(tables, scriptText, dataBytes, propertiesText, options);
|
|
@@ -6,7 +6,7 @@ let odf_js = require("odf.js");
|
|
|
6
6
|
var OdbReportNotSpecifiedError = class extends Error {
|
|
7
7
|
availableReports;
|
|
8
8
|
constructor(availableReports) {
|
|
9
|
-
super(availableReports.length === 0 ? "readOdbReportContent: this .odb declares no reports at all" : `readOdbReportContent: this .odb declares more than one report (${availableReports.join(", ")})
|
|
9
|
+
super(availableReports.length === 0 ? "readOdbReportContent: this .odb declares no reports at all" : `readOdbReportContent: this .odb declares more than one report (${availableReports.join(", ")}) — pass { report: '<name>' } to select one`);
|
|
10
10
|
this.name = "OdbReportNotSpecifiedError";
|
|
11
11
|
this.availableReports = availableReports;
|
|
12
12
|
}
|
|
@@ -5,7 +5,7 @@ import { readOdbInventory, readOdbReport } from "odf.js";
|
|
|
5
5
|
var OdbReportNotSpecifiedError = class extends Error {
|
|
6
6
|
availableReports;
|
|
7
7
|
constructor(availableReports) {
|
|
8
|
-
super(availableReports.length === 0 ? "readOdbReportContent: this .odb declares no reports at all" : `readOdbReportContent: this .odb declares more than one report (${availableReports.join(", ")})
|
|
8
|
+
super(availableReports.length === 0 ? "readOdbReportContent: this .odb declares no reports at all" : `readOdbReportContent: this .odb declares more than one report (${availableReports.join(", ")}) — pass { report: '<name>' } to select one`);
|
|
9
9
|
this.name = "OdbReportNotSpecifiedError";
|
|
10
10
|
this.availableReports = availableReports;
|
|
11
11
|
}
|
|
@@ -21,7 +21,7 @@ function quotedIdentifier(name) {
|
|
|
21
21
|
}
|
|
22
22
|
function savedQueryCommand(report, commandName, queries) {
|
|
23
23
|
const query = queries.find((candidate) => candidate.name === commandName);
|
|
24
|
-
if (query === void 0) throw new OdbReportDataSourceError(`rpt:command-type is "query" and rpt:command names "${commandName}", but this .odb declares no such saved query
|
|
24
|
+
if (query === void 0) throw new OdbReportDataSourceError(`rpt:command-type is "query" and rpt:command names "${commandName}", but this .odb declares no such saved query — available quer${queries.length === 1 ? "y" : "ies"}: ${queries.length === 0 ? "(none)" : queries.map((candidate) => candidate.name).join(", ")}`, report);
|
|
25
25
|
return query.command;
|
|
26
26
|
}
|
|
27
27
|
function odbReportCommandSql(report, queries) {
|
|
@@ -20,7 +20,7 @@ function quotedIdentifier(name) {
|
|
|
20
20
|
}
|
|
21
21
|
function savedQueryCommand(report, commandName, queries) {
|
|
22
22
|
const query = queries.find((candidate) => candidate.name === commandName);
|
|
23
|
-
if (query === void 0) throw new OdbReportDataSourceError(`rpt:command-type is "query" and rpt:command names "${commandName}", but this .odb declares no such saved query
|
|
23
|
+
if (query === void 0) throw new OdbReportDataSourceError(`rpt:command-type is "query" and rpt:command names "${commandName}", but this .odb declares no such saved query — available quer${queries.length === 1 ? "y" : "ies"}: ${queries.length === 0 ? "(none)" : queries.map((candidate) => candidate.name).join(", ")}`, report);
|
|
24
24
|
return query.command;
|
|
25
25
|
}
|
|
26
26
|
function odbReportCommandSql(report, queries) {
|
package/dist/odb/sql/errors.cjs
CHANGED
|
@@ -8,7 +8,7 @@ var HsqldbSqlUnsupportedError = class extends Error {
|
|
|
8
8
|
construct;
|
|
9
9
|
sql;
|
|
10
10
|
constructor(construct, sql) {
|
|
11
|
-
super(`HSQLDB SQL: ${construct} is not supported by this bounded query engine
|
|
11
|
+
super(`HSQLDB SQL: ${construct} is not supported by this bounded query engine — in statement: ${truncateForMessage(sql)}`);
|
|
12
12
|
this.name = "HsqldbSqlUnsupportedError";
|
|
13
13
|
this.construct = construct;
|
|
14
14
|
this.sql = sql;
|
|
@@ -18,7 +18,7 @@ var HsqldbSqlParseError = class extends Error {
|
|
|
18
18
|
sql;
|
|
19
19
|
offset;
|
|
20
20
|
constructor(message, sql, offset) {
|
|
21
|
-
super(`HSQLDB SQL parse error at offset ${String(offset)}: ${message}
|
|
21
|
+
super(`HSQLDB SQL parse error at offset ${String(offset)}: ${message} — in statement: ${truncateForMessage(sql)}`);
|
|
22
22
|
this.name = "HsqldbSqlParseError";
|
|
23
23
|
this.sql = sql;
|
|
24
24
|
this.offset = offset;
|
|
@@ -27,7 +27,7 @@ var HsqldbSqlParseError = class extends Error {
|
|
|
27
27
|
var HsqldbSqlEvaluationError = class extends Error {
|
|
28
28
|
sql;
|
|
29
29
|
constructor(message, sql) {
|
|
30
|
-
super(`HSQLDB SQL evaluation error: ${message}
|
|
30
|
+
super(`HSQLDB SQL evaluation error: ${message} — in statement: ${truncateForMessage(sql)}`);
|
|
31
31
|
this.name = "HsqldbSqlEvaluationError";
|
|
32
32
|
this.sql = sql;
|
|
33
33
|
}
|
package/dist/odb/sql/errors.js
CHANGED
|
@@ -7,7 +7,7 @@ var HsqldbSqlUnsupportedError = class extends Error {
|
|
|
7
7
|
construct;
|
|
8
8
|
sql;
|
|
9
9
|
constructor(construct, sql) {
|
|
10
|
-
super(`HSQLDB SQL: ${construct} is not supported by this bounded query engine
|
|
10
|
+
super(`HSQLDB SQL: ${construct} is not supported by this bounded query engine — in statement: ${truncateForMessage(sql)}`);
|
|
11
11
|
this.name = "HsqldbSqlUnsupportedError";
|
|
12
12
|
this.construct = construct;
|
|
13
13
|
this.sql = sql;
|
|
@@ -17,7 +17,7 @@ var HsqldbSqlParseError = class extends Error {
|
|
|
17
17
|
sql;
|
|
18
18
|
offset;
|
|
19
19
|
constructor(message, sql, offset) {
|
|
20
|
-
super(`HSQLDB SQL parse error at offset ${String(offset)}: ${message}
|
|
20
|
+
super(`HSQLDB SQL parse error at offset ${String(offset)}: ${message} — in statement: ${truncateForMessage(sql)}`);
|
|
21
21
|
this.name = "HsqldbSqlParseError";
|
|
22
22
|
this.sql = sql;
|
|
23
23
|
this.offset = offset;
|
|
@@ -26,7 +26,7 @@ var HsqldbSqlParseError = class extends Error {
|
|
|
26
26
|
var HsqldbSqlEvaluationError = class extends Error {
|
|
27
27
|
sql;
|
|
28
28
|
constructor(message, sql) {
|
|
29
|
-
super(`HSQLDB SQL evaluation error: ${message}
|
|
29
|
+
super(`HSQLDB SQL evaluation error: ${message} — in statement: ${truncateForMessage(sql)}`);
|
|
30
30
|
this.name = "HsqldbSqlEvaluationError";
|
|
31
31
|
this.sql = sql;
|
|
32
32
|
}
|
|
@@ -59,7 +59,7 @@ function tryResolveName(candidates, ref, what, sql) {
|
|
|
59
59
|
if (exact !== void 0) return exact;
|
|
60
60
|
if (!ref.quoted) {
|
|
61
61
|
const folded = candidates.filter((candidate) => candidate.toUpperCase() === ref.name);
|
|
62
|
-
if (folded.length > 1) throw new require_odb_sql_errors.HsqldbSqlEvaluationError(`${what} "${ref.name}" is ambiguous
|
|
62
|
+
if (folded.length > 1) throw new require_odb_sql_errors.HsqldbSqlEvaluationError(`${what} "${ref.name}" is ambiguous—it matches ${folded.join(", ")} case-insensitively`, sql);
|
|
63
63
|
const only = folded[0];
|
|
64
64
|
if (only !== void 0) return only;
|
|
65
65
|
}
|
|
@@ -67,7 +67,7 @@ function tryResolveName(candidates, ref, what, sql) {
|
|
|
67
67
|
function resolveName(candidates, ref, what, sql) {
|
|
68
68
|
const found = tryResolveName(candidates, ref, what, sql);
|
|
69
69
|
if (found !== void 0) return found;
|
|
70
|
-
throw new require_odb_sql_errors.HsqldbSqlEvaluationError(`${what} "${ref.name}" not found
|
|
70
|
+
throw new require_odb_sql_errors.HsqldbSqlEvaluationError(`${what} "${ref.name}" not found—available: ${candidates.length === 0 ? "(none)" : candidates.join(", ")}`, sql);
|
|
71
71
|
}
|
|
72
72
|
function resolveTable(tables, ref, sql) {
|
|
73
73
|
const resolvedName = resolveName(tables.map((table) => table.tableName), ref, "table", sql);
|
|
@@ -92,7 +92,7 @@ function tryResolveColumnIndex(columns, candidateIndices, ref, sql) {
|
|
|
92
92
|
exactCount += 1;
|
|
93
93
|
firstExact ??= index;
|
|
94
94
|
}
|
|
95
|
-
if (exactCount > 1) throw new require_odb_sql_errors.HsqldbSqlEvaluationError(`column "${ref.name}" is ambiguous
|
|
95
|
+
if (exactCount > 1) throw new require_odb_sql_errors.HsqldbSqlEvaluationError(`column "${ref.name}" is ambiguous—it matches more than one joined column named "${ref.name}"`, sql);
|
|
96
96
|
if (firstExact !== void 0) return firstExact;
|
|
97
97
|
if (!ref.quoted) {
|
|
98
98
|
let firstFolded;
|
|
@@ -103,14 +103,14 @@ function tryResolveColumnIndex(columns, candidateIndices, ref, sql) {
|
|
|
103
103
|
foldedNames.push(name);
|
|
104
104
|
firstFolded ??= index;
|
|
105
105
|
}
|
|
106
|
-
if (foldedNames.length > 1) throw new require_odb_sql_errors.HsqldbSqlEvaluationError(`column "${ref.name}" is ambiguous
|
|
106
|
+
if (foldedNames.length > 1) throw new require_odb_sql_errors.HsqldbSqlEvaluationError(`column "${ref.name}" is ambiguous—it matches ${foldedNames.join(", ")} case-insensitively`, sql);
|
|
107
107
|
if (firstFolded !== void 0) return firstFolded;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
function resolveColumnIndex(columns, candidateIndices, ref, sql) {
|
|
111
111
|
const index = tryResolveColumnIndex(columns, candidateIndices, ref, sql);
|
|
112
112
|
if (index !== void 0) return index;
|
|
113
|
-
throw new require_odb_sql_errors.HsqldbSqlEvaluationError(`column "${ref.name}" not found
|
|
113
|
+
throw new require_odb_sql_errors.HsqldbSqlEvaluationError(`column "${ref.name}" not found—available: ${candidateIndices.length === 0 ? "(none)" : candidateIndices.map((index) => columns[index]?.columnName ?? "?").join(", ")}`, sql);
|
|
114
114
|
}
|
|
115
115
|
var ColumnResolver = class {
|
|
116
116
|
sql;
|
|
@@ -351,14 +351,14 @@ function partitionIntoGroups(rows, groupIndices, resolver) {
|
|
|
351
351
|
}
|
|
352
352
|
function evaluateGrouped(statement, plan, matching, resolver) {
|
|
353
353
|
const groupIndices = statement.groupBy.map((ref) => resolver.indexOf(ref));
|
|
354
|
-
for (const item of plan) if (item.kind === "column" && !groupIndices.includes(item.index)) throw new require_odb_sql_errors.HsqldbSqlEvaluationError(`column "${item.text}" is neither grouped nor aggregated
|
|
354
|
+
for (const item of plan) if (item.kind === "column" && !groupIndices.includes(item.index)) throw new require_odb_sql_errors.HsqldbSqlEvaluationError(`column "${item.text}" is neither grouped nor aggregated—add it to GROUP BY or wrap it in an aggregate`, statement.sql);
|
|
355
355
|
const groups = groupIndices.length === 0 ? [{
|
|
356
356
|
keyValues: [],
|
|
357
357
|
rows: [...matching]
|
|
358
358
|
}] : partitionIntoGroups(matching, groupIndices, resolver);
|
|
359
359
|
const orderPositions = statement.orderBy.map((term) => {
|
|
360
360
|
const position = groupIndices.indexOf(resolver.indexOf(term.column));
|
|
361
|
-
if (position < 0) throw new require_odb_sql_errors.HsqldbSqlEvaluationError(`ORDER BY column "${term.column.text}" is not a GROUP BY column
|
|
361
|
+
if (position < 0) throw new require_odb_sql_errors.HsqldbSqlEvaluationError(`ORDER BY column "${term.column.text}" is not a GROUP BY column—a grouped result has no single value for it`, statement.sql);
|
|
362
362
|
return position;
|
|
363
363
|
});
|
|
364
364
|
const sortable = groups.map((group) => ({
|
|
@@ -407,7 +407,7 @@ function computeNaturalSharedPairs(leftColumns, rightColumns, sql) {
|
|
|
407
407
|
leftColumns.forEach((leftColumn, leftIndex) => {
|
|
408
408
|
const rightIndex = rightIndexByName.get(leftColumn.columnName);
|
|
409
409
|
if (rightIndex === void 0) return;
|
|
410
|
-
if (ambiguousRightNames.has(leftColumn.columnName) || seenNames.has(leftColumn.columnName)) throw new require_odb_sql_errors.HsqldbSqlEvaluationError(`NATURAL JOIN cannot determine a unique match for column "${leftColumn.columnName}"
|
|
410
|
+
if (ambiguousRightNames.has(leftColumn.columnName) || seenNames.has(leftColumn.columnName)) throw new require_odb_sql_errors.HsqldbSqlEvaluationError(`NATURAL JOIN cannot determine a unique match for column "${leftColumn.columnName}"—more than one column shares that name on one side of the join`, sql);
|
|
411
411
|
seenNames.add(leftColumn.columnName);
|
|
412
412
|
pairs.push({
|
|
413
413
|
leftIndex,
|
|
@@ -530,7 +530,7 @@ function evaluateSelectInScope(statement, tables, outer) {
|
|
|
530
530
|
const matching = where === void 0 ? rows : rows.filter((row) => evaluatePredicate(where, row, resolver, tables, statement.sql) === "true");
|
|
531
531
|
const hasAggregate = plan.some((item) => item.kind === "aggregate");
|
|
532
532
|
if (statement.groupBy.length > 0 || hasAggregate) {
|
|
533
|
-
if (statement.groupBy.length > 0 && statement.items.some((item) => item.kind === "star")) throw new require_odb_sql_errors.HsqldbSqlEvaluationError("SELECT * is not valid with GROUP BY
|
|
533
|
+
if (statement.groupBy.length > 0 && statement.items.some((item) => item.kind === "star")) throw new require_odb_sql_errors.HsqldbSqlEvaluationError("SELECT * is not valid with GROUP BY—name the grouped columns and the aggregates explicitly", statement.sql);
|
|
534
534
|
return evaluateGrouped(statement, plan, matching, resolver);
|
|
535
535
|
}
|
|
536
536
|
return evaluateUngrouped(statement, plan, matching, resolver);
|
package/dist/odb/sql/evaluate.js
CHANGED
|
@@ -58,7 +58,7 @@ function tryResolveName(candidates, ref, what, sql) {
|
|
|
58
58
|
if (exact !== void 0) return exact;
|
|
59
59
|
if (!ref.quoted) {
|
|
60
60
|
const folded = candidates.filter((candidate) => candidate.toUpperCase() === ref.name);
|
|
61
|
-
if (folded.length > 1) throw new HsqldbSqlEvaluationError(`${what} "${ref.name}" is ambiguous
|
|
61
|
+
if (folded.length > 1) throw new HsqldbSqlEvaluationError(`${what} "${ref.name}" is ambiguous—it matches ${folded.join(", ")} case-insensitively`, sql);
|
|
62
62
|
const only = folded[0];
|
|
63
63
|
if (only !== void 0) return only;
|
|
64
64
|
}
|
|
@@ -66,7 +66,7 @@ function tryResolveName(candidates, ref, what, sql) {
|
|
|
66
66
|
function resolveName(candidates, ref, what, sql) {
|
|
67
67
|
const found = tryResolveName(candidates, ref, what, sql);
|
|
68
68
|
if (found !== void 0) return found;
|
|
69
|
-
throw new HsqldbSqlEvaluationError(`${what} "${ref.name}" not found
|
|
69
|
+
throw new HsqldbSqlEvaluationError(`${what} "${ref.name}" not found—available: ${candidates.length === 0 ? "(none)" : candidates.join(", ")}`, sql);
|
|
70
70
|
}
|
|
71
71
|
function resolveTable(tables, ref, sql) {
|
|
72
72
|
const resolvedName = resolveName(tables.map((table) => table.tableName), ref, "table", sql);
|
|
@@ -91,7 +91,7 @@ function tryResolveColumnIndex(columns, candidateIndices, ref, sql) {
|
|
|
91
91
|
exactCount += 1;
|
|
92
92
|
firstExact ??= index;
|
|
93
93
|
}
|
|
94
|
-
if (exactCount > 1) throw new HsqldbSqlEvaluationError(`column "${ref.name}" is ambiguous
|
|
94
|
+
if (exactCount > 1) throw new HsqldbSqlEvaluationError(`column "${ref.name}" is ambiguous—it matches more than one joined column named "${ref.name}"`, sql);
|
|
95
95
|
if (firstExact !== void 0) return firstExact;
|
|
96
96
|
if (!ref.quoted) {
|
|
97
97
|
let firstFolded;
|
|
@@ -102,14 +102,14 @@ function tryResolveColumnIndex(columns, candidateIndices, ref, sql) {
|
|
|
102
102
|
foldedNames.push(name);
|
|
103
103
|
firstFolded ??= index;
|
|
104
104
|
}
|
|
105
|
-
if (foldedNames.length > 1) throw new HsqldbSqlEvaluationError(`column "${ref.name}" is ambiguous
|
|
105
|
+
if (foldedNames.length > 1) throw new HsqldbSqlEvaluationError(`column "${ref.name}" is ambiguous—it matches ${foldedNames.join(", ")} case-insensitively`, sql);
|
|
106
106
|
if (firstFolded !== void 0) return firstFolded;
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
function resolveColumnIndex(columns, candidateIndices, ref, sql) {
|
|
110
110
|
const index = tryResolveColumnIndex(columns, candidateIndices, ref, sql);
|
|
111
111
|
if (index !== void 0) return index;
|
|
112
|
-
throw new HsqldbSqlEvaluationError(`column "${ref.name}" not found
|
|
112
|
+
throw new HsqldbSqlEvaluationError(`column "${ref.name}" not found—available: ${candidateIndices.length === 0 ? "(none)" : candidateIndices.map((index) => columns[index]?.columnName ?? "?").join(", ")}`, sql);
|
|
113
113
|
}
|
|
114
114
|
var ColumnResolver = class {
|
|
115
115
|
sql;
|
|
@@ -350,14 +350,14 @@ function partitionIntoGroups(rows, groupIndices, resolver) {
|
|
|
350
350
|
}
|
|
351
351
|
function evaluateGrouped(statement, plan, matching, resolver) {
|
|
352
352
|
const groupIndices = statement.groupBy.map((ref) => resolver.indexOf(ref));
|
|
353
|
-
for (const item of plan) if (item.kind === "column" && !groupIndices.includes(item.index)) throw new HsqldbSqlEvaluationError(`column "${item.text}" is neither grouped nor aggregated
|
|
353
|
+
for (const item of plan) if (item.kind === "column" && !groupIndices.includes(item.index)) throw new HsqldbSqlEvaluationError(`column "${item.text}" is neither grouped nor aggregated—add it to GROUP BY or wrap it in an aggregate`, statement.sql);
|
|
354
354
|
const groups = groupIndices.length === 0 ? [{
|
|
355
355
|
keyValues: [],
|
|
356
356
|
rows: [...matching]
|
|
357
357
|
}] : partitionIntoGroups(matching, groupIndices, resolver);
|
|
358
358
|
const orderPositions = statement.orderBy.map((term) => {
|
|
359
359
|
const position = groupIndices.indexOf(resolver.indexOf(term.column));
|
|
360
|
-
if (position < 0) throw new HsqldbSqlEvaluationError(`ORDER BY column "${term.column.text}" is not a GROUP BY column
|
|
360
|
+
if (position < 0) throw new HsqldbSqlEvaluationError(`ORDER BY column "${term.column.text}" is not a GROUP BY column—a grouped result has no single value for it`, statement.sql);
|
|
361
361
|
return position;
|
|
362
362
|
});
|
|
363
363
|
const sortable = groups.map((group) => ({
|
|
@@ -406,7 +406,7 @@ function computeNaturalSharedPairs(leftColumns, rightColumns, sql) {
|
|
|
406
406
|
leftColumns.forEach((leftColumn, leftIndex) => {
|
|
407
407
|
const rightIndex = rightIndexByName.get(leftColumn.columnName);
|
|
408
408
|
if (rightIndex === void 0) return;
|
|
409
|
-
if (ambiguousRightNames.has(leftColumn.columnName) || seenNames.has(leftColumn.columnName)) throw new HsqldbSqlEvaluationError(`NATURAL JOIN cannot determine a unique match for column "${leftColumn.columnName}"
|
|
409
|
+
if (ambiguousRightNames.has(leftColumn.columnName) || seenNames.has(leftColumn.columnName)) throw new HsqldbSqlEvaluationError(`NATURAL JOIN cannot determine a unique match for column "${leftColumn.columnName}"—more than one column shares that name on one side of the join`, sql);
|
|
410
410
|
seenNames.add(leftColumn.columnName);
|
|
411
411
|
pairs.push({
|
|
412
412
|
leftIndex,
|
|
@@ -529,7 +529,7 @@ function evaluateSelectInScope(statement, tables, outer) {
|
|
|
529
529
|
const matching = where === void 0 ? rows : rows.filter((row) => evaluatePredicate(where, row, resolver, tables, statement.sql) === "true");
|
|
530
530
|
const hasAggregate = plan.some((item) => item.kind === "aggregate");
|
|
531
531
|
if (statement.groupBy.length > 0 || hasAggregate) {
|
|
532
|
-
if (statement.groupBy.length > 0 && statement.items.some((item) => item.kind === "star")) throw new HsqldbSqlEvaluationError("SELECT * is not valid with GROUP BY
|
|
532
|
+
if (statement.groupBy.length > 0 && statement.items.some((item) => item.kind === "star")) throw new HsqldbSqlEvaluationError("SELECT * is not valid with GROUP BY—name the grouped columns and the aggregates explicitly", statement.sql);
|
|
533
533
|
return evaluateGrouped(statement, plan, matching, resolver);
|
|
534
534
|
}
|
|
535
535
|
return evaluateUngrouped(statement, plan, matching, resolver);
|
package/dist/odb/sql/parser.cjs
CHANGED
|
@@ -141,7 +141,7 @@ var SqlParser = class {
|
|
|
141
141
|
this.advance();
|
|
142
142
|
this.takePunctuation("(");
|
|
143
143
|
if (this.atPunctuation("*")) {
|
|
144
|
-
if (aggregate !== "COUNT") this.fail(`a column name
|
|
144
|
+
if (aggregate !== "COUNT") this.fail(`a column name — ${aggregate}(*) is not valid SQL, only COUNT(*) is`);
|
|
145
145
|
this.advance();
|
|
146
146
|
this.takePunctuation(")");
|
|
147
147
|
return {
|
|
@@ -413,7 +413,7 @@ var SqlParser = class {
|
|
|
413
413
|
}
|
|
414
414
|
parseGroupByColumn() {
|
|
415
415
|
const token = this.peek();
|
|
416
|
-
if (token.kind === "keyword" && isAggregateFunction(token.keyword)) this.fail("a column name
|
|
416
|
+
if (token.kind === "keyword" && isAggregateFunction(token.keyword)) this.fail("a column name — an aggregate function is not valid in GROUP BY");
|
|
417
417
|
return this.parseColumnRef();
|
|
418
418
|
}
|
|
419
419
|
parseOrderBy() {
|
package/dist/odb/sql/parser.js
CHANGED
|
@@ -140,7 +140,7 @@ var SqlParser = class {
|
|
|
140
140
|
this.advance();
|
|
141
141
|
this.takePunctuation("(");
|
|
142
142
|
if (this.atPunctuation("*")) {
|
|
143
|
-
if (aggregate !== "COUNT") this.fail(`a column name
|
|
143
|
+
if (aggregate !== "COUNT") this.fail(`a column name — ${aggregate}(*) is not valid SQL, only COUNT(*) is`);
|
|
144
144
|
this.advance();
|
|
145
145
|
this.takePunctuation(")");
|
|
146
146
|
return {
|
|
@@ -412,7 +412,7 @@ var SqlParser = class {
|
|
|
412
412
|
}
|
|
413
413
|
parseGroupByColumn() {
|
|
414
414
|
const token = this.peek();
|
|
415
|
-
if (token.kind === "keyword" && isAggregateFunction(token.keyword)) this.fail("a column name
|
|
415
|
+
if (token.kind === "keyword" && isAggregateFunction(token.keyword)) this.fail("a column name — an aggregate function is not valid in GROUP BY");
|
|
416
416
|
return this.parseColumnRef();
|
|
417
417
|
}
|
|
418
418
|
parseOrderBy() {
|
package/dist/package-codec.cjs
CHANGED
|
@@ -23,7 +23,7 @@ function isOdfPackageFormat(format) {
|
|
|
23
23
|
var UnsupportedPackageFormatError = class extends Error {
|
|
24
24
|
format;
|
|
25
25
|
constructor(format) {
|
|
26
|
-
super(`'${format}' documents carry no raw package concept to decode/encode
|
|
26
|
+
super(`'${format}' documents carry no raw package concept to decode/encode — expected one of docx, pptx, xlsx, odt, odp, ods, odg, odf`);
|
|
27
27
|
this.name = "UnsupportedPackageFormatError";
|
|
28
28
|
this.format = format;
|
|
29
29
|
}
|
package/dist/package-codec.js
CHANGED
|
@@ -22,7 +22,7 @@ function isOdfPackageFormat(format) {
|
|
|
22
22
|
var UnsupportedPackageFormatError = class extends Error {
|
|
23
23
|
format;
|
|
24
24
|
constructor(format) {
|
|
25
|
-
super(`'${format}' documents carry no raw package concept to decode/encode
|
|
25
|
+
super(`'${format}' documents carry no raw package concept to decode/encode — expected one of docx, pptx, xlsx, odt, odp, ods, odg, odf`);
|
|
26
26
|
this.name = "UnsupportedPackageFormatError";
|
|
27
27
|
this.format = format;
|
|
28
28
|
}
|
package/dist/svg/write.cjs
CHANGED
|
@@ -15,7 +15,7 @@ var SvgUnsupportedDocumentKindError = class extends Error {
|
|
|
15
15
|
var SvgMultiPageNotSpecifiedError = class extends Error {
|
|
16
16
|
pageCount;
|
|
17
17
|
constructor(pageCount) {
|
|
18
|
-
super(`buildSvgText: this document has more than one page (${pageCount})
|
|
18
|
+
super(`buildSvgText: this document has more than one page (${pageCount}) — pass { page: <index> } to select one`);
|
|
19
19
|
this.name = "SvgMultiPageNotSpecifiedError";
|
|
20
20
|
this.pageCount = pageCount;
|
|
21
21
|
}
|
|
@@ -24,7 +24,7 @@ var SvgPageNotFoundError = class extends Error {
|
|
|
24
24
|
page;
|
|
25
25
|
pageCount;
|
|
26
26
|
constructor(page, pageCount) {
|
|
27
|
-
super(`buildSvgText: page index ${page} not found
|
|
27
|
+
super(`buildSvgText: page index ${page} not found — the document has ${pageCount} page(s)`);
|
|
28
28
|
this.name = "SvgPageNotFoundError";
|
|
29
29
|
this.page = page;
|
|
30
30
|
this.pageCount = pageCount;
|
package/dist/svg/write.js
CHANGED
|
@@ -14,7 +14,7 @@ var SvgUnsupportedDocumentKindError = class extends Error {
|
|
|
14
14
|
var SvgMultiPageNotSpecifiedError = class extends Error {
|
|
15
15
|
pageCount;
|
|
16
16
|
constructor(pageCount) {
|
|
17
|
-
super(`buildSvgText: this document has more than one page (${pageCount})
|
|
17
|
+
super(`buildSvgText: this document has more than one page (${pageCount}) — pass { page: <index> } to select one`);
|
|
18
18
|
this.name = "SvgMultiPageNotSpecifiedError";
|
|
19
19
|
this.pageCount = pageCount;
|
|
20
20
|
}
|
|
@@ -23,7 +23,7 @@ var SvgPageNotFoundError = class extends Error {
|
|
|
23
23
|
page;
|
|
24
24
|
pageCount;
|
|
25
25
|
constructor(page, pageCount) {
|
|
26
|
-
super(`buildSvgText: page index ${page} not found
|
|
26
|
+
super(`buildSvgText: page index ${page} not found — the document has ${pageCount} page(s)`);
|
|
27
27
|
this.name = "SvgPageNotFoundError";
|
|
28
28
|
this.page = page;
|
|
29
29
|
this.pageCount = pageCount;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "js.documents",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.1.1",
|
|
4
4
|
"description": "Bidirectional docx/pptx <-> PDF conversion and a read+write editable OOXML document model, built on ooxml.js and Zod 4 codecs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -77,21 +77,21 @@
|
|
|
77
77
|
],
|
|
78
78
|
"license": "MIT",
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"archive-codec": "1.11.
|
|
81
|
-
"byte-codec": "1.8.
|
|
82
|
-
"doc-codec": "6.0.
|
|
83
|
-
"document-schema.js": "7.14.
|
|
84
|
-
"epub-codec": "5.0.
|
|
80
|
+
"archive-codec": "1.11.11",
|
|
81
|
+
"byte-codec": "1.8.1",
|
|
82
|
+
"doc-codec": "6.0.2",
|
|
83
|
+
"document-schema.js": "7.14.1",
|
|
84
|
+
"epub-codec": "5.0.2",
|
|
85
85
|
"fflate": "0.8.3",
|
|
86
|
-
"markdown-codec": "11.0.
|
|
87
|
-
"odf.js": "11.0.
|
|
88
|
-
"ooxml.js": "12.0.
|
|
89
|
-
"pdf-codec": "5.2.
|
|
90
|
-
"ppt-codec": "2.1.
|
|
91
|
-
"rtf-codec": "8.0.
|
|
86
|
+
"markdown-codec": "11.0.2",
|
|
87
|
+
"odf.js": "11.0.1",
|
|
88
|
+
"ooxml.js": "12.0.1",
|
|
89
|
+
"pdf-codec": "5.2.5",
|
|
90
|
+
"ppt-codec": "2.1.1",
|
|
91
|
+
"rtf-codec": "8.0.2",
|
|
92
92
|
"temml": "0.13.4",
|
|
93
|
-
"wpd-codec": "5.1.
|
|
94
|
-
"xls-codec": "4.15.
|
|
93
|
+
"wpd-codec": "5.1.1",
|
|
94
|
+
"xls-codec": "4.15.17",
|
|
95
95
|
"zod": "4.4.3"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|