document-operations 1.1.6 → 1.1.8

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/index.cjs CHANGED
@@ -178,6 +178,7 @@ const convertDocumentOperation = defineOperation({
178
178
  async run({ source, targetFormat, output, fonts, onSubstitutionDiagnostics, images }, context) {
179
179
  const signal = context?.signal;
180
180
  const { bytes, format } = await resolveDocumentInput(source, { signal });
181
+ const wantsFontSubstitutionDiagnostics = onSubstitutionDiagnostics === true;
181
182
  const fontSubstitutions = [];
182
183
  const conversionSignal = signal ?? new AbortController().signal;
183
184
  const result = await converter.convert({
@@ -194,7 +195,7 @@ const convertDocumentOperation = defineOperation({
194
195
  italic: font.italic,
195
196
  bytes: (0, documents_js.base64ToBytes)(font.bytesBase64)
196
197
  })),
197
- onFontSubstitution: onSubstitutionDiagnostics === true ? (substitution) => fontSubstitutions.push(substitution) : void 0,
198
+ onFontSubstitution: wantsFontSubstitutionDiagnostics ? (substitution) => fontSubstitutions.push(substitution) : void 0,
198
199
  images: images === void 0 ? void 0 : (destination) => {
199
200
  const base64 = images[destination];
200
201
  return base64 === void 0 ? void 0 : { bytes: (0, documents_js.base64ToBytes)(base64) };
@@ -205,7 +206,7 @@ const convertDocumentOperation = defineOperation({
205
206
  targetFormat: result.document.format,
206
207
  output: resolvedOutput,
207
208
  diagnostics: [...result.diagnostics],
208
- ...onSubstitutionDiagnostics === true ? { fontSubstitutions: [...fontSubstitutions] } : {}
209
+ ...wantsFontSubstitutionDiagnostics ? { fontSubstitutions: [...fontSubstitutions] } : {}
209
210
  };
210
211
  }
211
212
  });
@@ -563,7 +564,7 @@ const fromPackageOperation = defineOperation({
563
564
  result = (0, documents_js.documentFromJson)(parsed);
564
565
  } catch (error) {
565
566
  if (error instanceof documents_js.UnrecognizedDocumentSchemaError) throw new Error("'source' has no recognised $schema -- only a file carrying a real DocumentTree (e.g. written by a caller's own --dump-package-equivalent step) can be read back by this operation", { cause: error });
566
- if (error instanceof zod.z.ZodError) throw new Error(`'source' failed ${(0, documents_js.documentSchemaKindOf)(parsed) ?? "document schema"} validation: ${error.message}`, { cause: error });
567
+ if (error instanceof zod.z.ZodError) throw new Error(`'source' failed ${(0, documents_js.documentSchemaKindOf)(parsed)} validation: ${error.message}`, { cause: error });
567
568
  throw error;
568
569
  }
569
570
  if (result.kind !== "DocumentTree") throw new Error(`'source' is a ${result.kind}, not a DocumentTree -- only a file carrying a real DocumentTree (e.g. written by a caller's own --dump-package-equivalent step) can be read back by this operation`);
@@ -781,20 +782,10 @@ const odbRenderReportOperation = defineOperation({
781
782
  const pkg = (0, documents_js.decodeOdbPackage)(inputBytes);
782
783
  const content = (0, documents_js.readOdbReportContent)(pkg, { report });
783
784
  const mathDiagnostics = [];
784
- const recordMathDiagnostic = (diagnostic, diagnosticContext) => {
785
- mathDiagnostics.push({
786
- kind: diagnostic.kind,
787
- detail: diagnostic.detail,
788
- sourcePath: diagnosticContext.sourcePath
789
- });
790
- };
791
785
  const fontSubstitutions = [];
792
786
  const charSubstitutions = [];
793
787
  let bytes;
794
- if (targetFormat === "docx") bytes = (0, documents_js.odbReportToDocx)(content, {
795
- signal,
796
- onMathDiagnostic: recordMathDiagnostic
797
- });
788
+ if (targetFormat === "docx") bytes = (0, documents_js.odbReportToDocx)(content, { signal });
798
789
  else if (targetFormat === "odt") bytes = (0, documents_js.odbReportToOdt)(content, { signal });
799
790
  else bytes = (0, documents_js.odbReportToPdf)(content, {
800
791
  signal,
@@ -804,15 +795,13 @@ const odbRenderReportOperation = defineOperation({
804
795
  italic: font.italic,
805
796
  bytes: (0, documents_js.base64ToBytes)(font.bytesBase64)
806
797
  })),
807
- onFontSubstitution: (substitution) => fontSubstitutions.push(substitution),
808
798
  onSubstitution: (substitution, substitutionContext) => {
809
799
  charSubstitutions.push({
810
800
  from: substitution.from,
811
801
  to: substitution.to,
812
802
  pageIndex: substitutionContext.pageIndex
813
803
  });
814
- },
815
- onMathDiagnostic: recordMathDiagnostic
804
+ }
816
805
  });
817
806
  return {
818
807
  ...await resolveDocumentOutput(bytes, output ?? {}),
package/dist/index.d.cts CHANGED
@@ -336,7 +336,7 @@ declare const computeFormulaOperation: {
336
336
  path: string;
337
337
  } | {
338
338
  bytesBase64: string;
339
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
339
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
340
340
  };
341
341
  bindings?: Record<string, {
342
342
  kind: "quantity";
@@ -349,7 +349,7 @@ declare const computeFormulaOperation: {
349
349
  dimension: Partial<Record<"length" | "mass" | "time" | "electricCurrent" | "thermodynamicTemperature" | "amountOfSubstance" | "luminousIntensity", number>>;
350
350
  }> | undefined;
351
351
  }, context?: DocumentOperationContext): Promise<{
352
- sourceFormat: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
352
+ sourceFormat: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
353
353
  documentKind: "wordprocessing" | "presentation" | "spreadsheet" | "drawing" | "formula";
354
354
  formulaCount: number;
355
355
  formulas: {
@@ -596,9 +596,9 @@ declare const convertDocumentOperation: {
596
596
  path: string;
597
597
  } | {
598
598
  bytesBase64: string;
599
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
599
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
600
600
  };
601
- targetFormat: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
601
+ targetFormat: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
602
602
  output?: {
603
603
  outputPath?: string | undefined;
604
604
  } | undefined;
@@ -611,7 +611,7 @@ declare const convertDocumentOperation: {
611
611
  onSubstitutionDiagnostics?: boolean | undefined;
612
612
  images?: Record<string, string> | undefined;
613
613
  }, context?: DocumentOperationContext): Promise<{
614
- targetFormat: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
614
+ targetFormat: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
615
615
  output: {
616
616
  path: string;
617
617
  byteLength: number;
@@ -686,8 +686,8 @@ declare const listDocumentConversionsOperation: {
686
686
  }, z.core.$strip>;
687
687
  run(input: Record<string, never>, context?: DocumentOperationContext): Promise<{
688
688
  conversions: {
689
- source: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
690
- target: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
689
+ source: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
690
+ target: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
691
691
  }[];
692
692
  }>;
693
693
  };
@@ -729,7 +729,7 @@ declare const docxExtrasOperation: {
729
729
  path: string;
730
730
  } | {
731
731
  bytesBase64: string;
732
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
732
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
733
733
  };
734
734
  }, context?: DocumentOperationContext): Promise<import("documents.js").DocxExtras>;
735
735
  };
@@ -744,8 +744,8 @@ declare const documentCreateOperation: {
744
744
  docx: "docx";
745
745
  pptx: "pptx";
746
746
  odt: "odt";
747
- ods: "ods";
748
747
  odp: "odp";
748
+ ods: "ods";
749
749
  odg: "odg";
750
750
  markdown: "markdown";
751
751
  pdf: "pdf";
@@ -763,7 +763,7 @@ declare const documentCreateOperation: {
763
763
  large: z.ZodOptional<z.ZodLiteral<true>>;
764
764
  }, z.core.$strip>]>;
765
765
  run(input: {
766
- format: "docx" | "pptx" | "odt" | "ods" | "odp" | "odg" | "markdown" | "pdf";
766
+ format: "docx" | "pptx" | "odt" | "odp" | "ods" | "odg" | "markdown" | "pdf";
767
767
  output?: {
768
768
  outputPath?: string | undefined;
769
769
  } | undefined;
@@ -851,7 +851,7 @@ declare const documentAppendParagraphsOperation: {
851
851
  path: string;
852
852
  } | {
853
853
  bytesBase64: string;
854
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
854
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
855
855
  };
856
856
  targetFormat: "docx" | "odt" | "markdown";
857
857
  paragraphs: {
@@ -930,7 +930,7 @@ declare const fontsOperation: {
930
930
  path: string;
931
931
  } | {
932
932
  bytesBase64: string;
933
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
933
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
934
934
  };
935
935
  }, context?: DocumentOperationContext): Promise<{
936
936
  faces: {
@@ -1038,9 +1038,9 @@ declare const fromPackageOperation: {
1038
1038
  path: string;
1039
1039
  } | {
1040
1040
  bytesBase64: string;
1041
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
1041
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
1042
1042
  };
1043
- targetFormat: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
1043
+ targetFormat: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
1044
1044
  output?: {
1045
1045
  outputPath?: string | undefined;
1046
1046
  } | undefined;
@@ -1091,7 +1091,7 @@ declare const metadataReadOperation: {
1091
1091
  path: string;
1092
1092
  } | {
1093
1093
  bytesBase64: string;
1094
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
1094
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
1095
1095
  };
1096
1096
  }, context?: DocumentOperationContext): Promise<{
1097
1097
  title?: string | undefined;
@@ -1185,9 +1185,9 @@ declare const metadataWriteOperation: {
1185
1185
  path: string;
1186
1186
  } | {
1187
1187
  bytesBase64: string;
1188
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
1188
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
1189
1189
  };
1190
- targetFormat: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
1190
+ targetFormat: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
1191
1191
  output?: {
1192
1192
  outputPath?: string | undefined;
1193
1193
  } | undefined;
@@ -1337,7 +1337,7 @@ declare const odbTablesOperation: {
1337
1337
  path: string;
1338
1338
  } | {
1339
1339
  bytesBase64: string;
1340
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
1340
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
1341
1341
  };
1342
1342
  }, context?: DocumentOperationContext): Promise<readonly import("documents.js").HsqldbTable[]>;
1343
1343
  };
@@ -1377,7 +1377,7 @@ declare const odbFormsOperation: {
1377
1377
  path: string;
1378
1378
  } | {
1379
1379
  bytesBase64: string;
1380
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
1380
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
1381
1381
  };
1382
1382
  }, context?: DocumentOperationContext): Promise<readonly OdbForm[]>;
1383
1383
  };
@@ -1417,7 +1417,7 @@ declare const odbReportsOperation: {
1417
1417
  path: string;
1418
1418
  } | {
1419
1419
  bytesBase64: string;
1420
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
1420
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
1421
1421
  };
1422
1422
  }, context?: DocumentOperationContext): Promise<readonly OdbReport[]>;
1423
1423
  };
@@ -1459,7 +1459,7 @@ declare const odbQueryOperation: {
1459
1459
  path: string;
1460
1460
  } | {
1461
1461
  bytesBase64: string;
1462
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
1462
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
1463
1463
  };
1464
1464
  sql?: string | undefined;
1465
1465
  query?: string | undefined;
@@ -1505,7 +1505,7 @@ declare const odbToCsvOperation: {
1505
1505
  path: string;
1506
1506
  } | {
1507
1507
  bytesBase64: string;
1508
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
1508
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
1509
1509
  };
1510
1510
  table?: string | undefined;
1511
1511
  output?: {
@@ -1552,7 +1552,7 @@ declare const odbToXlsxOperation: {
1552
1552
  path: string;
1553
1553
  } | {
1554
1554
  bytesBase64: string;
1555
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
1555
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
1556
1556
  };
1557
1557
  output?: {
1558
1558
  outputPath?: string | undefined;
@@ -1720,7 +1720,7 @@ declare const odbRenderReportOperation: {
1720
1720
  path: string;
1721
1721
  } | {
1722
1722
  bytesBase64: string;
1723
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
1723
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
1724
1724
  };
1725
1725
  targetFormat: "docx" | "odt" | "pdf";
1726
1726
  report?: string | undefined;
@@ -1849,7 +1849,7 @@ declare const odmToPdfOperation: {
1849
1849
  path: string;
1850
1850
  } | {
1851
1851
  bytesBase64: string;
1852
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
1852
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
1853
1853
  };
1854
1854
  }[];
1855
1855
  output: {
@@ -1917,7 +1917,7 @@ declare const outlineDocumentOperation: {
1917
1917
  path: string;
1918
1918
  } | {
1919
1919
  bytesBase64: string;
1920
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
1920
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
1921
1921
  };
1922
1922
  }, context?: DocumentOperationContext): Promise<OutlineDocumentOutput>;
1923
1923
  };
@@ -2005,7 +2005,7 @@ declare const pdfInspectOperation: {
2005
2005
  path: string;
2006
2006
  } | {
2007
2007
  bytesBase64: string;
2008
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
2008
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
2009
2009
  };
2010
2010
  full?: boolean | undefined;
2011
2011
  }, context?: DocumentOperationContext): Promise<{
@@ -2207,7 +2207,7 @@ declare const pdfInspectOperation: {
2207
2207
  yPt: number;
2208
2208
  }][] | undefined;
2209
2209
  source?: {
2210
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odm" | "odb" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd";
2210
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "odf" | "markdown" | "rtf" | "wpd" | "epub" | "pdf" | "odm" | "odb";
2211
2211
  xml: string;
2212
2212
  } | undefined;
2213
2213
  }[] | undefined;
@@ -2250,7 +2250,7 @@ declare const pdfInspectOperation: {
2250
2250
  structure?: LayoutStructureElement[] | undefined;
2251
2251
  form?: LayoutFormField[] | undefined;
2252
2252
  source?: Record<string, {
2253
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odm" | "odb" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd";
2253
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "odf" | "markdown" | "rtf" | "wpd" | "epub" | "pdf" | "odm" | "odb";
2254
2254
  xml: string;
2255
2255
  }> | undefined;
2256
2256
  } | PdfInspectSummary>;
package/dist/index.d.ts CHANGED
@@ -336,7 +336,7 @@ declare const computeFormulaOperation: {
336
336
  path: string;
337
337
  } | {
338
338
  bytesBase64: string;
339
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
339
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
340
340
  };
341
341
  bindings?: Record<string, {
342
342
  kind: "quantity";
@@ -349,7 +349,7 @@ declare const computeFormulaOperation: {
349
349
  dimension: Partial<Record<"length" | "mass" | "time" | "electricCurrent" | "thermodynamicTemperature" | "amountOfSubstance" | "luminousIntensity", number>>;
350
350
  }> | undefined;
351
351
  }, context?: DocumentOperationContext): Promise<{
352
- sourceFormat: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
352
+ sourceFormat: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
353
353
  documentKind: "wordprocessing" | "presentation" | "spreadsheet" | "drawing" | "formula";
354
354
  formulaCount: number;
355
355
  formulas: {
@@ -596,9 +596,9 @@ declare const convertDocumentOperation: {
596
596
  path: string;
597
597
  } | {
598
598
  bytesBase64: string;
599
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
599
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
600
600
  };
601
- targetFormat: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
601
+ targetFormat: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
602
602
  output?: {
603
603
  outputPath?: string | undefined;
604
604
  } | undefined;
@@ -611,7 +611,7 @@ declare const convertDocumentOperation: {
611
611
  onSubstitutionDiagnostics?: boolean | undefined;
612
612
  images?: Record<string, string> | undefined;
613
613
  }, context?: DocumentOperationContext): Promise<{
614
- targetFormat: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
614
+ targetFormat: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
615
615
  output: {
616
616
  path: string;
617
617
  byteLength: number;
@@ -686,8 +686,8 @@ declare const listDocumentConversionsOperation: {
686
686
  }, z.core.$strip>;
687
687
  run(input: Record<string, never>, context?: DocumentOperationContext): Promise<{
688
688
  conversions: {
689
- source: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
690
- target: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
689
+ source: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
690
+ target: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
691
691
  }[];
692
692
  }>;
693
693
  };
@@ -729,7 +729,7 @@ declare const docxExtrasOperation: {
729
729
  path: string;
730
730
  } | {
731
731
  bytesBase64: string;
732
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
732
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
733
733
  };
734
734
  }, context?: DocumentOperationContext): Promise<import("documents.js").DocxExtras>;
735
735
  };
@@ -744,8 +744,8 @@ declare const documentCreateOperation: {
744
744
  docx: "docx";
745
745
  pptx: "pptx";
746
746
  odt: "odt";
747
- ods: "ods";
748
747
  odp: "odp";
748
+ ods: "ods";
749
749
  odg: "odg";
750
750
  markdown: "markdown";
751
751
  pdf: "pdf";
@@ -763,7 +763,7 @@ declare const documentCreateOperation: {
763
763
  large: z.ZodOptional<z.ZodLiteral<true>>;
764
764
  }, z.core.$strip>]>;
765
765
  run(input: {
766
- format: "docx" | "pptx" | "odt" | "ods" | "odp" | "odg" | "markdown" | "pdf";
766
+ format: "docx" | "pptx" | "odt" | "odp" | "ods" | "odg" | "markdown" | "pdf";
767
767
  output?: {
768
768
  outputPath?: string | undefined;
769
769
  } | undefined;
@@ -851,7 +851,7 @@ declare const documentAppendParagraphsOperation: {
851
851
  path: string;
852
852
  } | {
853
853
  bytesBase64: string;
854
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
854
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
855
855
  };
856
856
  targetFormat: "docx" | "odt" | "markdown";
857
857
  paragraphs: {
@@ -930,7 +930,7 @@ declare const fontsOperation: {
930
930
  path: string;
931
931
  } | {
932
932
  bytesBase64: string;
933
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
933
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
934
934
  };
935
935
  }, context?: DocumentOperationContext): Promise<{
936
936
  faces: {
@@ -1038,9 +1038,9 @@ declare const fromPackageOperation: {
1038
1038
  path: string;
1039
1039
  } | {
1040
1040
  bytesBase64: string;
1041
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
1041
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
1042
1042
  };
1043
- targetFormat: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
1043
+ targetFormat: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
1044
1044
  output?: {
1045
1045
  outputPath?: string | undefined;
1046
1046
  } | undefined;
@@ -1091,7 +1091,7 @@ declare const metadataReadOperation: {
1091
1091
  path: string;
1092
1092
  } | {
1093
1093
  bytesBase64: string;
1094
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
1094
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
1095
1095
  };
1096
1096
  }, context?: DocumentOperationContext): Promise<{
1097
1097
  title?: string | undefined;
@@ -1185,9 +1185,9 @@ declare const metadataWriteOperation: {
1185
1185
  path: string;
1186
1186
  } | {
1187
1187
  bytesBase64: string;
1188
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
1188
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
1189
1189
  };
1190
- targetFormat: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
1190
+ targetFormat: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
1191
1191
  output?: {
1192
1192
  outputPath?: string | undefined;
1193
1193
  } | undefined;
@@ -1337,7 +1337,7 @@ declare const odbTablesOperation: {
1337
1337
  path: string;
1338
1338
  } | {
1339
1339
  bytesBase64: string;
1340
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
1340
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
1341
1341
  };
1342
1342
  }, context?: DocumentOperationContext): Promise<readonly import("documents.js").HsqldbTable[]>;
1343
1343
  };
@@ -1377,7 +1377,7 @@ declare const odbFormsOperation: {
1377
1377
  path: string;
1378
1378
  } | {
1379
1379
  bytesBase64: string;
1380
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
1380
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
1381
1381
  };
1382
1382
  }, context?: DocumentOperationContext): Promise<readonly OdbForm[]>;
1383
1383
  };
@@ -1417,7 +1417,7 @@ declare const odbReportsOperation: {
1417
1417
  path: string;
1418
1418
  } | {
1419
1419
  bytesBase64: string;
1420
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
1420
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
1421
1421
  };
1422
1422
  }, context?: DocumentOperationContext): Promise<readonly OdbReport[]>;
1423
1423
  };
@@ -1459,7 +1459,7 @@ declare const odbQueryOperation: {
1459
1459
  path: string;
1460
1460
  } | {
1461
1461
  bytesBase64: string;
1462
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
1462
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
1463
1463
  };
1464
1464
  sql?: string | undefined;
1465
1465
  query?: string | undefined;
@@ -1505,7 +1505,7 @@ declare const odbToCsvOperation: {
1505
1505
  path: string;
1506
1506
  } | {
1507
1507
  bytesBase64: string;
1508
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
1508
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
1509
1509
  };
1510
1510
  table?: string | undefined;
1511
1511
  output?: {
@@ -1552,7 +1552,7 @@ declare const odbToXlsxOperation: {
1552
1552
  path: string;
1553
1553
  } | {
1554
1554
  bytesBase64: string;
1555
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
1555
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
1556
1556
  };
1557
1557
  output?: {
1558
1558
  outputPath?: string | undefined;
@@ -1720,7 +1720,7 @@ declare const odbRenderReportOperation: {
1720
1720
  path: string;
1721
1721
  } | {
1722
1722
  bytesBase64: string;
1723
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
1723
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
1724
1724
  };
1725
1725
  targetFormat: "docx" | "odt" | "pdf";
1726
1726
  report?: string | undefined;
@@ -1849,7 +1849,7 @@ declare const odmToPdfOperation: {
1849
1849
  path: string;
1850
1850
  } | {
1851
1851
  bytesBase64: string;
1852
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
1852
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
1853
1853
  };
1854
1854
  }[];
1855
1855
  output: {
@@ -1917,7 +1917,7 @@ declare const outlineDocumentOperation: {
1917
1917
  path: string;
1918
1918
  } | {
1919
1919
  bytesBase64: string;
1920
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
1920
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
1921
1921
  };
1922
1922
  }, context?: DocumentOperationContext): Promise<OutlineDocumentOutput>;
1923
1923
  };
@@ -2005,7 +2005,7 @@ declare const pdfInspectOperation: {
2005
2005
  path: string;
2006
2006
  } | {
2007
2007
  bytesBase64: string;
2008
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd" | "svg" | "csv" | "doc" | "xls" | "ppt";
2008
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "odf" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "wpd" | "epub" | "pdf";
2009
2009
  };
2010
2010
  full?: boolean | undefined;
2011
2011
  }, context?: DocumentOperationContext): Promise<{
@@ -2207,7 +2207,7 @@ declare const pdfInspectOperation: {
2207
2207
  yPt: number;
2208
2208
  }][] | undefined;
2209
2209
  source?: {
2210
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odm" | "odb" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd";
2210
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "odf" | "markdown" | "rtf" | "wpd" | "epub" | "pdf" | "odm" | "odb";
2211
2211
  xml: string;
2212
2212
  } | undefined;
2213
2213
  }[] | undefined;
@@ -2250,7 +2250,7 @@ declare const pdfInspectOperation: {
2250
2250
  structure?: LayoutStructureElement[] | undefined;
2251
2251
  form?: LayoutFormField[] | undefined;
2252
2252
  source?: Record<string, {
2253
- format: "docx" | "pptx" | "xlsx" | "odt" | "ods" | "odp" | "odg" | "odm" | "odb" | "odf" | "markdown" | "pdf" | "epub" | "rtf" | "wpd";
2253
+ format: "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "odf" | "markdown" | "rtf" | "wpd" | "epub" | "pdf" | "odm" | "odb";
2254
2254
  xml: string;
2255
2255
  }> | undefined;
2256
2256
  } | PdfInspectSummary>;
package/dist/index.js CHANGED
@@ -177,6 +177,7 @@ const convertDocumentOperation = defineOperation({
177
177
  async run({ source, targetFormat, output, fonts, onSubstitutionDiagnostics, images }, context) {
178
178
  const signal = context?.signal;
179
179
  const { bytes, format } = await resolveDocumentInput(source, { signal });
180
+ const wantsFontSubstitutionDiagnostics = onSubstitutionDiagnostics === true;
180
181
  const fontSubstitutions = [];
181
182
  const conversionSignal = signal ?? new AbortController().signal;
182
183
  const result = await converter.convert({
@@ -193,7 +194,7 @@ const convertDocumentOperation = defineOperation({
193
194
  italic: font.italic,
194
195
  bytes: base64ToBytes(font.bytesBase64)
195
196
  })),
196
- onFontSubstitution: onSubstitutionDiagnostics === true ? (substitution) => fontSubstitutions.push(substitution) : void 0,
197
+ onFontSubstitution: wantsFontSubstitutionDiagnostics ? (substitution) => fontSubstitutions.push(substitution) : void 0,
197
198
  images: images === void 0 ? void 0 : (destination) => {
198
199
  const base64 = images[destination];
199
200
  return base64 === void 0 ? void 0 : { bytes: base64ToBytes(base64) };
@@ -204,7 +205,7 @@ const convertDocumentOperation = defineOperation({
204
205
  targetFormat: result.document.format,
205
206
  output: resolvedOutput,
206
207
  diagnostics: [...result.diagnostics],
207
- ...onSubstitutionDiagnostics === true ? { fontSubstitutions: [...fontSubstitutions] } : {}
208
+ ...wantsFontSubstitutionDiagnostics ? { fontSubstitutions: [...fontSubstitutions] } : {}
208
209
  };
209
210
  }
210
211
  });
@@ -562,7 +563,7 @@ const fromPackageOperation = defineOperation({
562
563
  result = documentFromJson(parsed);
563
564
  } catch (error) {
564
565
  if (error instanceof UnrecognizedDocumentSchemaError) throw new Error("'source' has no recognised $schema -- only a file carrying a real DocumentTree (e.g. written by a caller's own --dump-package-equivalent step) can be read back by this operation", { cause: error });
565
- if (error instanceof z.ZodError) throw new Error(`'source' failed ${documentSchemaKindOf(parsed) ?? "document schema"} validation: ${error.message}`, { cause: error });
566
+ if (error instanceof z.ZodError) throw new Error(`'source' failed ${documentSchemaKindOf(parsed)} validation: ${error.message}`, { cause: error });
566
567
  throw error;
567
568
  }
568
569
  if (result.kind !== "DocumentTree") throw new Error(`'source' is a ${result.kind}, not a DocumentTree -- only a file carrying a real DocumentTree (e.g. written by a caller's own --dump-package-equivalent step) can be read back by this operation`);
@@ -780,20 +781,10 @@ const odbRenderReportOperation = defineOperation({
780
781
  const pkg = decodeOdbPackage(inputBytes);
781
782
  const content = readOdbReportContent(pkg, { report });
782
783
  const mathDiagnostics = [];
783
- const recordMathDiagnostic = (diagnostic, diagnosticContext) => {
784
- mathDiagnostics.push({
785
- kind: diagnostic.kind,
786
- detail: diagnostic.detail,
787
- sourcePath: diagnosticContext.sourcePath
788
- });
789
- };
790
784
  const fontSubstitutions = [];
791
785
  const charSubstitutions = [];
792
786
  let bytes;
793
- if (targetFormat === "docx") bytes = odbReportToDocx(content, {
794
- signal,
795
- onMathDiagnostic: recordMathDiagnostic
796
- });
787
+ if (targetFormat === "docx") bytes = odbReportToDocx(content, { signal });
797
788
  else if (targetFormat === "odt") bytes = odbReportToOdt(content, { signal });
798
789
  else bytes = odbReportToPdf(content, {
799
790
  signal,
@@ -803,15 +794,13 @@ const odbRenderReportOperation = defineOperation({
803
794
  italic: font.italic,
804
795
  bytes: base64ToBytes(font.bytesBase64)
805
796
  })),
806
- onFontSubstitution: (substitution) => fontSubstitutions.push(substitution),
807
797
  onSubstitution: (substitution, substitutionContext) => {
808
798
  charSubstitutions.push({
809
799
  from: substitution.from,
810
800
  to: substitution.to,
811
801
  pageIndex: substitutionContext.pageIndex
812
802
  });
813
- },
814
- onMathDiagnostic: recordMathDiagnostic
803
+ }
815
804
  });
816
805
  return {
817
806
  ...await resolveDocumentOutput(bytes, output ?? {}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "document-operations",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "The canonical set of document-conversion, editing, inspection, and .odb operations documents.js exposes -- one Zod input/output schema and one transport-agnostic run() function per operation, shared by document-mcp, document-cli, and a REST API server rather than each defining its own copy.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -82,10 +82,10 @@
82
82
  "license": "MIT",
83
83
  "packageManager": "pnpm@11.6.0",
84
84
  "dependencies": {
85
- "document-compute.js": "1.5.9",
86
- "document-outline.js": "3.7.3",
87
- "document-schema.js": "7.11.1",
88
- "documents.js": "7.20.6",
85
+ "document-compute.js": "1.5.11",
86
+ "document-outline.js": "3.9.0",
87
+ "document-schema.js": "7.11.2",
88
+ "documents.js": "7.20.8",
89
89
  "zod": "4.4.3"
90
90
  },
91
91
  "devDependencies": {
@@ -98,7 +98,7 @@
98
98
  "@vitest/coverage-v8": "4.1.11",
99
99
  "eslint": "10.8.1",
100
100
  "husky": "9.1.7",
101
- "odf.js": "7.25.2",
101
+ "odf.js": "7.25.3",
102
102
  "publint": "0.3.22",
103
103
  "semantic-release": "25.0.9",
104
104
  "tsdown": "0.22.14",