🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@stll/docx-core

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stll/docx-core - npm Package Compare versions

Comparing version
0.7.0
to
0.8.0
+38
dist/document-BO7h-LxY.js
//#region src/model/content.ts
const OOXML_SYMBOL_CHARACTER_PATTERN = /^[\dA-Fa-f]{4}$/u;
/** Whether a symbol character is exactly four hexadecimal digits. */
const isOoxmlSymbolCharacter = (value) => OOXML_SYMBOL_CHARACTER_PATTERN.test(value);
/**
* Largest value a revision id (`w:id`) may carry: 2^31 - 1.
*
* `w:id` on `<w:ins>`/`<w:del>` comes from `CT_Markup`, typed
* `ST_DecimalNumber` — which ECMA-376 defines as an unbounded integer. The
* bound below is an implementation limit: conforming consumers read
* `ST_DecimalNumber` into a signed 32-bit int, and a value past this bound
* overflows on load and surfaces as an unreadable document. Port of
* eigenpal/docx-editor#1093.
*/
const MAX_REVISION_ID = 2147483647;
/**
* Coerce any revision id — including one parsed from an untrusted DOCX — into
* the range serialized `w:id` attributes may occupy.
*
* - Malformed (negative, fractional, `NaN`, `Infinity`): collapse to `0`.
* - Well-formed but out of range: fold modulo the range (not clamp) so a
* contiguous run of overflowing ids stays distinguishable.
*/
function normalizeRevisionId(id) {
if (!Number.isInteger(id) || id < 0) return 0;
if (id > 2147483647) return id % 2147483648;
return id;
}
//#endregion
//#region src/model/document.ts
/** DOCX package conformance classes. */
const DOCX_CONFORMANCE_CLASSES = Object.freeze({
STRICT: "strict",
TRANSITIONAL: "transitional",
UNKNOWN: "unknown"
});
//#endregion
export { normalizeRevisionId as i, MAX_REVISION_ID as n, isOoxmlSymbolCharacter as r, DOCX_CONFORMANCE_CLASSES as t };

Sorry, the diff of this file is too big to display

+1
-1

@@ -1,2 +0,2 @@

import { At as SectionProperties, M as DocumentBody, St as PositionalTab, Tt as RunContent, Ut as Table, Wt as TableCell, Zt as TextContent, _t as Paragraph, a as DocxPackage, b as BlockContent, i as DocxConformanceClass, n as Document, p as Style, qt as TableRow, t as DOCX_CONFORMANCE_CLASSES, vt as ParagraphContent, w as BreakContent, wt as Run } from "./document-DI8X7aZy.js";
import { At as SectionProperties, M as DocumentBody, St as PositionalTab, Tt as RunContent, Ut as Table, Wt as TableCell, Zt as TextContent, _t as Paragraph, a as DocxPackage, b as BlockContent, i as DocxConformanceClass, n as Document, p as Style, qt as TableRow, t as DOCX_CONFORMANCE_CLASSES, vt as ParagraphContent, w as BreakContent, wt as Run } from "./document-CMZ4oy9i.js";
//#region src/legal-source/types.d.ts

@@ -3,0 +3,0 @@ type LegalDocumentKind = "agreement" | "letter" | "memo" | "checklist" | "pleading" | "other";

@@ -1,2 +0,2 @@

import { $ as ImageTransform, $t as TrackedChangeInfo, A as ComplexField, An as TextEffect, At as SectionProperties, B as FooterReference, Bt as SoftHyphenContent, C as BookmarkStart, Cn as TableCellBorders, Ct as PropertyChangeInfo, D as CommentRangeEnd, Dn as TableMeasurement, Dt as SdtProperties, E as Comment, En as TableLook, Et as RunPropertyChange, F as EndnotePosition, Fn as KnownBorderStyle, Ft as ShapeFill, G as HeaderFooterType, Gt as TableCellPropertyChange, H as FootnotePosition, Ht as TabContent, I as EndnoteProperties, In as ShadingProperties, It as ShapeOutline, J as Image, Jt as TableRowPropertyChange, K as HeaderReference, Kt as TablePropertyChange, L as Field, Ln as ThemeColorSlot, Lt as ShapeTextBody, M as DocumentBody, Mn as UnderlineStyle, Mt as SectionStart, N as DrawingContent, Nn as BorderSpec, Nt as Shape, O as CommentRangeStart, On as TableRowFormatting, Ot as SdtType, P as Endnote, Pn as ColorValue, Pt as ShapeContent, Q as ImageSize, Qt as TextWatermark, R as FieldCharContent, Rt as ShapeType, S as BookmarkEnd, Sn as TableBorders, St as PositionalTab, T as Column, Tn as TableFormatting, Tt as RunContent, U as FootnoteProperties, Ut as Table, V as Footnote, Vt as SymbolContent, W as HeaderFooter, Wt as TableCell, X as ImagePadding, Xt as TextBox, Y as ImageCrop, Yt as TableStructuralChangeInfo, Z as ImagePosition, Zt as TextContent, _ as ThemeColorScheme, _n as ParagraphFormatting, _t as Paragraph, a as DocxPackage, an as LevelSuffix, at as MAX_REVISION_ID, b as BlockContent, bn as TabStop, bt as ParagraphPropertyChange, c as FontTable, cn as NumberFormat, ct as MoveFromRangeEnd, d as RelationshipMap, dn as CellMargins, dt as MoveToRangeEnd, en as TrackedRunChange, et as ImageWrap, f as RelationshipType, fn as ConditionalFormatStyle, ft as MoveToRangeStart, g as Theme, gn as ParagraphAlignment, gt as PageOrientation, h as StyleType, hn as LineSpacingRule, ht as NoteReferenceContent, i as DocxConformanceClass, in as AbstractNumbering, it as LineNumberRestart, j as Deletion, jn as TextFormatting, jt as SectionPropertyChange, k as CommentReference, kn as TableWidthType, kt as Section, l as MediaFile, ln as NumberingDefinitions, lt as MoveFromRangeStart, m as StyleDefinitions, mn as FloatingTableProperties, mt as NoteNumberRestart, n as Document, nn as Watermark, nt as Insertion, o as DocDefaults, on as ListLevel, ot as MathEquation, p as Style, pn as EmphasisMark, pt as NoBreakHyphenContent, q as Hyperlink, qt as TableRow, r as DocumentSettings, rn as normalizeRevisionId, rt as InstrTextContent, s as FontInfo, sn as ListRendering, st as MoveFrom, t as DOCX_CONFORMANCE_CLASSES, tn as VerticalAlign, tt as InlineSdt, u as Relationship, un as NumberingInstance, ut as MoveTo, v as ThemeFont, vn as SpacingExplicit, vt as ParagraphContent, w as BreakContent, wn as TableCellFormatting, wt as Run, x as BlockSdt, xn as TabStopAlignment, xt as PictureWatermark, y as ThemeFontScheme, yn as TabLeader, yt as ParagraphMarkChange, z as FieldType, zt as SimpleField } from "../document-DI8X7aZy.js";
export { type AbstractNumbering, type BlockContent, type BlockSdt, type BookmarkEnd, type BookmarkStart, type BorderSpec, type BreakContent, type CellMargins, type ColorValue, type Column, type Comment, type CommentRangeEnd, type CommentRangeStart, type CommentReference, type ComplexField, type ConditionalFormatStyle, DOCX_CONFORMANCE_CLASSES, type Deletion, type DocDefaults, Document, type DocumentBody, DocumentSettings, DocxConformanceClass, DocxPackage, type DrawingContent, type EmphasisMark, type Endnote, type EndnotePosition, type EndnoteProperties, type Field, type FieldCharContent, type FieldType, type FloatingTableProperties, type FontInfo, type FontTable, type FooterReference, type Footnote, type FootnotePosition, type FootnoteProperties, type HeaderFooter, type HeaderFooterType, type HeaderReference, type Hyperlink, type Image, type ImageCrop, type ImagePadding, type ImagePosition, type ImageSize, type ImageTransform, type ImageWrap, type InlineSdt, type Insertion, type InstrTextContent, type KnownBorderStyle, type LevelSuffix, type LineNumberRestart, type LineSpacingRule, type ListLevel, type ListRendering, MAX_REVISION_ID, type MathEquation, type MediaFile, type MoveFrom, type MoveFromRangeEnd, type MoveFromRangeStart, type MoveTo, type MoveToRangeEnd, type MoveToRangeStart, type NoBreakHyphenContent, type NoteNumberRestart, type NoteReferenceContent, type NumberFormat, type NumberingDefinitions, type NumberingInstance, type PageOrientation, type Paragraph, type ParagraphAlignment, type ParagraphContent, type ParagraphFormatting, type ParagraphMarkChange, type ParagraphPropertyChange, type PictureWatermark, type PositionalTab, type PropertyChangeInfo, type Relationship, type RelationshipMap, type RelationshipType, type Run, type RunContent, type RunPropertyChange, type SdtProperties, type SdtType, type Section, type SectionProperties, type SectionPropertyChange, type SectionStart, type ShadingProperties, type Shape, type ShapeContent, type ShapeFill, type ShapeOutline, type ShapeTextBody, type ShapeType, type SimpleField, type SoftHyphenContent, type SpacingExplicit, type Style, type StyleDefinitions, type StyleType, type SymbolContent, type TabContent, type TabLeader, type TabStop, type TabStopAlignment, type Table, type TableBorders, type TableCell, type TableCellBorders, type TableCellFormatting, type TableCellPropertyChange, type TableFormatting, type TableLook, type TableMeasurement, type TablePropertyChange, type TableRow, type TableRowFormatting, type TableRowPropertyChange, type TableStructuralChangeInfo, type TableWidthType, type TextBox, type TextContent, type TextEffect, type TextFormatting, type TextWatermark, type Theme, type ThemeColorScheme, type ThemeColorSlot, type ThemeFont, type ThemeFontScheme, type TrackedChangeInfo, type TrackedRunChange, type UnderlineStyle, type VerticalAlign, type Watermark, normalizeRevisionId };
import { $ as ImageTransform, $t as TrackedChangeInfo, A as ComplexField, An as TableWidthType, At as SectionProperties, B as FooterReference, Bt as SoftHyphenContent, C as BookmarkStart, Cn as TableBorders, Ct as PropertyChangeInfo, D as CommentRangeEnd, Dn as TableLook, Dt as SdtProperties, E as Comment, En as TableFormatting, Et as RunPropertyChange, F as EndnotePosition, Fn as ColorValue, Ft as ShapeFill, G as HeaderFooterType, Gt as TableCellPropertyChange, H as FootnotePosition, Ht as TabContent, I as EndnoteProperties, In as KnownBorderStyle, It as ShapeOutline, J as Image, Jt as TableRowPropertyChange, K as HeaderReference, Kt as TablePropertyChange, L as Field, Ln as ShadingProperties, Lt as ShapeTextBody, M as DocumentBody, Mn as TextFormatting, Mt as SectionStart, N as DrawingContent, Nn as UnderlineStyle, Nt as Shape, O as CommentRangeStart, On as TableMeasurement, Ot as SdtType, P as Endnote, Pn as BorderSpec, Pt as ShapeContent, Q as ImageSize, Qt as TextWatermark, R as FieldCharContent, Rn as ThemeColorSlot, Rt as ShapeType, S as BookmarkEnd, Sn as TabStopAlignment, St as PositionalTab, T as Column, Tn as TableCellFormatting, Tt as RunContent, U as FootnoteProperties, Ut as Table, V as Footnote, Vt as SymbolContent, W as HeaderFooter, Wt as TableCell, X as ImagePadding, Xt as TextBox, Y as ImageCrop, Yt as TableStructuralChangeInfo, Z as ImagePosition, Zt as TextContent, _ as ThemeColorScheme, _n as ParagraphAlignment, _t as Paragraph, a as DocxPackage, an as AbstractNumbering, at as MAX_REVISION_ID, b as BlockContent, bn as TabLeader, bt as ParagraphPropertyChange, c as FontTable, cn as ListRendering, ct as MoveFromRangeEnd, d as RelationshipMap, dn as NumberingInstance, dt as MoveToRangeEnd, en as TrackedRunChange, et as ImageWrap, f as RelationshipType, fn as CellMargins, ft as MoveToRangeStart, g as Theme, gn as LineSpacingRule, gt as PageOrientation, h as StyleType, hn as FloatingTableProperties, ht as NoteReferenceContent, i as DocxConformanceClass, in as normalizeRevisionId, it as LineNumberRestart, j as Deletion, jn as TextEffect, jt as SectionPropertyChange, k as CommentReference, kn as TableRowFormatting, kt as Section, l as MediaFile, ln as NumberFormat, lt as MoveFromRangeStart, m as StyleDefinitions, mn as EmphasisMark, mt as NoteNumberRestart, n as Document, nn as Watermark, nt as Insertion, o as DocDefaults, on as LevelSuffix, ot as MathEquation, p as Style, pn as ConditionalFormatStyle, pt as NoBreakHyphenContent, q as Hyperlink, qt as TableRow, r as DocumentSettings, rn as isOoxmlSymbolCharacter, rt as InstrTextContent, s as FontInfo, sn as ListLevel, st as MoveFrom, t as DOCX_CONFORMANCE_CLASSES, tn as VerticalAlign, tt as InlineSdt, u as Relationship, un as NumberingDefinitions, ut as MoveTo, v as ThemeFont, vn as ParagraphFormatting, vt as ParagraphContent, w as BreakContent, wn as TableCellBorders, wt as Run, x as BlockSdt, xn as TabStop, xt as PictureWatermark, y as ThemeFontScheme, yn as SpacingExplicit, yt as ParagraphMarkChange, z as FieldType, zt as SimpleField } from "../document-CMZ4oy9i.js";
export { type AbstractNumbering, type BlockContent, type BlockSdt, type BookmarkEnd, type BookmarkStart, type BorderSpec, type BreakContent, type CellMargins, type ColorValue, type Column, type Comment, type CommentRangeEnd, type CommentRangeStart, type CommentReference, type ComplexField, type ConditionalFormatStyle, DOCX_CONFORMANCE_CLASSES, type Deletion, type DocDefaults, Document, type DocumentBody, DocumentSettings, DocxConformanceClass, DocxPackage, type DrawingContent, type EmphasisMark, type Endnote, type EndnotePosition, type EndnoteProperties, type Field, type FieldCharContent, type FieldType, type FloatingTableProperties, type FontInfo, type FontTable, type FooterReference, type Footnote, type FootnotePosition, type FootnoteProperties, type HeaderFooter, type HeaderFooterType, type HeaderReference, type Hyperlink, type Image, type ImageCrop, type ImagePadding, type ImagePosition, type ImageSize, type ImageTransform, type ImageWrap, type InlineSdt, type Insertion, type InstrTextContent, type KnownBorderStyle, type LevelSuffix, type LineNumberRestart, type LineSpacingRule, type ListLevel, type ListRendering, MAX_REVISION_ID, type MathEquation, type MediaFile, type MoveFrom, type MoveFromRangeEnd, type MoveFromRangeStart, type MoveTo, type MoveToRangeEnd, type MoveToRangeStart, type NoBreakHyphenContent, type NoteNumberRestart, type NoteReferenceContent, type NumberFormat, type NumberingDefinitions, type NumberingInstance, type PageOrientation, type Paragraph, type ParagraphAlignment, type ParagraphContent, type ParagraphFormatting, type ParagraphMarkChange, type ParagraphPropertyChange, type PictureWatermark, type PositionalTab, type PropertyChangeInfo, type Relationship, type RelationshipMap, type RelationshipType, type Run, type RunContent, type RunPropertyChange, type SdtProperties, type SdtType, type Section, type SectionProperties, type SectionPropertyChange, type SectionStart, type ShadingProperties, type Shape, type ShapeContent, type ShapeFill, type ShapeOutline, type ShapeTextBody, type ShapeType, type SimpleField, type SoftHyphenContent, type SpacingExplicit, type Style, type StyleDefinitions, type StyleType, type SymbolContent, type TabContent, type TabLeader, type TabStop, type TabStopAlignment, type Table, type TableBorders, type TableCell, type TableCellBorders, type TableCellFormatting, type TableCellPropertyChange, type TableFormatting, type TableLook, type TableMeasurement, type TablePropertyChange, type TableRow, type TableRowFormatting, type TableRowPropertyChange, type TableStructuralChangeInfo, type TableWidthType, type TextBox, type TextContent, type TextEffect, type TextFormatting, type TextWatermark, type Theme, type ThemeColorScheme, type ThemeColorSlot, type ThemeFont, type ThemeFontScheme, type TrackedChangeInfo, type TrackedRunChange, type UnderlineStyle, type VerticalAlign, type Watermark, isOoxmlSymbolCharacter, normalizeRevisionId };

@@ -1,2 +0,2 @@

import { n as MAX_REVISION_ID, r as normalizeRevisionId, t as DOCX_CONFORMANCE_CLASSES } from "../document-D4XHQQIj.js";
export { DOCX_CONFORMANCE_CLASSES, MAX_REVISION_ID, normalizeRevisionId };
import { i as normalizeRevisionId, n as MAX_REVISION_ID, r as isOoxmlSymbolCharacter, t as DOCX_CONFORMANCE_CLASSES } from "../document-BO7h-LxY.js";
export { DOCX_CONFORMANCE_CLASSES, MAX_REVISION_ID, isOoxmlSymbolCharacter, normalizeRevisionId };

@@ -18,2 +18,18 @@ //#region src/generated/docx_kernel.d.ts

type DocxProjectionWire = readonly [schemaVersion: 2, paragraphs: readonly DocxProjectionParagraph[], structuralFacts: DocxProjectionStructuralFacts, revisionStatus: DocxProjectionRevisionStatus];
type DocxReviewUnknownReason = "invalid-document" | "invalid-comments" | "invalid-comments-extended" | "resource-limit" | "unsupported-location";
type DocxReviewFactSet<T> = readonly [status: "known", items: readonly T[]] | readonly [status: "unknown", reason: DocxReviewUnknownReason];
type DocxReviewDetail<T> = readonly [status: "known", value: T] | readonly [status: "unknown", reason: DocxReviewUnknownReason];
type DocxReviewPoint = readonly [paragraphOrdinal: number, utf8: number, utf16: number];
type DocxReviewSpan = readonly [start: DocxReviewPoint, end: DocxReviewPoint];
/** Compact versioned boundary tuple. Field order is stable within schema version 1. */
type DocxRevisionContent = readonly [span: DocxReviewSpan, text: string, contentKind: "text" | "formatting-only"];
type DocxCommentContent = readonly [anchor: DocxReviewSpan, commentText: string, referencedText: string];
/** Attributed revision wire tuple; positions are named and versioned by its container. */
type DocxAttributedRevision = readonly [type: "insertion" | "deletion" | "moveFrom" | "moveTo" | "cellIns" | "cellDel" | "cellMerge" | "pPrChange" | "rPrChange" | "sectPrChange" | "tblPrChange" | "trPrChange" | "tcPrChange" | "tblGridChange" | "customXmlDelRangeStart" | "customXmlDelRangeEnd" | "customXmlInsRangeStart" | "customXmlInsRangeEnd" | "customXmlMoveFromRangeStart" | "customXmlMoveFromRangeEnd" | "customXmlMoveToRangeStart" | "customXmlMoveToRangeEnd", author: string, date: string | null, revisionId: string | null, content: DocxReviewDetail<DocxRevisionContent>];
/** Attributed comment wire tuple; positions are named and versioned by its container. */
type DocxAttributedComment = readonly [commentId: string, author: string, initials: string | null, date: string | null, parentCommentId: string | null, threadState: "open" | "resolved", content: DocxReviewDetail<DocxCommentContent>];
/** Review-fact wire schema. A new tuple layout requires a schema-version bump. */
type DocxReviewFactsWire = readonly [schemaVersion: 1, revisions: DocxReviewFactSet<DocxAttributedRevision>, comments: DocxReviewFactSet<DocxAttributedComment>];
/** Fused package wire schema. A new tuple layout requires a schema-version bump. */
type DocxPackageProjectionWire = readonly [schemaVersion: 1, document: DocxProjectionWire, reviewFacts: DocxReviewFactsWire];
//#endregion

@@ -41,9 +57,10 @@ //#region src/projection.d.ts

declare const initializeDocxProjection: ({ wasm }?: InitializeDocxProjectionOptions) => Promise<void>;
declare const projectCompressedDocx: (bytes: Uint8Array) => Promise<DocxProjectionWire>;
/**
* Projects compressed DOCX bytes through the canonical Rust implementation.
* The TypeScript boundary initializes WebAssembly and preserves its versioned
* result; it does not contain an alternate OOXML parser.
* Projects the document snapshot and attributed review facts through one
* bounded package scan. Optional review-part failures remain explicit unknown
* fact families rather than invalidating the document snapshot.
*/
declare const projectCompressedDocx: (bytes: Uint8Array) => Promise<DocxProjectionWire>;
declare const projectCompressedDocxWithReviewFacts: (bytes: Uint8Array) => Promise<DocxPackageProjectionWire>;
//#endregion
export { type DocxProjectionBookmarkFact, DocxProjectionError, type DocxProjectionFactSet, type DocxProjectionFormattingSpan, type DocxProjectionIndentationFact, DocxProjectionInitializationError, type DocxProjectionNumberingFact, type DocxProjectionParagraph, type DocxProjectionReferenceFact, type DocxProjectionRevisionStatus, type DocxProjectionRevisionUnsupportedReason, type DocxProjectionStructuralFacts, type DocxProjectionStructuralSpan, type DocxProjectionStructure, type DocxProjectionUnknownReason, DocxProjectionWasmSource, type DocxProjectionWire, InitializeDocxProjectionOptions, initializeDocxProjection, projectCompressedDocx };
export { type DocxAttributedComment, type DocxAttributedRevision, type DocxCommentContent, type DocxPackageProjectionWire, type DocxProjectionBookmarkFact, DocxProjectionError, type DocxProjectionFactSet, type DocxProjectionFormattingSpan, type DocxProjectionIndentationFact, DocxProjectionInitializationError, type DocxProjectionNumberingFact, type DocxProjectionParagraph, type DocxProjectionReferenceFact, type DocxProjectionRevisionStatus, type DocxProjectionRevisionUnsupportedReason, type DocxProjectionStructuralFacts, type DocxProjectionStructuralSpan, type DocxProjectionStructure, type DocxProjectionUnknownReason, DocxProjectionWasmSource, type DocxProjectionWire, type DocxReviewDetail, type DocxReviewFactSet, type DocxReviewFactsWire, type DocxReviewPoint, type DocxReviewSpan, type DocxReviewUnknownReason, type DocxRevisionContent, InitializeDocxProjectionOptions, initializeDocxProjection, projectCompressedDocx, projectCompressedDocxWithReviewFacts };

@@ -33,2 +33,27 @@ import { TaggedError } from "better-result";

}
/**
* Projects the document snapshot and attributed review facts from one bounded
* package-directory scan.
*
* # Errors
*
* Returns a JavaScript `Error` when the document package itself cannot be
* projected. Invalid optional review parts are represented as unknown facts.
* @param {Uint8Array} bytes
* @returns {DocxPackageProjectionWire}
*/
function projectCompressedDocxWithReviewFacts$1(bytes) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
const len0 = WASM_VECTOR_LEN;
wasm.projectCompressedDocxWithReviewFacts(retptr, ptr0, len0);
var r0 = getDataViewMemory0().getInt32(retptr + 0, true);
var r1 = getDataViewMemory0().getInt32(retptr + 4, true);
if (getDataViewMemory0().getInt32(retptr + 8, true)) throw takeObject(r1);
return takeObject(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
function __wbg_get_imports() {

@@ -180,2 +205,4 @@ return {

let initialization;
const DOCUMENT_PROJECTION_FAILURE_MESSAGE = "Could not project the DOCX document";
const PACKAGE_PROJECTION_FAILURE_MESSAGE = "Could not project the DOCX package with review facts";
/** Loads and caches the single-threaded WebAssembly runtime. */

@@ -197,9 +224,9 @@ const initializeDocxProjection = ({ wasm } = {}) => {

*/
const projectCompressedDocx = async (bytes) => {
const projectWith = async ({ bytes, project, message }) => {
await initializeDocxProjection();
try {
return projectCompressedDocx$1(bytes);
return project(bytes);
} catch (cause) {
throw new DocxProjectionError({
message: "Could not project the DOCX package",
message,
cause

@@ -209,3 +236,18 @@ });

};
const projectCompressedDocx = (bytes) => projectWith({
bytes,
project: projectCompressedDocx$1,
message: DOCUMENT_PROJECTION_FAILURE_MESSAGE
});
/**
* Projects the document snapshot and attributed review facts through one
* bounded package scan. Optional review-part failures remain explicit unknown
* fact families rather than invalidating the document snapshot.
*/
const projectCompressedDocxWithReviewFacts = (bytes) => projectWith({
bytes,
project: projectCompressedDocxWithReviewFacts$1,
message: PACKAGE_PROJECTION_FAILURE_MESSAGE
});
//#endregion
export { DocxProjectionError, DocxProjectionInitializationError, initializeDocxProjection, projectCompressedDocx };
export { DocxProjectionError, DocxProjectionInitializationError, initializeDocxProjection, projectCompressedDocx, projectCompressedDocxWithReviewFacts };
{
"name": "@stll/docx-core",
"version": "0.7.0",
"version": "0.8.0",
"description": "Typed OOXML/DOCX model, validation, serialization, legal-source compilation, and browser-native package projection.",

@@ -5,0 +5,0 @@ "keywords": [

//#region src/model/content.ts
/**
* Largest value a revision id (`w:id`) may carry: 2^31 - 1.
*
* `w:id` on `<w:ins>`/`<w:del>` comes from `CT_Markup`, typed
* `ST_DecimalNumber` — which ECMA-376 defines as an unbounded integer. The
* bound below is an implementation limit: conforming consumers read
* `ST_DecimalNumber` into a signed 32-bit int, and a value past this bound
* overflows on load and surfaces as an unreadable document. Port of
* eigenpal/docx-editor#1093.
*/
const MAX_REVISION_ID = 2147483647;
/**
* Coerce any revision id — including one parsed from an untrusted DOCX — into
* the range serialized `w:id` attributes may occupy.
*
* - Malformed (negative, fractional, `NaN`, `Infinity`): collapse to `0`.
* - Well-formed but out of range: fold modulo the range (not clamp) so a
* contiguous run of overflowing ids stays distinguishable.
*/
function normalizeRevisionId(id) {
if (!Number.isInteger(id) || id < 0) return 0;
if (id > 2147483647) return id % 2147483648;
return id;
}
//#endregion
//#region src/model/document.ts
/** DOCX package conformance classes. */
const DOCX_CONFORMANCE_CLASSES = Object.freeze({
STRICT: "strict",
TRANSITIONAL: "transitional",
UNKNOWN: "unknown"
});
//#endregion
export { MAX_REVISION_ID as n, normalizeRevisionId as r, DOCX_CONFORMANCE_CLASSES as t };

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display