n8n-nodes-didar-crm 0.0.19 → 0.0.21
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/README.md +38 -12
- package/dist/nodes/DidarCrm.node.js +53 -0
- package/dist/nodes/activity/index.d.ts +2 -0
- package/dist/nodes/activity/index.js +5 -1
- package/dist/nodes/activity/search.operation.d.ts +2 -0
- package/dist/nodes/activity/search.operation.js +162 -0
- package/dist/nodes/activity/search.properties.d.ts +2 -0
- package/dist/nodes/activity/search.properties.js +193 -0
- package/dist/nodes/case/index.d.ts +2 -0
- package/dist/nodes/case/index.js +5 -1
- package/dist/nodes/case/search.operation.d.ts +2 -0
- package/dist/nodes/case/search.operation.js +156 -0
- package/dist/nodes/case/search.properties.d.ts +2 -0
- package/dist/nodes/case/search.properties.js +93 -0
- package/dist/nodes/deal/_shared.fields.js +8 -0
- package/dist/nodes/deal/create.operation.js +44 -1
- package/dist/nodes/deal/update.operation.js +41 -1
- package/dist/nodes/product/index.d.ts +2 -0
- package/dist/nodes/product/index.js +5 -1
- package/dist/nodes/product/search.operation.d.ts +2 -0
- package/dist/nodes/product/search.operation.js +30 -0
- package/dist/nodes/product/search.properties.d.ts +2 -0
- package/dist/nodes/product/search.properties.js +23 -0
- package/dist/nodes/supplementary/didaryab-search.operation.d.ts +2 -0
- package/dist/nodes/supplementary/didaryab-search.operation.js +27 -0
- package/dist/nodes/supplementary/didaryab-search.properties.d.ts +2 -0
- package/dist/nodes/supplementary/didaryab-search.properties.js +32 -0
- package/dist/nodes/supplementary/get-base-info.operation.d.ts +2 -0
- package/dist/nodes/supplementary/get-base-info.operation.js +26 -0
- package/dist/nodes/supplementary/get-base-info.properties.d.ts +2 -0
- package/dist/nodes/supplementary/get-base-info.properties.js +20 -0
- package/dist/nodes/supplementary/index.d.ts +6 -0
- package/dist/nodes/supplementary/index.js +16 -0
- package/dist/nodes/supplementary/popup-callerid.operation.d.ts +2 -0
- package/dist/nodes/supplementary/popup-callerid.operation.js +40 -0
- package/dist/nodes/supplementary/popup-callerid.properties.d.ts +2 -0
- package/dist/nodes/supplementary/popup-callerid.properties.js +34 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,20 +14,24 @@ This package provides actions and triggers to automate workflows with your Didar
|
|
|
14
14
|
- Create a deal
|
|
15
15
|
- Update a deal (by Id)
|
|
16
16
|
- Get deal details (by Id)
|
|
17
|
+
- Search deals (flexible filters, pipeline & stage, labels, custom fields, etc.)
|
|
17
18
|
|
|
18
19
|
### Person (Contact)
|
|
19
20
|
- Create a person
|
|
20
21
|
- Update a person (by Id)
|
|
21
22
|
- Get person details (by Id)
|
|
23
|
+
- Search persons (keywords, owner, custom fields, filters)
|
|
22
24
|
|
|
23
25
|
### Company
|
|
24
26
|
- Create a company
|
|
25
27
|
- Update a company (by Id)
|
|
26
28
|
- Get company details (by Id)
|
|
29
|
+
- Search companies (keywords, owner, custom fields, filters)
|
|
27
30
|
|
|
28
31
|
### Activity
|
|
29
32
|
- Create an activity
|
|
30
33
|
- Update an activity (by Id)
|
|
34
|
+
- Search activities (type, owner, creator, contactIds, tags, dealId, caseId, etc.)
|
|
31
35
|
|
|
32
36
|
### Note
|
|
33
37
|
- Create a note
|
|
@@ -36,11 +40,18 @@ This package provides actions and triggers to automate workflows with your Didar
|
|
|
36
40
|
### Case (Card)
|
|
37
41
|
- Create a case
|
|
38
42
|
- Update a case (by Id)
|
|
43
|
+
- Search cases (keywords, owner, contactIds, custom fields)
|
|
39
44
|
|
|
40
45
|
### Product
|
|
41
|
-
- Create a product
|
|
42
|
-
- Update a product (
|
|
46
|
+
- Create a product (with variants & custom fields)
|
|
47
|
+
- Update a product (with variants & custom fields)
|
|
43
48
|
- Get products by list of codes
|
|
49
|
+
- Search products (keywords)
|
|
50
|
+
|
|
51
|
+
### Complementary Actions
|
|
52
|
+
- **Get Base Information**: retrieve Pipelines, Activity Types, Custom Fields, Product Categories
|
|
53
|
+
- **Didaryab Searching**: global search across contacts, companies, deals, cases, attachments
|
|
54
|
+
- **Popup Caller ID**: insert call log by phone number & internal number
|
|
44
55
|
|
|
45
56
|
---
|
|
46
57
|
|
|
@@ -48,13 +59,15 @@ This package provides actions and triggers to automate workflows with your Didar
|
|
|
48
59
|
|
|
49
60
|
- Dropdown selectors for Pipelines, Owners (Users), Activity Types, Product Categories, etc.
|
|
50
61
|
- Manual ID input option for each dropdown field
|
|
62
|
+
- Multi-select and manual list parsing for IDs (supports JSON arrays, comma/newline separated, and n8n array variables)
|
|
51
63
|
- Additional fields for advanced properties:
|
|
52
64
|
- Visibility Type
|
|
53
65
|
- Custom Fields (JSON)
|
|
66
|
+
- Deal Items (list of product entries)
|
|
54
67
|
- Multi-value lists (phones, emails, websites, addresses, bank accounts, labels, users)
|
|
55
68
|
- Correct handling of defaults (zero GUIDs, booleans, etc.)
|
|
56
69
|
- Webhook trigger enforces **POST** requests only
|
|
57
|
-
- Consistent **Owner selection mechanism** (select from list or manual ID) across all resources
|
|
70
|
+
- Consistent **Owner/Creator selection mechanism** (select from list or manual ID) across all resources
|
|
58
71
|
|
|
59
72
|
---
|
|
60
73
|
|
|
@@ -89,36 +102,47 @@ Add the **Didar CRM Trigger** node to your workflow.
|
|
|
89
102
|
### 2. Resource operations
|
|
90
103
|
|
|
91
104
|
#### Deal
|
|
92
|
-
- **Create** → required
|
|
105
|
+
- **Create** → required: `Title`, `OwnerId`, `PipelineId`, `PipelineStageId`
|
|
93
106
|
- **Update** → same as create + `Id`
|
|
94
107
|
- **Get** → requires `Id`
|
|
108
|
+
- **Search** → optional filters (keywords, status, pipeline, owner, labels, probability, custom fields, etc.)
|
|
95
109
|
|
|
96
110
|
#### Person (Contact)
|
|
97
|
-
- **Create** → required
|
|
111
|
+
- **Create** → required: `LastName`, `OwnerId`
|
|
98
112
|
- **Update** → same as create + `Id`
|
|
99
113
|
- **Get** → requires `Id`
|
|
114
|
+
- **Search** → optional filters (keywords, owner, custom fields, etc.)
|
|
100
115
|
|
|
101
116
|
#### Company
|
|
102
|
-
- **Create** → required
|
|
117
|
+
- **Create** → required: `Name`, `OwnerId`
|
|
103
118
|
- **Update** → same as create + `Id`
|
|
104
119
|
- **Get** → requires `Id`
|
|
120
|
+
- **Search** → optional filters (keywords, owner, custom fields, etc.)
|
|
105
121
|
|
|
106
122
|
#### Activity
|
|
107
|
-
- **Create Activity** → required
|
|
123
|
+
- **Create Activity** → required: `Title`, `OwnerId`, `ActivityTypeId`
|
|
108
124
|
- **Update Activity** → same as create + `Id`
|
|
125
|
+
- **Search** → optional filters (activity types, owner, creator, tags, contacts, deals, cases, done/deleted flags)
|
|
109
126
|
|
|
110
127
|
#### Note
|
|
111
|
-
- **Create Note** → required
|
|
128
|
+
- **Create Note** → required: `ResultNote`, `OwnerId`
|
|
112
129
|
- **Update Note** → same as create + `Id`
|
|
113
130
|
|
|
114
131
|
#### Case (Card)
|
|
115
|
-
- **Create Case** → required
|
|
132
|
+
- **Create Case** → required: `Title`, `OwnerId`, `PipelineStageId`, `Status`
|
|
116
133
|
- **Update Case** → same as create + `Id`
|
|
134
|
+
- **Search** → optional filters (keywords, owner, contactIds, custom fields)
|
|
117
135
|
|
|
118
136
|
#### Product
|
|
119
|
-
- **Create Product** → required
|
|
137
|
+
- **Create Product** → required: `Title`, optional: `Variants`, `Fields`
|
|
120
138
|
- **Update Product** → same as create + `Id`
|
|
121
|
-
- **Get Products by Codes** → required
|
|
139
|
+
- **Get Products by Codes** → required: `Code[]`
|
|
140
|
+
- **Search Products** → optional: `Keywords`
|
|
141
|
+
|
|
142
|
+
#### Complementary
|
|
143
|
+
- **Get Base Information** → pipelines, activity types, custom fields, product categories
|
|
144
|
+
- **Didaryab Searching** → global search with `Keyword` + multiple `Types`
|
|
145
|
+
- **Popup Caller ID** → log calls by phone number & internal extension, requires `CallerId's APIKey`
|
|
122
146
|
|
|
123
147
|
---
|
|
124
148
|
|
|
@@ -128,6 +152,7 @@ A new credential type **Didar API** is provided.
|
|
|
128
152
|
|
|
129
153
|
- Set your **API Key** and (if required) authentication cookies.
|
|
130
154
|
- Shared across all nodes.
|
|
155
|
+
- Note: **Popup Caller ID** uses a separate fixed API Key provided by Didar.
|
|
131
156
|
|
|
132
157
|
---
|
|
133
158
|
|
|
@@ -147,7 +172,8 @@ n8n-nodes-didar-crm/
|
|
|
147
172
|
│ ├── activity/ # Activity operations
|
|
148
173
|
│ ├── note/ # Note operations
|
|
149
174
|
│ ├── case/ # Case operations
|
|
150
|
-
│
|
|
175
|
+
│ ├── product/ # Product operations
|
|
176
|
+
│ └── extras/ # Complementary actions (base info, didaryab, popup caller ID)
|
|
151
177
|
│── lib/
|
|
152
178
|
│ ├── http.ts # Request helper
|
|
153
179
|
│ └── loadOptions.ts # Dropdown population
|
|
@@ -49,6 +49,8 @@ const CaseOps = __importStar(require("./case"));
|
|
|
49
49
|
const case_1 = require("./case");
|
|
50
50
|
const ProductOps = __importStar(require("./product"));
|
|
51
51
|
const product_1 = require("./product");
|
|
52
|
+
// Supplementary (Base Info)
|
|
53
|
+
const supplementary_1 = require("./supplementary");
|
|
52
54
|
class DidarCrm {
|
|
53
55
|
constructor() {
|
|
54
56
|
this.methods = {
|
|
@@ -85,6 +87,7 @@ class DidarCrm {
|
|
|
85
87
|
{ name: 'Note', value: 'note' },
|
|
86
88
|
{ name: 'Case', value: 'case' },
|
|
87
89
|
{ name: 'Product', value: 'product' },
|
|
90
|
+
{ name: 'Supplementary', value: 'supplementary' }
|
|
88
91
|
],
|
|
89
92
|
default: 'deal',
|
|
90
93
|
description: 'Choose the entity to act on.',
|
|
@@ -139,6 +142,7 @@ class DidarCrm {
|
|
|
139
142
|
options: [
|
|
140
143
|
{ name: 'Create', value: 'create', action: 'Create an activity' },
|
|
141
144
|
{ name: 'Update', value: 'update', action: 'Update an activity by Id' },
|
|
145
|
+
{ name: 'Search', value: 'search', action: 'Search activities' }
|
|
142
146
|
],
|
|
143
147
|
default: 'create',
|
|
144
148
|
description: 'Select the action to perform on the selected resource.',
|
|
@@ -163,6 +167,7 @@ class DidarCrm {
|
|
|
163
167
|
options: [
|
|
164
168
|
{ name: 'Create', value: 'create', action: 'Create a case' },
|
|
165
169
|
{ name: 'Update', value: 'update', action: 'Update a case by ID' },
|
|
170
|
+
{ name: 'Search', value: 'search', action: 'Search cases' }
|
|
166
171
|
],
|
|
167
172
|
default: 'create',
|
|
168
173
|
description: 'Select the action to perform on the selected resource.',
|
|
@@ -176,10 +181,25 @@ class DidarCrm {
|
|
|
176
181
|
{ name: 'Create', value: 'create', action: 'Create a product' },
|
|
177
182
|
{ name: 'Update', value: 'update', action: 'Update a product by ID' },
|
|
178
183
|
{ name: 'Get by Codes', value: 'getByCodes', action: 'Get products by list of codes' },
|
|
184
|
+
{ name: 'Search', value: 'search', description: 'Search products' },
|
|
179
185
|
],
|
|
180
186
|
default: 'create',
|
|
181
187
|
description: 'Select the action to perform on the selected resource.',
|
|
182
188
|
},
|
|
189
|
+
{
|
|
190
|
+
displayName: 'Operation',
|
|
191
|
+
name: 'operation',
|
|
192
|
+
type: 'options',
|
|
193
|
+
displayOptions: {
|
|
194
|
+
show: { resource: ['supplementary'] },
|
|
195
|
+
},
|
|
196
|
+
options: [
|
|
197
|
+
{ name: 'Get Base Info', value: 'getBaseInfo', action: 'Fetch base information' },
|
|
198
|
+
{ name: 'Didaryab Searching', value: 'didaryabSearch', action: 'Didaryab Searching' }, // NEW
|
|
199
|
+
{ name: 'Popup Caller ID', value: 'popupCallerId', action: 'Trigger caller ID popup' }, // NEW
|
|
200
|
+
],
|
|
201
|
+
default: 'getBaseInfo',
|
|
202
|
+
},
|
|
183
203
|
// Deal properties (imported)
|
|
184
204
|
...deal_1.dealCreateProperties,
|
|
185
205
|
...deal_1.dealUpdateProperties,
|
|
@@ -198,16 +218,23 @@ class DidarCrm {
|
|
|
198
218
|
// Activity properties (imported)
|
|
199
219
|
...activity_1.activityCreateProperties,
|
|
200
220
|
...activity_1.activityUpdateProperties,
|
|
221
|
+
...activity_1.activitySearchProperties,
|
|
201
222
|
// Note properties (imported)
|
|
202
223
|
...note_1.noteCreateProperties,
|
|
203
224
|
...note_1.noteUpdateProperties,
|
|
204
225
|
// Case properties (imported)
|
|
205
226
|
...case_1.caseCreateProperties,
|
|
206
227
|
...case_1.caseUpdateProperties,
|
|
228
|
+
...case_1.caseSearchProperties,
|
|
207
229
|
// Product properties (imported)
|
|
208
230
|
...product_1.productCreateProperties,
|
|
209
231
|
...product_1.productUpdateProperties,
|
|
210
232
|
...product_1.productGetByCodesProperties,
|
|
233
|
+
...product_1.productSearchProperties,
|
|
234
|
+
// somewhere after Operation property
|
|
235
|
+
...supplementary_1.getBaseInfoProperties,
|
|
236
|
+
...supplementary_1.didaryabSearchProperties,
|
|
237
|
+
...supplementary_1.popupCallerIdProperties,
|
|
211
238
|
],
|
|
212
239
|
};
|
|
213
240
|
}
|
|
@@ -280,6 +307,10 @@ class DidarCrm {
|
|
|
280
307
|
await ActivityOps.activityUpdate.call(this, i, returnData);
|
|
281
308
|
continue;
|
|
282
309
|
}
|
|
310
|
+
if (operation === 'search') {
|
|
311
|
+
await ActivityOps.activitySearch.call(this, i, returnData);
|
|
312
|
+
continue;
|
|
313
|
+
}
|
|
283
314
|
}
|
|
284
315
|
if (resource === 'note') {
|
|
285
316
|
if (operation === 'create') {
|
|
@@ -300,6 +331,10 @@ class DidarCrm {
|
|
|
300
331
|
await CaseOps.caseUpdate.call(this, i, returnData);
|
|
301
332
|
continue;
|
|
302
333
|
}
|
|
334
|
+
if (operation === 'search') {
|
|
335
|
+
await CaseOps.caseSearch.call(this, i, returnData);
|
|
336
|
+
continue;
|
|
337
|
+
}
|
|
303
338
|
}
|
|
304
339
|
if (resource === 'product') {
|
|
305
340
|
if (operation === 'create') {
|
|
@@ -314,6 +349,24 @@ class DidarCrm {
|
|
|
314
349
|
await ProductOps.productGetByCodes.call(this, i, returnData);
|
|
315
350
|
continue;
|
|
316
351
|
}
|
|
352
|
+
if (operation === 'search') {
|
|
353
|
+
await ProductOps.productSearch.call(this, i, returnData);
|
|
354
|
+
continue;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
if (resource === 'supplementary') {
|
|
358
|
+
if (operation === 'getBaseInfo') {
|
|
359
|
+
await supplementary_1.getBaseInfo.call(this, i, returnData);
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
if (operation === 'didaryabSearch') {
|
|
363
|
+
await supplementary_1.didaryabSearch.call(this, i, returnData);
|
|
364
|
+
continue;
|
|
365
|
+
}
|
|
366
|
+
if (operation === 'popupCallerId') {
|
|
367
|
+
await supplementary_1.popupCallerId.call(this, i, returnData);
|
|
368
|
+
continue;
|
|
369
|
+
}
|
|
317
370
|
}
|
|
318
371
|
}
|
|
319
372
|
return [returnData];
|
|
@@ -2,3 +2,5 @@ export { activityCreate } from './create.operation';
|
|
|
2
2
|
export { activityCreateProperties } from './create.properties';
|
|
3
3
|
export { activityUpdate } from './update.operation';
|
|
4
4
|
export { activityUpdateProperties } from './update.properties';
|
|
5
|
+
export { activitySearch } from './search.operation';
|
|
6
|
+
export { activitySearchProperties } from './search.properties';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.activityUpdateProperties = exports.activityUpdate = exports.activityCreateProperties = exports.activityCreate = void 0;
|
|
3
|
+
exports.activitySearchProperties = exports.activitySearch = exports.activityUpdateProperties = exports.activityUpdate = exports.activityCreateProperties = exports.activityCreate = void 0;
|
|
4
4
|
var create_operation_1 = require("./create.operation");
|
|
5
5
|
Object.defineProperty(exports, "activityCreate", { enumerable: true, get: function () { return create_operation_1.activityCreate; } });
|
|
6
6
|
var create_properties_1 = require("./create.properties");
|
|
@@ -9,3 +9,7 @@ var update_operation_1 = require("./update.operation");
|
|
|
9
9
|
Object.defineProperty(exports, "activityUpdate", { enumerable: true, get: function () { return update_operation_1.activityUpdate; } });
|
|
10
10
|
var update_properties_1 = require("./update.properties");
|
|
11
11
|
Object.defineProperty(exports, "activityUpdateProperties", { enumerable: true, get: function () { return update_properties_1.activityUpdateProperties; } });
|
|
12
|
+
var search_operation_1 = require("./search.operation");
|
|
13
|
+
Object.defineProperty(exports, "activitySearch", { enumerable: true, get: function () { return search_operation_1.activitySearch; } });
|
|
14
|
+
var search_properties_1 = require("./search.properties");
|
|
15
|
+
Object.defineProperty(exports, "activitySearchProperties", { enumerable: true, get: function () { return search_properties_1.activitySearchProperties; } });
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.activitySearch = activitySearch;
|
|
4
|
+
const http_1 = require("../../lib/http");
|
|
5
|
+
async function activitySearch(i, returnData) {
|
|
6
|
+
var _a, _b, _c;
|
|
7
|
+
// ===== Helpers =====
|
|
8
|
+
const uniq = (arr) => Array.from(new Set(arr.map(s => s.trim()).filter(Boolean)));
|
|
9
|
+
const parseIdList = (input) => {
|
|
10
|
+
const out = [];
|
|
11
|
+
const pushFromString = (raw) => {
|
|
12
|
+
if (!raw)
|
|
13
|
+
return;
|
|
14
|
+
const s = raw.trim();
|
|
15
|
+
if (!s)
|
|
16
|
+
return;
|
|
17
|
+
// [Array: [ ... ]]
|
|
18
|
+
const arrayLabel = s.match(/^\s*\[Array:\s*(\[[\s\S]*\])\s*\]\s*$/i);
|
|
19
|
+
if (arrayLabel) {
|
|
20
|
+
try {
|
|
21
|
+
const arr = JSON.parse(arrayLabel[1]);
|
|
22
|
+
recur(arr);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
catch { }
|
|
26
|
+
}
|
|
27
|
+
// JSON array
|
|
28
|
+
if (/^\s*\[/.test(s)) {
|
|
29
|
+
try {
|
|
30
|
+
const arr = JSON.parse(s);
|
|
31
|
+
recur(arr);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
throw new Error('Invalid JSON array.');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// CSV / ; / newline
|
|
39
|
+
s.split(/[\n,;]+/).map(t => t.trim()).filter(Boolean).forEach(t => out.push(t));
|
|
40
|
+
};
|
|
41
|
+
const recur = (val) => {
|
|
42
|
+
var _a, _b;
|
|
43
|
+
if (val == null)
|
|
44
|
+
return;
|
|
45
|
+
if (Array.isArray(val)) {
|
|
46
|
+
val.forEach(recur);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
switch (typeof val) {
|
|
50
|
+
case 'string':
|
|
51
|
+
pushFromString(val);
|
|
52
|
+
return;
|
|
53
|
+
case 'number':
|
|
54
|
+
case 'boolean':
|
|
55
|
+
out.push(String(val));
|
|
56
|
+
return;
|
|
57
|
+
case 'object': {
|
|
58
|
+
const obj = val;
|
|
59
|
+
if (val instanceof Set) {
|
|
60
|
+
recur(Array.from(val));
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (val instanceof Map) {
|
|
64
|
+
recur(Array.from(val.values()));
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (obj === null || obj === void 0 ? void 0 : obj.values) {
|
|
68
|
+
recur(obj.values);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (obj === null || obj === void 0 ? void 0 : obj.Value) {
|
|
72
|
+
recur(obj.Value);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const s = ((_b = (_a = obj === null || obj === void 0 ? void 0 : obj.toString) === null || _a === void 0 ? void 0 : _a.call(obj)) !== null && _b !== void 0 ? _b : '').toString();
|
|
76
|
+
if (s)
|
|
77
|
+
pushFromString(s);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
default: return;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
recur(input);
|
|
84
|
+
return uniq(out);
|
|
85
|
+
};
|
|
86
|
+
const toBoolIfSet = (v) => {
|
|
87
|
+
if (v === '' || v === undefined)
|
|
88
|
+
return undefined;
|
|
89
|
+
return v === 1 ? true : false; // 1 => true, -1 => false
|
|
90
|
+
};
|
|
91
|
+
// ===== Main fields =====
|
|
92
|
+
// ActivityTypeIds (select/manual)
|
|
93
|
+
const typeMode = this.getNodeParameter('ActivityTypeMode', i, 'select');
|
|
94
|
+
const typeSel = this.getNodeParameter('ActivityTypeIdsSelect', i, []);
|
|
95
|
+
const typeMan = this.getNodeParameter('ActivityTypeIdsManual', i, []);
|
|
96
|
+
const activityTypeIds = parseIdList(typeMode === 'select' ? typeSel : typeMan);
|
|
97
|
+
// Owner
|
|
98
|
+
const ownerMode = this.getNodeParameter('OwnerMode', i, 'select');
|
|
99
|
+
const ownerSel = this.getNodeParameter('OwnerIdSelect', i, '');
|
|
100
|
+
const ownerMan = this.getNodeParameter('OwnerIdManual', i, '');
|
|
101
|
+
const ownerId = ownerMode === 'select' ? ownerSel : ownerMan;
|
|
102
|
+
// ContactIds
|
|
103
|
+
const contactIdsInput = this.getNodeParameter('ContactIds', i, []);
|
|
104
|
+
const contactIds = parseIdList(contactIdsInput);
|
|
105
|
+
// Deal / Case (simple)
|
|
106
|
+
const dealId = this.getNodeParameter('DealId', i, '').trim();
|
|
107
|
+
const caseId = this.getNodeParameter('CaseId', i, '').trim();
|
|
108
|
+
// ===== Additional =====
|
|
109
|
+
const add = this.getNodeParameter('additionalFields', i, {}) || {};
|
|
110
|
+
const fromDate = (_a = add.FromDate) !== null && _a !== void 0 ? _a : '1800-01-01T00:00:00.000Z';
|
|
111
|
+
const toDate = (_b = add.ToDate) !== null && _b !== void 0 ? _b : '9999-12-28T20:30:00.000Z';
|
|
112
|
+
// Creator (select/manual)
|
|
113
|
+
const creatorMode = this.getNodeParameter('CreatorMode', i, 'select');
|
|
114
|
+
const creatorSel = this.getNodeParameter('CreatorIdSelect', i, '');
|
|
115
|
+
const creatorMan = this.getNodeParameter('CreatorIdManual', i, '');
|
|
116
|
+
const creatorId = creatorMode === 'select' ? creatorSel : creatorMan;
|
|
117
|
+
// Flags (IsDone / IsDeleted) with Not set / True(1) / False(-1)
|
|
118
|
+
const isDoneOpt = add.IsDone;
|
|
119
|
+
const isDeletedOpt = add.IsDeleted;
|
|
120
|
+
const isDone = toBoolIfSet(isDoneOpt);
|
|
121
|
+
const isDeleted = toBoolIfSet(isDeletedOpt);
|
|
122
|
+
// TagIds
|
|
123
|
+
const tagIdsInput = add.TagIds;
|
|
124
|
+
const tagIds = parseIdList(tagIdsInput);
|
|
125
|
+
const limit = typeof add.Limit === 'number' ? add.Limit : 10;
|
|
126
|
+
const from = 0;
|
|
127
|
+
// ===== Build payload =====
|
|
128
|
+
const body = {
|
|
129
|
+
FromDate: fromDate,
|
|
130
|
+
ToDate: toDate,
|
|
131
|
+
SortType: 1, // ثابت و غیرنمایشی
|
|
132
|
+
From: from,
|
|
133
|
+
Limit: limit,
|
|
134
|
+
};
|
|
135
|
+
if (activityTypeIds.length)
|
|
136
|
+
body['ActivityTypeIds'] = activityTypeIds;
|
|
137
|
+
if (ownerId)
|
|
138
|
+
body['OwnerId'] = ownerId;
|
|
139
|
+
if (creatorId)
|
|
140
|
+
body['CreatorId'] = creatorId;
|
|
141
|
+
if (typeof isDone === 'boolean')
|
|
142
|
+
body['IsDone'] = isDone;
|
|
143
|
+
if (typeof isDeleted === 'boolean')
|
|
144
|
+
body['IsDeleted'] = isDeleted;
|
|
145
|
+
if (dealId)
|
|
146
|
+
body['DealId'] = dealId;
|
|
147
|
+
if (caseId)
|
|
148
|
+
body['CaseId'] = caseId;
|
|
149
|
+
if (contactIds.length)
|
|
150
|
+
body['ContactIds'] = contactIds;
|
|
151
|
+
if (tagIds.length)
|
|
152
|
+
body['TagIds'] = tagIds;
|
|
153
|
+
// ===== Request =====
|
|
154
|
+
const resp = await (0, http_1.didarRequest)(this, i, {
|
|
155
|
+
method: 'POST',
|
|
156
|
+
path: '/api/activity/search',
|
|
157
|
+
body,
|
|
158
|
+
});
|
|
159
|
+
const out = ((_c = resp === null || resp === void 0 ? void 0 : resp.Response) !== null && _c !== void 0 ? _c : resp);
|
|
160
|
+
returnData.push({ json: { search_respons: out, criteria: body } });
|
|
161
|
+
return returnData;
|
|
162
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.activitySearchProperties = void 0;
|
|
4
|
+
const showForActivitySearch = { show: { resource: ['activity'], operation: ['search'] } };
|
|
5
|
+
exports.activitySearchProperties = [
|
|
6
|
+
// ===== Main fields (ordered) =====
|
|
7
|
+
// ActivityTypeIds (Select/Manual, multi)
|
|
8
|
+
{
|
|
9
|
+
displayName: 'Activity Types Input Mode',
|
|
10
|
+
name: 'ActivityTypeMode',
|
|
11
|
+
type: 'options',
|
|
12
|
+
options: [
|
|
13
|
+
{ name: 'Select from list (multi)', value: 'select' },
|
|
14
|
+
{ name: 'Enter IDs manually', value: 'manual' },
|
|
15
|
+
],
|
|
16
|
+
default: 'select',
|
|
17
|
+
displayOptions: showForActivitySearch,
|
|
18
|
+
description: 'Choose how to provide activity type IDs (optional).',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
displayName: 'Activity Types',
|
|
22
|
+
name: 'ActivityTypeIdsSelect',
|
|
23
|
+
type: 'options',
|
|
24
|
+
typeOptions: { loadOptionsMethod: 'getActivityTypes', multipleValues: true },
|
|
25
|
+
default: [],
|
|
26
|
+
displayOptions: { show: { ...showForActivitySearch.show, ActivityTypeMode: ['select'] } },
|
|
27
|
+
description: 'Select one or more activity types (leave empty to ignore).',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
displayName: 'Activity Type IDs (Manual)',
|
|
31
|
+
name: 'ActivityTypeIdsManual',
|
|
32
|
+
type: 'string',
|
|
33
|
+
typeOptions: { multipleValues: true },
|
|
34
|
+
default: [],
|
|
35
|
+
displayOptions: { show: { ...showForActivitySearch.show, ActivityTypeMode: ['manual'] } },
|
|
36
|
+
description: 'Enter IDs as CSV / JSON array / [Array: [...]] / multi-lines.',
|
|
37
|
+
},
|
|
38
|
+
// Owner (select/manual)
|
|
39
|
+
{
|
|
40
|
+
displayName: 'Owner Input Mode',
|
|
41
|
+
name: 'OwnerMode',
|
|
42
|
+
type: 'options',
|
|
43
|
+
options: [
|
|
44
|
+
{ name: 'Select from list', value: 'select' },
|
|
45
|
+
{ name: 'Enter ID manually', value: 'manual' },
|
|
46
|
+
],
|
|
47
|
+
default: 'select',
|
|
48
|
+
displayOptions: showForActivitySearch,
|
|
49
|
+
description: 'Choose how to filter by owner (optional).',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
displayName: 'Owner',
|
|
53
|
+
name: 'OwnerIdSelect',
|
|
54
|
+
type: 'options',
|
|
55
|
+
typeOptions: { loadOptionsMethod: 'getUsers' },
|
|
56
|
+
default: '',
|
|
57
|
+
displayOptions: { show: { ...showForActivitySearch.show, OwnerMode: ['select'] } },
|
|
58
|
+
description: 'Select the owner user (leave empty to ignore).',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
displayName: 'Owner ID',
|
|
62
|
+
name: 'OwnerIdManual',
|
|
63
|
+
type: 'string',
|
|
64
|
+
default: '',
|
|
65
|
+
displayOptions: { show: { ...showForActivitySearch.show, OwnerMode: ['manual'] } },
|
|
66
|
+
description: 'Enter owner user ID manually (leave empty to ignore).',
|
|
67
|
+
},
|
|
68
|
+
// ContactIds
|
|
69
|
+
{
|
|
70
|
+
displayName: 'Contact IDs',
|
|
71
|
+
name: 'ContactIds',
|
|
72
|
+
type: 'string',
|
|
73
|
+
typeOptions: { multipleValues: true },
|
|
74
|
+
default: [],
|
|
75
|
+
displayOptions: showForActivitySearch,
|
|
76
|
+
description: 'Contact IDs (CSV / JSON array / [Array: [...]] / multi-lines).',
|
|
77
|
+
},
|
|
78
|
+
// DealId / CaseId (simple strings)
|
|
79
|
+
{
|
|
80
|
+
displayName: 'Deal ID',
|
|
81
|
+
name: 'DealId',
|
|
82
|
+
type: 'string',
|
|
83
|
+
default: '',
|
|
84
|
+
displayOptions: showForActivitySearch,
|
|
85
|
+
description: 'Filter by a specific deal (optional).',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
displayName: 'Case ID',
|
|
89
|
+
name: 'CaseId',
|
|
90
|
+
type: 'string',
|
|
91
|
+
default: '',
|
|
92
|
+
displayOptions: showForActivitySearch,
|
|
93
|
+
description: 'Filter by a specific case (optional).',
|
|
94
|
+
},
|
|
95
|
+
// Creator (select/manual)
|
|
96
|
+
{
|
|
97
|
+
displayName: 'Creator Input Mode',
|
|
98
|
+
name: 'CreatorMode',
|
|
99
|
+
type: 'options',
|
|
100
|
+
options: [
|
|
101
|
+
{ name: 'Select from list', value: 'select' },
|
|
102
|
+
{ name: 'Enter ID manually', value: 'manual' },
|
|
103
|
+
],
|
|
104
|
+
default: 'select',
|
|
105
|
+
displayOptions: showForActivitySearch,
|
|
106
|
+
description: 'Choose how to filter by creator (optional).',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
displayName: 'Creator',
|
|
110
|
+
name: 'CreatorIdSelect',
|
|
111
|
+
type: 'options',
|
|
112
|
+
typeOptions: { loadOptionsMethod: 'getUsers' },
|
|
113
|
+
default: '',
|
|
114
|
+
displayOptions: { show: { ...showForActivitySearch.show, CreatorMode: ['select'] } },
|
|
115
|
+
description: 'Select the creator user (leave empty to ignore).',
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
displayName: 'Creator ID',
|
|
119
|
+
name: 'CreatorIdManual',
|
|
120
|
+
type: 'string',
|
|
121
|
+
default: '',
|
|
122
|
+
displayOptions: { show: { ...showForActivitySearch.show, CreatorMode: ['manual'] } },
|
|
123
|
+
description: 'Enter creator user ID manually (leave empty to ignore).',
|
|
124
|
+
},
|
|
125
|
+
// ===== Additional filters =====
|
|
126
|
+
{
|
|
127
|
+
displayName: 'Additional Filters',
|
|
128
|
+
name: 'additionalFields',
|
|
129
|
+
type: 'collection',
|
|
130
|
+
placeholder: 'Add filter',
|
|
131
|
+
default: {},
|
|
132
|
+
displayOptions: showForActivitySearch,
|
|
133
|
+
options: [
|
|
134
|
+
// ثابتها / پیشفرضها
|
|
135
|
+
{
|
|
136
|
+
displayName: 'From Date',
|
|
137
|
+
name: 'FromDate',
|
|
138
|
+
type: 'dateTime',
|
|
139
|
+
default: '1800-01-01T00:00:00.000Z',
|
|
140
|
+
description: 'Lower bound date.',
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
displayName: 'To Date',
|
|
144
|
+
name: 'ToDate',
|
|
145
|
+
type: 'dateTime',
|
|
146
|
+
default: '9999-12-28T20:30:00.000Z',
|
|
147
|
+
description: 'Upper bound date.',
|
|
148
|
+
},
|
|
149
|
+
// IsDone / IsDeleted (Not set / True / False) — در operation به boolean تبدیل میکنیم
|
|
150
|
+
{
|
|
151
|
+
displayName: 'Is Done',
|
|
152
|
+
name: 'IsDone',
|
|
153
|
+
type: 'options',
|
|
154
|
+
options: [
|
|
155
|
+
{ name: 'Not set', value: '' },
|
|
156
|
+
{ name: 'True (1)', value: 1 },
|
|
157
|
+
{ name: 'False (-1)', value: -1 },
|
|
158
|
+
],
|
|
159
|
+
default: '',
|
|
160
|
+
description: 'Filter by completion flag (optional).',
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
displayName: 'Is Deleted',
|
|
164
|
+
name: 'IsDeleted',
|
|
165
|
+
type: 'options',
|
|
166
|
+
options: [
|
|
167
|
+
{ name: 'Not set', value: '' },
|
|
168
|
+
{ name: 'True (1)', value: 1 },
|
|
169
|
+
{ name: 'False (-1)', value: -1 },
|
|
170
|
+
],
|
|
171
|
+
default: '',
|
|
172
|
+
description: 'Filter by deletion flag (optional).',
|
|
173
|
+
},
|
|
174
|
+
// TagIds
|
|
175
|
+
{
|
|
176
|
+
displayName: 'Tag IDs',
|
|
177
|
+
name: 'TagIds',
|
|
178
|
+
type: 'string',
|
|
179
|
+
typeOptions: { multipleValues: true },
|
|
180
|
+
default: [],
|
|
181
|
+
description: 'Tag IDs (CSV / JSON array / [Array: [...]] / multi-lines).',
|
|
182
|
+
},
|
|
183
|
+
// Pagination
|
|
184
|
+
{
|
|
185
|
+
displayName: 'Limit',
|
|
186
|
+
name: 'Limit',
|
|
187
|
+
type: 'number',
|
|
188
|
+
default: 10,
|
|
189
|
+
description: 'Number of results to return.',
|
|
190
|
+
},
|
|
191
|
+
],
|
|
192
|
+
},
|
|
193
|
+
];
|
|
@@ -2,3 +2,5 @@ export { caseCreate } from './create.operation';
|
|
|
2
2
|
export { caseCreateProperties } from './create.properties';
|
|
3
3
|
export { caseUpdate } from './update.operation';
|
|
4
4
|
export { caseUpdateProperties } from './update.properties';
|
|
5
|
+
export { caseSearch } from './search.operation';
|
|
6
|
+
export { caseSearchProperties } from './search.properties';
|
package/dist/nodes/case/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.caseUpdateProperties = exports.caseUpdate = exports.caseCreateProperties = exports.caseCreate = void 0;
|
|
3
|
+
exports.caseSearchProperties = exports.caseSearch = exports.caseUpdateProperties = exports.caseUpdate = exports.caseCreateProperties = exports.caseCreate = void 0;
|
|
4
4
|
// nodes/case/index.ts
|
|
5
5
|
var create_operation_1 = require("./create.operation");
|
|
6
6
|
Object.defineProperty(exports, "caseCreate", { enumerable: true, get: function () { return create_operation_1.caseCreate; } });
|
|
@@ -10,3 +10,7 @@ var update_operation_1 = require("./update.operation");
|
|
|
10
10
|
Object.defineProperty(exports, "caseUpdate", { enumerable: true, get: function () { return update_operation_1.caseUpdate; } });
|
|
11
11
|
var update_properties_1 = require("./update.properties");
|
|
12
12
|
Object.defineProperty(exports, "caseUpdateProperties", { enumerable: true, get: function () { return update_properties_1.caseUpdateProperties; } });
|
|
13
|
+
var search_operation_1 = require("./search.operation");
|
|
14
|
+
Object.defineProperty(exports, "caseSearch", { enumerable: true, get: function () { return search_operation_1.caseSearch; } });
|
|
15
|
+
var search_properties_1 = require("./search.properties");
|
|
16
|
+
Object.defineProperty(exports, "caseSearchProperties", { enumerable: true, get: function () { return search_properties_1.caseSearchProperties; } });
|