@stll/folio-core 0.31.1 → 0.32.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.
@@ -274,7 +274,19 @@ type FolioAIEditSkipReason = "missingBlock" | "changedBlock" | "ambiguousFind" |
274
274
  * replace, or replaceBlock's `text` matches the live block.
275
275
  * Filtered out so the reviewer doesn't see "X → X" cards.
276
276
  */
277
- "noopOperation";
277
+ "noopOperation" |
278
+ /**
279
+ * The batch carried a `precondition.documentVersion` that no longer
280
+ * matches the document the surface holds; every operation in the batch
281
+ * is skipped. Re-read the document and regenerate the edits.
282
+ */
283
+ "documentVersionMismatch" |
284
+ /**
285
+ * The surface holds no editable document right now (no editor mounted,
286
+ * no entity to attach suggestions to); the operation was neither applied
287
+ * nor queued.
288
+ */
289
+ "documentNotEditable";
278
290
  type FolioAIEditAppliedOperation = {
279
291
  id: string;
280
292
  commentId?: number;
@@ -1,5 +1,21 @@
1
1
  //#region src/ai-edits/word-diff.ts
2
- const tokenize = (s) => s.match(/\s+|\S+/gu) ?? [];
2
+ const WHITESPACE = /\s/u;
3
+ const tokenize = (s) => {
4
+ const tokens = [];
5
+ let tokenStart = 0;
6
+ let cursor = 0;
7
+ while (cursor < s.length) {
8
+ while (cursor < s.length && WHITESPACE.test(s.charAt(cursor))) cursor++;
9
+ if (cursor === s.length) break;
10
+ while (cursor < s.length && !WHITESPACE.test(s.charAt(cursor))) cursor++;
11
+ tokens.push(s.slice(tokenStart, cursor));
12
+ tokenStart = cursor;
13
+ }
14
+ const last = tokens.at(-1);
15
+ if (last === void 0) return s.length === 0 ? [] : [s];
16
+ if (tokenStart < s.length) tokens[tokens.length - 1] = last + s.slice(tokenStart);
17
+ return tokens;
18
+ };
3
19
  /**
4
20
  * Cell budget for the O(n*m) word-diff DP table below, mirroring
5
21
  * `MAX_LCS_CELLS` in `version-comparison.ts`. `before`/`after` come from
@@ -6,6 +6,15 @@ declare const FOLIO_DOCUMENT_OPERATION_TYPES: readonly ["replaceInBlock", "repla
6
6
  declare const FOLIO_DOCUMENT_OPERATION_MODES: readonly ["direct", "tracked-changes", "suggested"];
7
7
  declare const FOLIO_DOCUMENT_OPERATION_STORIES: readonly ["main", "header", "footer", "footnote", "endnote"];
8
8
  declare const FOLIO_DOCUMENT_OPERATION_PRECONDITIONS: readonly ["blockTextHash"];
9
+ /**
10
+ * Batch-level preconditions. `documentVersion` is an opaque host token (an
11
+ * entity version id, a collaboration checkpoint) pinning the document the
12
+ * batch was authored against; whoever knows the live version (an agent
13
+ * bridge, a host applying the batch itself) compares it and skips the whole
14
+ * batch with `documentVersionMismatch` when it differs. The core apply path
15
+ * preserves the token but has no version to compare it to.
16
+ */
17
+ declare const FOLIO_DOCUMENT_OPERATION_BATCH_PRECONDITIONS: readonly ["documentVersion"];
9
18
  declare const FOLIO_DOCUMENT_OPERATION_BATCH_MODES: readonly ["best-effort", "atomic"];
10
19
  type FolioDocumentOperation = FolioAIEditOperation;
11
20
  type FolioDocumentOperationMode = FolioAIEditApplyMode;
@@ -37,6 +46,7 @@ type FolioDocumentOperationCapabilities = {
37
46
  readonly batchModes: typeof FOLIO_DOCUMENT_OPERATION_BATCH_MODES;
38
47
  readonly dryRun: true;
39
48
  readonly preconditions: typeof FOLIO_DOCUMENT_OPERATION_PRECONDITIONS;
49
+ readonly batchPreconditions: typeof FOLIO_DOCUMENT_OPERATION_BATCH_PRECONDITIONS;
40
50
  readonly stories: typeof FOLIO_DOCUMENT_OPERATION_STORIES;
41
51
  };
42
52
  declare const getFolioDocumentOperationCapabilities: () => FolioDocumentOperationCapabilities;
@@ -54,16 +64,49 @@ declare class InvalidFolioDocumentOperationBatchError extends InvalidFolioDocume
54
64
  reason: string;
55
65
  }> {}
56
66
  declare const assertSupportedFolioDocumentOperationVersion: (value: unknown) => typeof FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION;
67
+ /** Batch-level guard; see {@link FOLIO_DOCUMENT_OPERATION_BATCH_PRECONDITIONS}. */
68
+ type FolioDocumentOperationBatchPrecondition = {
69
+ readonly documentVersion: string;
70
+ };
57
71
  type FolioDocumentOperationBatch = {
58
72
  readonly version: typeof FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION;
59
73
  readonly operations: readonly FolioDocumentOperation[];
60
74
  readonly mode?: FolioDocumentOperationMode;
61
75
  readonly atomic?: boolean;
62
76
  readonly dryRun?: boolean;
77
+ readonly precondition?: FolioDocumentOperationBatchPrecondition;
63
78
  };
79
+ /**
80
+ * Every property each operation type accepts on the wire; the parser
81
+ * rejects any other key. Exported so a lenient front door (an LLM tool
82
+ * decoder) can strip stray keys with the same knowledge instead of
83
+ * guessing, and so tool schemas can be derived from the contract.
84
+ */
85
+ declare const FOLIO_DOCUMENT_OPERATION_KEYS_BY_TYPE: Readonly<{
86
+ readonly replaceInBlock: readonly ["id", "type", "blockId", "severity", "area", "precondition", "suggestionId", "find", "replace", "comment"];
87
+ readonly replaceRange: readonly ["id", "type", "range", "severity", "area", "precondition", "suggestionId", "replace", "comment"];
88
+ readonly commentOnRange: readonly ["id", "type", "range", "severity", "area", "precondition", "comment"];
89
+ readonly formatRange: readonly ["id", "type", "range", "severity", "area", "precondition", "suggestionId", "formatting"];
90
+ readonly insertAfterBlock: readonly ["id", "type", "blockId", "severity", "area", "precondition", "suggestionId", "text", "inheritFormatting", "pageBreakBefore", "styleId", "comment"];
91
+ readonly insertBeforeBlock: readonly ["id", "type", "blockId", "severity", "area", "precondition", "suggestionId", "text", "inheritFormatting", "pageBreakBefore", "styleId", "comment"];
92
+ readonly replaceBlock: readonly ["id", "type", "blockId", "severity", "area", "precondition", "suggestionId", "text", "preserveFormatting", "styleId", "comment"];
93
+ readonly deleteBlock: readonly ["id", "type", "blockId", "severity", "area", "precondition", "suggestionId", "comment"];
94
+ readonly commentOnBlock: readonly ["id", "type", "blockId", "severity", "area", "precondition", "suggestionId", "quote", "comment"];
95
+ readonly insertSignatureTable: readonly ["id", "type", "blockId", "severity", "area", "precondition", "suggestionId", "position", "parties", "comment"];
96
+ readonly insertTableRow: readonly ["id", "type", "blockId", "severity", "area", "precondition", "suggestionId", "position", "cellTexts"];
97
+ readonly deleteTableRow: readonly ["id", "type", "blockId", "severity", "area", "precondition", "suggestionId"];
98
+ readonly insertTableColumn: readonly ["id", "type", "blockId", "severity", "area", "precondition", "suggestionId", "position", "cellTexts"];
99
+ readonly deleteTableColumn: readonly ["id", "type", "blockId", "severity", "area", "precondition", "suggestionId"];
100
+ readonly mergeTableCells: readonly ["id", "type", "blockId", "severity", "area", "precondition", "suggestionId", "endBlockId", "rowCount"];
101
+ readonly splitTableCell: readonly ["id", "type", "blockId", "severity", "area", "precondition", "suggestionId"];
102
+ }>;
64
103
  declare const parseFolioDocumentOperationBatch: (value: unknown) => FolioDocumentOperationBatch;
65
- type FolioDocumentOperationStatus = "committed" | "previewed" | "rejected";
66
- type FolioDocumentOperationRecovery = "refreshDocument" | "narrowMatch" | "changeMode" | "changeTarget" | "removeOperation" | "inspectBatch";
104
+ /**
105
+ * `queued` is reported by a surface that routes the batch into a host-owned
106
+ * review queue instead of applying it; the core apply path never produces it.
107
+ */
108
+ type FolioDocumentOperationStatus = "committed" | "previewed" | "rejected" | "queued";
109
+ type FolioDocumentOperationRecovery = "refreshDocument" | "narrowMatch" | "changeMode" | "changeTarget" | "removeOperation" | "inspectBatch" | "retryLater";
67
110
  type FolioDocumentOperationIssue = {
68
111
  operationId: string;
69
112
  operationIndex: number;
@@ -152,9 +195,12 @@ type FolioDocumentOperationUndoResult = {
152
195
  undoHandle: FolioDocumentOperationUndoHandle;
153
196
  reason: FolioDocumentOperationUndoFailureReason;
154
197
  };
155
- type FolioDocumentOperationResult = {
198
+ /** One operation a host surface accepted into its own review queue rather than applying. */
199
+ type FolioDocumentOperationQueuedOperation = {
200
+ id: string;
201
+ };
202
+ type FolioDocumentOperationResultBase = {
156
203
  version: typeof FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION;
157
- status: FolioDocumentOperationStatus;
158
204
  applied: FolioAIEditAppliedOperation[];
159
205
  skipped: FolioAIEditSkippedOperation[];
160
206
  issues: FolioDocumentOperationIssue[];
@@ -163,6 +209,19 @@ type FolioDocumentOperationResult = {
163
209
  /** Present when the execution surface can undo this committed batch. */
164
210
  undoHandle: FolioDocumentOperationUndoHandle | null;
165
211
  };
212
+ /**
213
+ * Discriminated on `status`: only a host review-queue surface reports
214
+ * `"queued"`, and only that branch carries the `queued` list, so a consumer
215
+ * narrowing on the status can never meet a contradictory payload.
216
+ */
217
+ type FolioDocumentOperationResult = (FolioDocumentOperationResultBase & {
218
+ status: "queued";
219
+ /** Operations parked in the host review queue instead of applied. */
220
+ queued: FolioDocumentOperationQueuedOperation[];
221
+ }) | (FolioDocumentOperationResultBase & {
222
+ status: Exclude<FolioDocumentOperationStatus, "queued">;
223
+ queued?: never;
224
+ });
166
225
  declare const getFolioDocumentOperationIssues: (operations: readonly FolioDocumentOperation[], skipped: readonly FolioAIEditSkippedOperation[]) => FolioDocumentOperationIssue[];
167
226
  /** Build deterministic affected-target receipts from operations and their applied entries. */
168
227
  declare const getFolioDocumentOperationReceipts: (operations: readonly FolioDocumentOperation[], applied: readonly FolioAIEditAppliedOperation[]) => FolioDocumentOperationReceipt[];
@@ -177,4 +236,4 @@ type ApplyFolioDocumentOperationsOptions = {
177
236
  };
178
237
  declare const applyFolioDocumentOperations: ({ view, snapshot, batch, story, author, createCommentId, createUndoHandle }: ApplyFolioDocumentOperationsOptions) => FolioDocumentOperationResult;
179
238
  //#endregion
180
- export { ApplyFolioDocumentOperationsOptions, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FolioDocumentOperation, FolioDocumentOperationAffectedTarget, FolioDocumentOperationBatch, FolioDocumentOperationCapabilities, FolioDocumentOperationIssue, FolioDocumentOperationMode, FolioDocumentOperationPrecondition, FolioDocumentOperationReceipt, FolioDocumentOperationRecovery, FolioDocumentOperationResult, FolioDocumentOperationStatus, FolioDocumentOperationStory, FolioDocumentOperationType, FolioDocumentOperationUndoFailureReason, FolioDocumentOperationUndoHandle, FolioDocumentOperationUndoResult, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, applyFolioDocumentOperations, assertSupportedFolioDocumentOperationVersion, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, isFolioDocumentOperationModeSupported, isSupportedFolioDocumentOperationVersion, parseFolioDocumentOperationBatch };
239
+ export { ApplyFolioDocumentOperationsOptions, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_BATCH_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_KEYS_BY_TYPE, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FolioDocumentOperation, FolioDocumentOperationAffectedTarget, FolioDocumentOperationBatch, FolioDocumentOperationBatchPrecondition, FolioDocumentOperationCapabilities, FolioDocumentOperationIssue, FolioDocumentOperationMode, FolioDocumentOperationPrecondition, FolioDocumentOperationQueuedOperation, FolioDocumentOperationReceipt, FolioDocumentOperationRecovery, FolioDocumentOperationResult, FolioDocumentOperationStatus, FolioDocumentOperationStory, FolioDocumentOperationType, FolioDocumentOperationUndoFailureReason, FolioDocumentOperationUndoHandle, FolioDocumentOperationUndoResult, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, applyFolioDocumentOperations, assertSupportedFolioDocumentOperationVersion, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, isFolioDocumentOperationModeSupported, isSupportedFolioDocumentOperationVersion, parseFolioDocumentOperationBatch };
@@ -33,6 +33,15 @@ const FOLIO_DOCUMENT_OPERATION_STORIES = Object.freeze([
33
33
  "endnote"
34
34
  ]);
35
35
  const FOLIO_DOCUMENT_OPERATION_PRECONDITIONS = Object.freeze(["blockTextHash"]);
36
+ /**
37
+ * Batch-level preconditions. `documentVersion` is an opaque host token (an
38
+ * entity version id, a collaboration checkpoint) pinning the document the
39
+ * batch was authored against; whoever knows the live version (an agent
40
+ * bridge, a host applying the batch itself) compares it and skips the whole
41
+ * batch with `documentVersionMismatch` when it differs. The core apply path
42
+ * preserves the token but has no version to compare it to.
43
+ */
44
+ const FOLIO_DOCUMENT_OPERATION_BATCH_PRECONDITIONS = Object.freeze(["documentVersion"]);
36
45
  const FOLIO_DOCUMENT_OPERATION_BATCH_MODES = Object.freeze(["best-effort", "atomic"]);
37
46
  const parsedFolioDocumentOperationBatches = /* @__PURE__ */ new WeakSet();
38
47
  const DIRECT_AND_TRACKED_MODES = Object.freeze(["direct", "tracked-changes"]);
@@ -64,6 +73,7 @@ const DOCUMENT_OPERATION_CAPABILITIES = Object.freeze({
64
73
  batchModes: FOLIO_DOCUMENT_OPERATION_BATCH_MODES,
65
74
  dryRun: true,
66
75
  preconditions: FOLIO_DOCUMENT_OPERATION_PRECONDITIONS,
76
+ batchPreconditions: FOLIO_DOCUMENT_OPERATION_BATCH_PRECONDITIONS,
67
77
  stories: FOLIO_DOCUMENT_OPERATION_STORIES
68
78
  });
69
79
  const getFolioDocumentOperationCapabilities = () => DOCUMENT_OPERATION_CAPABILITIES;
@@ -224,6 +234,94 @@ const COMMON_OPERATION_KEYS = [
224
234
  "precondition",
225
235
  "suggestionId"
226
236
  ];
237
+ const RANGE_OPERATION_KEYS = [
238
+ "id",
239
+ "type",
240
+ "range",
241
+ "severity",
242
+ "area",
243
+ "precondition"
244
+ ];
245
+ /**
246
+ * Every property each operation type accepts on the wire; the parser
247
+ * rejects any other key. Exported so a lenient front door (an LLM tool
248
+ * decoder) can strip stray keys with the same knowledge instead of
249
+ * guessing, and so tool schemas can be derived from the contract.
250
+ */
251
+ const FOLIO_DOCUMENT_OPERATION_KEYS_BY_TYPE = Object.freeze({
252
+ replaceInBlock: [
253
+ ...COMMON_OPERATION_KEYS,
254
+ "find",
255
+ "replace",
256
+ "comment"
257
+ ],
258
+ replaceRange: [
259
+ ...RANGE_OPERATION_KEYS,
260
+ "suggestionId",
261
+ "replace",
262
+ "comment"
263
+ ],
264
+ commentOnRange: [...RANGE_OPERATION_KEYS, "comment"],
265
+ formatRange: [
266
+ ...RANGE_OPERATION_KEYS,
267
+ "suggestionId",
268
+ "formatting"
269
+ ],
270
+ insertAfterBlock: [
271
+ ...COMMON_OPERATION_KEYS,
272
+ "text",
273
+ "inheritFormatting",
274
+ "pageBreakBefore",
275
+ "styleId",
276
+ "comment"
277
+ ],
278
+ insertBeforeBlock: [
279
+ ...COMMON_OPERATION_KEYS,
280
+ "text",
281
+ "inheritFormatting",
282
+ "pageBreakBefore",
283
+ "styleId",
284
+ "comment"
285
+ ],
286
+ replaceBlock: [
287
+ ...COMMON_OPERATION_KEYS,
288
+ "text",
289
+ "preserveFormatting",
290
+ "styleId",
291
+ "comment"
292
+ ],
293
+ deleteBlock: [...COMMON_OPERATION_KEYS, "comment"],
294
+ commentOnBlock: [
295
+ ...COMMON_OPERATION_KEYS,
296
+ "quote",
297
+ "comment"
298
+ ],
299
+ insertSignatureTable: [
300
+ ...COMMON_OPERATION_KEYS,
301
+ "position",
302
+ "parties",
303
+ "comment"
304
+ ],
305
+ insertTableRow: [
306
+ ...COMMON_OPERATION_KEYS,
307
+ "position",
308
+ "cellTexts"
309
+ ],
310
+ deleteTableRow: COMMON_OPERATION_KEYS,
311
+ insertTableColumn: [
312
+ ...COMMON_OPERATION_KEYS,
313
+ "position",
314
+ "cellTexts"
315
+ ],
316
+ deleteTableColumn: COMMON_OPERATION_KEYS,
317
+ mergeTableCells: [
318
+ ...COMMON_OPERATION_KEYS,
319
+ "endBlockId",
320
+ "rowCount"
321
+ ],
322
+ splitTableCell: COMMON_OPERATION_KEYS
323
+ });
324
+ const isFolioDocumentOperationType = (value) => Object.hasOwn(FOLIO_DOCUMENT_OPERATION_KEYS_BY_TYPE, value);
227
325
  const parseSignatureParties = (value, path) => {
228
326
  const parties = value["parties"];
229
327
  if (!Array.isArray(parties)) return invalidBatch(`${path}.parties`, "expected an array");
@@ -248,6 +346,8 @@ const parseDocumentOperation = (value, index) => {
248
346
  if (!isPlainObject(value)) return invalidBatch(path, "expected an object");
249
347
  const id = readString(value, "id", path);
250
348
  const type = readString(value, "type", path);
349
+ if (!isFolioDocumentOperationType(type)) return invalidBatch(`${path}.type`, `unsupported operation type "${type}"`);
350
+ assertAllowedKeys(value, path, FOLIO_DOCUMENT_OPERATION_KEYS_BY_TYPE[type]);
251
351
  const reviewMeta = readReviewMeta(value, path);
252
352
  const precondition = readOptionalPrecondition(value, path);
253
353
  const suggestionId = readOptionalString(value, "suggestionId", path);
@@ -257,37 +357,15 @@ const parseDocumentOperation = (value, index) => {
257
357
  ...precondition !== void 0 && { precondition },
258
358
  ...suggestionId !== void 0 && { suggestionId }
259
359
  };
260
- if (type === "replaceRange") {
261
- assertAllowedKeys(value, path, [
262
- "id",
263
- "type",
264
- "range",
265
- "replace",
266
- "comment",
267
- "severity",
268
- "area",
269
- "precondition",
270
- "suggestionId"
271
- ]);
272
- return {
273
- ...operationMeta,
274
- id,
275
- type,
276
- range: readTextRange(value, path),
277
- replace: readString(value, "replace", path),
278
- ...comment !== void 0 && { comment }
279
- };
280
- }
360
+ if (type === "replaceRange") return {
361
+ ...operationMeta,
362
+ id,
363
+ type,
364
+ range: readTextRange(value, path),
365
+ replace: readString(value, "replace", path),
366
+ ...comment !== void 0 && { comment }
367
+ };
281
368
  if (type === "commentOnRange") {
282
- assertAllowedKeys(value, path, [
283
- "id",
284
- "type",
285
- "range",
286
- "comment",
287
- "severity",
288
- "area",
289
- "precondition"
290
- ]);
291
369
  if (comment === void 0) return invalidBatch(`${path}.comment`, "expected an object");
292
370
  return {
293
371
  ...operationMeta,
@@ -297,52 +375,24 @@ const parseDocumentOperation = (value, index) => {
297
375
  comment
298
376
  };
299
377
  }
300
- if (type === "formatRange") {
301
- assertAllowedKeys(value, path, [
302
- "id",
303
- "type",
304
- "range",
305
- "formatting",
306
- "severity",
307
- "area",
308
- "precondition",
309
- "suggestionId"
310
- ]);
311
- return {
312
- ...operationMeta,
313
- id,
314
- type,
315
- range: readTextRange(value, path),
316
- formatting: readInlineFormatting(value, path)
317
- };
318
- }
378
+ if (type === "formatRange") return {
379
+ ...operationMeta,
380
+ id,
381
+ type,
382
+ range: readTextRange(value, path),
383
+ formatting: readInlineFormatting(value, path)
384
+ };
319
385
  const blockId = readString(value, "blockId", path);
320
- if (type === "replaceInBlock") {
321
- assertAllowedKeys(value, path, [
322
- ...COMMON_OPERATION_KEYS,
323
- "find",
324
- "replace",
325
- "comment"
326
- ]);
327
- return {
328
- ...operationMeta,
329
- id,
330
- type,
331
- blockId,
332
- find: readString(value, "find", path),
333
- replace: readString(value, "replace", path),
334
- ...comment !== void 0 && { comment }
335
- };
336
- }
386
+ if (type === "replaceInBlock") return {
387
+ ...operationMeta,
388
+ id,
389
+ type,
390
+ blockId,
391
+ find: readString(value, "find", path),
392
+ replace: readString(value, "replace", path),
393
+ ...comment !== void 0 && { comment }
394
+ };
337
395
  if (type === "insertAfterBlock" || type === "insertBeforeBlock") {
338
- assertAllowedKeys(value, path, [
339
- ...COMMON_OPERATION_KEYS,
340
- "text",
341
- "inheritFormatting",
342
- "pageBreakBefore",
343
- "styleId",
344
- "comment"
345
- ]);
346
396
  const inheritFormatting = readOptionalBoolean(value, "inheritFormatting", path);
347
397
  const pageBreakBefore = readOptionalBoolean(value, "pageBreakBefore", path);
348
398
  const styleId = readOptionalString(value, "styleId", path);
@@ -359,13 +409,6 @@ const parseDocumentOperation = (value, index) => {
359
409
  };
360
410
  }
361
411
  if (type === "replaceBlock") {
362
- assertAllowedKeys(value, path, [
363
- ...COMMON_OPERATION_KEYS,
364
- "text",
365
- "preserveFormatting",
366
- "styleId",
367
- "comment"
368
- ]);
369
412
  const preserveFormatting = readOptionalBoolean(value, "preserveFormatting", path);
370
413
  const styleId = readOptionalString(value, "styleId", path);
371
414
  return {
@@ -379,22 +422,14 @@ const parseDocumentOperation = (value, index) => {
379
422
  ...comment !== void 0 && { comment }
380
423
  };
381
424
  }
382
- if (type === "deleteBlock") {
383
- assertAllowedKeys(value, path, [...COMMON_OPERATION_KEYS, "comment"]);
384
- return {
385
- ...operationMeta,
386
- id,
387
- type,
388
- blockId,
389
- ...comment !== void 0 && { comment }
390
- };
391
- }
425
+ if (type === "deleteBlock") return {
426
+ ...operationMeta,
427
+ id,
428
+ type,
429
+ blockId,
430
+ ...comment !== void 0 && { comment }
431
+ };
392
432
  if (type === "commentOnBlock") {
393
- assertAllowedKeys(value, path, [
394
- ...COMMON_OPERATION_KEYS,
395
- "quote",
396
- "comment"
397
- ]);
398
433
  if (comment === void 0) return invalidBatch(`${path}.comment`, "expected an object");
399
434
  const quote = readOptionalString(value, "quote", path);
400
435
  return {
@@ -407,12 +442,6 @@ const parseDocumentOperation = (value, index) => {
407
442
  };
408
443
  }
409
444
  if (type === "insertSignatureTable") {
410
- assertAllowedKeys(value, path, [
411
- ...COMMON_OPERATION_KEYS,
412
- "position",
413
- "parties",
414
- "comment"
415
- ]);
416
445
  const position = value["position"];
417
446
  if (position !== void 0 && position !== "after" && position !== "before") return invalidBatch(`${path}.position`, "expected \"after\" or \"before\" when provided");
418
447
  return {
@@ -426,11 +455,6 @@ const parseDocumentOperation = (value, index) => {
426
455
  };
427
456
  }
428
457
  if (type === "insertTableRow") {
429
- assertAllowedKeys(value, path, [
430
- ...COMMON_OPERATION_KEYS,
431
- "position",
432
- "cellTexts"
433
- ]);
434
458
  const position = value["position"];
435
459
  if (position !== void 0 && position !== "after" && position !== "before") return invalidBatch(`${path}.position`, "expected \"after\" or \"before\" when provided");
436
460
  const cellTexts = readOptionalStringArray(value, "cellTexts", path);
@@ -443,21 +467,13 @@ const parseDocumentOperation = (value, index) => {
443
467
  ...cellTexts !== void 0 && { cellTexts }
444
468
  };
445
469
  }
446
- if (type === "deleteTableRow") {
447
- assertAllowedKeys(value, path, COMMON_OPERATION_KEYS);
448
- return {
449
- ...operationMeta,
450
- id,
451
- type,
452
- blockId
453
- };
454
- }
470
+ if (type === "deleteTableRow") return {
471
+ ...operationMeta,
472
+ id,
473
+ type,
474
+ blockId
475
+ };
455
476
  if (type === "insertTableColumn") {
456
- assertAllowedKeys(value, path, [
457
- ...COMMON_OPERATION_KEYS,
458
- "position",
459
- "cellTexts"
460
- ]);
461
477
  const position = value["position"];
462
478
  if (position !== void 0 && position !== "after" && position !== "before") return invalidBatch(`${path}.position`, "expected \"after\" or \"before\" when provided");
463
479
  const cellTexts = readOptionalStringArray(value, "cellTexts", path);
@@ -470,21 +486,13 @@ const parseDocumentOperation = (value, index) => {
470
486
  ...cellTexts !== void 0 && { cellTexts }
471
487
  };
472
488
  }
473
- if (type === "deleteTableColumn") {
474
- assertAllowedKeys(value, path, COMMON_OPERATION_KEYS);
475
- return {
476
- ...operationMeta,
477
- id,
478
- type,
479
- blockId
480
- };
481
- }
489
+ if (type === "deleteTableColumn") return {
490
+ ...operationMeta,
491
+ id,
492
+ type,
493
+ blockId
494
+ };
482
495
  if (type === "mergeTableCells") {
483
- assertAllowedKeys(value, path, [
484
- ...COMMON_OPERATION_KEYS,
485
- "endBlockId",
486
- "rowCount"
487
- ]);
488
496
  const endBlockId = readOptionalString(value, "endBlockId", path);
489
497
  const rawRowCount = value["rowCount"];
490
498
  if (endBlockId === void 0 === (rawRowCount === void 0)) return invalidBatch(path, "expected exactly one of endBlockId or rowCount");
@@ -508,16 +516,21 @@ const parseDocumentOperation = (value, index) => {
508
516
  rowCount
509
517
  };
510
518
  }
511
- if (type === "splitTableCell") {
512
- assertAllowedKeys(value, path, COMMON_OPERATION_KEYS);
513
- return {
514
- ...operationMeta,
515
- id,
516
- type,
517
- blockId
518
- };
519
- }
520
- return invalidBatch(`${path}.type`, `unsupported operation type "${type}"`);
519
+ return {
520
+ ...operationMeta,
521
+ id,
522
+ type,
523
+ blockId
524
+ };
525
+ };
526
+ const readOptionalBatchPrecondition = (value) => {
527
+ const candidate = value["precondition"];
528
+ if (candidate === void 0) return;
529
+ if (!isPlainObject(candidate)) return invalidBatch("$.precondition", "expected an object when provided");
530
+ assertAllowedKeys(candidate, "$.precondition", FOLIO_DOCUMENT_OPERATION_BATCH_PRECONDITIONS);
531
+ const documentVersion = readString(candidate, "documentVersion", "$.precondition");
532
+ if (documentVersion.length === 0) return invalidBatch("$.precondition.documentVersion", "expected a non-empty string");
533
+ return { documentVersion };
521
534
  };
522
535
  const parseFolioDocumentOperationBatch = (value) => {
523
536
  if (isParsedFolioDocumentOperationBatch(value)) return value;
@@ -527,7 +540,8 @@ const parseFolioDocumentOperationBatch = (value) => {
527
540
  "operations",
528
541
  "mode",
529
542
  "atomic",
530
- "dryRun"
543
+ "dryRun",
544
+ "precondition"
531
545
  ]);
532
546
  const version = assertSupportedFolioDocumentOperationVersion(value["version"]);
533
547
  const operations = value["operations"];
@@ -536,6 +550,7 @@ const parseFolioDocumentOperationBatch = (value) => {
536
550
  if (mode !== void 0 && mode !== "direct" && mode !== "tracked-changes" && mode !== "suggested") return invalidBatch("$.mode", "expected \"direct\", \"tracked-changes\", or \"suggested\" when provided");
537
551
  const atomic = readOptionalBoolean(value, "atomic", "$");
538
552
  const dryRun = readOptionalBoolean(value, "dryRun", "$");
553
+ const precondition = readOptionalBatchPrecondition(value);
539
554
  const parsedOperations = operations.map(parseDocumentOperation);
540
555
  const operationIds = /* @__PURE__ */ new Set();
541
556
  for (const [index, operation] of parsedOperations.entries()) {
@@ -547,7 +562,8 @@ const parseFolioDocumentOperationBatch = (value) => {
547
562
  operations: parsedOperations,
548
563
  ...mode !== void 0 && { mode },
549
564
  ...atomic !== void 0 && { atomic },
550
- ...dryRun !== void 0 && { dryRun }
565
+ ...dryRun !== void 0 && { dryRun },
566
+ ...precondition !== void 0 && { precondition }
551
567
  };
552
568
  freezeParsedValue(parsedBatch);
553
569
  parsedFolioDocumentOperationBatches.add(parsedBatch);
@@ -564,7 +580,9 @@ const recoveryByReason = {
564
580
  preconditionFailed: "refreshDocument",
565
581
  staleRange: "refreshDocument",
566
582
  emptyOperation: "removeOperation",
567
- noopOperation: "removeOperation"
583
+ noopOperation: "removeOperation",
584
+ documentVersionMismatch: "refreshDocument",
585
+ documentNotEditable: "retryLater"
568
586
  };
569
587
  const getFolioDocumentOperationIssues = (operations, skipped) => {
570
588
  const indexById = /* @__PURE__ */ new Map();
@@ -780,4 +798,4 @@ const applyFolioDocumentOperations = ({ view, snapshot, batch, story = "main", a
780
798
  };
781
799
  };
782
800
  //#endregion
783
- export { FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, applyFolioDocumentOperations, assertSupportedFolioDocumentOperationVersion, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, isFolioDocumentOperationModeSupported, isSupportedFolioDocumentOperationVersion, parseFolioDocumentOperationBatch };
801
+ export { FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_BATCH_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_KEYS_BY_TYPE, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, applyFolioDocumentOperations, assertSupportedFolioDocumentOperationVersion, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, isFolioDocumentOperationModeSupported, isSupportedFolioDocumentOperationVersion, parseFolioDocumentOperationBatch };
@@ -1,4 +1,16 @@
1
+ import JSZip from "jszip";
1
2
  //#region src/docx/server/boundedArchive.d.ts
3
+ declare module "jszip" {
4
+ interface JSZipObject {
5
+ /**
6
+ * Chunked read of the entry content, missing from the published typings.
7
+ * `nodeStream` is this stream wrapped in a Node.js `Readable`, which
8
+ * browsers and web workers cannot provide; the stream itself is
9
+ * platform-neutral.
10
+ */
11
+ internalStream(type: "uint8array"): JSZip.JSZipStreamHelper<Uint8Array>;
12
+ }
13
+ }
2
14
  declare const DOCX_MAX_ENTRY_BYTES: number;
3
15
  declare const DOCX_MAX_TOTAL_BYTES: number;
4
16
  declare const DOCX_MAX_ENTRIES = 4096;
@@ -7,20 +7,34 @@ const DOCX_MAX_ENTRIES = 4096;
7
7
  const DOCX_MAX_INPUT_BYTES = 50 * 1024 * 1024;
8
8
  /** Error raised when a DOCX archive cannot be loaded within configured limits. */
9
9
  var DocxArchiveError = class extends TaggedError("DocxArchiveError") {};
10
+ const concatChunks = (chunks) => {
11
+ let totalBytes = 0;
12
+ for (const chunk of chunks) totalBytes += chunk.length;
13
+ const merged = new Uint8Array(totalBytes);
14
+ let offset = 0;
15
+ for (const chunk of chunks) {
16
+ merged.set(chunk, offset);
17
+ offset += chunk.length;
18
+ }
19
+ return merged;
20
+ };
21
+ /**
22
+ * Accumulate an entry chunk by chunk, checking both caps before each chunk is
23
+ * retained. Pausing the stream abandons a decompression bomb mid-inflate, so
24
+ * the caps bound memory instead of merely reporting the overrun afterwards.
25
+ */
10
26
  const collectStream = async ({ stream, maxEntryBytes, remainingBytes, maxTotalBytes, path }) => await new Promise((resolve, reject) => {
11
27
  const chunks = [];
12
28
  let entryBytes = 0;
13
29
  const fail = (reason, message) => {
14
- const destroy = Reflect.get(stream, "destroy");
15
- if (typeof destroy === "function") Reflect.apply(destroy, stream, []);
30
+ stream.pause();
16
31
  reject(new DocxArchiveError({
17
32
  message,
18
33
  reason
19
34
  }));
20
35
  };
21
36
  stream.on("data", (chunk) => {
22
- const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
23
- entryBytes += bytes.length;
37
+ entryBytes += chunk.length;
24
38
  if (entryBytes > maxEntryBytes) {
25
39
  fail("entry-too-large", `DOCX entry "${path}" exceeded the ${maxEntryBytes}-byte limit`);
26
40
  return;
@@ -29,10 +43,8 @@ const collectStream = async ({ stream, maxEntryBytes, remainingBytes, maxTotalBy
29
43
  fail("total-too-large", `DOCX archive exceeded the ${maxTotalBytes}-byte cumulative limit while reading "${path}"`);
30
44
  return;
31
45
  }
32
- chunks.push(bytes);
33
- });
34
- stream.on("end", () => resolve(Buffer.concat(chunks)));
35
- stream.on("error", reject);
46
+ chunks.push(chunk);
47
+ }).on("end", () => resolve(concatChunks(chunks))).on("error", reject).resume();
36
48
  });
37
49
  const getDeclaredUncompressedBytes = (entry) => {
38
50
  const data = "_data" in entry ? entry._data : void 0;
@@ -116,15 +128,15 @@ const loadDocxArchive = async (bytes, options = {}) => {
116
128
  const work = async () => {
117
129
  const entry = zip.file(path);
118
130
  if (!entry) return null;
119
- const buffer = await collectStream({
120
- stream: entry.nodeStream("nodebuffer"),
131
+ const content = await collectStream({
132
+ stream: entry.internalStream("uint8array"),
121
133
  maxEntryBytes: Math.min(requestedMaxBytes, maxEntryBytes),
122
134
  remainingBytes: maxTotalBytes - totalBytesRead,
123
135
  maxTotalBytes,
124
136
  path
125
137
  });
126
- totalBytesRead += buffer.length;
127
- return buffer;
138
+ totalBytesRead += content.length;
139
+ return content;
128
140
  };
129
141
  const next = readChain.then(work, work);
130
142
  readChain = next.then(() => void 0, () => void 0);
@@ -138,13 +150,10 @@ const loadDocxArchive = async (bytes, options = {}) => {
138
150
  declaredUncompressedBytes: getDeclaredUncompressedBytes(entry)
139
151
  }))),
140
152
  async readEntryString(path) {
141
- const buffer = await readEntry(path);
142
- return buffer === null ? null : buffer.toString("utf-8");
153
+ const content = await readEntry(path);
154
+ return content === null ? null : new TextDecoder("utf-8", { ignoreBOM: true }).decode(content);
143
155
  },
144
- async readEntryUint8(path, readOptions) {
145
- const buffer = await readEntry(path, readOptions);
146
- return buffer === null ? null : new Uint8Array(buffer);
147
- }
156
+ readEntryUint8: readEntry
148
157
  };
149
158
  };
150
159
  //#endregion
@@ -86,6 +86,7 @@ function createBilingualDocument(source, options) {
86
86
  cloner
87
87
  });
88
88
  const paraIds = createParaIdMinter(collectPackageParaIds(source.package));
89
+ const bookmarkIds = createBookmarkIdMinter(source.package);
89
90
  const rows = [];
90
91
  const content = [];
91
92
  let sectionRows = [];
@@ -97,7 +98,7 @@ function createBilingualDocument(source, options) {
97
98
  const copyParagraph = (paragraph) => {
98
99
  const targetParaId = paraIds.mint(paragraph.paraId);
99
100
  return {
100
- copy: cloneParagraphForTarget(paragraph, targetParaId, styleCloner, cloner),
101
+ copy: cloneParagraphForTarget(paragraph, targetParaId, styleCloner, cloner, bookmarkIds),
101
102
  ref: {
102
103
  sourceParaId: paragraph.paraId,
103
104
  targetParaId,
@@ -152,7 +153,8 @@ function createBilingualDocument(source, options) {
152
153
  editableParagraphIds: options.editableParagraphIds,
153
154
  paraIds,
154
155
  styleCloner,
155
- cloner
156
+ cloner,
157
+ bookmarkIds
156
158
  });
157
159
  rows.push({
158
160
  kind: "table",
@@ -362,7 +364,7 @@ const createStyleCloner = ({ styleById, suffix, cloner }) => {
362
364
  })
363
365
  };
364
366
  };
365
- const cloneParagraphForTarget = (paragraph, targetParaId, styleCloner, cloner) => {
367
+ const cloneParagraphForTarget = (paragraph, targetParaId, styleCloner, cloner, bookmarkIds) => {
366
368
  const { textId: _textId, sectionProperties: _sectionProperties, ...rest } = paragraph;
367
369
  const formatting = paragraph.formatting;
368
370
  const nextFormatting = formatting && {
@@ -379,12 +381,56 @@ const cloneParagraphForTarget = (paragraph, targetParaId, styleCloner, cloner) =
379
381
  };
380
382
  return {
381
383
  ...rest,
382
- content: structuredClone(paragraph.content),
384
+ content: remapClonedBookmarkIds(structuredClone(paragraph.content), bookmarkIds),
383
385
  paraId: targetParaId,
384
386
  ...nextFormatting && { formatting: nextFormatting },
385
387
  ...paragraph.listRendering && { listRendering: remapListRendering(paragraph.listRendering, cloner) }
386
388
  };
387
389
  };
390
+ const createBookmarkIdMinter = (source) => {
391
+ let nextId = 0;
392
+ const remapped = /* @__PURE__ */ new Map();
393
+ const visit = (value, seen) => {
394
+ if (typeof value !== "object" || value === null || seen.has(value)) return;
395
+ seen.add(value);
396
+ if (Array.isArray(value)) {
397
+ value.forEach((item) => visit(item, seen));
398
+ return;
399
+ }
400
+ const record = value;
401
+ if (record["type"] === "bookmarkStart" || record["type"] === "bookmarkEnd") {
402
+ const id = record["id"];
403
+ if (typeof id === "number") nextId = Math.max(nextId, id + 1);
404
+ }
405
+ Object.values(record).forEach((item) => visit(item, seen));
406
+ };
407
+ visit(source, /* @__PURE__ */ new Set());
408
+ return { mint: (sourceId) => {
409
+ const existing = remapped.get(sourceId);
410
+ if (existing !== void 0) return existing;
411
+ const id = nextId++;
412
+ remapped.set(sourceId, id);
413
+ return id;
414
+ } };
415
+ };
416
+ const remapClonedBookmarkIds = (value, bookmarkIds) => {
417
+ const visit = (item, seen) => {
418
+ if (typeof item !== "object" || item === null || seen.has(item)) return;
419
+ seen.add(item);
420
+ if (Array.isArray(item)) {
421
+ item.forEach((child) => visit(child, seen));
422
+ return;
423
+ }
424
+ const record = item;
425
+ if (record["type"] === "bookmarkStart" || record["type"] === "bookmarkEnd") {
426
+ const id = record["id"];
427
+ if (typeof id === "number") record["id"] = bookmarkIds.mint(id);
428
+ }
429
+ Object.values(record).forEach((child) => visit(child, seen));
430
+ };
431
+ visit(value, /* @__PURE__ */ new Set());
432
+ return value;
433
+ };
388
434
  const remapListRendering = (rendering, cloner) => {
389
435
  const clonedAbstract = rendering.abstractNumId === void 0 ? void 0 : cloner.clonedAbstractNumId(rendering.abstractNumId);
390
436
  return {
@@ -399,7 +445,7 @@ const collectTableParagraphs = (table) => {
399
445
  else out.push(...collectTableParagraphs(item));
400
446
  return out;
401
447
  };
402
- const cloneTableForTarget = ({ table, editableParagraphIds, paraIds, styleCloner, cloner }) => {
448
+ const cloneTableForTarget = ({ table, editableParagraphIds, paraIds, styleCloner, cloner, bookmarkIds }) => {
403
449
  const paragraphs = [];
404
450
  const cloneTable = (source) => ({
405
451
  ...structuredClone(source),
@@ -410,7 +456,7 @@ const cloneTableForTarget = ({ table, editableParagraphIds, paraIds, styleCloner
410
456
  content: cell.content.map((item) => {
411
457
  if (item.type === "table") return cloneTable(item);
412
458
  const targetParaId = paraIds.mint(item.paraId);
413
- const copy = cloneParagraphForTarget(item, targetParaId, styleCloner, cloner);
459
+ const copy = cloneParagraphForTarget(item, targetParaId, styleCloner, cloner, bookmarkIds);
414
460
  if (item.paraId !== void 0 && editableParagraphIds.has(item.paraId)) paragraphs.push({
415
461
  sourceParaId: item.paraId,
416
462
  targetParaId,
package/dist/server.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { FolioAIBlock, FolioAIBlockAnchor, FolioAIBlockKind, FolioAIBlockPreviewRun, FolioAIComment, FolioAIEditApplyMode, FolioAIEditApplyResult, FolioAIEditOperation, FolioAIEditPrecondition, FolioAIEditSnapshot, FolioAIInlineFormatting, FolioAITextRangeHandle, FolioDocumentNavigationTarget, FolioDocumentOutline, FolioDocumentOutlineEntry, FolioDocumentSection, FolioDocumentSectionHandle, FolioDocumentSectionReadResult } from "./ai-edits/types.js";
2
- import { FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FolioDocumentOperation, FolioDocumentOperationAffectedTarget, FolioDocumentOperationBatch, FolioDocumentOperationCapabilities, FolioDocumentOperationIssue, FolioDocumentOperationMode, FolioDocumentOperationPrecondition, FolioDocumentOperationReceipt, FolioDocumentOperationRecovery, FolioDocumentOperationResult, FolioDocumentOperationStatus, FolioDocumentOperationStory, FolioDocumentOperationType, FolioDocumentOperationUndoFailureReason, FolioDocumentOperationUndoHandle, FolioDocumentOperationUndoResult, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, assertSupportedFolioDocumentOperationVersion, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, isFolioDocumentOperationModeSupported, isSupportedFolioDocumentOperationVersion, parseFolioDocumentOperationBatch } from "./document-operations.js";
2
+ import { FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_BATCH_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_KEYS_BY_TYPE, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FolioDocumentOperation, FolioDocumentOperationAffectedTarget, FolioDocumentOperationBatch, FolioDocumentOperationBatchPrecondition, FolioDocumentOperationCapabilities, FolioDocumentOperationIssue, FolioDocumentOperationMode, FolioDocumentOperationPrecondition, FolioDocumentOperationQueuedOperation, FolioDocumentOperationReceipt, FolioDocumentOperationRecovery, FolioDocumentOperationResult, FolioDocumentOperationStatus, FolioDocumentOperationStory, FolioDocumentOperationType, FolioDocumentOperationUndoFailureReason, FolioDocumentOperationUndoHandle, FolioDocumentOperationUndoResult, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, assertSupportedFolioDocumentOperationVersion, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, isFolioDocumentOperationModeSupported, isSupportedFolioDocumentOperationVersion, parseFolioDocumentOperationBatch } from "./document-operations.js";
3
3
  import { FolioReviewChange, FolioReviewChangeKind } from "./ai-edits/read.js";
4
4
  import { ApplyFolioAIEditsToBufferOptions, ApplyFolioAIEditsToBufferResult, FOLIO_RESOLVED_REVIEWED_VIEWS, FOLIO_REVIEWED_VIEWS, FolioApplyDocumentOperationsOptions, FolioApplyDocumentOperationsToStoryOptions, FolioApplyOperationsOptions, FolioDocumentStory, FolioDocumentStoryHandle, FolioDocumentStoryNotFoundError, FolioDocxReviewer, FolioDocxReviewerOptions, FolioEditableDocumentStoryHandle, FolioReadReviewedStoryOptions, FolioResolveReviewedStoryOptions, FolioResolvedReviewedView, FolioReviewChangeFilter, FolioReviewComment, FolioReviewCommentFilter, FolioReviewCommentReply, FolioReviewReplyInput, FolioReviewedStory, FolioReviewedView, UnsupportedFolioReviewedViewError, applyFolioAIEditsToBuffer, isFolioResolvedReviewedView, isFolioReviewedView } from "./ai-edits/headless.js";
5
5
  import { createFolioAITextRangeHandle, hashFolioAIBlockText, normalizeFolioAIBlockText } from "./ai-edits/snapshot.js";
@@ -27,4 +27,4 @@ import { FOLIO_DOCX_PACKAGE_INSPECTION_DEFAULTS, FOLIO_DOCX_PACKAGE_INSPECTION_E
27
27
  import { FOLIO_YJS_DOCX_MATERIALIZATION_ERROR_CODES, FOLIO_YJS_PROSEMIRROR_FRAGMENT_NAME, FOLIO_YJS_UPDATE_MAX_BYTES, FolioYjsDocxMaterializationError, FolioYjsDocxMaterializationErrorCode, MaterializeYjsDocxOptions, materializeYjsDocx } from "./docx/server/materializeYjsDocx.js";
28
28
  import { GenerateRedlineDocxOptions, GenerateRedlineDocxResult, GenerateRedlineUnprocessedStory, InvalidGenerateRedlineDocxOptionsError, generateRedlineDocx } from "./redline.js";
29
29
  import { FOLIO_VERSION_COMPARISON_PRIVACY_TRANSFORMS, FOLIO_VERSION_COMPARISON_SCOPES, FolioBlockDiff, FolioCompareDocxVersionsOptions, FolioDocumentMetadataValue, FolioFormatProperty, FolioMetadataDiff, FolioStoryDiff, FolioVersionBlockHandle, FolioVersionComparisonPrivacyTransform, FolioVersionComparisonScope, FolioVersionDiff, FolioVersionDiffPrivacyOptions, FolioVersionDiffPrivacyReport, FolioVersionDiffSegment, FolioVersionDiffSummaryCounts, InvalidFolioVersionComparisonOptionsError, applyFolioVersionDiffPrivacy, compareDocxVersions, isFolioVersionComparisonPrivacyTransform, isFolioVersionComparisonScope } from "./version-comparison.js";
30
- export { type ApplyDocxXmlPatchProposalArgs, type ApplyFolioAIEditsToBufferOptions, type ApplyFolioAIEditsToBufferResult, BILINGUAL_TABLE_LAYOUTS, type BilingualBorders, type BilingualParagraphRef, type BilingualRow, type BilingualRowKind, type BilingualTableLayout, type BilingualTableParagraphRef, type CreateBilingualDocumentOptions, type CreateBilingualDocumentResult, type CreateBilingualDocxOptions, type CreateBilingualDocxResult, type CreateCommentReplyInput, type CreateEmptyDocumentOptions, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, type DeriveBlockIdInput, type DocumentPreset, type DocumentStyleCatalog, type DocumentStyleCatalogEntry, type DocumentStyleSet, DocxArchiveError, type DocxArchiveOptions, type DocxParagraphSource, type DocxTableRowKind, type DocxTableRowPosition, EnsureParaIdsError, type EnsureParaIdsOptions, type EnsureParaIdsResult, type EvaluateDocxXmlPatchProposalArgs, type ExtractDocumentStyleSetOptions, type ExtractedDocxParagraph, type ExtractedDocxTableCell, type ExtractedDocxTableCellParagraph, type ExtractedDocxText, FOLIO_DOCUMENT_METADATA_PROPERTIES, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_DOCUMENT_PRIVACY_TRANSFORMS, FOLIO_DOCX_CONFORMANCE_CHECKS, FOLIO_DOCX_CONFORMANCE_ISSUE_CODES, FOLIO_DOCX_CONFORMANCE_PROFILE, FOLIO_DOCX_CONFORMANCE_REPORT_VERSION, FOLIO_DOCX_PACKAGE_INSPECTION_DEFAULTS, FOLIO_DOCX_PACKAGE_INSPECTION_ERROR_CODES, FOLIO_DOCX_PACKAGE_INSPECTION_VERSION, FOLIO_DOCX_XML_PATCH_APPLICATION_PROFILE, FOLIO_DOCX_XML_PATCH_APPLICATION_VERSION, FOLIO_DOCX_XML_PATCH_PROPOSAL_DEFAULTS, FOLIO_DOCX_XML_PATCH_PROPOSAL_ISSUE_CODES, FOLIO_DOCX_XML_PATCH_PROPOSAL_PROFILE, FOLIO_DOCX_XML_PATCH_PROPOSAL_VERSION, FOLIO_RESOLVED_REVIEWED_VIEWS, FOLIO_REVIEWED_VIEWS, FOLIO_VERSION_COMPARISON_PRIVACY_TRANSFORMS, FOLIO_VERSION_COMPARISON_SCOPES, FOLIO_YJS_DOCX_MATERIALIZATION_ERROR_CODES, FOLIO_YJS_PROSEMIRROR_FRAGMENT_NAME, FOLIO_YJS_UPDATE_MAX_BYTES, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIComment, type FolioAIEditApplyMode, type FolioAIEditApplyResult, type FolioAIEditOperation, type FolioAIEditPrecondition, type FolioAIEditSnapshot, type FolioAIInlineFormatting, type FolioAITextRangeHandle, type FolioApplyDocumentOperationsOptions, type FolioApplyDocumentOperationsToStoryOptions, type FolioApplyOperationsOptions, type FolioBlockDiff, type FolioBlockId, type FolioCompareDocxVersionsOptions, type FolioDocumentMetadataProperty, type FolioDocumentMetadataValue, type FolioDocumentNavigationTarget, type FolioDocumentOperation, type FolioDocumentOperationAffectedTarget, type FolioDocumentOperationBatch, type FolioDocumentOperationCapabilities, type FolioDocumentOperationIssue, type FolioDocumentOperationMode, type FolioDocumentOperationPrecondition, type FolioDocumentOperationReceipt, type FolioDocumentOperationRecovery, type FolioDocumentOperationResult, type FolioDocumentOperationStatus, type FolioDocumentOperationStory, type FolioDocumentOperationType, type FolioDocumentOperationUndoFailureReason, type FolioDocumentOperationUndoHandle, type FolioDocumentOperationUndoResult, type FolioDocumentOutline, type FolioDocumentOutlineEntry, FolioDocumentPrivacyArchiveError, type FolioDocumentPrivacyOptions, type FolioDocumentPrivacyReport, type FolioDocumentPrivacyTransform, type FolioDocumentSection, type FolioDocumentSectionHandle, type FolioDocumentSectionReadResult, type FolioDocumentStory, type FolioDocumentStoryHandle, FolioDocumentStoryNotFoundError, type FolioDocxConformanceCheck, type FolioDocxConformanceCheckId, type FolioDocxConformanceCheckStatus, type FolioDocxConformanceIssue, type FolioDocxConformanceIssueCode, type FolioDocxConformanceReport, type FolioDocxConformanceStatus, type FolioDocxInspectedXmlPart, type FolioDocxPackageInspection, FolioDocxPackageInspectionError, type FolioDocxPackageInspectionErrorCode, type FolioDocxPackageInspectionLimits, type FolioDocxPackagePart, type FolioDocxPackagePartKind, type FolioDocxPreparedXmlReplacement, FolioDocxReviewer, type FolioDocxReviewerOptions, type FolioDocxXmlPatchApplication, FolioDocxXmlPatchApplicationError, type FolioDocxXmlPatchApplicationReceipt, type FolioDocxXmlPatchProposal, type FolioDocxXmlPatchProposalEvaluation, type FolioDocxXmlPatchProposalIssue, type FolioDocxXmlPatchProposalIssueCode, type FolioDocxXmlPatchProposalLimits, type FolioDocxXmlReplacement, type FolioEditableDocumentStoryHandle, type FolioFormatProperty, type FolioMetadataDiff, type FolioReadReviewedStoryOptions, type FolioResolveReviewedStoryOptions, type FolioResolvedReviewedView, type FolioReviewChange, type FolioReviewChangeFilter, type FolioReviewChangeKind, type FolioReviewComment, type FolioReviewCommentFilter, type FolioReviewCommentReply, type FolioReviewReplyInput, type FolioReviewedStory, type FolioReviewedView, type FolioStoryDiff, type FolioVersionBlockHandle, type FolioVersionComparisonPrivacyTransform, type FolioVersionComparisonScope, type FolioVersionDiff, type FolioVersionDiffPrivacyOptions, type FolioVersionDiffPrivacyReport, type FolioVersionDiffSegment, type FolioVersionDiffSummaryCounts, FolioYjsDocxMaterializationError, type FolioYjsDocxMaterializationErrorCode, type GenerateRedlineDocxOptions, type GenerateRedlineDocxResult, type GenerateRedlineUnprocessedStory, HEADING_LEVELS, type HeadingLevel, type InspectDocxPackageOptions, InvalidBilingualDocumentOptionsError, InvalidFolioDocumentOperationBatchError, InvalidFolioDocumentPrivacyOptionsError, InvalidFolioDocxXmlPatchProposalError, InvalidFolioDocxXmlPatchProposalOptionsError, InvalidFolioReportBuilderOptionsError, InvalidFolioVersionComparisonOptionsError, InvalidGenerateRedlineDocxOptionsError, type MaterializeYjsDocxOptions, type ParseOptions, type RewriteDocxMetadataPrivacyResult, STELLA_STYLE_SET_NAME, type TableCellSpec, UnsupportedFolioDocumentOperationVersionError, UnsupportedFolioDocxXmlPatchApplicationProfileError, UnsupportedFolioReviewedViewError, type ValidateDocxConformanceOptions, applyDocxXmlPatchProposal, applyFolioAIEditsToBuffer, applyFolioVersionDiffPrivacy, assertSupportedFolioDocumentOperationVersion, bookmark, compareDocxVersions, createBilingualDocument, createBilingualDocx, createDocx, createEmptyDocument, createFolioAITextRangeHandle, createStellaStyleDocumentPreset, createStellaStyleSet, createTableOfContentsField, deriveBlockId, docxToMarkdown, endnote, ensureParaIds, evaluateDocxXmlPatchProposal, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractDocxText, generateRedlineDocx, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioDocumentOutline, getFolioParaIdFromBlockId, hashFolioAIBlockText, heading, hyperlink, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxPackage, isFolioBlockId, isFolioDocumentOperationModeSupported, isFolioDocumentPrivacyTransform, isFolioResolvedReviewedView, isFolioReviewedView, isFolioVersionComparisonPrivacyTransform, isFolioVersionComparisonScope, isSequentialFolioBlockId, isSupportedFolioDocumentOperationVersion, materializeYjsDocx, normalizeFolioAIBlockText, pageBreak, paragraph, parseDocx, parseFolioDocumentOperationBatch, parseFolioDocxXmlPatchProposal, readBilingualDocument, readBilingualDocx, readFolioDocumentSection, replyToComment, rewriteDocxMetadataPrivacy, run, table, validateDocxConformance };
30
+ export { type ApplyDocxXmlPatchProposalArgs, type ApplyFolioAIEditsToBufferOptions, type ApplyFolioAIEditsToBufferResult, BILINGUAL_TABLE_LAYOUTS, type BilingualBorders, type BilingualParagraphRef, type BilingualRow, type BilingualRowKind, type BilingualTableLayout, type BilingualTableParagraphRef, type CreateBilingualDocumentOptions, type CreateBilingualDocumentResult, type CreateBilingualDocxOptions, type CreateBilingualDocxResult, type CreateCommentReplyInput, type CreateEmptyDocumentOptions, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, type DeriveBlockIdInput, type DocumentPreset, type DocumentStyleCatalog, type DocumentStyleCatalogEntry, type DocumentStyleSet, DocxArchiveError, type DocxArchiveOptions, type DocxParagraphSource, type DocxTableRowKind, type DocxTableRowPosition, EnsureParaIdsError, type EnsureParaIdsOptions, type EnsureParaIdsResult, type EvaluateDocxXmlPatchProposalArgs, type ExtractDocumentStyleSetOptions, type ExtractedDocxParagraph, type ExtractedDocxTableCell, type ExtractedDocxTableCellParagraph, type ExtractedDocxText, FOLIO_DOCUMENT_METADATA_PROPERTIES, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_BATCH_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_KEYS_BY_TYPE, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_DOCUMENT_PRIVACY_TRANSFORMS, FOLIO_DOCX_CONFORMANCE_CHECKS, FOLIO_DOCX_CONFORMANCE_ISSUE_CODES, FOLIO_DOCX_CONFORMANCE_PROFILE, FOLIO_DOCX_CONFORMANCE_REPORT_VERSION, FOLIO_DOCX_PACKAGE_INSPECTION_DEFAULTS, FOLIO_DOCX_PACKAGE_INSPECTION_ERROR_CODES, FOLIO_DOCX_PACKAGE_INSPECTION_VERSION, FOLIO_DOCX_XML_PATCH_APPLICATION_PROFILE, FOLIO_DOCX_XML_PATCH_APPLICATION_VERSION, FOLIO_DOCX_XML_PATCH_PROPOSAL_DEFAULTS, FOLIO_DOCX_XML_PATCH_PROPOSAL_ISSUE_CODES, FOLIO_DOCX_XML_PATCH_PROPOSAL_PROFILE, FOLIO_DOCX_XML_PATCH_PROPOSAL_VERSION, FOLIO_RESOLVED_REVIEWED_VIEWS, FOLIO_REVIEWED_VIEWS, FOLIO_VERSION_COMPARISON_PRIVACY_TRANSFORMS, FOLIO_VERSION_COMPARISON_SCOPES, FOLIO_YJS_DOCX_MATERIALIZATION_ERROR_CODES, FOLIO_YJS_PROSEMIRROR_FRAGMENT_NAME, FOLIO_YJS_UPDATE_MAX_BYTES, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIComment, type FolioAIEditApplyMode, type FolioAIEditApplyResult, type FolioAIEditOperation, type FolioAIEditPrecondition, type FolioAIEditSnapshot, type FolioAIInlineFormatting, type FolioAITextRangeHandle, type FolioApplyDocumentOperationsOptions, type FolioApplyDocumentOperationsToStoryOptions, type FolioApplyOperationsOptions, type FolioBlockDiff, type FolioBlockId, type FolioCompareDocxVersionsOptions, type FolioDocumentMetadataProperty, type FolioDocumentMetadataValue, type FolioDocumentNavigationTarget, type FolioDocumentOperation, type FolioDocumentOperationAffectedTarget, type FolioDocumentOperationBatch, type FolioDocumentOperationBatchPrecondition, type FolioDocumentOperationCapabilities, type FolioDocumentOperationIssue, type FolioDocumentOperationMode, type FolioDocumentOperationPrecondition, type FolioDocumentOperationQueuedOperation, type FolioDocumentOperationReceipt, type FolioDocumentOperationRecovery, type FolioDocumentOperationResult, type FolioDocumentOperationStatus, type FolioDocumentOperationStory, type FolioDocumentOperationType, type FolioDocumentOperationUndoFailureReason, type FolioDocumentOperationUndoHandle, type FolioDocumentOperationUndoResult, type FolioDocumentOutline, type FolioDocumentOutlineEntry, FolioDocumentPrivacyArchiveError, type FolioDocumentPrivacyOptions, type FolioDocumentPrivacyReport, type FolioDocumentPrivacyTransform, type FolioDocumentSection, type FolioDocumentSectionHandle, type FolioDocumentSectionReadResult, type FolioDocumentStory, type FolioDocumentStoryHandle, FolioDocumentStoryNotFoundError, type FolioDocxConformanceCheck, type FolioDocxConformanceCheckId, type FolioDocxConformanceCheckStatus, type FolioDocxConformanceIssue, type FolioDocxConformanceIssueCode, type FolioDocxConformanceReport, type FolioDocxConformanceStatus, type FolioDocxInspectedXmlPart, type FolioDocxPackageInspection, FolioDocxPackageInspectionError, type FolioDocxPackageInspectionErrorCode, type FolioDocxPackageInspectionLimits, type FolioDocxPackagePart, type FolioDocxPackagePartKind, type FolioDocxPreparedXmlReplacement, FolioDocxReviewer, type FolioDocxReviewerOptions, type FolioDocxXmlPatchApplication, FolioDocxXmlPatchApplicationError, type FolioDocxXmlPatchApplicationReceipt, type FolioDocxXmlPatchProposal, type FolioDocxXmlPatchProposalEvaluation, type FolioDocxXmlPatchProposalIssue, type FolioDocxXmlPatchProposalIssueCode, type FolioDocxXmlPatchProposalLimits, type FolioDocxXmlReplacement, type FolioEditableDocumentStoryHandle, type FolioFormatProperty, type FolioMetadataDiff, type FolioReadReviewedStoryOptions, type FolioResolveReviewedStoryOptions, type FolioResolvedReviewedView, type FolioReviewChange, type FolioReviewChangeFilter, type FolioReviewChangeKind, type FolioReviewComment, type FolioReviewCommentFilter, type FolioReviewCommentReply, type FolioReviewReplyInput, type FolioReviewedStory, type FolioReviewedView, type FolioStoryDiff, type FolioVersionBlockHandle, type FolioVersionComparisonPrivacyTransform, type FolioVersionComparisonScope, type FolioVersionDiff, type FolioVersionDiffPrivacyOptions, type FolioVersionDiffPrivacyReport, type FolioVersionDiffSegment, type FolioVersionDiffSummaryCounts, FolioYjsDocxMaterializationError, type FolioYjsDocxMaterializationErrorCode, type GenerateRedlineDocxOptions, type GenerateRedlineDocxResult, type GenerateRedlineUnprocessedStory, HEADING_LEVELS, type HeadingLevel, type InspectDocxPackageOptions, InvalidBilingualDocumentOptionsError, InvalidFolioDocumentOperationBatchError, InvalidFolioDocumentPrivacyOptionsError, InvalidFolioDocxXmlPatchProposalError, InvalidFolioDocxXmlPatchProposalOptionsError, InvalidFolioReportBuilderOptionsError, InvalidFolioVersionComparisonOptionsError, InvalidGenerateRedlineDocxOptionsError, type MaterializeYjsDocxOptions, type ParseOptions, type RewriteDocxMetadataPrivacyResult, STELLA_STYLE_SET_NAME, type TableCellSpec, UnsupportedFolioDocumentOperationVersionError, UnsupportedFolioDocxXmlPatchApplicationProfileError, UnsupportedFolioReviewedViewError, type ValidateDocxConformanceOptions, applyDocxXmlPatchProposal, applyFolioAIEditsToBuffer, applyFolioVersionDiffPrivacy, assertSupportedFolioDocumentOperationVersion, bookmark, compareDocxVersions, createBilingualDocument, createBilingualDocx, createDocx, createEmptyDocument, createFolioAITextRangeHandle, createStellaStyleDocumentPreset, createStellaStyleSet, createTableOfContentsField, deriveBlockId, docxToMarkdown, endnote, ensureParaIds, evaluateDocxXmlPatchProposal, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractDocxText, generateRedlineDocx, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioDocumentOutline, getFolioParaIdFromBlockId, hashFolioAIBlockText, heading, hyperlink, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxPackage, isFolioBlockId, isFolioDocumentOperationModeSupported, isFolioDocumentPrivacyTransform, isFolioResolvedReviewedView, isFolioReviewedView, isFolioVersionComparisonPrivacyTransform, isFolioVersionComparisonScope, isSequentialFolioBlockId, isSupportedFolioDocumentOperationVersion, materializeYjsDocx, normalizeFolioAIBlockText, pageBreak, paragraph, parseDocx, parseFolioDocumentOperationBatch, parseFolioDocxXmlPatchProposal, readBilingualDocument, readBilingualDocx, readFolioDocumentSection, replyToComment, rewriteDocxMetadataPrivacy, run, table, validateDocxConformance };
package/dist/server.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { FOLIO_RESOLVED_REVIEWED_VIEWS, FOLIO_REVIEWED_VIEWS, FolioDocumentStoryNotFoundError, FolioDocxReviewer, UnsupportedFolioReviewedViewError, applyFolioAIEditsToBuffer, isFolioResolvedReviewedView, isFolioReviewedView } from "./ai-edits/headless.js";
2
2
  import { getFolioDocumentOutline, readFolioDocumentSection } from "./ai-edits/scoped-reading.js";
3
3
  import { createFolioAITextRangeHandle, hashFolioAIBlockText, normalizeFolioAIBlockText } from "./ai-edits/snapshot.js";
4
- import { FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, assertSupportedFolioDocumentOperationVersion, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, isFolioDocumentOperationModeSupported, isSupportedFolioDocumentOperationVersion, parseFolioDocumentOperationBatch } from "./document-operations.js";
4
+ import { FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_BATCH_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_KEYS_BY_TYPE, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, assertSupportedFolioDocumentOperationVersion, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, isFolioDocumentOperationModeSupported, isSupportedFolioDocumentOperationVersion, parseFolioDocumentOperationBatch } from "./document-operations.js";
5
5
  import { EnsureParaIdsError, ensureParaIds } from "./docx/ensureParaIds.js";
6
6
  import { FOLIO_DOCUMENT_METADATA_PROPERTIES, FOLIO_DOCUMENT_PRIVACY_TRANSFORMS, FolioDocumentPrivacyArchiveError, InvalidFolioDocumentPrivacyOptionsError, isFolioDocumentPrivacyTransform, rewriteDocxMetadataPrivacy } from "./docx/metadataPrivacy.js";
7
7
  import { parseDocx } from "./docx/parser.js";
@@ -25,4 +25,4 @@ import { DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION } from "./style-set
25
25
  import { deriveBlockId, getFolioParaIdFromBlockId, isFolioBlockId, isSequentialFolioBlockId } from "./types/block-id.js";
26
26
  import { createEmptyDocument } from "./utils/createDocument.js";
27
27
  import { FOLIO_VERSION_COMPARISON_PRIVACY_TRANSFORMS, FOLIO_VERSION_COMPARISON_SCOPES, InvalidFolioVersionComparisonOptionsError, applyFolioVersionDiffPrivacy, compareDocxVersions, isFolioVersionComparisonPrivacyTransform, isFolioVersionComparisonScope } from "./version-comparison.js";
28
- export { BILINGUAL_TABLE_LAYOUTS, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, DocxArchiveError, EnsureParaIdsError, FOLIO_DOCUMENT_METADATA_PROPERTIES, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_DOCUMENT_PRIVACY_TRANSFORMS, FOLIO_DOCX_CONFORMANCE_CHECKS, FOLIO_DOCX_CONFORMANCE_ISSUE_CODES, FOLIO_DOCX_CONFORMANCE_PROFILE, FOLIO_DOCX_CONFORMANCE_REPORT_VERSION, FOLIO_DOCX_PACKAGE_INSPECTION_DEFAULTS, FOLIO_DOCX_PACKAGE_INSPECTION_ERROR_CODES, FOLIO_DOCX_PACKAGE_INSPECTION_VERSION, FOLIO_DOCX_XML_PATCH_APPLICATION_PROFILE, FOLIO_DOCX_XML_PATCH_APPLICATION_VERSION, FOLIO_DOCX_XML_PATCH_PROPOSAL_DEFAULTS, FOLIO_DOCX_XML_PATCH_PROPOSAL_ISSUE_CODES, FOLIO_DOCX_XML_PATCH_PROPOSAL_PROFILE, FOLIO_DOCX_XML_PATCH_PROPOSAL_VERSION, FOLIO_RESOLVED_REVIEWED_VIEWS, FOLIO_REVIEWED_VIEWS, FOLIO_VERSION_COMPARISON_PRIVACY_TRANSFORMS, FOLIO_VERSION_COMPARISON_SCOPES, FOLIO_YJS_DOCX_MATERIALIZATION_ERROR_CODES, FOLIO_YJS_PROSEMIRROR_FRAGMENT_NAME, FOLIO_YJS_UPDATE_MAX_BYTES, FolioDocumentPrivacyArchiveError, FolioDocumentStoryNotFoundError, FolioDocxPackageInspectionError, FolioDocxReviewer, FolioDocxXmlPatchApplicationError, FolioYjsDocxMaterializationError, HEADING_LEVELS, InvalidBilingualDocumentOptionsError, InvalidFolioDocumentOperationBatchError, InvalidFolioDocumentPrivacyOptionsError, InvalidFolioDocxXmlPatchProposalError, InvalidFolioDocxXmlPatchProposalOptionsError, InvalidFolioReportBuilderOptionsError, InvalidFolioVersionComparisonOptionsError, InvalidGenerateRedlineDocxOptionsError, STELLA_STYLE_SET_NAME, UnsupportedFolioDocumentOperationVersionError, UnsupportedFolioDocxXmlPatchApplicationProfileError, UnsupportedFolioReviewedViewError, applyDocxXmlPatchProposal, applyFolioAIEditsToBuffer, applyFolioVersionDiffPrivacy, assertSupportedFolioDocumentOperationVersion, bookmark, compareDocxVersions, createBilingualDocument, createBilingualDocx, createDocx, createEmptyDocument, createFolioAITextRangeHandle, createStellaStyleDocumentPreset, createStellaStyleSet, createTableOfContentsField, deriveBlockId, docxToMarkdown, endnote, ensureParaIds, evaluateDocxXmlPatchProposal, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractDocxText, generateRedlineDocx, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioDocumentOutline, getFolioParaIdFromBlockId, hashFolioAIBlockText, heading, hyperlink, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxPackage, isFolioBlockId, isFolioDocumentOperationModeSupported, isFolioDocumentPrivacyTransform, isFolioResolvedReviewedView, isFolioReviewedView, isFolioVersionComparisonPrivacyTransform, isFolioVersionComparisonScope, isSequentialFolioBlockId, isSupportedFolioDocumentOperationVersion, materializeYjsDocx, normalizeFolioAIBlockText, pageBreak, paragraph, parseDocx, parseFolioDocumentOperationBatch, parseFolioDocxXmlPatchProposal, readBilingualDocument, readBilingualDocx, readFolioDocumentSection, replyToComment, rewriteDocxMetadataPrivacy, run, table, validateDocxConformance };
28
+ export { BILINGUAL_TABLE_LAYOUTS, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, DocxArchiveError, EnsureParaIdsError, FOLIO_DOCUMENT_METADATA_PROPERTIES, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_BATCH_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_KEYS_BY_TYPE, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_DOCUMENT_PRIVACY_TRANSFORMS, FOLIO_DOCX_CONFORMANCE_CHECKS, FOLIO_DOCX_CONFORMANCE_ISSUE_CODES, FOLIO_DOCX_CONFORMANCE_PROFILE, FOLIO_DOCX_CONFORMANCE_REPORT_VERSION, FOLIO_DOCX_PACKAGE_INSPECTION_DEFAULTS, FOLIO_DOCX_PACKAGE_INSPECTION_ERROR_CODES, FOLIO_DOCX_PACKAGE_INSPECTION_VERSION, FOLIO_DOCX_XML_PATCH_APPLICATION_PROFILE, FOLIO_DOCX_XML_PATCH_APPLICATION_VERSION, FOLIO_DOCX_XML_PATCH_PROPOSAL_DEFAULTS, FOLIO_DOCX_XML_PATCH_PROPOSAL_ISSUE_CODES, FOLIO_DOCX_XML_PATCH_PROPOSAL_PROFILE, FOLIO_DOCX_XML_PATCH_PROPOSAL_VERSION, FOLIO_RESOLVED_REVIEWED_VIEWS, FOLIO_REVIEWED_VIEWS, FOLIO_VERSION_COMPARISON_PRIVACY_TRANSFORMS, FOLIO_VERSION_COMPARISON_SCOPES, FOLIO_YJS_DOCX_MATERIALIZATION_ERROR_CODES, FOLIO_YJS_PROSEMIRROR_FRAGMENT_NAME, FOLIO_YJS_UPDATE_MAX_BYTES, FolioDocumentPrivacyArchiveError, FolioDocumentStoryNotFoundError, FolioDocxPackageInspectionError, FolioDocxReviewer, FolioDocxXmlPatchApplicationError, FolioYjsDocxMaterializationError, HEADING_LEVELS, InvalidBilingualDocumentOptionsError, InvalidFolioDocumentOperationBatchError, InvalidFolioDocumentPrivacyOptionsError, InvalidFolioDocxXmlPatchProposalError, InvalidFolioDocxXmlPatchProposalOptionsError, InvalidFolioReportBuilderOptionsError, InvalidFolioVersionComparisonOptionsError, InvalidGenerateRedlineDocxOptionsError, STELLA_STYLE_SET_NAME, UnsupportedFolioDocumentOperationVersionError, UnsupportedFolioDocxXmlPatchApplicationProfileError, UnsupportedFolioReviewedViewError, applyDocxXmlPatchProposal, applyFolioAIEditsToBuffer, applyFolioVersionDiffPrivacy, assertSupportedFolioDocumentOperationVersion, bookmark, compareDocxVersions, createBilingualDocument, createBilingualDocx, createDocx, createEmptyDocument, createFolioAITextRangeHandle, createStellaStyleDocumentPreset, createStellaStyleSet, createTableOfContentsField, deriveBlockId, docxToMarkdown, endnote, ensureParaIds, evaluateDocxXmlPatchProposal, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractDocxText, generateRedlineDocx, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioDocumentOutline, getFolioParaIdFromBlockId, hashFolioAIBlockText, heading, hyperlink, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxPackage, isFolioBlockId, isFolioDocumentOperationModeSupported, isFolioDocumentPrivacyTransform, isFolioResolvedReviewedView, isFolioReviewedView, isFolioVersionComparisonPrivacyTransform, isFolioVersionComparisonScope, isSequentialFolioBlockId, isSupportedFolioDocumentOperationVersion, materializeYjsDocx, normalizeFolioAIBlockText, pageBreak, paragraph, parseDocx, parseFolioDocumentOperationBatch, parseFolioDocxXmlPatchProposal, readBilingualDocument, readBilingualDocx, readFolioDocumentSection, replyToComment, rewriteDocxMetadataPrivacy, run, table, validateDocxConformance };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stll/folio-core",
3
- "version": "0.31.1",
3
+ "version": "0.32.0",
4
4
  "description": "Headless, framework-neutral core of folio: the OOXML (.docx) parser, document model, ProseMirror integration, and page-layout engine. No React.",
5
5
  "keywords": [
6
6
  "document-model",