open-agreements 0.3.0 → 0.4.0

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 (429) hide show
  1. package/content/templates/closing-checklist/template.docx +0 -0
  2. package/dist/core/checklist/docx-import.d.ts +50 -0
  3. package/dist/core/checklist/docx-import.d.ts.map +1 -0
  4. package/dist/core/checklist/docx-import.js +613 -0
  5. package/dist/core/checklist/docx-import.js.map +1 -0
  6. package/dist/core/checklist/docx-table-helpers.d.ts +33 -0
  7. package/dist/core/checklist/docx-table-helpers.d.ts.map +1 -0
  8. package/dist/core/checklist/docx-table-helpers.js +154 -0
  9. package/dist/core/checklist/docx-table-helpers.js.map +1 -0
  10. package/dist/core/checklist/format-checklist-docx.d.ts.map +1 -1
  11. package/dist/core/checklist/format-checklist-docx.js +37 -88
  12. package/dist/core/checklist/format-checklist-docx.js.map +1 -1
  13. package/dist/core/checklist/index.d.ts +15 -12
  14. package/dist/core/checklist/index.d.ts.map +1 -1
  15. package/dist/core/checklist/index.js +48 -30
  16. package/dist/core/checklist/index.js.map +1 -1
  17. package/dist/core/checklist/status-labels.d.ts +6 -0
  18. package/dist/core/checklist/status-labels.d.ts.map +1 -1
  19. package/dist/core/checklist/status-labels.js +8 -0
  20. package/dist/core/checklist/status-labels.js.map +1 -1
  21. package/dist/index.d.ts +1 -1
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +1 -1
  24. package/dist/index.js.map +1 -1
  25. package/node_modules/@usejunior/docx-core/dist/atomizer.d.ts +218 -0
  26. package/node_modules/@usejunior/docx-core/dist/atomizer.d.ts.map +1 -0
  27. package/node_modules/@usejunior/docx-core/dist/atomizer.js +869 -0
  28. package/node_modules/@usejunior/docx-core/dist/atomizer.js.map +1 -0
  29. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/atomLcs.d.ts +96 -0
  30. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/atomLcs.d.ts.map +1 -0
  31. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/atomLcs.js +347 -0
  32. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/atomLcs.js.map +1 -0
  33. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/consumerCompatibility.d.ts +2 -0
  34. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/consumerCompatibility.d.ts.map +1 -0
  35. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/consumerCompatibility.js +188 -0
  36. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/consumerCompatibility.js.map +1 -0
  37. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/debug.d.ts +41 -0
  38. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/debug.d.ts.map +1 -0
  39. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/debug.js +85 -0
  40. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/debug.js.map +1 -0
  41. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/documentReconstructor.d.ts +64 -0
  42. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/documentReconstructor.d.ts.map +1 -0
  43. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/documentReconstructor.js +985 -0
  44. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/documentReconstructor.js.map +1 -0
  45. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/hierarchicalLcs.d.ts +111 -0
  46. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/hierarchicalLcs.d.ts.map +1 -0
  47. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/hierarchicalLcs.js +469 -0
  48. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/hierarchicalLcs.js.map +1 -0
  49. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/inPlaceModifier.d.ts +277 -0
  50. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/inPlaceModifier.d.ts.map +1 -0
  51. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/inPlaceModifier.js +2279 -0
  52. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/inPlaceModifier.js.map +1 -0
  53. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/numberingIntegration.d.ts +59 -0
  54. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/numberingIntegration.d.ts.map +1 -0
  55. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/numberingIntegration.js +209 -0
  56. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/numberingIntegration.js.map +1 -0
  57. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/pipeline.d.ts +69 -0
  58. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/pipeline.d.ts.map +1 -0
  59. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/pipeline.js +910 -0
  60. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/pipeline.js.map +1 -0
  61. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/premergeRuns.d.ts +26 -0
  62. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/premergeRuns.d.ts.map +1 -0
  63. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/premergeRuns.js +153 -0
  64. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/premergeRuns.js.map +1 -0
  65. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/trackChangesAcceptor.d.ts +63 -0
  66. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/trackChangesAcceptor.d.ts.map +1 -0
  67. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/trackChangesAcceptor.js +254 -0
  68. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/trackChangesAcceptor.js.map +1 -0
  69. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/trackChangesAcceptorAst.d.ts +64 -0
  70. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/trackChangesAcceptorAst.d.ts.map +1 -0
  71. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/trackChangesAcceptorAst.js +616 -0
  72. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/trackChangesAcceptorAst.js.map +1 -0
  73. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/xmlToWmlElement.d.ts +65 -0
  74. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/xmlToWmlElement.d.ts.map +1 -0
  75. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/xmlToWmlElement.js +95 -0
  76. package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/xmlToWmlElement.js.map +1 -0
  77. package/node_modules/@usejunior/docx-core/dist/baselines/wmlcomparer/DocxodusWasm.d.ts +51 -0
  78. package/node_modules/@usejunior/docx-core/dist/baselines/wmlcomparer/DocxodusWasm.d.ts.map +1 -0
  79. package/node_modules/@usejunior/docx-core/dist/baselines/wmlcomparer/DocxodusWasm.js +83 -0
  80. package/node_modules/@usejunior/docx-core/dist/baselines/wmlcomparer/DocxodusWasm.js.map +1 -0
  81. package/node_modules/@usejunior/docx-core/dist/baselines/wmlcomparer/DotnetCli.d.ts +40 -0
  82. package/node_modules/@usejunior/docx-core/dist/baselines/wmlcomparer/DotnetCli.d.ts.map +1 -0
  83. package/node_modules/@usejunior/docx-core/dist/baselines/wmlcomparer/DotnetCli.js +135 -0
  84. package/node_modules/@usejunior/docx-core/dist/baselines/wmlcomparer/DotnetCli.js.map +1 -0
  85. package/node_modules/@usejunior/docx-core/dist/cli/compare-two.d.ts +28 -0
  86. package/node_modules/@usejunior/docx-core/dist/cli/compare-two.d.ts.map +1 -0
  87. package/node_modules/@usejunior/docx-core/dist/cli/compare-two.js +110 -0
  88. package/node_modules/@usejunior/docx-core/dist/cli/compare-two.js.map +1 -0
  89. package/node_modules/@usejunior/docx-core/dist/cli/index.d.ts +3 -0
  90. package/node_modules/@usejunior/docx-core/dist/cli/index.d.ts.map +1 -0
  91. package/node_modules/@usejunior/docx-core/dist/cli/index.js +21 -0
  92. package/node_modules/@usejunior/docx-core/dist/cli/index.js.map +1 -0
  93. package/node_modules/@usejunior/docx-core/dist/core-types.d.ts +296 -0
  94. package/node_modules/@usejunior/docx-core/dist/core-types.d.ts.map +1 -0
  95. package/node_modules/@usejunior/docx-core/dist/core-types.js +122 -0
  96. package/node_modules/@usejunior/docx-core/dist/core-types.js.map +1 -0
  97. package/node_modules/@usejunior/docx-core/dist/footnotes.d.ts +144 -0
  98. package/node_modules/@usejunior/docx-core/dist/footnotes.d.ts.map +1 -0
  99. package/node_modules/@usejunior/docx-core/dist/footnotes.js +291 -0
  100. package/node_modules/@usejunior/docx-core/dist/footnotes.js.map +1 -0
  101. package/node_modules/@usejunior/docx-core/dist/format-detection.d.ts +120 -0
  102. package/node_modules/@usejunior/docx-core/dist/format-detection.d.ts.map +1 -0
  103. package/node_modules/@usejunior/docx-core/dist/format-detection.js +338 -0
  104. package/node_modules/@usejunior/docx-core/dist/format-detection.js.map +1 -0
  105. package/node_modules/@usejunior/docx-core/dist/index.d.ts +177 -0
  106. package/node_modules/@usejunior/docx-core/dist/index.d.ts.map +1 -0
  107. package/node_modules/@usejunior/docx-core/dist/index.js +55 -0
  108. package/node_modules/@usejunior/docx-core/dist/index.js.map +1 -0
  109. package/node_modules/@usejunior/docx-core/dist/integration/output-artifacts.d.ts +6 -0
  110. package/node_modules/@usejunior/docx-core/dist/integration/output-artifacts.d.ts.map +1 -0
  111. package/node_modules/@usejunior/docx-core/dist/integration/output-artifacts.js +30 -0
  112. package/node_modules/@usejunior/docx-core/dist/integration/output-artifacts.js.map +1 -0
  113. package/node_modules/@usejunior/docx-core/dist/move-detection.d.ts +211 -0
  114. package/node_modules/@usejunior/docx-core/dist/move-detection.d.ts.map +1 -0
  115. package/node_modules/@usejunior/docx-core/dist/move-detection.js +391 -0
  116. package/node_modules/@usejunior/docx-core/dist/move-detection.js.map +1 -0
  117. package/node_modules/@usejunior/docx-core/dist/numbering.d.ts +136 -0
  118. package/node_modules/@usejunior/docx-core/dist/numbering.d.ts.map +1 -0
  119. package/node_modules/@usejunior/docx-core/dist/numbering.js +446 -0
  120. package/node_modules/@usejunior/docx-core/dist/numbering.js.map +1 -0
  121. package/node_modules/@usejunior/docx-core/dist/primitives/accept_changes.d.ts +30 -0
  122. package/node_modules/@usejunior/docx-core/dist/primitives/accept_changes.d.ts.map +1 -0
  123. package/node_modules/@usejunior/docx-core/dist/primitives/accept_changes.js +241 -0
  124. package/node_modules/@usejunior/docx-core/dist/primitives/accept_changes.js.map +1 -0
  125. package/node_modules/@usejunior/docx-core/dist/primitives/bookmarks.d.ts +12 -0
  126. package/node_modules/@usejunior/docx-core/dist/primitives/bookmarks.d.ts.map +1 -0
  127. package/node_modules/@usejunior/docx-core/dist/primitives/bookmarks.js +248 -0
  128. package/node_modules/@usejunior/docx-core/dist/primitives/bookmarks.js.map +1 -0
  129. package/node_modules/@usejunior/docx-core/dist/primitives/comments.d.ts +88 -0
  130. package/node_modules/@usejunior/docx-core/dist/primitives/comments.d.ts.map +1 -0
  131. package/node_modules/@usejunior/docx-core/dist/primitives/comments.js +703 -0
  132. package/node_modules/@usejunior/docx-core/dist/primitives/comments.js.map +1 -0
  133. package/node_modules/@usejunior/docx-core/dist/primitives/document.d.ts +186 -0
  134. package/node_modules/@usejunior/docx-core/dist/primitives/document.d.ts.map +1 -0
  135. package/node_modules/@usejunior/docx-core/dist/primitives/document.js +555 -0
  136. package/node_modules/@usejunior/docx-core/dist/primitives/document.js.map +1 -0
  137. package/node_modules/@usejunior/docx-core/dist/primitives/document_view.d.ts +97 -0
  138. package/node_modules/@usejunior/docx-core/dist/primitives/document_view.d.ts.map +1 -0
  139. package/node_modules/@usejunior/docx-core/dist/primitives/document_view.js +749 -0
  140. package/node_modules/@usejunior/docx-core/dist/primitives/document_view.js.map +1 -0
  141. package/node_modules/@usejunior/docx-core/dist/primitives/dom-helpers.d.ts +94 -0
  142. package/node_modules/@usejunior/docx-core/dist/primitives/dom-helpers.d.ts.map +1 -0
  143. package/node_modules/@usejunior/docx-core/dist/primitives/dom-helpers.js +219 -0
  144. package/node_modules/@usejunior/docx-core/dist/primitives/dom-helpers.js.map +1 -0
  145. package/node_modules/@usejunior/docx-core/dist/primitives/errors.d.ts +7 -0
  146. package/node_modules/@usejunior/docx-core/dist/primitives/errors.d.ts.map +1 -0
  147. package/node_modules/@usejunior/docx-core/dist/primitives/errors.js +10 -0
  148. package/node_modules/@usejunior/docx-core/dist/primitives/errors.js.map +1 -0
  149. package/node_modules/@usejunior/docx-core/dist/primitives/extract_revisions.d.ts +50 -0
  150. package/node_modules/@usejunior/docx-core/dist/primitives/extract_revisions.d.ts.map +1 -0
  151. package/node_modules/@usejunior/docx-core/dist/primitives/extract_revisions.js +340 -0
  152. package/node_modules/@usejunior/docx-core/dist/primitives/extract_revisions.js.map +1 -0
  153. package/node_modules/@usejunior/docx-core/dist/primitives/footnotes.d.ts +37 -0
  154. package/node_modules/@usejunior/docx-core/dist/primitives/footnotes.d.ts.map +1 -0
  155. package/node_modules/@usejunior/docx-core/dist/primitives/footnotes.js +552 -0
  156. package/node_modules/@usejunior/docx-core/dist/primitives/footnotes.js.map +1 -0
  157. package/node_modules/@usejunior/docx-core/dist/primitives/formatting_tags.d.ts +43 -0
  158. package/node_modules/@usejunior/docx-core/dist/primitives/formatting_tags.d.ts.map +1 -0
  159. package/node_modules/@usejunior/docx-core/dist/primitives/formatting_tags.js +291 -0
  160. package/node_modules/@usejunior/docx-core/dist/primitives/formatting_tags.js.map +1 -0
  161. package/node_modules/@usejunior/docx-core/dist/primitives/index.d.ts +27 -0
  162. package/node_modules/@usejunior/docx-core/dist/primitives/index.d.ts.map +1 -0
  163. package/node_modules/@usejunior/docx-core/dist/primitives/index.js +27 -0
  164. package/node_modules/@usejunior/docx-core/dist/primitives/index.js.map +1 -0
  165. package/node_modules/@usejunior/docx-core/dist/primitives/layout.d.ts +53 -0
  166. package/node_modules/@usejunior/docx-core/dist/primitives/layout.d.ts.map +1 -0
  167. package/node_modules/@usejunior/docx-core/dist/primitives/layout.js +178 -0
  168. package/node_modules/@usejunior/docx-core/dist/primitives/layout.js.map +1 -0
  169. package/node_modules/@usejunior/docx-core/dist/primitives/list_labels.d.ts +19 -0
  170. package/node_modules/@usejunior/docx-core/dist/primitives/list_labels.d.ts.map +1 -0
  171. package/node_modules/@usejunior/docx-core/dist/primitives/list_labels.js +57 -0
  172. package/node_modules/@usejunior/docx-core/dist/primitives/list_labels.js.map +1 -0
  173. package/node_modules/@usejunior/docx-core/dist/primitives/matching.d.ts +31 -0
  174. package/node_modules/@usejunior/docx-core/dist/primitives/matching.d.ts.map +1 -0
  175. package/node_modules/@usejunior/docx-core/dist/primitives/matching.js +223 -0
  176. package/node_modules/@usejunior/docx-core/dist/primitives/matching.js.map +1 -0
  177. package/node_modules/@usejunior/docx-core/dist/primitives/merge_runs.d.ts +23 -0
  178. package/node_modules/@usejunior/docx-core/dist/primitives/merge_runs.d.ts.map +1 -0
  179. package/node_modules/@usejunior/docx-core/dist/primitives/merge_runs.js +243 -0
  180. package/node_modules/@usejunior/docx-core/dist/primitives/merge_runs.js.map +1 -0
  181. package/node_modules/@usejunior/docx-core/dist/primitives/namespaces.d.ts +91 -0
  182. package/node_modules/@usejunior/docx-core/dist/primitives/namespaces.d.ts.map +1 -0
  183. package/node_modules/@usejunior/docx-core/dist/primitives/namespaces.js +108 -0
  184. package/node_modules/@usejunior/docx-core/dist/primitives/namespaces.js.map +1 -0
  185. package/node_modules/@usejunior/docx-core/dist/primitives/numbering.d.ts +27 -0
  186. package/node_modules/@usejunior/docx-core/dist/primitives/numbering.d.ts.map +1 -0
  187. package/node_modules/@usejunior/docx-core/dist/primitives/numbering.js +182 -0
  188. package/node_modules/@usejunior/docx-core/dist/primitives/numbering.js.map +1 -0
  189. package/node_modules/@usejunior/docx-core/dist/primitives/prevent_double_elevation.d.ts +18 -0
  190. package/node_modules/@usejunior/docx-core/dist/primitives/prevent_double_elevation.d.ts.map +1 -0
  191. package/node_modules/@usejunior/docx-core/dist/primitives/prevent_double_elevation.js +190 -0
  192. package/node_modules/@usejunior/docx-core/dist/primitives/prevent_double_elevation.js.map +1 -0
  193. package/node_modules/@usejunior/docx-core/dist/primitives/reject_changes.d.ts +27 -0
  194. package/node_modules/@usejunior/docx-core/dist/primitives/reject_changes.d.ts.map +1 -0
  195. package/node_modules/@usejunior/docx-core/dist/primitives/reject_changes.js +371 -0
  196. package/node_modules/@usejunior/docx-core/dist/primitives/reject_changes.js.map +1 -0
  197. package/node_modules/@usejunior/docx-core/dist/primitives/relationships.d.ts +7 -0
  198. package/node_modules/@usejunior/docx-core/dist/primitives/relationships.d.ts.map +1 -0
  199. package/node_modules/@usejunior/docx-core/dist/primitives/relationships.js +24 -0
  200. package/node_modules/@usejunior/docx-core/dist/primitives/relationships.js.map +1 -0
  201. package/node_modules/@usejunior/docx-core/dist/primitives/semantic_tags.d.ts +17 -0
  202. package/node_modules/@usejunior/docx-core/dist/primitives/semantic_tags.d.ts.map +1 -0
  203. package/node_modules/@usejunior/docx-core/dist/primitives/semantic_tags.js +58 -0
  204. package/node_modules/@usejunior/docx-core/dist/primitives/semantic_tags.js.map +1 -0
  205. package/node_modules/@usejunior/docx-core/dist/primitives/simplify_redlines.d.ts +19 -0
  206. package/node_modules/@usejunior/docx-core/dist/primitives/simplify_redlines.d.ts.map +1 -0
  207. package/node_modules/@usejunior/docx-core/dist/primitives/simplify_redlines.js +94 -0
  208. package/node_modules/@usejunior/docx-core/dist/primitives/simplify_redlines.js.map +1 -0
  209. package/node_modules/@usejunior/docx-core/dist/primitives/styles.d.ts +36 -0
  210. package/node_modules/@usejunior/docx-core/dist/primitives/styles.d.ts.map +1 -0
  211. package/node_modules/@usejunior/docx-core/dist/primitives/styles.js +205 -0
  212. package/node_modules/@usejunior/docx-core/dist/primitives/styles.js.map +1 -0
  213. package/node_modules/@usejunior/docx-core/dist/primitives/tables.d.ts +54 -0
  214. package/node_modules/@usejunior/docx-core/dist/primitives/tables.d.ts.map +1 -0
  215. package/node_modules/@usejunior/docx-core/dist/primitives/tables.js +205 -0
  216. package/node_modules/@usejunior/docx-core/dist/primitives/tables.js.map +1 -0
  217. package/node_modules/@usejunior/docx-core/dist/primitives/text.d.ts +30 -0
  218. package/node_modules/@usejunior/docx-core/dist/primitives/text.d.ts.map +1 -0
  219. package/node_modules/@usejunior/docx-core/dist/primitives/text.js +461 -0
  220. package/node_modules/@usejunior/docx-core/dist/primitives/text.js.map +1 -0
  221. package/node_modules/@usejunior/docx-core/dist/primitives/validate_document.d.ts +24 -0
  222. package/node_modules/@usejunior/docx-core/dist/primitives/validate_document.d.ts.map +1 -0
  223. package/node_modules/@usejunior/docx-core/dist/primitives/validate_document.js +147 -0
  224. package/node_modules/@usejunior/docx-core/dist/primitives/validate_document.js.map +1 -0
  225. package/node_modules/@usejunior/docx-core/dist/primitives/xml.d.ts +5 -0
  226. package/node_modules/@usejunior/docx-core/dist/primitives/xml.d.ts.map +1 -0
  227. package/node_modules/@usejunior/docx-core/dist/primitives/xml.js +19 -0
  228. package/node_modules/@usejunior/docx-core/dist/primitives/xml.js.map +1 -0
  229. package/node_modules/@usejunior/docx-core/dist/primitives/zip.d.ts +25 -0
  230. package/node_modules/@usejunior/docx-core/dist/primitives/zip.d.ts.map +1 -0
  231. package/node_modules/@usejunior/docx-core/dist/primitives/zip.js +78 -0
  232. package/node_modules/@usejunior/docx-core/dist/primitives/zip.js.map +1 -0
  233. package/node_modules/@usejunior/docx-core/dist/shared/docx/DocxArchive.d.ts +94 -0
  234. package/node_modules/@usejunior/docx-core/dist/shared/docx/DocxArchive.d.ts.map +1 -0
  235. package/node_modules/@usejunior/docx-core/dist/shared/docx/DocxArchive.js +169 -0
  236. package/node_modules/@usejunior/docx-core/dist/shared/docx/DocxArchive.js.map +1 -0
  237. package/node_modules/@usejunior/docx-core/dist/shared/ooxml/namespaces.d.ts +149 -0
  238. package/node_modules/@usejunior/docx-core/dist/shared/ooxml/namespaces.d.ts.map +1 -0
  239. package/node_modules/@usejunior/docx-core/dist/shared/ooxml/namespaces.js +224 -0
  240. package/node_modules/@usejunior/docx-core/dist/shared/ooxml/namespaces.js.map +1 -0
  241. package/node_modules/@usejunior/docx-core/dist/shared/ooxml/types.d.ts +136 -0
  242. package/node_modules/@usejunior/docx-core/dist/shared/ooxml/types.d.ts.map +1 -0
  243. package/node_modules/@usejunior/docx-core/dist/shared/ooxml/types.js +7 -0
  244. package/node_modules/@usejunior/docx-core/dist/shared/ooxml/types.js.map +1 -0
  245. package/node_modules/@usejunior/docx-core/dist/shared/validators/structural.d.ts +31 -0
  246. package/node_modules/@usejunior/docx-core/dist/shared/validators/structural.d.ts.map +1 -0
  247. package/node_modules/@usejunior/docx-core/dist/shared/validators/structural.js +110 -0
  248. package/node_modules/@usejunior/docx-core/dist/shared/validators/structural.js.map +1 -0
  249. package/node_modules/@usejunior/docx-core/package.json +26 -0
  250. package/node_modules/core-util-is/LICENSE +19 -0
  251. package/node_modules/core-util-is/README.md +3 -0
  252. package/node_modules/core-util-is/lib/util.js +107 -0
  253. package/node_modules/core-util-is/package.json +38 -0
  254. package/node_modules/diff-match-patch/LICENSE +202 -0
  255. package/node_modules/diff-match-patch/README.md +94 -0
  256. package/node_modules/diff-match-patch/index.js +2218 -0
  257. package/node_modules/diff-match-patch/package.json +22 -0
  258. package/node_modules/immediate/LICENSE.txt +20 -0
  259. package/node_modules/immediate/README.md +93 -0
  260. package/node_modules/immediate/dist/immediate.js +75 -0
  261. package/node_modules/immediate/dist/immediate.min.js +1 -0
  262. package/node_modules/immediate/lib/browser.js +69 -0
  263. package/node_modules/immediate/lib/index.js +73 -0
  264. package/node_modules/immediate/package.json +42 -0
  265. package/node_modules/inherits/LICENSE +16 -0
  266. package/node_modules/inherits/README.md +42 -0
  267. package/node_modules/inherits/inherits.js +9 -0
  268. package/node_modules/inherits/inherits_browser.js +27 -0
  269. package/node_modules/inherits/package.json +29 -0
  270. package/node_modules/isarray/.npmignore +1 -0
  271. package/node_modules/isarray/.travis.yml +4 -0
  272. package/node_modules/isarray/Makefile +6 -0
  273. package/node_modules/isarray/README.md +60 -0
  274. package/node_modules/isarray/component.json +19 -0
  275. package/node_modules/isarray/index.js +5 -0
  276. package/node_modules/isarray/package.json +45 -0
  277. package/node_modules/isarray/test.js +20 -0
  278. package/node_modules/jszip/.codeclimate.yml +16 -0
  279. package/node_modules/jszip/.editorconfig +8 -0
  280. package/node_modules/jszip/.eslintrc.js +43 -0
  281. package/node_modules/jszip/.github/workflows/pr.yaml +58 -0
  282. package/node_modules/jszip/.jekyll-metadata +0 -0
  283. package/node_modules/jszip/.travis.yml +17 -0
  284. package/node_modules/jszip/CHANGES.md +204 -0
  285. package/node_modules/jszip/LICENSE.markdown +651 -0
  286. package/node_modules/jszip/README.markdown +33 -0
  287. package/node_modules/jszip/deps.js +37 -0
  288. package/node_modules/jszip/dist/jszip.js +11577 -0
  289. package/node_modules/jszip/dist/jszip.min.js +13 -0
  290. package/node_modules/jszip/graph.svg +601 -0
  291. package/node_modules/jszip/index.d.ts +330 -0
  292. package/node_modules/jszip/lib/base64.js +106 -0
  293. package/node_modules/jszip/lib/compressedObject.js +74 -0
  294. package/node_modules/jszip/lib/compressions.js +14 -0
  295. package/node_modules/jszip/lib/crc32.js +77 -0
  296. package/node_modules/jszip/lib/defaults.js +11 -0
  297. package/node_modules/jszip/lib/external.js +18 -0
  298. package/node_modules/jszip/lib/flate.js +85 -0
  299. package/node_modules/jszip/lib/generate/ZipFileWorker.js +539 -0
  300. package/node_modules/jszip/lib/generate/index.js +57 -0
  301. package/node_modules/jszip/lib/index.js +55 -0
  302. package/node_modules/jszip/lib/license_header.js +11 -0
  303. package/node_modules/jszip/lib/load.js +88 -0
  304. package/node_modules/jszip/lib/nodejs/NodejsStreamInputAdapter.js +74 -0
  305. package/node_modules/jszip/lib/nodejs/NodejsStreamOutputAdapter.js +42 -0
  306. package/node_modules/jszip/lib/nodejsUtils.js +57 -0
  307. package/node_modules/jszip/lib/object.js +384 -0
  308. package/node_modules/jszip/lib/readable-stream-browser.js +10 -0
  309. package/node_modules/jszip/lib/reader/ArrayReader.js +57 -0
  310. package/node_modules/jszip/lib/reader/DataReader.js +116 -0
  311. package/node_modules/jszip/lib/reader/NodeBufferReader.js +19 -0
  312. package/node_modules/jszip/lib/reader/StringReader.js +38 -0
  313. package/node_modules/jszip/lib/reader/Uint8ArrayReader.js +22 -0
  314. package/node_modules/jszip/lib/reader/readerFor.js +28 -0
  315. package/node_modules/jszip/lib/signature.js +7 -0
  316. package/node_modules/jszip/lib/stream/ConvertWorker.js +26 -0
  317. package/node_modules/jszip/lib/stream/Crc32Probe.js +24 -0
  318. package/node_modules/jszip/lib/stream/DataLengthProbe.js +29 -0
  319. package/node_modules/jszip/lib/stream/DataWorker.js +116 -0
  320. package/node_modules/jszip/lib/stream/GenericWorker.js +263 -0
  321. package/node_modules/jszip/lib/stream/StreamHelper.js +214 -0
  322. package/node_modules/jszip/lib/support.js +38 -0
  323. package/node_modules/jszip/lib/utf8.js +275 -0
  324. package/node_modules/jszip/lib/utils.js +501 -0
  325. package/node_modules/jszip/lib/zipEntries.js +261 -0
  326. package/node_modules/jszip/lib/zipEntry.js +293 -0
  327. package/node_modules/jszip/lib/zipObject.js +133 -0
  328. package/node_modules/jszip/package.json +67 -0
  329. package/node_modules/jszip/sponsors.md +21 -0
  330. package/node_modules/jszip/tsconfig.json +101 -0
  331. package/node_modules/jszip/vendor/FileSaver.js +247 -0
  332. package/node_modules/lie/README.md +62 -0
  333. package/node_modules/lie/dist/lie.js +350 -0
  334. package/node_modules/lie/dist/lie.min.js +1 -0
  335. package/node_modules/lie/dist/lie.polyfill.js +358 -0
  336. package/node_modules/lie/dist/lie.polyfill.min.js +1 -0
  337. package/node_modules/lie/lib/browser.js +273 -0
  338. package/node_modules/lie/lib/index.js +298 -0
  339. package/node_modules/lie/license.md +7 -0
  340. package/node_modules/lie/lie.d.ts +244 -0
  341. package/node_modules/lie/package.json +69 -0
  342. package/node_modules/lie/polyfill.js +4 -0
  343. package/node_modules/pako/LICENSE +21 -0
  344. package/node_modules/pako/README.md +191 -0
  345. package/node_modules/pako/dist/pako.js +6818 -0
  346. package/node_modules/pako/dist/pako.min.js +1 -0
  347. package/node_modules/pako/dist/pako_deflate.js +3997 -0
  348. package/node_modules/pako/dist/pako_deflate.min.js +1 -0
  349. package/node_modules/pako/dist/pako_inflate.js +3300 -0
  350. package/node_modules/pako/dist/pako_inflate.min.js +1 -0
  351. package/node_modules/pako/index.js +14 -0
  352. package/node_modules/pako/lib/deflate.js +400 -0
  353. package/node_modules/pako/lib/inflate.js +423 -0
  354. package/node_modules/pako/lib/utils/common.js +105 -0
  355. package/node_modules/pako/lib/utils/strings.js +187 -0
  356. package/node_modules/pako/lib/zlib/README +59 -0
  357. package/node_modules/pako/lib/zlib/adler32.js +51 -0
  358. package/node_modules/pako/lib/zlib/constants.js +68 -0
  359. package/node_modules/pako/lib/zlib/crc32.js +59 -0
  360. package/node_modules/pako/lib/zlib/deflate.js +1874 -0
  361. package/node_modules/pako/lib/zlib/gzheader.js +58 -0
  362. package/node_modules/pako/lib/zlib/inffast.js +345 -0
  363. package/node_modules/pako/lib/zlib/inflate.js +1556 -0
  364. package/node_modules/pako/lib/zlib/inftrees.js +343 -0
  365. package/node_modules/pako/lib/zlib/messages.js +32 -0
  366. package/node_modules/pako/lib/zlib/trees.js +1222 -0
  367. package/node_modules/pako/lib/zlib/zstream.js +47 -0
  368. package/node_modules/pako/package.json +44 -0
  369. package/node_modules/process-nextick-args/index.js +45 -0
  370. package/node_modules/process-nextick-args/license.md +19 -0
  371. package/node_modules/process-nextick-args/package.json +25 -0
  372. package/node_modules/process-nextick-args/readme.md +18 -0
  373. package/node_modules/readable-stream/.travis.yml +34 -0
  374. package/node_modules/readable-stream/CONTRIBUTING.md +38 -0
  375. package/node_modules/readable-stream/GOVERNANCE.md +136 -0
  376. package/node_modules/readable-stream/LICENSE +47 -0
  377. package/node_modules/readable-stream/README.md +58 -0
  378. package/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +60 -0
  379. package/node_modules/readable-stream/duplex-browser.js +1 -0
  380. package/node_modules/readable-stream/duplex.js +1 -0
  381. package/node_modules/readable-stream/lib/_stream_duplex.js +131 -0
  382. package/node_modules/readable-stream/lib/_stream_passthrough.js +47 -0
  383. package/node_modules/readable-stream/lib/_stream_readable.js +1019 -0
  384. package/node_modules/readable-stream/lib/_stream_transform.js +214 -0
  385. package/node_modules/readable-stream/lib/_stream_writable.js +685 -0
  386. package/node_modules/readable-stream/lib/internal/streams/BufferList.js +78 -0
  387. package/node_modules/readable-stream/lib/internal/streams/destroy.js +84 -0
  388. package/node_modules/readable-stream/lib/internal/streams/stream-browser.js +1 -0
  389. package/node_modules/readable-stream/lib/internal/streams/stream.js +1 -0
  390. package/node_modules/readable-stream/package.json +52 -0
  391. package/node_modules/readable-stream/passthrough.js +1 -0
  392. package/node_modules/readable-stream/readable-browser.js +7 -0
  393. package/node_modules/readable-stream/readable.js +19 -0
  394. package/node_modules/readable-stream/transform.js +1 -0
  395. package/node_modules/readable-stream/writable-browser.js +1 -0
  396. package/node_modules/readable-stream/writable.js +8 -0
  397. package/node_modules/safe-buffer/LICENSE +21 -0
  398. package/node_modules/safe-buffer/README.md +584 -0
  399. package/node_modules/safe-buffer/index.d.ts +187 -0
  400. package/node_modules/safe-buffer/index.js +62 -0
  401. package/node_modules/safe-buffer/package.json +37 -0
  402. package/node_modules/setimmediate/LICENSE.txt +20 -0
  403. package/node_modules/setimmediate/package.json +30 -0
  404. package/node_modules/setimmediate/setImmediate.js +186 -0
  405. package/node_modules/string_decoder/.travis.yml +50 -0
  406. package/node_modules/string_decoder/LICENSE +48 -0
  407. package/node_modules/string_decoder/README.md +47 -0
  408. package/node_modules/string_decoder/lib/string_decoder.js +296 -0
  409. package/node_modules/string_decoder/package.json +31 -0
  410. package/node_modules/util-deprecate/History.md +16 -0
  411. package/node_modules/util-deprecate/LICENSE +24 -0
  412. package/node_modules/util-deprecate/README.md +53 -0
  413. package/node_modules/util-deprecate/browser.js +67 -0
  414. package/node_modules/util-deprecate/node.js +6 -0
  415. package/node_modules/util-deprecate/package.json +27 -0
  416. package/package.json +9 -4
  417. package/packages/docx-core/node_modules/@xmldom/xmldom/CHANGELOG.md +468 -0
  418. package/packages/docx-core/node_modules/@xmldom/xmldom/LICENSE +8 -0
  419. package/packages/docx-core/node_modules/@xmldom/xmldom/SECURITY.md +50 -0
  420. package/packages/docx-core/node_modules/@xmldom/xmldom/index.d.ts +43 -0
  421. package/packages/docx-core/node_modules/@xmldom/xmldom/lib/.eslintrc.yml +2 -0
  422. package/packages/docx-core/node_modules/@xmldom/xmldom/lib/conventions.js +203 -0
  423. package/packages/docx-core/node_modules/@xmldom/xmldom/lib/dom-parser.js +322 -0
  424. package/packages/docx-core/node_modules/@xmldom/xmldom/lib/dom.js +1879 -0
  425. package/packages/docx-core/node_modules/@xmldom/xmldom/lib/entities.js +2166 -0
  426. package/packages/docx-core/node_modules/@xmldom/xmldom/lib/index.js +4 -0
  427. package/packages/docx-core/node_modules/@xmldom/xmldom/lib/sax.js +662 -0
  428. package/packages/docx-core/node_modules/@xmldom/xmldom/package.json +71 -0
  429. package/packages/docx-core/node_modules/@xmldom/xmldom/readme.md +356 -0
@@ -0,0 +1,147 @@
1
+ /**
2
+ * validate_document — structural integrity checks for OOXML documents.
3
+ *
4
+ * Runs before download/pack to catch common issues that could produce
5
+ * corrupt or unexpected output. Returns warnings (non-blocking) that are
6
+ * surfaced in response metadata.
7
+ */
8
+ import { OOXML, W } from './namespaces.js';
9
+ // ── Helpers ───────────────────────────────────────────────────────────
10
+ function getWAttr(el, localName) {
11
+ return el.getAttributeNS(OOXML.W_NS, localName) ?? el.getAttribute(`w:${localName}`);
12
+ }
13
+ // ── Check: orphaned bookmarks ─────────────────────────────────────────
14
+ function checkOrphanedBookmarks(body) {
15
+ const warnings = [];
16
+ const starts = new Map();
17
+ const ends = new Set();
18
+ const bookmarkStarts = body.getElementsByTagNameNS(OOXML.W_NS, W.bookmarkStart);
19
+ for (let i = 0; i < bookmarkStarts.length; i++) {
20
+ const el = bookmarkStarts.item(i);
21
+ const id = getWAttr(el, 'id');
22
+ if (id)
23
+ starts.set(id, el);
24
+ }
25
+ const bookmarkEnds = body.getElementsByTagNameNS(OOXML.W_NS, W.bookmarkEnd);
26
+ for (let i = 0; i < bookmarkEnds.length; i++) {
27
+ const el = bookmarkEnds.item(i);
28
+ const id = getWAttr(el, 'id');
29
+ if (id)
30
+ ends.add(id);
31
+ }
32
+ // bookmarkStart without matching bookmarkEnd
33
+ for (const [id, el] of starts) {
34
+ if (!ends.has(id)) {
35
+ const name = getWAttr(el, 'name') ?? '(unnamed)';
36
+ warnings.push({
37
+ code: 'ORPHANED_BOOKMARK_START',
38
+ message: `bookmarkStart id="${id}" name="${name}" has no matching bookmarkEnd`,
39
+ context: `name=${name}`,
40
+ });
41
+ }
42
+ }
43
+ // bookmarkEnd without matching bookmarkStart
44
+ for (const id of ends) {
45
+ if (!starts.has(id)) {
46
+ warnings.push({
47
+ code: 'ORPHANED_BOOKMARK_END',
48
+ message: `bookmarkEnd id="${id}" has no matching bookmarkStart`,
49
+ context: `id=${id}`,
50
+ });
51
+ }
52
+ }
53
+ return warnings;
54
+ }
55
+ // ── Check: malformed tracked-change wrappers ──────────────────────────
56
+ const TC_LOCALS = ['ins', 'del', 'moveFrom', 'moveTo'];
57
+ const REQUIRED_TC_ATTRS = ['id', 'author', 'date'];
58
+ function checkTrackedChangeWrappers(body) {
59
+ const warnings = [];
60
+ for (const local of TC_LOCALS) {
61
+ const elements = body.getElementsByTagNameNS(OOXML.W_NS, local);
62
+ for (let i = 0; i < elements.length; i++) {
63
+ const el = elements.item(i);
64
+ for (const attr of REQUIRED_TC_ATTRS) {
65
+ const val = getWAttr(el, attr);
66
+ if (!val) {
67
+ warnings.push({
68
+ code: 'MALFORMED_TRACKED_CHANGE',
69
+ message: `<w:${local}> missing required attribute w:${attr}`,
70
+ context: `element=w:${local}, missing=w:${attr}`,
71
+ });
72
+ }
73
+ }
74
+ // Check for empty tracked-change wrappers (no child elements)
75
+ let hasChildElement = false;
76
+ let c = el.firstChild;
77
+ while (c) {
78
+ if (c.nodeType === 1) {
79
+ hasChildElement = true;
80
+ break;
81
+ }
82
+ c = c.nextSibling;
83
+ }
84
+ if (!hasChildElement) {
85
+ const tcId = getWAttr(el, 'id') ?? '?';
86
+ warnings.push({
87
+ code: 'EMPTY_TRACKED_CHANGE',
88
+ message: `<w:${local} w:id="${tcId}"> has no child elements`,
89
+ context: `element=w:${local}, id=${tcId}`,
90
+ });
91
+ }
92
+ }
93
+ }
94
+ return warnings;
95
+ }
96
+ // ── Check: mismatched field markers ───────────────────────────────────
97
+ function checkFieldMarkers(body) {
98
+ const warnings = [];
99
+ // Collect all fldChar elements in document order
100
+ const fldChars = body.getElementsByTagNameNS(OOXML.W_NS, W.fldChar);
101
+ let depth = 0;
102
+ for (let i = 0; i < fldChars.length; i++) {
103
+ const el = fldChars.item(i);
104
+ const fldCharType = getWAttr(el, 'fldCharType');
105
+ if (fldCharType === 'begin') {
106
+ depth++;
107
+ }
108
+ else if (fldCharType === 'end') {
109
+ depth--;
110
+ if (depth < 0) {
111
+ warnings.push({
112
+ code: 'UNMATCHED_FIELD_END',
113
+ message: 'fldChar type="end" without matching type="begin"',
114
+ });
115
+ depth = 0;
116
+ }
117
+ }
118
+ }
119
+ if (depth > 0) {
120
+ warnings.push({
121
+ code: 'UNMATCHED_FIELD_BEGIN',
122
+ message: `${depth} fldChar type="begin" without matching type="end"`,
123
+ });
124
+ }
125
+ return warnings;
126
+ }
127
+ // ── Public API ────────────────────────────────────────────────────────
128
+ /**
129
+ * Validate structural integrity of the document body.
130
+ * Returns warnings for issues that may cause problems during download/pack.
131
+ * All checks are non-destructive and read-only.
132
+ */
133
+ export function validateDocument(doc) {
134
+ const body = doc.getElementsByTagNameNS(OOXML.W_NS, W.body).item(0);
135
+ if (!body)
136
+ return { warnings: [], isValid: true };
137
+ const warnings = [
138
+ ...checkOrphanedBookmarks(body),
139
+ ...checkTrackedChangeWrappers(body),
140
+ ...checkFieldMarkers(body),
141
+ ];
142
+ return {
143
+ warnings,
144
+ isValid: warnings.length === 0,
145
+ };
146
+ }
147
+ //# sourceMappingURL=validate_document.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate_document.js","sourceRoot":"","sources":["../../src/primitives/validate_document.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,iBAAiB,CAAC;AAc3C,yEAAyE;AAEzE,SAAS,QAAQ,CAAC,EAAW,EAAE,SAAiB;IAC9C,OAAO,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE,CAAC,YAAY,CAAC,KAAK,SAAS,EAAE,CAAC,CAAC;AACvF,CAAC;AAED,yEAAyE;AAEzE,SAAS,sBAAsB,CAAC,IAAa;IAC3C,MAAM,QAAQ,GAAwB,EAAE,CAAC;IACzC,MAAM,MAAM,GAAG,IAAI,GAAG,EAAmB,CAAC;IAC1C,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAE/B,MAAM,cAAc,GAAG,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC;IAChF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC/C,MAAM,EAAE,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC;QACnC,MAAM,EAAE,GAAG,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;QAC9B,IAAI,EAAE;YAAE,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7B,CAAC;IAED,MAAM,YAAY,GAAG,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC;IAC5E,KAAK,IA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C;AAClB,CAAC;AAED,yEAAyE;AAEzE;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAa;IAC5C,MAAM,IAAI,GAAG,GAAG,CAAC,sBAAsB,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpE,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAElD,MAAM,QAAQ,GAAwB;QACpC,GAAG,sBAAsB,CAAC,IAAe,CAAC;QAC1C,GAAG,0BAA0B,CAAC,IAAe,CAAC;QAC9C,GAAG,iBAAiB,CAAC,IAAe,CAAC;KACtC,CAAC;IAEF,OAAO;QACL,QAAQ;QACR,OAAO,EAAE,QAAQ,CAAC,MAAM,KAAK,CAAC;KAC/B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ export type XmlDoc = Document;
2
+ export declare function parseXml(xml: string): XmlDoc;
3
+ export declare function serializeXml(doc: XmlDoc): string;
4
+ export declare function textContent(node: Node | null | undefined): string;
5
+ //# sourceMappingURL=xml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xml.d.ts","sourceRoot":"","sources":["../../src/primitives/xml.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,MAAM,GAAG,QAAQ,CAAC;AAE9B,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAW5C;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAEjE"}
@@ -0,0 +1,19 @@
1
+ import { DOMParser, XMLSerializer } from '@xmldom/xmldom';
2
+ export function parseXml(xml) {
3
+ // application/xml ensures XML parsing rules (vs HTML-ish parsing).
4
+ const doc = new DOMParser().parseFromString(xml, 'application/xml');
5
+ // xmldom uses a <parsererror> element for some failures; keep a minimal check.
6
+ const parseErrors = doc.getElementsByTagName('parsererror');
7
+ if (parseErrors && parseErrors.length > 0) {
8
+ const msg = parseErrors[0]?.textContent?.trim() || 'XML parse error';
9
+ throw new Error(msg);
10
+ }
11
+ return doc;
12
+ }
13
+ export function serializeXml(doc) {
14
+ return new XMLSerializer().serializeToString(doc);
15
+ }
16
+ export function textContent(node) {
17
+ return node?.textContent ?? '';
18
+ }
19
+ //# sourceMappingURL=xml.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xml.js","sourceRoot":"","sources":["../../src/primitives/xml.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAI1D,MAAM,UAAU,QAAQ,CAAC,GAAW;IAClC,mEAAmE;IACnE,MAAM,GAAG,GAAG,IAAI,SAAS,EAAE,CAAC,eAAe,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC;IAEpE,+EAA+E;IAC/E,MAAM,WAAW,GAAG,GAAG,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAC;IAC5D,IAAI,WAAW,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1C,MAAM,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,iBAAiB,CAAC;QACrE,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,OAAO,IAAI,aAAa,EAAE,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,IAA6B;IACvD,OAAO,IAAI,EAAE,WAAW,IAAI,EAAE,CAAC;AACjC,CAAC"}
@@ -0,0 +1,25 @@
1
+ export type ZipCompression = 'STORE' | 'DEFLATE';
2
+ export type ZipEntryInfo = {
3
+ name: string;
4
+ isDirectory: boolean;
5
+ compressedSize: number;
6
+ uncompressedSize: number;
7
+ };
8
+ export declare class DocxZip {
9
+ private zip;
10
+ private constructor();
11
+ static load(buffer: Buffer): Promise<DocxZip>;
12
+ readText(path: string): Promise<string>;
13
+ readTextOrNull(path: string): Promise<string | null>;
14
+ writeText(path: string, text: string): void;
15
+ hasFile(path: string): boolean;
16
+ listFiles(): string[];
17
+ toBuffer(): Promise<Buffer>;
18
+ }
19
+ export declare function createZipBuffer(files: Record<string, string | Buffer | Uint8Array>, opts?: {
20
+ compression?: ZipCompression;
21
+ compressionLevel?: number;
22
+ }): Promise<Buffer>;
23
+ export declare function readZipText(buffer: Buffer, path: string): Promise<string | null>;
24
+ export declare function inspectZipEntries(buffer: Buffer): Promise<ZipEntryInfo[]>;
25
+ //# sourceMappingURL=zip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zip.d.ts","sourceRoot":"","sources":["../../src/primitives/zip.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,CAAC;AAEjD,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAaF,qBAAa,OAAO;IAClB,OAAO,CAAC,GAAG,CAAQ;IAEnB,OAAO;WAIM,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKnD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAMjC,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAM1D,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAI3C,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI9B,SAAS,IAAI,MAAM,EAAE;IAQf,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC;CAIlC;AAED,wBAAsB,eAAe,CACnC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC,EACnD,IAAI,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,cAAc,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAE,GACjE,OAAO,CAAC,MAAM,CAAC,CAWjB;AAED,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAKtF;AAED,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAW/E"}
@@ -0,0 +1,78 @@
1
+ import JSZip from 'jszip';
2
+ function safeNonNegativeInt(value) {
3
+ const parsed = Number(value);
4
+ if (!Number.isFinite(parsed) || parsed < 0)
5
+ return 0;
6
+ return Math.floor(parsed);
7
+ }
8
+ export class DocxZip {
9
+ zip;
10
+ constructor(zip) {
11
+ this.zip = zip;
12
+ }
13
+ static async load(buffer) {
14
+ const zip = await JSZip.loadAsync(buffer);
15
+ return new DocxZip(zip);
16
+ }
17
+ readText(path) {
18
+ const file = this.zip.file(path);
19
+ if (!file)
20
+ throw new Error(`Missing file in .docx: ${path}`);
21
+ return file.async('text');
22
+ }
23
+ async readTextOrNull(path) {
24
+ const file = this.zip.file(path);
25
+ if (!file)
26
+ return null;
27
+ return file.async('text');
28
+ }
29
+ writeText(path, text) {
30
+ this.zip.file(path, text);
31
+ }
32
+ hasFile(path) {
33
+ return this.zip.file(path) !== null;
34
+ }
35
+ listFiles() {
36
+ const files = [];
37
+ this.zip.forEach((relativePath) => {
38
+ files.push(relativePath);
39
+ });
40
+ return files;
41
+ }
42
+ async toBuffer() {
43
+ const out = await this.zip.generateAsync({ type: 'nodebuffer' });
44
+ return out;
45
+ }
46
+ }
47
+ export async function createZipBuffer(files, opts) {
48
+ const zip = new JSZip();
49
+ for (const [name, value] of Object.entries(files)) {
50
+ zip.file(name, value);
51
+ }
52
+ const out = await zip.generateAsync({
53
+ type: 'nodebuffer',
54
+ compression: opts?.compression ?? 'STORE',
55
+ compressionOptions: { level: opts?.compressionLevel ?? 9 },
56
+ });
57
+ return out;
58
+ }
59
+ export async function readZipText(buffer, path) {
60
+ const zip = await JSZip.loadAsync(buffer);
61
+ const file = zip.file(path);
62
+ if (!file)
63
+ return null;
64
+ return file.async('text');
65
+ }
66
+ export async function inspectZipEntries(buffer) {
67
+ const zip = await JSZip.loadAsync(buffer);
68
+ return Object.values(zip.files).map((file) => {
69
+ const stats = file._data;
70
+ return {
71
+ name: file.name,
72
+ isDirectory: file.dir,
73
+ compressedSize: safeNonNegativeInt(stats?.compressedSize),
74
+ uncompressedSize: safeNonNegativeInt(stats?.uncompressedSize),
75
+ };
76
+ });
77
+ }
78
+ //# sourceMappingURL=zip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zip.js","sourceRoot":"","sources":["../../src/primitives/zip.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAgB1B,SAAS,kBAAkB,CAAC,KAAc;IACxC,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC;QAAE,OAAO,CAAC,CAAC;IACrD,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,OAAO,OAAO;IACV,GAAG,CAAQ;IAEnB,YAAoB,GAAU;QAC5B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAc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;YACrB,cAAc,EAAE,kBAAkB,CAAC,KAAK,EAAE,cAAc,CAAC;YACzD,gBAAgB,EAAE,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,CAAC;SAC9D,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * DOCX archive handler using JSZip.
3
+ *
4
+ * Handles reading and writing DOCX files as ZIP archives,
5
+ * providing access to document.xml and other parts.
6
+ */
7
+ /** Standard paths within a DOCX archive */
8
+ export declare const DOCX_PATHS: {
9
+ readonly DOCUMENT: "word/document.xml";
10
+ readonly STYLES: "word/styles.xml";
11
+ readonly NUMBERING: "word/numbering.xml";
12
+ readonly SETTINGS: "word/settings.xml";
13
+ readonly COMMENTS: "word/comments.xml";
14
+ readonly FOOTNOTES: "word/footnotes.xml";
15
+ readonly ENDNOTES: "word/endnotes.xml";
16
+ readonly RELS: "word/_rels/document.xml.rels";
17
+ readonly CONTENT_TYPES: "[Content_Types].xml";
18
+ };
19
+ /**
20
+ * Represents a DOCX file as a ZIP archive.
21
+ *
22
+ * Provides methods to read and modify the XML parts of a DOCX file.
23
+ */
24
+ export declare class DocxArchive {
25
+ private zip;
26
+ private modified;
27
+ private constructor();
28
+ /**
29
+ * Load a DOCX file from a Buffer.
30
+ *
31
+ * @param buffer - The DOCX file contents
32
+ * @returns A DocxArchive instance
33
+ */
34
+ static load(buffer: Buffer): Promise<DocxArchive>;
35
+ /**
36
+ * Create a new empty DOCX archive.
37
+ *
38
+ * @returns A new DocxArchive with minimal structure
39
+ */
40
+ static create(): Promise<DocxArchive>;
41
+ /**
42
+ * Get the main document.xml content.
43
+ */
44
+ getDocumentXml(): Promise<string>;
45
+ /**
46
+ * Set the main document.xml content.
47
+ */
48
+ setDocumentXml(xml: string): void;
49
+ /**
50
+ * Get an arbitrary file from the archive.
51
+ *
52
+ * @param path - Path within the archive
53
+ * @returns File contents as string, or null if not found
54
+ */
55
+ getFile(path: string): Promise<string | null>;
56
+ /**
57
+ * Set an arbitrary file in the archive.
58
+ *
59
+ * @param path - Path within the archive
60
+ * @param content - File contents
61
+ */
62
+ setFile(path: string, content: string): void;
63
+ /**
64
+ * Check if a file exists in the archive.
65
+ */
66
+ hasFile(path: string): boolean;
67
+ /**
68
+ * List all files in the archive.
69
+ */
70
+ listFiles(): string[];
71
+ /**
72
+ * Get the styles.xml content if present.
73
+ */
74
+ getStylesXml(): Promise<string | null>;
75
+ /**
76
+ * Get the numbering.xml content if present.
77
+ */
78
+ getNumberingXml(): Promise<string | null>;
79
+ /**
80
+ * Save the archive to a Buffer.
81
+ *
82
+ * @returns The DOCX file as a Buffer
83
+ */
84
+ save(): Promise<Buffer>;
85
+ /**
86
+ * Clone this archive (deep copy).
87
+ */
88
+ clone(): Promise<DocxArchive>;
89
+ /**
90
+ * Get list of modified paths since loading.
91
+ */
92
+ getModifiedPaths(): string[];
93
+ }
94
+ //# sourceMappingURL=DocxArchive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocxArchive.d.ts","sourceRoot":"","sources":["../../../src/shared/docx/DocxArchive.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,2CAA2C;AAC3C,eAAO,MAAM,UAAU;;;;;;;;;;CAUb,CAAC;AAEX;;;;GAIG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,GAAG,CAAQ;IACnB,OAAO,CAAC,QAAQ,CAA0B;IAE1C,OAAO;IAIP;;;;;OAKG;WACU,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAcvD;;;;OAIG;WACU,MAAM,IAAI,OAAO,CAAC,WAAW,CAAC;IAmC3C;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC;IAQvC;;OAEG;IACH,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAKjC;;;;;OAKG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAQnD;;;;;OAKG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAK5C;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI9B;;OAEG;IACH,SAAS,IAAI,MAAM,EAAE;IAQrB;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAI5C;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAI/C;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC;IAS7B;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,WAAW,CAAC;IAKnC;;OAEG;IACH,gBAAgB,IAAI,MAAM,EAAE;CAG7B"}
@@ -0,0 +1,169 @@
1
+ /**
2
+ * DOCX archive handler using JSZip.
3
+ *
4
+ * Handles reading and writing DOCX files as ZIP archives,
5
+ * providing access to document.xml and other parts.
6
+ */
7
+ import JSZip from 'jszip';
8
+ /** Standard paths within a DOCX archive */
9
+ export const DOCX_PATHS = {
10
+ DOCUMENT: 'word/document.xml',
11
+ STYLES: 'word/styles.xml',
12
+ NUMBERING: 'word/numbering.xml',
13
+ SETTINGS: 'word/settings.xml',
14
+ COMMENTS: 'word/comments.xml',
15
+ FOOTNOTES: 'word/footnotes.xml',
16
+ ENDNOTES: 'word/endnotes.xml',
17
+ RELS: 'word/_rels/document.xml.rels',
18
+ CONTENT_TYPES: '[Content_Types].xml',
19
+ };
20
+ /**
21
+ * Represents a DOCX file as a ZIP archive.
22
+ *
23
+ * Provides methods to read and modify the XML parts of a DOCX file.
24
+ */
25
+ export class DocxArchive {
26
+ zip;
27
+ modified = new Set();
28
+ constructor(zip) {
29
+ this.zip = zip;
30
+ }
31
+ /**
32
+ * Load a DOCX file from a Buffer.
33
+ *
34
+ * @param buffer - The DOCX file contents
35
+ * @returns A DocxArchive instance
36
+ */
37
+ static async load(buffer) {
38
+ const zip = await JSZip.loadAsync(buffer);
39
+ // Verify this is a valid DOCX
40
+ if (!zip.file(DOCX_PATHS.DOCUMENT)) {
41
+ throw new Error('Invalid DOCX: missing word/document.xml');
42
+ }
43
+ if (!zip.file(DOCX_PATHS.CONTENT_TYPES)) {
44
+ throw new Error('Invalid DOCX: missing [Content_Types].xml');
45
+ }
46
+ return new DocxArchive(zip);
47
+ }
48
+ /**
49
+ * Create a new empty DOCX archive.
50
+ *
51
+ * @returns A new DocxArchive with minimal structure
52
+ */
53
+ static async create() {
54
+ const zip = new JSZip();
55
+ // Add minimal content types
56
+ zip.file(DOCX_PATHS.CONTENT_TYPES, `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
57
+ <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
58
+ <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
59
+ <Default Extension="xml" ContentType="application/xml"/>
60
+ <Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/>
61
+ </Types>`);
62
+ // Add minimal document
63
+ zip.file(DOCX_PATHS.DOCUMENT, `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
64
+ <w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
65
+ <w:body/>
66
+ </w:document>`);
67
+ // Add relationships
68
+ zip.file('_rels/.rels', `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
69
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
70
+ <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/>
71
+ </Relationships>`);
72
+ return new DocxArchive(zip);
73
+ }
74
+ /**
75
+ * Get the main document.xml content.
76
+ */
77
+ async getDocumentXml() {
78
+ const file = this.zip.file(DOCX_PATHS.DOCUMENT);
79
+ if (!file) {
80
+ throw new Error('Document XML not found');
81
+ }
82
+ return file.async('string');
83
+ }
84
+ /**
85
+ * Set the main document.xml content.
86
+ */
87
+ setDocumentXml(xml) {
88
+ this.zip.file(DOCX_PATHS.DOCUMENT, xml);
89
+ this.modified.add(DOCX_PATHS.DOCUMENT);
90
+ }
91
+ /**
92
+ * Get an arbitrary file from the archive.
93
+ *
94
+ * @param path - Path within the archive
95
+ * @returns File contents as string, or null if not found
96
+ */
97
+ async getFile(path) {
98
+ const file = this.zip.file(path);
99
+ if (!file) {
100
+ return null;
101
+ }
102
+ return file.async('string');
103
+ }
104
+ /**
105
+ * Set an arbitrary file in the archive.
106
+ *
107
+ * @param path - Path within the archive
108
+ * @param content - File contents
109
+ */
110
+ setFile(path, content) {
111
+ this.zip.file(path, content);
112
+ this.modified.add(path);
113
+ }
114
+ /**
115
+ * Check if a file exists in the archive.
116
+ */
117
+ hasFile(path) {
118
+ return this.zip.file(path) !== null;
119
+ }
120
+ /**
121
+ * List all files in the archive.
122
+ */
123
+ listFiles() {
124
+ const files = [];
125
+ this.zip.forEach((relativePath) => {
126
+ files.push(relativePath);
127
+ });
128
+ return files;
129
+ }
130
+ /**
131
+ * Get the styles.xml content if present.
132
+ */
133
+ async getStylesXml() {
134
+ return this.getFile(DOCX_PATHS.STYLES);
135
+ }
136
+ /**
137
+ * Get the numbering.xml content if present.
138
+ */
139
+ async getNumberingXml() {
140
+ return this.getFile(DOCX_PATHS.NUMBERING);
141
+ }
142
+ /**
143
+ * Save the archive to a Buffer.
144
+ *
145
+ * @returns The DOCX file as a Buffer
146
+ */
147
+ async save() {
148
+ const content = await this.zip.generateAsync({
149
+ type: 'nodebuffer',
150
+ compression: 'DEFLATE',
151
+ compressionOptions: { level: 6 },
152
+ });
153
+ return content;
154
+ }
155
+ /**
156
+ * Clone this archive (deep copy).
157
+ */
158
+ async clone() {
159
+ const buffer = await this.save();
160
+ return DocxArchive.load(buffer);
161
+ }
162
+ /**
163
+ * Get list of modified paths since loading.
164
+ */
165
+ getModifiedPaths() {
166
+ return Array.from(this.modified);
167
+ }
168
+ }
169
+ //#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