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/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,
|
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/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)) {
|
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)) {
|
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 !== "\"") {
|
package/dist/odb/read.cjs
CHANGED
|
@@ -8,7 +8,7 @@ let odf_js = require("odf.js");
|
|
|
8
8
|
var OdbNoEmbeddedDataSourceError = class extends Error {
|
|
9
9
|
url;
|
|
10
10
|
constructor(url) {
|
|
11
|
-
super(url === void 0 ? "readOdbTables: this .odb package has no embedded data source
|
|
11
|
+
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`);
|
|
12
12
|
this.name = "OdbNoEmbeddedDataSourceError";
|
|
13
13
|
this.url = url;
|
|
14
14
|
}
|
|
@@ -53,17 +53,17 @@ function readOdbTables(pkg, options) {
|
|
|
53
53
|
const engine = url.slice(14);
|
|
54
54
|
if (engine === "firebird") {
|
|
55
55
|
const firebirdPart = pkg.parts[DATABASE_FIREBIRD_PART];
|
|
56
|
-
if (firebirdPart === void 0) throw new OdbUnsupportedFormatError("unrecognised-engine", `an embedded Firebird engine with no ${DATABASE_FIREBIRD_PART} part
|
|
57
|
-
if (firebirdPart.kind !== "binary") throw new Error(`readOdbTables: ${DATABASE_FIREBIRD_PART} is not a binary part (found kind "${firebirdPart.kind}")
|
|
56
|
+
if (firebirdPart === void 0) throw new OdbUnsupportedFormatError("unrecognised-engine", `an embedded Firebird engine with no ${DATABASE_FIREBIRD_PART} part — an unrecognised embedded storage shape`);
|
|
57
|
+
if (firebirdPart.kind !== "binary") throw new Error(`readOdbTables: ${DATABASE_FIREBIRD_PART} is not a binary part (found kind "${firebirdPart.kind}") — malformed .odb package`);
|
|
58
58
|
const backupBytes = (0, odf_js.base64ToBytes)(firebirdPart.base64);
|
|
59
59
|
return require_firebird_backup.readFirebirdBackup(backupBytes).tables;
|
|
60
60
|
}
|
|
61
61
|
if (engine !== "hsqldb") throw new OdbUnsupportedFormatError("unrecognised-engine", `the embedded "${engine}" database engine`);
|
|
62
62
|
const manifestEntry = (0, odf_js.readManifest)(pkg).entries.find((entry) => entry.fullPath === DATABASE_SCRIPT_PART);
|
|
63
|
-
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}")
|
|
63
|
+
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`);
|
|
64
64
|
const scriptPart = pkg.parts[DATABASE_SCRIPT_PART];
|
|
65
|
-
if (scriptPart === void 0) throw new OdbUnsupportedFormatError("unrecognised-engine", `an embedded HSQLDB engine with no ${DATABASE_SCRIPT_PART} part
|
|
66
|
-
if (scriptPart.kind !== "binary") throw new Error(`readOdbTables: ${DATABASE_SCRIPT_PART} is not a binary part (found kind "${scriptPart.kind}")
|
|
65
|
+
if (scriptPart === void 0) throw new OdbUnsupportedFormatError("unrecognised-engine", `an embedded HSQLDB engine with no ${DATABASE_SCRIPT_PART} part — an unrecognised embedded storage shape`);
|
|
66
|
+
if (scriptPart.kind !== "binary") throw new Error(`readOdbTables: ${DATABASE_SCRIPT_PART} is not a binary part (found kind "${scriptPart.kind}") — malformed .odb package`);
|
|
67
67
|
const scriptBytes = (0, odf_js.base64ToBytes)(scriptPart.base64);
|
|
68
68
|
const classification = classifyScriptBytes(scriptBytes);
|
|
69
69
|
if (classification !== "text") {
|
|
@@ -77,10 +77,10 @@ function readOdbTables(pkg, options) {
|
|
|
77
77
|
function withCachedTableRows(pkg, tables, scriptText, options) {
|
|
78
78
|
const dataPart = pkg.parts[DATABASE_DATA_PART];
|
|
79
79
|
if (dataPart === void 0) return tables;
|
|
80
|
-
if (dataPart.kind !== "binary") throw new Error(`readOdbTables: ${DATABASE_DATA_PART} is not a binary part (found kind "${dataPart.kind}")
|
|
80
|
+
if (dataPart.kind !== "binary") throw new Error(`readOdbTables: ${DATABASE_DATA_PART} is not a binary part (found kind "${dataPart.kind}") — malformed .odb package`);
|
|
81
81
|
const propertiesPart = pkg.parts[DATABASE_PROPERTIES_PART];
|
|
82
|
-
if (propertiesPart === void 0) throw new Error(`readOdbTables: ${DATABASE_DATA_PART} is present but ${DATABASE_PROPERTIES_PART} is not
|
|
83
|
-
if (propertiesPart.kind !== "binary") throw new Error(`readOdbTables: ${DATABASE_PROPERTIES_PART} is not a binary part (found kind "${propertiesPart.kind}")
|
|
82
|
+
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)`);
|
|
83
|
+
if (propertiesPart.kind !== "binary") throw new Error(`readOdbTables: ${DATABASE_PROPERTIES_PART} is not a binary part (found kind "${propertiesPart.kind}") — malformed .odb package`);
|
|
84
84
|
const dataBytes = (0, odf_js.base64ToBytes)(dataPart.base64);
|
|
85
85
|
const propertiesText = new TextDecoder("utf-8", { fatal: true }).decode((0, odf_js.base64ToBytes)(propertiesPart.base64));
|
|
86
86
|
return require_hsqldb_cache.decodeHsqldbCachedTables(tables, scriptText, dataBytes, propertiesText, options);
|