@usejunior/docx-core 0.10.0 → 0.11.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.
Files changed (248) hide show
  1. package/LICENSE +202 -21
  2. package/NOTICE +2 -0
  3. package/README.md +2 -2
  4. package/dist/.tsbuildinfo +1 -1
  5. package/dist/atomizer.d.ts +13 -7
  6. package/dist/atomizer.d.ts.map +1 -1
  7. package/dist/atomizer.js +59 -24
  8. package/dist/atomizer.js.map +1 -1
  9. package/dist/baselines/atomizer/auxiliaryIdCollision.d.ts +99 -0
  10. package/dist/baselines/atomizer/auxiliaryIdCollision.d.ts.map +1 -0
  11. package/dist/baselines/atomizer/auxiliaryIdCollision.js +415 -0
  12. package/dist/baselines/atomizer/auxiliaryIdCollision.js.map +1 -0
  13. package/dist/baselines/atomizer/documentReconstructor.d.ts.map +1 -1
  14. package/dist/baselines/atomizer/documentReconstructor.js +120 -27
  15. package/dist/baselines/atomizer/documentReconstructor.js.map +1 -1
  16. package/dist/baselines/atomizer/inPlaceModifier-wrappers.d.ts +9 -0
  17. package/dist/baselines/atomizer/inPlaceModifier-wrappers.d.ts.map +1 -1
  18. package/dist/baselines/atomizer/inPlaceModifier-wrappers.js +52 -4
  19. package/dist/baselines/atomizer/inPlaceModifier-wrappers.js.map +1 -1
  20. package/dist/baselines/atomizer/pipeline.d.ts +12 -53
  21. package/dist/baselines/atomizer/pipeline.d.ts.map +1 -1
  22. package/dist/baselines/atomizer/pipeline.js +126 -231
  23. package/dist/baselines/atomizer/pipeline.js.map +1 -1
  24. package/dist/baselines/atomizer/trackChangesAcceptorAst.d.ts.map +1 -1
  25. package/dist/baselines/atomizer/trackChangesAcceptorAst.js +153 -23
  26. package/dist/baselines/atomizer/trackChangesAcceptorAst.js.map +1 -1
  27. package/dist/baselines/wmlcomparer/DotnetCli.d.ts.map +1 -1
  28. package/dist/baselines/wmlcomparer/DotnetCli.js +7 -0
  29. package/dist/baselines/wmlcomparer/DotnetCli.js.map +1 -1
  30. package/dist/cli/compare-two.d.ts.map +1 -1
  31. package/dist/cli/compare-two.js +3 -1
  32. package/dist/cli/compare-two.js.map +1 -1
  33. package/dist/cli/conformance-adapter.d.ts +3 -0
  34. package/dist/cli/conformance-adapter.d.ts.map +1 -0
  35. package/dist/cli/conformance-adapter.js +93 -0
  36. package/dist/cli/conformance-adapter.js.map +1 -0
  37. package/dist/cli/index.d.ts.map +1 -1
  38. package/dist/cli/index.js +5 -1
  39. package/dist/cli/index.js.map +1 -1
  40. package/dist/compare-types.d.ts +46 -0
  41. package/dist/compare-types.d.ts.map +1 -1
  42. package/dist/generation/compile.d.ts +22 -0
  43. package/dist/generation/compile.d.ts.map +1 -0
  44. package/dist/generation/compile.js +58 -0
  45. package/dist/generation/compile.js.map +1 -0
  46. package/dist/generation/context.d.ts +42 -0
  47. package/dist/generation/context.d.ts.map +1 -0
  48. package/dist/generation/context.js +65 -0
  49. package/dist/generation/context.js.map +1 -0
  50. package/dist/generation/emit/comments-part.d.ts +36 -0
  51. package/dist/generation/emit/comments-part.d.ts.map +1 -0
  52. package/dist/generation/emit/comments-part.js +116 -0
  53. package/dist/generation/emit/comments-part.js.map +1 -0
  54. package/dist/generation/emit/document-part.d.ts +24 -0
  55. package/dist/generation/emit/document-part.d.ts.map +1 -0
  56. package/dist/generation/emit/document-part.js +60 -0
  57. package/dist/generation/emit/document-part.js.map +1 -0
  58. package/dist/generation/emit/emit-context.d.ts +28 -0
  59. package/dist/generation/emit/emit-context.d.ts.map +1 -0
  60. package/dist/generation/emit/emit-context.js +19 -0
  61. package/dist/generation/emit/emit-context.js.map +1 -0
  62. package/dist/generation/emit/font-table-part.d.ts +16 -0
  63. package/dist/generation/emit/font-table-part.d.ts.map +1 -0
  64. package/dist/generation/emit/font-table-part.js +74 -0
  65. package/dist/generation/emit/font-table-part.js.map +1 -0
  66. package/dist/generation/emit/header-footer-part.d.ts +23 -0
  67. package/dist/generation/emit/header-footer-part.d.ts.map +1 -0
  68. package/dist/generation/emit/header-footer-part.js +57 -0
  69. package/dist/generation/emit/header-footer-part.js.map +1 -0
  70. package/dist/generation/emit/numbering-part.d.ts +29 -0
  71. package/dist/generation/emit/numbering-part.d.ts.map +1 -0
  72. package/dist/generation/emit/numbering-part.js +102 -0
  73. package/dist/generation/emit/numbering-part.js.map +1 -0
  74. package/dist/generation/emit/package-parts.d.ts +24 -0
  75. package/dist/generation/emit/package-parts.d.ts.map +1 -0
  76. package/dist/generation/emit/package-parts.js +121 -0
  77. package/dist/generation/emit/package-parts.js.map +1 -0
  78. package/dist/generation/emit/paragraph.d.ts +24 -0
  79. package/dist/generation/emit/paragraph.d.ts.map +1 -0
  80. package/dist/generation/emit/paragraph.js +63 -0
  81. package/dist/generation/emit/paragraph.js.map +1 -0
  82. package/dist/generation/emit/properties.d.ts +36 -0
  83. package/dist/generation/emit/properties.d.ts.map +1 -0
  84. package/dist/generation/emit/properties.js +154 -0
  85. package/dist/generation/emit/properties.js.map +1 -0
  86. package/dist/generation/emit/run.d.ts +16 -0
  87. package/dist/generation/emit/run.d.ts.map +1 -0
  88. package/dist/generation/emit/run.js +71 -0
  89. package/dist/generation/emit/run.js.map +1 -0
  90. package/dist/generation/emit/section.d.ts +29 -0
  91. package/dist/generation/emit/section.d.ts.map +1 -0
  92. package/dist/generation/emit/section.js +117 -0
  93. package/dist/generation/emit/section.js.map +1 -0
  94. package/dist/generation/emit/settings-part.d.ts +13 -0
  95. package/dist/generation/emit/settings-part.d.ts.map +1 -0
  96. package/dist/generation/emit/settings-part.js +68 -0
  97. package/dist/generation/emit/settings-part.js.map +1 -0
  98. package/dist/generation/emit/styles-part.d.ts +16 -0
  99. package/dist/generation/emit/styles-part.d.ts.map +1 -0
  100. package/dist/generation/emit/styles-part.js +82 -0
  101. package/dist/generation/emit/styles-part.js.map +1 -0
  102. package/dist/generation/emit/table.d.ts +26 -0
  103. package/dist/generation/emit/table.d.ts.map +1 -0
  104. package/dist/generation/emit/table.js +209 -0
  105. package/dist/generation/emit/table.js.map +1 -0
  106. package/dist/generation/emit/theme-part.d.ts +21 -0
  107. package/dist/generation/emit/theme-part.d.ts.map +1 -0
  108. package/dist/generation/emit/theme-part.js +151 -0
  109. package/dist/generation/emit/theme-part.js.map +1 -0
  110. package/dist/generation/emit/web-settings-part.d.ts +12 -0
  111. package/dist/generation/emit/web-settings-part.d.ts.map +1 -0
  112. package/dist/generation/emit/web-settings-part.js +19 -0
  113. package/dist/generation/emit/web-settings-part.js.map +1 -0
  114. package/dist/generation/errors.d.ts +22 -0
  115. package/dist/generation/errors.d.ts.map +1 -0
  116. package/dist/generation/errors.js +29 -0
  117. package/dist/generation/errors.js.map +1 -0
  118. package/dist/generation/index.d.ts +13 -0
  119. package/dist/generation/index.d.ts.map +1 -0
  120. package/dist/generation/index.js +12 -0
  121. package/dist/generation/index.js.map +1 -0
  122. package/dist/generation/ordering.d.ts +46 -0
  123. package/dist/generation/ordering.d.ts.map +1 -0
  124. package/dist/generation/ordering.js +119 -0
  125. package/dist/generation/ordering.js.map +1 -0
  126. package/dist/generation/recipes.d.ts +70 -0
  127. package/dist/generation/recipes.d.ts.map +1 -0
  128. package/dist/generation/recipes.js +149 -0
  129. package/dist/generation/recipes.js.map +1 -0
  130. package/dist/generation/structural-checks.d.ts +24 -0
  131. package/dist/generation/structural-checks.d.ts.map +1 -0
  132. package/dist/generation/structural-checks.js +318 -0
  133. package/dist/generation/structural-checks.js.map +1 -0
  134. package/dist/generation/theme-colors.d.ts +4 -0
  135. package/dist/generation/theme-colors.d.ts.map +1 -0
  136. package/dist/generation/theme-colors.js +18 -0
  137. package/dist/generation/theme-colors.js.map +1 -0
  138. package/dist/generation/types.d.ts +249 -0
  139. package/dist/generation/types.d.ts.map +1 -0
  140. package/dist/generation/types.js +54 -0
  141. package/dist/generation/types.js.map +1 -0
  142. package/dist/generation/validate-spec.d.ts +27 -0
  143. package/dist/generation/validate-spec.d.ts.map +1 -0
  144. package/dist/generation/validate-spec.js +359 -0
  145. package/dist/generation/validate-spec.js.map +1 -0
  146. package/dist/index.d.ts +3 -0
  147. package/dist/index.d.ts.map +1 -1
  148. package/dist/index.js +8 -0
  149. package/dist/index.js.map +1 -1
  150. package/dist/integration/generation-probes.d.ts +15 -0
  151. package/dist/integration/generation-probes.d.ts.map +1 -0
  152. package/dist/integration/generation-probes.js +84 -0
  153. package/dist/integration/generation-probes.js.map +1 -0
  154. package/dist/integration/libreoffice-oracle.d.ts +8 -0
  155. package/dist/integration/libreoffice-oracle.d.ts.map +1 -1
  156. package/dist/integration/libreoffice-oracle.js +14 -6
  157. package/dist/integration/libreoffice-oracle.js.map +1 -1
  158. package/dist/integration/synthetic-docx-fixture.d.ts +72 -0
  159. package/dist/integration/synthetic-docx-fixture.d.ts.map +1 -1
  160. package/dist/integration/synthetic-docx-fixture.js +131 -4
  161. package/dist/integration/synthetic-docx-fixture.js.map +1 -1
  162. package/dist/primitives/accept_changes.d.ts +2 -1
  163. package/dist/primitives/accept_changes.d.ts.map +1 -1
  164. package/dist/primitives/accept_changes.js +153 -12
  165. package/dist/primitives/accept_changes.js.map +1 -1
  166. package/dist/primitives/document.d.ts +38 -0
  167. package/dist/primitives/document.d.ts.map +1 -1
  168. package/dist/primitives/document.js +75 -9
  169. package/dist/primitives/document.js.map +1 -1
  170. package/dist/primitives/document_view-comments.d.ts.map +1 -1
  171. package/dist/primitives/document_view-comments.js +4 -3
  172. package/dist/primitives/document_view-comments.js.map +1 -1
  173. package/dist/primitives/document_view-types.d.ts +15 -0
  174. package/dist/primitives/document_view-types.d.ts.map +1 -1
  175. package/dist/primitives/document_view.d.ts.map +1 -1
  176. package/dist/primitives/document_view.js +21 -13
  177. package/dist/primitives/document_view.js.map +1 -1
  178. package/dist/primitives/formatting_tags.d.ts +1 -0
  179. package/dist/primitives/formatting_tags.d.ts.map +1 -1
  180. package/dist/primitives/formatting_tags.js +16 -10
  181. package/dist/primitives/formatting_tags.js.map +1 -1
  182. package/dist/primitives/index.d.ts +4 -0
  183. package/dist/primitives/index.d.ts.map +1 -1
  184. package/dist/primitives/index.js +4 -0
  185. package/dist/primitives/index.js.map +1 -1
  186. package/dist/primitives/layout.d.ts.map +1 -1
  187. package/dist/primitives/layout.js +13 -0
  188. package/dist/primitives/layout.js.map +1 -1
  189. package/dist/primitives/minimal_save.d.ts +38 -0
  190. package/dist/primitives/minimal_save.d.ts.map +1 -0
  191. package/dist/primitives/minimal_save.js +323 -0
  192. package/dist/primitives/minimal_save.js.map +1 -0
  193. package/dist/primitives/namespaces.d.ts +46 -0
  194. package/dist/primitives/namespaces.d.ts.map +1 -1
  195. package/dist/primitives/namespaces.js +49 -0
  196. package/dist/primitives/namespaces.js.map +1 -1
  197. package/dist/primitives/reject_changes.d.ts +4 -2
  198. package/dist/primitives/reject_changes.d.ts.map +1 -1
  199. package/dist/primitives/reject_changes.js +177 -24
  200. package/dist/primitives/reject_changes.js.map +1 -1
  201. package/dist/primitives/revision-parts.d.ts +7 -0
  202. package/dist/primitives/revision-parts.d.ts.map +1 -0
  203. package/dist/primitives/revision-parts.js +27 -0
  204. package/dist/primitives/revision-parts.js.map +1 -0
  205. package/dist/primitives/revision-vocabulary.d.ts +7 -0
  206. package/dist/primitives/revision-vocabulary.d.ts.map +1 -0
  207. package/dist/primitives/revision-vocabulary.js +39 -0
  208. package/dist/primitives/revision-vocabulary.js.map +1 -0
  209. package/dist/primitives/schema-corpus-capture.d.ts +19 -0
  210. package/dist/primitives/schema-corpus-capture.d.ts.map +1 -0
  211. package/dist/primitives/schema-corpus-capture.js +29 -0
  212. package/dist/primitives/schema-corpus-capture.js.map +1 -0
  213. package/dist/primitives/sectPrAudit.d.ts +19 -0
  214. package/dist/primitives/sectPrAudit.d.ts.map +1 -0
  215. package/dist/primitives/sectPrAudit.js +165 -0
  216. package/dist/primitives/sectPrAudit.js.map +1 -0
  217. package/dist/primitives/semantic_tags.d.ts.map +1 -1
  218. package/dist/primitives/semantic_tags.js +2 -1
  219. package/dist/primitives/semantic_tags.js.map +1 -1
  220. package/dist/primitives/serialize_html.d.ts +1 -0
  221. package/dist/primitives/serialize_html.d.ts.map +1 -1
  222. package/dist/primitives/serialize_html.js +4 -2
  223. package/dist/primitives/serialize_html.js.map +1 -1
  224. package/dist/primitives/styles.d.ts +15 -0
  225. package/dist/primitives/styles.d.ts.map +1 -1
  226. package/dist/primitives/styles.js +11 -0
  227. package/dist/primitives/styles.js.map +1 -1
  228. package/dist/primitives/track-changes-emitter.d.ts +9 -0
  229. package/dist/primitives/track-changes-emitter.d.ts.map +1 -1
  230. package/dist/primitives/track-changes-emitter.js +54 -4
  231. package/dist/primitives/track-changes-emitter.js.map +1 -1
  232. package/dist/primitives/validate_ai_revisions.d.ts +35 -0
  233. package/dist/primitives/validate_ai_revisions.d.ts.map +1 -0
  234. package/dist/primitives/validate_ai_revisions.js +323 -0
  235. package/dist/primitives/validate_ai_revisions.js.map +1 -0
  236. package/dist/primitives/xml.d.ts +5 -0
  237. package/dist/primitives/xml.d.ts.map +1 -1
  238. package/dist/primitives/xml.js +5 -0
  239. package/dist/primitives/xml.js.map +1 -1
  240. package/dist/primitives/zip.d.ts +1 -0
  241. package/dist/primitives/zip.d.ts.map +1 -1
  242. package/dist/primitives/zip.js +21 -3
  243. package/dist/primitives/zip.js.map +1 -1
  244. package/dist/shared/field-structure.d.ts +14 -0
  245. package/dist/shared/field-structure.d.ts.map +1 -0
  246. package/dist/shared/field-structure.js +166 -0
  247. package/dist/shared/field-structure.js.map +1 -0
  248. package/package.json +7 -4
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Declarative document specification for from-scratch DOCX generation.
3
+ *
4
+ * The entire surface is plain data: discriminated unions on `kind`, no Map /
5
+ * Date / class instances, explicit unit suffixes (`...Twips`, `...Pt`) instead
6
+ * of bare numbers. `JSON.parse(JSON.stringify(spec))` is identity over any
7
+ * valid spec, which is what lets a stored recipe (or, later, an MCP payload)
8
+ * compile without translation.
9
+ *
10
+ * The type surface intentionally covers the full feature set of the
11
+ * add-docx-generation change even though emitters land in phases; the
12
+ * compiler rejects any spec feature whose emitter has not shipped yet
13
+ * (see validate-spec.ts) rather than silently ignoring it.
14
+ */
15
+ export const THEME_COLOR_SLOTS = [
16
+ 'text1',
17
+ 'background1',
18
+ 'text2',
19
+ 'background2',
20
+ 'accent1',
21
+ 'accent2',
22
+ 'accent3',
23
+ 'accent4',
24
+ 'accent5',
25
+ 'accent6',
26
+ 'hyperlink',
27
+ 'followedHyperlink',
28
+ ];
29
+ /**
30
+ * The fixed set of text-highlight values (CT_HighlightColor). Single source of
31
+ * truth: the {@link HighlightColor} union is derived from this array, and
32
+ * validation reuses it as a runtime whitelist so JSON/JS callers cannot author
33
+ * an out-of-enum `w:highlight`.
34
+ */
35
+ export const HIGHLIGHT_COLORS = [
36
+ 'yellow',
37
+ 'green',
38
+ 'cyan',
39
+ 'magenta',
40
+ 'blue',
41
+ 'red',
42
+ 'darkBlue',
43
+ 'darkCyan',
44
+ 'darkGreen',
45
+ 'darkMagenta',
46
+ 'darkRed',
47
+ 'darkYellow',
48
+ 'darkGray',
49
+ 'lightGray',
50
+ 'black',
51
+ 'white',
52
+ 'none',
53
+ ];
54
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/generation/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAyBH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,OAAO;IACP,aAAa;IACb,OAAO;IACP,aAAa;IACb,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,WAAW;IACX,mBAAmB;CACX,CAAC;AAkFX;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,QAAQ;IACR,OAAO;IACP,MAAM;IACN,SAAS;IACT,MAAM;IACN,KAAK;IACL,UAAU;IACV,UAAU;IACV,WAAW;IACX,aAAa;IACb,SAAS;IACT,YAAY;IACZ,UAAU;IACV,WAAW;IACX,OAAO;IACP,OAAO;IACP,MAAM;CACE,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Pre-compile validation of a DocumentSpec.
3
+ *
4
+ * Two jobs:
5
+ * 1. Shape/referential checks for the spec subset whose emitters have shipped.
6
+ * 2. Loud rejection of declared-but-not-yet-implemented spec features. The
7
+ * type surface covers the full add-docx-generation change; emitters land
8
+ * in phases, and a spec feature without an emitter must fail compilation
9
+ * with a typed error naming the feature and its path — never be silently
10
+ * dropped (scenario SDX-GEN-003).
11
+ *
12
+ * Shipped so far: formatted text/tab/break runs, five-part PAGE/NUMPAGES
13
+ * fields, paragraph formatting, named styles + styles.xml, multi-section
14
+ * documents with per-section page setup, page numbering, break types,
15
+ * default/first/even headers and footers, tables (grid, spans, vertical
16
+ * merges, cell decoration, nesting), multi-level numbering with w:numPr
17
+ * list references, and drafting notes compiled to anchored comments (body
18
+ * story only — header/footer paragraphs cannot carry notes).
19
+ *
20
+ * Every declared feature now has an emitter; the loud-rejection contract
21
+ * (SDX-GEN-003) lives on as runtime guards against unrecognized block and
22
+ * inline kinds, which protect callers handing in JSON that the TypeScript
23
+ * surface never saw.
24
+ */
25
+ import type { DocumentSpec } from './types.js';
26
+ export declare function validateSpec(spec: DocumentSpec): void;
27
+ //# sourceMappingURL=validate-spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-spec.d.ts","sourceRoot":"","sources":["../../src/generation/validate-spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAGV,YAAY,EASb,MAAM,YAAY,CAAC;AAiBpB,wBAAgB,YAAY,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CAYrD"}
@@ -0,0 +1,359 @@
1
+ /**
2
+ * Pre-compile validation of a DocumentSpec.
3
+ *
4
+ * Two jobs:
5
+ * 1. Shape/referential checks for the spec subset whose emitters have shipped.
6
+ * 2. Loud rejection of declared-but-not-yet-implemented spec features. The
7
+ * type surface covers the full add-docx-generation change; emitters land
8
+ * in phases, and a spec feature without an emitter must fail compilation
9
+ * with a typed error naming the feature and its path — never be silently
10
+ * dropped (scenario SDX-GEN-003).
11
+ *
12
+ * Shipped so far: formatted text/tab/break runs, five-part PAGE/NUMPAGES
13
+ * fields, paragraph formatting, named styles + styles.xml, multi-section
14
+ * documents with per-section page setup, page numbering, break types,
15
+ * default/first/even headers and footers, tables (grid, spans, vertical
16
+ * merges, cell decoration, nesting), multi-level numbering with w:numPr
17
+ * list references, and drafting notes compiled to anchored comments (body
18
+ * story only — header/footer paragraphs cannot carry notes).
19
+ *
20
+ * Every declared feature now has an emitter; the loud-rejection contract
21
+ * (SDX-GEN-003) lives on as runtime guards against unrecognized block and
22
+ * inline kinds, which protect callers handing in JSON that the TypeScript
23
+ * surface never saw.
24
+ */
25
+ import { GenerationSpecError } from './errors.js';
26
+ import { HIGHLIGHT_COLORS, THEME_COLOR_SLOTS } from './types.js';
27
+ const COLOR_HEX_RE = /^[0-9A-Fa-f]{6}$/;
28
+ const TWO_HEX_RE = /^[0-9A-Fa-f]{2}$/;
29
+ const HIGHLIGHT_COLOR_SET = new Set(HIGHLIGHT_COLORS);
30
+ const THEME_COLOR_SLOT_SET = new Set(THEME_COLOR_SLOTS);
31
+ function unsupported(path, feature) {
32
+ throw new GenerationSpecError('unsupported_feature', path, `Spec feature '${feature}' is declared in the DocumentSpec type surface but its emitter has not shipped yet; ` +
33
+ 'it is rejected rather than silently ignored');
34
+ }
35
+ export function validateSpec(spec) {
36
+ if (!Array.isArray(spec.sections) || spec.sections.length === 0) {
37
+ throw new GenerationSpecError('empty_sections', '/sections', 'DocumentSpec.sections must contain at least one section');
38
+ }
39
+ validateTheme(spec);
40
+ const declaredStyleIds = validateStyles(spec.styles ?? []);
41
+ const numbering = validateNumbering(spec.numbering ?? []);
42
+ spec.sections.forEach((section, sectionIndex) => {
43
+ validateSection(section, `/sections/${sectionIndex}`, declaredStyleIds, numbering);
44
+ });
45
+ }
46
+ function validateTheme(spec) {
47
+ if (!spec.theme?.colors)
48
+ return;
49
+ for (const [slot, hex] of Object.entries(spec.theme.colors)) {
50
+ if (!THEME_COLOR_SLOT_SET.has(slot)) {
51
+ throw new GenerationSpecError('invalid_value', `/theme/colors/${slot}`, `theme color slot must be one of the supported theme slots, got '${slot}'`);
52
+ }
53
+ if (typeof hex !== 'string' || !COLOR_HEX_RE.test(hex)) {
54
+ throw new GenerationSpecError('invalid_value', `/theme/colors/${slot}`, `theme color value must be six hex digits without '#', got '${hex}'`);
55
+ }
56
+ }
57
+ }
58
+ /** Returns numId handle → set of declared levels, for list-reference checks. */
59
+ function validateNumbering(definitions) {
60
+ const declared = new Map();
61
+ definitions.forEach((definition, index) => {
62
+ const path = `/numbering/${index}`;
63
+ if (!definition.numId) {
64
+ throw new GenerationSpecError('invalid_value', `${path}/numId`, 'NumberingSpec requires a numId handle');
65
+ }
66
+ if (declared.has(definition.numId)) {
67
+ throw new GenerationSpecError('invalid_value', `${path}/numId`, `Duplicate numbering handle '${definition.numId}'`);
68
+ }
69
+ if (!Array.isArray(definition.levels) || definition.levels.length === 0) {
70
+ throw new GenerationSpecError('invalid_value', `${path}/levels`, 'Numbering definitions require at least one level');
71
+ }
72
+ const levels = new Set();
73
+ definition.levels.forEach((level, levelIndex) => {
74
+ const levelPath = `${path}/levels/${levelIndex}`;
75
+ if (!Number.isInteger(level.ilvl) || level.ilvl < 0 || level.ilvl > 8) {
76
+ throw new GenerationSpecError('invalid_value', `${levelPath}/ilvl`, 'ilvl must be an integer between 0 and 8');
77
+ }
78
+ if (levels.has(level.ilvl)) {
79
+ throw new GenerationSpecError('invalid_value', `${levelPath}/ilvl`, `Duplicate ilvl ${level.ilvl} in numbering '${definition.numId}'`);
80
+ }
81
+ levels.add(level.ilvl);
82
+ if (typeof level.lvlText !== 'string' || level.lvlText.length === 0) {
83
+ throw new GenerationSpecError('invalid_value', `${levelPath}/lvlText`, 'Numbering levels require a lvlText pattern');
84
+ }
85
+ if (level.start !== undefined && (!Number.isInteger(level.start) || level.start < 0)) {
86
+ throw new GenerationSpecError('invalid_value', `${levelPath}/start`, 'Level start must be a non-negative integer');
87
+ }
88
+ if (level.runProps)
89
+ validateRunProps(level.runProps, `${levelPath}/runProps`);
90
+ });
91
+ declared.set(definition.numId, levels);
92
+ });
93
+ return declared;
94
+ }
95
+ /** Returns the set of resolvable style ids (declared styles + implicit Normal). */
96
+ function validateStyles(styles) {
97
+ const ids = new Set(['Normal']);
98
+ styles.forEach((style, index) => {
99
+ const path = `/styles/${index}`;
100
+ if (!style.styleId || !style.name) {
101
+ throw new GenerationSpecError('invalid_value', path, 'StyleSpec requires styleId and name');
102
+ }
103
+ if (ids.has(style.styleId)) {
104
+ throw new GenerationSpecError('invalid_value', `${path}/styleId`, `Duplicate styleId '${style.styleId}'`);
105
+ }
106
+ ids.add(style.styleId);
107
+ if (style.run)
108
+ validateRunProps(style.run, `${path}/run`);
109
+ });
110
+ // basedOn / next must resolve against the full declared set (forward refs allowed).
111
+ styles.forEach((style, index) => {
112
+ const path = `/styles/${index}`;
113
+ for (const key of ['basedOn', 'next']) {
114
+ const ref = style[key];
115
+ if (ref !== undefined && !ids.has(ref)) {
116
+ throw new GenerationSpecError('dangling_style_reference', `${path}/${key}`, `Style '${style.styleId}' references undeclared style '${ref}' via ${key}`);
117
+ }
118
+ }
119
+ });
120
+ return ids;
121
+ }
122
+ function validateSection(section, path, styleIds, numbering) {
123
+ if (section.pageNumbering?.start !== undefined) {
124
+ const start = section.pageNumbering.start;
125
+ if (!Number.isInteger(start) || start < 1) {
126
+ throw new GenerationSpecError('invalid_value', `${path}/pageNumbering/start`, 'Page numbering start must be a positive integer');
127
+ }
128
+ }
129
+ for (const [kind, set] of [['headers', section.headers], ['footers', section.footers]]) {
130
+ if (!set)
131
+ continue;
132
+ for (const slot of ['default', 'first', 'even']) {
133
+ const content = set[slot];
134
+ if (!content)
135
+ continue;
136
+ const slotPath = `${path}/${kind}/${slot}`;
137
+ if (!Array.isArray(content.blocks) || content.blocks.length === 0) {
138
+ throw new GenerationSpecError('invalid_value', `${slotPath}/blocks`, 'Header/footer blocks must be a non-empty array');
139
+ }
140
+ content.blocks.forEach((block, blockIndex) => {
141
+ validateBlock(block, `${slotPath}/blocks/${blockIndex}`, styleIds, numbering, 'headerFooter');
142
+ });
143
+ }
144
+ }
145
+ const size = section.page?.sizeTwips;
146
+ if (size && (!(size.w > 0) || !(size.h > 0))) {
147
+ throw new GenerationSpecError('invalid_value', `${path}/page/sizeTwips`, 'Page size dimensions must be positive twips');
148
+ }
149
+ const margins = section.page?.marginsTwips;
150
+ if (margins) {
151
+ for (const [key, value] of Object.entries(margins)) {
152
+ if (value !== undefined && (typeof value !== 'number' || value < 0 || !Number.isFinite(value))) {
153
+ throw new GenerationSpecError('invalid_value', `${path}/page/marginsTwips/${key}`, 'Margins must be non-negative finite twips');
154
+ }
155
+ }
156
+ }
157
+ if (!Array.isArray(section.blocks)) {
158
+ throw new GenerationSpecError('invalid_value', `${path}/blocks`, 'Section blocks must be an array');
159
+ }
160
+ section.blocks.forEach((block, blockIndex) => {
161
+ validateBlock(block, `${path}/blocks/${blockIndex}`, styleIds, numbering, 'body');
162
+ });
163
+ }
164
+ function validateBlock(block, path, styleIds, numbering, story) {
165
+ if (block.kind === 'table')
166
+ validateTable(block, path, styleIds, numbering, story);
167
+ else if (block.kind === 'paragraph')
168
+ validateParagraph(block, path, styleIds, numbering, story);
169
+ else
170
+ unsupported(path, `block kind '${block.kind}'`);
171
+ }
172
+ /**
173
+ * Table shape and grid arithmetic. Every row's effective column count
174
+ * (the sum of its cells' gridSpans) must equal the declared grid, and a
175
+ * vertical-merge continuation must sit at exactly the grid position and
176
+ * span of a merge cell in the previous row — otherwise readers either show
177
+ * a recovery dialog or silently reflow the table.
178
+ */
179
+ function validateTable(table, path, styleIds, numbering, story) {
180
+ if (!Array.isArray(table.columnWidthsTwips) || table.columnWidthsTwips.length === 0) {
181
+ throw new GenerationSpecError('invalid_value', `${path}/columnWidthsTwips`, 'Tables require at least one column width');
182
+ }
183
+ table.columnWidthsTwips.forEach((width, i) => {
184
+ if (!(width > 0) || !Number.isFinite(width)) {
185
+ throw new GenerationSpecError('invalid_value', `${path}/columnWidthsTwips/${i}`, 'Column widths must be positive finite twips');
186
+ }
187
+ });
188
+ if (table.borders)
189
+ validateBorders(table.borders, `${path}/borders`);
190
+ if (!Array.isArray(table.rows) || table.rows.length === 0) {
191
+ throw new GenerationSpecError('invalid_value', `${path}/rows`, 'Tables require at least one row');
192
+ }
193
+ const columnCount = table.columnWidthsTwips.length;
194
+ // Grid start → span of every merge-participating cell in the previous row.
195
+ let previousMerges = new Map();
196
+ table.rows.forEach((row, rowIndex) => {
197
+ const rowPath = `${path}/rows/${rowIndex}`;
198
+ if (!Array.isArray(row.cells) || row.cells.length === 0) {
199
+ throw new GenerationSpecError('invalid_value', `${rowPath}/cells`, 'Rows require at least one cell');
200
+ }
201
+ if (row.heightTwips !== undefined && (!(row.heightTwips > 0) || !Number.isFinite(row.heightTwips))) {
202
+ throw new GenerationSpecError('invalid_value', `${rowPath}/heightTwips`, 'Row height must be positive finite twips');
203
+ }
204
+ const currentMerges = new Map();
205
+ let gridOffset = 0;
206
+ row.cells.forEach((cell, cellIndex) => {
207
+ const cellPath = `${rowPath}/cells/${cellIndex}`;
208
+ if (cell.gridSpan !== undefined && (!Number.isInteger(cell.gridSpan) || cell.gridSpan < 1)) {
209
+ throw new GenerationSpecError('invalid_value', `${cellPath}/gridSpan`, 'gridSpan must be a positive integer');
210
+ }
211
+ const span = cell.gridSpan ?? 1;
212
+ if (cell.vMerge === 'continue') {
213
+ if (rowIndex === 0) {
214
+ throw new GenerationSpecError('grid_mismatch', `${cellPath}/vMerge`, 'A vertical merge cannot continue in the first row');
215
+ }
216
+ if (previousMerges.get(gridOffset) !== span) {
217
+ throw new GenerationSpecError('grid_mismatch', `${cellPath}/vMerge`, `vMerge continuation at grid column ${gridOffset} (span ${span}) has no matching merge cell in the previous row`);
218
+ }
219
+ }
220
+ if (cell.vMerge !== undefined)
221
+ currentMerges.set(gridOffset, span);
222
+ if (cell.widthTwips !== undefined && (!(cell.widthTwips > 0) || !Number.isFinite(cell.widthTwips))) {
223
+ throw new GenerationSpecError('invalid_value', `${cellPath}/widthTwips`, 'Cell width must be positive finite twips');
224
+ }
225
+ if (cell.borders)
226
+ validateBorders(cell.borders, `${cellPath}/borders`);
227
+ if (cell.shadingHex !== undefined && !COLOR_HEX_RE.test(cell.shadingHex)) {
228
+ throw new GenerationSpecError('invalid_value', `${cellPath}/shadingHex`, `shadingHex must be six hex digits without '#', got '${cell.shadingHex}'`);
229
+ }
230
+ if (cell.themeFill !== undefined) {
231
+ validateThemeColorSlot(cell.themeFill, `${cellPath}/themeFill`, 'themeFill');
232
+ }
233
+ if (cell.shadingHex !== undefined && cell.themeFill !== undefined) {
234
+ throw new GenerationSpecError('invalid_value', `${cellPath}/themeFill`, 'themeFill cannot be set when shadingHex is also set');
235
+ }
236
+ validateOptionalTwoHex(cell.themeFillTint, `${cellPath}/themeFillTint`, 'themeFillTint');
237
+ validateOptionalTwoHex(cell.themeFillShade, `${cellPath}/themeFillShade`, 'themeFillShade');
238
+ if ((cell.themeFillTint !== undefined || cell.themeFillShade !== undefined) && cell.themeFill === undefined) {
239
+ throw new GenerationSpecError('invalid_value', `${cellPath}/themeFill`, 'themeFill is required when themeFillTint or themeFillShade is set');
240
+ }
241
+ if (cell.marginsTwips) {
242
+ for (const [key, value] of Object.entries(cell.marginsTwips)) {
243
+ if (value !== undefined && (typeof value !== 'number' || value < 0 || !Number.isFinite(value))) {
244
+ throw new GenerationSpecError('invalid_value', `${cellPath}/marginsTwips/${key}`, 'Cell margins must be non-negative finite twips');
245
+ }
246
+ }
247
+ }
248
+ if (!Array.isArray(cell.blocks)) {
249
+ throw new GenerationSpecError('invalid_value', `${cellPath}/blocks`, 'Cell blocks must be an array (empty allowed; an empty cell compiles to an empty paragraph)');
250
+ }
251
+ cell.blocks.forEach((block, blockIndex) => {
252
+ validateBlock(block, `${cellPath}/blocks/${blockIndex}`, styleIds, numbering, story);
253
+ });
254
+ gridOffset += span;
255
+ });
256
+ if (gridOffset !== columnCount) {
257
+ throw new GenerationSpecError('grid_mismatch', rowPath, `Row spans ${gridOffset} grid column(s) but the table declares ${columnCount}`);
258
+ }
259
+ previousMerges = currentMerges;
260
+ });
261
+ }
262
+ function validateBorders(borders, path) {
263
+ for (const [edge, spec] of Object.entries(borders)) {
264
+ if (!spec)
265
+ continue;
266
+ if (spec.colorHex !== undefined && !COLOR_HEX_RE.test(spec.colorHex)) {
267
+ throw new GenerationSpecError('invalid_value', `${path}/${edge}/colorHex`, `colorHex must be six hex digits without '#', got '${spec.colorHex}'`);
268
+ }
269
+ if (spec.sizeEighthPt !== undefined && (!(spec.sizeEighthPt > 0) || !Number.isFinite(spec.sizeEighthPt))) {
270
+ throw new GenerationSpecError('invalid_value', `${path}/${edge}/sizeEighthPt`, 'Border size must be positive finite eighth-points');
271
+ }
272
+ }
273
+ }
274
+ function validateParagraph(paragraph, path, styleIds, numbering, story) {
275
+ if (paragraph.note !== undefined) {
276
+ if (story === 'headerFooter') {
277
+ throw new GenerationSpecError('invalid_value', `${path}/note`, 'Drafting notes anchor as document-story comments and cannot live in headers or footers');
278
+ }
279
+ if (typeof paragraph.note.text !== 'string' || paragraph.note.text.length === 0) {
280
+ throw new GenerationSpecError('invalid_value', `${path}/note/text`, 'Drafting notes require non-empty text');
281
+ }
282
+ }
283
+ if (paragraph.list !== undefined) {
284
+ const levels = numbering.get(paragraph.list.numId);
285
+ if (!levels) {
286
+ throw new GenerationSpecError('dangling_numbering_reference', `${path}/list/numId`, `Paragraph references undeclared numbering '${paragraph.list.numId}'`);
287
+ }
288
+ if (!levels.has(paragraph.list.ilvl)) {
289
+ throw new GenerationSpecError('dangling_numbering_reference', `${path}/list/ilvl`, `Numbering '${paragraph.list.numId}' declares no level ${paragraph.list.ilvl}`);
290
+ }
291
+ }
292
+ if (paragraph.styleId !== undefined && !styleIds.has(paragraph.styleId)) {
293
+ throw new GenerationSpecError('dangling_style_reference', `${path}/styleId`, `Paragraph references undeclared style '${paragraph.styleId}'`);
294
+ }
295
+ if (paragraph.tabs) {
296
+ paragraph.tabs.forEach((stop, i) => {
297
+ if (!(stop.posTwips >= 0) || !Number.isFinite(stop.posTwips)) {
298
+ throw new GenerationSpecError('invalid_value', `${path}/tabs/${i}/posTwips`, 'Tab stop position must be a non-negative finite twips value');
299
+ }
300
+ });
301
+ }
302
+ if (!Array.isArray(paragraph.runs)) {
303
+ throw new GenerationSpecError('invalid_value', `${path}/runs`, 'Paragraph runs must be an array');
304
+ }
305
+ paragraph.runs.forEach((run, runIndex) => {
306
+ validateInline(run, `${path}/runs/${runIndex}`);
307
+ });
308
+ }
309
+ function validateInline(run, path) {
310
+ if (run.kind !== 'tab' && run.kind !== 'break' && run.kind !== 'field' && run.kind !== 'text') {
311
+ unsupported(path, `inline kind '${run.kind}'`);
312
+ }
313
+ if (run.kind === 'tab' || run.kind === 'break')
314
+ return;
315
+ if (run.kind === 'field') {
316
+ if (typeof run.cachedResult !== 'string' || run.cachedResult.length === 0) {
317
+ throw new GenerationSpecError('invalid_value', `${path}/cachedResult`, 'Fields require a non-empty cachedResult — the no-recovery-dialog guarantee is unrepresentable-by-omission');
318
+ }
319
+ validateRunProps(run, path);
320
+ return;
321
+ }
322
+ if (typeof run.text !== 'string') {
323
+ throw new GenerationSpecError('invalid_value', `${path}/text`, 'Text runs must carry a string');
324
+ }
325
+ validateRunProps(run, path);
326
+ }
327
+ function validateRunProps(props, path) {
328
+ if (props.colorHex !== undefined && !COLOR_HEX_RE.test(props.colorHex)) {
329
+ throw new GenerationSpecError('invalid_value', `${path}/colorHex`, `colorHex must be six hex digits without '#', got '${props.colorHex}'`);
330
+ }
331
+ if (props.themeColor !== undefined) {
332
+ validateThemeColorSlot(props.themeColor, `${path}/themeColor`, 'themeColor');
333
+ }
334
+ if (props.colorHex !== undefined && props.themeColor !== undefined) {
335
+ throw new GenerationSpecError('invalid_value', `${path}/themeColor`, 'themeColor cannot be set when colorHex is also set');
336
+ }
337
+ validateOptionalTwoHex(props.themeTint, `${path}/themeTint`, 'themeTint');
338
+ validateOptionalTwoHex(props.themeShade, `${path}/themeShade`, 'themeShade');
339
+ if ((props.themeTint !== undefined || props.themeShade !== undefined) && props.themeColor === undefined) {
340
+ throw new GenerationSpecError('invalid_value', `${path}/themeColor`, 'themeColor is required when themeTint or themeShade is set');
341
+ }
342
+ if (props.sizePt !== undefined && (!(props.sizePt > 0) || !Number.isFinite(props.sizePt))) {
343
+ throw new GenerationSpecError('invalid_value', `${path}/sizePt`, 'sizePt must be a positive finite number');
344
+ }
345
+ if (props.highlight !== undefined && !HIGHLIGHT_COLOR_SET.has(props.highlight)) {
346
+ throw new GenerationSpecError('invalid_value', `${path}/highlight`, `highlight must be one of the fixed CT_HighlightColor values, got '${props.highlight}'`);
347
+ }
348
+ }
349
+ function validateThemeColorSlot(value, path, fieldName) {
350
+ if (!THEME_COLOR_SLOT_SET.has(value)) {
351
+ throw new GenerationSpecError('invalid_value', path, `${fieldName} must be one of the supported theme slots, got '${value}'`);
352
+ }
353
+ }
354
+ function validateOptionalTwoHex(value, path, fieldName) {
355
+ if (value !== undefined && !TWO_HEX_RE.test(value)) {
356
+ throw new GenerationSpecError('invalid_value', path, `${fieldName} must be two hex digits without '#', got '${value}'`);
357
+ }
358
+ }
359
+ //# sourceMappingURL=validate-spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-spec.js","sourceRoot":"","sources":["../../src/generation/validate-spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAclD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEjE,MAAM,YAAY,GAAG,kBAAkB,CAAC;AACxC,MAAM,UAAU,GAAG,kBAAkB,CAAC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AC,MAAM,KAAK,SAAS,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;QAC1F,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,GAAG,IAAI,SAAS,EAAE,yCAAyC,CAAC,CAAC;IAC9G,CAAC;IACD,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;QAC/E,MAAM,IAAI,mBAAmB,CAC3B,eAAe,EACf,GAAG,IAAI,YAAY,EACnB,qEAAqE,KAAK,CAAC,SAAS,GAAG,CACxF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,sBAAsB,CAAC,KAAa,EAAE,IAAY,EAAE,SAAiB;IAC5E,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,IAAI,EAAE,GAAG,SAAS,mDAAmD,KAAK,GAAG,CAAC,CAAC;IAChI,CAAC;AACH,CAAC;AAED,SAAS,sBAAsB,CAAC,KAAyB,EAAE,IAAY,EAAE,SAAiB;IACxF,IAAI,KAAK,KAAK,SAAS,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACnD,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,IAAI,EAAE,GAAG,SAAS,6CAA6C,KAAK,GAAG,CAAC,CAAC;IAC1H,CAAC;AACH,CAAC"}
package/dist/index.d.ts CHANGED
@@ -30,4 +30,7 @@ export * from './primitives/index.js';
30
30
  export { allocateRevisionId, buildPPrChangeElement, buildTcPrChangeElement, buildTrPrChangeElement, buildRPrChangeElement, createRevisionContainer, createRevisionContext, createRevisionIdState, escapeXmlAttr, formatDate, prepareElementForDeletion, wrapElementWithDel, wrapElementWithIns, } from './primitives/track-changes-emitter.js';
31
31
  export type { RevisionContext, RevisionContextOptions, RevisionIdState, } from './primitives/track-changes-emitter.js';
32
32
  export { resolveSoffice, runLibreOfficeOracle, type OracleJob } from './integration/libreoffice-oracle.js';
33
+ export { buildSyntheticDocx, buildDocxFromParts, type SyntheticDocxOptions, type DocxPartsOptions, } from './integration/synthetic-docx-fixture.js';
34
+ export { generateDocx, type GenerateDocxOptions, GenerationSpecError, GenerationInternalError, type GenerationSpecErrorCode, checkGeneratedPackage, type StructuralCheckResult, type StructuralIssue, coverTermsTable, signatureBlock, type CoverTermsOptions, type SignatureBlockOptions, } from './generation/index.js';
35
+ export type { BlockSpec, BorderSpec, BreakSpec, DocumentMetaSpec, DocumentSpec, DraftingNoteSpec, FieldSpec, HeaderFooterSet, HeaderFooterSpec, InlineSpec, NumberingSpec, ParagraphSpec, RunProps, RunSpec, SectionSpec, StyleSpec, TableBorders, TableCellSpec, TableRowSpec, TableSpec, TabSpec, } from './generation/index.js';
33
36
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExE,YAAY,EACV,cAAc,EACd,aAAa,EACb,YAAY,EACZ,gCAAgC,EAChC,qCAAqC,EACrC,qCAAqC,EACrC,iCAAiC,EACjC,4BAA4B,EAC5B,qBAAqB,EACrB,4BAA4B,EAC5B,kBAAkB,EAClB,6BAA6B,EAC7B,0BAA0B,EAC1B,kCAAkC,EAClC,kCAAkC,EAClC,iCAAiC,EACjC,iCAAiC,GAClC,MAAM,oBAAoB,CAAC;AAE5B;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,cAAmB,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W,EACX,SAAS,EACT,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,SAAS,EACT,OAAO,GACR,MAAM,uBAAuB,CAAC"}
package/dist/index.js CHANGED
@@ -58,4 +58,12 @@ export { allocateRevisionId, buildPPrChangeElement, buildTcPrChangeElement, buil
58
58
  // Re-export the LibreOffice accept/reject oracle (gated reference voter; callers skip when
59
59
  // `resolveSoffice()` is null). odf-core's round-trip tests drive it with `.odt` jobs.
60
60
  export { resolveSoffice, runLibreOfficeOracle } from './integration/libreoffice-oracle.js';
61
+ // Synthetic-DOCX fixture builders re-exported for downstream packages' test suites
62
+ // (odf-core's DOCX→ODT conversion tests build their inputs with these). They live under
63
+ // `integration/` because `src/testing/**` is excluded from the package build.
64
+ export { buildSyntheticDocx, buildDocxFromParts, } from './integration/synthetic-docx-fixture.js';
65
+ // From-scratch generation (OpenSpec capability: docx-generation). Public as of
66
+ // the final phase of add-docx-generation: compatibility matrix recorded, all
67
+ // scenario coverage enforced strictly in CI.
68
+ export { generateDocx, GenerationSpecError, GenerationInternalError, checkGeneratedPackage, coverTermsTable, signatureBlock, } from './generation/index.js';
61
69
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAuB5E;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,QAAgB,EAChB,OAAe,EACf,UAA0B,EAAE;IAE5B,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IAEpF,+CAA+C;IAC/C,IAAK,MAAiB,KAAK,WAAW,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CACb,+DAA+D;YAC/D,iDAAiD,CAClD,CAAC;IACJ,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sFAAsF;AACtF,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAkB,MAAM,qCAAqC,CAAC;AAE3G,mFAAmF;AACnF,wFAAwF;AACxF,8EAA8E;AAC9E,OAAO,EACL,kBAAkB,EAClB,kBAAkB,GAGnB,MAAM,yCAAyC,CAAC;AAEjD,+EAA+E;AAC/E,6EAA6E;AAC7E,6CAA6C;AAC7C,OAAO,EACL,YAAY,EAEZ,mBAAmB,EACnB,uBAAuB,EAEvB,qBAAqB,EAGrB,eAAe,EACf,cAAc,GAGf,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,15 @@
1
+ export type DocxIdentityProbeResult = {
2
+ /** The package as re-saved by LibreOffice's DOCX export filter. */
3
+ savedPackage: Buffer;
4
+ };
5
+ export type DocxPdfProbeResult = {
6
+ pdf: Buffer;
7
+ };
8
+ /**
9
+ * Load→save a complete generated package through LibreOffice's DOCX filter.
10
+ * Throws when LibreOffice cannot load the package (no output is produced).
11
+ */
12
+ export declare function probeDocxIdentity(generated: Buffer, soffice?: string | null): Promise<DocxIdentityProbeResult>;
13
+ /** Render a generated package to PDF headlessly — the headless-renderer probe. */
14
+ export declare function probeDocxToPdf(generated: Buffer, soffice?: string | null): Promise<DocxPdfProbeResult>;
15
+ //# sourceMappingURL=generation-probes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generation-probes.d.ts","sourceRoot":"","sources":["../../src/integration/generation-probes.ts"],"names":[],"mappings":"AA0BA,MAAM,MAAM,uBAAuB,GAAG;IACpC,mEAAmE;IACnE,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AA+CF;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,MAAM,GAAG,IAAuB,GACxC,OAAO,CAAC,uBAAuB,CAAC,CAIlC;AAED,kFAAkF;AAClF,wBAAsB,cAAc,CAClC,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,MAAM,GAAG,IAAuB,GACxC,OAAO,CAAC,kBAAkB,CAAC,CAI7B"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * LibreOffice probes for generated full-package documents.
3
+ *
4
+ * Deliberately separate from runLibreOfficeOracle: the oracle's contract is
5
+ * "main XML string per accept/reject/identity job over a bare document.xml or
6
+ * .odt", driven by an injected Basic macro because the resolve-all commands
7
+ * are dispatch-only. These probes have a different contract — a complete
8
+ * generated package goes in, and the *saved package* (or rendered PDF) comes
9
+ * back out — and need no macro: `--convert-to` performs exactly the
10
+ * load→save (or load→render) cycle that exposes recovery-dialog failures,
11
+ * because a package LibreOffice cannot load cleanly produces no output.
12
+ *
13
+ * Local-only, like the oracle: callers skip when `resolveSoffice()` is null
14
+ * (CI does not install LibreOffice; the structural checks are the
15
+ * CI-enforceable proxy).
16
+ */
17
+ import { execFile } from 'node:child_process';
18
+ import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
19
+ import os from 'node:os';
20
+ import path from 'node:path';
21
+ import { pathToFileURL } from 'node:url';
22
+ import { promisify } from 'node:util';
23
+ import { resolveSoffice } from './libreoffice-oracle.js';
24
+ const execFileAsync = promisify(execFile);
25
+ async function runConvert(input, convertTo, outExt, soffice) {
26
+ const work = mkdtempSync(path.join(os.tmpdir(), 'sdx-gen-probe-'));
27
+ try {
28
+ const inDir = path.join(work, 'in');
29
+ const outDir = path.join(work, 'out');
30
+ const profile = path.join(work, 'profile');
31
+ mkdirSync(inDir, { recursive: true });
32
+ mkdirSync(outDir, { recursive: true });
33
+ mkdirSync(profile, { recursive: true });
34
+ const inPath = path.join(inDir, 'probe.docx');
35
+ writeFileSync(inPath, new Uint8Array(input));
36
+ const args = [
37
+ '--headless',
38
+ '--norestore',
39
+ '--nologo',
40
+ `-env:UserInstallation=${pathToFileURL(profile).href}`,
41
+ '--convert-to',
42
+ convertTo,
43
+ '--outdir',
44
+ outDir,
45
+ inPath,
46
+ ];
47
+ let diag = '';
48
+ try {
49
+ const r = await execFileAsync(soffice, args, { timeout: 45_000, killSignal: 'SIGKILL', maxBuffer: 8 * 1024 * 1024 });
50
+ diag = String(r.stderr ?? '') || String(r.stdout ?? '');
51
+ }
52
+ catch (err) {
53
+ const e = err;
54
+ diag = String(e.stderr ?? e.stdout ?? e.message ?? '');
55
+ }
56
+ const outPath = path.join(outDir, `probe.${outExt}`);
57
+ if (!existsSync(outPath)) {
58
+ throw new Error(`LibreOffice could not convert the generated package to ${outExt} — likely a load failure ` +
59
+ `(the recovery-dialog class of bug).\nsoffice output:\n${diag.trim() || '(no output)'}`);
60
+ }
61
+ return readFileSync(outPath);
62
+ }
63
+ finally {
64
+ rmSync(work, { recursive: true, force: true });
65
+ }
66
+ }
67
+ /**
68
+ * Load→save a complete generated package through LibreOffice's DOCX filter.
69
+ * Throws when LibreOffice cannot load the package (no output is produced).
70
+ */
71
+ export async function probeDocxIdentity(generated, soffice = resolveSoffice()) {
72
+ if (!soffice)
73
+ throw new Error('probeDocxIdentity: no soffice binary (call resolveSoffice() and skip)');
74
+ const savedPackage = await runConvert(generated, 'docx:MS Word 2007 XML', 'docx', soffice);
75
+ return { savedPackage };
76
+ }
77
+ /** Render a generated package to PDF headlessly — the headless-renderer probe. */
78
+ export async function probeDocxToPdf(generated, soffice = resolveSoffice()) {
79
+ if (!soffice)
80
+ throw new Error('probeDocxToPdf: no soffice binary (call resolveSoffice() and skip)');
81
+ const pdf = await runConvert(generated, 'pdf', 'pdf', soffice);
82
+ return { pdf };
83
+ }
84
+ //# sourceMappingURL=generation-probes.js.map