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

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;
@@ -105251,6 +105357,12 @@ export type DocCapabilitiesGetResult = {
105251
105357
  dryRun: boolean;
105252
105358
  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
105359
  };
105360
+ "watermarks.apply": {
105361
+ available: boolean;
105362
+ tracked: boolean;
105363
+ dryRun: boolean;
105364
+ 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">;
105365
+ };
105254
105366
  "watermarks.list": {
105255
105367
  available: boolean;
105256
105368
  tracked: boolean;
@@ -108279,7 +108391,7 @@ export type DocCapabilitiesCheckResult = ({
108279
108391
  };
108280
108392
  });
108281
108393
  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";
108394
+ 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
108395
  available: ({
108284
108396
  kind: "supported";
108285
108397
  }) | ({
@@ -112175,6 +112287,98 @@ export type DocHeaderFootersPartsDeleteResult = {
112175
112287
  refId: string;
112176
112288
  partPath: string;
112177
112289
  };
112290
+ export type DocWatermarksApplyResult = {
112291
+ success: true;
112292
+ watermarks: Array<{
112293
+ watermarkId: string;
112294
+ owner: {
112295
+ refId: string;
112296
+ partPath: string;
112297
+ };
112298
+ effectiveIn: Array<{
112299
+ kind: "headerFooterSlot";
112300
+ section: {
112301
+ kind: "section";
112302
+ sectionId: string;
112303
+ };
112304
+ headerFooterKind: "header";
112305
+ variant: "default" | "first" | "even";
112306
+ }>;
112307
+ watermark: ({
112308
+ kind: "text";
112309
+ text: string;
112310
+ fontFamily?: string;
112311
+ fontSizePt?: "auto" | number;
112312
+ bold?: boolean;
112313
+ italic?: boolean;
112314
+ color?: string;
112315
+ opacity?: number;
112316
+ orientation?: "horizontal" | "diagonal";
112317
+ placement?: {
112318
+ widthPt?: number;
112319
+ heightPt?: number;
112320
+ rotationDegrees?: number;
112321
+ behindText?: boolean;
112322
+ horizontal?: {
112323
+ relativeFrom: "page" | "margin";
112324
+ alignment?: "left" | "center" | "right";
112325
+ offsetPt?: number;
112326
+ };
112327
+ vertical?: {
112328
+ relativeFrom: "page" | "margin";
112329
+ alignment?: "top" | "center" | "bottom";
112330
+ offsetPt?: number;
112331
+ };
112332
+ };
112333
+ }) | ({
112334
+ kind: "picture";
112335
+ mediaPartPath: string;
112336
+ contentType: string;
112337
+ scalePercent: "auto" | 50 | 100 | 150 | 200 | 500;
112338
+ widthPt: number;
112339
+ heightPt: number;
112340
+ lockAspectRatio: boolean;
112341
+ washout: boolean;
112342
+ opacity: number;
112343
+ placement: {
112344
+ widthPt?: number;
112345
+ heightPt?: number;
112346
+ rotationDegrees?: number;
112347
+ behindText?: boolean;
112348
+ horizontal?: {
112349
+ relativeFrom: "page" | "margin";
112350
+ alignment?: "left" | "center" | "right";
112351
+ offsetPt?: number;
112352
+ };
112353
+ vertical?: {
112354
+ relativeFrom: "page" | "margin";
112355
+ alignment?: "top" | "center" | "bottom";
112356
+ offsetPt?: number;
112357
+ };
112358
+ };
112359
+ });
112360
+ }>;
112361
+ affectedSlots: Array<{
112362
+ kind: "headerFooterSlot";
112363
+ section: {
112364
+ kind: "section";
112365
+ sectionId: string;
112366
+ };
112367
+ headerFooterKind: "header";
112368
+ variant: "default" | "first" | "even";
112369
+ }>;
112370
+ preservedSlots: Array<{
112371
+ kind: "headerFooterSlot";
112372
+ section: {
112373
+ kind: "section";
112374
+ sectionId: string;
112375
+ };
112376
+ headerFooterKind: "header";
112377
+ variant: "default" | "first" | "even";
112378
+ }>;
112379
+ evaluatedRevision: string;
112380
+ dryRun?: true;
112381
+ };
112178
112382
  export type DocWatermarksListResult = {
112179
112383
  evaluatedRevision: string;
112180
112384
  total: number;
@@ -147381,6 +147585,110 @@ export interface DocHeaderFootersPartsDeleteBoundParams {
147381
147585
  refId: string;
147382
147586
  };
147383
147587
  }
147588
+ export interface DocWatermarksApplyBoundParams {
147589
+ out?: string;
147590
+ force?: boolean;
147591
+ expectedRevision?: string;
147592
+ changeMode?: string;
147593
+ dryRun?: boolean;
147594
+ target: ({
147595
+ kind: "document";
147596
+ }) | ({
147597
+ kind: "headerFooterSlots";
147598
+ slots: Array<{
147599
+ kind: "headerFooterSlot";
147600
+ section: {
147601
+ kind: "section";
147602
+ sectionId: string;
147603
+ };
147604
+ headerFooterKind: "header";
147605
+ variant: "default" | "first" | "even";
147606
+ }>;
147607
+ });
147608
+ action: string;
147609
+ watermark?: ({
147610
+ kind: "text";
147611
+ text: string;
147612
+ fontFamily?: string;
147613
+ fontSizePt?: "auto" | number;
147614
+ bold?: boolean;
147615
+ italic?: boolean;
147616
+ color?: string;
147617
+ opacity?: number;
147618
+ orientation?: "horizontal" | "diagonal";
147619
+ placement?: {
147620
+ widthPt?: number;
147621
+ heightPt?: number;
147622
+ rotationDegrees?: number;
147623
+ behindText?: boolean;
147624
+ horizontal?: {
147625
+ relativeFrom: "page" | "margin";
147626
+ alignment?: "left" | "center" | "right";
147627
+ offsetPt?: number;
147628
+ };
147629
+ vertical?: {
147630
+ relativeFrom: "page" | "margin";
147631
+ alignment?: "top" | "center" | "bottom";
147632
+ offsetPt?: number;
147633
+ };
147634
+ };
147635
+ }) | ({
147636
+ kind: "picture";
147637
+ src: string;
147638
+ scalePercent?: "auto" | 50 | 100 | 150 | 200 | 500;
147639
+ widthPt?: number;
147640
+ heightPt?: number;
147641
+ lockAspectRatio?: boolean;
147642
+ washout?: boolean;
147643
+ opacity?: number;
147644
+ placement?: {
147645
+ widthPt?: number;
147646
+ heightPt?: number;
147647
+ rotationDegrees?: number;
147648
+ behindText?: boolean;
147649
+ horizontal?: {
147650
+ relativeFrom: "page" | "margin";
147651
+ alignment?: "left" | "center" | "right";
147652
+ offsetPt?: number;
147653
+ };
147654
+ vertical?: {
147655
+ relativeFrom: "page" | "margin";
147656
+ alignment?: "top" | "center" | "bottom";
147657
+ offsetPt?: number;
147658
+ };
147659
+ };
147660
+ }) | ({
147661
+ kind: "picture";
147662
+ src?: unknown;
147663
+ scalePercent?: "auto" | 50 | 100 | 150 | 200 | 500;
147664
+ widthPt?: number;
147665
+ heightPt?: number;
147666
+ lockAspectRatio?: boolean;
147667
+ washout?: boolean;
147668
+ opacity?: number;
147669
+ placement?: {
147670
+ widthPt?: number;
147671
+ heightPt?: number;
147672
+ rotationDegrees?: number;
147673
+ behindText?: boolean;
147674
+ horizontal?: {
147675
+ relativeFrom: "page" | "margin";
147676
+ alignment?: "left" | "center" | "right";
147677
+ offsetPt?: number;
147678
+ };
147679
+ vertical?: {
147680
+ relativeFrom: "page" | "margin";
147681
+ alignment?: "top" | "center" | "bottom";
147682
+ offsetPt?: number;
147683
+ };
147684
+ };
147685
+ source: {
147686
+ kind: "existing";
147687
+ watermarkId: string;
147688
+ };
147689
+ });
147690
+ watermarkIds?: string[];
147691
+ }
147384
147692
  export interface DocWatermarksListBoundParams {
147385
147693
  target?: ({
147386
147694
  kind: "document";
@@ -153027,6 +153335,7 @@ export declare function createDocApi(runtime: RuntimeInvoker): {
153027
153335
  };
153028
153336
  };
153029
153337
  watermarks: {
153338
+ apply: (params: DocWatermarksApplyParams, options?: InvokeOptions) => Promise<DocWatermarksApplyResult>;
153030
153339
  list: (params?: DocWatermarksListParams, options?: InvokeOptions) => Promise<DocWatermarksListResult>;
153031
153340
  insert: (params: DocWatermarksInsertParams, options?: InvokeOptions) => Promise<DocWatermarksInsertResult>;
153032
153341
  replace: (params: DocWatermarksReplaceParams, options?: InvokeOptions) => Promise<DocWatermarksReplaceResult>;
@@ -153595,6 +153904,7 @@ export declare function createBoundDocApi(runtime: RuntimeInvoker): {
153595
153904
  };
153596
153905
  };
153597
153906
  watermarks: {
153907
+ apply: (params: DocWatermarksApplyBoundParams, options?: InvokeOptions) => Promise<DocWatermarksApplyResult>;
153598
153908
  list: (params?: DocWatermarksListBoundParams, options?: InvokeOptions) => Promise<DocWatermarksListResult>;
153599
153909
  insert: (params: DocWatermarksInsertBoundParams, options?: InvokeOptions) => Promise<DocWatermarksInsertResult>;
153600
153910
  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),