n8n-nodes-h2i 1.0.1 → 1.0.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.
@@ -42,25 +42,42 @@ class DavixH2I {
42
42
  { name: 'Tools (Analyze Images)', value: 'tools' },
43
43
  ],
44
44
  },
45
- // H2I operation
45
+ // H2I actions
46
46
  {
47
47
  displayName: 'Operation',
48
48
  name: 'operation',
49
49
  type: 'options',
50
- default: 'render',
50
+ default: 'image',
51
51
  displayOptions: { show: { resource: ['h2i'] } },
52
- options: [{ name: 'Render HTML → Image', value: 'render' }],
52
+ options: [
53
+ { name: 'Render HTML to Image', value: 'image' },
54
+ { name: 'Render HTML to PDF', value: 'pdf' },
55
+ ],
53
56
  },
54
- // Image operation
57
+ // Image actions
55
58
  {
56
59
  displayName: 'Operation',
57
60
  name: 'operation',
58
61
  type: 'options',
59
- default: 'transform',
62
+ default: 'format',
60
63
  displayOptions: { show: { resource: ['image'] } },
61
- options: [{ name: 'Transform / Convert', value: 'transform' }],
64
+ options: [
65
+ { name: 'Format', value: 'format' },
66
+ { name: 'Resize', value: 'resize' },
67
+ { name: 'Crop', value: 'crop' },
68
+ { name: 'Transform', value: 'transform' },
69
+ { name: 'Compress', value: 'compress' },
70
+ { name: 'Enhance', value: 'enhance' },
71
+ { name: 'Padding', value: 'padding' },
72
+ { name: 'Frame', value: 'frame' },
73
+ { name: 'Background', value: 'background' },
74
+ { name: 'Watermark', value: 'watermark' },
75
+ { name: 'PDF Export', value: 'pdf' },
76
+ { name: 'Metadata (JSON only)', value: 'metadata' },
77
+ { name: 'Multitask', value: 'multitask' },
78
+ ],
62
79
  },
63
- // PDF operations
80
+ // PDF actions
64
81
  {
65
82
  displayName: 'Operation',
66
83
  name: 'operation',
@@ -68,21 +85,33 @@ class DavixH2I {
68
85
  default: 'merge',
69
86
  displayOptions: { show: { resource: ['pdf'] } },
70
87
  options: [
88
+ { name: 'To Images', value: 'to-images' },
71
89
  { name: 'Merge', value: 'merge' },
72
90
  { name: 'Split', value: 'split' },
73
91
  { name: 'Compress', value: 'compress' },
74
- { name: 'To Images', value: 'to-images' },
75
92
  { name: 'Extract Images', value: 'extract-images' },
93
+ { name: 'Watermark', value: 'watermark' },
94
+ { name: 'Rotate', value: 'rotate' },
95
+ { name: 'Metadata', value: 'metadata' },
96
+ { name: 'Reorder', value: 'reorder' },
97
+ { name: 'Delete Pages', value: 'delete-pages' },
98
+ { name: 'Extract Pages', value: 'extract' },
99
+ { name: 'Flatten', value: 'flatten' },
100
+ { name: 'Encrypt', value: 'encrypt' },
101
+ { name: 'Decrypt', value: 'decrypt' },
76
102
  ],
77
103
  },
78
- // Tools operation
104
+ // Tools actions
79
105
  {
80
106
  displayName: 'Operation',
81
107
  name: 'operation',
82
108
  type: 'options',
83
- default: 'analyze',
109
+ default: 'single',
84
110
  displayOptions: { show: { resource: ['tools'] } },
85
- options: [{ name: 'Analyze Images', value: 'analyze' }],
111
+ options: [
112
+ { name: 'Single Tool', value: 'single' },
113
+ { name: 'Multitask', value: 'multitask' },
114
+ ],
86
115
  },
87
116
  // -------------------------
88
117
  // H2I
@@ -94,7 +123,7 @@ class DavixH2I {
94
123
  default: '',
95
124
  required: true,
96
125
  typeOptions: { rows: 6 },
97
- displayOptions: { show: { resource: ['h2i'], operation: ['render'] } },
126
+ displayOptions: { show: { resource: ['h2i'], operation: ['image', 'pdf'] } },
98
127
  },
99
128
  {
100
129
  displayName: 'CSS',
@@ -102,21 +131,21 @@ class DavixH2I {
102
131
  type: 'string',
103
132
  default: '',
104
133
  typeOptions: { rows: 4 },
105
- displayOptions: { show: { resource: ['h2i'], operation: ['render'] } },
134
+ displayOptions: { show: { resource: ['h2i'], operation: ['image', 'pdf'] } },
106
135
  },
107
136
  {
108
137
  displayName: 'Width',
109
138
  name: 'width',
110
139
  type: 'number',
111
140
  default: 1000,
112
- displayOptions: { show: { resource: ['h2i'], operation: ['render'] } },
141
+ displayOptions: { show: { resource: ['h2i'], operation: ['image', 'pdf'] } },
113
142
  },
114
143
  {
115
144
  displayName: 'Height',
116
145
  name: 'height',
117
146
  type: 'number',
118
147
  default: 1500,
119
- displayOptions: { show: { resource: ['h2i'], operation: ['render'] } },
148
+ displayOptions: { show: { resource: ['h2i'], operation: ['image', 'pdf'] } },
120
149
  },
121
150
  {
122
151
  displayName: 'Format',
@@ -127,21 +156,69 @@ class DavixH2I {
127
156
  { name: 'PNG', value: 'png' },
128
157
  { name: 'JPEG', value: 'jpeg' },
129
158
  ],
130
- displayOptions: { show: { resource: ['h2i'], operation: ['render'] } },
159
+ displayOptions: { show: { resource: ['h2i'], operation: ['image'] } },
160
+ },
161
+ {
162
+ displayName: 'PDF Page Size',
163
+ name: 'h2iPdfPageSize',
164
+ type: 'options',
165
+ default: 'auto',
166
+ options: [
167
+ { name: 'Auto', value: 'auto' },
168
+ { name: 'A4', value: 'a4' },
169
+ { name: 'Letter', value: 'letter' },
170
+ ],
171
+ displayOptions: { show: { resource: ['h2i'], operation: ['pdf'] } },
172
+ },
173
+ {
174
+ displayName: 'PDF Orientation',
175
+ name: 'h2iPdfOrientation',
176
+ type: 'options',
177
+ default: 'portrait',
178
+ options: [
179
+ { name: 'Portrait', value: 'portrait' },
180
+ { name: 'Landscape', value: 'landscape' },
181
+ ],
182
+ displayOptions: { show: { resource: ['h2i'], operation: ['pdf'] } },
183
+ },
184
+ {
185
+ displayName: 'PDF Margin',
186
+ name: 'h2iPdfMargin',
187
+ type: 'number',
188
+ default: 0,
189
+ displayOptions: { show: { resource: ['h2i'], operation: ['pdf'] } },
190
+ },
191
+ {
192
+ displayName: 'PDF Embed Format',
193
+ name: 'h2iPdfEmbedFormat',
194
+ type: 'options',
195
+ default: 'png',
196
+ options: [
197
+ { name: 'PNG', value: 'png' },
198
+ { name: 'JPEG', value: 'jpeg' },
199
+ ],
200
+ displayOptions: { show: { resource: ['h2i'], operation: ['pdf'] } },
201
+ },
202
+ {
203
+ displayName: 'PDF JPEG Quality',
204
+ name: 'h2iPdfJpegQuality',
205
+ type: 'number',
206
+ default: 85,
207
+ displayOptions: { show: { resource: ['h2i'], operation: ['pdf'] } },
131
208
  },
132
209
  {
133
210
  displayName: 'Download Result as Binary',
134
211
  name: 'downloadBinary',
135
212
  type: 'boolean',
136
213
  default: false,
137
- displayOptions: { show: { resource: ['h2i'], operation: ['render'] } },
214
+ displayOptions: { show: { resource: ['h2i'], operation: ['image', 'pdf'] } },
138
215
  },
139
216
  {
140
217
  displayName: 'Output Binary Property',
141
218
  name: 'outputBinaryProperty',
142
219
  type: 'string',
143
220
  default: 'data',
144
- displayOptions: { show: { resource: ['h2i'], operation: ['render'], downloadBinary: [true] } },
221
+ displayOptions: { show: { resource: ['h2i'], operation: ['image', 'pdf'], downloadBinary: [true] } },
145
222
  },
146
223
  // -------------------------
147
224
  // Image
@@ -153,7 +230,7 @@ class DavixH2I {
153
230
  default: 'data',
154
231
  placeholder: 'data OR image1,image2',
155
232
  description: 'Comma-separated binary property names from previous nodes (each will be sent as an `images` file).',
156
- displayOptions: { show: { resource: ['image'], operation: ['transform'] } },
233
+ displayOptions: { show: { resource: ['image'] } },
157
234
  },
158
235
  {
159
236
  displayName: 'Format',
@@ -169,54 +246,270 @@ class DavixH2I {
169
246
  { name: 'SVG', value: 'svg' },
170
247
  { name: 'PDF', value: 'pdf' },
171
248
  ],
172
- displayOptions: { show: { resource: ['image'], operation: ['transform'] } },
249
+ displayOptions: { show: { resource: ['image'] } },
250
+ },
251
+ { displayName: 'Width', name: 'imageWidth', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['resize', 'format'] } } },
252
+ { displayName: 'Height', name: 'imageHeight', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['resize', 'format'] } } },
253
+ { displayName: 'Enlarge', name: 'enlarge', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['resize'] } } },
254
+ { displayName: 'Normalize Orientation', name: 'normalizeOrientation', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['resize', 'crop', 'enhance', 'metadata'] } } },
255
+ { displayName: 'Crop X', name: 'cropX', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['crop'] } } },
256
+ { displayName: 'Crop Y', name: 'cropY', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['crop'] } } },
257
+ { displayName: 'Crop Width', name: 'cropWidth', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['crop'] } } },
258
+ { displayName: 'Crop Height', name: 'cropHeight', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['crop'] } } },
259
+ { displayName: 'Background Color', name: 'backgroundColor', type: 'string', default: '', displayOptions: { show: { resource: ['image'], operation: ['crop', 'compress', 'background'] } } },
260
+ { displayName: 'Rotate (degrees)', name: 'rotate', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['transform'] } } },
261
+ { displayName: 'Flip Horizontal', name: 'flipH', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['transform'] } } },
262
+ { displayName: 'Flip Vertical', name: 'flipV', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['transform'] } } },
263
+ { displayName: 'Color Space', name: 'colorSpace', type: 'options', default: 'srgb', options: [{ name: 'sRGB', value: 'srgb' }, { name: 'Display P3', value: 'display-p3' }], displayOptions: { show: { resource: ['image'], operation: ['transform', 'compress'] } } },
264
+ { displayName: 'Target Size (KB)', name: 'targetSizeKB', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['compress'] } } },
265
+ { displayName: 'Quality', name: 'quality', type: 'number', default: 82, displayOptions: { show: { resource: ['image'], operation: ['compress'] } } },
266
+ { displayName: 'Keep Metadata', name: 'keepMetadata', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['format', 'resize', 'crop', 'transform', 'compress', 'enhance', 'padding', 'frame', 'background', 'watermark', 'pdf', 'multitask', 'metadata'] } } },
267
+ { displayName: 'Blur', name: 'blur', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['enhance'] } } },
268
+ { displayName: 'Sharpen', name: 'sharpen', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['enhance'] } } },
269
+ { displayName: 'Grayscale', name: 'grayscale', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['enhance'] } } },
270
+ { displayName: 'Sepia', name: 'sepia', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['enhance'] } } },
271
+ { displayName: 'Brightness', name: 'brightness', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['enhance'] } } },
272
+ { displayName: 'Contrast', name: 'contrast', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['enhance'] } } },
273
+ { displayName: 'Saturation', name: 'saturation', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['enhance'] } } },
274
+ { displayName: 'Pad', name: 'pad', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['padding', 'frame'] } } },
275
+ { displayName: 'Pad Top', name: 'padTop', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['padding'] } } },
276
+ { displayName: 'Pad Right', name: 'padRight', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['padding'] } } },
277
+ { displayName: 'Pad Bottom', name: 'padBottom', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['padding'] } } },
278
+ { displayName: 'Pad Left', name: 'padLeft', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['padding'] } } },
279
+ { displayName: 'Pad Color', name: 'padColor', type: 'string', default: '', displayOptions: { show: { resource: ['image'], operation: ['padding', 'frame', 'background'] } } },
280
+ { displayName: 'Border', name: 'border', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['frame'] } } },
281
+ { displayName: 'Border Color', name: 'borderColor', type: 'string', default: '', displayOptions: { show: { resource: ['image'], operation: ['frame'] } } },
282
+ { displayName: 'Border Radius', name: 'borderRadius', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['padding', 'background'] } } },
283
+ { displayName: 'Background Blur', name: 'backgroundBlur', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['background'] } } },
284
+ { displayName: 'Watermark Text', name: 'watermarkText', type: 'string', default: '', displayOptions: { show: { resource: ['image'], operation: ['watermark'] } } },
285
+ { displayName: 'Watermark Font Size', name: 'watermarkFontSize', type: 'number', default: 24, displayOptions: { show: { resource: ['image'], operation: ['watermark'] } } },
286
+ { displayName: 'Watermark Color', name: 'watermarkColor', type: 'string', default: '#000000', displayOptions: { show: { resource: ['image'], operation: ['watermark'] } } },
287
+ { displayName: 'Watermark Opacity', name: 'watermarkOpacity', type: 'number', default: 0.35, displayOptions: { show: { resource: ['image'], operation: ['watermark'] } } },
288
+ {
289
+ displayName: 'Watermark Position',
290
+ name: 'watermarkPosition',
291
+ type: 'options',
292
+ default: 'center',
293
+ options: [
294
+ { name: 'Center', value: 'center' },
295
+ { name: 'Top Left', value: 'top-left' },
296
+ { name: 'Top Right', value: 'top-right' },
297
+ { name: 'Bottom Left', value: 'bottom-left' },
298
+ { name: 'Bottom Right', value: 'bottom-right' },
299
+ ],
300
+ displayOptions: { show: { resource: ['image'], operation: ['watermark'] } },
173
301
  },
302
+ { displayName: 'Watermark Margin', name: 'watermarkMargin', type: 'number', default: 8, displayOptions: { show: { resource: ['image'], operation: ['watermark'] } } },
303
+ { displayName: 'Watermark Scale', name: 'watermarkScale', type: 'number', default: 1, displayOptions: { show: { resource: ['image'], operation: ['watermark'] } } },
174
304
  {
175
- displayName: 'Width',
176
- name: 'imageWidth',
305
+ displayName: 'Watermark Image Binary Property',
306
+ name: 'watermarkImageBinaryProp',
307
+ type: 'string',
308
+ default: '',
309
+ placeholder: 'watermarkImage',
310
+ displayOptions: { show: { resource: ['image'], operation: ['watermark'] } },
311
+ },
312
+ {
313
+ displayName: 'PDF Mode',
314
+ name: 'pdfMode',
315
+ type: 'options',
316
+ default: 'single',
317
+ options: [
318
+ { name: 'Single', value: 'single' },
319
+ { name: 'Multi', value: 'multi' },
320
+ ],
321
+ displayOptions: { show: { resource: ['image'], operation: ['pdf'] } },
322
+ },
323
+ {
324
+ displayName: 'PDF Page Size',
325
+ name: 'pdfPageSize',
326
+ type: 'options',
327
+ default: 'auto',
328
+ options: [
329
+ { name: 'Auto', value: 'auto' },
330
+ { name: 'A4', value: 'a4' },
331
+ { name: 'Letter', value: 'letter' },
332
+ ],
333
+ displayOptions: { show: { resource: ['image'], operation: ['pdf'] } },
334
+ },
335
+ {
336
+ displayName: 'PDF Orientation',
337
+ name: 'pdfOrientation',
338
+ type: 'options',
339
+ default: 'portrait',
340
+ options: [
341
+ { name: 'Portrait', value: 'portrait' },
342
+ { name: 'Landscape', value: 'landscape' },
343
+ ],
344
+ displayOptions: { show: { resource: ['image'], operation: ['pdf'] } },
345
+ },
346
+ {
347
+ displayName: 'PDF Margin',
348
+ name: 'pdfMargin',
177
349
  type: 'number',
178
350
  default: 0,
179
- displayOptions: { show: { resource: ['image'], operation: ['transform'] } },
351
+ displayOptions: { show: { resource: ['image'], operation: ['pdf'] } },
180
352
  },
181
353
  {
182
- displayName: 'Height',
183
- name: 'imageHeight',
354
+ displayName: 'PDF Embed Format',
355
+ name: 'pdfEmbedFormat',
356
+ type: 'options',
357
+ default: 'png',
358
+ options: [
359
+ { name: 'PNG', value: 'png' },
360
+ { name: 'JPEG', value: 'jpeg' },
361
+ ],
362
+ displayOptions: { show: { resource: ['image'], operation: ['pdf'] } },
363
+ },
364
+ {
365
+ displayName: 'PDF JPEG Quality',
366
+ name: 'pdfJpegQuality',
184
367
  type: 'number',
185
- default: 0,
186
- displayOptions: { show: { resource: ['image'], operation: ['transform'] } },
368
+ default: 85,
369
+ displayOptions: { show: { resource: ['image'], operation: ['pdf'] } },
187
370
  },
371
+ { displayName: 'Include Raw EXIF', name: 'includeRawExif', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['metadata'] } } },
188
372
  {
189
- displayName: 'Enlarge',
190
- name: 'enlarge',
373
+ displayName: 'Multitask Options',
374
+ name: 'imageMultitaskOptions',
375
+ type: 'multiOptions',
376
+ default: [],
377
+ options: [
378
+ { name: 'Format', value: 'format' },
379
+ { name: 'Width', value: 'width' },
380
+ { name: 'Height', value: 'height' },
381
+ { name: 'Enlarge', value: 'enlarge' },
382
+ { name: 'Normalize Orientation', value: 'normalizeOrientation' },
383
+ { name: 'Crop', value: 'crop' },
384
+ { name: 'Background Color', value: 'backgroundColor' },
385
+ { name: 'Rotate', value: 'rotate' },
386
+ { name: 'Flip Horizontal', value: 'flipH' },
387
+ { name: 'Flip Vertical', value: 'flipV' },
388
+ { name: 'Color Space', value: 'colorSpace' },
389
+ { name: 'Target Size (KB)', value: 'targetSizeKB' },
390
+ { name: 'Quality', value: 'quality' },
391
+ { name: 'Keep Metadata', value: 'keepMetadata' },
392
+ { name: 'Blur', value: 'blur' },
393
+ { name: 'Sharpen', value: 'sharpen' },
394
+ { name: 'Grayscale', value: 'grayscale' },
395
+ { name: 'Sepia', value: 'sepia' },
396
+ { name: 'Brightness', value: 'brightness' },
397
+ { name: 'Contrast', value: 'contrast' },
398
+ { name: 'Saturation', value: 'saturation' },
399
+ { name: 'Pad', value: 'pad' },
400
+ { name: 'Pad Sides', value: 'padSides' },
401
+ { name: 'Pad Color', value: 'padColor' },
402
+ { name: 'Border', value: 'border' },
403
+ { name: 'Border Color', value: 'borderColor' },
404
+ { name: 'Border Radius', value: 'borderRadius' },
405
+ { name: 'Background Blur', value: 'backgroundBlur' },
406
+ { name: 'Watermark', value: 'watermark' },
407
+ { name: 'PDF Options', value: 'pdf' },
408
+ { name: 'Include Raw EXIF', value: 'includeRawExif' },
409
+ ],
410
+ displayOptions: { show: { resource: ['image'], operation: ['multitask'] } },
411
+ },
412
+ // Conditional image fields for multitask
413
+ { displayName: 'Width', name: 'multiWidth', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['width'] } } },
414
+ { displayName: 'Height', name: 'multiHeight', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['height'] } } },
415
+ { displayName: 'Enlarge', name: 'multiEnlarge', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['enlarge'] } } },
416
+ {
417
+ displayName: 'Normalize Orientation',
418
+ name: 'multiNormalizeOrientation',
191
419
  type: 'boolean',
192
420
  default: false,
193
- displayOptions: { show: { resource: ['image'], operation: ['transform'] } },
421
+ displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['normalizeOrientation'] } },
422
+ },
423
+ { displayName: 'Crop X', name: 'multiCropX', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['crop'] } } },
424
+ { displayName: 'Crop Y', name: 'multiCropY', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['crop'] } } },
425
+ { displayName: 'Crop Width', name: 'multiCropWidth', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['crop'] } } },
426
+ { displayName: 'Crop Height', name: 'multiCropHeight', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['crop'] } } },
427
+ { displayName: 'Background Color', name: 'multiBackgroundColor', type: 'string', default: '', displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['backgroundColor'] } } },
428
+ { displayName: 'Rotate (degrees)', name: 'multiRotate', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['rotate'] } } },
429
+ { displayName: 'Flip Horizontal', name: 'multiFlipH', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['flipH'] } } },
430
+ { displayName: 'Flip Vertical', name: 'multiFlipV', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['flipV'] } } },
431
+ {
432
+ displayName: 'Color Space',
433
+ name: 'multiColorSpace',
434
+ type: 'options',
435
+ default: 'srgb',
436
+ options: [{ name: 'sRGB', value: 'srgb' }, { name: 'Display P3', value: 'display-p3' }],
437
+ displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['colorSpace'] } },
438
+ },
439
+ { displayName: 'Target Size (KB)', name: 'multiTargetSizeKB', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['targetSizeKB'] } } },
440
+ { displayName: 'Quality', name: 'multiQuality', type: 'number', default: 82, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['quality'] } } },
441
+ {
442
+ displayName: 'Keep Metadata',
443
+ name: 'multiKeepMetadata',
444
+ type: 'boolean',
445
+ default: false,
446
+ displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['keepMetadata'] } },
447
+ },
448
+ { displayName: 'Blur', name: 'multiBlur', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['blur'] } } },
449
+ { displayName: 'Sharpen', name: 'multiSharpen', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['sharpen'] } } },
450
+ { displayName: 'Grayscale', name: 'multiGrayscale', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['grayscale'] } } },
451
+ { displayName: 'Sepia', name: 'multiSepia', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['sepia'] } } },
452
+ { displayName: 'Brightness', name: 'multiBrightness', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['brightness'] } } },
453
+ { displayName: 'Contrast', name: 'multiContrast', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['contrast'] } } },
454
+ { displayName: 'Saturation', name: 'multiSaturation', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['saturation'] } } },
455
+ { displayName: 'Pad', name: 'multiPad', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['pad'] } } },
456
+ {
457
+ displayName: 'Pad Sides',
458
+ name: 'multiPadSides',
459
+ type: 'boolean',
460
+ default: false,
461
+ displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['padSides'] } },
462
+ },
463
+ { displayName: 'Pad Top', name: 'multiPadTop', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['padSides'] } } },
464
+ { displayName: 'Pad Right', name: 'multiPadRight', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['padSides'] } } },
465
+ { displayName: 'Pad Bottom', name: 'multiPadBottom', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['padSides'] } } },
466
+ { displayName: 'Pad Left', name: 'multiPadLeft', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['padSides'] } } },
467
+ { displayName: 'Pad Color', name: 'multiPadColor', type: 'string', default: '', displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['padColor'] } } },
468
+ { displayName: 'Border', name: 'multiBorder', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['border'] } } },
469
+ { displayName: 'Border Color', name: 'multiBorderColor', type: 'string', default: '', displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['borderColor'] } } },
470
+ { displayName: 'Border Radius', name: 'multiBorderRadius', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['borderRadius'] } } },
471
+ { displayName: 'Background Blur', name: 'multiBackgroundBlur', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['backgroundBlur'] } } },
472
+ { displayName: 'Watermark Text', name: 'multiWatermarkText', type: 'string', default: '', displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['watermark'] } } },
473
+ { displayName: 'Watermark Font Size', name: 'multiWatermarkFontSize', type: 'number', default: 24, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['watermark'] } } },
474
+ { displayName: 'Watermark Color', name: 'multiWatermarkColor', type: 'string', default: '#000000', displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['watermark'] } } },
475
+ { displayName: 'Watermark Opacity', name: 'multiWatermarkOpacity', type: 'number', default: 0.35, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['watermark'] } } },
476
+ {
477
+ displayName: 'Watermark Position',
478
+ name: 'multiWatermarkPosition',
479
+ type: 'options',
480
+ default: 'center',
481
+ options: [
482
+ { name: 'Center', value: 'center' },
483
+ { name: 'Top Left', value: 'top-left' },
484
+ { name: 'Top Right', value: 'top-right' },
485
+ { name: 'Bottom Left', value: 'bottom-left' },
486
+ { name: 'Bottom Right', value: 'bottom-right' },
487
+ ],
488
+ displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['watermark'] } },
489
+ },
490
+ { displayName: 'Watermark Margin', name: 'multiWatermarkMargin', type: 'number', default: 8, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['watermark'] } } },
491
+ { displayName: 'Watermark Scale', name: 'multiWatermarkScale', type: 'number', default: 1, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['watermark'] } } },
492
+ {
493
+ displayName: 'Watermark Image Binary Property',
494
+ name: 'multiWatermarkImageBinaryProp',
495
+ type: 'string',
496
+ default: '',
497
+ displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['watermark'] } },
194
498
  },
195
- { displayName: 'Crop X', name: 'cropX', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['transform'] } } },
196
- { displayName: 'Crop Y', name: 'cropY', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['transform'] } } },
197
- { displayName: 'Crop Width', name: 'cropWidth', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['transform'] } } },
198
- { displayName: 'Crop Height', name: 'cropHeight', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['transform'] } } },
199
- { displayName: 'Rotate (degrees)', name: 'rotate', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['transform'] } } },
200
- { displayName: 'Flip Horizontal', name: 'flipH', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['transform'] } } },
201
- { displayName: 'Flip Vertical', name: 'flipV', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['transform'] } } },
202
- { displayName: 'Target Size (KB)', name: 'targetSizeKB', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['transform'] } } },
203
- { displayName: 'Quality', name: 'quality', type: 'number', default: 82, displayOptions: { show: { resource: ['image'], operation: ['transform'] } } },
204
- { displayName: 'Keep Metadata', name: 'keepMetadata', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['transform'] } } },
205
- // PDF-only options for Image endpoint (format=pdf)
206
499
  {
207
500
  displayName: 'PDF Mode',
208
- name: 'pdfMode',
501
+ name: 'multiPdfMode',
209
502
  type: 'options',
210
503
  default: 'single',
211
504
  options: [
212
505
  { name: 'Single', value: 'single' },
213
506
  { name: 'Multi', value: 'multi' },
214
507
  ],
215
- displayOptions: { show: { resource: ['image'], operation: ['transform'], imageFormat: ['pdf'] } },
508
+ displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['pdf'] } },
216
509
  },
217
510
  {
218
511
  displayName: 'PDF Page Size',
219
- name: 'pdfPageSize',
512
+ name: 'multiPdfPageSize',
220
513
  type: 'options',
221
514
  default: 'auto',
222
515
  options: [
@@ -224,57 +517,75 @@ class DavixH2I {
224
517
  { name: 'A4', value: 'a4' },
225
518
  { name: 'Letter', value: 'letter' },
226
519
  ],
227
- displayOptions: { show: { resource: ['image'], operation: ['transform'], imageFormat: ['pdf'] } },
520
+ displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['pdf'] } },
228
521
  },
229
522
  {
230
523
  displayName: 'PDF Orientation',
231
- name: 'pdfOrientation',
524
+ name: 'multiPdfOrientation',
232
525
  type: 'options',
233
526
  default: 'portrait',
234
527
  options: [
235
528
  { name: 'Portrait', value: 'portrait' },
236
529
  { name: 'Landscape', value: 'landscape' },
237
530
  ],
238
- displayOptions: { show: { resource: ['image'], operation: ['transform'], imageFormat: ['pdf'] } },
531
+ displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['pdf'] } },
239
532
  },
240
533
  {
241
534
  displayName: 'PDF Margin',
242
- name: 'pdfMargin',
535
+ name: 'multiPdfMargin',
243
536
  type: 'number',
244
537
  default: 0,
245
- displayOptions: { show: { resource: ['image'], operation: ['transform'], imageFormat: ['pdf'] } },
538
+ displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['pdf'] } },
246
539
  },
247
540
  {
248
541
  displayName: 'PDF Embed Format',
249
- name: 'pdfEmbedFormat',
542
+ name: 'multiPdfEmbedFormat',
250
543
  type: 'options',
251
544
  default: 'png',
252
545
  options: [
253
546
  { name: 'PNG', value: 'png' },
254
547
  { name: 'JPEG', value: 'jpeg' },
255
548
  ],
256
- displayOptions: { show: { resource: ['image'], operation: ['transform'], imageFormat: ['pdf'] } },
549
+ displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['pdf'] } },
257
550
  },
258
551
  {
259
552
  displayName: 'PDF JPEG Quality',
260
- name: 'pdfJpegQuality',
553
+ name: 'multiPdfJpegQuality',
261
554
  type: 'number',
262
555
  default: 85,
263
- displayOptions: { show: { resource: ['image'], operation: ['transform'], imageFormat: ['pdf'] } },
556
+ displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['pdf'] } },
557
+ },
558
+ {
559
+ displayName: 'Include Raw EXIF',
560
+ name: 'multiIncludeRawExif',
561
+ type: 'boolean',
562
+ default: false,
563
+ displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['includeRawExif'] } },
264
564
  },
265
565
  {
266
566
  displayName: 'Download Result(s) as Binary',
267
567
  name: 'imageDownloadBinary',
268
568
  type: 'boolean',
269
569
  default: false,
270
- displayOptions: { show: { resource: ['image'], operation: ['transform'] } },
570
+ displayOptions: {
571
+ show: {
572
+ resource: ['image'],
573
+ operation: ['format', 'resize', 'crop', 'transform', 'compress', 'enhance', 'padding', 'frame', 'background', 'watermark', 'pdf', 'multitask'],
574
+ },
575
+ },
271
576
  },
272
577
  {
273
578
  displayName: 'Output Binary Property',
274
579
  name: 'imageOutputBinaryProperty',
275
580
  type: 'string',
276
581
  default: 'data',
277
- displayOptions: { show: { resource: ['image'], operation: ['transform'], imageDownloadBinary: [true] } },
582
+ displayOptions: {
583
+ show: {
584
+ resource: ['image'],
585
+ operation: ['format', 'resize', 'crop', 'transform', 'compress', 'enhance', 'padding', 'frame', 'background', 'watermark', 'pdf', 'multitask'],
586
+ imageDownloadBinary: [true],
587
+ },
588
+ },
278
589
  },
279
590
  // -------------------------
280
591
  // PDF
@@ -308,7 +619,7 @@ class DavixH2I {
308
619
  name: 'prefix',
309
620
  type: 'string',
310
621
  default: 'split_',
311
- displayOptions: { show: { resource: ['pdf'], operation: ['split'] } },
622
+ displayOptions: { show: { resource: ['pdf'], operation: ['split', 'extract'] } },
312
623
  },
313
624
  {
314
625
  displayName: 'Pages',
@@ -316,7 +627,9 @@ class DavixH2I {
316
627
  type: 'string',
317
628
  default: 'all',
318
629
  placeholder: 'all OR 1-3,5,7',
319
- displayOptions: { show: { resource: ['pdf'], operation: ['to-images', 'extract-images'] } },
630
+ displayOptions: {
631
+ show: { resource: ['pdf'], operation: ['to-images', 'extract-images', 'watermark', 'rotate', 'delete-pages', 'extract'] },
632
+ },
320
633
  },
321
634
  {
322
635
  displayName: 'To Format',
@@ -345,6 +658,47 @@ class DavixH2I {
345
658
  ],
346
659
  displayOptions: { show: { resource: ['pdf'], operation: ['extract-images'] } },
347
660
  },
661
+ { displayName: 'Watermark Text', name: 'watermarkText', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['watermark'] } } },
662
+ { displayName: 'Watermark Opacity', name: 'watermarkOpacity', type: 'number', default: 0.35, displayOptions: { show: { resource: ['pdf'], operation: ['watermark'] } } },
663
+ {
664
+ displayName: 'Watermark Position',
665
+ name: 'watermarkPosition',
666
+ type: 'options',
667
+ default: 'center',
668
+ options: [
669
+ { name: 'Center', value: 'center' },
670
+ { name: 'Top Left', value: 'top-left' },
671
+ { name: 'Top Right', value: 'top-right' },
672
+ { name: 'Bottom Left', value: 'bottom-left' },
673
+ { name: 'Bottom Right', value: 'bottom-right' },
674
+ ],
675
+ displayOptions: { show: { resource: ['pdf'], operation: ['watermark'] } },
676
+ },
677
+ { displayName: 'Watermark Margin', name: 'watermarkMargin', type: 'number', default: 8, displayOptions: { show: { resource: ['pdf'], operation: ['watermark'] } } },
678
+ { displayName: 'Watermark Font Size', name: 'watermarkFontSize', type: 'number', default: 24, displayOptions: { show: { resource: ['pdf'], operation: ['watermark'] } } },
679
+ { displayName: 'Watermark Color', name: 'watermarkColor', type: 'string', default: '#000000', displayOptions: { show: { resource: ['pdf'], operation: ['watermark'] } } },
680
+ { displayName: 'Watermark Scale', name: 'watermarkScale', type: 'number', default: 1, displayOptions: { show: { resource: ['pdf'], operation: ['watermark'] } } },
681
+ {
682
+ displayName: 'Watermark Image Binary Property',
683
+ name: 'watermarkImageBinaryProp',
684
+ type: 'string',
685
+ default: '',
686
+ displayOptions: { show: { resource: ['pdf'], operation: ['watermark'] } },
687
+ },
688
+ { displayName: 'Degrees', name: 'degrees', type: 'number', default: 0, displayOptions: { show: { resource: ['pdf'], operation: ['rotate'] } } },
689
+ { displayName: 'Title', name: 'title', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['metadata'] } } },
690
+ { displayName: 'Author', name: 'author', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['metadata'] } } },
691
+ { displayName: 'Subject', name: 'subject', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['metadata'] } } },
692
+ { displayName: 'Keywords', name: 'keywords', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['metadata'] } } },
693
+ { displayName: 'Creator', name: 'creator', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['metadata'] } } },
694
+ { displayName: 'Producer', name: 'producer', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['metadata'] } } },
695
+ { displayName: 'Clean All Metadata', name: 'cleanAllMetadata', type: 'boolean', default: false, displayOptions: { show: { resource: ['pdf'], operation: ['metadata'] } } },
696
+ { displayName: 'Order (JSON array)', name: 'order', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['reorder'] } } },
697
+ { displayName: 'Mode', name: 'mode', type: 'string', default: 'range', displayOptions: { show: { resource: ['pdf'], operation: ['extract'] } } },
698
+ { displayName: 'Flatten Forms', name: 'flattenForms', type: 'boolean', default: false, displayOptions: { show: { resource: ['pdf'], operation: ['flatten'] } } },
699
+ { displayName: 'User Password', name: 'userPassword', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['encrypt'] } } },
700
+ { displayName: 'Owner Password', name: 'ownerPassword', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['encrypt'] } } },
701
+ { displayName: 'Password', name: 'password', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['decrypt'] } } },
348
702
  {
349
703
  displayName: 'Download Result(s) as Binary',
350
704
  name: 'pdfDownloadBinary',
@@ -369,7 +723,21 @@ class DavixH2I {
369
723
  default: 'data',
370
724
  placeholder: 'data OR img1,img2',
371
725
  description: 'Comma-separated binary property names (each will be sent as an `images` file).',
372
- displayOptions: { show: { resource: ['tools'], operation: ['analyze'] } },
726
+ displayOptions: { show: { resource: ['tools'] } },
727
+ },
728
+ {
729
+ displayName: 'Tool',
730
+ name: 'tool',
731
+ type: 'options',
732
+ default: 'metadata',
733
+ options: [
734
+ { name: 'Metadata', value: 'metadata' },
735
+ { name: 'Colors', value: 'colors' },
736
+ { name: 'Detect Format', value: 'detect-format' },
737
+ { name: 'Orientation', value: 'orientation' },
738
+ { name: 'Hash', value: 'hash' },
739
+ ],
740
+ displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
373
741
  },
374
742
  {
375
743
  displayName: 'Tools',
@@ -383,21 +751,53 @@ class DavixH2I {
383
751
  { name: 'Orientation', value: 'orientation' },
384
752
  { name: 'Hash', value: 'hash' },
385
753
  ],
386
- displayOptions: { show: { resource: ['tools'], operation: ['analyze'] } },
754
+ displayOptions: { show: { resource: ['tools'], operation: ['multitask'] } },
755
+ },
756
+ {
757
+ displayName: 'Multitask Options',
758
+ name: 'toolsMultitaskOptions',
759
+ type: 'multiOptions',
760
+ default: [],
761
+ options: [
762
+ { name: 'Include Raw EXIF', value: 'includeRawExif' },
763
+ { name: 'Palette Size', value: 'paletteSize' },
764
+ { name: 'Hash Type', value: 'hashType' },
765
+ { name: 'Quality Sample', value: 'qualitySample' },
766
+ { name: 'Transparency Sample', value: 'transparencySample' },
767
+ { name: 'Similarity Mode', value: 'similarityMode' },
768
+ { name: 'Similarity Threshold', value: 'similarityThreshold' },
769
+ { name: 'Efficiency Format', value: 'efficiencyFormat' },
770
+ { name: 'Efficiency Quality', value: 'efficiencyQuality' },
771
+ ],
772
+ displayOptions: { show: { resource: ['tools'], operation: ['multitask'] } },
387
773
  },
388
774
  {
389
775
  displayName: 'Include Raw EXIF',
390
776
  name: 'includeRawExif',
391
777
  type: 'boolean',
392
778
  default: false,
393
- displayOptions: { show: { resource: ['tools'], operation: ['analyze'] } },
779
+ displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
780
+ },
781
+ {
782
+ displayName: 'Include Raw EXIF',
783
+ name: 'multiIncludeRawExif',
784
+ type: 'boolean',
785
+ default: false,
786
+ displayOptions: { show: { resource: ['tools'], operation: ['multitask'], toolsMultitaskOptions: ['includeRawExif'] } },
394
787
  },
395
788
  {
396
789
  displayName: 'Palette Size',
397
790
  name: 'paletteSize',
398
791
  type: 'number',
399
792
  default: 5,
400
- displayOptions: { show: { resource: ['tools'], operation: ['analyze'] } },
793
+ displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
794
+ },
795
+ {
796
+ displayName: 'Palette Size',
797
+ name: 'multiPaletteSize',
798
+ type: 'number',
799
+ default: 5,
800
+ displayOptions: { show: { resource: ['tools'], operation: ['multitask'], toolsMultitaskOptions: ['paletteSize'] } },
401
801
  },
402
802
  {
403
803
  displayName: 'Hash Type',
@@ -409,7 +809,103 @@ class DavixH2I {
409
809
  { name: 'MD5', value: 'md5' },
410
810
  { name: 'SHA1', value: 'sha1' },
411
811
  ],
412
- displayOptions: { show: { resource: ['tools'], operation: ['analyze'] } },
812
+ displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
813
+ },
814
+ {
815
+ displayName: 'Hash Type',
816
+ name: 'multiHashType',
817
+ type: 'options',
818
+ default: 'phash',
819
+ options: [
820
+ { name: 'pHash', value: 'phash' },
821
+ { name: 'MD5', value: 'md5' },
822
+ { name: 'SHA1', value: 'sha1' },
823
+ ],
824
+ displayOptions: { show: { resource: ['tools'], operation: ['multitask'], toolsMultitaskOptions: ['hashType'] } },
825
+ },
826
+ {
827
+ displayName: 'Quality Sample',
828
+ name: 'qualitySample',
829
+ type: 'number',
830
+ default: 0,
831
+ displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
832
+ },
833
+ {
834
+ displayName: 'Quality Sample',
835
+ name: 'multiQualitySample',
836
+ type: 'number',
837
+ default: 0,
838
+ displayOptions: { show: { resource: ['tools'], operation: ['multitask'], toolsMultitaskOptions: ['qualitySample'] } },
839
+ },
840
+ {
841
+ displayName: 'Transparency Sample',
842
+ name: 'transparencySample',
843
+ type: 'number',
844
+ default: 0,
845
+ displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
846
+ },
847
+ {
848
+ displayName: 'Transparency Sample',
849
+ name: 'multiTransparencySample',
850
+ type: 'number',
851
+ default: 0,
852
+ displayOptions: { show: { resource: ['tools'], operation: ['multitask'], toolsMultitaskOptions: ['transparencySample'] } },
853
+ },
854
+ {
855
+ displayName: 'Similarity Mode',
856
+ name: 'similarityMode',
857
+ type: 'string',
858
+ default: '',
859
+ displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
860
+ },
861
+ {
862
+ displayName: 'Similarity Mode',
863
+ name: 'multiSimilarityMode',
864
+ type: 'string',
865
+ default: '',
866
+ displayOptions: { show: { resource: ['tools'], operation: ['multitask'], toolsMultitaskOptions: ['similarityMode'] } },
867
+ },
868
+ {
869
+ displayName: 'Similarity Threshold',
870
+ name: 'similarityThreshold',
871
+ type: 'number',
872
+ default: 0,
873
+ displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
874
+ },
875
+ {
876
+ displayName: 'Similarity Threshold',
877
+ name: 'multiSimilarityThreshold',
878
+ type: 'number',
879
+ default: 0,
880
+ displayOptions: { show: { resource: ['tools'], operation: ['multitask'], toolsMultitaskOptions: ['similarityThreshold'] } },
881
+ },
882
+ {
883
+ displayName: 'Efficiency Format',
884
+ name: 'efficiencyFormat',
885
+ type: 'string',
886
+ default: '',
887
+ displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
888
+ },
889
+ {
890
+ displayName: 'Efficiency Format',
891
+ name: 'multiEfficiencyFormat',
892
+ type: 'string',
893
+ default: '',
894
+ displayOptions: { show: { resource: ['tools'], operation: ['multitask'], toolsMultitaskOptions: ['efficiencyFormat'] } },
895
+ },
896
+ {
897
+ displayName: 'Efficiency Quality',
898
+ name: 'efficiencyQuality',
899
+ type: 'number',
900
+ default: 0,
901
+ displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
902
+ },
903
+ {
904
+ displayName: 'Efficiency Quality',
905
+ name: 'multiEfficiencyQuality',
906
+ type: 'number',
907
+ default: 0,
908
+ displayOptions: { show: { resource: ['tools'], operation: ['multitask'], toolsMultitaskOptions: ['efficiencyQuality'] } },
413
909
  },
414
910
  ],
415
911
  };
@@ -419,17 +915,73 @@ class DavixH2I {
419
915
  for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
420
916
  const resource = this.getNodeParameter('resource', itemIndex);
421
917
  const operation = this.getNodeParameter('operation', itemIndex);
918
+ const gatherFirstUrl = (response) => {
919
+ if (typeof response?.url === 'string')
920
+ return String(response.url);
921
+ if (Array.isArray(response?.results)) {
922
+ for (const r of response.results) {
923
+ if (r?.url)
924
+ return String(r.url);
925
+ if (typeof r === 'string')
926
+ return r;
927
+ }
928
+ }
929
+ return undefined;
930
+ };
931
+ const attachFiles = async (fieldName, propList, formData) => {
932
+ const names = propList
933
+ .split(',')
934
+ .map((s) => s.trim())
935
+ .filter(Boolean);
936
+ if (names.length === 0)
937
+ throw new Error('No binary property names provided.');
938
+ for (const name of names) {
939
+ const buffer = await this.helpers.getBinaryDataBuffer(itemIndex, name);
940
+ const meta = items[itemIndex].binary?.[name];
941
+ const fileName = meta?.fileName ?? `${fieldName}-${name}`;
942
+ const mimeType = meta?.mimeType;
943
+ formData[fieldName] = formData[fieldName] || [];
944
+ formData[fieldName].push({
945
+ value: buffer,
946
+ options: {
947
+ filename: fileName,
948
+ contentType: mimeType,
949
+ },
950
+ });
951
+ }
952
+ };
953
+ const attachSingleFile = async (fieldName, propName, formData) => {
954
+ if (!propName)
955
+ return;
956
+ const buffer = await this.helpers.getBinaryDataBuffer(itemIndex, propName);
957
+ const meta = items[itemIndex].binary?.[propName];
958
+ const fileName = meta?.fileName ?? fieldName;
959
+ const mimeType = meta?.mimeType;
960
+ formData[fieldName] = {
961
+ value: buffer,
962
+ options: { filename: fileName, contentType: mimeType },
963
+ };
964
+ };
422
965
  // ---- H2I (JSON)
423
966
  if (resource === 'h2i') {
424
- if (operation !== 'render')
425
- throw new Error(`Unsupported H2I operation: ${operation}`);
967
+ const action = operation;
426
968
  const body = {
969
+ action,
427
970
  html: this.getNodeParameter('html', itemIndex),
428
971
  css: this.getNodeParameter('css', itemIndex),
429
972
  width: this.getNodeParameter('width', itemIndex),
430
973
  height: this.getNodeParameter('height', itemIndex),
431
- format: this.getNodeParameter('format', itemIndex),
432
974
  };
975
+ if (action === 'image') {
976
+ body.format = this.getNodeParameter('format', itemIndex);
977
+ }
978
+ else {
979
+ body.pdfPageSize = this.getNodeParameter('h2iPdfPageSize', itemIndex);
980
+ body.pdfOrientation = this.getNodeParameter('h2iPdfOrientation', itemIndex);
981
+ body.pdfMargin = this.getNodeParameter('h2iPdfMargin', itemIndex);
982
+ body.pdfEmbedFormat = this.getNodeParameter('h2iPdfEmbedFormat', itemIndex);
983
+ body.pdfJpegQuality = this.getNodeParameter('h2iPdfJpegQuality', itemIndex);
984
+ }
433
985
  const response = await GenericFunctions_1.davixRequest.call(this, {
434
986
  method: 'POST',
435
987
  url: '/v1/h2i',
@@ -437,9 +989,12 @@ class DavixH2I {
437
989
  body,
438
990
  });
439
991
  const downloadBinary = this.getNodeParameter('downloadBinary', itemIndex);
440
- if (downloadBinary && typeof response.url === 'string') {
992
+ if (downloadBinary) {
993
+ const firstUrl = gatherFirstUrl(response);
994
+ if (!firstUrl)
995
+ throw new Error('No URL returned to download.');
441
996
  const binName = this.getNodeParameter('outputBinaryProperty', itemIndex);
442
- const dl = await GenericFunctions_1.downloadToBinary.call(this, String(response.url), `h2i.${body.format === 'jpeg' ? 'jpg' : 'png'}`);
997
+ const dl = await GenericFunctions_1.downloadToBinary.call(this, firstUrl, action === 'pdf' ? 'h2i.pdf' : `h2i.${body.format === 'jpeg' ? 'jpg' : body.format ?? 'png'}`);
443
998
  const binary = await this.helpers.prepareBinaryData(dl.data, dl.fileName, dl.mimeType);
444
999
  out.push({ json: response, binary: { [binName]: binary } });
445
1000
  }
@@ -448,72 +1003,229 @@ class DavixH2I {
448
1003
  }
449
1004
  continue;
450
1005
  }
451
- // Helper to attach multiple binaries as files
452
- const attachFiles = async (fieldName, propList, formData) => {
453
- const names = propList
454
- .split(',')
455
- .map((s) => s.trim())
456
- .filter(Boolean);
457
- if (names.length === 0)
458
- throw new Error('No binary property names provided.');
459
- for (const name of names) {
460
- const buffer = await this.helpers.getBinaryDataBuffer(itemIndex, name);
461
- const meta = items[itemIndex].binary?.[name];
462
- const fileName = meta?.fileName ?? `${fieldName}-${name}`;
463
- const mimeType = meta?.mimeType;
464
- formData[fieldName] = formData[fieldName] || [];
465
- formData[fieldName].push({
466
- value: buffer,
467
- options: {
468
- filename: fileName,
469
- contentType: mimeType,
470
- },
471
- });
472
- }
473
- };
474
1006
  // ---- IMAGE (multipart)
475
1007
  if (resource === 'image') {
476
- if (operation !== 'transform')
477
- throw new Error(`Unsupported Image operation: ${operation}`);
1008
+ const action = operation;
478
1009
  const imageBinaryProps = this.getNodeParameter('imageBinaryProps', itemIndex);
479
1010
  const format = this.getNodeParameter('imageFormat', itemIndex);
480
- const formData = {};
1011
+ const formData = { action };
481
1012
  await attachFiles('images', imageBinaryProps, formData);
482
- // core params
483
- formData.format = format;
484
- const w = this.getNodeParameter('imageWidth', itemIndex);
485
- const h = this.getNodeParameter('imageHeight', itemIndex);
486
- if (w)
487
- formData.width = String(w);
488
- if (h)
489
- formData.height = String(h);
490
- formData.enlarge = toBoolString(this.getNodeParameter('enlarge', itemIndex));
491
- formData.rotate = String(this.getNodeParameter('rotate', itemIndex));
492
- formData.flipH = toBoolString(this.getNodeParameter('flipH', itemIndex));
493
- formData.flipV = toBoolString(this.getNodeParameter('flipV', itemIndex));
494
- const cropX = this.getNodeParameter('cropX', itemIndex);
495
- const cropY = this.getNodeParameter('cropY', itemIndex);
496
- const cropWidth = this.getNodeParameter('cropWidth', itemIndex);
497
- const cropHeight = this.getNodeParameter('cropHeight', itemIndex);
498
- if (cropWidth && cropHeight) {
499
- formData.cropX = String(cropX);
500
- formData.cropY = String(cropY);
501
- formData.cropWidth = String(cropWidth);
502
- formData.cropHeight = String(cropHeight);
503
- }
504
- const targetSizeKB = this.getNodeParameter('targetSizeKB', itemIndex);
505
- if (targetSizeKB)
506
- formData.targetSizeKB = String(targetSizeKB);
507
- formData.quality = String(this.getNodeParameter('quality', itemIndex));
508
- formData.keepMetadata = toBoolString(this.getNodeParameter('keepMetadata', itemIndex));
509
- // pdf-only params
510
- if (format === 'pdf') {
1013
+ const setNumber = (name, value) => {
1014
+ if (value !== undefined && value !== null && value !== 0)
1015
+ formData[name] = String(value);
1016
+ };
1017
+ const setString = (name, value) => {
1018
+ if (value !== undefined && value !== null && value !== '')
1019
+ formData[name] = value;
1020
+ };
1021
+ const setBool = (name, value) => {
1022
+ formData[name] = toBoolString(value);
1023
+ };
1024
+ const includePdfFields = () => {
511
1025
  formData.pdfMode = this.getNodeParameter('pdfMode', itemIndex);
512
1026
  formData.pdfPageSize = this.getNodeParameter('pdfPageSize', itemIndex);
513
1027
  formData.pdfOrientation = this.getNodeParameter('pdfOrientation', itemIndex);
514
- formData.pdfMargin = String(this.getNodeParameter('pdfMargin', itemIndex));
1028
+ setNumber('pdfMargin', this.getNodeParameter('pdfMargin', itemIndex));
515
1029
  formData.pdfEmbedFormat = this.getNodeParameter('pdfEmbedFormat', itemIndex);
516
- formData.pdfJpegQuality = String(this.getNodeParameter('pdfJpegQuality', itemIndex));
1030
+ setNumber('pdfJpegQuality', this.getNodeParameter('pdfJpegQuality', itemIndex));
1031
+ };
1032
+ const includeWatermarkFile = async (propName) => {
1033
+ if (propName)
1034
+ await attachSingleFile('watermarkImage', propName, formData);
1035
+ };
1036
+ switch (action) {
1037
+ case 'format':
1038
+ formData.format = format;
1039
+ setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
1040
+ setNumber('width', this.getNodeParameter('imageWidth', itemIndex));
1041
+ setNumber('height', this.getNodeParameter('imageHeight', itemIndex));
1042
+ break;
1043
+ case 'resize':
1044
+ formData.format = format;
1045
+ setNumber('width', this.getNodeParameter('imageWidth', itemIndex));
1046
+ setNumber('height', this.getNodeParameter('imageHeight', itemIndex));
1047
+ setBool('enlarge', this.getNodeParameter('enlarge', itemIndex));
1048
+ setBool('normalizeOrientation', this.getNodeParameter('normalizeOrientation', itemIndex));
1049
+ setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
1050
+ break;
1051
+ case 'crop':
1052
+ formData.format = format;
1053
+ setNumber('cropX', this.getNodeParameter('cropX', itemIndex));
1054
+ setNumber('cropY', this.getNodeParameter('cropY', itemIndex));
1055
+ setNumber('cropWidth', this.getNodeParameter('cropWidth', itemIndex));
1056
+ setNumber('cropHeight', this.getNodeParameter('cropHeight', itemIndex));
1057
+ setBool('normalizeOrientation', this.getNodeParameter('normalizeOrientation', itemIndex));
1058
+ setString('backgroundColor', this.getNodeParameter('backgroundColor', itemIndex));
1059
+ setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
1060
+ break;
1061
+ case 'transform':
1062
+ formData.format = format;
1063
+ setNumber('rotate', this.getNodeParameter('rotate', itemIndex));
1064
+ setBool('flipH', this.getNodeParameter('flipH', itemIndex));
1065
+ setBool('flipV', this.getNodeParameter('flipV', itemIndex));
1066
+ formData.colorSpace = this.getNodeParameter('colorSpace', itemIndex);
1067
+ setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
1068
+ break;
1069
+ case 'compress':
1070
+ formData.format = format;
1071
+ setNumber('targetSizeKB', this.getNodeParameter('targetSizeKB', itemIndex));
1072
+ setNumber('quality', this.getNodeParameter('quality', itemIndex));
1073
+ formData.colorSpace = this.getNodeParameter('colorSpace', itemIndex);
1074
+ setString('backgroundColor', this.getNodeParameter('backgroundColor', itemIndex));
1075
+ setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
1076
+ break;
1077
+ case 'enhance':
1078
+ formData.format = format;
1079
+ setNumber('blur', this.getNodeParameter('blur', itemIndex));
1080
+ setNumber('sharpen', this.getNodeParameter('sharpen', itemIndex));
1081
+ setBool('grayscale', this.getNodeParameter('grayscale', itemIndex));
1082
+ setBool('sepia', this.getNodeParameter('sepia', itemIndex));
1083
+ setNumber('brightness', this.getNodeParameter('brightness', itemIndex));
1084
+ setNumber('contrast', this.getNodeParameter('contrast', itemIndex));
1085
+ setNumber('saturation', this.getNodeParameter('saturation', itemIndex));
1086
+ setBool('normalizeOrientation', this.getNodeParameter('normalizeOrientation', itemIndex));
1087
+ setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
1088
+ break;
1089
+ case 'padding':
1090
+ formData.format = format;
1091
+ setNumber('pad', this.getNodeParameter('pad', itemIndex));
1092
+ if (this.getNodeParameter('padTop', itemIndex) || this.getNodeParameter('padRight', itemIndex) || this.getNodeParameter('padBottom', itemIndex) || this.getNodeParameter('padLeft', itemIndex)) {
1093
+ setNumber('padTop', this.getNodeParameter('padTop', itemIndex));
1094
+ setNumber('padRight', this.getNodeParameter('padRight', itemIndex));
1095
+ setNumber('padBottom', this.getNodeParameter('padBottom', itemIndex));
1096
+ setNumber('padLeft', this.getNodeParameter('padLeft', itemIndex));
1097
+ }
1098
+ setString('padColor', this.getNodeParameter('padColor', itemIndex));
1099
+ setNumber('borderRadius', this.getNodeParameter('borderRadius', itemIndex));
1100
+ setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
1101
+ break;
1102
+ case 'frame':
1103
+ formData.format = format;
1104
+ setNumber('border', this.getNodeParameter('border', itemIndex));
1105
+ setString('borderColor', this.getNodeParameter('borderColor', itemIndex));
1106
+ setNumber('pad', this.getNodeParameter('pad', itemIndex));
1107
+ setString('padColor', this.getNodeParameter('padColor', itemIndex));
1108
+ setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
1109
+ break;
1110
+ case 'background':
1111
+ formData.format = format;
1112
+ setString('backgroundColor', this.getNodeParameter('backgroundColor', itemIndex));
1113
+ setNumber('backgroundBlur', this.getNodeParameter('backgroundBlur', itemIndex));
1114
+ setNumber('borderRadius', this.getNodeParameter('borderRadius', itemIndex));
1115
+ setString('padColor', this.getNodeParameter('padColor', itemIndex));
1116
+ setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
1117
+ break;
1118
+ case 'watermark':
1119
+ formData.format = format;
1120
+ setString('watermarkText', this.getNodeParameter('watermarkText', itemIndex));
1121
+ setNumber('watermarkFontSize', this.getNodeParameter('watermarkFontSize', itemIndex));
1122
+ setString('watermarkColor', this.getNodeParameter('watermarkColor', itemIndex));
1123
+ setNumber('watermarkOpacity', this.getNodeParameter('watermarkOpacity', itemIndex));
1124
+ formData.watermarkPosition = this.getNodeParameter('watermarkPosition', itemIndex);
1125
+ setNumber('watermarkMargin', this.getNodeParameter('watermarkMargin', itemIndex));
1126
+ setNumber('watermarkScale', this.getNodeParameter('watermarkScale', itemIndex));
1127
+ await includeWatermarkFile(this.getNodeParameter('watermarkImageBinaryProp', itemIndex));
1128
+ setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
1129
+ break;
1130
+ case 'pdf':
1131
+ formData.format = 'pdf';
1132
+ includePdfFields();
1133
+ setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
1134
+ break;
1135
+ case 'metadata':
1136
+ setBool('normalizeOrientation', this.getNodeParameter('normalizeOrientation', itemIndex));
1137
+ setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
1138
+ setBool('includeRawExif', this.getNodeParameter('includeRawExif', itemIndex));
1139
+ break;
1140
+ case 'multitask': {
1141
+ formData.format = format;
1142
+ const options = this.getNodeParameter('imageMultitaskOptions', itemIndex);
1143
+ const has = (key) => options.includes(key);
1144
+ if (has('width'))
1145
+ setNumber('width', this.getNodeParameter('multiWidth', itemIndex));
1146
+ if (has('height'))
1147
+ setNumber('height', this.getNodeParameter('multiHeight', itemIndex));
1148
+ if (has('enlarge'))
1149
+ setBool('enlarge', this.getNodeParameter('multiEnlarge', itemIndex));
1150
+ if (has('normalizeOrientation'))
1151
+ setBool('normalizeOrientation', this.getNodeParameter('multiNormalizeOrientation', itemIndex));
1152
+ if (has('crop')) {
1153
+ setNumber('cropX', this.getNodeParameter('multiCropX', itemIndex));
1154
+ setNumber('cropY', this.getNodeParameter('multiCropY', itemIndex));
1155
+ setNumber('cropWidth', this.getNodeParameter('multiCropWidth', itemIndex));
1156
+ setNumber('cropHeight', this.getNodeParameter('multiCropHeight', itemIndex));
1157
+ }
1158
+ if (has('backgroundColor'))
1159
+ setString('backgroundColor', this.getNodeParameter('multiBackgroundColor', itemIndex));
1160
+ if (has('rotate'))
1161
+ setNumber('rotate', this.getNodeParameter('multiRotate', itemIndex));
1162
+ if (has('flipH'))
1163
+ setBool('flipH', this.getNodeParameter('multiFlipH', itemIndex));
1164
+ if (has('flipV'))
1165
+ setBool('flipV', this.getNodeParameter('multiFlipV', itemIndex));
1166
+ if (has('colorSpace'))
1167
+ formData.colorSpace = this.getNodeParameter('multiColorSpace', itemIndex);
1168
+ if (has('targetSizeKB'))
1169
+ setNumber('targetSizeKB', this.getNodeParameter('multiTargetSizeKB', itemIndex));
1170
+ if (has('quality'))
1171
+ setNumber('quality', this.getNodeParameter('multiQuality', itemIndex));
1172
+ if (has('keepMetadata'))
1173
+ setBool('keepMetadata', this.getNodeParameter('multiKeepMetadata', itemIndex));
1174
+ if (has('blur'))
1175
+ setNumber('blur', this.getNodeParameter('multiBlur', itemIndex));
1176
+ if (has('sharpen'))
1177
+ setNumber('sharpen', this.getNodeParameter('multiSharpen', itemIndex));
1178
+ if (has('grayscale'))
1179
+ setBool('grayscale', this.getNodeParameter('multiGrayscale', itemIndex));
1180
+ if (has('sepia'))
1181
+ setBool('sepia', this.getNodeParameter('multiSepia', itemIndex));
1182
+ if (has('brightness'))
1183
+ setNumber('brightness', this.getNodeParameter('multiBrightness', itemIndex));
1184
+ if (has('contrast'))
1185
+ setNumber('contrast', this.getNodeParameter('multiContrast', itemIndex));
1186
+ if (has('saturation'))
1187
+ setNumber('saturation', this.getNodeParameter('multiSaturation', itemIndex));
1188
+ if (has('pad'))
1189
+ setNumber('pad', this.getNodeParameter('multiPad', itemIndex));
1190
+ if (has('padSides')) {
1191
+ setBool('padSides', this.getNodeParameter('multiPadSides', itemIndex));
1192
+ setNumber('padTop', this.getNodeParameter('multiPadTop', itemIndex));
1193
+ setNumber('padRight', this.getNodeParameter('multiPadRight', itemIndex));
1194
+ setNumber('padBottom', this.getNodeParameter('multiPadBottom', itemIndex));
1195
+ setNumber('padLeft', this.getNodeParameter('multiPadLeft', itemIndex));
1196
+ }
1197
+ if (has('padColor'))
1198
+ setString('padColor', this.getNodeParameter('multiPadColor', itemIndex));
1199
+ if (has('border'))
1200
+ setNumber('border', this.getNodeParameter('multiBorder', itemIndex));
1201
+ if (has('borderColor'))
1202
+ setString('borderColor', this.getNodeParameter('multiBorderColor', itemIndex));
1203
+ if (has('borderRadius'))
1204
+ setNumber('borderRadius', this.getNodeParameter('multiBorderRadius', itemIndex));
1205
+ if (has('backgroundBlur'))
1206
+ setNumber('backgroundBlur', this.getNodeParameter('multiBackgroundBlur', itemIndex));
1207
+ if (has('watermark')) {
1208
+ setString('watermarkText', this.getNodeParameter('multiWatermarkText', itemIndex));
1209
+ setNumber('watermarkFontSize', this.getNodeParameter('multiWatermarkFontSize', itemIndex));
1210
+ setString('watermarkColor', this.getNodeParameter('multiWatermarkColor', itemIndex));
1211
+ setNumber('watermarkOpacity', this.getNodeParameter('multiWatermarkOpacity', itemIndex));
1212
+ formData.watermarkPosition = this.getNodeParameter('multiWatermarkPosition', itemIndex);
1213
+ setNumber('watermarkMargin', this.getNodeParameter('multiWatermarkMargin', itemIndex));
1214
+ setNumber('watermarkScale', this.getNodeParameter('multiWatermarkScale', itemIndex));
1215
+ await includeWatermarkFile(this.getNodeParameter('multiWatermarkImageBinaryProp', itemIndex));
1216
+ }
1217
+ if (has('pdf')) {
1218
+ formData.pdfMode = this.getNodeParameter('multiPdfMode', itemIndex);
1219
+ formData.pdfPageSize = this.getNodeParameter('multiPdfPageSize', itemIndex);
1220
+ formData.pdfOrientation = this.getNodeParameter('multiPdfOrientation', itemIndex);
1221
+ setNumber('pdfMargin', this.getNodeParameter('multiPdfMargin', itemIndex));
1222
+ formData.pdfEmbedFormat = this.getNodeParameter('multiPdfEmbedFormat', itemIndex);
1223
+ setNumber('pdfJpegQuality', this.getNodeParameter('multiPdfJpegQuality', itemIndex));
1224
+ }
1225
+ if (has('includeRawExif'))
1226
+ setBool('includeRawExif', this.getNodeParameter('multiIncludeRawExif', itemIndex));
1227
+ break;
1228
+ }
517
1229
  }
518
1230
  const response = await GenericFunctions_1.davixRequest.call(this, {
519
1231
  method: 'POST',
@@ -521,29 +1233,16 @@ class DavixH2I {
521
1233
  formData,
522
1234
  json: true,
523
1235
  });
524
- // optional download
525
- const downloadBinary = this.getNodeParameter('imageDownloadBinary', itemIndex);
1236
+ const downloadBinary = ['metadata'].includes(action) ? false : this.getNodeParameter('imageDownloadBinary', itemIndex);
526
1237
  if (downloadBinary) {
1238
+ const firstUrl = gatherFirstUrl(response);
1239
+ if (!firstUrl)
1240
+ throw new Error('No URL returned to download.');
527
1241
  const binName = this.getNodeParameter('imageOutputBinaryProperty', itemIndex);
528
- const urls = [];
529
- if (typeof response.url === 'string')
530
- urls.push(String(response.url));
531
- if (Array.isArray(response.results)) {
532
- for (const r of response.results) {
533
- if (r?.url)
534
- urls.push(String(r.url));
535
- }
536
- }
537
- if (urls.length) {
538
- const firstUrl = urls[0];
539
- const ext = format === 'jpeg' ? 'jpg' : format;
540
- const dl = await GenericFunctions_1.downloadToBinary.call(this, firstUrl, `pixlab-image.${ext}`);
541
- const binary = await this.helpers.prepareBinaryData(dl.data, dl.fileName, dl.mimeType);
542
- out.push({ json: response, binary: { [binName]: binary } });
543
- }
544
- else {
545
- out.push({ json: response });
546
- }
1242
+ const ext = format === 'jpeg' ? 'jpg' : format;
1243
+ const dl = await GenericFunctions_1.downloadToBinary.call(this, firstUrl, `pixlab-image.${ext}`);
1244
+ const binary = await this.helpers.prepareBinaryData(dl.data, dl.fileName, dl.mimeType);
1245
+ out.push({ json: response, binary: { [binName]: binary } });
547
1246
  }
548
1247
  else {
549
1248
  out.push({ json: response });
@@ -554,30 +1253,81 @@ class DavixH2I {
554
1253
  if (resource === 'pdf') {
555
1254
  const action = operation;
556
1255
  const pdfBinaryProps = this.getNodeParameter('pdfBinaryProps', itemIndex);
557
- const formData = {};
1256
+ const formData = { action };
558
1257
  await attachFiles('files', pdfBinaryProps, formData);
559
- formData.action = action;
1258
+ const setNumber = (name, value) => {
1259
+ if (value !== undefined && value !== null && value !== 0)
1260
+ formData[name] = String(value);
1261
+ };
1262
+ const setString = (name, value) => {
1263
+ if (value)
1264
+ formData[name] = value;
1265
+ };
1266
+ const setBool = (name, value) => {
1267
+ formData[name] = toBoolString(value);
1268
+ };
560
1269
  if (action === 'merge') {
561
- formData.sortByName = toBoolString(this.getNodeParameter('sortByName', itemIndex));
1270
+ setBool('sortByName', this.getNodeParameter('sortByName', itemIndex));
562
1271
  }
563
1272
  if (action === 'split') {
564
- formData.ranges = this.getNodeParameter('ranges', itemIndex);
565
- formData.prefix = this.getNodeParameter('prefix', itemIndex);
1273
+ setString('ranges', this.getNodeParameter('ranges', itemIndex));
1274
+ setString('prefix', this.getNodeParameter('prefix', itemIndex));
566
1275
  }
567
1276
  if (action === 'to-images') {
568
- formData.pages = this.getNodeParameter('pages', itemIndex);
569
- formData.toFormat = this.getNodeParameter('toFormat', itemIndex);
570
- const w = this.getNodeParameter('pdfWidth', itemIndex);
571
- const h = this.getNodeParameter('pdfHeight', itemIndex);
572
- if (w)
573
- formData.width = String(w);
574
- if (h)
575
- formData.height = String(h);
576
- formData.dpi = String(this.getNodeParameter('dpi', itemIndex));
1277
+ setString('pages', this.getNodeParameter('pages', itemIndex));
1278
+ setString('toFormat', this.getNodeParameter('toFormat', itemIndex));
1279
+ setNumber('width', this.getNodeParameter('pdfWidth', itemIndex));
1280
+ setNumber('height', this.getNodeParameter('pdfHeight', itemIndex));
1281
+ setNumber('dpi', this.getNodeParameter('dpi', itemIndex));
577
1282
  }
578
1283
  if (action === 'extract-images') {
579
- formData.pages = this.getNodeParameter('pages', itemIndex);
580
- formData.imageFormat = this.getNodeParameter('extractImageFormat', itemIndex);
1284
+ setString('pages', this.getNodeParameter('pages', itemIndex));
1285
+ setString('imageFormat', this.getNodeParameter('extractImageFormat', itemIndex));
1286
+ }
1287
+ if (action === 'watermark') {
1288
+ setString('pages', this.getNodeParameter('pages', itemIndex));
1289
+ setString('watermarkText', this.getNodeParameter('watermarkText', itemIndex));
1290
+ setNumber('watermarkOpacity', this.getNodeParameter('watermarkOpacity', itemIndex));
1291
+ setString('watermarkPosition', this.getNodeParameter('watermarkPosition', itemIndex));
1292
+ setNumber('watermarkMargin', this.getNodeParameter('watermarkMargin', itemIndex));
1293
+ setNumber('watermarkFontSize', this.getNodeParameter('watermarkFontSize', itemIndex));
1294
+ setString('watermarkColor', this.getNodeParameter('watermarkColor', itemIndex));
1295
+ setNumber('watermarkScale', this.getNodeParameter('watermarkScale', itemIndex));
1296
+ await attachSingleFile('watermarkImage', this.getNodeParameter('watermarkImageBinaryProp', itemIndex), formData);
1297
+ }
1298
+ if (action === 'rotate') {
1299
+ setNumber('degrees', this.getNodeParameter('degrees', itemIndex));
1300
+ setString('pages', this.getNodeParameter('pages', itemIndex));
1301
+ }
1302
+ if (action === 'metadata') {
1303
+ setString('title', this.getNodeParameter('title', itemIndex));
1304
+ setString('author', this.getNodeParameter('author', itemIndex));
1305
+ setString('subject', this.getNodeParameter('subject', itemIndex));
1306
+ setString('keywords', this.getNodeParameter('keywords', itemIndex));
1307
+ setString('creator', this.getNodeParameter('creator', itemIndex));
1308
+ setString('producer', this.getNodeParameter('producer', itemIndex));
1309
+ setBool('cleanAllMetadata', this.getNodeParameter('cleanAllMetadata', itemIndex));
1310
+ }
1311
+ if (action === 'reorder') {
1312
+ setString('order', this.getNodeParameter('order', itemIndex));
1313
+ }
1314
+ if (action === 'delete-pages') {
1315
+ setString('pages', this.getNodeParameter('pages', itemIndex));
1316
+ }
1317
+ if (action === 'extract') {
1318
+ setString('pages', this.getNodeParameter('pages', itemIndex));
1319
+ setString('mode', this.getNodeParameter('mode', itemIndex));
1320
+ setString('prefix', this.getNodeParameter('prefix', itemIndex));
1321
+ }
1322
+ if (action === 'flatten') {
1323
+ setBool('flattenForms', this.getNodeParameter('flattenForms', itemIndex));
1324
+ }
1325
+ if (action === 'encrypt') {
1326
+ setString('userPassword', this.getNodeParameter('userPassword', itemIndex));
1327
+ setString('ownerPassword', this.getNodeParameter('ownerPassword', itemIndex));
1328
+ }
1329
+ if (action === 'decrypt') {
1330
+ setString('password', this.getNodeParameter('password', itemIndex));
581
1331
  }
582
1332
  const response = await GenericFunctions_1.davixRequest.call(this, {
583
1333
  method: 'POST',
@@ -587,25 +1337,13 @@ class DavixH2I {
587
1337
  });
588
1338
  const downloadBinary = this.getNodeParameter('pdfDownloadBinary', itemIndex);
589
1339
  if (downloadBinary) {
1340
+ const firstUrl = gatherFirstUrl(response);
1341
+ if (!firstUrl)
1342
+ throw new Error('No URL returned to download.');
590
1343
  const binName = this.getNodeParameter('pdfOutputBinaryProperty', itemIndex);
591
- const urls = [];
592
- if (typeof response.url === 'string')
593
- urls.push(String(response.url));
594
- if (Array.isArray(response.results)) {
595
- for (const r of response.results) {
596
- if (r?.url)
597
- urls.push(String(r.url));
598
- }
599
- }
600
- if (urls.length) {
601
- const firstUrl = urls[0];
602
- const dl = await GenericFunctions_1.downloadToBinary.call(this, firstUrl, `pixlab-pdf-result.bin`);
603
- const binary = await this.helpers.prepareBinaryData(dl.data, dl.fileName, dl.mimeType);
604
- out.push({ json: response, binary: { [binName]: binary } });
605
- }
606
- else {
607
- out.push({ json: response });
608
- }
1344
+ const dl = await GenericFunctions_1.downloadToBinary.call(this, firstUrl, `pixlab-pdf-result.bin`);
1345
+ const binary = await this.helpers.prepareBinaryData(dl.data, dl.fileName, dl.mimeType);
1346
+ out.push({ json: response, binary: { [binName]: binary } });
609
1347
  }
610
1348
  else {
611
1349
  out.push({ json: response });
@@ -614,16 +1352,51 @@ class DavixH2I {
614
1352
  }
615
1353
  // ---- TOOLS (multipart)
616
1354
  if (resource === 'tools') {
617
- if (operation !== 'analyze')
618
- throw new Error(`Unsupported Tools operation: ${operation}`);
1355
+ const action = operation;
619
1356
  const toolsBinaryProps = this.getNodeParameter('toolsBinaryProps', itemIndex);
620
- const formData = {};
1357
+ const formData = { action };
621
1358
  await attachFiles('images', toolsBinaryProps, formData);
622
- const tools = this.getNodeParameter('tools', itemIndex);
623
- formData.tools = tools.join(',');
624
- formData.includeRawExif = toBoolString(this.getNodeParameter('includeRawExif', itemIndex));
625
- formData.paletteSize = String(this.getNodeParameter('paletteSize', itemIndex));
626
- formData.hashType = this.getNodeParameter('hashType', itemIndex);
1359
+ const setString = (name, value) => {
1360
+ if (value)
1361
+ formData[name] = value;
1362
+ };
1363
+ const setNumber = (name, value) => {
1364
+ if (value !== undefined && value !== null && value !== 0)
1365
+ formData[name] = String(value);
1366
+ };
1367
+ const setBool = (name, value) => {
1368
+ formData[name] = toBoolString(value);
1369
+ };
1370
+ if (action === 'single') {
1371
+ const tool = this.getNodeParameter('tool', itemIndex);
1372
+ if (!tool)
1373
+ throw new Error('Select one tool for single action.');
1374
+ formData.tools = tool;
1375
+ }
1376
+ else {
1377
+ const tools = this.getNodeParameter('tools', itemIndex);
1378
+ formData.tools = tools.join(',');
1379
+ }
1380
+ const options = action === 'multitask' ? this.getNodeParameter('toolsMultitaskOptions', itemIndex) : [];
1381
+ const has = (key) => options.includes(key);
1382
+ if (action === 'single' || has('includeRawExif'))
1383
+ setBool('includeRawExif', this.getNodeParameter('includeRawExif', itemIndex));
1384
+ if (action === 'single' || has('paletteSize'))
1385
+ setNumber('paletteSize', this.getNodeParameter('paletteSize', itemIndex));
1386
+ if (action === 'single' || has('hashType'))
1387
+ setString('hashType', this.getNodeParameter('hashType', itemIndex));
1388
+ if (has('qualitySample'))
1389
+ setNumber('qualitySample', this.getNodeParameter('qualitySample', itemIndex));
1390
+ if (has('transparencySample'))
1391
+ setNumber('transparencySample', this.getNodeParameter('transparencySample', itemIndex));
1392
+ if (has('similarityMode'))
1393
+ setString('similarityMode', this.getNodeParameter('similarityMode', itemIndex));
1394
+ if (has('similarityThreshold'))
1395
+ setNumber('similarityThreshold', this.getNodeParameter('similarityThreshold', itemIndex));
1396
+ if (has('efficiencyFormat'))
1397
+ setString('efficiencyFormat', this.getNodeParameter('efficiencyFormat', itemIndex));
1398
+ if (has('efficiencyQuality'))
1399
+ setNumber('efficiencyQuality', this.getNodeParameter('efficiencyQuality', itemIndex));
627
1400
  const response = await GenericFunctions_1.davixRequest.call(this, {
628
1401
  method: 'POST',
629
1402
  url: '/v1/tools',