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.
- package/content/templates/closing-checklist/template.docx +0 -0
- package/dist/core/checklist/docx-import.d.ts +50 -0
- package/dist/core/checklist/docx-import.d.ts.map +1 -0
- package/dist/core/checklist/docx-import.js +613 -0
- package/dist/core/checklist/docx-import.js.map +1 -0
- package/dist/core/checklist/docx-table-helpers.d.ts +33 -0
- package/dist/core/checklist/docx-table-helpers.d.ts.map +1 -0
- package/dist/core/checklist/docx-table-helpers.js +154 -0
- package/dist/core/checklist/docx-table-helpers.js.map +1 -0
- package/dist/core/checklist/format-checklist-docx.d.ts.map +1 -1
- package/dist/core/checklist/format-checklist-docx.js +37 -88
- package/dist/core/checklist/format-checklist-docx.js.map +1 -1
- package/dist/core/checklist/index.d.ts +15 -12
- package/dist/core/checklist/index.d.ts.map +1 -1
- package/dist/core/checklist/index.js +48 -30
- package/dist/core/checklist/index.js.map +1 -1
- package/dist/core/checklist/status-labels.d.ts +6 -0
- package/dist/core/checklist/status-labels.d.ts.map +1 -1
- package/dist/core/checklist/status-labels.js +8 -0
- package/dist/core/checklist/status-labels.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/node_modules/@usejunior/docx-core/dist/atomizer.d.ts +218 -0
- package/node_modules/@usejunior/docx-core/dist/atomizer.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/atomizer.js +869 -0
- package/node_modules/@usejunior/docx-core/dist/atomizer.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/atomLcs.d.ts +96 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/atomLcs.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/atomLcs.js +347 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/atomLcs.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/consumerCompatibility.d.ts +2 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/consumerCompatibility.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/consumerCompatibility.js +188 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/consumerCompatibility.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/debug.d.ts +41 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/debug.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/debug.js +85 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/debug.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/documentReconstructor.d.ts +64 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/documentReconstructor.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/documentReconstructor.js +985 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/documentReconstructor.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/hierarchicalLcs.d.ts +111 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/hierarchicalLcs.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/hierarchicalLcs.js +469 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/hierarchicalLcs.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/inPlaceModifier.d.ts +277 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/inPlaceModifier.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/inPlaceModifier.js +2279 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/inPlaceModifier.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/numberingIntegration.d.ts +59 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/numberingIntegration.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/numberingIntegration.js +209 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/numberingIntegration.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/pipeline.d.ts +69 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/pipeline.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/pipeline.js +910 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/pipeline.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/premergeRuns.d.ts +26 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/premergeRuns.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/premergeRuns.js +153 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/premergeRuns.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/trackChangesAcceptor.d.ts +63 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/trackChangesAcceptor.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/trackChangesAcceptor.js +254 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/trackChangesAcceptor.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/trackChangesAcceptorAst.d.ts +64 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/trackChangesAcceptorAst.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/trackChangesAcceptorAst.js +616 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/trackChangesAcceptorAst.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/xmlToWmlElement.d.ts +65 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/xmlToWmlElement.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/xmlToWmlElement.js +95 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/atomizer/xmlToWmlElement.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/wmlcomparer/DocxodusWasm.d.ts +51 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/wmlcomparer/DocxodusWasm.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/wmlcomparer/DocxodusWasm.js +83 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/wmlcomparer/DocxodusWasm.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/wmlcomparer/DotnetCli.d.ts +40 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/wmlcomparer/DotnetCli.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/wmlcomparer/DotnetCli.js +135 -0
- package/node_modules/@usejunior/docx-core/dist/baselines/wmlcomparer/DotnetCli.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/cli/compare-two.d.ts +28 -0
- package/node_modules/@usejunior/docx-core/dist/cli/compare-two.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/cli/compare-two.js +110 -0
- package/node_modules/@usejunior/docx-core/dist/cli/compare-two.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/cli/index.d.ts +3 -0
- package/node_modules/@usejunior/docx-core/dist/cli/index.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/cli/index.js +21 -0
- package/node_modules/@usejunior/docx-core/dist/cli/index.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/core-types.d.ts +296 -0
- package/node_modules/@usejunior/docx-core/dist/core-types.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/core-types.js +122 -0
- package/node_modules/@usejunior/docx-core/dist/core-types.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/footnotes.d.ts +144 -0
- package/node_modules/@usejunior/docx-core/dist/footnotes.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/footnotes.js +291 -0
- package/node_modules/@usejunior/docx-core/dist/footnotes.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/format-detection.d.ts +120 -0
- package/node_modules/@usejunior/docx-core/dist/format-detection.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/format-detection.js +338 -0
- package/node_modules/@usejunior/docx-core/dist/format-detection.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/index.d.ts +177 -0
- package/node_modules/@usejunior/docx-core/dist/index.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/index.js +55 -0
- package/node_modules/@usejunior/docx-core/dist/index.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/integration/output-artifacts.d.ts +6 -0
- package/node_modules/@usejunior/docx-core/dist/integration/output-artifacts.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/integration/output-artifacts.js +30 -0
- package/node_modules/@usejunior/docx-core/dist/integration/output-artifacts.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/move-detection.d.ts +211 -0
- package/node_modules/@usejunior/docx-core/dist/move-detection.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/move-detection.js +391 -0
- package/node_modules/@usejunior/docx-core/dist/move-detection.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/numbering.d.ts +136 -0
- package/node_modules/@usejunior/docx-core/dist/numbering.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/numbering.js +446 -0
- package/node_modules/@usejunior/docx-core/dist/numbering.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/accept_changes.d.ts +30 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/accept_changes.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/accept_changes.js +241 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/accept_changes.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/bookmarks.d.ts +12 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/bookmarks.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/bookmarks.js +248 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/bookmarks.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/comments.d.ts +88 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/comments.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/comments.js +703 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/comments.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/document.d.ts +186 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/document.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/document.js +555 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/document.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/document_view.d.ts +97 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/document_view.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/document_view.js +749 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/document_view.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/dom-helpers.d.ts +94 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/dom-helpers.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/dom-helpers.js +219 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/dom-helpers.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/errors.d.ts +7 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/errors.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/errors.js +10 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/errors.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/extract_revisions.d.ts +50 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/extract_revisions.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/extract_revisions.js +340 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/extract_revisions.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/footnotes.d.ts +37 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/footnotes.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/footnotes.js +552 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/footnotes.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/formatting_tags.d.ts +43 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/formatting_tags.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/formatting_tags.js +291 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/formatting_tags.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/index.d.ts +27 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/index.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/index.js +27 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/index.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/layout.d.ts +53 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/layout.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/layout.js +178 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/layout.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/list_labels.d.ts +19 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/list_labels.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/list_labels.js +57 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/list_labels.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/matching.d.ts +31 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/matching.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/matching.js +223 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/matching.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/merge_runs.d.ts +23 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/merge_runs.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/merge_runs.js +243 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/merge_runs.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/namespaces.d.ts +91 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/namespaces.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/namespaces.js +108 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/namespaces.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/numbering.d.ts +27 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/numbering.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/numbering.js +182 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/numbering.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/prevent_double_elevation.d.ts +18 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/prevent_double_elevation.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/prevent_double_elevation.js +190 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/prevent_double_elevation.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/reject_changes.d.ts +27 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/reject_changes.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/reject_changes.js +371 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/reject_changes.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/relationships.d.ts +7 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/relationships.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/relationships.js +24 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/relationships.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/semantic_tags.d.ts +17 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/semantic_tags.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/semantic_tags.js +58 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/semantic_tags.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/simplify_redlines.d.ts +19 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/simplify_redlines.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/simplify_redlines.js +94 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/simplify_redlines.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/styles.d.ts +36 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/styles.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/styles.js +205 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/styles.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/tables.d.ts +54 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/tables.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/tables.js +205 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/tables.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/text.d.ts +30 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/text.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/text.js +461 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/text.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/validate_document.d.ts +24 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/validate_document.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/validate_document.js +147 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/validate_document.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/xml.d.ts +5 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/xml.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/xml.js +19 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/xml.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/zip.d.ts +25 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/zip.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/zip.js +78 -0
- package/node_modules/@usejunior/docx-core/dist/primitives/zip.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/shared/docx/DocxArchive.d.ts +94 -0
- package/node_modules/@usejunior/docx-core/dist/shared/docx/DocxArchive.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/shared/docx/DocxArchive.js +169 -0
- package/node_modules/@usejunior/docx-core/dist/shared/docx/DocxArchive.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/shared/ooxml/namespaces.d.ts +149 -0
- package/node_modules/@usejunior/docx-core/dist/shared/ooxml/namespaces.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/shared/ooxml/namespaces.js +224 -0
- package/node_modules/@usejunior/docx-core/dist/shared/ooxml/namespaces.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/shared/ooxml/types.d.ts +136 -0
- package/node_modules/@usejunior/docx-core/dist/shared/ooxml/types.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/shared/ooxml/types.js +7 -0
- package/node_modules/@usejunior/docx-core/dist/shared/ooxml/types.js.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/shared/validators/structural.d.ts +31 -0
- package/node_modules/@usejunior/docx-core/dist/shared/validators/structural.d.ts.map +1 -0
- package/node_modules/@usejunior/docx-core/dist/shared/validators/structural.js +110 -0
- package/node_modules/@usejunior/docx-core/dist/shared/validators/structural.js.map +1 -0
- package/node_modules/@usejunior/docx-core/package.json +26 -0
- package/node_modules/core-util-is/LICENSE +19 -0
- package/node_modules/core-util-is/README.md +3 -0
- package/node_modules/core-util-is/lib/util.js +107 -0
- package/node_modules/core-util-is/package.json +38 -0
- package/node_modules/diff-match-patch/LICENSE +202 -0
- package/node_modules/diff-match-patch/README.md +94 -0
- package/node_modules/diff-match-patch/index.js +2218 -0
- package/node_modules/diff-match-patch/package.json +22 -0
- package/node_modules/immediate/LICENSE.txt +20 -0
- package/node_modules/immediate/README.md +93 -0
- package/node_modules/immediate/dist/immediate.js +75 -0
- package/node_modules/immediate/dist/immediate.min.js +1 -0
- package/node_modules/immediate/lib/browser.js +69 -0
- package/node_modules/immediate/lib/index.js +73 -0
- package/node_modules/immediate/package.json +42 -0
- package/node_modules/inherits/LICENSE +16 -0
- package/node_modules/inherits/README.md +42 -0
- package/node_modules/inherits/inherits.js +9 -0
- package/node_modules/inherits/inherits_browser.js +27 -0
- package/node_modules/inherits/package.json +29 -0
- package/node_modules/isarray/.npmignore +1 -0
- package/node_modules/isarray/.travis.yml +4 -0
- package/node_modules/isarray/Makefile +6 -0
- package/node_modules/isarray/README.md +60 -0
- package/node_modules/isarray/component.json +19 -0
- package/node_modules/isarray/index.js +5 -0
- package/node_modules/isarray/package.json +45 -0
- package/node_modules/isarray/test.js +20 -0
- package/node_modules/jszip/.codeclimate.yml +16 -0
- package/node_modules/jszip/.editorconfig +8 -0
- package/node_modules/jszip/.eslintrc.js +43 -0
- package/node_modules/jszip/.github/workflows/pr.yaml +58 -0
- package/node_modules/jszip/.jekyll-metadata +0 -0
- package/node_modules/jszip/.travis.yml +17 -0
- package/node_modules/jszip/CHANGES.md +204 -0
- package/node_modules/jszip/LICENSE.markdown +651 -0
- package/node_modules/jszip/README.markdown +33 -0
- package/node_modules/jszip/deps.js +37 -0
- package/node_modules/jszip/dist/jszip.js +11577 -0
- package/node_modules/jszip/dist/jszip.min.js +13 -0
- package/node_modules/jszip/graph.svg +601 -0
- package/node_modules/jszip/index.d.ts +330 -0
- package/node_modules/jszip/lib/base64.js +106 -0
- package/node_modules/jszip/lib/compressedObject.js +74 -0
- package/node_modules/jszip/lib/compressions.js +14 -0
- package/node_modules/jszip/lib/crc32.js +77 -0
- package/node_modules/jszip/lib/defaults.js +11 -0
- package/node_modules/jszip/lib/external.js +18 -0
- package/node_modules/jszip/lib/flate.js +85 -0
- package/node_modules/jszip/lib/generate/ZipFileWorker.js +539 -0
- package/node_modules/jszip/lib/generate/index.js +57 -0
- package/node_modules/jszip/lib/index.js +55 -0
- package/node_modules/jszip/lib/license_header.js +11 -0
- package/node_modules/jszip/lib/load.js +88 -0
- package/node_modules/jszip/lib/nodejs/NodejsStreamInputAdapter.js +74 -0
- package/node_modules/jszip/lib/nodejs/NodejsStreamOutputAdapter.js +42 -0
- package/node_modules/jszip/lib/nodejsUtils.js +57 -0
- package/node_modules/jszip/lib/object.js +384 -0
- package/node_modules/jszip/lib/readable-stream-browser.js +10 -0
- package/node_modules/jszip/lib/reader/ArrayReader.js +57 -0
- package/node_modules/jszip/lib/reader/DataReader.js +116 -0
- package/node_modules/jszip/lib/reader/NodeBufferReader.js +19 -0
- package/node_modules/jszip/lib/reader/StringReader.js +38 -0
- package/node_modules/jszip/lib/reader/Uint8ArrayReader.js +22 -0
- package/node_modules/jszip/lib/reader/readerFor.js +28 -0
- package/node_modules/jszip/lib/signature.js +7 -0
- package/node_modules/jszip/lib/stream/ConvertWorker.js +26 -0
- package/node_modules/jszip/lib/stream/Crc32Probe.js +24 -0
- package/node_modules/jszip/lib/stream/DataLengthProbe.js +29 -0
- package/node_modules/jszip/lib/stream/DataWorker.js +116 -0
- package/node_modules/jszip/lib/stream/GenericWorker.js +263 -0
- package/node_modules/jszip/lib/stream/StreamHelper.js +214 -0
- package/node_modules/jszip/lib/support.js +38 -0
- package/node_modules/jszip/lib/utf8.js +275 -0
- package/node_modules/jszip/lib/utils.js +501 -0
- package/node_modules/jszip/lib/zipEntries.js +261 -0
- package/node_modules/jszip/lib/zipEntry.js +293 -0
- package/node_modules/jszip/lib/zipObject.js +133 -0
- package/node_modules/jszip/package.json +67 -0
- package/node_modules/jszip/sponsors.md +21 -0
- package/node_modules/jszip/tsconfig.json +101 -0
- package/node_modules/jszip/vendor/FileSaver.js +247 -0
- package/node_modules/lie/README.md +62 -0
- package/node_modules/lie/dist/lie.js +350 -0
- package/node_modules/lie/dist/lie.min.js +1 -0
- package/node_modules/lie/dist/lie.polyfill.js +358 -0
- package/node_modules/lie/dist/lie.polyfill.min.js +1 -0
- package/node_modules/lie/lib/browser.js +273 -0
- package/node_modules/lie/lib/index.js +298 -0
- package/node_modules/lie/license.md +7 -0
- package/node_modules/lie/lie.d.ts +244 -0
- package/node_modules/lie/package.json +69 -0
- package/node_modules/lie/polyfill.js +4 -0
- package/node_modules/pako/LICENSE +21 -0
- package/node_modules/pako/README.md +191 -0
- package/node_modules/pako/dist/pako.js +6818 -0
- package/node_modules/pako/dist/pako.min.js +1 -0
- package/node_modules/pako/dist/pako_deflate.js +3997 -0
- package/node_modules/pako/dist/pako_deflate.min.js +1 -0
- package/node_modules/pako/dist/pako_inflate.js +3300 -0
- package/node_modules/pako/dist/pako_inflate.min.js +1 -0
- package/node_modules/pako/index.js +14 -0
- package/node_modules/pako/lib/deflate.js +400 -0
- package/node_modules/pako/lib/inflate.js +423 -0
- package/node_modules/pako/lib/utils/common.js +105 -0
- package/node_modules/pako/lib/utils/strings.js +187 -0
- package/node_modules/pako/lib/zlib/README +59 -0
- package/node_modules/pako/lib/zlib/adler32.js +51 -0
- package/node_modules/pako/lib/zlib/constants.js +68 -0
- package/node_modules/pako/lib/zlib/crc32.js +59 -0
- package/node_modules/pako/lib/zlib/deflate.js +1874 -0
- package/node_modules/pako/lib/zlib/gzheader.js +58 -0
- package/node_modules/pako/lib/zlib/inffast.js +345 -0
- package/node_modules/pako/lib/zlib/inflate.js +1556 -0
- package/node_modules/pako/lib/zlib/inftrees.js +343 -0
- package/node_modules/pako/lib/zlib/messages.js +32 -0
- package/node_modules/pako/lib/zlib/trees.js +1222 -0
- package/node_modules/pako/lib/zlib/zstream.js +47 -0
- package/node_modules/pako/package.json +44 -0
- package/node_modules/process-nextick-args/index.js +45 -0
- package/node_modules/process-nextick-args/license.md +19 -0
- package/node_modules/process-nextick-args/package.json +25 -0
- package/node_modules/process-nextick-args/readme.md +18 -0
- package/node_modules/readable-stream/.travis.yml +34 -0
- package/node_modules/readable-stream/CONTRIBUTING.md +38 -0
- package/node_modules/readable-stream/GOVERNANCE.md +136 -0
- package/node_modules/readable-stream/LICENSE +47 -0
- package/node_modules/readable-stream/README.md +58 -0
- package/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +60 -0
- package/node_modules/readable-stream/duplex-browser.js +1 -0
- package/node_modules/readable-stream/duplex.js +1 -0
- package/node_modules/readable-stream/lib/_stream_duplex.js +131 -0
- package/node_modules/readable-stream/lib/_stream_passthrough.js +47 -0
- package/node_modules/readable-stream/lib/_stream_readable.js +1019 -0
- package/node_modules/readable-stream/lib/_stream_transform.js +214 -0
- package/node_modules/readable-stream/lib/_stream_writable.js +685 -0
- package/node_modules/readable-stream/lib/internal/streams/BufferList.js +78 -0
- package/node_modules/readable-stream/lib/internal/streams/destroy.js +84 -0
- package/node_modules/readable-stream/lib/internal/streams/stream-browser.js +1 -0
- package/node_modules/readable-stream/lib/internal/streams/stream.js +1 -0
- package/node_modules/readable-stream/package.json +52 -0
- package/node_modules/readable-stream/passthrough.js +1 -0
- package/node_modules/readable-stream/readable-browser.js +7 -0
- package/node_modules/readable-stream/readable.js +19 -0
- package/node_modules/readable-stream/transform.js +1 -0
- package/node_modules/readable-stream/writable-browser.js +1 -0
- package/node_modules/readable-stream/writable.js +8 -0
- package/node_modules/safe-buffer/LICENSE +21 -0
- package/node_modules/safe-buffer/README.md +584 -0
- package/node_modules/safe-buffer/index.d.ts +187 -0
- package/node_modules/safe-buffer/index.js +62 -0
- package/node_modules/safe-buffer/package.json +37 -0
- package/node_modules/setimmediate/LICENSE.txt +20 -0
- package/node_modules/setimmediate/package.json +30 -0
- package/node_modules/setimmediate/setImmediate.js +186 -0
- package/node_modules/string_decoder/.travis.yml +50 -0
- package/node_modules/string_decoder/LICENSE +48 -0
- package/node_modules/string_decoder/README.md +47 -0
- package/node_modules/string_decoder/lib/string_decoder.js +296 -0
- package/node_modules/string_decoder/package.json +31 -0
- package/node_modules/util-deprecate/History.md +16 -0
- package/node_modules/util-deprecate/LICENSE +24 -0
- package/node_modules/util-deprecate/README.md +53 -0
- package/node_modules/util-deprecate/browser.js +67 -0
- package/node_modules/util-deprecate/node.js +6 -0
- package/node_modules/util-deprecate/package.json +27 -0
- package/package.json +9 -4
- package/packages/docx-core/node_modules/@xmldom/xmldom/CHANGELOG.md +468 -0
- package/packages/docx-core/node_modules/@xmldom/xmldom/LICENSE +8 -0
- package/packages/docx-core/node_modules/@xmldom/xmldom/SECURITY.md +50 -0
- package/packages/docx-core/node_modules/@xmldom/xmldom/index.d.ts +43 -0
- package/packages/docx-core/node_modules/@xmldom/xmldom/lib/.eslintrc.yml +2 -0
- package/packages/docx-core/node_modules/@xmldom/xmldom/lib/conventions.js +203 -0
- package/packages/docx-core/node_modules/@xmldom/xmldom/lib/dom-parser.js +322 -0
- package/packages/docx-core/node_modules/@xmldom/xmldom/lib/dom.js +1879 -0
- package/packages/docx-core/node_modules/@xmldom/xmldom/lib/entities.js +2166 -0
- package/packages/docx-core/node_modules/@xmldom/xmldom/lib/index.js +4 -0
- package/packages/docx-core/node_modules/@xmldom/xmldom/lib/sax.js +662 -0
- package/packages/docx-core/node_modules/@xmldom/xmldom/package.json +71 -0
- 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,W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IACL,CAAC;IAED,OAAO,QAAQ,CAAC;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 @@
|
|
|
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;QAC9B,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAC1C,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;IAED,QAAQ,CAAC,IAAY;QACnB,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,EAAE,CAAC,CAAC;QAC7D,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IAED,KAAK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EAAE,WAAW,IAAI,OAAO;QACzC,kBAAkB,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAgB,IAAI,CAAC,EAAE;KAC3D,CAAC,CAAC;IACH,OAAO,GAAa,CAAC;AACvB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,MAAc,EAAE,IAAY;IAC5D,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC1C,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,MAAc;IACpD,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC1C,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAC3C,MAAM,KAAK,GAAI,IAAkC,CAAC,KAAK,CAAC;QACxD,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,GAAG;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
|
+
//# sourceMappingURL=DocxArchive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocxArchive.js","sourceRoot":"","sources":["../../../src/shared/docx/DocxArchive.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,2CAA2C;AAC3C,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,QAAQ,EAAE,mBAAmB;IAC7B,MAAM,EAAE,iBAAiB;IACzB,SAAS,EAAE,oBAAoB;IAC/B,QAAQ,EAAE,mBAAmB;IAC7B,QAAQ,EAAE,mBAAmB;IAC7B,SAAS,EAAE,oBAAoB;IAC/B,QAAQ,EAAE,mBAAmB;IAC7B,IAAI,EAAE,8BAA8B;IACpC,aAAa,EAAE,qBAAqB;CAC5B,CAAC;AAEX;;;;GAIG;AACH,MAAM,OAAO,WAAW;IACd,GAAG,CAAQ;IACX,QAAQ,GAAgB,IAAI,GAAG,EAAE,CAAC;IAE1C,YAAoB,GAAU;QAC5B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAc;QAC9B,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAE1C,8BAA8B;QAC9B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,E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