indesign-cli 0.2.0__py3-none-any.whl

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.
Files changed (72) hide show
  1. cli_anything/indesign/README.md +32 -0
  2. cli_anything/indesign/__init__.py +1 -0
  3. cli_anything/indesign/__main__.py +5 -0
  4. cli_anything/indesign/core/artifacts.py +57 -0
  5. cli_anything/indesign/core/catalog.py +405 -0
  6. cli_anything/indesign/core/domains.py +178 -0
  7. cli_anything/indesign/core/envelope.py +65 -0
  8. cli_anything/indesign/core/errors.py +30 -0
  9. cli_anything/indesign/core/health.py +46 -0
  10. cli_anything/indesign/core/hidden_backend.py +116 -0
  11. cli_anything/indesign/core/hidden_handler_schemas.py +223 -0
  12. cli_anything/indesign/core/mcp_backend.py +152 -0
  13. cli_anything/indesign/core/node_setup.py +35 -0
  14. cli_anything/indesign/core/paths.py +41 -0
  15. cli_anything/indesign/core/plugins/__init__.py +2 -0
  16. cli_anything/indesign/core/plugins/backend.py +90 -0
  17. cli_anything/indesign/core/plugins/discovery.py +69 -0
  18. cli_anything/indesign/core/plugins/host_actions.py +76 -0
  19. cli_anything/indesign/core/plugins/install.py +38 -0
  20. cli_anything/indesign/core/plugins/manifest.py +279 -0
  21. cli_anything/indesign/core/plugins/validate.py +181 -0
  22. cli_anything/indesign/core/router.py +217 -0
  23. cli_anything/indesign/core/runtime.py +59 -0
  24. cli_anything/indesign/core/scripts.py +44 -0
  25. cli_anything/indesign/core/session.py +68 -0
  26. cli_anything/indesign/indesign_cli.py +320 -0
  27. cli_anything/indesign/node/hidden_handler_bridge.mjs +111 -0
  28. cli_anything/indesign/server/package-lock.json +168 -0
  29. cli_anything/indesign/server/package.json +45 -0
  30. cli_anything/indesign/server/src/advanced/index.js +76 -0
  31. cli_anything/indesign/server/src/core/InDesignMCPServer.js +273 -0
  32. cli_anything/indesign/server/src/core/scriptExecutor.js +271 -0
  33. cli_anything/indesign/server/src/core/sessionManager.js +545 -0
  34. cli_anything/indesign/server/src/handlers/advancedTemplateHandlers.js +1072 -0
  35. cli_anything/indesign/server/src/handlers/bookHandlers.js +490 -0
  36. cli_anything/indesign/server/src/handlers/documentHandlers.js +1472 -0
  37. cli_anything/indesign/server/src/handlers/exportHandlers.js +208 -0
  38. cli_anything/indesign/server/src/handlers/graphicsHandlers.js +605 -0
  39. cli_anything/indesign/server/src/handlers/groupHandlers.js +358 -0
  40. cli_anything/indesign/server/src/handlers/helpHandlers.js +347 -0
  41. cli_anything/indesign/server/src/handlers/index.js +77 -0
  42. cli_anything/indesign/server/src/handlers/layerHandlers.js +75 -0
  43. cli_anything/indesign/server/src/handlers/masterSpreadHandlers.js +451 -0
  44. cli_anything/indesign/server/src/handlers/pageHandlers.js +698 -0
  45. cli_anything/indesign/server/src/handlers/pageItemHandlers.js +704 -0
  46. cli_anything/indesign/server/src/handlers/presentationHandlers.js +220 -0
  47. cli_anything/indesign/server/src/handlers/spreadHandlers.js +348 -0
  48. cli_anything/indesign/server/src/handlers/styleHandlers.js +458 -0
  49. cli_anything/indesign/server/src/handlers/textHandlers.js +431 -0
  50. cli_anything/indesign/server/src/handlers/utilityHandlers.js +83 -0
  51. cli_anything/indesign/server/src/index.js +17 -0
  52. cli_anything/indesign/server/src/types/index.js +106 -0
  53. cli_anything/indesign/server/src/types/toolDefinitionsAdvancedTemplates.js +144 -0
  54. cli_anything/indesign/server/src/types/toolDefinitionsBook.js +224 -0
  55. cli_anything/indesign/server/src/types/toolDefinitionsContent.js +353 -0
  56. cli_anything/indesign/server/src/types/toolDefinitionsDocument.js +409 -0
  57. cli_anything/indesign/server/src/types/toolDefinitionsExport.js +65 -0
  58. cli_anything/indesign/server/src/types/toolDefinitionsLayer.js +40 -0
  59. cli_anything/indesign/server/src/types/toolDefinitionsMasterSpread.js +160 -0
  60. cli_anything/indesign/server/src/types/toolDefinitionsPage.js +271 -0
  61. cli_anything/indesign/server/src/types/toolDefinitionsPageItemGroup.js +437 -0
  62. cli_anything/indesign/server/src/types/toolDefinitionsPresentation.js +83 -0
  63. cli_anything/indesign/server/src/types/toolDefinitionsSpread.js +158 -0
  64. cli_anything/indesign/server/src/types/toolDefinitionsUtility.js +40 -0
  65. cli_anything/indesign/server/src/utils/stringUtils.js +107 -0
  66. cli_anything/indesign/skills/SKILL.md +198 -0
  67. indesign_cli-0.2.0.dist-info/METADATA +267 -0
  68. indesign_cli-0.2.0.dist-info/RECORD +72 -0
  69. indesign_cli-0.2.0.dist-info/WHEEL +5 -0
  70. indesign_cli-0.2.0.dist-info/entry_points.txt +3 -0
  71. indesign_cli-0.2.0.dist-info/licenses/LICENSE +21 -0
  72. indesign_cli-0.2.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,490 @@
1
+ /**
2
+ * Book management handlers
3
+ */
4
+ import { ScriptExecutor } from '../core/scriptExecutor.js';
5
+ import { formatResponse, escapeJsxString, escapeFilePathForJsx } from '../utils/stringUtils.js';
6
+
7
+ export class BookHandlers {
8
+ /**
9
+ * Create a book
10
+ */
11
+ static async createBook(args) {
12
+ const { filePath } = args;
13
+
14
+ const escapedFilePath = escapeFilePathForJsx(filePath);
15
+
16
+ const script = [
17
+ `var bookFile = File("${escapedFilePath}");`,
18
+ 'var bookFolder = bookFile.parent;',
19
+ 'if (!bookFolder.exists) {',
20
+ ' bookFolder.create();',
21
+ '}',
22
+ 'var book = app.books.add(bookFile);',
23
+ 'try { book.save(bookFile); } catch (saveError) { try { book.save(); } catch (_) {} }',
24
+ 'book.close();',
25
+ `"Book created successfully: ${escapedFilePath}";`
26
+ ].join('\n');
27
+
28
+ const result = await ScriptExecutor.executeInDesignScript(script);
29
+ return formatResponse(result, "Create Book");
30
+ }
31
+
32
+ /**
33
+ * Open a book
34
+ */
35
+ static async openBook(args) {
36
+ const { filePath } = args;
37
+
38
+ const escapedFilePath = escapeFilePathForJsx(filePath);
39
+
40
+ const script = [
41
+ `var bookFile = File("${escapedFilePath}");`,
42
+ 'if (!bookFile.exists) {',
43
+ ` "Book file not found: ${escapedFilePath}";`,
44
+ '} else {',
45
+ ' var book = app.open(bookFile);',
46
+ ' "Book opened successfully: " + book.name;',
47
+ '}'
48
+ ].join('\n');
49
+
50
+ const result = await ScriptExecutor.executeInDesignScript(script);
51
+ return formatResponse(result, "Open Book");
52
+ }
53
+
54
+ /**
55
+ * Add a document to a book
56
+ */
57
+ static async addDocumentToBook(args) {
58
+ const { bookPath, documentPath } = args;
59
+
60
+ const escapedBookPath = escapeFilePathForJsx(bookPath);
61
+ const escapedDocumentPath = escapeFilePathForJsx(documentPath);
62
+
63
+ const script = [
64
+ `var bookFile = File("${escapedBookPath}");`,
65
+ `var docFile = File("${escapedDocumentPath}");`,
66
+ '',
67
+ 'if (!bookFile.exists) {',
68
+ ` "Book file not found: ${escapedBookPath}";`,
69
+ '} else if (!docFile.exists) {',
70
+ ` "Document file not found: ${escapedDocumentPath}";`,
71
+ '} else {',
72
+ ' var book = app.open(bookFile);',
73
+ ' var bookContent = book.bookContents.add(docFile);',
74
+ ' book.save();',
75
+ ' book.close();',
76
+ ' "Document added to book successfully";',
77
+ '}'
78
+ ].join('\n');
79
+
80
+ const result = await ScriptExecutor.executeInDesignScript(script);
81
+ return formatResponse(result, "Add Document to Book");
82
+ }
83
+
84
+ /**
85
+ * Synchronize a book
86
+ */
87
+ static async synchronizeBook(args) {
88
+ const { bookPath } = args;
89
+
90
+ const escapedBookPath = escapeFilePathForJsx(bookPath);
91
+
92
+ const script = [
93
+ `var bookFile = File("${escapedBookPath}");`,
94
+ '',
95
+ 'if (!bookFile.exists) {',
96
+ ` "Book file not found: ${escapedBookPath}";`,
97
+ '} else {',
98
+ ' var book = app.open(bookFile);',
99
+ ' book.synchronize();',
100
+ ' book.save();',
101
+ ' book.close();',
102
+ ' "Book synchronized successfully";',
103
+ '}'
104
+ ].join('\n');
105
+
106
+ const result = await ScriptExecutor.executeInDesignScript(script);
107
+ return formatResponse(result, "Synchronize Book");
108
+ }
109
+
110
+ /**
111
+ * Export a book
112
+ */
113
+ static async exportBook(args) {
114
+ const { bookPath, format = 'PDF', outputPath } = args;
115
+
116
+ const escapedBookPath = escapeFilePathForJsx(bookPath);
117
+ const escapedOutputPath = escapeFilePathForJsx(outputPath);
118
+ const allowedFormats = new Set(['PDF', 'EPUB', 'HTML']);
119
+ const normalizedFormat = typeof format === 'string' ? format.trim().toUpperCase() : 'PDF';
120
+ const safeFormat = allowedFormats.has(normalizedFormat) ? normalizedFormat : 'PDF';
121
+ const escapedFormat = escapeJsxString(safeFormat);
122
+
123
+ const script = [
124
+ `var bookFile = File("${escapedBookPath}");`,
125
+ `var outputFile = File("${escapedOutputPath}");`,
126
+ '',
127
+ 'if (!bookFile.exists) {',
128
+ ` "Book file not found: ${escapedBookPath}";`,
129
+ '} else {',
130
+ ' var book = app.open(bookFile);',
131
+ '',
132
+ ` if ("${escapedFormat}" === "PDF") {`,
133
+ ' book.exportFile(ExportFormat.PDF_TYPE, outputFile);',
134
+ ` } else if ("${escapedFormat}" === "EPUB") {`,
135
+ ' book.exportFile(ExportFormat.EPUB, outputFile);',
136
+ ` } else if ("${escapedFormat}" === "HTML") {`,
137
+ ' book.exportFile(ExportFormat.HTML, outputFile);',
138
+ ' } else {',
139
+ ` "Unsupported format: ${escapedFormat}";`,
140
+ ' }',
141
+ '',
142
+ ' book.close();',
143
+ ' "Book exported successfully";',
144
+ '}'
145
+ ].join('\n');
146
+
147
+ const result = await ScriptExecutor.executeInDesignScript(script);
148
+ return formatResponse(result, "Export Book");
149
+ }
150
+
151
+ /**
152
+ * Package a book for print
153
+ */
154
+ static async packageBook(args) {
155
+ const {
156
+ bookPath,
157
+ outputPath,
158
+ copyingFonts = true,
159
+ copyingLinkedGraphics = true,
160
+ copyingProfiles = true,
161
+ updatingGraphics = true,
162
+ includingHiddenLayers = false,
163
+ ignorePreflightErrors = false,
164
+ creatingReport = true,
165
+ includeIdml = false,
166
+ includePdf = false
167
+ } = args;
168
+
169
+ const escapedBookPath = escapeFilePathForJsx(bookPath);
170
+ const escapedOutputPath = escapeFilePathForJsx(outputPath);
171
+
172
+ const script = [
173
+ `var bookFile = File("${escapedBookPath}");`,
174
+ `var outputFolder = Folder("${escapedOutputPath}");`,
175
+ '',
176
+ 'if (!bookFile.exists) {',
177
+ ` "Book file not found: ${escapedBookPath}";`,
178
+ '} else {',
179
+ ' var book = app.open(bookFile);',
180
+ '',
181
+ ` book.packageForPrint(outputFolder, ${copyingFonts}, ${copyingLinkedGraphics}, ${copyingProfiles}, ${updatingGraphics}, ${includingHiddenLayers}, ${ignorePreflightErrors}, ${creatingReport}, ${includeIdml}, ${includePdf});`,
182
+ '',
183
+ ' book.close();',
184
+ ' "Book packaged successfully";',
185
+ '}'
186
+ ].join('\n');
187
+
188
+ const result = await ScriptExecutor.executeInDesignScript(script);
189
+ return formatResponse(result, "Package Book");
190
+ }
191
+
192
+ /**
193
+ * Get book information
194
+ */
195
+ static async getBookInfo(args) {
196
+ const { bookPath } = args;
197
+
198
+ const escapedBookPath = escapeFilePathForJsx(bookPath);
199
+
200
+ const script = [
201
+ `var bookFile = File("${escapedBookPath}");`,
202
+ '',
203
+ 'if (!bookFile.exists) {',
204
+ ` "Book file not found: ${escapedBookPath}";`,
205
+ '} else {',
206
+ ' var book = app.open(bookFile);',
207
+ ' var info = "=== BOOK INFORMATION ===\\n";',
208
+ '',
209
+ ' info += "Name: " + book.name + "\\n";',
210
+ ' info += "File Path: " + book.filePath + "\\n";',
211
+ ' info += "Modified: " + book.modified + "\\n";',
212
+ ' info += "Saved: " + book.saved + "\\n";',
213
+ ' info += "Automatic Pagination: " + book.automaticPagination + "\\n";',
214
+ ' info += "Automatic Document Conversion: " + book.automaticDocumentConversion + "\\n";',
215
+ '',
216
+ ' // Book contents',
217
+ ' info += "\\n=== BOOK CONTENTS ===\\n";',
218
+ ' info += "Number of Documents: " + book.bookContents.length + "\\n";',
219
+ '',
220
+ ' for (var i = 0; i < book.bookContents.length; i++) {',
221
+ ' var content = book.bookContents[i];',
222
+ ' var status = "Unknown";',
223
+ ' var pageCount = "Unknown";',
224
+ ' try { status = content.status; } catch (statusError) {}',
225
+ ' try { pageCount = content.pageCount; } catch (pageCountError) { try { pageCount = content.documentPageRange; } catch (_) {} }',
226
+ ' info += "Document " + (i + 1) + ": " + content.name + "\\n";',
227
+ ' info += " Status: " + status + "\\n";',
228
+ ' info += " Page Count: " + pageCount + "\\n";',
229
+ ' }',
230
+ '',
231
+ ' book.close();',
232
+ ' info;',
233
+ '}'
234
+ ].join('\n');
235
+
236
+ const result = await ScriptExecutor.executeInDesignScript(script);
237
+ return formatResponse(result, "Get Book Info");
238
+ }
239
+
240
+ /**
241
+ * List all books
242
+ */
243
+ static async listBooks(args) {
244
+ const script = [
245
+ 'var books = app.books;',
246
+ 'var info = "=== ALL BOOKS ===\\n";',
247
+ 'info += "Total books: " + books.length + "\\n\\n";',
248
+ '',
249
+ 'for (var i = 0; i < books.length; i++) {',
250
+ ' var book = books[i];',
251
+ ' info += "Book " + i + ":\\n";',
252
+ ' info += " Name: " + book.name + "\\n";',
253
+ ' info += " File Path: " + book.filePath + "\\n";',
254
+ ' info += " Modified: " + book.modified + "\\n";',
255
+ ' info += " Saved: " + book.saved + "\\n";',
256
+ ' info += " Document Count: " + book.bookContents.length + "\\n";',
257
+ ' info += "\\n";',
258
+ '}',
259
+ 'info;'
260
+ ].join('\n');
261
+
262
+ const result = await ScriptExecutor.executeInDesignScript(script);
263
+ return formatResponse(result, "List Books");
264
+ }
265
+
266
+ /**
267
+ * Repaginate a book
268
+ */
269
+ static async repaginateBook(args) {
270
+ const { bookPath } = args;
271
+
272
+ const escapedBookPath = escapeFilePathForJsx(bookPath);
273
+
274
+ const script = [
275
+ `var bookFile = File("${escapedBookPath}");`,
276
+ '',
277
+ 'if (!bookFile.exists) {',
278
+ ` "Book file not found: ${escapedBookPath}";`,
279
+ '} else {',
280
+ ' var book = app.open(bookFile);',
281
+ ' book.repaginate();',
282
+ ' book.save();',
283
+ ' book.close();',
284
+ ' "Book repaginated successfully";',
285
+ '}'
286
+ ].join('\n');
287
+
288
+ const result = await ScriptExecutor.executeInDesignScript(script);
289
+ return formatResponse(result, "Repaginate Book");
290
+ }
291
+
292
+ /**
293
+ * Update all cross references in a book
294
+ */
295
+ static async updateAllCrossReferences(args) {
296
+ const { bookPath } = args;
297
+
298
+ const escapedBookPath = escapeFilePathForJsx(bookPath);
299
+
300
+ const script = [
301
+ `var bookFile = File("${escapedBookPath}");`,
302
+ '',
303
+ 'if (!bookFile.exists) {',
304
+ ` "Book file not found: ${escapedBookPath}";`,
305
+ '} else {',
306
+ ' var book = app.open(bookFile);',
307
+ ' book.updateAllCrossReferences();',
308
+ ' book.save();',
309
+ ' book.close();',
310
+ ' "All cross references updated successfully";',
311
+ '}'
312
+ ].join('\n');
313
+
314
+ const result = await ScriptExecutor.executeInDesignScript(script);
315
+ return formatResponse(result, "Update All Cross References");
316
+ }
317
+
318
+ /**
319
+ * Update all numbers in a book
320
+ */
321
+ static async updateAllNumbers(args) {
322
+ const { bookPath } = args;
323
+
324
+ const escapedBookPath = escapeFilePathForJsx(bookPath);
325
+
326
+ const script = [
327
+ `var bookFile = File("${escapedBookPath}");`,
328
+ '',
329
+ 'if (!bookFile.exists) {',
330
+ ` "Book file not found: ${escapedBookPath}";`,
331
+ '} else {',
332
+ ' var book = app.open(bookFile);',
333
+ ' book.updateAllNumbers();',
334
+ ' book.save();',
335
+ ' book.close();',
336
+ ' "All numbers updated successfully";',
337
+ '}'
338
+ ].join('\n');
339
+
340
+ const result = await ScriptExecutor.executeInDesignScript(script);
341
+ return formatResponse(result, "Update All Numbers");
342
+ }
343
+
344
+ /**
345
+ * Update chapter and paragraph numbers in a book
346
+ */
347
+ static async updateChapterAndParagraphNumbers(args) {
348
+ const { bookPath } = args;
349
+
350
+ const escapedBookPath = escapeFilePathForJsx(bookPath);
351
+
352
+ const script = [
353
+ `var bookFile = File("${escapedBookPath}");`,
354
+ '',
355
+ 'if (!bookFile.exists) {',
356
+ ` "Book file not found: ${escapedBookPath}";`,
357
+ '} else {',
358
+ ' var book = app.open(bookFile);',
359
+ ' book.updateChapterAndParagraphNumbers();',
360
+ ' book.save();',
361
+ ' book.close();',
362
+ ' "Chapter and paragraph numbers updated successfully";',
363
+ '}'
364
+ ].join('\n');
365
+
366
+ const result = await ScriptExecutor.executeInDesignScript(script);
367
+ return formatResponse(result, "Update Chapter and Paragraph Numbers");
368
+ }
369
+
370
+ /**
371
+ * Preflight a book
372
+ */
373
+ static async preflightBook(args) {
374
+ const { bookPath, outputPath, autoOpen = false } = args;
375
+
376
+ const escapedBookPath = escapeFilePathForJsx(bookPath);
377
+ const escapedOutputPath = outputPath ? escapeFilePathForJsx(outputPath) : '';
378
+
379
+ const script = [
380
+ `var bookFile = File("${escapedBookPath}");`,
381
+ ...(escapedOutputPath ? [`var outputFile = File("${escapedOutputPath}");`] : []),
382
+ '',
383
+ 'if (!bookFile.exists) {',
384
+ ` "Book file not found: ${escapedBookPath}";`,
385
+ '} else {',
386
+ ' var book = app.open(bookFile);',
387
+ ...(escapedOutputPath ? [
388
+ ' book.preflight(outputFile, ' + autoOpen + ');'
389
+ ] : [
390
+ ' book.preflight();'
391
+ ]),
392
+ ' book.close();',
393
+ ' "Book preflighted successfully";',
394
+ '}'
395
+ ].join('\n');
396
+
397
+ const result = await ScriptExecutor.executeInDesignScript(script);
398
+ return formatResponse(result, "Preflight Book");
399
+ }
400
+
401
+ /**
402
+ * Print a book
403
+ */
404
+ static async printBook(args) {
405
+ const { bookPath, printDialog = true, printerPreset = 'DEFAULT_VALUE' } = args;
406
+
407
+ const escapedBookPath = escapeFilePathForJsx(bookPath);
408
+
409
+ const script = [
410
+ `var bookFile = File("${escapedBookPath}");`,
411
+ '',
412
+ 'if (!bookFile.exists) {',
413
+ ` "Book file not found: ${escapedBookPath}";`,
414
+ '} else {',
415
+ ' var book = app.open(bookFile);',
416
+ ` book.print(${printDialog}, PrinterPresetTypes.${printerPreset});`,
417
+ ' book.close();',
418
+ ' "Book print job sent successfully";',
419
+ '}'
420
+ ].join('\n');
421
+
422
+ const result = await ScriptExecutor.executeInDesignScript(script);
423
+ return formatResponse(result, "Print Book");
424
+ }
425
+
426
+ /**
427
+ * Set book properties
428
+ */
429
+ static async setBookProperties(args) {
430
+ const {
431
+ bookPath,
432
+ automaticPagination,
433
+ automaticDocumentConversion,
434
+ insertBlankPage,
435
+ mergeIdenticalLayers,
436
+ synchronizeBulletNumberingList,
437
+ synchronizeCellStyle,
438
+ synchronizeCharacterStyle,
439
+ synchronizeConditionalText,
440
+ synchronizeCrossReferenceFormat,
441
+ synchronizeMasterPage,
442
+ synchronizeObjectStyle,
443
+ synchronizeParagraphStyle,
444
+ synchronizeSwatch,
445
+ synchronizeTableOfContentStyle,
446
+ synchronizeTableStyle,
447
+ synchronizeTextVariable,
448
+ synchronizeTrapStyle
449
+ } = args;
450
+
451
+ const escapedBookPath = escapeFilePathForJsx(bookPath);
452
+
453
+ const script = [
454
+ `var bookFile = File("${escapedBookPath}");`,
455
+ '',
456
+ 'if (!bookFile.exists) {',
457
+ ` "Book file not found: ${escapedBookPath}";`,
458
+ '} else {',
459
+ ' var book = app.open(bookFile);',
460
+ ' try {',
461
+ ...(automaticPagination !== undefined ? [` book.automaticPagination = ${automaticPagination};`] : []),
462
+ ...(automaticDocumentConversion !== undefined ? [` book.automaticDocumentConversion = ${automaticDocumentConversion};`] : []),
463
+ ...(insertBlankPage !== undefined ? [` book.insertBlankPage = ${insertBlankPage};`] : []),
464
+ ...(mergeIdenticalLayers !== undefined ? [` book.mergeIdenticalLayers = ${mergeIdenticalLayers};`] : []),
465
+ ...(synchronizeBulletNumberingList !== undefined ? [` book.synchronizeBulletNumberingList = ${synchronizeBulletNumberingList};`] : []),
466
+ ...(synchronizeCellStyle !== undefined ? [` book.synchronizeCellStyle = ${synchronizeCellStyle};`] : []),
467
+ ...(synchronizeCharacterStyle !== undefined ? [` book.synchronizeCharacterStyle = ${synchronizeCharacterStyle};`] : []),
468
+ ...(synchronizeConditionalText !== undefined ? [` book.synchronizeConditionalText = ${synchronizeConditionalText};`] : []),
469
+ ...(synchronizeCrossReferenceFormat !== undefined ? [` book.synchronizeCrossReferenceFormat = ${synchronizeCrossReferenceFormat};`] : []),
470
+ ...(synchronizeMasterPage !== undefined ? [` book.synchronizeMasterPage = ${synchronizeMasterPage};`] : []),
471
+ ...(synchronizeObjectStyle !== undefined ? [` book.synchronizeObjectStyle = ${synchronizeObjectStyle};`] : []),
472
+ ...(synchronizeParagraphStyle !== undefined ? [` book.synchronizeParagraphStyle = ${synchronizeParagraphStyle};`] : []),
473
+ ...(synchronizeSwatch !== undefined ? [` book.synchronizeSwatch = ${synchronizeSwatch};`] : []),
474
+ ...(synchronizeTableOfContentStyle !== undefined ? [` book.synchronizeTableOfContentStyle = ${synchronizeTableOfContentStyle};`] : []),
475
+ ...(synchronizeTableStyle !== undefined ? [` book.synchronizeTableStyle = ${synchronizeTableStyle};`] : []),
476
+ ...(synchronizeTextVariable !== undefined ? [` book.synchronizeTextVariable = ${synchronizeTextVariable};`] : []),
477
+ ...(synchronizeTrapStyle !== undefined ? [` book.synchronizeTrapStyle = ${synchronizeTrapStyle};`] : []),
478
+ ' book.save();',
479
+ ' "Book properties updated successfully";',
480
+ ' } catch (error) {',
481
+ ' "Error updating book properties: " + error.message;',
482
+ ' }',
483
+ ' book.close();',
484
+ '}'
485
+ ].join('\n');
486
+
487
+ const result = await ScriptExecutor.executeInDesignScript(script);
488
+ return formatResponse(result, "Set Book Properties");
489
+ }
490
+ }