@superdoc/sdk 2.15.1-next.5 → 2.16.0-next.2

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/README.md CHANGED
@@ -60,6 +60,71 @@ is not supported for Liveblocks or the standalone document host.
60
60
 
61
61
  See the [Node.js SDK guide](https://docs.superdoc.dev/agents/automation/node-sdk) for a complete workflow.
62
62
 
63
+ ## Tracked comparison with exact-file review
64
+
65
+ The SDK's `diff.capture` and `diff.compare` describe a snapshot comparison. A
66
+ blocked tracked `diff.apply` cannot turn that snapshot into a complete review
67
+ proposal: the host must provide the exact base and target DOCX bytes, a durable
68
+ review store, a document ID, and an authenticated actor. For a Node host using
69
+ the V2 document runtime, `runTrackedComparisonReview` connects those steps:
70
+
71
+ ```js
72
+ import { readFile } from 'node:fs/promises';
73
+ import { createSuperDocClient, runTrackedComparisonReview } from '@superdoc/sdk';
74
+ import {
75
+ createDocumentProposalManager,
76
+ createFileDocumentReviewStore,
77
+ openVersionedDocumentReviewSession,
78
+ } from '@superdoc/docx-engine/document-runtime';
79
+
80
+ const baseBytes = new Uint8Array(await readFile(basePath));
81
+ const targetBytes = new Uint8Array(await readFile(targetPath));
82
+ const actor = authenticatedUser.name; // Set by the host's authentication layer.
83
+ const store = createFileDocumentReviewStore(durableReviewDirectory);
84
+ const manager = createDocumentProposalManager(store);
85
+ if (!(await store.read(documentId))) {
86
+ const initial = await manager.initialize({ documentId, bytes: baseBytes, savePolicy: 'suggest-only' });
87
+ if (initial.kind !== 'initialized' && initial.kind !== 'stale') throw new Error(initial.kind);
88
+ }
89
+
90
+ const session = await openVersionedDocumentReviewSession({ store, documentId, actor });
91
+ const client = createSuperDocClient({
92
+ user: { name: actor },
93
+ requestTimeoutMs: 120_000,
94
+ env: { SUPERDOC_SDK_DOCUMENT_HOST_BIN: 'embedded' },
95
+ });
96
+ try {
97
+ const { diff, comparisonError, result } = await runTrackedComparisonReview({
98
+ client, baseBytes, targetBytes, documentId, actor,
99
+ currentReviewDocument: (id) => manager.current(id),
100
+ reviewSession: session,
101
+ options: { timeoutMs: 120_000 },
102
+ });
103
+ console.log(diff?.applyEligibility?.tracked, comparisonError);
104
+ if (result.kind === 'prepared') {
105
+ const preview = await session.preview(result.id);
106
+ // Present the whole-document proposal and its exact base/target files to a reviewer.
107
+ // Call session.decide(result.id, 'accept' or 'reject') after their decision.
108
+ } else if (result.kind !== 'native-revisions-applied') {
109
+ throw new Error(`Tracked review did not proceed: ${result.kind}`);
110
+ }
111
+ // manager.current(documentId) supplies export bytes; manager.history(documentId) supplies audit events.
112
+ } finally {
113
+ await client.dispose();
114
+ await session.close();
115
+ }
116
+ ```
117
+
118
+ The helper stages private copies of the exact bytes for SDK capture and compare,
119
+ checks the store's current base and the review session's version, document, and
120
+ actor binding, then calls the versioned session's `applyTarget` in tracked mode.
121
+ If SDK import or comparison is unavailable, `comparisonError` explains why
122
+ `diff` is null and exact-file review still runs.
123
+ That session chooses native Word revisions only after proving accept and reject
124
+ endpoints; other supported changes become one whole-document proposal. A stale
125
+ base or invalid DOCX returns a refusal without a partial apply. The host owns
126
+ authorization, durable storage, reviewer presentation, and decisions.
127
+
63
128
  ## Agent execution evidence
64
129
 
65
130
  The core preset's `agent_apply`, `agent_verify`, and supported named actions
@@ -347,6 +347,7 @@ function createDocApi(runtime) {
347
347
  },
348
348
  },
349
349
  watermarks: {
350
+ apply: (params, options) => runtime.invoke(contract.CONTRACT.operations["doc.watermarks.apply"], params, options),
350
351
  list: (params = {}, options) => runtime.invoke(contract.CONTRACT.operations["doc.watermarks.list"], params, options),
351
352
  insert: (params, options) => runtime.invoke(contract.CONTRACT.operations["doc.watermarks.insert"], params, options),
352
353
  replace: (params, options) => runtime.invoke(contract.CONTRACT.operations["doc.watermarks.replace"], params, options),
@@ -919,6 +920,7 @@ function createBoundDocApi(runtime) {
919
920
  },
920
921
  },
921
922
  watermarks: {
923
+ apply: (params, options) => runtime.invoke(contract.CONTRACT.operations["doc.watermarks.apply"], params, options),
922
924
  list: (params = {}, options) => runtime.invoke(contract.CONTRACT.operations["doc.watermarks.list"], params, options),
923
925
  insert: (params, options) => runtime.invoke(contract.CONTRACT.operations["doc.watermarks.insert"], params, options),
924
926
  replace: (params, options) => runtime.invoke(contract.CONTRACT.operations["doc.watermarks.replace"], params, options),
@@ -25743,6 +25743,112 @@ export interface DocHeaderFootersPartsDeleteParams {
25743
25743
  refId: string;
25744
25744
  };
25745
25745
  }
25746
+ export interface DocWatermarksApplyParams {
25747
+ doc?: string;
25748
+ sessionId?: string;
25749
+ out?: string;
25750
+ force?: boolean;
25751
+ expectedRevision?: string;
25752
+ changeMode?: string;
25753
+ dryRun?: boolean;
25754
+ target: ({
25755
+ kind: "document";
25756
+ }) | ({
25757
+ kind: "headerFooterSlots";
25758
+ slots: Array<{
25759
+ kind: "headerFooterSlot";
25760
+ section: {
25761
+ kind: "section";
25762
+ sectionId: string;
25763
+ };
25764
+ headerFooterKind: "header";
25765
+ variant: "default" | "first" | "even";
25766
+ }>;
25767
+ });
25768
+ action: string;
25769
+ watermark?: ({
25770
+ kind: "text";
25771
+ text: string;
25772
+ fontFamily?: string;
25773
+ fontSizePt?: "auto" | number;
25774
+ bold?: boolean;
25775
+ italic?: boolean;
25776
+ color?: string;
25777
+ opacity?: number;
25778
+ orientation?: "horizontal" | "diagonal";
25779
+ placement?: {
25780
+ widthPt?: number;
25781
+ heightPt?: number;
25782
+ rotationDegrees?: number;
25783
+ behindText?: boolean;
25784
+ horizontal?: {
25785
+ relativeFrom: "page" | "margin";
25786
+ alignment?: "left" | "center" | "right";
25787
+ offsetPt?: number;
25788
+ };
25789
+ vertical?: {
25790
+ relativeFrom: "page" | "margin";
25791
+ alignment?: "top" | "center" | "bottom";
25792
+ offsetPt?: number;
25793
+ };
25794
+ };
25795
+ }) | ({
25796
+ kind: "picture";
25797
+ src: string;
25798
+ scalePercent?: "auto" | 50 | 100 | 150 | 200 | 500;
25799
+ widthPt?: number;
25800
+ heightPt?: number;
25801
+ lockAspectRatio?: boolean;
25802
+ washout?: boolean;
25803
+ opacity?: number;
25804
+ placement?: {
25805
+ widthPt?: number;
25806
+ heightPt?: number;
25807
+ rotationDegrees?: number;
25808
+ behindText?: boolean;
25809
+ horizontal?: {
25810
+ relativeFrom: "page" | "margin";
25811
+ alignment?: "left" | "center" | "right";
25812
+ offsetPt?: number;
25813
+ };
25814
+ vertical?: {
25815
+ relativeFrom: "page" | "margin";
25816
+ alignment?: "top" | "center" | "bottom";
25817
+ offsetPt?: number;
25818
+ };
25819
+ };
25820
+ }) | ({
25821
+ kind: "picture";
25822
+ src?: unknown;
25823
+ scalePercent?: "auto" | 50 | 100 | 150 | 200 | 500;
25824
+ widthPt?: number;
25825
+ heightPt?: number;
25826
+ lockAspectRatio?: boolean;
25827
+ washout?: boolean;
25828
+ opacity?: number;
25829
+ placement?: {
25830
+ widthPt?: number;
25831
+ heightPt?: number;
25832
+ rotationDegrees?: number;
25833
+ behindText?: boolean;
25834
+ horizontal?: {
25835
+ relativeFrom: "page" | "margin";
25836
+ alignment?: "left" | "center" | "right";
25837
+ offsetPt?: number;
25838
+ };
25839
+ vertical?: {
25840
+ relativeFrom: "page" | "margin";
25841
+ alignment?: "top" | "center" | "bottom";
25842
+ offsetPt?: number;
25843
+ };
25844
+ };
25845
+ source: {
25846
+ kind: "existing";
25847
+ watermarkId: string;
25848
+ };
25849
+ });
25850
+ watermarkIds?: string[];
25851
+ }
25746
25852
  export interface DocWatermarksListParams {
25747
25853
  doc?: string;
25748
25854
  sessionId?: string;
@@ -100717,8 +100823,9 @@ export type DocTrackChangesListResult = {
100717
100823
  format?: string;
100718
100824
  };
100719
100825
  revisionGroupId?: string;
100720
- reviewGroup?: {
100826
+ reviewGroup?: ({
100721
100827
  kind: "text-rewrite";
100828
+ groupOrigin: "authored-operation";
100722
100829
  role: "parent" | "child";
100723
100830
  parentId?: string;
100724
100831
  childChangeIds: Array<string>;
@@ -100733,7 +100840,24 @@ export type DocTrackChangesListResult = {
100733
100840
  rsids?: Array<string>;
100734
100841
  };
100735
100842
  }>;
100736
- };
100843
+ }) | ({
100844
+ kind: "comparison-hunk";
100845
+ groupOrigin: "comparison-hunk";
100846
+ role: "parent" | "child";
100847
+ parentId?: string;
100848
+ childChangeIds: Array<string>;
100849
+ members: Array<{
100850
+ id: string;
100851
+ type: "insertion" | "deletion" | "replacement" | "formatting" | "move" | "structural" | "insert" | "delete" | "format";
100852
+ subtype: string;
100853
+ sourceIds: {
100854
+ wordIdInsert?: string;
100855
+ wordIdDelete?: string;
100856
+ wordIdOther?: Array<string>;
100857
+ rsids?: Array<string>;
100858
+ };
100859
+ }>;
100860
+ });
100737
100861
  author?: string;
100738
100862
  authorEmail?: string;
100739
100863
  authorImage?: string;
@@ -101023,8 +101147,9 @@ export type DocTrackChangesGetResult = {
101023
101147
  format?: string;
101024
101148
  };
101025
101149
  revisionGroupId?: string;
101026
- reviewGroup?: {
101150
+ reviewGroup?: ({
101027
101151
  kind: "text-rewrite";
101152
+ groupOrigin: "authored-operation";
101028
101153
  role: "parent" | "child";
101029
101154
  parentId?: string;
101030
101155
  childChangeIds: Array<string>;
@@ -101039,7 +101164,24 @@ export type DocTrackChangesGetResult = {
101039
101164
  rsids?: Array<string>;
101040
101165
  };
101041
101166
  }>;
101042
- };
101167
+ }) | ({
101168
+ kind: "comparison-hunk";
101169
+ groupOrigin: "comparison-hunk";
101170
+ role: "parent" | "child";
101171
+ parentId?: string;
101172
+ childChangeIds: Array<string>;
101173
+ members: Array<{
101174
+ id: string;
101175
+ type: "insertion" | "deletion" | "replacement" | "formatting" | "move" | "structural" | "insert" | "delete" | "format";
101176
+ subtype: string;
101177
+ sourceIds: {
101178
+ wordIdInsert?: string;
101179
+ wordIdDelete?: string;
101180
+ wordIdOther?: Array<string>;
101181
+ rsids?: Array<string>;
101182
+ };
101183
+ }>;
101184
+ });
101043
101185
  splitFromId?: string | null;
101044
101186
  replacement?: {
101045
101187
  inserted: ({
@@ -105251,6 +105393,12 @@ export type DocCapabilitiesGetResult = {
105251
105393
  dryRun: boolean;
105252
105394
  reasons?: Array<"COMMAND_UNAVAILABLE" | "HELPER_UNAVAILABLE" | "OPERATION_UNAVAILABLE" | "TRACKED_MODE_UNAVAILABLE" | "DRY_RUN_UNAVAILABLE" | "NAMESPACE_UNAVAILABLE" | "STYLES_PART_MISSING" | "COLLABORATION_ACTIVE" | "TARGET_CONTEXT_REQUIRED" | "TARGET_UNSUPPORTED">;
105253
105395
  };
105396
+ "watermarks.apply": {
105397
+ available: boolean;
105398
+ tracked: boolean;
105399
+ dryRun: boolean;
105400
+ reasons?: Array<"COMMAND_UNAVAILABLE" | "HELPER_UNAVAILABLE" | "OPERATION_UNAVAILABLE" | "TRACKED_MODE_UNAVAILABLE" | "DRY_RUN_UNAVAILABLE" | "NAMESPACE_UNAVAILABLE" | "STYLES_PART_MISSING" | "COLLABORATION_ACTIVE" | "TARGET_CONTEXT_REQUIRED" | "TARGET_UNSUPPORTED">;
105401
+ };
105254
105402
  "watermarks.list": {
105255
105403
  available: boolean;
105256
105404
  tracked: boolean;
@@ -108279,7 +108427,7 @@ export type DocCapabilitiesCheckResult = ({
108279
108427
  };
108280
108428
  });
108281
108429
  export type DocCapabilitiesResolveResult = {
108282
- operationId: "get" | "find" | "getNode" | "getNodeById" | "getText" | "getMarkdown" | "getHtml" | "projectMarkdown" | "projectHtml" | "markdownToFragment" | "htmlToFragment" | "info" | "extract" | "clearContent" | "insert" | "replace" | "delete" | "formatRange" | "blocks.findText" | "blocks.list" | "blocks.delete" | "blocks.deleteRange" | "blocks.split" | "blocks.merge" | "blocks.move" | "format.apply" | "format.bold" | "format.italic" | "format.strike" | "format.underline" | "format.highlight" | "format.color" | "format.fontSize" | "format.fontFamily" | "format.letterSpacing" | "format.vertAlign" | "format.position" | "format.dstrike" | "format.smallCaps" | "format.caps" | "format.shading" | "format.border" | "format.outline" | "format.shadow" | "format.emboss" | "format.imprint" | "format.charScale" | "format.kerning" | "format.vanish" | "format.webHidden" | "format.specVanish" | "format.rtl" | "format.cs" | "format.bCs" | "format.iCs" | "format.eastAsianLayout" | "format.em" | "format.fitText" | "format.snapToGrid" | "format.lang" | "format.oMath" | "format.rStyle" | "format.rFonts" | "format.fontSizeCs" | "format.ligatures" | "format.numForm" | "format.numSpacing" | "format.stylisticSets" | "format.contextualAlternates" | "styles.apply" | "styles.getCatalog" | "templates.apply" | "create.paragraph" | "create.heading" | "create.sectionBreak" | "sections.list" | "sections.get" | "sections.setBreakType" | "sections.setPageMargins" | "sections.setHeaderFooterMargins" | "sections.setPageSetup" | "sections.setColumns" | "sections.setLineNumbering" | "sections.setPageNumbering" | "sections.setTitlePage" | "sections.setOddEvenHeadersFooters" | "sections.setVerticalAlign" | "sections.setSectionDirection" | "sections.setHeaderFooterRef" | "sections.clearHeaderFooterRef" | "sections.setLinkToPrevious" | "sections.setPageBorders" | "sections.clearPageBorders" | "styles.paragraph.setStyle" | "styles.paragraph.setStyleRef" | "styles.paragraph.clearStyle" | "format.paragraph.resetDirectFormatting" | "format.paragraph.setAlignment" | "format.paragraph.clearAlignment" | "format.paragraph.setIndentation" | "format.paragraph.clearIndentation" | "format.paragraph.setSpacing" | "format.paragraph.clearSpacing" | "format.paragraph.setKeepOptions" | "format.paragraph.setOutlineLevel" | "format.paragraph.setFlowOptions" | "format.paragraph.setTabStop" | "format.paragraph.clearTabStop" | "format.paragraph.clearAllTabStops" | "format.paragraph.setBorder" | "format.paragraph.clearBorder" | "format.paragraph.setShading" | "format.paragraph.clearShading" | "format.paragraph.setMarkRunProps" | "format.paragraph.setDirection" | "format.paragraph.clearDirection" | "format.paragraph.setNumbering" | "lists.list" | "lists.get" | "lists.insert" | "lists.create" | "lists.attach" | "lists.detach" | "lists.delete" | "lists.indent" | "lists.outdent" | "lists.join" | "lists.canJoin" | "lists.separate" | "lists.merge" | "lists.split" | "lists.setLevel" | "lists.setValue" | "lists.continuePrevious" | "lists.canContinuePrevious" | "lists.setLevelRestart" | "lists.convertToText" | "lists.applyTemplate" | "lists.applyPreset" | "lists.setType" | "lists.captureTemplate" | "lists.setLevelNumbering" | "lists.setLevelBullet" | "lists.setLevelPictureBullet" | "lists.setLevelAlignment" | "lists.setLevelIndents" | "lists.setLevelTrailingCharacter" | "lists.setLevelMarkerFont" | "lists.clearLevelOverrides" | "lists.getStyle" | "lists.applyStyle" | "lists.restartAt" | "lists.setLevelNumberStyle" | "lists.setLevelText" | "lists.setLevelStart" | "lists.setLevelLayout" | "lists.getState" | "lists.apply" | "lists.continue" | "lists.restart" | "lists.remove" | "comments.create" | "comments.patch" | "comments.delete" | "comments.get" | "comments.list" | "trackChanges.list" | "trackChanges.get" | "trackChanges.decide" | "query.match" | "ranges.resolve" | "selection.current" | "mutations.preview" | "mutations.apply" | "plan.execute" | "capabilities.get" | "capabilities.check" | "capabilities.resolve" | "create.table" | "tables.convertFromText" | "tables.delete" | "tables.clearContents" | "tables.move" | "tables.split" | "tables.convertToText" | "tables.setLayout" | "tables.insertRow" | "tables.deleteRow" | "tables.moveRow" | "tables.setRowHeight" | "tables.distributeRows" | "tables.setRowOptions" | "tables.insertColumn" | "tables.deleteColumn" | "tables.moveColumn" | "tables.setColumnWidth" | "tables.distributeColumns" | "tables.insertCell" | "tables.deleteCell" | "tables.mergeCells" | "tables.unmergeCells" | "tables.splitCell" | "tables.setCellProperties" | "tables.setCellText" | "tables.sort" | "tables.setAltText" | "tables.setStyle" | "tables.clearStyle" | "tables.setStyleOption" | "tables.setBorder" | "tables.clearBorder" | "tables.applyBorderPreset" | "tables.setShading" | "tables.clearShading" | "tables.setTablePadding" | "tables.setCellPadding" | "tables.setCellSpacing" | "tables.clearCellSpacing" | "tables.applyStyle" | "tables.setBorders" | "tables.setTableOptions" | "tables.applyPreset" | "tables.get" | "tables.getCells" | "tables.getProperties" | "tables.getStyles" | "tables.setDefaultStyle" | "tables.clearDefaultStyle" | "create.tableOfContents" | "toc.list" | "toc.get" | "toc.configure" | "toc.update" | "toc.remove" | "toc.markEntry" | "toc.unmarkEntry" | "toc.listEntries" | "toc.getEntry" | "toc.editEntry" | "history.get" | "history.undo" | "history.redo" | "create.image" | "images.list" | "images.get" | "images.delete" | "images.move" | "images.convertToInline" | "images.convertToFloating" | "images.setSize" | "images.setWrapType" | "images.setWrapSide" | "images.setWrapDistances" | "images.setPosition" | "images.setAnchorOptions" | "images.setZOrder" | "images.scale" | "images.setLockAspectRatio" | "images.rotate" | "images.flip" | "images.crop" | "images.resetCrop" | "images.replaceSource" | "images.setAltText" | "images.setDecorative" | "images.setName" | "images.setHyperlink" | "images.insertCaption" | "images.updateCaption" | "images.removeCaption" | "hyperlinks.list" | "hyperlinks.get" | "hyperlinks.wrap" | "hyperlinks.insert" | "hyperlinks.patch" | "hyperlinks.remove" | "headerFooters.list" | "headerFooters.get" | "headerFooters.resolve" | "headerFooters.refs.set" | "headerFooters.refs.clear" | "headerFooters.refs.setLinkedToPrevious" | "headerFooters.parts.list" | "headerFooters.parts.create" | "headerFooters.parts.delete" | "watermarks.list" | "watermarks.insert" | "watermarks.replace" | "watermarks.remove" | "create.contentControl" | "contentControls.list" | "contentControls.get" | "contentControls.listInRange" | "contentControls.selectByTag" | "contentControls.selectByTitle" | "contentControls.listChildren" | "contentControls.getParent" | "contentControls.wrap" | "contentControls.unwrap" | "contentControls.delete" | "contentControls.copy" | "contentControls.move" | "contentControls.patch" | "contentControls.setLockMode" | "contentControls.setType" | "contentControls.getContent" | "contentControls.replaceContent" | "contentControls.clearContent" | "contentControls.appendContent" | "contentControls.prependContent" | "contentControls.insertBefore" | "contentControls.insertAfter" | "contentControls.getBinding" | "contentControls.setBinding" | "contentControls.clearBinding" | "contentControls.getRawProperties" | "contentControls.patchRawProperties" | "contentControls.validateWordCompatibility" | "contentControls.normalizeWordCompatibility" | "contentControls.normalizeTagPayload" | "contentControls.text.setMultiline" | "contentControls.text.setValue" | "contentControls.text.clearValue" | "contentControls.date.setValue" | "contentControls.date.clearValue" | "contentControls.date.setDisplayFormat" | "contentControls.date.setDisplayLocale" | "contentControls.date.setStorageFormat" | "contentControls.date.setCalendar" | "contentControls.checkbox.getState" | "contentControls.checkbox.setState" | "contentControls.checkbox.toggle" | "contentControls.checkbox.setSymbolPair" | "contentControls.choiceList.getItems" | "contentControls.choiceList.setItems" | "contentControls.choiceList.setSelected" | "contentControls.repeatingSection.listItems" | "contentControls.repeatingSection.insertItemBefore" | "contentControls.repeatingSection.insertItemAfter" | "contentControls.repeatingSection.cloneItem" | "contentControls.repeatingSection.deleteItem" | "contentControls.repeatingSection.setAllowInsertDelete" | "contentControls.group.wrap" | "contentControls.group.ungroup" | "bookmarks.list" | "bookmarks.get" | "bookmarks.insert" | "bookmarks.rename" | "bookmarks.remove" | "footnotes.list" | "footnotes.get" | "footnotes.insert" | "footnotes.update" | "footnotes.remove" | "footnotes.configure" | "clipboard.parse" | "clipboard.insert" | "clipboard.serializeSelection" | "crossRefs.list" | "crossRefs.get" | "crossRefs.insert" | "crossRefs.rebuild" | "crossRefs.remove" | "index.list" | "index.get" | "index.insert" | "index.configure" | "index.rebuild" | "index.remove" | "index.entries.list" | "index.entries.get" | "index.entries.insert" | "index.entries.update" | "index.entries.remove" | "captions.list" | "captions.get" | "captions.insert" | "captions.update" | "captions.remove" | "captions.configure" | "fields.list" | "fields.get" | "fields.insert" | "fields.rebuild" | "fields.remove" | "citations.list" | "citations.get" | "citations.insert" | "citations.update" | "citations.remove" | "citations.sources.list" | "citations.sources.get" | "citations.sources.insert" | "citations.sources.update" | "citations.sources.remove" | "citations.bibliography.get" | "citations.bibliography.insert" | "citations.bibliography.rebuild" | "citations.bibliography.configure" | "citations.bibliography.remove" | "authorities.list" | "authorities.get" | "authorities.insert" | "authorities.configure" | "authorities.rebuild" | "authorities.remove" | "authorities.entries.list" | "authorities.entries.get" | "authorities.entries.insert" | "authorities.entries.update" | "authorities.entries.remove" | "diff.capture" | "diff.compare" | "diff.apply" | "export.toDocx" | "protection.get" | "protection.setEditingRestriction" | "protection.clearEditingRestriction" | "permissionRanges.list" | "permissionRanges.get" | "permissionRanges.create" | "permissionRanges.remove" | "permissionRanges.updatePrincipal" | "customXml.parts.list" | "customXml.parts.get" | "customXml.parts.create" | "customXml.parts.patch" | "customXml.parts.remove" | "metadata.attach" | "metadata.list" | "metadata.get" | "metadata.update" | "metadata.remove" | "metadata.resolve";
108430
+ operationId: "get" | "find" | "getNode" | "getNodeById" | "getText" | "getMarkdown" | "getHtml" | "projectMarkdown" | "projectHtml" | "markdownToFragment" | "htmlToFragment" | "info" | "extract" | "clearContent" | "insert" | "replace" | "delete" | "formatRange" | "blocks.findText" | "blocks.list" | "blocks.delete" | "blocks.deleteRange" | "blocks.split" | "blocks.merge" | "blocks.move" | "format.apply" | "format.bold" | "format.italic" | "format.strike" | "format.underline" | "format.highlight" | "format.color" | "format.fontSize" | "format.fontFamily" | "format.letterSpacing" | "format.vertAlign" | "format.position" | "format.dstrike" | "format.smallCaps" | "format.caps" | "format.shading" | "format.border" | "format.outline" | "format.shadow" | "format.emboss" | "format.imprint" | "format.charScale" | "format.kerning" | "format.vanish" | "format.webHidden" | "format.specVanish" | "format.rtl" | "format.cs" | "format.bCs" | "format.iCs" | "format.eastAsianLayout" | "format.em" | "format.fitText" | "format.snapToGrid" | "format.lang" | "format.oMath" | "format.rStyle" | "format.rFonts" | "format.fontSizeCs" | "format.ligatures" | "format.numForm" | "format.numSpacing" | "format.stylisticSets" | "format.contextualAlternates" | "styles.apply" | "styles.getCatalog" | "templates.apply" | "create.paragraph" | "create.heading" | "create.sectionBreak" | "sections.list" | "sections.get" | "sections.setBreakType" | "sections.setPageMargins" | "sections.setHeaderFooterMargins" | "sections.setPageSetup" | "sections.setColumns" | "sections.setLineNumbering" | "sections.setPageNumbering" | "sections.setTitlePage" | "sections.setOddEvenHeadersFooters" | "sections.setVerticalAlign" | "sections.setSectionDirection" | "sections.setHeaderFooterRef" | "sections.clearHeaderFooterRef" | "sections.setLinkToPrevious" | "sections.setPageBorders" | "sections.clearPageBorders" | "styles.paragraph.setStyle" | "styles.paragraph.setStyleRef" | "styles.paragraph.clearStyle" | "format.paragraph.resetDirectFormatting" | "format.paragraph.setAlignment" | "format.paragraph.clearAlignment" | "format.paragraph.setIndentation" | "format.paragraph.clearIndentation" | "format.paragraph.setSpacing" | "format.paragraph.clearSpacing" | "format.paragraph.setKeepOptions" | "format.paragraph.setOutlineLevel" | "format.paragraph.setFlowOptions" | "format.paragraph.setTabStop" | "format.paragraph.clearTabStop" | "format.paragraph.clearAllTabStops" | "format.paragraph.setBorder" | "format.paragraph.clearBorder" | "format.paragraph.setShading" | "format.paragraph.clearShading" | "format.paragraph.setMarkRunProps" | "format.paragraph.setDirection" | "format.paragraph.clearDirection" | "format.paragraph.setNumbering" | "lists.list" | "lists.get" | "lists.insert" | "lists.create" | "lists.attach" | "lists.detach" | "lists.delete" | "lists.indent" | "lists.outdent" | "lists.join" | "lists.canJoin" | "lists.separate" | "lists.merge" | "lists.split" | "lists.setLevel" | "lists.setValue" | "lists.continuePrevious" | "lists.canContinuePrevious" | "lists.setLevelRestart" | "lists.convertToText" | "lists.applyTemplate" | "lists.applyPreset" | "lists.setType" | "lists.captureTemplate" | "lists.setLevelNumbering" | "lists.setLevelBullet" | "lists.setLevelPictureBullet" | "lists.setLevelAlignment" | "lists.setLevelIndents" | "lists.setLevelTrailingCharacter" | "lists.setLevelMarkerFont" | "lists.clearLevelOverrides" | "lists.getStyle" | "lists.applyStyle" | "lists.restartAt" | "lists.setLevelNumberStyle" | "lists.setLevelText" | "lists.setLevelStart" | "lists.setLevelLayout" | "lists.getState" | "lists.apply" | "lists.continue" | "lists.restart" | "lists.remove" | "comments.create" | "comments.patch" | "comments.delete" | "comments.get" | "comments.list" | "trackChanges.list" | "trackChanges.get" | "trackChanges.decide" | "query.match" | "ranges.resolve" | "selection.current" | "mutations.preview" | "mutations.apply" | "plan.execute" | "capabilities.get" | "capabilities.check" | "capabilities.resolve" | "create.table" | "tables.convertFromText" | "tables.delete" | "tables.clearContents" | "tables.move" | "tables.split" | "tables.convertToText" | "tables.setLayout" | "tables.insertRow" | "tables.deleteRow" | "tables.moveRow" | "tables.setRowHeight" | "tables.distributeRows" | "tables.setRowOptions" | "tables.insertColumn" | "tables.deleteColumn" | "tables.moveColumn" | "tables.setColumnWidth" | "tables.distributeColumns" | "tables.insertCell" | "tables.deleteCell" | "tables.mergeCells" | "tables.unmergeCells" | "tables.splitCell" | "tables.setCellProperties" | "tables.setCellText" | "tables.sort" | "tables.setAltText" | "tables.setStyle" | "tables.clearStyle" | "tables.setStyleOption" | "tables.setBorder" | "tables.clearBorder" | "tables.applyBorderPreset" | "tables.setShading" | "tables.clearShading" | "tables.setTablePadding" | "tables.setCellPadding" | "tables.setCellSpacing" | "tables.clearCellSpacing" | "tables.applyStyle" | "tables.setBorders" | "tables.setTableOptions" | "tables.applyPreset" | "tables.get" | "tables.getCells" | "tables.getProperties" | "tables.getStyles" | "tables.setDefaultStyle" | "tables.clearDefaultStyle" | "create.tableOfContents" | "toc.list" | "toc.get" | "toc.configure" | "toc.update" | "toc.remove" | "toc.markEntry" | "toc.unmarkEntry" | "toc.listEntries" | "toc.getEntry" | "toc.editEntry" | "history.get" | "history.undo" | "history.redo" | "create.image" | "images.list" | "images.get" | "images.delete" | "images.move" | "images.convertToInline" | "images.convertToFloating" | "images.setSize" | "images.setWrapType" | "images.setWrapSide" | "images.setWrapDistances" | "images.setPosition" | "images.setAnchorOptions" | "images.setZOrder" | "images.scale" | "images.setLockAspectRatio" | "images.rotate" | "images.flip" | "images.crop" | "images.resetCrop" | "images.replaceSource" | "images.setAltText" | "images.setDecorative" | "images.setName" | "images.setHyperlink" | "images.insertCaption" | "images.updateCaption" | "images.removeCaption" | "hyperlinks.list" | "hyperlinks.get" | "hyperlinks.wrap" | "hyperlinks.insert" | "hyperlinks.patch" | "hyperlinks.remove" | "headerFooters.list" | "headerFooters.get" | "headerFooters.resolve" | "headerFooters.refs.set" | "headerFooters.refs.clear" | "headerFooters.refs.setLinkedToPrevious" | "headerFooters.parts.list" | "headerFooters.parts.create" | "headerFooters.parts.delete" | "watermarks.apply" | "watermarks.list" | "watermarks.insert" | "watermarks.replace" | "watermarks.remove" | "create.contentControl" | "contentControls.list" | "contentControls.get" | "contentControls.listInRange" | "contentControls.selectByTag" | "contentControls.selectByTitle" | "contentControls.listChildren" | "contentControls.getParent" | "contentControls.wrap" | "contentControls.unwrap" | "contentControls.delete" | "contentControls.copy" | "contentControls.move" | "contentControls.patch" | "contentControls.setLockMode" | "contentControls.setType" | "contentControls.getContent" | "contentControls.replaceContent" | "contentControls.clearContent" | "contentControls.appendContent" | "contentControls.prependContent" | "contentControls.insertBefore" | "contentControls.insertAfter" | "contentControls.getBinding" | "contentControls.setBinding" | "contentControls.clearBinding" | "contentControls.getRawProperties" | "contentControls.patchRawProperties" | "contentControls.validateWordCompatibility" | "contentControls.normalizeWordCompatibility" | "contentControls.normalizeTagPayload" | "contentControls.text.setMultiline" | "contentControls.text.setValue" | "contentControls.text.clearValue" | "contentControls.date.setValue" | "contentControls.date.clearValue" | "contentControls.date.setDisplayFormat" | "contentControls.date.setDisplayLocale" | "contentControls.date.setStorageFormat" | "contentControls.date.setCalendar" | "contentControls.checkbox.getState" | "contentControls.checkbox.setState" | "contentControls.checkbox.toggle" | "contentControls.checkbox.setSymbolPair" | "contentControls.choiceList.getItems" | "contentControls.choiceList.setItems" | "contentControls.choiceList.setSelected" | "contentControls.repeatingSection.listItems" | "contentControls.repeatingSection.insertItemBefore" | "contentControls.repeatingSection.insertItemAfter" | "contentControls.repeatingSection.cloneItem" | "contentControls.repeatingSection.deleteItem" | "contentControls.repeatingSection.setAllowInsertDelete" | "contentControls.group.wrap" | "contentControls.group.ungroup" | "bookmarks.list" | "bookmarks.get" | "bookmarks.insert" | "bookmarks.rename" | "bookmarks.remove" | "footnotes.list" | "footnotes.get" | "footnotes.insert" | "footnotes.update" | "footnotes.remove" | "footnotes.configure" | "clipboard.parse" | "clipboard.insert" | "clipboard.serializeSelection" | "crossRefs.list" | "crossRefs.get" | "crossRefs.insert" | "crossRefs.rebuild" | "crossRefs.remove" | "index.list" | "index.get" | "index.insert" | "index.configure" | "index.rebuild" | "index.remove" | "index.entries.list" | "index.entries.get" | "index.entries.insert" | "index.entries.update" | "index.entries.remove" | "captions.list" | "captions.get" | "captions.insert" | "captions.update" | "captions.remove" | "captions.configure" | "fields.list" | "fields.get" | "fields.insert" | "fields.rebuild" | "fields.remove" | "citations.list" | "citations.get" | "citations.insert" | "citations.update" | "citations.remove" | "citations.sources.list" | "citations.sources.get" | "citations.sources.insert" | "citations.sources.update" | "citations.sources.remove" | "citations.bibliography.get" | "citations.bibliography.insert" | "citations.bibliography.rebuild" | "citations.bibliography.configure" | "citations.bibliography.remove" | "authorities.list" | "authorities.get" | "authorities.insert" | "authorities.configure" | "authorities.rebuild" | "authorities.remove" | "authorities.entries.list" | "authorities.entries.get" | "authorities.entries.insert" | "authorities.entries.update" | "authorities.entries.remove" | "diff.capture" | "diff.compare" | "diff.apply" | "export.toDocx" | "protection.get" | "protection.setEditingRestriction" | "protection.clearEditingRestriction" | "permissionRanges.list" | "permissionRanges.get" | "permissionRanges.create" | "permissionRanges.remove" | "permissionRanges.updatePrincipal" | "customXml.parts.list" | "customXml.parts.get" | "customXml.parts.create" | "customXml.parts.patch" | "customXml.parts.remove" | "metadata.attach" | "metadata.list" | "metadata.get" | "metadata.update" | "metadata.remove" | "metadata.resolve";
108283
108431
  available: ({
108284
108432
  kind: "supported";
108285
108433
  }) | ({
@@ -112175,6 +112323,98 @@ export type DocHeaderFootersPartsDeleteResult = {
112175
112323
  refId: string;
112176
112324
  partPath: string;
112177
112325
  };
112326
+ export type DocWatermarksApplyResult = {
112327
+ success: true;
112328
+ watermarks: Array<{
112329
+ watermarkId: string;
112330
+ owner: {
112331
+ refId: string;
112332
+ partPath: string;
112333
+ };
112334
+ effectiveIn: Array<{
112335
+ kind: "headerFooterSlot";
112336
+ section: {
112337
+ kind: "section";
112338
+ sectionId: string;
112339
+ };
112340
+ headerFooterKind: "header";
112341
+ variant: "default" | "first" | "even";
112342
+ }>;
112343
+ watermark: ({
112344
+ kind: "text";
112345
+ text: string;
112346
+ fontFamily?: string;
112347
+ fontSizePt?: "auto" | number;
112348
+ bold?: boolean;
112349
+ italic?: boolean;
112350
+ color?: string;
112351
+ opacity?: number;
112352
+ orientation?: "horizontal" | "diagonal";
112353
+ placement?: {
112354
+ widthPt?: number;
112355
+ heightPt?: number;
112356
+ rotationDegrees?: number;
112357
+ behindText?: boolean;
112358
+ horizontal?: {
112359
+ relativeFrom: "page" | "margin";
112360
+ alignment?: "left" | "center" | "right";
112361
+ offsetPt?: number;
112362
+ };
112363
+ vertical?: {
112364
+ relativeFrom: "page" | "margin";
112365
+ alignment?: "top" | "center" | "bottom";
112366
+ offsetPt?: number;
112367
+ };
112368
+ };
112369
+ }) | ({
112370
+ kind: "picture";
112371
+ mediaPartPath: string;
112372
+ contentType: string;
112373
+ scalePercent: "auto" | 50 | 100 | 150 | 200 | 500;
112374
+ widthPt: number;
112375
+ heightPt: number;
112376
+ lockAspectRatio: boolean;
112377
+ washout: boolean;
112378
+ opacity: number;
112379
+ placement: {
112380
+ widthPt?: number;
112381
+ heightPt?: number;
112382
+ rotationDegrees?: number;
112383
+ behindText?: boolean;
112384
+ horizontal?: {
112385
+ relativeFrom: "page" | "margin";
112386
+ alignment?: "left" | "center" | "right";
112387
+ offsetPt?: number;
112388
+ };
112389
+ vertical?: {
112390
+ relativeFrom: "page" | "margin";
112391
+ alignment?: "top" | "center" | "bottom";
112392
+ offsetPt?: number;
112393
+ };
112394
+ };
112395
+ });
112396
+ }>;
112397
+ affectedSlots: Array<{
112398
+ kind: "headerFooterSlot";
112399
+ section: {
112400
+ kind: "section";
112401
+ sectionId: string;
112402
+ };
112403
+ headerFooterKind: "header";
112404
+ variant: "default" | "first" | "even";
112405
+ }>;
112406
+ preservedSlots: Array<{
112407
+ kind: "headerFooterSlot";
112408
+ section: {
112409
+ kind: "section";
112410
+ sectionId: string;
112411
+ };
112412
+ headerFooterKind: "header";
112413
+ variant: "default" | "first" | "even";
112414
+ }>;
112415
+ evaluatedRevision: string;
112416
+ dryRun?: true;
112417
+ };
112178
112418
  export type DocWatermarksListResult = {
112179
112419
  evaluatedRevision: string;
112180
112420
  total: number;
@@ -147381,6 +147621,110 @@ export interface DocHeaderFootersPartsDeleteBoundParams {
147381
147621
  refId: string;
147382
147622
  };
147383
147623
  }
147624
+ export interface DocWatermarksApplyBoundParams {
147625
+ out?: string;
147626
+ force?: boolean;
147627
+ expectedRevision?: string;
147628
+ changeMode?: string;
147629
+ dryRun?: boolean;
147630
+ target: ({
147631
+ kind: "document";
147632
+ }) | ({
147633
+ kind: "headerFooterSlots";
147634
+ slots: Array<{
147635
+ kind: "headerFooterSlot";
147636
+ section: {
147637
+ kind: "section";
147638
+ sectionId: string;
147639
+ };
147640
+ headerFooterKind: "header";
147641
+ variant: "default" | "first" | "even";
147642
+ }>;
147643
+ });
147644
+ action: string;
147645
+ watermark?: ({
147646
+ kind: "text";
147647
+ text: string;
147648
+ fontFamily?: string;
147649
+ fontSizePt?: "auto" | number;
147650
+ bold?: boolean;
147651
+ italic?: boolean;
147652
+ color?: string;
147653
+ opacity?: number;
147654
+ orientation?: "horizontal" | "diagonal";
147655
+ placement?: {
147656
+ widthPt?: number;
147657
+ heightPt?: number;
147658
+ rotationDegrees?: number;
147659
+ behindText?: boolean;
147660
+ horizontal?: {
147661
+ relativeFrom: "page" | "margin";
147662
+ alignment?: "left" | "center" | "right";
147663
+ offsetPt?: number;
147664
+ };
147665
+ vertical?: {
147666
+ relativeFrom: "page" | "margin";
147667
+ alignment?: "top" | "center" | "bottom";
147668
+ offsetPt?: number;
147669
+ };
147670
+ };
147671
+ }) | ({
147672
+ kind: "picture";
147673
+ src: string;
147674
+ scalePercent?: "auto" | 50 | 100 | 150 | 200 | 500;
147675
+ widthPt?: number;
147676
+ heightPt?: number;
147677
+ lockAspectRatio?: boolean;
147678
+ washout?: boolean;
147679
+ opacity?: number;
147680
+ placement?: {
147681
+ widthPt?: number;
147682
+ heightPt?: number;
147683
+ rotationDegrees?: number;
147684
+ behindText?: boolean;
147685
+ horizontal?: {
147686
+ relativeFrom: "page" | "margin";
147687
+ alignment?: "left" | "center" | "right";
147688
+ offsetPt?: number;
147689
+ };
147690
+ vertical?: {
147691
+ relativeFrom: "page" | "margin";
147692
+ alignment?: "top" | "center" | "bottom";
147693
+ offsetPt?: number;
147694
+ };
147695
+ };
147696
+ }) | ({
147697
+ kind: "picture";
147698
+ src?: unknown;
147699
+ scalePercent?: "auto" | 50 | 100 | 150 | 200 | 500;
147700
+ widthPt?: number;
147701
+ heightPt?: number;
147702
+ lockAspectRatio?: boolean;
147703
+ washout?: boolean;
147704
+ opacity?: number;
147705
+ placement?: {
147706
+ widthPt?: number;
147707
+ heightPt?: number;
147708
+ rotationDegrees?: number;
147709
+ behindText?: boolean;
147710
+ horizontal?: {
147711
+ relativeFrom: "page" | "margin";
147712
+ alignment?: "left" | "center" | "right";
147713
+ offsetPt?: number;
147714
+ };
147715
+ vertical?: {
147716
+ relativeFrom: "page" | "margin";
147717
+ alignment?: "top" | "center" | "bottom";
147718
+ offsetPt?: number;
147719
+ };
147720
+ };
147721
+ source: {
147722
+ kind: "existing";
147723
+ watermarkId: string;
147724
+ };
147725
+ });
147726
+ watermarkIds?: string[];
147727
+ }
147384
147728
  export interface DocWatermarksListBoundParams {
147385
147729
  target?: ({
147386
147730
  kind: "document";
@@ -153027,6 +153371,7 @@ export declare function createDocApi(runtime: RuntimeInvoker): {
153027
153371
  };
153028
153372
  };
153029
153373
  watermarks: {
153374
+ apply: (params: DocWatermarksApplyParams, options?: InvokeOptions) => Promise<DocWatermarksApplyResult>;
153030
153375
  list: (params?: DocWatermarksListParams, options?: InvokeOptions) => Promise<DocWatermarksListResult>;
153031
153376
  insert: (params: DocWatermarksInsertParams, options?: InvokeOptions) => Promise<DocWatermarksInsertResult>;
153032
153377
  replace: (params: DocWatermarksReplaceParams, options?: InvokeOptions) => Promise<DocWatermarksReplaceResult>;
@@ -153595,6 +153940,7 @@ export declare function createBoundDocApi(runtime: RuntimeInvoker): {
153595
153940
  };
153596
153941
  };
153597
153942
  watermarks: {
153943
+ apply: (params: DocWatermarksApplyBoundParams, options?: InvokeOptions) => Promise<DocWatermarksApplyResult>;
153598
153944
  list: (params?: DocWatermarksListBoundParams, options?: InvokeOptions) => Promise<DocWatermarksListResult>;
153599
153945
  insert: (params: DocWatermarksInsertBoundParams, options?: InvokeOptions) => Promise<DocWatermarksInsertResult>;
153600
153946
  replace: (params: DocWatermarksReplaceBoundParams, options?: InvokeOptions) => Promise<DocWatermarksReplaceResult>;
@@ -344,6 +344,7 @@ export function createDocApi(runtime) {
344
344
  },
345
345
  },
346
346
  watermarks: {
347
+ apply: (params, options) => runtime.invoke(CONTRACT.operations["doc.watermarks.apply"], params, options),
347
348
  list: (params = {}, options) => runtime.invoke(CONTRACT.operations["doc.watermarks.list"], params, options),
348
349
  insert: (params, options) => runtime.invoke(CONTRACT.operations["doc.watermarks.insert"], params, options),
349
350
  replace: (params, options) => runtime.invoke(CONTRACT.operations["doc.watermarks.replace"], params, options),
@@ -916,6 +917,7 @@ export function createBoundDocApi(runtime) {
916
917
  },
917
918
  },
918
919
  watermarks: {
920
+ apply: (params, options) => runtime.invoke(CONTRACT.operations["doc.watermarks.apply"], params, options),
919
921
  list: (params = {}, options) => runtime.invoke(CONTRACT.operations["doc.watermarks.list"], params, options),
920
922
  insert: (params, options) => runtime.invoke(CONTRACT.operations["doc.watermarks.insert"], params, options),
921
923
  replace: (params, options) => runtime.invoke(CONTRACT.operations["doc.watermarks.replace"], params, options),