n8n-nodes-h2i 1.0.1 → 1.0.3

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,40 +246,80 @@ 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'] }, hide: { operation: ['multitask'] } },
173
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'] } } },
174
266
  {
175
- displayName: 'Width',
176
- name: 'imageWidth',
177
- type: 'number',
178
- default: 0,
179
- displayOptions: { show: { resource: ['image'], operation: ['transform'] } },
267
+ displayName: 'Keep Metadata',
268
+ name: 'keepMetadata',
269
+ type: 'boolean',
270
+ default: false,
271
+ displayOptions: {
272
+ show: {
273
+ resource: ['image'],
274
+ operation: ['format', 'resize', 'crop', 'transform', 'compress', 'enhance', 'padding', 'frame', 'background', 'watermark', 'pdf', 'metadata'],
275
+ },
276
+ },
180
277
  },
278
+ { displayName: 'Blur', name: 'blur', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['enhance'] } } },
279
+ { displayName: 'Sharpen', name: 'sharpen', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['enhance'] } } },
280
+ { displayName: 'Grayscale', name: 'grayscale', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['enhance'] } } },
281
+ { displayName: 'Sepia', name: 'sepia', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['enhance'] } } },
282
+ { displayName: 'Brightness', name: 'brightness', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['enhance'] } } },
283
+ { displayName: 'Contrast', name: 'contrast', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['enhance'] } } },
284
+ { displayName: 'Saturation', name: 'saturation', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['enhance'] } } },
285
+ { displayName: 'Pad', name: 'pad', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['padding', 'frame'] } } },
286
+ { displayName: 'Pad Top', name: 'padTop', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['padding'] } } },
287
+ { displayName: 'Pad Right', name: 'padRight', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['padding'] } } },
288
+ { displayName: 'Pad Bottom', name: 'padBottom', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['padding'] } } },
289
+ { displayName: 'Pad Left', name: 'padLeft', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['padding'] } } },
290
+ { displayName: 'Pad Color', name: 'padColor', type: 'string', default: '', displayOptions: { show: { resource: ['image'], operation: ['padding', 'frame', 'background'] } } },
291
+ { displayName: 'Border', name: 'border', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['frame'] } } },
292
+ { displayName: 'Border Color', name: 'borderColor', type: 'string', default: '', displayOptions: { show: { resource: ['image'], operation: ['frame'] } } },
293
+ { displayName: 'Border Radius', name: 'borderRadius', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['padding', 'background'] } } },
294
+ { displayName: 'Background Blur', name: 'backgroundBlur', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['background'] } } },
295
+ { displayName: 'Watermark Text', name: 'watermarkText', type: 'string', default: '', displayOptions: { show: { resource: ['image'], operation: ['watermark'] } } },
296
+ { displayName: 'Watermark Font Size', name: 'watermarkFontSize', type: 'number', default: 24, displayOptions: { show: { resource: ['image'], operation: ['watermark'] } } },
297
+ { displayName: 'Watermark Color', name: 'watermarkColor', type: 'string', default: '#000000', displayOptions: { show: { resource: ['image'], operation: ['watermark'] } } },
298
+ { displayName: 'Watermark Opacity', name: 'watermarkOpacity', type: 'number', default: 0.35, displayOptions: { show: { resource: ['image'], operation: ['watermark'] } } },
181
299
  {
182
- displayName: 'Height',
183
- name: 'imageHeight',
184
- type: 'number',
185
- default: 0,
186
- displayOptions: { show: { resource: ['image'], operation: ['transform'] } },
300
+ displayName: 'Watermark Position',
301
+ name: 'watermarkPosition',
302
+ type: 'options',
303
+ default: 'center',
304
+ options: [
305
+ { name: 'Center', value: 'center' },
306
+ { name: 'Top Left', value: 'top-left' },
307
+ { name: 'Top Right', value: 'top-right' },
308
+ { name: 'Bottom Left', value: 'bottom-left' },
309
+ { name: 'Bottom Right', value: 'bottom-right' },
310
+ ],
311
+ displayOptions: { show: { resource: ['image'], operation: ['watermark'] } },
187
312
  },
313
+ { displayName: 'Watermark Margin', name: 'watermarkMargin', type: 'number', default: 8, displayOptions: { show: { resource: ['image'], operation: ['watermark'] } } },
314
+ { displayName: 'Watermark Scale', name: 'watermarkScale', type: 'number', default: 1, displayOptions: { show: { resource: ['image'], operation: ['watermark'] } } },
188
315
  {
189
- displayName: 'Enlarge',
190
- name: 'enlarge',
191
- type: 'boolean',
192
- default: false,
193
- displayOptions: { show: { resource: ['image'], operation: ['transform'] } },
316
+ displayName: 'Watermark Image Binary Property',
317
+ name: 'watermarkImageBinaryProp',
318
+ type: 'string',
319
+ default: '',
320
+ placeholder: 'watermarkImage',
321
+ displayOptions: { show: { resource: ['image'], operation: ['watermark'] } },
194
322
  },
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
323
  {
207
324
  displayName: 'PDF Mode',
208
325
  name: 'pdfMode',
@@ -212,7 +329,7 @@ class DavixH2I {
212
329
  { name: 'Single', value: 'single' },
213
330
  { name: 'Multi', value: 'multi' },
214
331
  ],
215
- displayOptions: { show: { resource: ['image'], operation: ['transform'], imageFormat: ['pdf'] } },
332
+ displayOptions: { show: { resource: ['image'], operation: ['pdf'] } },
216
333
  },
217
334
  {
218
335
  displayName: 'PDF Page Size',
@@ -224,7 +341,7 @@ class DavixH2I {
224
341
  { name: 'A4', value: 'a4' },
225
342
  { name: 'Letter', value: 'letter' },
226
343
  ],
227
- displayOptions: { show: { resource: ['image'], operation: ['transform'], imageFormat: ['pdf'] } },
344
+ displayOptions: { show: { resource: ['image'], operation: ['pdf'] } },
228
345
  },
229
346
  {
230
347
  displayName: 'PDF Orientation',
@@ -235,14 +352,14 @@ class DavixH2I {
235
352
  { name: 'Portrait', value: 'portrait' },
236
353
  { name: 'Landscape', value: 'landscape' },
237
354
  ],
238
- displayOptions: { show: { resource: ['image'], operation: ['transform'], imageFormat: ['pdf'] } },
355
+ displayOptions: { show: { resource: ['image'], operation: ['pdf'] } },
239
356
  },
240
357
  {
241
358
  displayName: 'PDF Margin',
242
359
  name: 'pdfMargin',
243
360
  type: 'number',
244
361
  default: 0,
245
- displayOptions: { show: { resource: ['image'], operation: ['transform'], imageFormat: ['pdf'] } },
362
+ displayOptions: { show: { resource: ['image'], operation: ['pdf'] } },
246
363
  },
247
364
  {
248
365
  displayName: 'PDF Embed Format',
@@ -253,28 +370,249 @@ class DavixH2I {
253
370
  { name: 'PNG', value: 'png' },
254
371
  { name: 'JPEG', value: 'jpeg' },
255
372
  ],
256
- displayOptions: { show: { resource: ['image'], operation: ['transform'], imageFormat: ['pdf'] } },
373
+ displayOptions: { show: { resource: ['image'], operation: ['pdf'] } },
257
374
  },
258
375
  {
259
376
  displayName: 'PDF JPEG Quality',
260
377
  name: 'pdfJpegQuality',
261
378
  type: 'number',
262
379
  default: 85,
263
- displayOptions: { show: { resource: ['image'], operation: ['transform'], imageFormat: ['pdf'] } },
380
+ displayOptions: { show: { resource: ['image'], operation: ['pdf'] } },
381
+ },
382
+ { displayName: 'Include Raw EXIF', name: 'includeRawExif', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['metadata'] } } },
383
+ {
384
+ displayName: 'Multitask Options',
385
+ name: 'imageMultitaskOptions',
386
+ type: 'multiOptions',
387
+ default: [],
388
+ options: [
389
+ { name: 'Format', value: 'format' },
390
+ { name: 'Width', value: 'width' },
391
+ { name: 'Height', value: 'height' },
392
+ { name: 'Enlarge', value: 'enlarge' },
393
+ { name: 'Normalize Orientation', value: 'normalizeOrientation' },
394
+ { name: 'Crop', value: 'crop' },
395
+ { name: 'Background Color', value: 'backgroundColor' },
396
+ { name: 'Rotate', value: 'rotate' },
397
+ { name: 'Flip Horizontal', value: 'flipH' },
398
+ { name: 'Flip Vertical', value: 'flipV' },
399
+ { name: 'Color Space', value: 'colorSpace' },
400
+ { name: 'Target Size (KB)', value: 'targetSizeKB' },
401
+ { name: 'Quality', value: 'quality' },
402
+ { name: 'Keep Metadata', value: 'keepMetadata' },
403
+ { name: 'Blur', value: 'blur' },
404
+ { name: 'Sharpen', value: 'sharpen' },
405
+ { name: 'Grayscale', value: 'grayscale' },
406
+ { name: 'Sepia', value: 'sepia' },
407
+ { name: 'Brightness', value: 'brightness' },
408
+ { name: 'Contrast', value: 'contrast' },
409
+ { name: 'Saturation', value: 'saturation' },
410
+ { name: 'Pad', value: 'pad' },
411
+ { name: 'Pad Sides', value: 'padSides' },
412
+ { name: 'Pad Color', value: 'padColor' },
413
+ { name: 'Border', value: 'border' },
414
+ { name: 'Border Color', value: 'borderColor' },
415
+ { name: 'Border Radius', value: 'borderRadius' },
416
+ { name: 'Background Blur', value: 'backgroundBlur' },
417
+ { name: 'Watermark', value: 'watermark' },
418
+ { name: 'PDF Options', value: 'pdf' },
419
+ { name: 'Include Raw EXIF', value: 'includeRawExif' },
420
+ ],
421
+ displayOptions: { show: { resource: ['image'], operation: ['multitask'] } },
422
+ },
423
+ // Conditional image fields for multitask
424
+ {
425
+ displayName: 'Format',
426
+ name: 'multiFormat',
427
+ type: 'options',
428
+ default: 'webp',
429
+ options: [
430
+ { name: 'JPEG', value: 'jpeg' },
431
+ { name: 'PNG', value: 'png' },
432
+ { name: 'WebP', value: 'webp' },
433
+ { name: 'AVIF', value: 'avif' },
434
+ { name: 'GIF', value: 'gif' },
435
+ { name: 'SVG', value: 'svg' },
436
+ { name: 'PDF', value: 'pdf' },
437
+ ],
438
+ displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['format'] } },
439
+ },
440
+ { displayName: 'Width', name: 'multiWidth', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['width'] } } },
441
+ { displayName: 'Height', name: 'multiHeight', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['height'] } } },
442
+ { displayName: 'Enlarge', name: 'multiEnlarge', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['enlarge'] } } },
443
+ {
444
+ displayName: 'Normalize Orientation',
445
+ name: 'multiNormalizeOrientation',
446
+ type: 'boolean',
447
+ default: false,
448
+ displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['normalizeOrientation'] } },
449
+ },
450
+ { displayName: 'Crop X', name: 'multiCropX', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['crop'] } } },
451
+ { displayName: 'Crop Y', name: 'multiCropY', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['crop'] } } },
452
+ { displayName: 'Crop Width', name: 'multiCropWidth', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['crop'] } } },
453
+ { displayName: 'Crop Height', name: 'multiCropHeight', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['crop'] } } },
454
+ { displayName: 'Background Color', name: 'multiBackgroundColor', type: 'string', default: '', displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['backgroundColor'] } } },
455
+ { displayName: 'Rotate (degrees)', name: 'multiRotate', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['rotate'] } } },
456
+ { displayName: 'Flip Horizontal', name: 'multiFlipH', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['flipH'] } } },
457
+ { displayName: 'Flip Vertical', name: 'multiFlipV', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['flipV'] } } },
458
+ {
459
+ displayName: 'Color Space',
460
+ name: 'multiColorSpace',
461
+ type: 'options',
462
+ default: 'srgb',
463
+ options: [{ name: 'sRGB', value: 'srgb' }, { name: 'Display P3', value: 'display-p3' }],
464
+ displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['colorSpace'] } },
465
+ },
466
+ { displayName: 'Target Size (KB)', name: 'multiTargetSizeKB', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['targetSizeKB'] } } },
467
+ { displayName: 'Quality', name: 'multiQuality', type: 'number', default: 82, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['quality'] } } },
468
+ {
469
+ displayName: 'Keep Metadata',
470
+ name: 'multiKeepMetadata',
471
+ type: 'boolean',
472
+ default: false,
473
+ displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['keepMetadata'] } },
474
+ },
475
+ { displayName: 'Blur', name: 'multiBlur', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['blur'] } } },
476
+ { displayName: 'Sharpen', name: 'multiSharpen', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['sharpen'] } } },
477
+ { displayName: 'Grayscale', name: 'multiGrayscale', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['grayscale'] } } },
478
+ { displayName: 'Sepia', name: 'multiSepia', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['sepia'] } } },
479
+ { displayName: 'Brightness', name: 'multiBrightness', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['brightness'] } } },
480
+ { displayName: 'Contrast', name: 'multiContrast', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['contrast'] } } },
481
+ { displayName: 'Saturation', name: 'multiSaturation', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['saturation'] } } },
482
+ { displayName: 'Pad', name: 'multiPad', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['pad'] } } },
483
+ {
484
+ displayName: 'Pad Sides',
485
+ name: 'multiPadSides',
486
+ type: 'boolean',
487
+ default: false,
488
+ displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['padSides'] } },
489
+ },
490
+ { displayName: 'Pad Top', name: 'multiPadTop', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['padSides'] } } },
491
+ { displayName: 'Pad Right', name: 'multiPadRight', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['padSides'] } } },
492
+ { displayName: 'Pad Bottom', name: 'multiPadBottom', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['padSides'] } } },
493
+ { displayName: 'Pad Left', name: 'multiPadLeft', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['padSides'] } } },
494
+ { displayName: 'Pad Color', name: 'multiPadColor', type: 'string', default: '', displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['padColor'] } } },
495
+ { displayName: 'Border', name: 'multiBorder', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['border'] } } },
496
+ { displayName: 'Border Color', name: 'multiBorderColor', type: 'string', default: '', displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['borderColor'] } } },
497
+ { displayName: 'Border Radius', name: 'multiBorderRadius', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['borderRadius'] } } },
498
+ { displayName: 'Background Blur', name: 'multiBackgroundBlur', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['backgroundBlur'] } } },
499
+ { displayName: 'Watermark Text', name: 'multiWatermarkText', type: 'string', default: '', displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['watermark'] } } },
500
+ { displayName: 'Watermark Font Size', name: 'multiWatermarkFontSize', type: 'number', default: 24, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['watermark'] } } },
501
+ { displayName: 'Watermark Color', name: 'multiWatermarkColor', type: 'string', default: '#000000', displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['watermark'] } } },
502
+ { displayName: 'Watermark Opacity', name: 'multiWatermarkOpacity', type: 'number', default: 0.35, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['watermark'] } } },
503
+ {
504
+ displayName: 'Watermark Position',
505
+ name: 'multiWatermarkPosition',
506
+ type: 'options',
507
+ default: 'center',
508
+ options: [
509
+ { name: 'Center', value: 'center' },
510
+ { name: 'Top Left', value: 'top-left' },
511
+ { name: 'Top Right', value: 'top-right' },
512
+ { name: 'Bottom Left', value: 'bottom-left' },
513
+ { name: 'Bottom Right', value: 'bottom-right' },
514
+ ],
515
+ displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['watermark'] } },
516
+ },
517
+ { displayName: 'Watermark Margin', name: 'multiWatermarkMargin', type: 'number', default: 8, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['watermark'] } } },
518
+ { displayName: 'Watermark Scale', name: 'multiWatermarkScale', type: 'number', default: 1, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['watermark'] } } },
519
+ {
520
+ displayName: 'Watermark Image Binary Property',
521
+ name: 'multiWatermarkImageBinaryProp',
522
+ type: 'string',
523
+ default: '',
524
+ displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['watermark'] } },
525
+ },
526
+ {
527
+ displayName: 'PDF Mode',
528
+ name: 'multiPdfMode',
529
+ type: 'options',
530
+ default: 'single',
531
+ options: [
532
+ { name: 'Single', value: 'single' },
533
+ { name: 'Multi', value: 'multi' },
534
+ ],
535
+ displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['pdf'] } },
536
+ },
537
+ {
538
+ displayName: 'PDF Page Size',
539
+ name: 'multiPdfPageSize',
540
+ type: 'options',
541
+ default: 'auto',
542
+ options: [
543
+ { name: 'Auto', value: 'auto' },
544
+ { name: 'A4', value: 'a4' },
545
+ { name: 'Letter', value: 'letter' },
546
+ ],
547
+ displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['pdf'] } },
548
+ },
549
+ {
550
+ displayName: 'PDF Orientation',
551
+ name: 'multiPdfOrientation',
552
+ type: 'options',
553
+ default: 'portrait',
554
+ options: [
555
+ { name: 'Portrait', value: 'portrait' },
556
+ { name: 'Landscape', value: 'landscape' },
557
+ ],
558
+ displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['pdf'] } },
559
+ },
560
+ {
561
+ displayName: 'PDF Margin',
562
+ name: 'multiPdfMargin',
563
+ type: 'number',
564
+ default: 0,
565
+ displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['pdf'] } },
566
+ },
567
+ {
568
+ displayName: 'PDF Embed Format',
569
+ name: 'multiPdfEmbedFormat',
570
+ type: 'options',
571
+ default: 'png',
572
+ options: [
573
+ { name: 'PNG', value: 'png' },
574
+ { name: 'JPEG', value: 'jpeg' },
575
+ ],
576
+ displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['pdf'] } },
577
+ },
578
+ {
579
+ displayName: 'PDF JPEG Quality',
580
+ name: 'multiPdfJpegQuality',
581
+ type: 'number',
582
+ default: 85,
583
+ displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['pdf'] } },
584
+ },
585
+ {
586
+ displayName: 'Include Raw EXIF',
587
+ name: 'multiIncludeRawExif',
588
+ type: 'boolean',
589
+ default: false,
590
+ displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['includeRawExif'] } },
264
591
  },
265
592
  {
266
593
  displayName: 'Download Result(s) as Binary',
267
594
  name: 'imageDownloadBinary',
268
595
  type: 'boolean',
269
596
  default: false,
270
- displayOptions: { show: { resource: ['image'], operation: ['transform'] } },
597
+ displayOptions: {
598
+ show: {
599
+ resource: ['image'],
600
+ operation: ['format', 'resize', 'crop', 'transform', 'compress', 'enhance', 'padding', 'frame', 'background', 'watermark', 'pdf', 'multitask'],
601
+ },
602
+ },
271
603
  },
272
604
  {
273
605
  displayName: 'Output Binary Property',
274
606
  name: 'imageOutputBinaryProperty',
275
607
  type: 'string',
276
608
  default: 'data',
277
- displayOptions: { show: { resource: ['image'], operation: ['transform'], imageDownloadBinary: [true] } },
609
+ displayOptions: {
610
+ show: {
611
+ resource: ['image'],
612
+ operation: ['format', 'resize', 'crop', 'transform', 'compress', 'enhance', 'padding', 'frame', 'background', 'watermark', 'pdf', 'multitask'],
613
+ imageDownloadBinary: [true],
614
+ },
615
+ },
278
616
  },
279
617
  // -------------------------
280
618
  // PDF
@@ -308,7 +646,7 @@ class DavixH2I {
308
646
  name: 'prefix',
309
647
  type: 'string',
310
648
  default: 'split_',
311
- displayOptions: { show: { resource: ['pdf'], operation: ['split'] } },
649
+ displayOptions: { show: { resource: ['pdf'], operation: ['split', 'extract'] } },
312
650
  },
313
651
  {
314
652
  displayName: 'Pages',
@@ -316,7 +654,9 @@ class DavixH2I {
316
654
  type: 'string',
317
655
  default: 'all',
318
656
  placeholder: 'all OR 1-3,5,7',
319
- displayOptions: { show: { resource: ['pdf'], operation: ['to-images', 'extract-images'] } },
657
+ displayOptions: {
658
+ show: { resource: ['pdf'], operation: ['to-images', 'extract-images', 'watermark', 'rotate', 'delete-pages', 'extract'] },
659
+ },
320
660
  },
321
661
  {
322
662
  displayName: 'To Format',
@@ -345,6 +685,47 @@ class DavixH2I {
345
685
  ],
346
686
  displayOptions: { show: { resource: ['pdf'], operation: ['extract-images'] } },
347
687
  },
688
+ { displayName: 'Watermark Text', name: 'watermarkText', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['watermark'] } } },
689
+ { displayName: 'Watermark Opacity', name: 'watermarkOpacity', type: 'number', default: 0.35, displayOptions: { show: { resource: ['pdf'], operation: ['watermark'] } } },
690
+ {
691
+ displayName: 'Watermark Position',
692
+ name: 'watermarkPosition',
693
+ type: 'options',
694
+ default: 'center',
695
+ options: [
696
+ { name: 'Center', value: 'center' },
697
+ { name: 'Top Left', value: 'top-left' },
698
+ { name: 'Top Right', value: 'top-right' },
699
+ { name: 'Bottom Left', value: 'bottom-left' },
700
+ { name: 'Bottom Right', value: 'bottom-right' },
701
+ ],
702
+ displayOptions: { show: { resource: ['pdf'], operation: ['watermark'] } },
703
+ },
704
+ { displayName: 'Watermark Margin', name: 'watermarkMargin', type: 'number', default: 8, displayOptions: { show: { resource: ['pdf'], operation: ['watermark'] } } },
705
+ { displayName: 'Watermark Font Size', name: 'watermarkFontSize', type: 'number', default: 24, displayOptions: { show: { resource: ['pdf'], operation: ['watermark'] } } },
706
+ { displayName: 'Watermark Color', name: 'watermarkColor', type: 'string', default: '#000000', displayOptions: { show: { resource: ['pdf'], operation: ['watermark'] } } },
707
+ { displayName: 'Watermark Scale', name: 'watermarkScale', type: 'number', default: 1, displayOptions: { show: { resource: ['pdf'], operation: ['watermark'] } } },
708
+ {
709
+ displayName: 'Watermark Image Binary Property',
710
+ name: 'watermarkImageBinaryProp',
711
+ type: 'string',
712
+ default: '',
713
+ displayOptions: { show: { resource: ['pdf'], operation: ['watermark'] } },
714
+ },
715
+ { displayName: 'Degrees', name: 'degrees', type: 'number', default: 0, displayOptions: { show: { resource: ['pdf'], operation: ['rotate'] } } },
716
+ { displayName: 'Title', name: 'title', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['metadata'] } } },
717
+ { displayName: 'Author', name: 'author', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['metadata'] } } },
718
+ { displayName: 'Subject', name: 'subject', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['metadata'] } } },
719
+ { displayName: 'Keywords', name: 'keywords', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['metadata'] } } },
720
+ { displayName: 'Creator', name: 'creator', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['metadata'] } } },
721
+ { displayName: 'Producer', name: 'producer', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['metadata'] } } },
722
+ { displayName: 'Clean All Metadata', name: 'cleanAllMetadata', type: 'boolean', default: false, displayOptions: { show: { resource: ['pdf'], operation: ['metadata'] } } },
723
+ { displayName: 'Order (JSON array)', name: 'order', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['reorder'] } } },
724
+ { displayName: 'Mode', name: 'mode', type: 'string', default: 'range', displayOptions: { show: { resource: ['pdf'], operation: ['extract'] } } },
725
+ { displayName: 'Flatten Forms', name: 'flattenForms', type: 'boolean', default: false, displayOptions: { show: { resource: ['pdf'], operation: ['flatten'] } } },
726
+ { displayName: 'User Password', name: 'userPassword', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['encrypt'] } } },
727
+ { displayName: 'Owner Password', name: 'ownerPassword', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['encrypt'] } } },
728
+ { displayName: 'Password', name: 'password', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['decrypt'] } } },
348
729
  {
349
730
  displayName: 'Download Result(s) as Binary',
350
731
  name: 'pdfDownloadBinary',
@@ -369,7 +750,27 @@ class DavixH2I {
369
750
  default: 'data',
370
751
  placeholder: 'data OR img1,img2',
371
752
  description: 'Comma-separated binary property names (each will be sent as an `images` file).',
372
- displayOptions: { show: { resource: ['tools'], operation: ['analyze'] } },
753
+ displayOptions: { show: { resource: ['tools'] } },
754
+ },
755
+ {
756
+ displayName: 'Tool',
757
+ name: 'tool',
758
+ type: 'options',
759
+ default: 'metadata',
760
+ options: [
761
+ { name: 'Metadata', value: 'metadata' },
762
+ { name: 'Colors', value: 'colors' },
763
+ { name: 'Detect Format', value: 'detect-format' },
764
+ { name: 'Orientation', value: 'orientation' },
765
+ { name: 'Hash', value: 'hash' },
766
+ { name: 'Similarity', value: 'similarity' },
767
+ { name: 'Dimensions', value: 'dimensions' },
768
+ { name: 'Palette', value: 'palette' },
769
+ { name: 'Transparency', value: 'transparency' },
770
+ { name: 'Quality', value: 'quality' },
771
+ { name: 'Efficiency', value: 'efficiency' },
772
+ ],
773
+ displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
373
774
  },
374
775
  {
375
776
  displayName: 'Tools',
@@ -382,22 +783,42 @@ class DavixH2I {
382
783
  { name: 'Detect Format', value: 'detect-format' },
383
784
  { name: 'Orientation', value: 'orientation' },
384
785
  { name: 'Hash', value: 'hash' },
786
+ { name: 'Similarity', value: 'similarity' },
787
+ { name: 'Dimensions', value: 'dimensions' },
788
+ { name: 'Palette', value: 'palette' },
789
+ { name: 'Transparency', value: 'transparency' },
790
+ { name: 'Quality', value: 'quality' },
791
+ { name: 'Efficiency', value: 'efficiency' },
385
792
  ],
386
- displayOptions: { show: { resource: ['tools'], operation: ['analyze'] } },
793
+ displayOptions: { show: { resource: ['tools'], operation: ['multitask'] } },
387
794
  },
388
795
  {
389
796
  displayName: 'Include Raw EXIF',
390
797
  name: 'includeRawExif',
391
798
  type: 'boolean',
392
799
  default: false,
393
- displayOptions: { show: { resource: ['tools'], operation: ['analyze'] } },
800
+ displayOptions: { show: { resource: ['tools'], operation: ['single'], tool: ['metadata'] } },
801
+ },
802
+ {
803
+ displayName: 'Include Raw EXIF',
804
+ name: 'multiIncludeRawExif',
805
+ type: 'boolean',
806
+ default: false,
807
+ displayOptions: { show: { resource: ['tools'], operation: ['multitask'], tools: ['metadata'] } },
394
808
  },
395
809
  {
396
810
  displayName: 'Palette Size',
397
811
  name: 'paletteSize',
398
812
  type: 'number',
399
813
  default: 5,
400
- displayOptions: { show: { resource: ['tools'], operation: ['analyze'] } },
814
+ displayOptions: { show: { resource: ['tools'], operation: ['single'], tool: ['palette'] } },
815
+ },
816
+ {
817
+ displayName: 'Palette Size',
818
+ name: 'multiPaletteSize',
819
+ type: 'number',
820
+ default: 5,
821
+ displayOptions: { show: { resource: ['tools'], operation: ['multitask'], tools: ['palette'] } },
401
822
  },
402
823
  {
403
824
  displayName: 'Hash Type',
@@ -409,7 +830,103 @@ class DavixH2I {
409
830
  { name: 'MD5', value: 'md5' },
410
831
  { name: 'SHA1', value: 'sha1' },
411
832
  ],
412
- displayOptions: { show: { resource: ['tools'], operation: ['analyze'] } },
833
+ displayOptions: { show: { resource: ['tools'], operation: ['single'], tool: ['hash'] } },
834
+ },
835
+ {
836
+ displayName: 'Hash Type',
837
+ name: 'multiHashType',
838
+ type: 'options',
839
+ default: 'phash',
840
+ options: [
841
+ { name: 'pHash', value: 'phash' },
842
+ { name: 'MD5', value: 'md5' },
843
+ { name: 'SHA1', value: 'sha1' },
844
+ ],
845
+ displayOptions: { show: { resource: ['tools'], operation: ['multitask'], tools: ['hash'] } },
846
+ },
847
+ {
848
+ displayName: 'Quality Sample',
849
+ name: 'qualitySample',
850
+ type: 'number',
851
+ default: 0,
852
+ displayOptions: { show: { resource: ['tools'], operation: ['single'], tool: ['quality'] } },
853
+ },
854
+ {
855
+ displayName: 'Quality Sample',
856
+ name: 'multiQualitySample',
857
+ type: 'number',
858
+ default: 0,
859
+ displayOptions: { show: { resource: ['tools'], operation: ['multitask'], tools: ['quality'] } },
860
+ },
861
+ {
862
+ displayName: 'Transparency Sample',
863
+ name: 'transparencySample',
864
+ type: 'number',
865
+ default: 0,
866
+ displayOptions: { show: { resource: ['tools'], operation: ['single'], tool: ['transparency'] } },
867
+ },
868
+ {
869
+ displayName: 'Transparency Sample',
870
+ name: 'multiTransparencySample',
871
+ type: 'number',
872
+ default: 0,
873
+ displayOptions: { show: { resource: ['tools'], operation: ['multitask'], tools: ['transparency'] } },
874
+ },
875
+ {
876
+ displayName: 'Similarity Mode',
877
+ name: 'similarityMode',
878
+ type: 'string',
879
+ default: '',
880
+ displayOptions: { show: { resource: ['tools'], operation: ['single'], tool: ['similarity'] } },
881
+ },
882
+ {
883
+ displayName: 'Similarity Mode',
884
+ name: 'multiSimilarityMode',
885
+ type: 'string',
886
+ default: '',
887
+ displayOptions: { show: { resource: ['tools'], operation: ['multitask'], tools: ['similarity'] } },
888
+ },
889
+ {
890
+ displayName: 'Similarity Threshold',
891
+ name: 'similarityThreshold',
892
+ type: 'number',
893
+ default: 0,
894
+ displayOptions: { show: { resource: ['tools'], operation: ['single'], tool: ['similarity'] } },
895
+ },
896
+ {
897
+ displayName: 'Similarity Threshold',
898
+ name: 'multiSimilarityThreshold',
899
+ type: 'number',
900
+ default: 0,
901
+ displayOptions: { show: { resource: ['tools'], operation: ['multitask'], tools: ['similarity'] } },
902
+ },
903
+ {
904
+ displayName: 'Efficiency Format',
905
+ name: 'efficiencyFormat',
906
+ type: 'string',
907
+ default: '',
908
+ displayOptions: { show: { resource: ['tools'], operation: ['single'], tool: ['efficiency'] } },
909
+ },
910
+ {
911
+ displayName: 'Efficiency Format',
912
+ name: 'multiEfficiencyFormat',
913
+ type: 'string',
914
+ default: '',
915
+ displayOptions: { show: { resource: ['tools'], operation: ['multitask'], tools: ['efficiency'] } },
916
+ },
917
+ {
918
+ displayName: 'Efficiency Quality',
919
+ name: 'efficiencyQuality',
920
+ type: 'number',
921
+ default: 0,
922
+ displayOptions: { show: { resource: ['tools'], operation: ['single'], tool: ['efficiency'] } },
923
+ },
924
+ {
925
+ displayName: 'Efficiency Quality',
926
+ name: 'multiEfficiencyQuality',
927
+ type: 'number',
928
+ default: 0,
929
+ displayOptions: { show: { resource: ['tools'], operation: ['multitask'], tools: ['efficiency'] } },
413
930
  },
414
931
  ],
415
932
  };
@@ -419,17 +936,73 @@ class DavixH2I {
419
936
  for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
420
937
  const resource = this.getNodeParameter('resource', itemIndex);
421
938
  const operation = this.getNodeParameter('operation', itemIndex);
939
+ const gatherFirstUrl = (response) => {
940
+ if (typeof response?.url === 'string')
941
+ return String(response.url);
942
+ if (Array.isArray(response?.results)) {
943
+ for (const r of response.results) {
944
+ if (r?.url)
945
+ return String(r.url);
946
+ if (typeof r === 'string')
947
+ return r;
948
+ }
949
+ }
950
+ return undefined;
951
+ };
952
+ const attachFiles = async (fieldName, propList, formData) => {
953
+ const names = propList
954
+ .split(',')
955
+ .map((s) => s.trim())
956
+ .filter(Boolean);
957
+ if (names.length === 0)
958
+ throw new Error('No binary property names provided.');
959
+ for (const name of names) {
960
+ const buffer = await this.helpers.getBinaryDataBuffer(itemIndex, name);
961
+ const meta = items[itemIndex].binary?.[name];
962
+ const fileName = meta?.fileName ?? `${fieldName}-${name}`;
963
+ const mimeType = meta?.mimeType;
964
+ formData[fieldName] = formData[fieldName] || [];
965
+ formData[fieldName].push({
966
+ value: buffer,
967
+ options: {
968
+ filename: fileName,
969
+ contentType: mimeType,
970
+ },
971
+ });
972
+ }
973
+ };
974
+ const attachSingleFile = async (fieldName, propName, formData) => {
975
+ if (!propName)
976
+ return;
977
+ const buffer = await this.helpers.getBinaryDataBuffer(itemIndex, propName);
978
+ const meta = items[itemIndex].binary?.[propName];
979
+ const fileName = meta?.fileName ?? fieldName;
980
+ const mimeType = meta?.mimeType;
981
+ formData[fieldName] = {
982
+ value: buffer,
983
+ options: { filename: fileName, contentType: mimeType },
984
+ };
985
+ };
422
986
  // ---- H2I (JSON)
423
987
  if (resource === 'h2i') {
424
- if (operation !== 'render')
425
- throw new Error(`Unsupported H2I operation: ${operation}`);
988
+ const action = operation;
426
989
  const body = {
990
+ action,
427
991
  html: this.getNodeParameter('html', itemIndex),
428
992
  css: this.getNodeParameter('css', itemIndex),
429
993
  width: this.getNodeParameter('width', itemIndex),
430
994
  height: this.getNodeParameter('height', itemIndex),
431
- format: this.getNodeParameter('format', itemIndex),
432
995
  };
996
+ if (action === 'image') {
997
+ body.format = this.getNodeParameter('format', itemIndex);
998
+ }
999
+ else {
1000
+ body.pdfPageSize = this.getNodeParameter('h2iPdfPageSize', itemIndex);
1001
+ body.pdfOrientation = this.getNodeParameter('h2iPdfOrientation', itemIndex);
1002
+ body.pdfMargin = this.getNodeParameter('h2iPdfMargin', itemIndex);
1003
+ body.pdfEmbedFormat = this.getNodeParameter('h2iPdfEmbedFormat', itemIndex);
1004
+ body.pdfJpegQuality = this.getNodeParameter('h2iPdfJpegQuality', itemIndex);
1005
+ }
433
1006
  const response = await GenericFunctions_1.davixRequest.call(this, {
434
1007
  method: 'POST',
435
1008
  url: '/v1/h2i',
@@ -437,9 +1010,12 @@ class DavixH2I {
437
1010
  body,
438
1011
  });
439
1012
  const downloadBinary = this.getNodeParameter('downloadBinary', itemIndex);
440
- if (downloadBinary && typeof response.url === 'string') {
1013
+ if (downloadBinary) {
1014
+ const firstUrl = gatherFirstUrl(response);
1015
+ if (!firstUrl)
1016
+ throw new Error('No URL returned to download.');
441
1017
  const binName = this.getNodeParameter('outputBinaryProperty', itemIndex);
442
- const dl = await GenericFunctions_1.downloadToBinary.call(this, String(response.url), `h2i.${body.format === 'jpeg' ? 'jpg' : 'png'}`);
1018
+ const dl = await GenericFunctions_1.downloadToBinary.call(this, firstUrl, action === 'pdf' ? 'h2i.pdf' : `h2i.${body.format === 'jpeg' ? 'jpg' : body.format ?? 'png'}`);
443
1019
  const binary = await this.helpers.prepareBinaryData(dl.data, dl.fileName, dl.mimeType);
444
1020
  out.push({ json: response, binary: { [binName]: binary } });
445
1021
  }
@@ -448,72 +1024,230 @@ class DavixH2I {
448
1024
  }
449
1025
  continue;
450
1026
  }
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
1027
  // ---- IMAGE (multipart)
475
1028
  if (resource === 'image') {
476
- if (operation !== 'transform')
477
- throw new Error(`Unsupported Image operation: ${operation}`);
1029
+ const action = operation;
478
1030
  const imageBinaryProps = this.getNodeParameter('imageBinaryProps', itemIndex);
479
1031
  const format = this.getNodeParameter('imageFormat', itemIndex);
480
- const formData = {};
1032
+ const formData = { action };
481
1033
  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') {
1034
+ const setNumber = (name, value) => {
1035
+ if (value !== undefined && value !== null && value !== 0)
1036
+ formData[name] = String(value);
1037
+ };
1038
+ const setString = (name, value) => {
1039
+ if (value !== undefined && value !== null && value !== '')
1040
+ formData[name] = value;
1041
+ };
1042
+ const setBool = (name, value) => {
1043
+ formData[name] = toBoolString(value);
1044
+ };
1045
+ const includePdfFields = () => {
511
1046
  formData.pdfMode = this.getNodeParameter('pdfMode', itemIndex);
512
1047
  formData.pdfPageSize = this.getNodeParameter('pdfPageSize', itemIndex);
513
1048
  formData.pdfOrientation = this.getNodeParameter('pdfOrientation', itemIndex);
514
- formData.pdfMargin = String(this.getNodeParameter('pdfMargin', itemIndex));
1049
+ setNumber('pdfMargin', this.getNodeParameter('pdfMargin', itemIndex));
515
1050
  formData.pdfEmbedFormat = this.getNodeParameter('pdfEmbedFormat', itemIndex);
516
- formData.pdfJpegQuality = String(this.getNodeParameter('pdfJpegQuality', itemIndex));
1051
+ setNumber('pdfJpegQuality', this.getNodeParameter('pdfJpegQuality', itemIndex));
1052
+ };
1053
+ const includeWatermarkFile = async (propName) => {
1054
+ if (propName)
1055
+ await attachSingleFile('watermarkImage', propName, formData);
1056
+ };
1057
+ switch (action) {
1058
+ case 'format':
1059
+ formData.format = format;
1060
+ setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
1061
+ setNumber('width', this.getNodeParameter('imageWidth', itemIndex));
1062
+ setNumber('height', this.getNodeParameter('imageHeight', itemIndex));
1063
+ break;
1064
+ case 'resize':
1065
+ formData.format = format;
1066
+ setNumber('width', this.getNodeParameter('imageWidth', itemIndex));
1067
+ setNumber('height', this.getNodeParameter('imageHeight', itemIndex));
1068
+ setBool('enlarge', this.getNodeParameter('enlarge', itemIndex));
1069
+ setBool('normalizeOrientation', this.getNodeParameter('normalizeOrientation', itemIndex));
1070
+ setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
1071
+ break;
1072
+ case 'crop':
1073
+ formData.format = format;
1074
+ setNumber('cropX', this.getNodeParameter('cropX', itemIndex));
1075
+ setNumber('cropY', this.getNodeParameter('cropY', itemIndex));
1076
+ setNumber('cropWidth', this.getNodeParameter('cropWidth', itemIndex));
1077
+ setNumber('cropHeight', this.getNodeParameter('cropHeight', itemIndex));
1078
+ setBool('normalizeOrientation', this.getNodeParameter('normalizeOrientation', itemIndex));
1079
+ setString('backgroundColor', this.getNodeParameter('backgroundColor', itemIndex));
1080
+ setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
1081
+ break;
1082
+ case 'transform':
1083
+ formData.format = format;
1084
+ setNumber('rotate', this.getNodeParameter('rotate', itemIndex));
1085
+ setBool('flipH', this.getNodeParameter('flipH', itemIndex));
1086
+ setBool('flipV', this.getNodeParameter('flipV', itemIndex));
1087
+ formData.colorSpace = this.getNodeParameter('colorSpace', itemIndex);
1088
+ setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
1089
+ break;
1090
+ case 'compress':
1091
+ formData.format = format;
1092
+ setNumber('targetSizeKB', this.getNodeParameter('targetSizeKB', itemIndex));
1093
+ setNumber('quality', this.getNodeParameter('quality', itemIndex));
1094
+ formData.colorSpace = this.getNodeParameter('colorSpace', itemIndex);
1095
+ setString('backgroundColor', this.getNodeParameter('backgroundColor', itemIndex));
1096
+ setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
1097
+ break;
1098
+ case 'enhance':
1099
+ formData.format = format;
1100
+ setNumber('blur', this.getNodeParameter('blur', itemIndex));
1101
+ setNumber('sharpen', this.getNodeParameter('sharpen', itemIndex));
1102
+ setBool('grayscale', this.getNodeParameter('grayscale', itemIndex));
1103
+ setBool('sepia', this.getNodeParameter('sepia', itemIndex));
1104
+ setNumber('brightness', this.getNodeParameter('brightness', itemIndex));
1105
+ setNumber('contrast', this.getNodeParameter('contrast', itemIndex));
1106
+ setNumber('saturation', this.getNodeParameter('saturation', itemIndex));
1107
+ setBool('normalizeOrientation', this.getNodeParameter('normalizeOrientation', itemIndex));
1108
+ setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
1109
+ break;
1110
+ case 'padding':
1111
+ formData.format = format;
1112
+ setNumber('pad', this.getNodeParameter('pad', itemIndex));
1113
+ if (this.getNodeParameter('padTop', itemIndex) || this.getNodeParameter('padRight', itemIndex) || this.getNodeParameter('padBottom', itemIndex) || this.getNodeParameter('padLeft', itemIndex)) {
1114
+ setNumber('padTop', this.getNodeParameter('padTop', itemIndex));
1115
+ setNumber('padRight', this.getNodeParameter('padRight', itemIndex));
1116
+ setNumber('padBottom', this.getNodeParameter('padBottom', itemIndex));
1117
+ setNumber('padLeft', this.getNodeParameter('padLeft', itemIndex));
1118
+ }
1119
+ setString('padColor', this.getNodeParameter('padColor', itemIndex));
1120
+ setNumber('borderRadius', this.getNodeParameter('borderRadius', itemIndex));
1121
+ setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
1122
+ break;
1123
+ case 'frame':
1124
+ formData.format = format;
1125
+ setNumber('border', this.getNodeParameter('border', itemIndex));
1126
+ setString('borderColor', this.getNodeParameter('borderColor', itemIndex));
1127
+ setNumber('pad', this.getNodeParameter('pad', itemIndex));
1128
+ setString('padColor', this.getNodeParameter('padColor', itemIndex));
1129
+ setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
1130
+ break;
1131
+ case 'background':
1132
+ formData.format = format;
1133
+ setString('backgroundColor', this.getNodeParameter('backgroundColor', itemIndex));
1134
+ setNumber('backgroundBlur', this.getNodeParameter('backgroundBlur', itemIndex));
1135
+ setNumber('borderRadius', this.getNodeParameter('borderRadius', itemIndex));
1136
+ setString('padColor', this.getNodeParameter('padColor', itemIndex));
1137
+ setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
1138
+ break;
1139
+ case 'watermark':
1140
+ formData.format = format;
1141
+ setString('watermarkText', this.getNodeParameter('watermarkText', itemIndex));
1142
+ setNumber('watermarkFontSize', this.getNodeParameter('watermarkFontSize', itemIndex));
1143
+ setString('watermarkColor', this.getNodeParameter('watermarkColor', itemIndex));
1144
+ setNumber('watermarkOpacity', this.getNodeParameter('watermarkOpacity', itemIndex));
1145
+ formData.watermarkPosition = this.getNodeParameter('watermarkPosition', itemIndex);
1146
+ setNumber('watermarkMargin', this.getNodeParameter('watermarkMargin', itemIndex));
1147
+ setNumber('watermarkScale', this.getNodeParameter('watermarkScale', itemIndex));
1148
+ await includeWatermarkFile(this.getNodeParameter('watermarkImageBinaryProp', itemIndex));
1149
+ setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
1150
+ break;
1151
+ case 'pdf':
1152
+ formData.format = 'pdf';
1153
+ includePdfFields();
1154
+ setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
1155
+ break;
1156
+ case 'metadata':
1157
+ setBool('normalizeOrientation', this.getNodeParameter('normalizeOrientation', itemIndex));
1158
+ setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
1159
+ setBool('includeRawExif', this.getNodeParameter('includeRawExif', itemIndex));
1160
+ break;
1161
+ case 'multitask': {
1162
+ const options = this.getNodeParameter('imageMultitaskOptions', itemIndex);
1163
+ const has = (key) => options.includes(key);
1164
+ if (has('format'))
1165
+ setString('format', this.getNodeParameter('multiFormat', itemIndex));
1166
+ if (has('width'))
1167
+ setNumber('width', this.getNodeParameter('multiWidth', itemIndex));
1168
+ if (has('height'))
1169
+ setNumber('height', this.getNodeParameter('multiHeight', itemIndex));
1170
+ if (has('enlarge'))
1171
+ setBool('enlarge', this.getNodeParameter('multiEnlarge', itemIndex));
1172
+ if (has('normalizeOrientation'))
1173
+ setBool('normalizeOrientation', this.getNodeParameter('multiNormalizeOrientation', itemIndex));
1174
+ if (has('crop')) {
1175
+ setNumber('cropX', this.getNodeParameter('multiCropX', itemIndex));
1176
+ setNumber('cropY', this.getNodeParameter('multiCropY', itemIndex));
1177
+ setNumber('cropWidth', this.getNodeParameter('multiCropWidth', itemIndex));
1178
+ setNumber('cropHeight', this.getNodeParameter('multiCropHeight', itemIndex));
1179
+ }
1180
+ if (has('backgroundColor'))
1181
+ setString('backgroundColor', this.getNodeParameter('multiBackgroundColor', itemIndex));
1182
+ if (has('rotate'))
1183
+ setNumber('rotate', this.getNodeParameter('multiRotate', itemIndex));
1184
+ if (has('flipH'))
1185
+ setBool('flipH', this.getNodeParameter('multiFlipH', itemIndex));
1186
+ if (has('flipV'))
1187
+ setBool('flipV', this.getNodeParameter('multiFlipV', itemIndex));
1188
+ if (has('colorSpace'))
1189
+ formData.colorSpace = this.getNodeParameter('multiColorSpace', itemIndex);
1190
+ if (has('targetSizeKB'))
1191
+ setNumber('targetSizeKB', this.getNodeParameter('multiTargetSizeKB', itemIndex));
1192
+ if (has('quality'))
1193
+ setNumber('quality', this.getNodeParameter('multiQuality', itemIndex));
1194
+ if (has('keepMetadata'))
1195
+ setBool('keepMetadata', this.getNodeParameter('multiKeepMetadata', itemIndex));
1196
+ if (has('blur'))
1197
+ setNumber('blur', this.getNodeParameter('multiBlur', itemIndex));
1198
+ if (has('sharpen'))
1199
+ setNumber('sharpen', this.getNodeParameter('multiSharpen', itemIndex));
1200
+ if (has('grayscale'))
1201
+ setBool('grayscale', this.getNodeParameter('multiGrayscale', itemIndex));
1202
+ if (has('sepia'))
1203
+ setBool('sepia', this.getNodeParameter('multiSepia', itemIndex));
1204
+ if (has('brightness'))
1205
+ setNumber('brightness', this.getNodeParameter('multiBrightness', itemIndex));
1206
+ if (has('contrast'))
1207
+ setNumber('contrast', this.getNodeParameter('multiContrast', itemIndex));
1208
+ if (has('saturation'))
1209
+ setNumber('saturation', this.getNodeParameter('multiSaturation', itemIndex));
1210
+ if (has('pad'))
1211
+ setNumber('pad', this.getNodeParameter('multiPad', itemIndex));
1212
+ if (has('padSides')) {
1213
+ setBool('padSides', this.getNodeParameter('multiPadSides', itemIndex));
1214
+ setNumber('padTop', this.getNodeParameter('multiPadTop', itemIndex));
1215
+ setNumber('padRight', this.getNodeParameter('multiPadRight', itemIndex));
1216
+ setNumber('padBottom', this.getNodeParameter('multiPadBottom', itemIndex));
1217
+ setNumber('padLeft', this.getNodeParameter('multiPadLeft', itemIndex));
1218
+ }
1219
+ if (has('padColor'))
1220
+ setString('padColor', this.getNodeParameter('multiPadColor', itemIndex));
1221
+ if (has('border'))
1222
+ setNumber('border', this.getNodeParameter('multiBorder', itemIndex));
1223
+ if (has('borderColor'))
1224
+ setString('borderColor', this.getNodeParameter('multiBorderColor', itemIndex));
1225
+ if (has('borderRadius'))
1226
+ setNumber('borderRadius', this.getNodeParameter('multiBorderRadius', itemIndex));
1227
+ if (has('backgroundBlur'))
1228
+ setNumber('backgroundBlur', this.getNodeParameter('multiBackgroundBlur', itemIndex));
1229
+ if (has('watermark')) {
1230
+ setString('watermarkText', this.getNodeParameter('multiWatermarkText', itemIndex));
1231
+ setNumber('watermarkFontSize', this.getNodeParameter('multiWatermarkFontSize', itemIndex));
1232
+ setString('watermarkColor', this.getNodeParameter('multiWatermarkColor', itemIndex));
1233
+ setNumber('watermarkOpacity', this.getNodeParameter('multiWatermarkOpacity', itemIndex));
1234
+ formData.watermarkPosition = this.getNodeParameter('multiWatermarkPosition', itemIndex);
1235
+ setNumber('watermarkMargin', this.getNodeParameter('multiWatermarkMargin', itemIndex));
1236
+ setNumber('watermarkScale', this.getNodeParameter('multiWatermarkScale', itemIndex));
1237
+ await includeWatermarkFile(this.getNodeParameter('multiWatermarkImageBinaryProp', itemIndex));
1238
+ }
1239
+ if (has('pdf')) {
1240
+ formData.pdfMode = this.getNodeParameter('multiPdfMode', itemIndex);
1241
+ formData.pdfPageSize = this.getNodeParameter('multiPdfPageSize', itemIndex);
1242
+ formData.pdfOrientation = this.getNodeParameter('multiPdfOrientation', itemIndex);
1243
+ setNumber('pdfMargin', this.getNodeParameter('multiPdfMargin', itemIndex));
1244
+ formData.pdfEmbedFormat = this.getNodeParameter('multiPdfEmbedFormat', itemIndex);
1245
+ setNumber('pdfJpegQuality', this.getNodeParameter('multiPdfJpegQuality', itemIndex));
1246
+ }
1247
+ if (has('includeRawExif'))
1248
+ setBool('includeRawExif', this.getNodeParameter('multiIncludeRawExif', itemIndex));
1249
+ break;
1250
+ }
517
1251
  }
518
1252
  const response = await GenericFunctions_1.davixRequest.call(this, {
519
1253
  method: 'POST',
@@ -521,29 +1255,16 @@ class DavixH2I {
521
1255
  formData,
522
1256
  json: true,
523
1257
  });
524
- // optional download
525
- const downloadBinary = this.getNodeParameter('imageDownloadBinary', itemIndex);
1258
+ const downloadBinary = ['metadata'].includes(action) ? false : this.getNodeParameter('imageDownloadBinary', itemIndex);
526
1259
  if (downloadBinary) {
1260
+ const firstUrl = gatherFirstUrl(response);
1261
+ if (!firstUrl)
1262
+ throw new Error('No URL returned to download.');
527
1263
  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
- }
1264
+ const ext = format === 'jpeg' ? 'jpg' : format;
1265
+ const dl = await GenericFunctions_1.downloadToBinary.call(this, firstUrl, `pixlab-image.${ext}`);
1266
+ const binary = await this.helpers.prepareBinaryData(dl.data, dl.fileName, dl.mimeType);
1267
+ out.push({ json: response, binary: { [binName]: binary } });
547
1268
  }
548
1269
  else {
549
1270
  out.push({ json: response });
@@ -554,30 +1275,81 @@ class DavixH2I {
554
1275
  if (resource === 'pdf') {
555
1276
  const action = operation;
556
1277
  const pdfBinaryProps = this.getNodeParameter('pdfBinaryProps', itemIndex);
557
- const formData = {};
1278
+ const formData = { action };
558
1279
  await attachFiles('files', pdfBinaryProps, formData);
559
- formData.action = action;
1280
+ const setNumber = (name, value) => {
1281
+ if (value !== undefined && value !== null && value !== 0)
1282
+ formData[name] = String(value);
1283
+ };
1284
+ const setString = (name, value) => {
1285
+ if (value)
1286
+ formData[name] = value;
1287
+ };
1288
+ const setBool = (name, value) => {
1289
+ formData[name] = toBoolString(value);
1290
+ };
560
1291
  if (action === 'merge') {
561
- formData.sortByName = toBoolString(this.getNodeParameter('sortByName', itemIndex));
1292
+ setBool('sortByName', this.getNodeParameter('sortByName', itemIndex));
562
1293
  }
563
1294
  if (action === 'split') {
564
- formData.ranges = this.getNodeParameter('ranges', itemIndex);
565
- formData.prefix = this.getNodeParameter('prefix', itemIndex);
1295
+ setString('ranges', this.getNodeParameter('ranges', itemIndex));
1296
+ setString('prefix', this.getNodeParameter('prefix', itemIndex));
566
1297
  }
567
1298
  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));
1299
+ setString('pages', this.getNodeParameter('pages', itemIndex));
1300
+ setString('toFormat', this.getNodeParameter('toFormat', itemIndex));
1301
+ setNumber('width', this.getNodeParameter('pdfWidth', itemIndex));
1302
+ setNumber('height', this.getNodeParameter('pdfHeight', itemIndex));
1303
+ setNumber('dpi', this.getNodeParameter('dpi', itemIndex));
577
1304
  }
578
1305
  if (action === 'extract-images') {
579
- formData.pages = this.getNodeParameter('pages', itemIndex);
580
- formData.imageFormat = this.getNodeParameter('extractImageFormat', itemIndex);
1306
+ setString('pages', this.getNodeParameter('pages', itemIndex));
1307
+ setString('imageFormat', this.getNodeParameter('extractImageFormat', itemIndex));
1308
+ }
1309
+ if (action === 'watermark') {
1310
+ setString('pages', this.getNodeParameter('pages', itemIndex));
1311
+ setString('watermarkText', this.getNodeParameter('watermarkText', itemIndex));
1312
+ setNumber('watermarkOpacity', this.getNodeParameter('watermarkOpacity', itemIndex));
1313
+ setString('watermarkPosition', this.getNodeParameter('watermarkPosition', itemIndex));
1314
+ setNumber('watermarkMargin', this.getNodeParameter('watermarkMargin', itemIndex));
1315
+ setNumber('watermarkFontSize', this.getNodeParameter('watermarkFontSize', itemIndex));
1316
+ setString('watermarkColor', this.getNodeParameter('watermarkColor', itemIndex));
1317
+ setNumber('watermarkScale', this.getNodeParameter('watermarkScale', itemIndex));
1318
+ await attachSingleFile('watermarkImage', this.getNodeParameter('watermarkImageBinaryProp', itemIndex), formData);
1319
+ }
1320
+ if (action === 'rotate') {
1321
+ setNumber('degrees', this.getNodeParameter('degrees', itemIndex));
1322
+ setString('pages', this.getNodeParameter('pages', itemIndex));
1323
+ }
1324
+ if (action === 'metadata') {
1325
+ setString('title', this.getNodeParameter('title', itemIndex));
1326
+ setString('author', this.getNodeParameter('author', itemIndex));
1327
+ setString('subject', this.getNodeParameter('subject', itemIndex));
1328
+ setString('keywords', this.getNodeParameter('keywords', itemIndex));
1329
+ setString('creator', this.getNodeParameter('creator', itemIndex));
1330
+ setString('producer', this.getNodeParameter('producer', itemIndex));
1331
+ setBool('cleanAllMetadata', this.getNodeParameter('cleanAllMetadata', itemIndex));
1332
+ }
1333
+ if (action === 'reorder') {
1334
+ setString('order', this.getNodeParameter('order', itemIndex));
1335
+ }
1336
+ if (action === 'delete-pages') {
1337
+ setString('pages', this.getNodeParameter('pages', itemIndex));
1338
+ }
1339
+ if (action === 'extract') {
1340
+ setString('pages', this.getNodeParameter('pages', itemIndex));
1341
+ setString('mode', this.getNodeParameter('mode', itemIndex));
1342
+ setString('prefix', this.getNodeParameter('prefix', itemIndex));
1343
+ }
1344
+ if (action === 'flatten') {
1345
+ setBool('flattenForms', this.getNodeParameter('flattenForms', itemIndex));
1346
+ }
1347
+ if (action === 'encrypt') {
1348
+ setString('userPassword', this.getNodeParameter('userPassword', itemIndex));
1349
+ setString('ownerPassword', this.getNodeParameter('ownerPassword', itemIndex));
1350
+ }
1351
+ if (action === 'decrypt') {
1352
+ setString('password', this.getNodeParameter('password', itemIndex));
581
1353
  }
582
1354
  const response = await GenericFunctions_1.davixRequest.call(this, {
583
1355
  method: 'POST',
@@ -587,25 +1359,13 @@ class DavixH2I {
587
1359
  });
588
1360
  const downloadBinary = this.getNodeParameter('pdfDownloadBinary', itemIndex);
589
1361
  if (downloadBinary) {
1362
+ const firstUrl = gatherFirstUrl(response);
1363
+ if (!firstUrl)
1364
+ throw new Error('No URL returned to download.');
590
1365
  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
- }
1366
+ const dl = await GenericFunctions_1.downloadToBinary.call(this, firstUrl, `pixlab-pdf-result.bin`);
1367
+ const binary = await this.helpers.prepareBinaryData(dl.data, dl.fileName, dl.mimeType);
1368
+ out.push({ json: response, binary: { [binName]: binary } });
609
1369
  }
610
1370
  else {
611
1371
  out.push({ json: response });
@@ -614,16 +1374,85 @@ class DavixH2I {
614
1374
  }
615
1375
  // ---- TOOLS (multipart)
616
1376
  if (resource === 'tools') {
617
- if (operation !== 'analyze')
618
- throw new Error(`Unsupported Tools operation: ${operation}`);
1377
+ const action = operation;
619
1378
  const toolsBinaryProps = this.getNodeParameter('toolsBinaryProps', itemIndex);
620
- const formData = {};
1379
+ const formData = { action };
621
1380
  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);
1381
+ const setString = (name, value) => {
1382
+ if (value)
1383
+ formData[name] = value;
1384
+ };
1385
+ const setNumber = (name, value) => {
1386
+ if (value !== undefined && value !== null && value !== 0)
1387
+ formData[name] = String(value);
1388
+ };
1389
+ const setBool = (name, value) => {
1390
+ formData[name] = toBoolString(value);
1391
+ };
1392
+ let selectedTools = [];
1393
+ if (action === 'single') {
1394
+ const tool = this.getNodeParameter('tool', itemIndex);
1395
+ if (!tool)
1396
+ throw new Error('Select one tool for single action.');
1397
+ selectedTools = [tool];
1398
+ formData.tools = tool;
1399
+ }
1400
+ else {
1401
+ const tools = this.getNodeParameter('tools', itemIndex);
1402
+ selectedTools = tools;
1403
+ formData.tools = tools.join(',');
1404
+ }
1405
+ const hasTool = (toolName) => selectedTools.includes(toolName);
1406
+ if (hasTool('metadata')) {
1407
+ const val = action === 'single'
1408
+ ? this.getNodeParameter('includeRawExif', itemIndex)
1409
+ : this.getNodeParameter('multiIncludeRawExif', itemIndex);
1410
+ setBool('includeRawExif', val);
1411
+ }
1412
+ if (hasTool('palette')) {
1413
+ const val = action === 'single'
1414
+ ? this.getNodeParameter('paletteSize', itemIndex)
1415
+ : this.getNodeParameter('multiPaletteSize', itemIndex);
1416
+ setNumber('paletteSize', val);
1417
+ }
1418
+ if (hasTool('hash')) {
1419
+ const val = action === 'single'
1420
+ ? this.getNodeParameter('hashType', itemIndex)
1421
+ : this.getNodeParameter('multiHashType', itemIndex);
1422
+ setString('hashType', val);
1423
+ }
1424
+ if (hasTool('quality')) {
1425
+ const val = action === 'single'
1426
+ ? this.getNodeParameter('qualitySample', itemIndex)
1427
+ : this.getNodeParameter('multiQualitySample', itemIndex);
1428
+ setNumber('qualitySample', val);
1429
+ }
1430
+ if (hasTool('transparency')) {
1431
+ const val = action === 'single'
1432
+ ? this.getNodeParameter('transparencySample', itemIndex)
1433
+ : this.getNodeParameter('multiTransparencySample', itemIndex);
1434
+ setNumber('transparencySample', val);
1435
+ }
1436
+ if (hasTool('similarity')) {
1437
+ const mode = action === 'single'
1438
+ ? this.getNodeParameter('similarityMode', itemIndex)
1439
+ : this.getNodeParameter('multiSimilarityMode', itemIndex);
1440
+ const threshold = action === 'single'
1441
+ ? this.getNodeParameter('similarityThreshold', itemIndex)
1442
+ : this.getNodeParameter('multiSimilarityThreshold', itemIndex);
1443
+ setString('similarityMode', mode);
1444
+ setNumber('similarityThreshold', threshold);
1445
+ }
1446
+ if (hasTool('efficiency')) {
1447
+ const format = action === 'single'
1448
+ ? this.getNodeParameter('efficiencyFormat', itemIndex)
1449
+ : this.getNodeParameter('multiEfficiencyFormat', itemIndex);
1450
+ const quality = action === 'single'
1451
+ ? this.getNodeParameter('efficiencyQuality', itemIndex)
1452
+ : this.getNodeParameter('multiEfficiencyQuality', itemIndex);
1453
+ setString('efficiencyFormat', format);
1454
+ setNumber('efficiencyQuality', quality);
1455
+ }
627
1456
  const response = await GenericFunctions_1.davixRequest.call(this, {
628
1457
  method: 'POST',
629
1458
  url: '/v1/tools',