@stll/folio-agents 0.12.0 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/operation-schema.d.ts +199 -2
- package/dist/operation-schema.js +118 -21
- package/dist/tools.js +24 -17
- package/package.json +2 -2
|
@@ -15,6 +15,7 @@ type FolioJsonSchema = {
|
|
|
15
15
|
readonly additionalProperties?: boolean;
|
|
16
16
|
readonly items?: FolioJsonSchema;
|
|
17
17
|
readonly oneOf?: readonly FolioJsonSchema[];
|
|
18
|
+
readonly not?: FolioJsonSchema;
|
|
18
19
|
};
|
|
19
20
|
/**
|
|
20
21
|
* JSON Schema for the contract's `textRange` handle (a serializable range
|
|
@@ -49,8 +50,74 @@ declare const FOLIO_CLEARABLE_LIST_LEVEL_JSON_SCHEMA: {
|
|
|
49
50
|
}, {
|
|
50
51
|
readonly type: "null";
|
|
51
52
|
}];
|
|
52
|
-
readonly description: "`w:numPr/w:ilvl`, zero-based; a number retains the paragraph or anchor's numbering instance (`numId`), while null removes paragraph numbering.";
|
|
53
|
+
readonly description: "`w:numPr/w:ilvl`, zero-based; a number retains the paragraph or anchor's numbering instance (`numId`), while null removes paragraph numbering unless a concrete numbering instance is supplied, in which case it omits the direct level.";
|
|
53
54
|
};
|
|
55
|
+
/** Complete direct `w:ind` attributes, or null to restore style inheritance. */
|
|
56
|
+
declare const FOLIO_CLEARABLE_PARAGRAPH_INDENTATION_JSON_SCHEMA: {
|
|
57
|
+
readonly oneOf: readonly [{
|
|
58
|
+
readonly type: "object";
|
|
59
|
+
readonly properties: {
|
|
60
|
+
readonly indentLeft: {
|
|
61
|
+
readonly type: "integer";
|
|
62
|
+
readonly minimum: number;
|
|
63
|
+
readonly maximum: number;
|
|
64
|
+
};
|
|
65
|
+
readonly indentRight: {
|
|
66
|
+
readonly type: "integer";
|
|
67
|
+
readonly minimum: number;
|
|
68
|
+
readonly maximum: number;
|
|
69
|
+
};
|
|
70
|
+
readonly indentFirstLine: {
|
|
71
|
+
readonly type: "integer";
|
|
72
|
+
readonly minimum: number;
|
|
73
|
+
readonly maximum: number;
|
|
74
|
+
};
|
|
75
|
+
readonly hangingIndent: {
|
|
76
|
+
readonly type: "boolean";
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
readonly minProperties: 1;
|
|
80
|
+
readonly additionalProperties: false;
|
|
81
|
+
}, {
|
|
82
|
+
readonly type: "null";
|
|
83
|
+
}];
|
|
84
|
+
readonly description: "Complete direct paragraph indentation (`w:ind`); null removes the direct child and restores style inheritance.";
|
|
85
|
+
};
|
|
86
|
+
declare const FOLIO_CLEARABLE_NUMBERING_JSON_SCHEMA: {
|
|
87
|
+
readonly oneOf: readonly [{
|
|
88
|
+
readonly type: "object";
|
|
89
|
+
readonly properties: {
|
|
90
|
+
readonly numId: {
|
|
91
|
+
readonly type: "integer";
|
|
92
|
+
readonly minimum: 1;
|
|
93
|
+
readonly maximum: number;
|
|
94
|
+
};
|
|
95
|
+
readonly level: {
|
|
96
|
+
readonly type: "integer";
|
|
97
|
+
readonly minimum: 0;
|
|
98
|
+
readonly maximum: number;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
readonly required: readonly ["numId", "level"];
|
|
102
|
+
readonly additionalProperties: false;
|
|
103
|
+
}, {
|
|
104
|
+
readonly type: "null";
|
|
105
|
+
}];
|
|
106
|
+
readonly description: "Concrete numbering instance and level; null removes paragraph numbering.";
|
|
107
|
+
};
|
|
108
|
+
declare const FOLIO_HARD_PAGE_BREAK_JSON_SCHEMA: {
|
|
109
|
+
readonly type: "object";
|
|
110
|
+
readonly properties: {
|
|
111
|
+
readonly clear: {
|
|
112
|
+
readonly type: "string";
|
|
113
|
+
readonly enum: readonly ["none", "left", "right", "all"];
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
readonly additionalProperties: false;
|
|
117
|
+
readonly description: "Insert an empty hard page-break run; it cannot be combined with text, pageBreakBefore, or lineBreakMode.";
|
|
118
|
+
};
|
|
119
|
+
/** Shared cross-field constraint for insertion and suggest-changes projections. */
|
|
120
|
+
declare const FOLIO_HARD_PAGE_BREAK_OPERATION_CONSTRAINT: Pick<FolioJsonSchema, "oneOf">;
|
|
54
121
|
/** Complete direct `w:spacing` attributes, or null to restore style inheritance. */
|
|
55
122
|
declare const FOLIO_CLEARABLE_PARAGRAPH_SPACING_JSON_SCHEMA: {
|
|
56
123
|
readonly oneOf: readonly [{
|
|
@@ -95,6 +162,136 @@ declare const FOLIO_CLEARABLE_PARAGRAPH_SPACING_JSON_SCHEMA: {
|
|
|
95
162
|
}];
|
|
96
163
|
readonly description: "Complete direct paragraph spacing (`w:spacing`); omitted attributes stay absent, while zero and false remain explicit. Null removes the direct spacing child and restores style inheritance.";
|
|
97
164
|
};
|
|
165
|
+
declare const FOLIO_BLOCK_PARAGRAPH_PROPERTIES_JSON_SCHEMA: {
|
|
166
|
+
readonly type: "object";
|
|
167
|
+
readonly description: "The paragraph properties to set; at least one.";
|
|
168
|
+
readonly properties: {
|
|
169
|
+
readonly styleId: {
|
|
170
|
+
readonly oneOf: readonly [{
|
|
171
|
+
readonly type: "string";
|
|
172
|
+
}, {
|
|
173
|
+
readonly type: "null";
|
|
174
|
+
}];
|
|
175
|
+
readonly description: "Paragraph style id; null clears the direct style.";
|
|
176
|
+
};
|
|
177
|
+
readonly listLevel: {
|
|
178
|
+
readonly oneOf: readonly [{
|
|
179
|
+
readonly type: "integer";
|
|
180
|
+
readonly minimum: 0;
|
|
181
|
+
readonly maximum: number;
|
|
182
|
+
}, {
|
|
183
|
+
readonly type: "null";
|
|
184
|
+
}];
|
|
185
|
+
readonly description: "`w:numPr/w:ilvl`, zero-based; a number retains the paragraph or anchor's numbering instance (`numId`), while null removes paragraph numbering unless a concrete numbering instance is supplied, in which case it omits the direct level.";
|
|
186
|
+
};
|
|
187
|
+
readonly numbering: {
|
|
188
|
+
readonly oneOf: readonly [{
|
|
189
|
+
readonly type: "object";
|
|
190
|
+
readonly properties: {
|
|
191
|
+
readonly numId: {
|
|
192
|
+
readonly type: "integer";
|
|
193
|
+
readonly minimum: 1;
|
|
194
|
+
readonly maximum: number;
|
|
195
|
+
};
|
|
196
|
+
readonly level: {
|
|
197
|
+
readonly type: "integer";
|
|
198
|
+
readonly minimum: 0;
|
|
199
|
+
readonly maximum: number;
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
readonly required: readonly ["numId", "level"];
|
|
203
|
+
readonly additionalProperties: false;
|
|
204
|
+
}, {
|
|
205
|
+
readonly type: "null";
|
|
206
|
+
}];
|
|
207
|
+
readonly description: "Concrete numbering instance and level; null removes paragraph numbering.";
|
|
208
|
+
};
|
|
209
|
+
readonly indentation: {
|
|
210
|
+
readonly oneOf: readonly [{
|
|
211
|
+
readonly type: "object";
|
|
212
|
+
readonly properties: {
|
|
213
|
+
readonly indentLeft: {
|
|
214
|
+
readonly type: "integer";
|
|
215
|
+
readonly minimum: number;
|
|
216
|
+
readonly maximum: number;
|
|
217
|
+
};
|
|
218
|
+
readonly indentRight: {
|
|
219
|
+
readonly type: "integer";
|
|
220
|
+
readonly minimum: number;
|
|
221
|
+
readonly maximum: number;
|
|
222
|
+
};
|
|
223
|
+
readonly indentFirstLine: {
|
|
224
|
+
readonly type: "integer";
|
|
225
|
+
readonly minimum: number;
|
|
226
|
+
readonly maximum: number;
|
|
227
|
+
};
|
|
228
|
+
readonly hangingIndent: {
|
|
229
|
+
readonly type: "boolean";
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
readonly minProperties: 1;
|
|
233
|
+
readonly additionalProperties: false;
|
|
234
|
+
}, {
|
|
235
|
+
readonly type: "null";
|
|
236
|
+
}];
|
|
237
|
+
readonly description: "Complete direct paragraph indentation (`w:ind`); null removes the direct child and restores style inheritance.";
|
|
238
|
+
};
|
|
239
|
+
readonly alignment: {
|
|
240
|
+
readonly oneOf: readonly [{
|
|
241
|
+
readonly type: "string";
|
|
242
|
+
readonly enum: readonly ("left" | "right" | "center" | "both" | "distribute" | "mediumKashida" | "highKashida" | "lowKashida" | "thaiDistribute")[];
|
|
243
|
+
}, {
|
|
244
|
+
readonly type: "null";
|
|
245
|
+
}];
|
|
246
|
+
readonly description: "Direct paragraph alignment; null restores style inheritance.";
|
|
247
|
+
};
|
|
248
|
+
readonly spacing: {
|
|
249
|
+
readonly oneOf: readonly [{
|
|
250
|
+
readonly type: "object";
|
|
251
|
+
readonly properties: {
|
|
252
|
+
readonly spaceBefore: {
|
|
253
|
+
readonly type: "integer";
|
|
254
|
+
readonly minimum: 0;
|
|
255
|
+
readonly maximum: number;
|
|
256
|
+
readonly description: "Non-negative space before, in twips.";
|
|
257
|
+
};
|
|
258
|
+
readonly spaceAfter: {
|
|
259
|
+
readonly type: "integer";
|
|
260
|
+
readonly minimum: 0;
|
|
261
|
+
readonly maximum: number;
|
|
262
|
+
readonly description: "Non-negative space after, in twips.";
|
|
263
|
+
};
|
|
264
|
+
readonly lineSpacing: {
|
|
265
|
+
readonly type: "integer";
|
|
266
|
+
readonly minimum: number;
|
|
267
|
+
readonly maximum: number;
|
|
268
|
+
readonly description: "Signed line spacing: 240ths of a line with the auto rule, otherwise twips.";
|
|
269
|
+
};
|
|
270
|
+
readonly lineSpacingRule: {
|
|
271
|
+
readonly type: "string";
|
|
272
|
+
readonly enum: readonly ("auto" | "exact" | "atLeast")[];
|
|
273
|
+
readonly description: "How `lineSpacing` is interpreted.";
|
|
274
|
+
};
|
|
275
|
+
readonly beforeAutospacing: {
|
|
276
|
+
readonly type: "boolean";
|
|
277
|
+
readonly description: "Whether the application determines spacing before automatically.";
|
|
278
|
+
};
|
|
279
|
+
readonly afterAutospacing: {
|
|
280
|
+
readonly type: "boolean";
|
|
281
|
+
readonly description: "Whether the application determines spacing after automatically.";
|
|
282
|
+
};
|
|
283
|
+
};
|
|
284
|
+
readonly minProperties: 1;
|
|
285
|
+
readonly additionalProperties: false;
|
|
286
|
+
}, {
|
|
287
|
+
readonly type: "null";
|
|
288
|
+
}];
|
|
289
|
+
readonly description: "Complete direct paragraph spacing (`w:spacing`); omitted attributes stay absent, while zero and false remain explicit. Null removes the direct spacing child and restores style inheritance.";
|
|
290
|
+
};
|
|
291
|
+
};
|
|
292
|
+
readonly minProperties: 1;
|
|
293
|
+
readonly additionalProperties: false;
|
|
294
|
+
};
|
|
98
295
|
/**
|
|
99
296
|
* JSON Schema (draft-07 compatible) for ONE document operation: the full
|
|
100
297
|
* union accepted by `parseFolioDocumentOperationBatch` in
|
|
@@ -163,4 +360,4 @@ type FolioDocumentOperationBatchSchema = StandardSchemaV1<unknown, FolioDocument
|
|
|
163
360
|
*/
|
|
164
361
|
declare const folioDocumentOperationBatchSchema: FolioDocumentOperationBatchSchema;
|
|
165
362
|
//#endregion
|
|
166
|
-
export { FOLIO_CLEARABLE_LIST_LEVEL_JSON_SCHEMA, FOLIO_CLEARABLE_PARAGRAPH_SPACING_JSON_SCHEMA, FOLIO_CLEARABLE_PARAGRAPH_STYLE_ID_JSON_SCHEMA, FOLIO_DOCUMENT_OPERATION_BATCH_JSON_SCHEMA, FOLIO_DOCUMENT_OPERATION_JSON_SCHEMA, FOLIO_PRECONDITION_JSON_SCHEMA, FOLIO_TEXT_RANGE_JSON_SCHEMA, FolioJsonSchema, folioDocumentOperationBatchSchema };
|
|
363
|
+
export { FOLIO_BLOCK_PARAGRAPH_PROPERTIES_JSON_SCHEMA, FOLIO_CLEARABLE_LIST_LEVEL_JSON_SCHEMA, FOLIO_CLEARABLE_NUMBERING_JSON_SCHEMA, FOLIO_CLEARABLE_PARAGRAPH_INDENTATION_JSON_SCHEMA, FOLIO_CLEARABLE_PARAGRAPH_SPACING_JSON_SCHEMA, FOLIO_CLEARABLE_PARAGRAPH_STYLE_ID_JSON_SCHEMA, FOLIO_DOCUMENT_OPERATION_BATCH_JSON_SCHEMA, FOLIO_DOCUMENT_OPERATION_JSON_SCHEMA, FOLIO_HARD_PAGE_BREAK_JSON_SCHEMA, FOLIO_HARD_PAGE_BREAK_OPERATION_CONSTRAINT, FOLIO_PRECONDITION_JSON_SCHEMA, FOLIO_TEXT_RANGE_JSON_SCHEMA, FolioJsonSchema, folioDocumentOperationBatchSchema };
|
package/dist/operation-schema.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, parseFolioDocumentOperationBatch } from "@stll/folio-core/server";
|
|
1
|
+
import { FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PAGE_BREAK_CLEAR_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, parseFolioDocumentOperationBatch } from "@stll/folio-core/server";
|
|
2
2
|
//#region src/operation-schema.ts
|
|
3
3
|
/**
|
|
4
4
|
* Reusable projections of folio's versioned document-operation contract for
|
|
@@ -143,8 +143,74 @@ const FOLIO_CLEARABLE_LIST_LEVEL_JSON_SCHEMA = {
|
|
|
143
143
|
minimum: 0,
|
|
144
144
|
maximum: Number.MAX_SAFE_INTEGER
|
|
145
145
|
}, { type: "null" }],
|
|
146
|
-
description: "`w:numPr/w:ilvl`, zero-based; a number retains the paragraph or anchor's numbering instance (`numId`), while null removes paragraph numbering."
|
|
146
|
+
description: "`w:numPr/w:ilvl`, zero-based; a number retains the paragraph or anchor's numbering instance (`numId`), while null removes paragraph numbering unless a concrete numbering instance is supplied, in which case it omits the direct level."
|
|
147
147
|
};
|
|
148
|
+
/** Complete direct `w:ind` attributes, or null to restore style inheritance. */
|
|
149
|
+
const FOLIO_CLEARABLE_PARAGRAPH_INDENTATION_JSON_SCHEMA = {
|
|
150
|
+
oneOf: [{
|
|
151
|
+
type: "object",
|
|
152
|
+
properties: {
|
|
153
|
+
indentLeft: {
|
|
154
|
+
type: "integer",
|
|
155
|
+
minimum: Number.MIN_SAFE_INTEGER,
|
|
156
|
+
maximum: Number.MAX_SAFE_INTEGER
|
|
157
|
+
},
|
|
158
|
+
indentRight: {
|
|
159
|
+
type: "integer",
|
|
160
|
+
minimum: Number.MIN_SAFE_INTEGER,
|
|
161
|
+
maximum: Number.MAX_SAFE_INTEGER
|
|
162
|
+
},
|
|
163
|
+
indentFirstLine: {
|
|
164
|
+
type: "integer",
|
|
165
|
+
minimum: Number.MIN_SAFE_INTEGER,
|
|
166
|
+
maximum: Number.MAX_SAFE_INTEGER
|
|
167
|
+
},
|
|
168
|
+
hangingIndent: { type: "boolean" }
|
|
169
|
+
},
|
|
170
|
+
minProperties: 1,
|
|
171
|
+
additionalProperties: false
|
|
172
|
+
}, { type: "null" }],
|
|
173
|
+
description: "Complete direct paragraph indentation (`w:ind`); null removes the direct child and restores style inheritance."
|
|
174
|
+
};
|
|
175
|
+
const FOLIO_CLEARABLE_NUMBERING_JSON_SCHEMA = {
|
|
176
|
+
oneOf: [{
|
|
177
|
+
type: "object",
|
|
178
|
+
properties: {
|
|
179
|
+
numId: {
|
|
180
|
+
type: "integer",
|
|
181
|
+
minimum: 1,
|
|
182
|
+
maximum: Number.MAX_SAFE_INTEGER
|
|
183
|
+
},
|
|
184
|
+
level: {
|
|
185
|
+
type: "integer",
|
|
186
|
+
minimum: 0,
|
|
187
|
+
maximum: Number.MAX_SAFE_INTEGER
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
required: ["numId", "level"],
|
|
191
|
+
additionalProperties: false
|
|
192
|
+
}, { type: "null" }],
|
|
193
|
+
description: "Concrete numbering instance and level; null removes paragraph numbering."
|
|
194
|
+
};
|
|
195
|
+
const FOLIO_HARD_PAGE_BREAK_JSON_SCHEMA = {
|
|
196
|
+
type: "object",
|
|
197
|
+
properties: { clear: {
|
|
198
|
+
type: "string",
|
|
199
|
+
enum: FOLIO_PAGE_BREAK_CLEAR_VALUES
|
|
200
|
+
} },
|
|
201
|
+
additionalProperties: false,
|
|
202
|
+
description: "Insert an empty hard page-break run; it cannot be combined with text, pageBreakBefore, or lineBreakMode."
|
|
203
|
+
};
|
|
204
|
+
/** Shared cross-field constraint for insertion and suggest-changes projections. */
|
|
205
|
+
const FOLIO_HARD_PAGE_BREAK_OPERATION_CONSTRAINT = { oneOf: [{ not: { required: ["hardPageBreak"] } }, {
|
|
206
|
+
required: ["hardPageBreak", "text"],
|
|
207
|
+
properties: {
|
|
208
|
+
type: { enum: ["insertAfterBlock", "insertBeforeBlock"] },
|
|
209
|
+
text: { enum: [""] },
|
|
210
|
+
pageBreakBefore: { not: {} },
|
|
211
|
+
lineBreakMode: { not: {} }
|
|
212
|
+
}
|
|
213
|
+
}] };
|
|
148
214
|
/** Complete direct `w:spacing` attributes, or null to restore style inheritance. */
|
|
149
215
|
const FOLIO_CLEARABLE_PARAGRAPH_SPACING_JSON_SCHEMA = {
|
|
150
216
|
oneOf: [{
|
|
@@ -187,6 +253,26 @@ const FOLIO_CLEARABLE_PARAGRAPH_SPACING_JSON_SCHEMA = {
|
|
|
187
253
|
}, { type: "null" }],
|
|
188
254
|
description: "Complete direct paragraph spacing (`w:spacing`); omitted attributes stay absent, while zero and false remain explicit. Null removes the direct spacing child and restores style inheritance."
|
|
189
255
|
};
|
|
256
|
+
const FOLIO_BLOCK_PARAGRAPH_PROPERTIES_JSON_SCHEMA = {
|
|
257
|
+
type: "object",
|
|
258
|
+
description: "The paragraph properties to set; at least one.",
|
|
259
|
+
properties: {
|
|
260
|
+
styleId: FOLIO_CLEARABLE_PARAGRAPH_STYLE_ID_JSON_SCHEMA,
|
|
261
|
+
listLevel: FOLIO_CLEARABLE_LIST_LEVEL_JSON_SCHEMA,
|
|
262
|
+
numbering: FOLIO_CLEARABLE_NUMBERING_JSON_SCHEMA,
|
|
263
|
+
indentation: FOLIO_CLEARABLE_PARAGRAPH_INDENTATION_JSON_SCHEMA,
|
|
264
|
+
alignment: {
|
|
265
|
+
oneOf: [{
|
|
266
|
+
type: "string",
|
|
267
|
+
enum: FOLIO_PARAGRAPH_ALIGNMENT_VALUES
|
|
268
|
+
}, { type: "null" }],
|
|
269
|
+
description: "Direct paragraph alignment; null restores style inheritance."
|
|
270
|
+
},
|
|
271
|
+
spacing: FOLIO_CLEARABLE_PARAGRAPH_SPACING_JSON_SCHEMA
|
|
272
|
+
},
|
|
273
|
+
minProperties: 1,
|
|
274
|
+
additionalProperties: false
|
|
275
|
+
};
|
|
190
276
|
/**
|
|
191
277
|
* JSON Schema (draft-07 compatible) for ONE document operation: the full
|
|
192
278
|
* union accepted by `parseFolioDocumentOperationBatch` in
|
|
@@ -308,6 +394,7 @@ const FOLIO_DOCUMENT_OPERATION_JSON_SCHEMA = {
|
|
|
308
394
|
{
|
|
309
395
|
type: "object",
|
|
310
396
|
description: "Insert a new paragraph after the anchor block.",
|
|
397
|
+
...FOLIO_HARD_PAGE_BREAK_OPERATION_CONSTRAINT,
|
|
311
398
|
properties: {
|
|
312
399
|
...operationMetaProperties,
|
|
313
400
|
...suggestionIdProperty,
|
|
@@ -338,6 +425,13 @@ const FOLIO_DOCUMENT_OPERATION_JSON_SCHEMA = {
|
|
|
338
425
|
description: "Direct paragraph alignment; null restores style inheritance."
|
|
339
426
|
},
|
|
340
427
|
spacing: FOLIO_CLEARABLE_PARAGRAPH_SPACING_JSON_SCHEMA,
|
|
428
|
+
indentation: FOLIO_CLEARABLE_PARAGRAPH_INDENTATION_JSON_SCHEMA,
|
|
429
|
+
lineBreakMode: {
|
|
430
|
+
type: "string",
|
|
431
|
+
enum: ["paragraph", "inline"]
|
|
432
|
+
},
|
|
433
|
+
numbering: FOLIO_CLEARABLE_NUMBERING_JSON_SCHEMA,
|
|
434
|
+
hardPageBreak: FOLIO_HARD_PAGE_BREAK_JSON_SCHEMA,
|
|
341
435
|
moveId: {
|
|
342
436
|
type: "string",
|
|
343
437
|
description: "Links this operation to the other half of one relocation: a `deleteBlock` and an insertion sharing a `moveId` are written as `w:moveFrom` / `w:moveTo`. An id that does not name exactly one of each applies as an ordinary edit."
|
|
@@ -355,6 +449,7 @@ const FOLIO_DOCUMENT_OPERATION_JSON_SCHEMA = {
|
|
|
355
449
|
{
|
|
356
450
|
type: "object",
|
|
357
451
|
description: "Insert a new paragraph before the anchor block.",
|
|
452
|
+
...FOLIO_HARD_PAGE_BREAK_OPERATION_CONSTRAINT,
|
|
358
453
|
properties: {
|
|
359
454
|
...operationMetaProperties,
|
|
360
455
|
...suggestionIdProperty,
|
|
@@ -385,6 +480,13 @@ const FOLIO_DOCUMENT_OPERATION_JSON_SCHEMA = {
|
|
|
385
480
|
description: "Direct paragraph alignment; null restores style inheritance."
|
|
386
481
|
},
|
|
387
482
|
spacing: FOLIO_CLEARABLE_PARAGRAPH_SPACING_JSON_SCHEMA,
|
|
483
|
+
indentation: FOLIO_CLEARABLE_PARAGRAPH_INDENTATION_JSON_SCHEMA,
|
|
484
|
+
lineBreakMode: {
|
|
485
|
+
type: "string",
|
|
486
|
+
enum: ["paragraph", "inline"]
|
|
487
|
+
},
|
|
488
|
+
numbering: FOLIO_CLEARABLE_NUMBERING_JSON_SCHEMA,
|
|
489
|
+
hardPageBreak: FOLIO_HARD_PAGE_BREAK_JSON_SCHEMA,
|
|
388
490
|
moveId: {
|
|
389
491
|
type: "string",
|
|
390
492
|
description: "Links this operation to the other half of one relocation: a `deleteBlock` and an insertion sharing a `moveId` are written as `w:moveFrom` / `w:moveTo`. An id that does not name exactly one of each applies as an ordinary edit."
|
|
@@ -473,6 +575,14 @@ const FOLIO_DOCUMENT_OPERATION_JSON_SCHEMA = {
|
|
|
473
575
|
separator: {
|
|
474
576
|
type: "string",
|
|
475
577
|
description: "Text at `offset` the break replaces, usually the space between the halves."
|
|
578
|
+
},
|
|
579
|
+
firstParagraphProperties: {
|
|
580
|
+
...FOLIO_BLOCK_PARAGRAPH_PROPERTIES_JSON_SCHEMA,
|
|
581
|
+
description: "Properties for the first result; omitted properties keep the source paragraph's value."
|
|
582
|
+
},
|
|
583
|
+
secondParagraphProperties: {
|
|
584
|
+
...FOLIO_BLOCK_PARAGRAPH_PROPERTIES_JSON_SCHEMA,
|
|
585
|
+
description: "Properties for the second result; omitted properties keep the source paragraph's value."
|
|
476
586
|
}
|
|
477
587
|
},
|
|
478
588
|
required: [
|
|
@@ -497,6 +607,10 @@ const FOLIO_DOCUMENT_OPERATION_JSON_SCHEMA = {
|
|
|
497
607
|
separator: {
|
|
498
608
|
type: "string",
|
|
499
609
|
description: "Text the join inserts between the two halves, usually a space."
|
|
610
|
+
},
|
|
611
|
+
mergedParagraphProperties: {
|
|
612
|
+
...FOLIO_BLOCK_PARAGRAPH_PROPERTIES_JSON_SCHEMA,
|
|
613
|
+
description: "Properties for the joined result; omitted properties keep the first paragraph's value."
|
|
500
614
|
}
|
|
501
615
|
},
|
|
502
616
|
required: [
|
|
@@ -517,24 +631,7 @@ const FOLIO_DOCUMENT_OPERATION_JSON_SCHEMA = {
|
|
|
517
631
|
enum: ["setBlockParagraphProperties"]
|
|
518
632
|
},
|
|
519
633
|
blockId: blockIdProperty,
|
|
520
|
-
properties:
|
|
521
|
-
type: "object",
|
|
522
|
-
description: "The paragraph properties to set; at least one.",
|
|
523
|
-
properties: {
|
|
524
|
-
styleId: FOLIO_CLEARABLE_PARAGRAPH_STYLE_ID_JSON_SCHEMA,
|
|
525
|
-
listLevel: FOLIO_CLEARABLE_LIST_LEVEL_JSON_SCHEMA,
|
|
526
|
-
alignment: {
|
|
527
|
-
oneOf: [{
|
|
528
|
-
type: "string",
|
|
529
|
-
enum: FOLIO_PARAGRAPH_ALIGNMENT_VALUES
|
|
530
|
-
}, { type: "null" }],
|
|
531
|
-
description: "Direct paragraph alignment; null restores style inheritance."
|
|
532
|
-
},
|
|
533
|
-
spacing: FOLIO_CLEARABLE_PARAGRAPH_SPACING_JSON_SCHEMA
|
|
534
|
-
},
|
|
535
|
-
minProperties: 1,
|
|
536
|
-
additionalProperties: false
|
|
537
|
-
}
|
|
634
|
+
properties: FOLIO_BLOCK_PARAGRAPH_PROPERTIES_JSON_SCHEMA
|
|
538
635
|
},
|
|
539
636
|
required: [
|
|
540
637
|
"id",
|
|
@@ -921,4 +1018,4 @@ const folioDocumentOperationBatchSchema = {
|
|
|
921
1018
|
jsonSchema: FOLIO_DOCUMENT_OPERATION_BATCH_JSON_SCHEMA
|
|
922
1019
|
};
|
|
923
1020
|
//#endregion
|
|
924
|
-
export { FOLIO_CLEARABLE_LIST_LEVEL_JSON_SCHEMA, FOLIO_CLEARABLE_PARAGRAPH_SPACING_JSON_SCHEMA, FOLIO_CLEARABLE_PARAGRAPH_STYLE_ID_JSON_SCHEMA, FOLIO_DOCUMENT_OPERATION_BATCH_JSON_SCHEMA, FOLIO_DOCUMENT_OPERATION_JSON_SCHEMA, FOLIO_PRECONDITION_JSON_SCHEMA, FOLIO_TEXT_RANGE_JSON_SCHEMA, folioDocumentOperationBatchSchema };
|
|
1021
|
+
export { FOLIO_BLOCK_PARAGRAPH_PROPERTIES_JSON_SCHEMA, FOLIO_CLEARABLE_LIST_LEVEL_JSON_SCHEMA, FOLIO_CLEARABLE_NUMBERING_JSON_SCHEMA, FOLIO_CLEARABLE_PARAGRAPH_INDENTATION_JSON_SCHEMA, FOLIO_CLEARABLE_PARAGRAPH_SPACING_JSON_SCHEMA, FOLIO_CLEARABLE_PARAGRAPH_STYLE_ID_JSON_SCHEMA, FOLIO_DOCUMENT_OPERATION_BATCH_JSON_SCHEMA, FOLIO_DOCUMENT_OPERATION_JSON_SCHEMA, FOLIO_HARD_PAGE_BREAK_JSON_SCHEMA, FOLIO_HARD_PAGE_BREAK_OPERATION_CONSTRAINT, FOLIO_PRECONDITION_JSON_SCHEMA, FOLIO_TEXT_RANGE_JSON_SCHEMA, folioDocumentOperationBatchSchema };
|
package/dist/tools.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FOLIO_COMMENT_ID_JSON_SCHEMA, FOLIO_SCOPED_HANDLE_JSON_SCHEMA, FOLIO_SECTION_HANDLE_JSON_SCHEMA, FOLIO_STORY_HANDLE_JSON_SCHEMA } from "./codecs.js";
|
|
2
|
-
import { FOLIO_CLEARABLE_LIST_LEVEL_JSON_SCHEMA, FOLIO_CLEARABLE_PARAGRAPH_SPACING_JSON_SCHEMA, FOLIO_CLEARABLE_PARAGRAPH_STYLE_ID_JSON_SCHEMA, FOLIO_PRECONDITION_JSON_SCHEMA, FOLIO_TEXT_RANGE_JSON_SCHEMA } from "./operation-schema.js";
|
|
2
|
+
import { FOLIO_BLOCK_PARAGRAPH_PROPERTIES_JSON_SCHEMA, FOLIO_CLEARABLE_LIST_LEVEL_JSON_SCHEMA, FOLIO_CLEARABLE_NUMBERING_JSON_SCHEMA, FOLIO_CLEARABLE_PARAGRAPH_INDENTATION_JSON_SCHEMA, FOLIO_CLEARABLE_PARAGRAPH_SPACING_JSON_SCHEMA, FOLIO_CLEARABLE_PARAGRAPH_STYLE_ID_JSON_SCHEMA, FOLIO_HARD_PAGE_BREAK_JSON_SCHEMA, FOLIO_HARD_PAGE_BREAK_OPERATION_CONSTRAINT, FOLIO_PRECONDITION_JSON_SCHEMA, FOLIO_TEXT_RANGE_JSON_SCHEMA } from "./operation-schema.js";
|
|
3
3
|
import { DEFAULT_SUGGEST_CHANGES_OPERATION_TYPES, resolveSuggestChangesOptions } from "./suggest-changes-options.js";
|
|
4
4
|
import { defineFolioAgentToolDefinition } from "./tool-contract.js";
|
|
5
5
|
import { FOLIO_AGENT_TOOL_NAMES } from "./types.js";
|
|
@@ -121,6 +121,14 @@ const OPERATION_PROPERTY_SCHEMAS = {
|
|
|
121
121
|
description: "For inserts: direct paragraph alignment; null restores style inheritance."
|
|
122
122
|
},
|
|
123
123
|
spacing: FOLIO_CLEARABLE_PARAGRAPH_SPACING_JSON_SCHEMA,
|
|
124
|
+
indentation: FOLIO_CLEARABLE_PARAGRAPH_INDENTATION_JSON_SCHEMA,
|
|
125
|
+
lineBreakMode: {
|
|
126
|
+
type: "string",
|
|
127
|
+
enum: ["paragraph", "inline"],
|
|
128
|
+
description: "For inserts: interpret line breaks as paragraph boundaries (default) or inline breaks."
|
|
129
|
+
},
|
|
130
|
+
numbering: FOLIO_CLEARABLE_NUMBERING_JSON_SCHEMA,
|
|
131
|
+
hardPageBreak: FOLIO_HARD_PAGE_BREAK_JSON_SCHEMA,
|
|
124
132
|
preserveFormatting: {
|
|
125
133
|
type: "boolean",
|
|
126
134
|
description: "For `replaceBlock`: keep the block's existing formatting for the replacement text."
|
|
@@ -179,22 +187,20 @@ const OPERATION_PROPERTY_SCHEMAS = {
|
|
|
179
187
|
additionalProperties: false
|
|
180
188
|
},
|
|
181
189
|
properties: {
|
|
182
|
-
|
|
183
|
-
description: "Required for `setBlockParagraphProperties`: the paragraph properties to set. Null clears a direct property."
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
minProperties: 1,
|
|
197
|
-
additionalProperties: false
|
|
190
|
+
...FOLIO_BLOCK_PARAGRAPH_PROPERTIES_JSON_SCHEMA,
|
|
191
|
+
description: "Required for `setBlockParagraphProperties`: the paragraph properties to set. Null clears a direct property."
|
|
192
|
+
},
|
|
193
|
+
firstParagraphProperties: {
|
|
194
|
+
...FOLIO_BLOCK_PARAGRAPH_PROPERTIES_JSON_SCHEMA,
|
|
195
|
+
description: "For `splitBlock`, properties for the first result; omitted properties keep the source paragraph's value."
|
|
196
|
+
},
|
|
197
|
+
secondParagraphProperties: {
|
|
198
|
+
...FOLIO_BLOCK_PARAGRAPH_PROPERTIES_JSON_SCHEMA,
|
|
199
|
+
description: "For `splitBlock`, properties for the second result; omitted properties keep the source paragraph's value."
|
|
200
|
+
},
|
|
201
|
+
mergedParagraphProperties: {
|
|
202
|
+
...FOLIO_BLOCK_PARAGRAPH_PROPERTIES_JSON_SCHEMA,
|
|
203
|
+
description: "For `mergeBlockWithNext`, properties for the joined result; omitted properties keep the first paragraph's value."
|
|
198
204
|
},
|
|
199
205
|
listLevel: FOLIO_CLEARABLE_LIST_LEVEL_JSON_SCHEMA,
|
|
200
206
|
offset: {
|
|
@@ -235,6 +241,7 @@ const buildSuggestChangesOperationSchema = (resolved) => {
|
|
|
235
241
|
return {
|
|
236
242
|
type: "object",
|
|
237
243
|
properties,
|
|
244
|
+
...FOLIO_HARD_PAGE_BREAK_OPERATION_CONSTRAINT,
|
|
238
245
|
required: resolved.reviewMeta === "required" ? [
|
|
239
246
|
"type",
|
|
240
247
|
"severity",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/folio-agents",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.2",
|
|
4
4
|
"description": "Framework-neutral LLM tool layer over folio's ai-edits engine: function-calling tools so an agent can read and mutate .docx documents through @stll/folio-core.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"test": "bun test src"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@stll/folio-core": "^0.
|
|
57
|
+
"@stll/folio-core": "^0.38.0",
|
|
58
58
|
"better-result": "3.0.1"
|
|
59
59
|
},
|
|
60
60
|
"main": "./dist/index.js",
|