@stll/folio-core 0.74.0 → 0.75.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-edits/clean-text.d.ts +4 -1
- package/dist/ai-edits/clean-text.js +21 -7
- package/dist/ai-edits/headless.d.ts +5 -2
- package/dist/ai-edits/headless.js +18 -9
- package/dist/ai-edits/note-references.d.ts +1 -1
- package/dist/ai-edits/note-references.js +1 -1
- package/dist/ai-edits/pending-suggestions.d.ts +9 -7
- package/dist/ai-edits/pending-suggestions.js +134 -88
- package/dist/ai-edits/pendingJoin.d.ts +5 -1
- package/dist/ai-edits/pendingJoin.js +6 -2
- package/dist/ai-edits/retired-comment-receipts.d.ts +2 -2
- package/dist/ai-edits/retired-comment-receipts.js +3 -18
- package/dist/ai-edits/tracked-batch-fidelity.d.ts +6 -10
- package/dist/ai-edits/tracked-batch-fidelity.js +3 -182
- package/dist/canonical/canonicalBatchReview.d.ts +4 -1
- package/dist/canonical/canonicalBatchReview.js +32 -14
- package/dist/canonical/canonicalComments.d.ts +6 -2
- package/dist/canonical/canonicalComments.js +8 -4
- package/dist/canonical/canonicalPublicOperations.js +29 -9
- package/dist/canonical/canonicalRefusalGrounds.d.ts +4 -0
- package/dist/canonical/canonicalRefusalGrounds.js +56 -0
- package/dist/canonical/canonicalSession.d.ts +12 -6
- package/dist/canonical/canonicalSession.js +116 -121
- package/dist/canonical/canonicalTrackedBatchFidelity.js +3 -3
- package/dist/compare/inline-atoms.d.ts +35 -41
- package/dist/compare/inline-atoms.js +2 -465
- package/dist/compare/section-boundary-properties.d.ts +3 -30
- package/dist/compare/section-boundary-properties.js +4 -72
- package/dist/controller/canonicalClipboard.js +43 -42
- package/dist/controller/canonicalComposition.d.ts +1 -1
- package/dist/controller/canonicalComposition.js +5 -5
- package/dist/controller/canonicalInput.d.ts +4 -2
- package/dist/controller/canonicalInput.js +33 -16
- package/dist/controller/canonicalStoryEditor.d.ts +2 -3
- package/dist/controller/canonicalStoryEditor.js +43 -25
- package/dist/controller/canonicalStructure.d.ts +19 -2
- package/dist/controller/canonicalStructure.js +139 -42
- package/dist/controller/deferredDisplayListPainter.d.ts +8 -0
- package/dist/controller/deferredDisplayListPainter.js +34 -0
- package/dist/controller/folioEditor.js +4 -2
- package/dist/controller/headerFooterEditorManager.js +3 -17
- package/dist/controller/hiddenEditorApi.d.ts +24 -3
- package/dist/controller/hiddenEditorApi.js +2 -0
- package/dist/controller/hiddenEditorManager.js +132 -189
- package/dist/controller/layoutPipeline.d.ts +4 -86
- package/dist/controller/layoutPipeline.js +8 -727
- package/dist/controller/layoutPipelineExecution.d.ts +94 -0
- package/dist/controller/layoutPipelineExecution.js +730 -0
- package/dist/controller/noteEditorManager.js +3 -16
- package/dist/docx/blockContentParser.d.ts +1 -3
- package/dist/docx/blockContentParser.js +3 -10
- package/dist/docx/canonicalSave.d.ts +4 -3
- package/dist/docx/canonicalSave.js +4 -3
- package/dist/docx/listMarkerComputation.d.ts +24 -17
- package/dist/docx/listMarkerComputation.js +31 -60
- package/dist/docx/listModelNormalization.js +8 -15
- package/dist/docx/rezip.d.ts +16 -3
- package/dist/docx/rezip.js +35 -9
- package/dist/docx/selectiveSave.js +13 -5
- package/dist/docx/server/templatePlan/apply.js +38 -3
- package/dist/docx/server/templatePlan/blocks.d.ts +16 -1
- package/dist/docx/server/templatePlan/blocks.js +93 -7
- package/dist/docx/server/templatePlan/builders.d.ts +37 -2
- package/dist/docx/server/templatePlan/builders.js +196 -5
- package/dist/docx/server/templatePlan/emit.d.ts +2 -0
- package/dist/docx/server/templatePlan/emit.js +2 -0
- package/dist/docx/server/templatePlan/inspect.js +19 -52
- package/dist/docx/server/templatePlan/labels.d.ts +7 -2
- package/dist/docx/server/templatePlan/labels.js +104 -22
- package/dist/docx/server/templatePlan/plan.d.ts +13 -1
- package/dist/docx/server/templatePlan/plan.js +22 -7
- package/dist/docx/server/templatePlan/planShape.js +31 -2
- package/dist/docx/server/templatePlan/story.d.ts +8 -0
- package/dist/docx/server/templatePlan/story.js +11 -1
- package/dist/docx/server/templatePlan/types.d.ts +138 -16
- package/dist/docx/server/templatePlan/verify.js +50 -9
- package/dist/i18n/messages/ar.gen.js +1 -0
- package/dist/i18n/messages/catalogs.gen.d.ts +17 -0
- package/dist/i18n/messages/catalogs.gen.js +17 -0
- package/dist/i18n/messages/cs.gen.js +1 -0
- package/dist/i18n/messages/de.gen.js +1 -0
- package/dist/i18n/messages/en.gen.js +1 -0
- package/dist/i18n/messages/es.gen.js +1 -0
- package/dist/i18n/messages/et.gen.js +1 -0
- package/dist/i18n/messages/fr.gen.js +1 -0
- package/dist/i18n/messages/he.gen.js +1 -0
- package/dist/i18n/messages/hi.gen.js +1 -0
- package/dist/i18n/messages/hu.gen.js +1 -0
- package/dist/i18n/messages/lt.gen.js +1 -0
- package/dist/i18n/messages/lv.gen.js +1 -0
- package/dist/i18n/messages/messages.gen.d.ts +1 -0
- package/dist/i18n/messages/pl.gen.js +1 -0
- package/dist/i18n/messages/pt-BR.gen.js +1 -0
- package/dist/i18n/messages/sk.gen.js +1 -0
- package/dist/i18n/messages/tr.gen.js +1 -0
- package/dist/i18n/messages/zh-CN.gen.js +1 -0
- package/dist/layout-bridge/convert/toFlowBlocks.js +0 -12
- package/dist/layout-bridge/convert/topLevelConversion.js +1 -10
- package/dist/prosemirror/extensions/features/ImagePasteExtension.js +1 -1
- package/dist/prosemirror/listMarker.d.ts +1 -6
- package/dist/prosemirror/listMarker.js +4 -56
- package/dist/server.d.ts +2 -2
- package/dist/types/canonicalCapabilities.d.ts +40 -45
- package/dist/types/canonicalCapabilities.js +51 -43
- package/dist/types/canonicalComments.d.ts +2 -2
- package/dist/types/canonicalSections.d.ts +2 -2
- package/dist/utils/clipboard.d.ts +2 -28
- package/dist/utils/clipboard.js +1 -96
- package/dist/utils/clipboardFiles.d.ts +27 -0
- package/dist/utils/clipboardFiles.js +98 -0
- package/dist/utils/rulerControl.d.ts +1 -0
- package/dist/utils/rulerControl.js +2 -1
- package/package.json +2 -2
|
@@ -262,8 +262,12 @@ const pendingMarkEditOf = (type) => {
|
|
|
262
262
|
if (type === "replaceBlock") return "wholeText";
|
|
263
263
|
return "inline";
|
|
264
264
|
};
|
|
265
|
-
/**
|
|
266
|
-
|
|
265
|
+
/**
|
|
266
|
+
* The shared property boundary, independent of the paragraph's
|
|
267
|
+
* representation: any mark accepting removes, including one added and then
|
|
268
|
+
* deleted by another author, takes the edited properties with it.
|
|
269
|
+
*/
|
|
270
|
+
const pendingParagraphPropertiesRefusal = (mark) => markGoesWhenAccepted(mark) ? PENDING_PARAGRAPH_MARK_PROPERTY_REFUSAL : void 0;
|
|
267
271
|
/**
|
|
268
272
|
* The refusal an operation that places no block meets on a paragraph whose
|
|
269
273
|
* mark is pending deletion, by the rules the default engine applies: its
|
|
@@ -12,8 +12,8 @@ type RetiredCommentReceiptsOptions = {
|
|
|
12
12
|
operations: readonly Pick<FolioAIEditOperation, "id" | "type">[];
|
|
13
13
|
/** Canonical inline changes can relocate markers before later steps run. */
|
|
14
14
|
sourceRanges?: ReadonlyMap<string, readonly TextSpan[]>;
|
|
15
|
-
/**
|
|
16
|
-
acceptedCommentIds
|
|
15
|
+
/** Anchors in the accepted story on either side of the batch. */
|
|
16
|
+
acceptedCommentIds: (side: "before" | "after") => ReadonlySet<number> | null;
|
|
17
17
|
};
|
|
18
18
|
/** Report full anchor removal only where one operation owns the deletion. */
|
|
19
19
|
export declare const addRetiredCommentReceipts: ({ before, after, applied, operations, sourceRanges, acceptedCommentIds }: RetiredCommentReceiptsOptions) => void;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import { acceptAllChanges, rejectEverySuggestion } from "../prosemirror/commands/comments.js";
|
|
2
|
-
import { createDocumentNumberingPlugin, getStatedDocumentNumbering } from "../prosemirror/plugins/documentNumbering.js";
|
|
3
|
-
import { getDocumentStyleResolver } from "../prosemirror/plugins/documentStyleState.js";
|
|
4
|
-
import { createDocumentStyleContextPlugin } from "../prosemirror/plugins/documentStyles.js";
|
|
5
1
|
import { isZeroWidthAnchor } from "../prosemirror/zeroWidthAnchors.js";
|
|
6
|
-
import {
|
|
2
|
+
import { commentAnchorIdsForNode, coveredCommentIdsInProseDoc, isCommentAnchorCarrier } from "./comment-lifecycle.js";
|
|
7
3
|
import { comparisonApplying } from "./note-references.js";
|
|
8
|
-
import { EditorState } from "prosemirror-state";
|
|
9
4
|
// src/ai-edits/retired-comment-receipts.ts
|
|
10
5
|
const deletionOperations = /* @__PURE__ */ new Set([
|
|
11
6
|
"deleteBlock",
|
|
@@ -26,16 +21,6 @@ const deletedParagraphMark = (node) => {
|
|
|
26
21
|
const marker = node.attrs["pPrMark"];
|
|
27
22
|
return objectAttr(marker, "kind") === "del" ? objectAttr(marker, "info") : void 0;
|
|
28
23
|
};
|
|
29
|
-
const acceptedComments = (before, doc) => {
|
|
30
|
-
const state = rejectEverySuggestion(EditorState.create({
|
|
31
|
-
doc,
|
|
32
|
-
plugins: [createDocumentNumberingPlugin(getStatedDocumentNumbering(before)), createDocumentStyleContextPlugin(getDocumentStyleResolver(before))]
|
|
33
|
-
}));
|
|
34
|
-
let accepted = state.doc;
|
|
35
|
-
return acceptAllChanges()(state, (transaction) => {
|
|
36
|
-
accepted = transaction.doc;
|
|
37
|
-
}) ? anchoredCommentIdsInProseDoc(accepted) : null;
|
|
38
|
-
};
|
|
39
24
|
const candidatesOf = (coverage) => [...coverage].flatMap(([commentId, owner]) => owner === null ? [] : [{
|
|
40
25
|
commentId,
|
|
41
26
|
owner
|
|
@@ -147,8 +132,8 @@ const addRetiredCommentReceipts = ({ before, after, applied, operations, sourceR
|
|
|
147
132
|
const covering = candidates.filter(({ commentId, owner }) => ownsOriginalCoverage(commentId, owner));
|
|
148
133
|
const owned = covering.filter(({ commentId }) => !foldedComments.has(commentId) || covering.filter((candidate) => candidate.commentId === commentId).length === 1);
|
|
149
134
|
if (owned.length === 0) return;
|
|
150
|
-
const originallyAccepted = acceptedCommentIds
|
|
151
|
-
const finallyAccepted = acceptedCommentIds
|
|
135
|
+
const originallyAccepted = acceptedCommentIds("before");
|
|
136
|
+
const finallyAccepted = acceptedCommentIds("after");
|
|
152
137
|
if (originallyAccepted === null || finallyAccepted === null) return;
|
|
153
138
|
const byOperation = /* @__PURE__ */ new Map();
|
|
154
139
|
for (const { commentId, owner } of owned) {
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { document_d_exports } from "../types/document.js";
|
|
2
|
-
import { EditorState } from "prosemirror-state";
|
|
3
|
-
import { Node } from "prosemirror-model";
|
|
4
|
-
type TrackedBatchFidelityOptions = {
|
|
5
|
-
before: EditorState;
|
|
6
|
-
after: Node;
|
|
7
|
-
createdCommentIds: readonly number[];
|
|
8
|
-
retiredCommentIds?: readonly number[];
|
|
9
|
-
};
|
|
10
2
|
declare const protectionKinds: readonly ["note", "drawing", "field", "comment"];
|
|
11
3
|
type ProtectionKind = (typeof protectionKinds)[number];
|
|
12
4
|
export type Inventory = Record<ProtectionKind, Map<string, number>>;
|
|
5
|
+
/**
|
|
6
|
+
* The protected content `after` holds as a pending deletion and `before` did
|
|
7
|
+
* not: an edit the reviewer sees as deleted, which Accept All may remove.
|
|
8
|
+
*/
|
|
9
|
+
export declare const newlyDeletedProtectedContent: (before: Inventory, after: Inventory) => Inventory;
|
|
10
|
+
export declare const missingProtectedContent: (expected: Inventory, actual: Inventory, retiredCommentIds: readonly number[], deleted?: Inventory) => ProtectionKind | null;
|
|
13
11
|
export declare const sameOriginalBlocks: (before: readonly document_d_exports.BlockContent[], after: readonly document_d_exports.BlockContent[], addedCommentIds: ReadonlySet<number>) => boolean;
|
|
14
12
|
/**
|
|
15
13
|
* The protected content the edited blocks hold as a new tracked deletion,
|
|
@@ -18,6 +16,4 @@ export declare const sameOriginalBlocks: (before: readonly document_d_exports.Bl
|
|
|
18
16
|
export declare const newlyDeletedProtectedBlocks: (before: readonly document_d_exports.BlockContent[], after: readonly document_d_exports.BlockContent[]) => Inventory;
|
|
19
17
|
/** The kind of protected content missing from the accepted blocks. */
|
|
20
18
|
export declare const missingProtectedBlockKind: (before: readonly document_d_exports.BlockContent[], after: readonly document_d_exports.BlockContent[], retiredCommentIds?: readonly number[], deleted?: Inventory) => ProtectionKind | null;
|
|
21
|
-
/** Check both clean readings before any tracked batch can publish its changes. */
|
|
22
|
-
export declare const trackedBatchFidelityError: (options: TrackedBatchFidelityOptions) => string | null;
|
|
23
19
|
export {};
|
|
@@ -4,92 +4,8 @@ import { BLOCK_TREE_DESCENT, visitBlockTreeRecords, visitInlineContentSlots, vis
|
|
|
4
4
|
import { consolidateParagraphContent, formattingEquals } from "../docx/runConsolidator.js";
|
|
5
5
|
import { serializeDocumentPart } from "../docx/serializer/documentSerializer.js";
|
|
6
6
|
import { WORDPROCESSINGML_NAMESPACE_URIS } from "../docx/xmlParser.js";
|
|
7
|
-
import { pluginsForHeadlessRevisionResolution } from "../internal/headlessRevisionResolutionGuard.js";
|
|
8
|
-
import { getSuggestions, projectAllChangesInHeadlessState, rejectEverySuggestion } from "../prosemirror/commands/comments.js";
|
|
9
|
-
import { proseDocToBlocks } from "../prosemirror/conversion/fromProseDoc.js";
|
|
10
|
-
import { isBlockBoundaryNode } from "../prosemirror/keptRangeBoundaries.js";
|
|
11
|
-
import { readRangeAnchorAttrs } from "../prosemirror/rangeAnchorAttrs.js";
|
|
12
|
-
import { commentAnchorIdsForNode, ownCommentAnchorIds } from "./comment-lifecycle.js";
|
|
13
|
-
import { comparisonApplying, noteReferenceOf } from "./note-references.js";
|
|
14
|
-
import { changedTopLevelWindow } from "./result-validation.js";
|
|
15
|
-
import { Result } from "better-result";
|
|
16
7
|
import { mergeRunContent } from "@stll/docx-core/ops";
|
|
17
|
-
import { EditorState } from "prosemirror-state";
|
|
18
|
-
import { Fragment } from "prosemirror-model";
|
|
19
8
|
// src/ai-edits/tracked-batch-fidelity.ts
|
|
20
|
-
const copyRange = (doc, from, to) => {
|
|
21
|
-
if (from === 0 && to === doc.childCount) return doc;
|
|
22
|
-
const nodes = [];
|
|
23
|
-
for (let index = from; index < to; index++) nodes.push(doc.child(index));
|
|
24
|
-
return doc.copy(Fragment.fromArray(nodes));
|
|
25
|
-
};
|
|
26
|
-
const hasStoryBoundary = (doc) => {
|
|
27
|
-
let found = false;
|
|
28
|
-
doc.descendants((node) => {
|
|
29
|
-
found ||= isBlockBoundaryNode(node) || node.type.name === "rangeAnchor" || node.type.name === "bookmarkBoundary" || node.type.name === "moveRangeBoundary" || node.attrs["_sectionProperties"] != null || noteReferenceOf(node) !== null || commentAnchorIdsForNode(node).length > 0;
|
|
30
|
-
return !found;
|
|
31
|
-
});
|
|
32
|
-
return found;
|
|
33
|
-
};
|
|
34
|
-
const isStableBoundary = (node) => node.type.name === "paragraph" && node.attrs["pPrMark"] == null;
|
|
35
|
-
const hasParagraphMark = (node) => node.type.name === "paragraph" && node.attrs["pPrMark"] != null;
|
|
36
|
-
/** Include the neighbors a paragraph join or boundary relocation may reach. */
|
|
37
|
-
const resolutionWindow = (before, after) => {
|
|
38
|
-
const window = changedTopLevelWindow(before, after);
|
|
39
|
-
if (window === null) return null;
|
|
40
|
-
let { from, beforeTo, afterTo } = window;
|
|
41
|
-
while (from > 0) {
|
|
42
|
-
from--;
|
|
43
|
-
if (isStableBoundary(before.child(from))) {
|
|
44
|
-
const predecessor = before.maybeChild(from - 1);
|
|
45
|
-
if (predecessor === null || !hasParagraphMark(predecessor) && !isBlockBoundaryNode(predecessor)) break;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
while (beforeTo < before.childCount && afterTo < after.childCount) {
|
|
49
|
-
const boundary = before.child(beforeTo);
|
|
50
|
-
beforeTo++;
|
|
51
|
-
afterTo++;
|
|
52
|
-
if (isStableBoundary(boundary)) break;
|
|
53
|
-
}
|
|
54
|
-
const beforeWindow = copyRange(before, from, beforeTo);
|
|
55
|
-
const afterWindow = copyRange(after, from, afterTo);
|
|
56
|
-
if (hasStoryBoundary(beforeWindow) || hasStoryBoundary(afterWindow)) return {
|
|
57
|
-
before,
|
|
58
|
-
after
|
|
59
|
-
};
|
|
60
|
-
return {
|
|
61
|
-
before: beforeWindow,
|
|
62
|
-
after: afterWindow
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* Comments added by an edit batch also exist outside its tracked revisions.
|
|
67
|
-
* Only the added comments' own anchors go; an older comment's reference
|
|
68
|
-
* inside an added comment's range stays, without the added comment's mark.
|
|
69
|
-
*/
|
|
70
|
-
const withoutAddedComments = (node, added) => {
|
|
71
|
-
const name = node.type.name;
|
|
72
|
-
if ((name === "commentReference" || name === "commentRangeBoundary") && ownCommentAnchorIds(node).some((id) => added.has(id))) return null;
|
|
73
|
-
if (name === "rangeAnchor") {
|
|
74
|
-
const parsed = readRangeAnchorAttrs(node);
|
|
75
|
-
if (parsed.ok) {
|
|
76
|
-
const markers = parsed.value.markers.filter((marker) => marker.type !== "commentRangeStart" && marker.type !== "commentRangeEnd" || !added.has(marker.id));
|
|
77
|
-
if (markers.length === 0) return null;
|
|
78
|
-
if (markers.length !== parsed.value.markers.length) return node.type.create({
|
|
79
|
-
...node.attrs,
|
|
80
|
-
markers
|
|
81
|
-
}, null, node.marks);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
const marks = node.marks.filter((mark) => mark.type.name !== "comment" || !added.has(mark.attrs["commentId"]));
|
|
85
|
-
if (node.isLeaf) return node.mark(marks);
|
|
86
|
-
const children = [];
|
|
87
|
-
node.forEach((child) => {
|
|
88
|
-
const kept = withoutAddedComments(child, added);
|
|
89
|
-
if (kept !== null) children.push(kept);
|
|
90
|
-
});
|
|
91
|
-
return node.copy(Fragment.fromArray(children)).mark(marks);
|
|
92
|
-
};
|
|
93
9
|
const protectionKinds = [
|
|
94
10
|
"note",
|
|
95
11
|
"drawing",
|
|
@@ -99,61 +15,11 @@ const protectionKinds = [
|
|
|
99
15
|
const add = (items, key) => {
|
|
100
16
|
items.set(key, (items.get(key) ?? 0) + 1);
|
|
101
17
|
};
|
|
102
|
-
const isTrackedDeletion = (node) => node.marks.some(({ type }) => type.name === "deletion");
|
|
103
|
-
/**
|
|
104
|
-
* The protected content of `doc`; with `deletedOnly`, only the notes,
|
|
105
|
-
* drawings and fields that are themselves pending deletion, which Accept All
|
|
106
|
-
* removes as the reviewer sees it.
|
|
107
|
-
*/
|
|
108
|
-
const protectedContent = (doc, deletedOnly = false) => {
|
|
109
|
-
const inventory = {
|
|
110
|
-
note: /* @__PURE__ */ new Map(),
|
|
111
|
-
drawing: /* @__PURE__ */ new Map(),
|
|
112
|
-
field: /* @__PURE__ */ new Map(),
|
|
113
|
-
comment: /* @__PURE__ */ new Map()
|
|
114
|
-
};
|
|
115
|
-
const comments = /* @__PURE__ */ new Set();
|
|
116
|
-
let hasComment = false;
|
|
117
|
-
doc.descendants((node) => {
|
|
118
|
-
if (deletedOnly && !isTrackedDeletion(node)) return true;
|
|
119
|
-
if (deletedOnly && node.type.name === "textBoxAnchor") add(inventory.drawing, JSON.stringify(["textBox", node.attrs["anchorId"]]));
|
|
120
|
-
const note = noteReferenceOf(node);
|
|
121
|
-
if (note !== null) inventory.note.set(JSON.stringify([note.noteType, note.noteId]), 1);
|
|
122
|
-
switch (node.type.name) {
|
|
123
|
-
case "image":
|
|
124
|
-
add(inventory.drawing, JSON.stringify([
|
|
125
|
-
"image",
|
|
126
|
-
node.attrs["rId"] ?? node.attrs["src"],
|
|
127
|
-
node.attrs["docPrId"]
|
|
128
|
-
]));
|
|
129
|
-
break;
|
|
130
|
-
case "shape":
|
|
131
|
-
add(inventory.drawing, JSON.stringify(["shape", node.attrs["shapeId"]]));
|
|
132
|
-
break;
|
|
133
|
-
case "textBox":
|
|
134
|
-
add(inventory.drawing, JSON.stringify(["textBox", node.attrs["_docxAnchorId"]]));
|
|
135
|
-
break;
|
|
136
|
-
case "field":
|
|
137
|
-
case "structuredField": add(inventory.field, String(node.attrs["instruction"]));
|
|
138
|
-
}
|
|
139
|
-
if (deletedOnly) return true;
|
|
140
|
-
for (const id of commentAnchorIdsForNode(node)) {
|
|
141
|
-
comments.add(id);
|
|
142
|
-
hasComment = true;
|
|
143
|
-
}
|
|
144
|
-
return true;
|
|
145
|
-
});
|
|
146
|
-
for (const id of comments) add(inventory.comment, String(id));
|
|
147
|
-
if (hasComment) visitCommentMarkers(proseDocToBlocks(doc, []), ({ item }) => {
|
|
148
|
-
if (item.type === "commentReference") add(inventory.comment, `reference:${String(item.id)}`);
|
|
149
|
-
});
|
|
150
|
-
return inventory;
|
|
151
|
-
};
|
|
152
18
|
/**
|
|
153
19
|
* The protected content `after` holds as a pending deletion and `before` did
|
|
154
20
|
* not: an edit the reviewer sees as deleted, which Accept All may remove.
|
|
155
21
|
*/
|
|
156
|
-
const
|
|
22
|
+
const newlyDeletedProtectedContent = (before, after) => {
|
|
157
23
|
const inventory = {
|
|
158
24
|
note: /* @__PURE__ */ new Map(),
|
|
159
25
|
drawing: /* @__PURE__ */ new Map(),
|
|
@@ -240,7 +106,6 @@ const sameOriginalBlocks = (before, after, addedCommentIds) => {
|
|
|
240
106
|
return other !== void 0 && (block === other || authoredBlock(block) === authoredBlock(other));
|
|
241
107
|
});
|
|
242
108
|
};
|
|
243
|
-
const sameOriginal = (before, after) => before.content.eq(after.content) || sameOriginalBlocks(proseDocToBlocks(before, []), proseDocToBlocks(after, []), /* @__PURE__ */ new Set());
|
|
244
109
|
const modelInventory = (blocks) => {
|
|
245
110
|
const inventory = {
|
|
246
111
|
note: /* @__PURE__ */ new Map(),
|
|
@@ -307,51 +172,7 @@ const deletedModelInventory = (blocks) => {
|
|
|
307
172
|
* The protected content the edited blocks hold as a new tracked deletion,
|
|
308
173
|
* which Accept All removes as the reviewer sees it.
|
|
309
174
|
*/
|
|
310
|
-
const newlyDeletedProtectedBlocks = (before, after) =>
|
|
175
|
+
const newlyDeletedProtectedBlocks = (before, after) => newlyDeletedProtectedContent(deletedModelInventory(before), deletedModelInventory(after));
|
|
311
176
|
/** The kind of protected content missing from the accepted blocks. */
|
|
312
177
|
const missingProtectedBlockKind = (before, after, retiredCommentIds = [], deleted) => missingProtectedContent(modelInventory(before), modelInventory(after), retiredCommentIds, deleted);
|
|
313
|
-
|
|
314
|
-
if (comparisonApplying()) return null;
|
|
315
|
-
const window = resolutionWindow(before.doc, after);
|
|
316
|
-
if (window === null) return null;
|
|
317
|
-
const plugins = pluginsForHeadlessRevisionResolution(before.plugins);
|
|
318
|
-
let original = EditorState.create({
|
|
319
|
-
doc: window.before,
|
|
320
|
-
plugins
|
|
321
|
-
});
|
|
322
|
-
let candidate = EditorState.create({
|
|
323
|
-
doc: window.after,
|
|
324
|
-
plugins
|
|
325
|
-
});
|
|
326
|
-
if (window.before !== before.doc && (getSuggestions(original).length > 0 || getSuggestions(candidate).length > 0)) {
|
|
327
|
-
original = EditorState.create({
|
|
328
|
-
doc: before.doc,
|
|
329
|
-
plugins
|
|
330
|
-
});
|
|
331
|
-
candidate = EditorState.create({
|
|
332
|
-
doc: after,
|
|
333
|
-
plugins
|
|
334
|
-
});
|
|
335
|
-
}
|
|
336
|
-
original = rejectEverySuggestion(original);
|
|
337
|
-
candidate = rejectEverySuggestion(candidate);
|
|
338
|
-
const rejectedBefore = projectAllChangesInHeadlessState(original, "reject");
|
|
339
|
-
const rejectedAfter = projectAllChangesInHeadlessState(candidate, "reject");
|
|
340
|
-
if (rejectedBefore === null || rejectedAfter === null) return "Reject All could not resolve the tracked result.";
|
|
341
|
-
const rejected = createdCommentIds.length === 0 ? rejectedAfter.doc : withoutAddedComments(rejectedAfter.doc, new Set(createdCommentIds));
|
|
342
|
-
if (rejected === null || !sameOriginal(rejectedBefore.doc, rejected)) return "Reject All would change the original content or formatting.";
|
|
343
|
-
const acceptedBefore = projectAllChangesInHeadlessState(original, "accept");
|
|
344
|
-
const acceptedAfter = projectAllChangesInHeadlessState(candidate, "accept");
|
|
345
|
-
if (acceptedBefore === null || acceptedAfter === null) return "Accept All could not resolve the tracked result.";
|
|
346
|
-
const lost = missingProtectedContent(protectedContent(acceptedBefore.doc), protectedContent(acceptedAfter.doc), retiredCommentIds, newlyDeleted(protectedContent(original.doc, true), protectedContent(candidate.doc, true)));
|
|
347
|
-
return lost === null ? null : `Accept All would lose a ${lost}.`;
|
|
348
|
-
};
|
|
349
|
-
/** Check both clean readings before any tracked batch can publish its changes. */
|
|
350
|
-
const trackedBatchFidelityError = (options) => {
|
|
351
|
-
const verdict = Result.try({
|
|
352
|
-
try: () => checkTrackedBatchFidelity(options),
|
|
353
|
-
catch: () => "The tracked result could not be verified."
|
|
354
|
-
});
|
|
355
|
-
return verdict.isOk() ? verdict.value : verdict.error;
|
|
356
|
-
};
|
|
357
|
-
export { missingProtectedBlockKind, newlyDeletedProtectedBlocks, sameOriginalBlocks, trackedBatchFidelityError };
|
|
178
|
+
export { missingProtectedBlockKind, missingProtectedContent, newlyDeletedProtectedBlocks, newlyDeletedProtectedContent, sameOriginalBlocks };
|
|
@@ -19,7 +19,10 @@ export declare const createCanonicalBatchReview: ({ before, after, story }: Cano
|
|
|
19
19
|
original: readonly document_d_exports.BlockContent[];
|
|
20
20
|
edited: readonly document_d_exports.BlockContent[];
|
|
21
21
|
} | null;
|
|
22
|
-
reject
|
|
22
|
+
reject: () => {
|
|
23
|
+
original: readonly document_d_exports.BlockContent[];
|
|
24
|
+
edited: readonly document_d_exports.BlockContent[];
|
|
25
|
+
} | null;
|
|
23
26
|
acceptedCommentIds(side: "before" | "after"): Set<number> | null;
|
|
24
27
|
};
|
|
25
28
|
export {};
|
|
@@ -60,7 +60,14 @@ const resolveStory = ({ version: { document, projection }, story, ids, decision,
|
|
|
60
60
|
indentation: "restore"
|
|
61
61
|
}));
|
|
62
62
|
};
|
|
63
|
-
|
|
63
|
+
/**
|
|
64
|
+
* Both sides of a batch resolved the same way. A revision the document held
|
|
65
|
+
* before the batch that blocks its own resolution, alone and the same way on
|
|
66
|
+
* both sides, stays pending on both: the proof is about what the batch
|
|
67
|
+
* changes, and a blocker the batch did not make must not refuse every edit
|
|
68
|
+
* of a document that holds one.
|
|
69
|
+
*/
|
|
70
|
+
const resolveStoryPair = ({ before, after, story, decision, restores }) => {
|
|
64
71
|
let beforeIds = before.ids;
|
|
65
72
|
let afterIds = after.ids;
|
|
66
73
|
while (true) {
|
|
@@ -68,13 +75,14 @@ const acceptStoryPair = ({ before, after, story }) => {
|
|
|
68
75
|
version: before.version,
|
|
69
76
|
story,
|
|
70
77
|
ids: beforeIds,
|
|
71
|
-
decision
|
|
78
|
+
decision
|
|
72
79
|
});
|
|
73
80
|
const edited = resolveStory({
|
|
74
81
|
version: after.version,
|
|
75
82
|
story,
|
|
76
83
|
ids: afterIds,
|
|
77
|
-
decision
|
|
84
|
+
decision,
|
|
85
|
+
...restores === void 0 ? {} : { restores }
|
|
78
86
|
});
|
|
79
87
|
if (original?.type === "resolved" && edited?.type === "resolved") return {
|
|
80
88
|
original: original.content,
|
|
@@ -95,8 +103,9 @@ const createCanonicalBatchReview = ({ before, after, story }) => {
|
|
|
95
103
|
let accepted;
|
|
96
104
|
const accept = () => {
|
|
97
105
|
if (accepted !== void 0) return accepted;
|
|
98
|
-
accepted =
|
|
106
|
+
accepted = resolveStoryPair({
|
|
99
107
|
story,
|
|
108
|
+
decision: "accept",
|
|
100
109
|
before: {
|
|
101
110
|
version: before,
|
|
102
111
|
ids: revisions("before").ordinary
|
|
@@ -108,21 +117,30 @@ const createCanonicalBatchReview = ({ before, after, story }) => {
|
|
|
108
117
|
}) ?? null;
|
|
109
118
|
return accepted;
|
|
110
119
|
};
|
|
120
|
+
let rejected;
|
|
121
|
+
const reject = () => {
|
|
122
|
+
if (rejected !== void 0) return rejected;
|
|
123
|
+
rejected = resolveStoryPair({
|
|
124
|
+
story,
|
|
125
|
+
decision: "reject",
|
|
126
|
+
before: {
|
|
127
|
+
version: before,
|
|
128
|
+
ids: revisions("before").all
|
|
129
|
+
},
|
|
130
|
+
after: {
|
|
131
|
+
version: after,
|
|
132
|
+
ids: revisions("after").all
|
|
133
|
+
},
|
|
134
|
+
restores: before.document
|
|
135
|
+
}) ?? null;
|
|
136
|
+
return rejected;
|
|
137
|
+
};
|
|
111
138
|
return {
|
|
112
139
|
story,
|
|
113
140
|
before: before.document,
|
|
114
141
|
after: after.document,
|
|
115
142
|
accept,
|
|
116
|
-
reject
|
|
117
|
-
const rejected = resolveStory({
|
|
118
|
-
version: side === "before" ? before : after,
|
|
119
|
-
story,
|
|
120
|
-
ids: revisions(side).all,
|
|
121
|
-
decision: "reject",
|
|
122
|
-
...side === "after" ? { restores: before.document } : {}
|
|
123
|
-
});
|
|
124
|
-
return rejected?.type === "resolved" ? rejected.content : void 0;
|
|
125
|
-
},
|
|
143
|
+
reject,
|
|
126
144
|
acceptedCommentIds(side) {
|
|
127
145
|
const pair = accept();
|
|
128
146
|
return pair === null ? null : anchoredCommentIdsInBlocks(side === "before" ? pair.original : pair.edited);
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
/** The one semantic compiler for canonical sidebar, controlled and public comments. */
|
|
2
|
-
import {
|
|
2
|
+
import { CanonicalRefusalGround } from "../types/canonicalCapabilities.js";
|
|
3
3
|
import { Comment } from "../types/content.js";
|
|
4
4
|
import { document_d_exports } from "../types/document.js";
|
|
5
5
|
import { Err, Ok, TaggedErrorClass } from "better-result";
|
|
6
6
|
import { CreateCommentOp, DocumentOp, IdLease } from "@stll/docx-core/ops";
|
|
7
7
|
declare const CanonicalCommentErrorBase: TaggedErrorClass<"CanonicalCommentError">;
|
|
8
|
+
/**
|
|
9
|
+
* A comment command the document does not allow, such as a reply to a missing
|
|
10
|
+
* thread, or one no id is left to mint for.
|
|
11
|
+
*/
|
|
8
12
|
export declare class CanonicalCommentError extends CanonicalCommentErrorBase<{
|
|
9
13
|
message: string;
|
|
10
|
-
|
|
14
|
+
ground: CanonicalRefusalGround;
|
|
11
15
|
}> {}
|
|
12
16
|
export type CanonicalCommentCommand = {
|
|
13
17
|
type: "create";
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { commentThreadParaId } from "../docx/commentThreadKey.js";
|
|
2
2
|
import { cloneParagraphWithPropertySource } from "../docx/paragraphPropertySource.js";
|
|
3
3
|
import { threadedCommentIds } from "../docx/serializer/commentSerializer.js";
|
|
4
|
-
import {
|
|
4
|
+
import { CANONICAL_CONDITION } from "../types/canonicalCapabilities.js";
|
|
5
5
|
import { canonicalJson } from "../utils/canonicalJson.js";
|
|
6
6
|
import { Result, TaggedError } from "better-result";
|
|
7
7
|
import { DOCUMENT_OP_TYPES, ID_KIND_LIMITS, ID_LEASE_KINDS, allocateCommentAnchorIds, applyDocumentOps, formatParaId, freshLeasedIds, packageParagraphIds } from "@stll/docx-core/ops";
|
|
8
8
|
// src/canonical/canonicalComments.ts
|
|
9
9
|
/** The one semantic compiler for canonical sidebar, controlled and public comments. */
|
|
10
10
|
const CanonicalCommentErrorBase = TaggedError("CanonicalCommentError");
|
|
11
|
+
/**
|
|
12
|
+
* A comment command the document does not allow, such as a reply to a missing
|
|
13
|
+
* thread, or one no id is left to mint for.
|
|
14
|
+
*/
|
|
11
15
|
var CanonicalCommentError = class extends CanonicalCommentErrorBase {};
|
|
12
|
-
const refuse = (message) => Result.err(new CanonicalCommentError({
|
|
16
|
+
const refuse = (message, condition = CANONICAL_CONDITION.invalidRequest) => Result.err(new CanonicalCommentError({
|
|
13
17
|
message,
|
|
14
|
-
|
|
18
|
+
ground: { condition }
|
|
15
19
|
}));
|
|
16
20
|
const compileCanonicalComments = ({ document, command, idLease }) => {
|
|
17
21
|
const current = document.package.document.comments ?? [];
|
|
@@ -139,7 +143,7 @@ const compileCanonicalComments = ({ document, command, idLease }) => {
|
|
|
139
143
|
const last = content.at(-1);
|
|
140
144
|
if (!threaded.has(comment.id) || last === void 0 || commentThreadParaId(content.map(({ paraId }) => paraId)) !== void 0) continue;
|
|
141
145
|
const paraId = canonicalCommentBody(draft, "", idLease).at(0)?.paraId;
|
|
142
|
-
if (paraId === void 0) return refuse("No paragraph id is free.");
|
|
146
|
+
if (paraId === void 0) return refuse("No paragraph id is free.", CANONICAL_CONDITION.idSpace);
|
|
143
147
|
const op = {
|
|
144
148
|
type: DOCUMENT_OP_TYPES.UPDATE_COMMENT_CONTENT,
|
|
145
149
|
id: comment.id,
|
|
@@ -1780,7 +1780,15 @@ const resolveTableInsertion = ({ operation, listStart, paragraph, projection, st
|
|
|
1780
1780
|
noteReferences
|
|
1781
1781
|
});
|
|
1782
1782
|
const pendingJoinRefusal = () => refusal(PENDING_JOIN_INSERTION_REFUSAL.reason, PENDING_JOIN_INSERTION_REFUSAL.message);
|
|
1783
|
-
const followsDeletedBreak = (
|
|
1783
|
+
const followsDeletedBreak = (position) => {
|
|
1784
|
+
const $position = projection.doc.resolve(position);
|
|
1785
|
+
for (let index = $position.index() - 1; index >= 0; index--) {
|
|
1786
|
+
const previous = $position.parent.child(index);
|
|
1787
|
+
if (previous.type.name !== "paragraph" || !isDeletedPPrMark(previous.attrs["pPrMark"])) return false;
|
|
1788
|
+
if (!paragraphGoes(previous, "accept")) return true;
|
|
1789
|
+
}
|
|
1790
|
+
return false;
|
|
1791
|
+
};
|
|
1784
1792
|
const pendingBreakRefusal = () => refusal(PENDING_BREAK_TABLE_REFUSAL.reason, PENDING_BREAK_TABLE_REFUSAL.message);
|
|
1785
1793
|
const outer = findOutermostTableBoundary(projection.doc, paragraph.start - 1);
|
|
1786
1794
|
if (outer !== null) {
|
|
@@ -1803,7 +1811,7 @@ const resolveTableInsertion = ({ operation, listStart, paragraph, projection, st
|
|
|
1803
1811
|
const neighbour = $place.parent.maybeChild($place.index() + (side === "after" ? 1 : -1));
|
|
1804
1812
|
const gap = side === "after" ? place.start - 1 + place.node.nodeSize : place.start - 1;
|
|
1805
1813
|
if (stopsPendingJoin(gap)) return pendingJoinRefusal();
|
|
1806
|
-
if (side === "after" && followsDeletedBreak(
|
|
1814
|
+
if (side === "after" && followsDeletedBreak(gap)) return pendingBreakRefusal();
|
|
1807
1815
|
if (side === "before") {
|
|
1808
1816
|
const start = insertionGap(projection.doc, gap, side);
|
|
1809
1817
|
const pending = start < gap ? projection.doc.nodeAt(start) : null;
|
|
@@ -1814,7 +1822,7 @@ const resolveTableInsertion = ({ operation, listStart, paragraph, projection, st
|
|
|
1814
1822
|
});
|
|
1815
1823
|
if (address !== void 0) {
|
|
1816
1824
|
if (stopsPendingJoin(start)) return pendingJoinRefusal();
|
|
1817
|
-
if (followsDeletedBreak(
|
|
1825
|
+
if (followsDeletedBreak(start)) return pendingBreakRefusal();
|
|
1818
1826
|
return besideTable(address, start);
|
|
1819
1827
|
}
|
|
1820
1828
|
}
|
|
@@ -4053,7 +4061,7 @@ var CanonicalPublicOperations = class {
|
|
|
4053
4061
|
paragraph.node.descendants((node) => {
|
|
4054
4062
|
if (node.isText && !node.marks.some(({ type }) => type.name === "insertion" || type.name === "deletion")) holdsOriginalWords = true;
|
|
4055
4063
|
});
|
|
4056
|
-
if (operation.moveId === void 0 && !gainsFollower && (keepsTablesApart || tracked && (after?.type.name === "table" || precedesInsertedTable) && isInsertedPPrMark(paragraph.node.attrs["pPrMark"]) && holdsOriginalWords)) {
|
|
4064
|
+
if (operation.moveId === void 0 && !gainsFollower && (keepsTablesApart || tracked && (after?.type.name === "table" || precedesInsertedTable) && isInsertedPPrMark(paragraph.node.attrs["pPrMark"]) && holdsOriginalWords && joinedWordsStart === void 0)) {
|
|
4057
4065
|
if (paragraph.start === end) return refusal("noopOperation");
|
|
4058
4066
|
const start = keepsTablesApart ? paragraph.start : joinedWordsStart ?? paragraph.start;
|
|
4059
4067
|
const from = projection.addressAt(start);
|
|
@@ -4356,7 +4364,7 @@ var CanonicalPublicOperations = class {
|
|
|
4356
4364
|
const projection = this.options.session.projectStory(story);
|
|
4357
4365
|
if (!anchor || projection.isErr()) return refusal("missingBlock");
|
|
4358
4366
|
const paragraph = projection.value.paragraph(blockId);
|
|
4359
|
-
if (!paragraph) return holdsParagraph(state.doc, blockId) ? refusal("unsupportedBlock", "The canonical session holds no address in this paragraph
|
|
4367
|
+
if (!paragraph) return holdsParagraph(state.doc, blockId) ? refusal("unsupportedBlock", "The canonical session holds no address in this paragraph.") : refusal("missingBlock");
|
|
4360
4368
|
if ((operation.type === "insertTable" || operation.type === "insertSignatureTable") && !supportsTableInsertionMode(operation.type, options.batch.mode ?? "tracked-changes")) return refusal("unsupportedMode");
|
|
4361
4369
|
const noteReferences = collectNoteReferenceLabels(state.doc);
|
|
4362
4370
|
const clean = buildCleanBlockText(paragraph.node, paragraph.start - 1, {
|
|
@@ -4733,16 +4741,28 @@ var CanonicalPublicOperations = class {
|
|
|
4733
4741
|
...tracked ? { keepFieldsOf: planTextChanges } : {}
|
|
4734
4742
|
});
|
|
4735
4743
|
const addedComments = tracked ? batchCommentSpans(batchComments, blockId, clean.text) : [];
|
|
4736
|
-
const
|
|
4737
|
-
|
|
4744
|
+
const commentedAt = (index) => {
|
|
4745
|
+
const position = clean.offsets[index];
|
|
4746
|
+
return position !== void 0 && paragraph.node.nodeAt(position - paragraph.start)?.marks.some((mark) => mark.type.name === "comment") === true;
|
|
4747
|
+
};
|
|
4748
|
+
const commentTouchesGap = (gap) => commentedAt(gap - 1) || commentedAt(gap) || addedComments.some((span) => span.start <= gap && gap <= span.end);
|
|
4749
|
+
const touchesComment = (changes) => changes?.some((change) => {
|
|
4750
|
+
const changeStart = start + change.start;
|
|
4751
|
+
const changeEnd = start + change.end;
|
|
4752
|
+
for (let index = changeStart; index < changeEnd; index++) if (commentedAt(index)) return true;
|
|
4753
|
+
if (changeEnd > changeStart && addedComments.some((span) => span.start < changeEnd && changeStart < span.end)) return true;
|
|
4754
|
+
return change.text.length > 0 && (commentTouchesGap(changeStart) || commentTouchesGap(changeEnd));
|
|
4755
|
+
}) === true;
|
|
4756
|
+
if (tracked && touchesComment([{
|
|
4738
4757
|
start: 0,
|
|
4739
|
-
end: end - start
|
|
4758
|
+
end: end - start,
|
|
4759
|
+
text
|
|
4740
4760
|
}])) {
|
|
4741
4761
|
const directCuts = planReplacementChanges({
|
|
4742
4762
|
...replacementSource,
|
|
4743
4763
|
planChanges: planTextChanges
|
|
4744
4764
|
});
|
|
4745
|
-
if (
|
|
4765
|
+
if (touchesComment(planned) || touchesComment(directCuts)) planned = directCuts;
|
|
4746
4766
|
}
|
|
4747
4767
|
if (planned === null) return panic("A replacement's planned changes must reproduce it.");
|
|
4748
4768
|
const changes = cutAroundRepeatedSeparators(replacementSource.source, planned).map((change) => ({
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CanonicalRefusalGround } from "../types/canonicalCapabilities.js";
|
|
2
|
+
import { DocumentOpRefusalReason } from "@stll/docx-core/ops";
|
|
3
|
+
/** The refusal ground a document operation refused for `reason` reports. */
|
|
4
|
+
export declare const groundForDocumentOpRefusal: (reason: DocumentOpRefusalReason) => CanonicalRefusalGround;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { CANONICAL_CONDITION, CANONICAL_GAP, CANONICAL_RULE } from "../types/canonicalCapabilities.js";
|
|
2
|
+
// src/canonical/canonicalRefusalGrounds.ts
|
|
3
|
+
const STALE = { condition: CANONICAL_CONDITION.stale };
|
|
4
|
+
const INVALID_REQUEST = { condition: CANONICAL_CONDITION.invalidRequest };
|
|
5
|
+
/**
|
|
6
|
+
* The ground of every document operation refusal: a moved-on document is
|
|
7
|
+
* stale, an exhausted id space names it, a link suggestion review records
|
|
8
|
+
* cannot hold is the document's rule, content the tracked-change records
|
|
9
|
+
* cannot express is a gap, and every other reason describes a request the
|
|
10
|
+
* document does not allow.
|
|
11
|
+
*/
|
|
12
|
+
const DOCUMENT_OP_REFUSAL_GROUNDS = {
|
|
13
|
+
unsupportedSchema: INVALID_REQUEST,
|
|
14
|
+
blockNotFound: INVALID_REQUEST,
|
|
15
|
+
invalidOperation: INVALID_REQUEST,
|
|
16
|
+
noChange: INVALID_REQUEST,
|
|
17
|
+
dependentRecords: INVALID_REQUEST,
|
|
18
|
+
invalidOffset: INVALID_REQUEST,
|
|
19
|
+
crossBlockRange: INVALID_REQUEST,
|
|
20
|
+
splitsSurrogatePair: INVALID_REQUEST,
|
|
21
|
+
invalidText: INVALID_REQUEST,
|
|
22
|
+
invalidBlockId: INVALID_REQUEST,
|
|
23
|
+
idCollision: INVALID_REQUEST,
|
|
24
|
+
notAdjacent: INVALID_REQUEST,
|
|
25
|
+
sectionBoundary: INVALID_REQUEST,
|
|
26
|
+
insideTrackedDeletion: INVALID_REQUEST,
|
|
27
|
+
needsNewIds: { condition: CANONICAL_CONDITION.idSpace },
|
|
28
|
+
invalidNewId: INVALID_REQUEST,
|
|
29
|
+
sharedId: INVALID_REQUEST,
|
|
30
|
+
stale: STALE,
|
|
31
|
+
structureMismatch: INVALID_REQUEST,
|
|
32
|
+
emptyContent: INVALID_REQUEST,
|
|
33
|
+
emptyBlockList: INVALID_REQUEST,
|
|
34
|
+
revisionConflict: INVALID_REQUEST,
|
|
35
|
+
pendingTableChange: INVALID_REQUEST,
|
|
36
|
+
pendingRunPropertyChange: INVALID_REQUEST,
|
|
37
|
+
pendingParagraphPropertyChange: INVALID_REQUEST,
|
|
38
|
+
joinIntoPendingTable: INVALID_REQUEST,
|
|
39
|
+
containerFinalMark: INVALID_REQUEST,
|
|
40
|
+
insideInlineControl: INVALID_REQUEST,
|
|
41
|
+
untrackable: { gap: CANONICAL_GAP.trackedChangeRecords },
|
|
42
|
+
pendingBreakTakeover: INVALID_REQUEST,
|
|
43
|
+
pendingParagraphMarkDeletion: INVALID_REQUEST,
|
|
44
|
+
pendingParagraphMarkInsertion: INVALID_REQUEST,
|
|
45
|
+
pendingParagraphJoin: INVALID_REQUEST,
|
|
46
|
+
pendingGridChange: INVALID_REQUEST,
|
|
47
|
+
unrecordableLinkSuggestion: { rule: CANONICAL_RULE.linkSuggestionShape },
|
|
48
|
+
missingBlockId: INVALID_REQUEST,
|
|
49
|
+
duplicateBlockId: INVALID_REQUEST,
|
|
50
|
+
duplicateRecordId: INVALID_REQUEST,
|
|
51
|
+
sectionsOutOfStep: STALE,
|
|
52
|
+
emptyRecord: INVALID_REQUEST
|
|
53
|
+
};
|
|
54
|
+
/** The refusal ground a document operation refused for `reason` reports. */
|
|
55
|
+
const groundForDocumentOpRefusal = (reason) => DOCUMENT_OP_REFUSAL_GROUNDS[reason];
|
|
56
|
+
export { groundForDocumentOpRefusal };
|