@embedpdf/engine-services 3.0.0-next.15 → 3.0.0-next.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1818 -518
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +233 -39
- package/dist/index.d.ts +233 -39
- package/dist/index.js +1818 -520
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionReadBudget, AnalyzeInput, Annotation, AnnotationActor, AnnotationAppearanceRenderOptions, AnnotationAppearancesResult, AnnotationAuthority, AnnotationCreateResult, AnnotationDeleteResult, AnnotationDraft, AnnotationExportSelection, AnnotationFamily, AnnotationFlattenResult, AnnotationImportResult, AnnotationList, AnnotationListMutationMeta, AnnotationPatch, AnnotationRef, AnnotationReplyType, AnnotationUpdateResult, Attachment, AttachmentCreateResult, AttachmentDeleteResult, AttachmentFileInfo, AttachmentFileWorkerPayload, AttachmentRef, BaseVersionInfo, BundleImportPages, BundleLimits, ChangeAnalysis, ChangeAuthority, ChangeItem, ChangeItemType, ChangeRecordPayload, ChangeResult, CustomMetadata, CustomMetadataPatch, CustomMetadataUpdateResult, DateInput, DigestAlgorithm, DocumentActionsSnapshot, DocumentMetadata, DocumentProtection, DocumentSecurityProbeInfo, DocumentVersionRef, EngineError, FieldPosition, FontIdentityInfo, FormExportSelection, FormFieldDTO, FormFieldDisplay, FormFieldDraft, FormFieldPatch, FormFieldRef, FormFieldValue, FormImportResult, FormRepairResult, FormResetResult, FormSetValueResult, FormSnapshot, FormValuesImportDrop, FormWidget, IsoDateTime, MetadataPatch, MetadataUpdateResult, ObjectNumberRange, PageDeleteResult, PageFlattenResult, PageFlattenUsage, PageGeometryRun, PageGeometrySnapshot, PageInsertBlankSpec, PageInsertResult, PageListSnapshot, PageNameInput, PageNameResult, PageNetworkRenderFormat, PageObjectNumber, PagePosition, PageRaster, PageRef, PageRemoveNameInput, PageRenderOptions, PageReorderResult, PageRotateResult, PageTextSnapshot, PdfActionTree, PdfCoordinates, PdfDestination, PdfQuad, PdfRect, PdfRevision, PdfRotation, PdfSaveMode, RecordedOp, RedactionApplyResult, RedactionApplyScope, RevisionStructure, SearchScanRequest, SearchSlice, SerializedEngineError, SignatureCancelResult, SignatureCompleteInput, SignatureCompleteResult, SignatureDTO, SignaturePrepareInput, SignaturePrepared, SignatureSnapshot, SignedDocumentPolicy, VisibleBoxOf, WidgetAnnotation, WidgetPlacement, WireAnnotationBundle, WireAnnotationResources,
|
|
1
|
+
import { ActionReadBudget, AnalyzeInput, Annotation, AnnotationActor, AnnotationAppearanceRenderOptions, AnnotationAppearancesResult, AnnotationAuthority, AnnotationCreateResult, AnnotationDeleteResult, AnnotationDraft, AnnotationExportSelection, AnnotationFamily, AnnotationFlattenResult, AnnotationImportResult, AnnotationList, AnnotationListMutationMeta, AnnotationPatch, AnnotationRef, AnnotationReplyType, AnnotationUpdateResult, Attachment, AttachmentCreateResult, AttachmentDeleteResult, AttachmentFileBase, AttachmentFileInfo, AttachmentFileWorkerPayload, AttachmentMutationMeta, AttachmentRef, BaseVersionInfo, BundleImportPages, BundleLimits, ChangeAnalysis, ChangeAuthority, ChangeItem, ChangeItemType, ChangeRecordPayload, ChangeResult, Coordinates, CustomMetadata, CustomMetadataPatch, CustomMetadataUpdateResult, DateInput, DigestAlgorithm, DocumentActionsSnapshot, DocumentMetadata, DocumentProtection, DocumentSecurityProbeInfo, DocumentVersionRef, EngineError, FieldPosition, FontIdentityInfo, FormExportSelection, FormFieldDTO, FormFieldDisplay, FormFieldDraft, FormFieldPatch, FormFieldRef, FormFieldValue, FormImportResult, FormRepairResult, FormResetResult, FormSetValueResult, FormSnapshot, FormValuesImportDrop, FormWidget, IsoDateTime, MetadataPatch, MetadataUpdateResult, ObjectNumberRange, OutlineItemPatch, OutlineItemRef, PageCoordinates, PageDeleteResult, PageExtractFlatten, PageFlattenResult, PageFlattenUsage, PageGeometryRun, PageGeometrySnapshot, PageInsertBlankSpec, PageInsertResult, PageListSnapshot, PageNameInput, PageNameResult, PageNetworkRenderFormat, PageObjectNumber, PagePosition, PageRaster, PageRef, PageRemoveNameInput, PageRenderOptions, PageReorderResult, PageRotateResult, PageTextSnapshot, PdfActionTree, PdfCoordinates, PdfDestination, PdfQuad, PdfRect, PdfRevision, PdfRotation, PdfSaveMode, RecordedOp, RedactionApplyResult, RedactionApplyScope, RevisionStructure, SearchScanRequest, SearchSlice, SerializedEngineError, SignatureCancelResult, SignatureCompleteInput, SignatureCompleteResult, SignatureDTO, SignaturePrepareInput, SignaturePrepared, SignatureSnapshot, SignedDocumentPolicy, VisibleBoxOf, WidgetAnnotation, WidgetPlacement, WireAnnotationBundle, WireAnnotationResources, WireFormBundle, WirePack, WireResource, WorkerRequest, WorkerResponse, WorkingSetPage, generateUuid } from "@embedpdf/engine-core/runtime";
|
|
2
2
|
import { PdfFunctions, PdfRuntimeMemory, PdfRuntimeModule, Ptr } from "@embedpdf/engine-runtime";
|
|
3
3
|
import { PlannedValueWrite } from "@embedpdf/engine-core/validation";
|
|
4
4
|
//#region src/runtime/lifecycle/bootstrap.d.ts
|
|
@@ -621,7 +621,7 @@ declare class DocumentSession {
|
|
|
621
621
|
* Nothing else creates objects at held numbers, so a held number is free
|
|
622
622
|
* otherwise; the fork checks that again as it creates.
|
|
623
623
|
*/
|
|
624
|
-
|
|
624
|
+
claimObjectNumber(objectNumber: number): void;
|
|
625
625
|
/**
|
|
626
626
|
* Throws once a transaction neither committed nor aborted, so nothing reads
|
|
627
627
|
* or writes a document in an unknown state.
|
|
@@ -745,6 +745,8 @@ declare class PagesReader {
|
|
|
745
745
|
* has none.
|
|
746
746
|
*/
|
|
747
747
|
declare function visibleBoxReader(runtime: PdfRuntimeModule, session: DocumentSession): VisibleBoxOf;
|
|
748
|
+
/** The turn of the page at `index` as it reads: its own `/Rotate`, or the one it inherits. */
|
|
749
|
+
declare function rotationAt(runtime: PdfRuntimeModule, docPtr: Ptr, index: number): PdfRotation;
|
|
748
750
|
//#endregion
|
|
749
751
|
//#region src/features/pages/PagesMutator.d.ts
|
|
750
752
|
/**
|
|
@@ -836,10 +838,12 @@ declare class PagesMutator {
|
|
|
836
838
|
//#region src/features/pages/PagesExtractor.d.ts
|
|
837
839
|
/**
|
|
838
840
|
* Export a subset of pages as a standalone PDF. A read over the session:
|
|
839
|
-
*
|
|
840
|
-
*
|
|
841
|
-
*
|
|
842
|
-
*
|
|
841
|
+
* the pages are copied into a scratch document, so the source is untouched —
|
|
842
|
+
* no registry refresh, no layer artifact. A plain copy is
|
|
843
|
+
* `FPDF_ImportPagesByIndex`; a flattened one `EPDFDoc_ExportPagesFlattened`,
|
|
844
|
+
* which copies the pages as they draw. Either keeps the document's title.
|
|
845
|
+
* Lives next to `PagesReader`/`PagesMutator` (one file per page verb family)
|
|
846
|
+
* so both worker hosts share the code path.
|
|
843
847
|
*/
|
|
844
848
|
declare class PagesExtractor {
|
|
845
849
|
private readonly runtime;
|
|
@@ -847,14 +851,24 @@ declare class PagesExtractor {
|
|
|
847
851
|
constructor(runtime: PdfRuntimeModule, session: DocumentSession);
|
|
848
852
|
/**
|
|
849
853
|
* Copy the given pages, in the supplied caller order, into a new
|
|
850
|
-
* document and serialize it
|
|
851
|
-
*
|
|
852
|
-
*
|
|
854
|
+
* document and serialize it: as they are, or, with `flatten`, as they draw
|
|
855
|
+
* (checked against the caller's rights before it gets here). Validation up
|
|
856
|
+
* front: non-empty, no duplicates, every page object number resolvable
|
|
857
|
+
* (`NotFound` from the session on a bad one). The scratch document is
|
|
858
|
+
* always closed, success or throw.
|
|
853
859
|
*/
|
|
854
|
-
extract(pages: PageRef[], signal: AbortSignal): {
|
|
860
|
+
extract(pages: PageRef[], flatten: PageExtractFlatten | undefined, signal: AbortSignal): {
|
|
855
861
|
bytes: ArrayBuffer;
|
|
856
862
|
size: number;
|
|
857
863
|
};
|
|
864
|
+
/** A new document with copies of the pages at `indices`, as they are. */
|
|
865
|
+
private copyPlain;
|
|
866
|
+
/**
|
|
867
|
+
* A new document with the pages at `indices` as they draw for
|
|
868
|
+
* `flatten.usage`: what `flatten` includes painted in, nothing interactive
|
|
869
|
+
* left, layers in their state for the usage.
|
|
870
|
+
*/
|
|
871
|
+
private copyFlattened;
|
|
858
872
|
}
|
|
859
873
|
//#endregion
|
|
860
874
|
//#region src/features/pages/PagesInserter.d.ts
|
|
@@ -1592,7 +1606,7 @@ interface ChangeRecord {
|
|
|
1592
1606
|
readonly userId: string | null;
|
|
1593
1607
|
readonly steps: readonly ReverseStep[];
|
|
1594
1608
|
}
|
|
1595
|
-
type ReverseStep = ObjectsRevertStep | AnnotationRemoveStep | AnnotationRestoreStep | AnnotationReorderStep | FieldRemoveStep | FieldRestoreStep | WidgetRestoreStep | WidgetDeleteStep | CalculationOrderStep | MetadataRevertStep;
|
|
1609
|
+
type ReverseStep = ObjectsRevertStep | AnnotationRemoveStep | AnnotationRestoreStep | AnnotationReorderStep | FieldRemoveStep | FieldRestoreStep | WidgetRestoreStep | WidgetDeleteStep | CalculationOrderStep | MetadataRevertStep | OutlineRemoveStep | OutlineRestoreStep | OutlineMoveStep | OutlineReopenStep | PageRotateStep | PageReorderStep | PageRestoreStep | PageRemoveStep | AttachmentRemoveStep | AttachmentRestoreStep;
|
|
1596
1610
|
/**
|
|
1597
1611
|
* One dictionary a change wrote, as it was before (the capture, with the
|
|
1598
1612
|
* objects under `deep` the layer held) and as the change left it (a shallow
|
|
@@ -1616,11 +1630,13 @@ interface ObjectsRevertStep {
|
|
|
1616
1630
|
/** What its item reports doing: the op it puts back, or its opposite (a widget's add undoes its removal). */
|
|
1617
1631
|
readonly reports: ChangeItemType;
|
|
1618
1632
|
readonly objects: readonly CapturedObject[];
|
|
1619
|
-
/** What the item reads back: the annotation, or the
|
|
1633
|
+
/** What the item reads back: the annotation, the form fields, or the outline item. */
|
|
1620
1634
|
readonly subject: {
|
|
1621
1635
|
readonly annotation: AnnotationRef;
|
|
1622
1636
|
} | {
|
|
1623
1637
|
readonly fields: readonly number[];
|
|
1638
|
+
} | {
|
|
1639
|
+
readonly outlineItem: OutlineItemRef;
|
|
1624
1640
|
};
|
|
1625
1641
|
/** Whether the op changed what the annotation shows (its update's `appearance.changed`). */
|
|
1626
1642
|
readonly appearanceChanged?: boolean;
|
|
@@ -1642,6 +1658,12 @@ type RevertFallback = {
|
|
|
1642
1658
|
readonly restore: FormFieldPatch;
|
|
1643
1659
|
/** The values it left in them: a property still holding its value is put back. */
|
|
1644
1660
|
readonly left: FormFieldPatch;
|
|
1661
|
+
} | {
|
|
1662
|
+
readonly kind: 'outline';
|
|
1663
|
+
/** The old values of the fields an outline item update changed, as a patch. */
|
|
1664
|
+
readonly restore: OutlineItemPatch<PdfDestination>;
|
|
1665
|
+
/** The values it left in them: a field still holding its value is put back. */
|
|
1666
|
+
readonly left: OutlineItemPatch<PdfDestination>;
|
|
1645
1667
|
} | {
|
|
1646
1668
|
readonly kind: 'value';
|
|
1647
1669
|
/** Each field the op wrote: its value before, and the value the op left. */
|
|
@@ -1768,14 +1790,174 @@ interface MetadataRevertStep {
|
|
|
1768
1790
|
readonly restore: MetadataPatch | CustomMetadataPatch;
|
|
1769
1791
|
readonly left: MetadataPatch | CustomMetadataPatch;
|
|
1770
1792
|
}
|
|
1793
|
+
/**
|
|
1794
|
+
* Deletes outline items a create or a restore brought back, when nobody
|
|
1795
|
+
* changed them since: the item and the items under it are the same ones, and
|
|
1796
|
+
* their dictionaries read exactly as the change left them. Undoing a create
|
|
1797
|
+
* never deletes an item someone gave a child, or renamed, since; a page its
|
|
1798
|
+
* target goes to going away changes nothing of it.
|
|
1799
|
+
*/
|
|
1800
|
+
interface OutlineRemoveStep {
|
|
1801
|
+
readonly kind: 'outline.remove';
|
|
1802
|
+
readonly ref: OutlineItemRef;
|
|
1803
|
+
/** The item and the items under it, depth first, each as the change left it (the guard). */
|
|
1804
|
+
readonly left: readonly CapturedObject[];
|
|
1805
|
+
}
|
|
1806
|
+
/**
|
|
1807
|
+
* Opens again a parent that the op this step follows emptied, as it was open
|
|
1808
|
+
* before: a parent without children has no open state, so it comes back
|
|
1809
|
+
* closed with its first child. Only while its children are just the ones the
|
|
1810
|
+
* undo put back: a parent someone filled since keeps what they left.
|
|
1811
|
+
*/
|
|
1812
|
+
interface OutlineReopenStep {
|
|
1813
|
+
readonly kind: 'outline.reopen';
|
|
1814
|
+
readonly ref: OutlineItemRef;
|
|
1815
|
+
/** The children it has once the undo put them back. */
|
|
1816
|
+
readonly children: readonly number[];
|
|
1817
|
+
}
|
|
1818
|
+
/**
|
|
1819
|
+
* Brings back what an outline delete removed: the same items, at the same
|
|
1820
|
+
* numbers, at the place the item had (`EPDFOutline_ImportItemRaw`). Left
|
|
1821
|
+
* alone when its parent is gone or it is back already.
|
|
1822
|
+
*/
|
|
1823
|
+
interface OutlineRestoreStep {
|
|
1824
|
+
readonly kind: 'outline.restore';
|
|
1825
|
+
readonly ref: OutlineItemRef;
|
|
1826
|
+
/** Its parent when it went; `null` for the top level. */
|
|
1827
|
+
readonly parent: OutlineItemRef | null;
|
|
1828
|
+
readonly capture: Uint8Array;
|
|
1829
|
+
}
|
|
1830
|
+
/**
|
|
1831
|
+
* Puts outline items back where they were before a move: its reverse, and,
|
|
1832
|
+
* the other way round, its redo. Each item goes only while it is still under
|
|
1833
|
+
* the parent the move left it under, and its parent is still there.
|
|
1834
|
+
*/
|
|
1835
|
+
interface OutlineMoveStep {
|
|
1836
|
+
readonly kind: 'outline.move';
|
|
1837
|
+
/**
|
|
1838
|
+
* Where each goes back to, by object number (parent 0: the top level;
|
|
1839
|
+
* after 0: first), in document order, so an anchor is placed before what
|
|
1840
|
+
* follows it.
|
|
1841
|
+
*/
|
|
1842
|
+
readonly placements: readonly {
|
|
1843
|
+
readonly item: number;
|
|
1844
|
+
readonly parent: number;
|
|
1845
|
+
readonly after: number;
|
|
1846
|
+
}[];
|
|
1847
|
+
/** The parent each was left under (0: the top level). */
|
|
1848
|
+
readonly left: readonly {
|
|
1849
|
+
readonly item: number;
|
|
1850
|
+
readonly parent: number;
|
|
1851
|
+
}[];
|
|
1852
|
+
}
|
|
1853
|
+
/**
|
|
1854
|
+
* Turns pages to `rotation`: its reverse, and, the other way round, its redo.
|
|
1855
|
+
* Each page turns only while it still has the rotation the change left it
|
|
1856
|
+
* with (`left`). A change that turned pages from several rotations has one
|
|
1857
|
+
* step for each.
|
|
1858
|
+
*/
|
|
1859
|
+
interface PageRotateStep {
|
|
1860
|
+
readonly kind: 'pages.rotate';
|
|
1861
|
+
/** The pages, by object number. */
|
|
1862
|
+
readonly pages: readonly number[];
|
|
1863
|
+
readonly rotation: PdfRotation;
|
|
1864
|
+
readonly left: PdfRotation;
|
|
1865
|
+
}
|
|
1866
|
+
/**
|
|
1867
|
+
* Puts pages back where they were before a move: its reverse, and, the other
|
|
1868
|
+
* way round, its redo. Each page goes only while it still follows the page the
|
|
1869
|
+
* move left it after, and the page it goes after is still there.
|
|
1870
|
+
*/
|
|
1871
|
+
interface PageReorderStep {
|
|
1872
|
+
readonly kind: 'pages.reorder';
|
|
1873
|
+
/**
|
|
1874
|
+
* Where each goes back to, by object number (after 0: first), in display
|
|
1875
|
+
* order, so an anchor is placed before what follows it.
|
|
1876
|
+
*/
|
|
1877
|
+
readonly placements: readonly {
|
|
1878
|
+
readonly page: number;
|
|
1879
|
+
readonly after: number;
|
|
1880
|
+
}[];
|
|
1881
|
+
/** The page each was left after (0: first). */
|
|
1882
|
+
readonly left: readonly {
|
|
1883
|
+
readonly page: number;
|
|
1884
|
+
readonly after: number;
|
|
1885
|
+
}[];
|
|
1886
|
+
}
|
|
1887
|
+
/**
|
|
1888
|
+
* Brings back what a page delete removed: the same pages, at the same
|
|
1889
|
+
* numbers, each after the page it followed while that is still there, else
|
|
1890
|
+
* first (`EPDFPage_ImportRaw`), with their annotations and names. A page that
|
|
1891
|
+
* is back already is left alone.
|
|
1892
|
+
*/
|
|
1893
|
+
interface PageRestoreStep {
|
|
1894
|
+
readonly kind: 'pages.restore';
|
|
1895
|
+
/** Each page and its capture, in the display order they had. */
|
|
1896
|
+
readonly pages: readonly {
|
|
1897
|
+
readonly page: number;
|
|
1898
|
+
readonly capture: Uint8Array;
|
|
1899
|
+
}[];
|
|
1900
|
+
}
|
|
1901
|
+
/**
|
|
1902
|
+
* Deletes pages an insert or a restore brought, each while it reads as the
|
|
1903
|
+
* change left it: the page and what the layer holds of its annotations,
|
|
1904
|
+
* contents and resources. Undoing an insert never deletes a page someone
|
|
1905
|
+
* annotated, or turned, since. A step that would delete every page is left
|
|
1906
|
+
* alone: a document keeps one.
|
|
1907
|
+
*/
|
|
1908
|
+
interface PageRemoveStep {
|
|
1909
|
+
readonly kind: 'pages.remove';
|
|
1910
|
+
/** Each page, and the digest of how the change left it. */
|
|
1911
|
+
readonly pages: readonly {
|
|
1912
|
+
readonly page: number;
|
|
1913
|
+
readonly left: string;
|
|
1914
|
+
}[];
|
|
1915
|
+
}
|
|
1916
|
+
/**
|
|
1917
|
+
* Deletes the embedded file a create or a restore brought, while it is still
|
|
1918
|
+
* that file, as the change left it: undoing an upload never deletes a file
|
|
1919
|
+
* someone put under its name since, even one with the same bytes.
|
|
1920
|
+
*/
|
|
1921
|
+
interface AttachmentRemoveStep {
|
|
1922
|
+
readonly kind: 'attachments.remove';
|
|
1923
|
+
readonly ref: AttachmentRef;
|
|
1924
|
+
/** The file as the change left it, in canonical bytes (the guard). */
|
|
1925
|
+
readonly left: Uint8Array;
|
|
1926
|
+
}
|
|
1927
|
+
/**
|
|
1928
|
+
* Brings back the file a delete removed, under its key, with its file
|
|
1929
|
+
* specification and bytes as they were (`EPDFAttachment_ImportRaw`). Left
|
|
1930
|
+
* alone when another file has the key now.
|
|
1931
|
+
*/
|
|
1932
|
+
interface AttachmentRestoreStep {
|
|
1933
|
+
readonly kind: 'attachments.restore';
|
|
1934
|
+
readonly ref: AttachmentRef;
|
|
1935
|
+
readonly capture: Uint8Array;
|
|
1936
|
+
}
|
|
1771
1937
|
//#endregion
|
|
1772
1938
|
//#region src/features/changes/ChangeApplier.d.ts
|
|
1773
1939
|
/** What a change did: one item per op (or per step of an undo), and the record that undoes it. */
|
|
1774
|
-
interface AppliedChange {
|
|
1775
|
-
readonly items: ChangeItem<
|
|
1940
|
+
interface AppliedChange<C extends Coordinates = PdfCoordinates> {
|
|
1941
|
+
readonly items: ChangeItem<C>[];
|
|
1776
1942
|
/** Its steps are empty when nothing was written: there is nothing to undo. */
|
|
1777
1943
|
readonly record: ChangeRecord;
|
|
1778
1944
|
}
|
|
1945
|
+
/**
|
|
1946
|
+
* Where a change's places are measured. Each op's places turn into the
|
|
1947
|
+
* file's coordinates right before it runs, and each item's into the
|
|
1948
|
+
* answer's space right after its op (or an undo's step) ran, against the
|
|
1949
|
+
* document as it is then: an earlier op can add, remove or put back a page a
|
|
1950
|
+
* later one names.
|
|
1951
|
+
*/
|
|
1952
|
+
interface ChangeSpace<In extends Coordinates, Out extends Coordinates> {
|
|
1953
|
+
opInFileSpace(op: RecordedOp<In, WireAnnotationResources>): RecordedOp<PdfCoordinates, WireAnnotationResources>;
|
|
1954
|
+
itemOut(item: ChangeItem<PdfCoordinates>): ChangeItem<Out>;
|
|
1955
|
+
}
|
|
1956
|
+
/**
|
|
1957
|
+
* The file's own coordinates, in and out: for a single verb's one-op change,
|
|
1958
|
+
* whose job converts at the worker's boundary.
|
|
1959
|
+
*/
|
|
1960
|
+
declare const FILE_SPACE: ChangeSpace<PdfCoordinates, PdfCoordinates>;
|
|
1779
1961
|
/**
|
|
1780
1962
|
* Runs changes inside the job's layer transaction, which its caller opens and
|
|
1781
1963
|
* ends, so a failure anywhere leaves the document as it was: a change's ops in
|
|
@@ -1792,17 +1974,23 @@ declare class ChangeApplier {
|
|
|
1792
1974
|
private readonly session;
|
|
1793
1975
|
private readonly fonts?;
|
|
1794
1976
|
constructor(runtime: PdfRuntimeModule, session: DocumentSession, fonts?: FontRegistrar | undefined);
|
|
1795
|
-
apply(ops: readonly RecordedOp<
|
|
1796
|
-
undo(record: ChangeRecord, authority: ChangeAuthority, signal: AbortSignal): AppliedChange
|
|
1977
|
+
apply<In extends Coordinates, Out extends Coordinates>(ops: readonly RecordedOp<In, WireAnnotationResources>[], authority: ChangeAuthority, signal: AbortSignal, space: ChangeSpace<In, Out>): AppliedChange<Out>;
|
|
1978
|
+
undo<Out extends Coordinates>(record: ChangeRecord, authority: ChangeAuthority, signal: AbortSignal, space: Pick<ChangeSpace<Coordinates, Out>, 'itemOut'>): AppliedChange<Out>;
|
|
1797
1979
|
private context;
|
|
1798
1980
|
}
|
|
1799
1981
|
//#endregion
|
|
1800
1982
|
//#region src/features/changes/ChangeLedger.d.ts
|
|
1983
|
+
/**
|
|
1984
|
+
* An applied change's answer, in the space its job answered in: page space
|
|
1985
|
+
* for a change (`doc.apply`), the file's for a single verb's job, whose
|
|
1986
|
+
* boundary converts it.
|
|
1987
|
+
*/
|
|
1988
|
+
type KeptResult = ChangeResult<PdfCoordinates> | ChangeResult<PageCoordinates>;
|
|
1801
1989
|
/** What one change answered, kept under its `opId`. */
|
|
1802
1990
|
type ChangeOutcome = {
|
|
1803
1991
|
readonly kind: 'applied';
|
|
1804
1992
|
readonly fingerprint: string;
|
|
1805
|
-
readonly result:
|
|
1993
|
+
readonly result: KeptResult;
|
|
1806
1994
|
} | {
|
|
1807
1995
|
readonly kind: 'refused';
|
|
1808
1996
|
readonly fingerprint: string;
|
|
@@ -1834,7 +2022,7 @@ declare class ChangeLedger {
|
|
|
1834
2022
|
readonly unavailable: UndoUnavailableReason;
|
|
1835
2023
|
} | undefined;
|
|
1836
2024
|
/** Keeps an applied change's answer, and its record when it can be undone. */
|
|
1837
|
-
keepApplied(opId: string, fingerprint: string, result:
|
|
2025
|
+
keepApplied(opId: string, fingerprint: string, result: KeptResult, record: ChangeRecord | null): void;
|
|
1838
2026
|
/** Keeps a refusal: asking again answers it again. */
|
|
1839
2027
|
keepRefused(opId: string, fingerprint: string, error: SerializedEngineError): void;
|
|
1840
2028
|
/**
|
|
@@ -1894,27 +2082,30 @@ declare class AttachmentReader {
|
|
|
1894
2082
|
//#endregion
|
|
1895
2083
|
//#region src/features/attachments/AttachmentMutator.d.ts
|
|
1896
2084
|
/**
|
|
1897
|
-
* Create/delete
|
|
1898
|
-
*
|
|
1899
|
-
*
|
|
1900
|
-
*
|
|
2085
|
+
* Create/delete writes over the document catalog's `/EmbeddedFiles` name
|
|
2086
|
+
* tree, sharing the write path (`writeAttachmentFilePayload`) with the
|
|
2087
|
+
* file-attachment annotation writer. The change ops run them
|
|
2088
|
+
* (`attachmentChanges.ts`), which decide what an undo needs.
|
|
1901
2089
|
*
|
|
1902
2090
|
* Identity is the name-tree key (unique by construction). Note the
|
|
1903
|
-
* tree is key-sorted: both
|
|
1904
|
-
* never move.
|
|
1905
|
-
* happen in the callers, exactly like every other mutation family.
|
|
2091
|
+
* tree is key-sorted: both writes shift other entries' indices; keys
|
|
2092
|
+
* never move.
|
|
1906
2093
|
*/
|
|
1907
2094
|
declare class AttachmentMutator {
|
|
1908
2095
|
private readonly runtime;
|
|
1909
2096
|
private readonly session;
|
|
1910
2097
|
constructor(runtime: PdfRuntimeModule, session: DocumentSession);
|
|
1911
2098
|
/**
|
|
1912
|
-
* Create an embedded file
|
|
1913
|
-
* writes key = /UF = /F); a duplicate key rejects with
|
|
1914
|
-
* The result carries the read-back entry,
|
|
1915
|
-
* included.
|
|
2099
|
+
* Create an embedded file from `bytes`. `file.name` becomes the tree key
|
|
2100
|
+
* (PDFium writes key = /UF = /F); a duplicate key rejects with
|
|
2101
|
+
* `InvalidArg`. The result carries the read-back entry,
|
|
2102
|
+
* `checksum`/`size`/dates included.
|
|
1916
2103
|
*/
|
|
1917
|
-
create(file:
|
|
2104
|
+
create(file: AttachmentFileBase, bytes: ArrayBuffer | undefined, signal: AbortSignal): AttachmentCreateResult;
|
|
2105
|
+
/** The entry under `ref`'s key as it reads now; `null` when no file has the key. */
|
|
2106
|
+
find(ref: AttachmentRef): Attachment | null;
|
|
2107
|
+
/** A write's meta, naming the file it changed. Cloud coherence pins are a server concern. */
|
|
2108
|
+
meta(ref: AttachmentRef): AttachmentMutationMeta;
|
|
1918
2109
|
/** Delete an embedded file by key. Unlinks the tree entry only. */
|
|
1919
2110
|
delete(ref: AttachmentRef, signal: AbortSignal): AttachmentDeleteResult;
|
|
1920
2111
|
}
|
|
@@ -2903,6 +3094,7 @@ declare class WorkerHost {
|
|
|
2903
3094
|
private handleMetadataReadCustom;
|
|
2904
3095
|
private handleMetadataUpdateCustom;
|
|
2905
3096
|
private handleActionsRead;
|
|
3097
|
+
private handleOutlineRead;
|
|
2906
3098
|
private handleAnnotationsList;
|
|
2907
3099
|
private handleAnnotationsRenderAppearances;
|
|
2908
3100
|
private handleAnnotationsCreate;
|
|
@@ -2933,7 +3125,10 @@ declare class WorkerHost {
|
|
|
2933
3125
|
* carries who the write acts for, and what it checks per annotation.
|
|
2934
3126
|
*/
|
|
2935
3127
|
private applyOne;
|
|
2936
|
-
/**
|
|
3128
|
+
/**
|
|
3129
|
+
* A change's answer the first time, kept under its `opId`; a retry's
|
|
3130
|
+
* checks. The answer is in the space its job answered in (`ChangeOutcome`).
|
|
3131
|
+
*/
|
|
2937
3132
|
private replayed;
|
|
2938
3133
|
/**
|
|
2939
3134
|
* Runs a change and keeps its answer under `opId`: the result and the record
|
|
@@ -2947,23 +3142,22 @@ declare class WorkerHost {
|
|
|
2947
3142
|
* runs the record this job kept for it. One artifact for all that applied.
|
|
2948
3143
|
*/
|
|
2949
3144
|
private handleDocumentApplyChanges;
|
|
3145
|
+
/**
|
|
3146
|
+
* Page space for a change, measured as each op runs: the page boxes are read
|
|
3147
|
+
* anew each time, as an op can add, remove or put back the page a later
|
|
3148
|
+
* one names.
|
|
3149
|
+
*/
|
|
3150
|
+
private pageSpaceOf;
|
|
2950
3151
|
/** A change's ops, or the steps of the record an undo names. */
|
|
2951
3152
|
private runChange;
|
|
2952
3153
|
private handlePagesList;
|
|
2953
|
-
private handlePagesReorder;
|
|
2954
|
-
private handlePagesRotate;
|
|
2955
|
-
private handlePagesDelete;
|
|
2956
3154
|
private handlePagesSetName;
|
|
2957
3155
|
private handlePagesRemoveName;
|
|
2958
3156
|
private handlePagesFlatten;
|
|
2959
3157
|
private handleRedactionApply;
|
|
2960
3158
|
private handlePagesExtract;
|
|
2961
|
-
private handlePagesInsert;
|
|
2962
|
-
private handlePagesInsertBlank;
|
|
2963
3159
|
private handleAttachmentsList;
|
|
2964
3160
|
private handleAttachmentsReadFile;
|
|
2965
|
-
private handleAttachmentsCreate;
|
|
2966
|
-
private handleAttachmentsDelete;
|
|
2967
3161
|
private handleAnnotationsReadFile;
|
|
2968
3162
|
private handleMeasureViewports;
|
|
2969
3163
|
private handleMeasureSetScale;
|
|
@@ -3066,5 +3260,5 @@ declare class WorkerHost {
|
|
|
3066
3260
|
private saveLayerArtifact;
|
|
3067
3261
|
}
|
|
3068
3262
|
//#endregion
|
|
3069
|
-
export { ALL_STANDARD_SECURITY_PERMISSIONS, type AcquiredBaseDocument, ActionReadBudgetTracker, AnnotationAppearanceReader, AnnotationBatchApplier, AnnotationExporter, AnnotationFlattener, AnnotationImporter, AnnotationMutator, AnnotationReader, type AppliedChange, AttachmentMutator, AttachmentReader, BaseDocumentRegistry, type BatchCreate, type BatchCreateResult, CandidateFinalizer, ChangeApplier, ChangeLedger, type ChangeOutcome, type ChangeRecord, CloseStack, DIGEST_CODE, DocumentActionsReader, PagesMutator as DocumentPagesMutator, PagesMutator, DocumentSaver, DocumentSession, EPDF_CHAR_GEOMETRY_LAYOUT, FontRegistrar, FormExporter, FormImporter, FormMutator, FormReader, type LayerSource, MetadataMutator, MetadataReader, type OpenedPdfDocument, type OpenedPdfDocumentKind, type PackedChangeRecord, PageGeometryReader, PagesReader as PageLayoutReader, PagesReader, PagePtrPool, PageRenderReader as PageRasterReader, PageRenderReader, type PageRecord, PageTextReader, PagesExtractor, PagesFlattener, PagesInserter, RawAnnotationReader, type RawGeometryGlyphRecord, RedactionApplier, type ReverseStep, SearchReader, SecurityReader, SignatureAnalyzer, SignatureMutator, SignatureReader, type StartupFontSpec, type UndoUnavailableReason, type WorkerEncodedImage, WorkerHost, type WorkerHostOptions, type WorkerImageEncoder, acquireSignatureModel, buildRunsFromRawGlyphs, changeLedgerOf, destroyLibrary, disposeFormModel, disposeSignatureModel, ensureInitialized, formatPdfDate, generateUuid, hasAllStandardSecurityPermissions, hasSignedSignature, normalizeU32, openFatMemoryDocument, openLayerDocument, packChangeRecord, pdfDateToIso, readActionModel, readAttachmentFileInfo, readRevisions, readSignaturesFromModel, readStructure, throwIfAborted, unpackChangeRecord, visibleBoxReader, writeAttachmentFilePayload };
|
|
3263
|
+
export { ALL_STANDARD_SECURITY_PERMISSIONS, type AcquiredBaseDocument, ActionReadBudgetTracker, AnnotationAppearanceReader, AnnotationBatchApplier, AnnotationExporter, AnnotationFlattener, AnnotationImporter, AnnotationMutator, AnnotationReader, type AppliedChange, AttachmentMutator, AttachmentReader, BaseDocumentRegistry, type BatchCreate, type BatchCreateResult, CandidateFinalizer, ChangeApplier, ChangeLedger, type ChangeOutcome, type ChangeRecord, type ChangeSpace, CloseStack, DIGEST_CODE, DocumentActionsReader, PagesMutator as DocumentPagesMutator, PagesMutator, DocumentSaver, DocumentSession, EPDF_CHAR_GEOMETRY_LAYOUT, FILE_SPACE, FontRegistrar, FormExporter, FormImporter, FormMutator, FormReader, type KeptResult, type LayerSource, MetadataMutator, MetadataReader, type OpenedPdfDocument, type OpenedPdfDocumentKind, type PackedChangeRecord, PageGeometryReader, PagesReader as PageLayoutReader, PagesReader, PagePtrPool, PageRenderReader as PageRasterReader, PageRenderReader, type PageRecord, PageTextReader, PagesExtractor, PagesFlattener, PagesInserter, RawAnnotationReader, type RawGeometryGlyphRecord, RedactionApplier, type ReverseStep, SearchReader, SecurityReader, SignatureAnalyzer, SignatureMutator, SignatureReader, type StartupFontSpec, type UndoUnavailableReason, type WorkerEncodedImage, WorkerHost, type WorkerHostOptions, type WorkerImageEncoder, acquireSignatureModel, buildRunsFromRawGlyphs, changeLedgerOf, destroyLibrary, disposeFormModel, disposeSignatureModel, ensureInitialized, formatPdfDate, generateUuid, hasAllStandardSecurityPermissions, hasSignedSignature, normalizeU32, openFatMemoryDocument, openLayerDocument, packChangeRecord, pdfDateToIso, readActionModel, readAttachmentFileInfo, readRevisions, readSignaturesFromModel, readStructure, rotationAt, throwIfAborted, unpackChangeRecord, visibleBoxReader, writeAttachmentFilePayload };
|
|
3070
3264
|
//# sourceMappingURL=index.d.ts.map
|