n8n-nodes-didar-crm 0.0.8 → 0.0.10

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.
Files changed (30) hide show
  1. package/dist/lib/loadOptions.d.ts +1 -0
  2. package/dist/lib/loadOptions.js +25 -0
  3. package/dist/nodes/DidarCrm.node.d.ts +1 -0
  4. package/dist/nodes/DidarCrm.node.js +63 -0
  5. package/dist/nodes/activity/create.operation.d.ts +2 -0
  6. package/dist/nodes/activity/create.operation.js +90 -0
  7. package/dist/nodes/activity/create.properties.d.ts +2 -0
  8. package/dist/nodes/activity/create.properties.js +162 -0
  9. package/dist/nodes/activity/index.d.ts +4 -0
  10. package/dist/nodes/activity/index.js +11 -0
  11. package/dist/nodes/activity/update.operation.d.ts +2 -0
  12. package/dist/nodes/activity/update.operation.js +93 -0
  13. package/dist/nodes/activity/update.properties.d.ts +2 -0
  14. package/dist/nodes/activity/update.properties.js +173 -0
  15. package/dist/nodes/company/create.operation.d.ts +2 -0
  16. package/dist/nodes/company/create.operation.js +121 -0
  17. package/dist/nodes/company/create.properties.d.ts +2 -0
  18. package/dist/nodes/company/create.properties.js +210 -0
  19. package/dist/nodes/company/get.operation.d.ts +2 -0
  20. package/dist/nodes/company/get.operation.js +15 -0
  21. package/dist/nodes/company/get.properties.d.ts +2 -0
  22. package/dist/nodes/company/get.properties.js +14 -0
  23. package/dist/nodes/company/index.d.ts +6 -0
  24. package/dist/nodes/company/index.js +15 -0
  25. package/dist/nodes/company/update.operation.d.ts +2 -0
  26. package/dist/nodes/company/update.operation.js +123 -0
  27. package/dist/nodes/company/update.properties.d.ts +2 -0
  28. package/dist/nodes/company/update.properties.js +180 -0
  29. package/package.json +1 -1
  30. package/dist/nodes/didar.svg +0 -12
@@ -2,3 +2,4 @@ import { ILoadOptionsFunctions, INodePropertyOptions } from 'n8n-workflow';
2
2
  export declare function getPipelines(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
3
3
  export declare function getStagesForPipeline(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
4
4
  export declare function getUsers(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
5
+ export declare function getActivityTypes(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getPipelines = getPipelines;
4
4
  exports.getStagesForPipeline = getStagesForPipeline;
5
5
  exports.getUsers = getUsers;
6
+ exports.getActivityTypes = getActivityTypes;
6
7
  async function getPipelines() {
7
8
  var _a;
8
9
  const creds = await this.getCredentials('didarApi');
@@ -74,3 +75,27 @@ async function getUsers() {
74
75
  value: u.UserId, // اگر OwnerId باید از UserId بیاد، این را به u.UserId تغییر بده
75
76
  }));
76
77
  }
78
+ async function getActivityTypes() {
79
+ var _a;
80
+ const creds = await this.getCredentials('didarApi');
81
+ const baseUrl = creds.baseUrl;
82
+ const apiKey = creds.apiKey;
83
+ const useCookie = creds.useCookie;
84
+ const cookie = creds.cookie;
85
+ const urlBase = (baseUrl || '').replace(/\/+$/, '');
86
+ const url = `${urlBase}/api/activity/GetActivityType?apikey=${encodeURIComponent(apiKey)}`;
87
+ const options = {
88
+ method: 'POST',
89
+ url,
90
+ json: true,
91
+ headers: { 'Content-Type': 'application/json' },
92
+ body: {},
93
+ };
94
+ if (useCookie && cookie)
95
+ options.headers.Cookie = cookie;
96
+ const resp = await this.helpers.httpRequest(options);
97
+ const list = ((_a = resp === null || resp === void 0 ? void 0 : resp.Response) !== null && _a !== void 0 ? _a : []);
98
+ return list
99
+ .filter((x) => (x === null || x === void 0 ? void 0 : x.Id) && (x === null || x === void 0 ? void 0 : x.Title))
100
+ .map((x) => ({ name: x.Title, value: x.Id }));
101
+ }
@@ -5,6 +5,7 @@ export declare class DidarCrm implements INodeType {
5
5
  getPipelines: (this: ILoadOptionsFunctions) => Promise<INodePropertyOptions[]>;
6
6
  getStagesForPipeline: (this: ILoadOptionsFunctions) => Promise<INodePropertyOptions[]>;
7
7
  getUsers: (this: ILoadOptionsFunctions) => Promise<INodePropertyOptions[]>;
8
+ getActivityTypes: (this: ILoadOptionsFunctions) => Promise<INodePropertyOptions[]>;
8
9
  };
9
10
  };
10
11
  description: INodeTypeDescription;
@@ -39,6 +39,10 @@ const Load = __importStar(require("../lib/loadOptions"));
39
39
  const deal_1 = require("./deal");
40
40
  const PersonOps = __importStar(require("./person"));
41
41
  const person_1 = require("./person");
42
+ const CompanyOps = __importStar(require("./company"));
43
+ const company_1 = require("./company");
44
+ const ActivityOps = __importStar(require("./activity"));
45
+ const activity_1 = require("./activity");
42
46
  class DidarCrm {
43
47
  constructor() {
44
48
  this.methods = {
@@ -46,6 +50,7 @@ class DidarCrm {
46
50
  getPipelines: Load.getPipelines,
47
51
  getStagesForPipeline: Load.getStagesForPipeline,
48
52
  getUsers: Load.getUsers,
53
+ getActivityTypes: Load.getActivityTypes,
49
54
  },
50
55
  };
51
56
  this.description = {
@@ -68,6 +73,8 @@ class DidarCrm {
68
73
  options: [
69
74
  { name: 'Deal', value: 'deal' },
70
75
  { name: 'Person', value: 'person' },
76
+ { name: 'Company', value: 'company' },
77
+ { name: 'Activity', value: 'activity' },
71
78
  ],
72
79
  default: 'deal',
73
80
  description: 'Choose the entity to act on.',
@@ -98,6 +105,31 @@ class DidarCrm {
98
105
  default: 'create',
99
106
  description: 'Select the action to perform on the selected resource.',
100
107
  },
108
+ {
109
+ displayName: 'Operation',
110
+ name: 'operation',
111
+ type: 'options',
112
+ displayOptions: { show: { resource: ['company'] } },
113
+ options: [
114
+ { name: 'Create', value: 'create', action: 'Create a company' },
115
+ { name: 'Update', value: 'update', action: 'Update a company by Id' }, // NEW
116
+ { name: 'Get', value: 'get', action: 'Get a company by Id' }, // NEW
117
+ ],
118
+ default: 'create',
119
+ description: 'Select the action to perform on the selected resource.',
120
+ },
121
+ {
122
+ displayName: 'Operation',
123
+ name: 'operation',
124
+ type: 'options',
125
+ displayOptions: { show: { resource: ['activity'] } },
126
+ options: [
127
+ { name: 'Create', value: 'create', action: 'Create an activity' },
128
+ { name: 'Update', value: 'update', action: 'Update an activity by Id' }, // NEW
129
+ ],
130
+ default: 'create',
131
+ description: 'Select the action to perform on the selected resource.',
132
+ },
101
133
  // Deal properties (imported)
102
134
  ...deal_1.dealCreateProperties,
103
135
  ...deal_1.dealUpdateProperties,
@@ -106,6 +138,13 @@ class DidarCrm {
106
138
  ...person_1.personCreateProperties,
107
139
  ...person_1.personUpdateProperties,
108
140
  ...person_1.personGetProperties,
141
+ // Company properties (imported)
142
+ ...company_1.companyCreateProperties,
143
+ ...company_1.companyUpdateProperties,
144
+ ...company_1.companyGetProperties,
145
+ // Activity properties (imported)
146
+ ...activity_1.activityCreateProperties,
147
+ ...activity_1.activityUpdateProperties,
109
148
  ],
110
149
  };
111
150
  }
@@ -143,6 +182,30 @@ class DidarCrm {
143
182
  continue;
144
183
  }
145
184
  }
185
+ if (resource === 'company') {
186
+ if (operation === 'create') {
187
+ await CompanyOps.companyCreate.call(this, i, returnData);
188
+ continue;
189
+ }
190
+ if (operation === 'update') {
191
+ await CompanyOps.companyUpdate.call(this, i, returnData);
192
+ continue;
193
+ } // NEW
194
+ if (operation === 'get') {
195
+ await CompanyOps.companyGet.call(this, i, returnData);
196
+ continue;
197
+ } // NEW
198
+ }
199
+ if (resource === 'activity') {
200
+ if (operation === 'create') {
201
+ await ActivityOps.activityCreate.call(this, i, returnData);
202
+ continue;
203
+ }
204
+ if (operation === 'update') {
205
+ await ActivityOps.activityUpdate.call(this, i, returnData);
206
+ continue;
207
+ } // NEW
208
+ }
146
209
  }
147
210
  return [returnData];
148
211
  }
@@ -0,0 +1,2 @@
1
+ import { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
2
+ export declare function activityCreate(this: IExecuteFunctions, i: number, returnData: INodeExecutionData[]): Promise<void>;
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.activityCreate = activityCreate;
4
+ const http_1 = require("../../lib/http");
5
+ async function activityCreate(i, returnData) {
6
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
7
+ // Required basics
8
+ const title = this.getNodeParameter('Title', i, '');
9
+ if (!title)
10
+ throw new Error('Title is required.');
11
+ // ActivityType: select/manual
12
+ const typeMode = this.getNodeParameter('ActivityTypeMode', i);
13
+ const activityTypeId = typeMode === 'select'
14
+ ? this.getNodeParameter('ActivityTypeIdSelect', i, '')
15
+ : this.getNodeParameter('ActivityTypeIdManual', i, '');
16
+ if (!activityTypeId)
17
+ throw new Error('ActivityTypeId is required (select from list or enter manually).');
18
+ const isDone = this.getNodeParameter('IsDone', i, false);
19
+ // Additional fields
20
+ const add = this.getNodeParameter('additionalFields', i, {}) || {};
21
+ // Owner
22
+ let ownerId = '';
23
+ if (add.OwnerMode === 'select')
24
+ ownerId = add.OwnerIdSelect || '';
25
+ else if (add.OwnerMode === 'manual')
26
+ ownerId = add.OwnerIdManual || '';
27
+ // OwnerId اختیاری است مگر شما الزامش کنید؛ اگر لازم شد همین‌جا ارور دهید.
28
+ const note = (_a = add.Note) !== null && _a !== void 0 ? _a : '';
29
+ const resultNote = (_b = add.ResultNote) !== null && _b !== void 0 ? _b : '';
30
+ const isDeleted = (_c = add.IsDeleted) !== null && _c !== void 0 ? _c : false;
31
+ const isPinned = (_d = add.IsPinned) !== null && _d !== void 0 ? _d : false;
32
+ const dueDate = (_e = add.DueDate) !== null && _e !== void 0 ? _e : '';
33
+ const duration = Number((_f = add.Duration) !== null && _f !== void 0 ? _f : 0);
34
+ const doneDate = (_g = add.DoneDate) !== null && _g !== void 0 ? _g : '';
35
+ const dealId = (_h = add.DealId) !== null && _h !== void 0 ? _h : '00000000-0000-0000-0000-000000000000';
36
+ const caseId = (_j = add.CaseId) !== null && _j !== void 0 ? _j : '00000000-0000-0000-0000-000000000000';
37
+ // ContactIds: string[]
38
+ let contactIds;
39
+ const cids = add.ContactIds;
40
+ if (Array.isArray(cids))
41
+ contactIds = cids.filter(Boolean);
42
+ else if (typeof cids === 'string' && cids)
43
+ contactIds = [cids];
44
+ const creatorId = (_k = add.CreatorId) !== null && _k !== void 0 ? _k : '00000000-0000-0000-0000-000000000000';
45
+ const recurrenceType = (_l = add.RecurrenceType) !== null && _l !== void 0 ? _l : '';
46
+ const recurrenceDataNum = Number((_m = add.RecurrenceData) !== null && _m !== void 0 ? _m : 0);
47
+ const recurrenceEndDate = (_o = add.RecurrenceEndDate) !== null && _o !== void 0 ? _o : '';
48
+ // Build body
49
+ const activity = {
50
+ ActivityTypeId: activityTypeId,
51
+ Title: title,
52
+ IsDone: isDone,
53
+ };
54
+ if (ownerId)
55
+ activity['OwnerId'] = ownerId;
56
+ if (note)
57
+ activity['Note'] = note;
58
+ if (resultNote)
59
+ activity['ResultNote'] = resultNote;
60
+ if (isDeleted)
61
+ activity['IsDeleted'] = true;
62
+ if (isPinned)
63
+ activity['IsPinned'] = true;
64
+ if (dueDate)
65
+ activity['DueDate'] = dueDate;
66
+ if (duration > 0)
67
+ activity['Duration'] = duration;
68
+ if (doneDate)
69
+ activity['DoneDate'] = doneDate;
70
+ if (dealId)
71
+ activity['DealId'] = dealId;
72
+ if (caseId)
73
+ activity['CaseId'] = caseId;
74
+ if (contactIds === null || contactIds === void 0 ? void 0 : contactIds.length)
75
+ activity['ContactIds'] = contactIds;
76
+ if (creatorId)
77
+ activity['CreatorId'] = creatorId;
78
+ if (recurrenceType)
79
+ activity['RecurrenceType'] = recurrenceType;
80
+ if (recurrenceDataNum > 0)
81
+ activity['RecurrenceData'] = recurrenceDataNum;
82
+ if (recurrenceEndDate)
83
+ activity['RecurrenceEndDate'] = recurrenceEndDate;
84
+ const resp = await (0, http_1.didarRequest)(this, i, {
85
+ method: 'POST',
86
+ path: '/api/activity/save',
87
+ body: { Activity: activity },
88
+ });
89
+ returnData.push({ json: resp });
90
+ }
@@ -0,0 +1,2 @@
1
+ import { INodeProperties } from 'n8n-workflow';
2
+ export declare const activityCreateProperties: INodeProperties[];
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.activityCreateProperties = void 0;
4
+ const showForActivityCreate = { show: { resource: ['activity'], operation: ['create'] } };
5
+ exports.activityCreateProperties = [
6
+ // ===== MAIN (به ترتیب خواسته‌شده) =====
7
+ {
8
+ displayName: 'Title',
9
+ name: 'Title',
10
+ type: 'string',
11
+ default: '',
12
+ required: true,
13
+ displayOptions: showForActivityCreate,
14
+ description: 'Activity title (required).',
15
+ },
16
+ // ActivityTypeId: Select / Manual
17
+ {
18
+ displayName: 'Activity Type Input Mode',
19
+ name: 'ActivityTypeMode',
20
+ type: 'options',
21
+ options: [
22
+ { name: 'Select from list', value: 'select' },
23
+ { name: 'Enter ID manually', value: 'manual' },
24
+ ],
25
+ default: 'select',
26
+ displayOptions: showForActivityCreate,
27
+ description: 'Choose how to set the activity type.',
28
+ },
29
+ {
30
+ displayName: 'Activity Type',
31
+ name: 'ActivityTypeIdSelect',
32
+ type: 'options',
33
+ typeOptions: { loadOptionsMethod: 'getActivityTypes' },
34
+ default: '',
35
+ displayOptions: { show: { ...showForActivityCreate.show, ActivityTypeMode: ['select'] } },
36
+ description: 'Select the activity type (required if select mode).',
37
+ },
38
+ {
39
+ displayName: 'Activity Type ID',
40
+ name: 'ActivityTypeIdManual',
41
+ type: 'string',
42
+ default: '',
43
+ displayOptions: { show: { ...showForActivityCreate.show, ActivityTypeMode: ['manual'] } },
44
+ description: 'Enter activity type ID manually (required if manual mode).',
45
+ },
46
+ // Owner (Select/Manual)
47
+ {
48
+ displayName: 'Owner Input Mode',
49
+ name: 'OwnerMode',
50
+ type: 'options',
51
+ options: [
52
+ { name: 'Select from list', value: 'select' },
53
+ { name: 'Enter ID manually', value: 'manual' },
54
+ ],
55
+ default: 'select',
56
+ description: 'Choose how to set the owner.',
57
+ },
58
+ {
59
+ displayName: 'Owner',
60
+ name: 'OwnerIdSelect',
61
+ type: 'options',
62
+ typeOptions: { loadOptionsMethod: 'getUsers' },
63
+ default: '',
64
+ displayOptions: { show: { OwnerMode: ['select'] } },
65
+ description: 'Select the owner user (required if select mode).',
66
+ },
67
+ {
68
+ displayName: 'Owner ID',
69
+ name: 'OwnerIdManual',
70
+ type: 'string',
71
+ default: '',
72
+ displayOptions: { show: { OwnerMode: ['manual'] } },
73
+ description: 'Enter owner user ID manually (required if manual mode).',
74
+ },
75
+ {
76
+ displayName: 'Is Done',
77
+ name: 'IsDone',
78
+ type: 'boolean',
79
+ default: false,
80
+ displayOptions: showForActivityCreate,
81
+ description: 'Mark the activity as completed.',
82
+ },
83
+ // ===== Additional Fields =====
84
+ {
85
+ displayName: 'Additional Fields',
86
+ name: 'additionalFields',
87
+ type: 'collection',
88
+ placeholder: 'Add field',
89
+ default: {},
90
+ displayOptions: showForActivityCreate,
91
+ options: [
92
+ { displayName: 'Note', name: 'Note', type: 'string', default: '', description: 'Activity note/description.' },
93
+ { displayName: 'Result Note', name: 'ResultNote', type: 'string', default: '', description: 'Result/Outcome notes.' },
94
+ { displayName: 'Is Deleted', name: 'IsDeleted', type: 'boolean', default: false, description: 'Soft-delete flag.' },
95
+ { displayName: 'Is Pinned', name: 'IsPinned', type: 'boolean', default: false, description: 'Pin this activity.' },
96
+ { displayName: 'Due Date', name: 'DueDate', type: 'dateTime', default: '', description: 'Planned due date/time (ISO).' },
97
+ { displayName: 'Duration', name: 'Duration', type: 'number', default: 0, description: 'Duration in minutes (>= 0). Only sent if > 0.' },
98
+ { displayName: 'Done Date', name: 'DoneDate', type: 'dateTime', default: '', description: 'Completion date/time (ISO).' },
99
+ {
100
+ displayName: 'Deal ID',
101
+ name: 'DealId',
102
+ type: 'string',
103
+ default: '00000000-0000-0000-0000-000000000000',
104
+ description: 'Related deal ID (zero-guid if none).',
105
+ },
106
+ {
107
+ displayName: 'Case ID',
108
+ name: 'CaseId',
109
+ type: 'string',
110
+ default: '00000000-0000-0000-0000-000000000000',
111
+ description: 'Related case ID (zero-guid if none).',
112
+ },
113
+ // ContactIds: string[]
114
+ {
115
+ displayName: 'Contact IDs',
116
+ name: 'ContactIds',
117
+ type: 'string',
118
+ typeOptions: { multipleValues: true },
119
+ default: [],
120
+ description: 'List of related contact IDs.',
121
+ },
122
+ {
123
+ displayName: 'Creator ID',
124
+ name: 'CreatorId',
125
+ type: 'string',
126
+ default: '00000000-0000-0000-0000-000000000000',
127
+ description: 'Creator user ID (GUID).',
128
+ },
129
+ // Recurrence
130
+ {
131
+ displayName: 'Recurrence Type',
132
+ name: 'RecurrenceType',
133
+ type: 'options',
134
+ options: [
135
+ { name: '—', value: '' },
136
+ { name: 'OneTime', value: 'OneTime' },
137
+ { name: 'Hourly', value: 'Hourly' },
138
+ { name: 'Daily', value: 'Daily' },
139
+ { name: 'Weekly', value: 'Weekly' },
140
+ { name: 'Monthly', value: 'Monthly' },
141
+ { name: 'Yearly', value: 'Yearly' },
142
+ ],
143
+ default: '',
144
+ description: 'Recurrence pattern; leave empty for non-recurring.',
145
+ },
146
+ {
147
+ displayName: 'Recurrence Data',
148
+ name: 'RecurrenceData',
149
+ type: 'number',
150
+ default: 0,
151
+ description: 'Positive integer. Only sent if > 0.',
152
+ },
153
+ {
154
+ displayName: 'Recurrence End Date',
155
+ name: 'RecurrenceEndDate',
156
+ type: 'dateTime',
157
+ default: '',
158
+ description: 'End date/time for recurrence (ISO).',
159
+ },
160
+ ],
161
+ },
162
+ ];
@@ -0,0 +1,4 @@
1
+ export { activityCreate } from './create.operation';
2
+ export { activityCreateProperties } from './create.properties';
3
+ export { activityUpdate } from './update.operation';
4
+ export { activityUpdateProperties } from './update.properties';
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.activityUpdateProperties = exports.activityUpdate = exports.activityCreateProperties = exports.activityCreate = void 0;
4
+ var create_operation_1 = require("./create.operation");
5
+ Object.defineProperty(exports, "activityCreate", { enumerable: true, get: function () { return create_operation_1.activityCreate; } });
6
+ var create_properties_1 = require("./create.properties");
7
+ Object.defineProperty(exports, "activityCreateProperties", { enumerable: true, get: function () { return create_properties_1.activityCreateProperties; } });
8
+ var update_operation_1 = require("./update.operation"); // NEW
9
+ Object.defineProperty(exports, "activityUpdate", { enumerable: true, get: function () { return update_operation_1.activityUpdate; } });
10
+ var update_properties_1 = require("./update.properties"); // NEW
11
+ Object.defineProperty(exports, "activityUpdateProperties", { enumerable: true, get: function () { return update_properties_1.activityUpdateProperties; } });
@@ -0,0 +1,2 @@
1
+ import { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
2
+ export declare function activityUpdate(this: IExecuteFunctions, i: number, returnData: INodeExecutionData[]): Promise<void>;
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.activityUpdate = activityUpdate;
4
+ const http_1 = require("../../lib/http");
5
+ async function activityUpdate(i, returnData) {
6
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
7
+ // Required
8
+ const id = this.getNodeParameter('Id', i, '');
9
+ if (!id)
10
+ throw new Error('Id is required.');
11
+ const title = this.getNodeParameter('Title', i, '');
12
+ if (!title)
13
+ throw new Error('Title is required.');
14
+ // ActivityType: select/manual
15
+ const typeMode = this.getNodeParameter('ActivityTypeMode', i);
16
+ const activityTypeId = typeMode === 'select'
17
+ ? this.getNodeParameter('ActivityTypeIdSelect', i, '')
18
+ : this.getNodeParameter('ActivityTypeIdManual', i, '');
19
+ if (!activityTypeId)
20
+ throw new Error('ActivityTypeId is required (select from list or enter manually).');
21
+ // Owner
22
+ const ownerMode = this.getNodeParameter('OwnerMode', i);
23
+ const ownerId = ownerMode === 'select'
24
+ ? this.getNodeParameter('OwnerIdSelect', i, '')
25
+ : this.getNodeParameter('OwnerIdManual', i, '');
26
+ // if (!ownerId) throw new Error('OwnerId is required (select from list or enter manually).');
27
+ const isDone = this.getNodeParameter('IsDone', i, false);
28
+ // Additional fields
29
+ const add = this.getNodeParameter('additionalFields', i, {}) || {};
30
+ const note = (_a = add.Note) !== null && _a !== void 0 ? _a : '';
31
+ const resultNote = (_b = add.ResultNote) !== null && _b !== void 0 ? _b : '';
32
+ const isDeleted = (_c = add.IsDeleted) !== null && _c !== void 0 ? _c : false;
33
+ const isPinned = (_d = add.IsPinned) !== null && _d !== void 0 ? _d : false;
34
+ const dueDate = (_e = add.DueDate) !== null && _e !== void 0 ? _e : '';
35
+ const duration = Number((_f = add.Duration) !== null && _f !== void 0 ? _f : 0);
36
+ const doneDate = (_g = add.DoneDate) !== null && _g !== void 0 ? _g : '';
37
+ const dealId = (_h = add.DealId) !== null && _h !== void 0 ? _h : '00000000-0000-0000-0000-000000000000';
38
+ const caseId = (_j = add.CaseId) !== null && _j !== void 0 ? _j : '00000000-0000-0000-0000-000000000000';
39
+ // ContactIds: string[]
40
+ let contactIds;
41
+ const cids = add.ContactIds;
42
+ if (Array.isArray(cids))
43
+ contactIds = cids.filter(Boolean);
44
+ else if (typeof cids === 'string' && cids)
45
+ contactIds = [cids];
46
+ const creatorId = (_k = add.CreatorId) !== null && _k !== void 0 ? _k : '00000000-0000-0000-0000-000000000000';
47
+ const recurrenceType = (_l = add.RecurrenceType) !== null && _l !== void 0 ? _l : '';
48
+ const recurrenceDataNum = Number((_m = add.RecurrenceData) !== null && _m !== void 0 ? _m : 0);
49
+ const recurrenceEndDate = (_o = add.RecurrenceEndDate) !== null && _o !== void 0 ? _o : '';
50
+ // Build body (با Id)
51
+ const activity = {
52
+ Id: id,
53
+ ActivityTypeId: activityTypeId,
54
+ Title: title,
55
+ IsDone: isDone,
56
+ };
57
+ if (ownerId)
58
+ activity['OwnerId'] = ownerId;
59
+ if (note)
60
+ activity['Note'] = note;
61
+ if (resultNote)
62
+ activity['ResultNote'] = resultNote;
63
+ if (isDeleted)
64
+ activity['IsDeleted'] = true;
65
+ if (isPinned)
66
+ activity['IsPinned'] = true;
67
+ if (dueDate)
68
+ activity['DueDate'] = dueDate;
69
+ if (duration > 0)
70
+ activity['Duration'] = duration;
71
+ if (doneDate)
72
+ activity['DoneDate'] = doneDate;
73
+ if (dealId)
74
+ activity['DealId'] = dealId;
75
+ if (caseId)
76
+ activity['CaseId'] = caseId;
77
+ if (contactIds === null || contactIds === void 0 ? void 0 : contactIds.length)
78
+ activity['ContactIds'] = contactIds;
79
+ if (creatorId)
80
+ activity['CreatorId'] = creatorId;
81
+ if (recurrenceType)
82
+ activity['RecurrenceType'] = recurrenceType;
83
+ if (recurrenceDataNum > 0)
84
+ activity['RecurrenceData'] = recurrenceDataNum;
85
+ if (recurrenceEndDate)
86
+ activity['RecurrenceEndDate'] = recurrenceEndDate;
87
+ const resp = await (0, http_1.didarRequest)(this, i, {
88
+ method: 'POST',
89
+ path: '/api/activity/save',
90
+ body: { Activity: activity },
91
+ });
92
+ returnData.push({ json: resp });
93
+ }
@@ -0,0 +1,2 @@
1
+ import { INodeProperties } from 'n8n-workflow';
2
+ export declare const activityUpdateProperties: INodeProperties[];