n8n-nodes-idb2b 1.1.3 → 1.1.4
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/IDB2B/IDB2B.node.js +161 -4
- package/package.json +1 -1
|
@@ -382,6 +382,12 @@ class IDB2B {
|
|
|
382
382
|
},
|
|
383
383
|
},
|
|
384
384
|
options: [
|
|
385
|
+
{
|
|
386
|
+
name: 'Get All',
|
|
387
|
+
value: 'getAll',
|
|
388
|
+
action: 'Get all activities for a lead',
|
|
389
|
+
description: 'Retrieve all activities for a specific lead',
|
|
390
|
+
},
|
|
385
391
|
{
|
|
386
392
|
name: 'Create',
|
|
387
393
|
value: 'create',
|
|
@@ -389,7 +395,7 @@ class IDB2B {
|
|
|
389
395
|
description: 'Create a new activity for a lead',
|
|
390
396
|
},
|
|
391
397
|
],
|
|
392
|
-
default: '
|
|
398
|
+
default: 'getAll',
|
|
393
399
|
},
|
|
394
400
|
{
|
|
395
401
|
displayName: 'Operation',
|
|
@@ -801,10 +807,10 @@ class IDB2B {
|
|
|
801
807
|
displayOptions: {
|
|
802
808
|
show: {
|
|
803
809
|
resource: ['leadActivities'],
|
|
804
|
-
operation: ['create'],
|
|
810
|
+
operation: ['create', 'getAll'],
|
|
805
811
|
},
|
|
806
812
|
},
|
|
807
|
-
description: 'ID of the lead to add activity to',
|
|
813
|
+
description: 'ID of the lead to get activities for or add activity to',
|
|
808
814
|
},
|
|
809
815
|
{
|
|
810
816
|
displayName: 'Subject',
|
|
@@ -916,6 +922,124 @@ class IDB2B {
|
|
|
916
922
|
},
|
|
917
923
|
],
|
|
918
924
|
},
|
|
925
|
+
{
|
|
926
|
+
displayName: 'Limit',
|
|
927
|
+
name: 'limit',
|
|
928
|
+
type: 'number',
|
|
929
|
+
default: 50,
|
|
930
|
+
description: 'Maximum number of activities to return',
|
|
931
|
+
displayOptions: {
|
|
932
|
+
show: {
|
|
933
|
+
resource: ['leadActivities'],
|
|
934
|
+
operation: ['getAll'],
|
|
935
|
+
},
|
|
936
|
+
},
|
|
937
|
+
},
|
|
938
|
+
{
|
|
939
|
+
displayName: 'Page',
|
|
940
|
+
name: 'page',
|
|
941
|
+
type: 'number',
|
|
942
|
+
default: 1,
|
|
943
|
+
description: 'Page number to retrieve',
|
|
944
|
+
displayOptions: {
|
|
945
|
+
show: {
|
|
946
|
+
resource: ['leadActivities'],
|
|
947
|
+
operation: ['getAll'],
|
|
948
|
+
},
|
|
949
|
+
},
|
|
950
|
+
},
|
|
951
|
+
{
|
|
952
|
+
displayName: 'Fields to Return',
|
|
953
|
+
name: 'fields',
|
|
954
|
+
type: 'multiOptions',
|
|
955
|
+
default: [],
|
|
956
|
+
description: 'Select specific fields to return (leave empty for all fields)',
|
|
957
|
+
displayOptions: {
|
|
958
|
+
show: {
|
|
959
|
+
resource: ['leadActivities'],
|
|
960
|
+
operation: ['getAll'],
|
|
961
|
+
},
|
|
962
|
+
},
|
|
963
|
+
options: [
|
|
964
|
+
{
|
|
965
|
+
name: 'ID',
|
|
966
|
+
value: 'id',
|
|
967
|
+
},
|
|
968
|
+
{
|
|
969
|
+
name: 'Lead ID',
|
|
970
|
+
value: 'lead_id',
|
|
971
|
+
},
|
|
972
|
+
{
|
|
973
|
+
name: 'Icon',
|
|
974
|
+
value: 'icon',
|
|
975
|
+
},
|
|
976
|
+
{
|
|
977
|
+
name: 'Subject',
|
|
978
|
+
value: 'subject',
|
|
979
|
+
},
|
|
980
|
+
{
|
|
981
|
+
name: 'Description',
|
|
982
|
+
value: 'description',
|
|
983
|
+
},
|
|
984
|
+
{
|
|
985
|
+
name: 'Date and Time',
|
|
986
|
+
value: 'datetime',
|
|
987
|
+
},
|
|
988
|
+
{
|
|
989
|
+
name: 'User ID',
|
|
990
|
+
value: 'user_id',
|
|
991
|
+
},
|
|
992
|
+
{
|
|
993
|
+
name: 'Attachments',
|
|
994
|
+
value: 'attachments',
|
|
995
|
+
},
|
|
996
|
+
{
|
|
997
|
+
name: 'Created At',
|
|
998
|
+
value: 'created_at',
|
|
999
|
+
},
|
|
1000
|
+
{
|
|
1001
|
+
name: 'Updated At',
|
|
1002
|
+
value: 'updated_at',
|
|
1003
|
+
},
|
|
1004
|
+
],
|
|
1005
|
+
},
|
|
1006
|
+
{
|
|
1007
|
+
displayName: 'Query Parameters',
|
|
1008
|
+
name: 'queryParameters',
|
|
1009
|
+
type: 'fixedCollection',
|
|
1010
|
+
typeOptions: {
|
|
1011
|
+
multipleValues: true,
|
|
1012
|
+
},
|
|
1013
|
+
default: {},
|
|
1014
|
+
placeholder: 'Add Parameter',
|
|
1015
|
+
description: 'Additional query parameters',
|
|
1016
|
+
displayOptions: {
|
|
1017
|
+
show: {
|
|
1018
|
+
resource: ['leadActivities'],
|
|
1019
|
+
operation: ['getAll'],
|
|
1020
|
+
},
|
|
1021
|
+
},
|
|
1022
|
+
options: [
|
|
1023
|
+
{
|
|
1024
|
+
name: 'parameter',
|
|
1025
|
+
displayName: 'Parameter',
|
|
1026
|
+
values: [
|
|
1027
|
+
{
|
|
1028
|
+
displayName: 'Name',
|
|
1029
|
+
name: 'name',
|
|
1030
|
+
type: 'string',
|
|
1031
|
+
default: '',
|
|
1032
|
+
},
|
|
1033
|
+
{
|
|
1034
|
+
displayName: 'Value',
|
|
1035
|
+
name: 'value',
|
|
1036
|
+
type: 'string',
|
|
1037
|
+
default: '',
|
|
1038
|
+
},
|
|
1039
|
+
],
|
|
1040
|
+
},
|
|
1041
|
+
],
|
|
1042
|
+
},
|
|
919
1043
|
{
|
|
920
1044
|
displayName: 'Endpoint',
|
|
921
1045
|
name: 'endpoint',
|
|
@@ -1239,7 +1363,25 @@ class IDB2B {
|
|
|
1239
1363
|
}
|
|
1240
1364
|
}
|
|
1241
1365
|
else if (resource === 'leadActivities') {
|
|
1242
|
-
if (operation === '
|
|
1366
|
+
if (operation === 'getAll') {
|
|
1367
|
+
method = 'GET';
|
|
1368
|
+
const leadId = this.getNodeParameter('lead_id', i);
|
|
1369
|
+
// Validate required fields
|
|
1370
|
+
if (!leadId || typeof leadId !== 'string' || leadId.trim().length === 0) {
|
|
1371
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Lead ID is required and must be a non-empty string', { itemIndex: i });
|
|
1372
|
+
}
|
|
1373
|
+
endpoint = `/leads/${leadId.trim()}/activities`;
|
|
1374
|
+
// Add pagination parameters
|
|
1375
|
+
const limit = this.getNodeParameter('limit', i, 50);
|
|
1376
|
+
const page = this.getNodeParameter('page', i, 1);
|
|
1377
|
+
qs.limit = limit;
|
|
1378
|
+
qs.page = page;
|
|
1379
|
+
// Add additional query parameters
|
|
1380
|
+
const queryParameters = this.getNodeParameter('queryParameters', i, {});
|
|
1381
|
+
const additionalQs = buildQueryString(queryParameters);
|
|
1382
|
+
qs = Object.assign(Object.assign({}, qs), additionalQs);
|
|
1383
|
+
}
|
|
1384
|
+
else if (operation === 'create') {
|
|
1243
1385
|
method = 'POST';
|
|
1244
1386
|
const leadId = this.getNodeParameter('lead_id', i);
|
|
1245
1387
|
const subject = this.getNodeParameter('subject', i);
|
|
@@ -1356,6 +1498,21 @@ class IDB2B {
|
|
|
1356
1498
|
}) });
|
|
1357
1499
|
}
|
|
1358
1500
|
}
|
|
1501
|
+
// Apply field filtering for leadActivities getAll operation
|
|
1502
|
+
if (resource === 'leadActivities' && operation === 'getAll') {
|
|
1503
|
+
const fieldsToReturn = this.getNodeParameter('fields', i, []);
|
|
1504
|
+
if (fieldsToReturn.length > 0 && Array.isArray(response.data)) {
|
|
1505
|
+
processedResponse = Object.assign(Object.assign({}, response), { data: response.data.map((activity) => {
|
|
1506
|
+
const filteredActivity = {};
|
|
1507
|
+
fieldsToReturn.forEach(field => {
|
|
1508
|
+
if (field in activity) {
|
|
1509
|
+
filteredActivity[field] = activity[field];
|
|
1510
|
+
}
|
|
1511
|
+
});
|
|
1512
|
+
return filteredActivity;
|
|
1513
|
+
}) });
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1359
1516
|
returnData.push({
|
|
1360
1517
|
json: processedResponse,
|
|
1361
1518
|
pairedItem: { item: i },
|