n8n-nodes-h2i 1.0.2 → 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.
- package/dist/nodes/DavixH2I/DavixH2I.node.js +115 -59
- package/package.json +1 -1
|
@@ -246,7 +246,7 @@ class DavixH2I {
|
|
|
246
246
|
{ name: 'SVG', value: 'svg' },
|
|
247
247
|
{ name: 'PDF', value: 'pdf' },
|
|
248
248
|
],
|
|
249
|
-
displayOptions: { show: { resource: ['image'] } },
|
|
249
|
+
displayOptions: { show: { resource: ['image'] }, hide: { operation: ['multitask'] } },
|
|
250
250
|
},
|
|
251
251
|
{ displayName: 'Width', name: 'imageWidth', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['resize', 'format'] } } },
|
|
252
252
|
{ displayName: 'Height', name: 'imageHeight', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['resize', 'format'] } } },
|
|
@@ -263,7 +263,18 @@ class DavixH2I {
|
|
|
263
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
264
|
{ displayName: 'Target Size (KB)', name: 'targetSizeKB', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['compress'] } } },
|
|
265
265
|
{ displayName: 'Quality', name: 'quality', type: 'number', default: 82, displayOptions: { show: { resource: ['image'], operation: ['compress'] } } },
|
|
266
|
-
{
|
|
266
|
+
{
|
|
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
|
+
},
|
|
277
|
+
},
|
|
267
278
|
{ displayName: 'Blur', name: 'blur', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['enhance'] } } },
|
|
268
279
|
{ displayName: 'Sharpen', name: 'sharpen', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['enhance'] } } },
|
|
269
280
|
{ displayName: 'Grayscale', name: 'grayscale', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['enhance'] } } },
|
|
@@ -410,6 +421,22 @@ class DavixH2I {
|
|
|
410
421
|
displayOptions: { show: { resource: ['image'], operation: ['multitask'] } },
|
|
411
422
|
},
|
|
412
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
|
+
},
|
|
413
440
|
{ displayName: 'Width', name: 'multiWidth', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['width'] } } },
|
|
414
441
|
{ displayName: 'Height', name: 'multiHeight', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['height'] } } },
|
|
415
442
|
{ displayName: 'Enlarge', name: 'multiEnlarge', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['enlarge'] } } },
|
|
@@ -736,6 +763,12 @@ class DavixH2I {
|
|
|
736
763
|
{ name: 'Detect Format', value: 'detect-format' },
|
|
737
764
|
{ name: 'Orientation', value: 'orientation' },
|
|
738
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' },
|
|
739
772
|
],
|
|
740
773
|
displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
|
|
741
774
|
},
|
|
@@ -750,24 +783,12 @@ class DavixH2I {
|
|
|
750
783
|
{ name: 'Detect Format', value: 'detect-format' },
|
|
751
784
|
{ name: 'Orientation', value: 'orientation' },
|
|
752
785
|
{ name: 'Hash', value: 'hash' },
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
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' },
|
|
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' },
|
|
771
792
|
],
|
|
772
793
|
displayOptions: { show: { resource: ['tools'], operation: ['multitask'] } },
|
|
773
794
|
},
|
|
@@ -776,28 +797,28 @@ class DavixH2I {
|
|
|
776
797
|
name: 'includeRawExif',
|
|
777
798
|
type: 'boolean',
|
|
778
799
|
default: false,
|
|
779
|
-
displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
|
|
800
|
+
displayOptions: { show: { resource: ['tools'], operation: ['single'], tool: ['metadata'] } },
|
|
780
801
|
},
|
|
781
802
|
{
|
|
782
803
|
displayName: 'Include Raw EXIF',
|
|
783
804
|
name: 'multiIncludeRawExif',
|
|
784
805
|
type: 'boolean',
|
|
785
806
|
default: false,
|
|
786
|
-
displayOptions: { show: { resource: ['tools'], operation: ['multitask'],
|
|
807
|
+
displayOptions: { show: { resource: ['tools'], operation: ['multitask'], tools: ['metadata'] } },
|
|
787
808
|
},
|
|
788
809
|
{
|
|
789
810
|
displayName: 'Palette Size',
|
|
790
811
|
name: 'paletteSize',
|
|
791
812
|
type: 'number',
|
|
792
813
|
default: 5,
|
|
793
|
-
displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
|
|
814
|
+
displayOptions: { show: { resource: ['tools'], operation: ['single'], tool: ['palette'] } },
|
|
794
815
|
},
|
|
795
816
|
{
|
|
796
817
|
displayName: 'Palette Size',
|
|
797
818
|
name: 'multiPaletteSize',
|
|
798
819
|
type: 'number',
|
|
799
820
|
default: 5,
|
|
800
|
-
displayOptions: { show: { resource: ['tools'], operation: ['multitask'],
|
|
821
|
+
displayOptions: { show: { resource: ['tools'], operation: ['multitask'], tools: ['palette'] } },
|
|
801
822
|
},
|
|
802
823
|
{
|
|
803
824
|
displayName: 'Hash Type',
|
|
@@ -809,7 +830,7 @@ class DavixH2I {
|
|
|
809
830
|
{ name: 'MD5', value: 'md5' },
|
|
810
831
|
{ name: 'SHA1', value: 'sha1' },
|
|
811
832
|
],
|
|
812
|
-
displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
|
|
833
|
+
displayOptions: { show: { resource: ['tools'], operation: ['single'], tool: ['hash'] } },
|
|
813
834
|
},
|
|
814
835
|
{
|
|
815
836
|
displayName: 'Hash Type',
|
|
@@ -821,91 +842,91 @@ class DavixH2I {
|
|
|
821
842
|
{ name: 'MD5', value: 'md5' },
|
|
822
843
|
{ name: 'SHA1', value: 'sha1' },
|
|
823
844
|
],
|
|
824
|
-
displayOptions: { show: { resource: ['tools'], operation: ['multitask'],
|
|
845
|
+
displayOptions: { show: { resource: ['tools'], operation: ['multitask'], tools: ['hash'] } },
|
|
825
846
|
},
|
|
826
847
|
{
|
|
827
848
|
displayName: 'Quality Sample',
|
|
828
849
|
name: 'qualitySample',
|
|
829
850
|
type: 'number',
|
|
830
851
|
default: 0,
|
|
831
|
-
displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
|
|
852
|
+
displayOptions: { show: { resource: ['tools'], operation: ['single'], tool: ['quality'] } },
|
|
832
853
|
},
|
|
833
854
|
{
|
|
834
855
|
displayName: 'Quality Sample',
|
|
835
856
|
name: 'multiQualitySample',
|
|
836
857
|
type: 'number',
|
|
837
858
|
default: 0,
|
|
838
|
-
displayOptions: { show: { resource: ['tools'], operation: ['multitask'],
|
|
859
|
+
displayOptions: { show: { resource: ['tools'], operation: ['multitask'], tools: ['quality'] } },
|
|
839
860
|
},
|
|
840
861
|
{
|
|
841
862
|
displayName: 'Transparency Sample',
|
|
842
863
|
name: 'transparencySample',
|
|
843
864
|
type: 'number',
|
|
844
865
|
default: 0,
|
|
845
|
-
displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
|
|
866
|
+
displayOptions: { show: { resource: ['tools'], operation: ['single'], tool: ['transparency'] } },
|
|
846
867
|
},
|
|
847
868
|
{
|
|
848
869
|
displayName: 'Transparency Sample',
|
|
849
870
|
name: 'multiTransparencySample',
|
|
850
871
|
type: 'number',
|
|
851
872
|
default: 0,
|
|
852
|
-
displayOptions: { show: { resource: ['tools'], operation: ['multitask'],
|
|
873
|
+
displayOptions: { show: { resource: ['tools'], operation: ['multitask'], tools: ['transparency'] } },
|
|
853
874
|
},
|
|
854
875
|
{
|
|
855
876
|
displayName: 'Similarity Mode',
|
|
856
877
|
name: 'similarityMode',
|
|
857
878
|
type: 'string',
|
|
858
879
|
default: '',
|
|
859
|
-
displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
|
|
880
|
+
displayOptions: { show: { resource: ['tools'], operation: ['single'], tool: ['similarity'] } },
|
|
860
881
|
},
|
|
861
882
|
{
|
|
862
883
|
displayName: 'Similarity Mode',
|
|
863
884
|
name: 'multiSimilarityMode',
|
|
864
885
|
type: 'string',
|
|
865
886
|
default: '',
|
|
866
|
-
displayOptions: { show: { resource: ['tools'], operation: ['multitask'],
|
|
887
|
+
displayOptions: { show: { resource: ['tools'], operation: ['multitask'], tools: ['similarity'] } },
|
|
867
888
|
},
|
|
868
889
|
{
|
|
869
890
|
displayName: 'Similarity Threshold',
|
|
870
891
|
name: 'similarityThreshold',
|
|
871
892
|
type: 'number',
|
|
872
893
|
default: 0,
|
|
873
|
-
displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
|
|
894
|
+
displayOptions: { show: { resource: ['tools'], operation: ['single'], tool: ['similarity'] } },
|
|
874
895
|
},
|
|
875
896
|
{
|
|
876
897
|
displayName: 'Similarity Threshold',
|
|
877
898
|
name: 'multiSimilarityThreshold',
|
|
878
899
|
type: 'number',
|
|
879
900
|
default: 0,
|
|
880
|
-
displayOptions: { show: { resource: ['tools'], operation: ['multitask'],
|
|
901
|
+
displayOptions: { show: { resource: ['tools'], operation: ['multitask'], tools: ['similarity'] } },
|
|
881
902
|
},
|
|
882
903
|
{
|
|
883
904
|
displayName: 'Efficiency Format',
|
|
884
905
|
name: 'efficiencyFormat',
|
|
885
906
|
type: 'string',
|
|
886
907
|
default: '',
|
|
887
|
-
displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
|
|
908
|
+
displayOptions: { show: { resource: ['tools'], operation: ['single'], tool: ['efficiency'] } },
|
|
888
909
|
},
|
|
889
910
|
{
|
|
890
911
|
displayName: 'Efficiency Format',
|
|
891
912
|
name: 'multiEfficiencyFormat',
|
|
892
913
|
type: 'string',
|
|
893
914
|
default: '',
|
|
894
|
-
displayOptions: { show: { resource: ['tools'], operation: ['multitask'],
|
|
915
|
+
displayOptions: { show: { resource: ['tools'], operation: ['multitask'], tools: ['efficiency'] } },
|
|
895
916
|
},
|
|
896
917
|
{
|
|
897
918
|
displayName: 'Efficiency Quality',
|
|
898
919
|
name: 'efficiencyQuality',
|
|
899
920
|
type: 'number',
|
|
900
921
|
default: 0,
|
|
901
|
-
displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
|
|
922
|
+
displayOptions: { show: { resource: ['tools'], operation: ['single'], tool: ['efficiency'] } },
|
|
902
923
|
},
|
|
903
924
|
{
|
|
904
925
|
displayName: 'Efficiency Quality',
|
|
905
926
|
name: 'multiEfficiencyQuality',
|
|
906
927
|
type: 'number',
|
|
907
928
|
default: 0,
|
|
908
|
-
displayOptions: { show: { resource: ['tools'], operation: ['multitask'],
|
|
929
|
+
displayOptions: { show: { resource: ['tools'], operation: ['multitask'], tools: ['efficiency'] } },
|
|
909
930
|
},
|
|
910
931
|
],
|
|
911
932
|
};
|
|
@@ -1138,9 +1159,10 @@ class DavixH2I {
|
|
|
1138
1159
|
setBool('includeRawExif', this.getNodeParameter('includeRawExif', itemIndex));
|
|
1139
1160
|
break;
|
|
1140
1161
|
case 'multitask': {
|
|
1141
|
-
formData.format = format;
|
|
1142
1162
|
const options = this.getNodeParameter('imageMultitaskOptions', itemIndex);
|
|
1143
1163
|
const has = (key) => options.includes(key);
|
|
1164
|
+
if (has('format'))
|
|
1165
|
+
setString('format', this.getNodeParameter('multiFormat', itemIndex));
|
|
1144
1166
|
if (has('width'))
|
|
1145
1167
|
setNumber('width', this.getNodeParameter('multiWidth', itemIndex));
|
|
1146
1168
|
if (has('height'))
|
|
@@ -1367,36 +1389,70 @@ class DavixH2I {
|
|
|
1367
1389
|
const setBool = (name, value) => {
|
|
1368
1390
|
formData[name] = toBoolString(value);
|
|
1369
1391
|
};
|
|
1392
|
+
let selectedTools = [];
|
|
1370
1393
|
if (action === 'single') {
|
|
1371
1394
|
const tool = this.getNodeParameter('tool', itemIndex);
|
|
1372
1395
|
if (!tool)
|
|
1373
1396
|
throw new Error('Select one tool for single action.');
|
|
1397
|
+
selectedTools = [tool];
|
|
1374
1398
|
formData.tools = tool;
|
|
1375
1399
|
}
|
|
1376
1400
|
else {
|
|
1377
1401
|
const tools = this.getNodeParameter('tools', itemIndex);
|
|
1402
|
+
selectedTools = tools;
|
|
1378
1403
|
formData.tools = tools.join(',');
|
|
1379
1404
|
}
|
|
1380
|
-
const
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
setNumber('
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
setString('
|
|
1398
|
-
|
|
1399
|
-
|
|
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
|
+
}
|
|
1400
1456
|
const response = await GenericFunctions_1.davixRequest.call(this, {
|
|
1401
1457
|
method: 'POST',
|
|
1402
1458
|
url: '/v1/tools',
|