@trg-admin/n8n-nodes-zoho-desk 0.1.21 → 0.1.22
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.
|
@@ -762,52 +762,86 @@ class ZohoDesk {
|
|
|
762
762
|
const returnAll = this.getNodeParameter('returnAll', i, false);
|
|
763
763
|
const options = this.getNodeParameter('options', i, {});
|
|
764
764
|
const qs = {};
|
|
765
|
+
const cleanCommaSeparated = (value) => {
|
|
766
|
+
if (typeof value !== 'string') {
|
|
767
|
+
return '';
|
|
768
|
+
}
|
|
769
|
+
return value
|
|
770
|
+
.split(',')
|
|
771
|
+
.map((s) => s.trim())
|
|
772
|
+
.filter(Boolean)
|
|
773
|
+
.join(',');
|
|
774
|
+
};
|
|
765
775
|
// Department filtering: options.departmentIds, options.departmentId, or legacy parameter
|
|
766
776
|
const topLevelDepartmentId = this.getNodeParameter('departmentId', i, '');
|
|
767
777
|
if (options.departmentIds) {
|
|
768
|
-
|
|
778
|
+
const cleaned = cleanCommaSeparated(options.departmentIds);
|
|
779
|
+
if (cleaned)
|
|
780
|
+
qs.departmentIds = cleaned;
|
|
769
781
|
}
|
|
770
782
|
else if (options.departmentId) {
|
|
771
|
-
|
|
783
|
+
const cleaned = String(options.departmentId).trim();
|
|
784
|
+
if (cleaned)
|
|
785
|
+
qs.departmentId = cleaned;
|
|
772
786
|
}
|
|
773
787
|
else if (topLevelDepartmentId) {
|
|
774
|
-
|
|
788
|
+
const cleaned = String(topLevelDepartmentId).trim();
|
|
789
|
+
if (cleaned)
|
|
790
|
+
qs.departmentId = cleaned;
|
|
775
791
|
}
|
|
776
792
|
if (options.viewId) {
|
|
777
|
-
|
|
793
|
+
const cleaned = String(options.viewId).trim();
|
|
794
|
+
if (cleaned)
|
|
795
|
+
qs.viewId = cleaned;
|
|
778
796
|
}
|
|
779
797
|
if (options.assignee) {
|
|
780
|
-
|
|
798
|
+
const cleaned = cleanCommaSeparated(options.assignee);
|
|
799
|
+
if (cleaned)
|
|
800
|
+
qs.assignee = cleaned;
|
|
781
801
|
}
|
|
782
802
|
if (options.teamIds) {
|
|
783
|
-
|
|
803
|
+
const cleaned = cleanCommaSeparated(options.teamIds);
|
|
804
|
+
if (cleaned)
|
|
805
|
+
qs.teamIds = cleaned;
|
|
784
806
|
}
|
|
785
807
|
if (options.channel) {
|
|
786
|
-
|
|
808
|
+
const cleaned = cleanCommaSeparated(options.channel);
|
|
809
|
+
if (cleaned)
|
|
810
|
+
qs.channel = cleaned;
|
|
787
811
|
}
|
|
788
812
|
if (options.status) {
|
|
789
|
-
|
|
813
|
+
const cleaned = cleanCommaSeparated(options.status);
|
|
814
|
+
if (cleaned)
|
|
815
|
+
qs.status = cleaned;
|
|
790
816
|
}
|
|
791
817
|
if (options.priority) {
|
|
792
|
-
|
|
818
|
+
const cleaned = cleanCommaSeparated(options.priority);
|
|
819
|
+
if (cleaned)
|
|
820
|
+
qs.priority = cleaned;
|
|
793
821
|
}
|
|
794
822
|
if (options.sortBy) {
|
|
795
|
-
|
|
823
|
+
const cleaned = String(options.sortBy).trim();
|
|
824
|
+
if (cleaned)
|
|
825
|
+
qs.sortBy = cleaned;
|
|
796
826
|
}
|
|
797
827
|
if (options.receivedInDays) {
|
|
798
828
|
qs.receivedInDays = options.receivedInDays;
|
|
799
829
|
}
|
|
800
830
|
if (options.fields) {
|
|
801
|
-
|
|
831
|
+
const cleaned = cleanCommaSeparated(options.fields);
|
|
832
|
+
if (cleaned)
|
|
833
|
+
qs.fields = cleaned;
|
|
802
834
|
}
|
|
803
835
|
if (options.include) {
|
|
804
836
|
if (Array.isArray(options.include)) {
|
|
805
837
|
if (options.include.length > 0) {
|
|
806
|
-
qs.include = options.include.join(',');
|
|
838
|
+
qs.include = options.include.map((s) => String(s).trim()).filter(Boolean).join(',');
|
|
807
839
|
}
|
|
808
840
|
}
|
|
809
|
-
else if (typeof options.include === 'string'
|
|
810
|
-
|
|
841
|
+
else if (typeof options.include === 'string') {
|
|
842
|
+
const cleaned = cleanCommaSeparated(options.include);
|
|
843
|
+
if (cleaned)
|
|
844
|
+
qs.include = cleaned;
|
|
811
845
|
}
|
|
812
846
|
}
|
|
813
847
|
if (returnAll) {
|