document-cli 1.11.5 → 1.11.6
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/dist/cli.js +8 -9
- package/dist/index.cjs +6 -7
- package/dist/index.js +7 -8
- package/dist/{tui-Bw_z7xq6.js → tui-Cl3hyOfi.js} +4 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
import { a as odbFormSummary, c as formatDocxExtrasLines, d as writeOutput, f as loadProvidedFonts, h as isDocumentFormat, i as formatOdbReportLines, l as readInput, m as inferFormatFromExtension, n as describeOdbReport, o as formatMetadataLines, r as formatOdbFormLines, s as presentMetadataEntries, t as describeOdbForm, u as resolveDefaultOutputPath } from "./odb-structure-CS2Eybob.js";
|
|
3
3
|
import { Command, CommanderError, InvalidArgumentError } from "commander";
|
|
4
4
|
import { writeFile } from "node:fs/promises";
|
|
5
|
-
import { HsqldbSqlEvaluationError, HsqldbSqlParseError, HsqldbSqlUnsupportedError, OdbNoEmbeddedDataSourceError, OdbReportNotSpecifiedError, OdbTableNotFoundError, OdbTableNotSpecifiedError, OdbUnsupportedFormatError, OdmUnresolvedSectionError, PdfEncryptedError, PdfParseError, UnrecognizedDocumentSchemaError, UnsupportedFontSourceFormatError, buildDocumentBytes, createLocalDocumentConverter, decodePackage, documentFromJson, documentPackageWithSchema, evaluateSelect, extractSourceFontsForFormat, hsqldbCellDisplayText, layoutDocumentWithSchema, odbReportToDocx, odbReportToOdt, odbReportToPdf, odbToCsv, odbToXlsx, odmToPdf, parseSelect, readDocumentMetadata, readDocxExtras, readOdbForms, readOdbInventory, readOdbReportContent, readOdbReports, readOdbTables, readPdf, setDocumentMetadata } from "documents.js";
|
|
5
|
+
import { HsqldbSqlEvaluationError, HsqldbSqlParseError, HsqldbSqlUnsupportedError, OdbNoEmbeddedDataSourceError, OdbReportNotSpecifiedError, OdbTableNotFoundError, OdbTableNotSpecifiedError, OdbUnsupportedFormatError, OdmUnresolvedSectionError, PdfEncryptedError, PdfParseError, UnrecognizedDocumentSchemaError, UnsupportedFontSourceFormatError, buildDocumentBytes, createLocalDocumentConverter, decodeOdbPackage, decodePackage, documentFromJson, documentPackageWithSchema, evaluateSelect, extractSourceFontsForFormat, hsqldbCellDisplayText, layoutDocumentWithSchema, odbReportToDocx, odbReportToOdt, odbReportToPdf, odbToCsv, odbToXlsx, odmToPdf, parseSelect, readDocumentMetadata, readDocxExtras, readOdbForms, readOdbInventory, readOdbReportContent, readOdbReports, readOdbTables, readPdf, setDocumentMetadata } from "documents.js";
|
|
6
6
|
import { basename, dirname, extname, join } from "node:path";
|
|
7
|
-
import { decodePackage as decodePackage$1 } from "odf.js";
|
|
8
7
|
import { existsSync, readFileSync } from "node:fs";
|
|
9
8
|
//#region src/runtime/abort.ts
|
|
10
9
|
function combineSignals(a, b) {
|
|
@@ -567,7 +566,7 @@ async function runOdbTables(input, options) {
|
|
|
567
566
|
const { signal, getAbortReason } = createRuntimeSignal({});
|
|
568
567
|
try {
|
|
569
568
|
const inputBytes = await readInput(input, { signal });
|
|
570
|
-
const pkg =
|
|
569
|
+
const pkg = decodeOdbPackage(new Uint8Array(inputBytes));
|
|
571
570
|
const tables = readOdbTables(pkg);
|
|
572
571
|
if (options.json) {
|
|
573
572
|
const summary = tables.map((table) => ({
|
|
@@ -612,7 +611,7 @@ async function runOdbQuery(input, options) {
|
|
|
612
611
|
const { signal, getAbortReason } = createRuntimeSignal({});
|
|
613
612
|
try {
|
|
614
613
|
const inputBytes = await readInput(input, { signal });
|
|
615
|
-
const pkg =
|
|
614
|
+
const pkg = decodeOdbPackage(new Uint8Array(inputBytes));
|
|
616
615
|
const resolved = resolveQuerySql(pkg, options);
|
|
617
616
|
if ("errorMessage" in resolved) {
|
|
618
617
|
process.stderr.write(`[${command}] ${resolved.errorMessage}\n`);
|
|
@@ -634,7 +633,7 @@ async function runOdbForms(input, options) {
|
|
|
634
633
|
const { signal, getAbortReason } = createRuntimeSignal({});
|
|
635
634
|
try {
|
|
636
635
|
const inputBytes = await readInput(input, { signal });
|
|
637
|
-
const forms = readOdbForms(
|
|
636
|
+
const forms = readOdbForms(decodeOdbPackage(new Uint8Array(inputBytes)));
|
|
638
637
|
if (options.json) {
|
|
639
638
|
process.stdout.write(`${JSON.stringify(forms.map((form) => odbFormSummary(form)))}\n`);
|
|
640
639
|
return 0;
|
|
@@ -657,7 +656,7 @@ async function runOdbReports(input, options) {
|
|
|
657
656
|
const { signal, getAbortReason } = createRuntimeSignal({});
|
|
658
657
|
try {
|
|
659
658
|
const inputBytes = await readInput(input, { signal });
|
|
660
|
-
const reports = readOdbReports(
|
|
659
|
+
const reports = readOdbReports(decodeOdbPackage(new Uint8Array(inputBytes)));
|
|
661
660
|
if (options.json) {
|
|
662
661
|
process.stdout.write(`${JSON.stringify(reports)}\n`);
|
|
663
662
|
return 0;
|
|
@@ -715,7 +714,7 @@ async function runOdbRenderReport(input, output, options) {
|
|
|
715
714
|
try {
|
|
716
715
|
const inputBytes = await readInput(input, { signal });
|
|
717
716
|
const fonts = await loadProvidedFonts(options.fontFile ?? [], { signal });
|
|
718
|
-
const pkg =
|
|
717
|
+
const pkg = decodeOdbPackage(new Uint8Array(inputBytes));
|
|
719
718
|
const content = readOdbReportContent(pkg, { report: options.report });
|
|
720
719
|
const bytes = targetFormat === "docx" ? odbReportToDocx(content) : targetFormat === "odt" ? odbReportToOdt(content) : odbReportToPdf(content, {
|
|
721
720
|
signal,
|
|
@@ -1047,7 +1046,7 @@ function registerSetMetadataCommand(program) {
|
|
|
1047
1046
|
}
|
|
1048
1047
|
//#endregion
|
|
1049
1048
|
//#region package.json
|
|
1050
|
-
var version = "1.11.
|
|
1049
|
+
var version = "1.11.6";
|
|
1051
1050
|
//#endregion
|
|
1052
1051
|
//#region src/program.ts
|
|
1053
1052
|
function createProgram() {
|
|
@@ -1074,7 +1073,7 @@ function createProgram() {
|
|
|
1074
1073
|
//#region src/cli.ts
|
|
1075
1074
|
async function launchTui(startPath, signal) {
|
|
1076
1075
|
try {
|
|
1077
|
-
const { runTui } = await import("./tui-
|
|
1076
|
+
const { runTui } = await import("./tui-Cl3hyOfi.js");
|
|
1078
1077
|
await runTui({
|
|
1079
1078
|
startPath,
|
|
1080
1079
|
signal
|
package/dist/index.cjs
CHANGED
|
@@ -4,7 +4,6 @@ let documents_js = require("documents.js");
|
|
|
4
4
|
let pdf_codec = require("pdf-codec");
|
|
5
5
|
let node_path = require("node:path");
|
|
6
6
|
let commander = require("commander");
|
|
7
|
-
let odf_js = require("odf.js");
|
|
8
7
|
let node_fs = require("node:fs");
|
|
9
8
|
//#region src/format.ts
|
|
10
9
|
const EXTENSION_TO_FORMAT = {
|
|
@@ -885,7 +884,7 @@ async function runOdbTables(input, options) {
|
|
|
885
884
|
const { signal, getAbortReason } = createRuntimeSignal({});
|
|
886
885
|
try {
|
|
887
886
|
const inputBytes = await readInput(input, { signal });
|
|
888
|
-
const pkg = (0,
|
|
887
|
+
const pkg = (0, documents_js.decodeOdbPackage)(new Uint8Array(inputBytes));
|
|
889
888
|
const tables = (0, documents_js.readOdbTables)(pkg);
|
|
890
889
|
if (options.json) {
|
|
891
890
|
const summary = tables.map((table) => ({
|
|
@@ -930,7 +929,7 @@ async function runOdbQuery(input, options) {
|
|
|
930
929
|
const { signal, getAbortReason } = createRuntimeSignal({});
|
|
931
930
|
try {
|
|
932
931
|
const inputBytes = await readInput(input, { signal });
|
|
933
|
-
const pkg = (0,
|
|
932
|
+
const pkg = (0, documents_js.decodeOdbPackage)(new Uint8Array(inputBytes));
|
|
934
933
|
const resolved = resolveQuerySql(pkg, options);
|
|
935
934
|
if ("errorMessage" in resolved) {
|
|
936
935
|
process.stderr.write(`[${command}] ${resolved.errorMessage}\n`);
|
|
@@ -952,7 +951,7 @@ async function runOdbForms(input, options) {
|
|
|
952
951
|
const { signal, getAbortReason } = createRuntimeSignal({});
|
|
953
952
|
try {
|
|
954
953
|
const inputBytes = await readInput(input, { signal });
|
|
955
|
-
const forms = (0, documents_js.readOdbForms)((0,
|
|
954
|
+
const forms = (0, documents_js.readOdbForms)((0, documents_js.decodeOdbPackage)(new Uint8Array(inputBytes)));
|
|
956
955
|
if (options.json) {
|
|
957
956
|
process.stdout.write(`${JSON.stringify(forms.map((form) => odbFormSummary(form)))}\n`);
|
|
958
957
|
return 0;
|
|
@@ -975,7 +974,7 @@ async function runOdbReports(input, options) {
|
|
|
975
974
|
const { signal, getAbortReason } = createRuntimeSignal({});
|
|
976
975
|
try {
|
|
977
976
|
const inputBytes = await readInput(input, { signal });
|
|
978
|
-
const reports = (0, documents_js.readOdbReports)((0,
|
|
977
|
+
const reports = (0, documents_js.readOdbReports)((0, documents_js.decodeOdbPackage)(new Uint8Array(inputBytes)));
|
|
979
978
|
if (options.json) {
|
|
980
979
|
process.stdout.write(`${JSON.stringify(reports)}\n`);
|
|
981
980
|
return 0;
|
|
@@ -1033,7 +1032,7 @@ async function runOdbRenderReport(input, output, options) {
|
|
|
1033
1032
|
try {
|
|
1034
1033
|
const inputBytes = await readInput(input, { signal });
|
|
1035
1034
|
const fonts = await loadProvidedFonts(options.fontFile ?? [], { signal });
|
|
1036
|
-
const pkg = (0,
|
|
1035
|
+
const pkg = (0, documents_js.decodeOdbPackage)(new Uint8Array(inputBytes));
|
|
1037
1036
|
const content = (0, documents_js.readOdbReportContent)(pkg, { report: options.report });
|
|
1038
1037
|
const bytes = targetFormat === "docx" ? (0, documents_js.odbReportToDocx)(content) : targetFormat === "odt" ? (0, documents_js.odbReportToOdt)(content) : (0, documents_js.odbReportToPdf)(content, {
|
|
1039
1038
|
signal,
|
|
@@ -1365,7 +1364,7 @@ function registerSetMetadataCommand(program) {
|
|
|
1365
1364
|
}
|
|
1366
1365
|
//#endregion
|
|
1367
1366
|
//#region package.json
|
|
1368
|
-
var version = "1.11.
|
|
1367
|
+
var version = "1.11.6";
|
|
1369
1368
|
//#endregion
|
|
1370
1369
|
//#region src/program.ts
|
|
1371
1370
|
function createProgram() {
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { readFile, writeFile } from "node:fs/promises";
|
|
2
|
-
import { HsqldbSqlEvaluationError, HsqldbSqlParseError, HsqldbSqlUnsupportedError, OdbNoEmbeddedDataSourceError, OdbReportNotSpecifiedError, OdbTableNotFoundError, OdbTableNotSpecifiedError, OdbUnsupportedFormatError, OdmUnresolvedSectionError, PdfEncryptedError, PdfParseError, UnrecognizedDocumentSchemaError, UnsupportedFontSourceFormatError, buildDocumentBytes, createLocalDocumentConverter, decodePackage, documentFromJson, documentPackageWithSchema, evaluateSelect, extractSourceFontsForFormat, hsqldbCellDisplayText, layoutDocumentWithSchema, odbReportToDocx, odbReportToOdt, odbReportToPdf, odbToCsv, odbToXlsx, odmToPdf, parseSelect, readDocumentMetadata, readDocxExtras, readOdbForms, readOdbInventory, readOdbReportContent, readOdbReports, readOdbTables, readPdf, setDocumentMetadata } from "documents.js";
|
|
2
|
+
import { HsqldbSqlEvaluationError, HsqldbSqlParseError, HsqldbSqlUnsupportedError, OdbNoEmbeddedDataSourceError, OdbReportNotSpecifiedError, OdbTableNotFoundError, OdbTableNotSpecifiedError, OdbUnsupportedFormatError, OdmUnresolvedSectionError, PdfEncryptedError, PdfParseError, UnrecognizedDocumentSchemaError, UnsupportedFontSourceFormatError, buildDocumentBytes, createLocalDocumentConverter, decodeOdbPackage, decodePackage, documentFromJson, documentPackageWithSchema, evaluateSelect, extractSourceFontsForFormat, hsqldbCellDisplayText, layoutDocumentWithSchema, odbReportToDocx, odbReportToOdt, odbReportToPdf, odbToCsv, odbToXlsx, odmToPdf, parseSelect, readDocumentMetadata, readDocxExtras, readOdbForms, readOdbInventory, readOdbReportContent, readOdbReports, readOdbTables, readPdf, setDocumentMetadata } from "documents.js";
|
|
3
3
|
import { readFontFace } from "pdf-codec";
|
|
4
4
|
import { basename, dirname, extname, join } from "node:path";
|
|
5
5
|
import { Command, InvalidArgumentError } from "commander";
|
|
6
|
-
import { decodePackage as decodePackage$1 } from "odf.js";
|
|
7
6
|
import { existsSync, readFileSync } from "node:fs";
|
|
8
7
|
//#region src/format.ts
|
|
9
8
|
const EXTENSION_TO_FORMAT = {
|
|
@@ -884,7 +883,7 @@ async function runOdbTables(input, options) {
|
|
|
884
883
|
const { signal, getAbortReason } = createRuntimeSignal({});
|
|
885
884
|
try {
|
|
886
885
|
const inputBytes = await readInput(input, { signal });
|
|
887
|
-
const pkg =
|
|
886
|
+
const pkg = decodeOdbPackage(new Uint8Array(inputBytes));
|
|
888
887
|
const tables = readOdbTables(pkg);
|
|
889
888
|
if (options.json) {
|
|
890
889
|
const summary = tables.map((table) => ({
|
|
@@ -929,7 +928,7 @@ async function runOdbQuery(input, options) {
|
|
|
929
928
|
const { signal, getAbortReason } = createRuntimeSignal({});
|
|
930
929
|
try {
|
|
931
930
|
const inputBytes = await readInput(input, { signal });
|
|
932
|
-
const pkg =
|
|
931
|
+
const pkg = decodeOdbPackage(new Uint8Array(inputBytes));
|
|
933
932
|
const resolved = resolveQuerySql(pkg, options);
|
|
934
933
|
if ("errorMessage" in resolved) {
|
|
935
934
|
process.stderr.write(`[${command}] ${resolved.errorMessage}\n`);
|
|
@@ -951,7 +950,7 @@ async function runOdbForms(input, options) {
|
|
|
951
950
|
const { signal, getAbortReason } = createRuntimeSignal({});
|
|
952
951
|
try {
|
|
953
952
|
const inputBytes = await readInput(input, { signal });
|
|
954
|
-
const forms = readOdbForms(
|
|
953
|
+
const forms = readOdbForms(decodeOdbPackage(new Uint8Array(inputBytes)));
|
|
955
954
|
if (options.json) {
|
|
956
955
|
process.stdout.write(`${JSON.stringify(forms.map((form) => odbFormSummary(form)))}\n`);
|
|
957
956
|
return 0;
|
|
@@ -974,7 +973,7 @@ async function runOdbReports(input, options) {
|
|
|
974
973
|
const { signal, getAbortReason } = createRuntimeSignal({});
|
|
975
974
|
try {
|
|
976
975
|
const inputBytes = await readInput(input, { signal });
|
|
977
|
-
const reports = readOdbReports(
|
|
976
|
+
const reports = readOdbReports(decodeOdbPackage(new Uint8Array(inputBytes)));
|
|
978
977
|
if (options.json) {
|
|
979
978
|
process.stdout.write(`${JSON.stringify(reports)}\n`);
|
|
980
979
|
return 0;
|
|
@@ -1032,7 +1031,7 @@ async function runOdbRenderReport(input, output, options) {
|
|
|
1032
1031
|
try {
|
|
1033
1032
|
const inputBytes = await readInput(input, { signal });
|
|
1034
1033
|
const fonts = await loadProvidedFonts(options.fontFile ?? [], { signal });
|
|
1035
|
-
const pkg =
|
|
1034
|
+
const pkg = decodeOdbPackage(new Uint8Array(inputBytes));
|
|
1036
1035
|
const content = readOdbReportContent(pkg, { report: options.report });
|
|
1037
1036
|
const bytes = targetFormat === "docx" ? odbReportToDocx(content) : targetFormat === "odt" ? odbReportToOdt(content) : odbReportToPdf(content, {
|
|
1038
1037
|
signal,
|
|
@@ -1364,7 +1363,7 @@ function registerSetMetadataCommand(program) {
|
|
|
1364
1363
|
}
|
|
1365
1364
|
//#endregion
|
|
1366
1365
|
//#region package.json
|
|
1367
|
-
var version = "1.11.
|
|
1366
|
+
var version = "1.11.6";
|
|
1368
1367
|
//#endregion
|
|
1369
1368
|
//#region src/program.ts
|
|
1370
1369
|
function createProgram() {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { c as formatDocxExtrasLines, f as loadProvidedFonts, i as formatOdbReportLines, l as readInput, m as inferFormatFromExtension, n as describeOdbReport, o as formatMetadataLines, p as formatToExtension, r as formatOdbFormLines, t as describeOdbForm } from "./odb-structure-CS2Eybob.js";
|
|
2
2
|
import { readFile, writeFile } from "node:fs/promises";
|
|
3
|
-
import { bytesToBase64, createDocx, createOdg, createOdp, createOds, createOdt, createPdf, createPptx, decodeMarkdownText, docxToPdf, encodeMarkdownText, hsqldbCellDisplayText, markdownToPdf, odbReportToDocx, odbReportToOdt, odbReportToPdf, odgToPdf, odpToPdf, odsToPdf, odtToPdf, openDocx, openMarkdown, openOdg, openOdp, openOds, openOdt, openPdf, openPptx, parseXml, pptxToPdf, readDocxContent, readDocxExtras, readMarkdownContent, readOdbForms, readOdbReportContent, readOdbReports, readOdbTables, readOdgContent, readOdpContent, readOdsContent, readOdtContent, readPdf, readPptxContent, rgbHexToColor, xlsxToPdf } from "documents.js";
|
|
3
|
+
import { bytesToBase64, createDocx, createOdg, createOdp, createOds, createOdt, createPdf, createPptx, decodeMarkdownText, decodeOdbPackage, docxToPdf, encodeMarkdownText, hsqldbCellDisplayText, markdownToPdf, odbReportToDocx, odbReportToOdt, odbReportToPdf, odgToPdf, odpToPdf, odsToPdf, odtToPdf, openDocx, openMarkdown, openOdg, openOdp, openOds, openOdt, openPdf, openPptx, parseXml, pptxToPdf, readDocxContent, readDocxExtras, readMarkdownContent, readOdbForms, readOdbReportContent, readOdbReports, readOdbTables, readOdgContent, readOdpContent, readOdsContent, readOdtContent, readPdf, readPptxContent, rgbHexToColor, xlsxToPdf } from "documents.js";
|
|
4
4
|
import { basename, dirname, extname, join } from "node:path";
|
|
5
|
-
import { cellReference, columnIndexToLetters, decodePackage as decodePackage$1 } from "odf.js";
|
|
6
5
|
import { readdirSync } from "node:fs";
|
|
7
6
|
import { Box, Text, render, useApp, useInput, useWindowSize } from "ink";
|
|
8
7
|
import { createContext, useContext, useEffect, useReducer, useState } from "react";
|
|
9
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
9
|
import TextInput from "ink-text-input";
|
|
10
|
+
import { cellReference, columnIndexToLetters } from "odf.js";
|
|
11
11
|
//#region src/tui/errors.ts
|
|
12
12
|
function describeError(error) {
|
|
13
13
|
if (error instanceof Error) return error.message;
|
|
@@ -78,7 +78,7 @@ const ODB_EXTENSION = ".odb";
|
|
|
78
78
|
async function openDocumentAtPath(path, options = {}) {
|
|
79
79
|
const bytes = new Uint8Array(await readFile(path));
|
|
80
80
|
if (path.toLowerCase().endsWith(ODB_EXTENSION)) {
|
|
81
|
-
const pkg =
|
|
81
|
+
const pkg = decodeOdbPackage(bytes);
|
|
82
82
|
return {
|
|
83
83
|
format: "odb",
|
|
84
84
|
tables: readOdbTables(pkg),
|
|
@@ -3812,7 +3812,7 @@ async function renderOdbReportTo(doc, destinationPath, options) {
|
|
|
3812
3812
|
const format = detectFormat(destinationPath);
|
|
3813
3813
|
if (!isReportRenderTargetFormat(format)) throw new Error(`Cannot tell whether to render "${options.reportName}" as docx, odt, or pdf from '${destinationPath}' -- give the destination one of those three extensions`);
|
|
3814
3814
|
const fonts = await loadProvidedFonts(options.fontFiles ?? [], { signal: options.signal });
|
|
3815
|
-
const pkg =
|
|
3815
|
+
const pkg = decodeOdbPackage(new Uint8Array(await readFile(doc.path)));
|
|
3816
3816
|
const content = readOdbReportContent(pkg, { report: options.reportName });
|
|
3817
3817
|
const bytes = format === "docx" ? odbReportToDocx(content) : format === "odt" ? odbReportToOdt(content) : odbReportToPdf(content, toPdfOptions(options, fonts));
|
|
3818
3818
|
await writeFile(destinationPath, bytes);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "document-cli",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.6",
|
|
4
4
|
"description": "CLI and interactive Ink TUI for documents.js: every docx/pptx/odt/odp/ods/odg/odf/pdf/odm/odb/xlsx/markdown conversion, bridge, and editor as a scriptable command or a terminal app.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|