n8n-nodes-didar-crm 0.0.27 → 0.0.29
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.
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.dealCreate = dealCreate;
|
|
4
4
|
const http_1 = require("../../lib/http");
|
|
5
|
+
// تابع اعتبارسنجی GUID
|
|
6
|
+
const validateGuid = (value, fieldName) => {
|
|
7
|
+
if (!value)
|
|
8
|
+
return; // اگر خالی باشد، اجازه میدهیم (اعتبارسنجی وجود در جای دیگر انجام میشود)
|
|
9
|
+
const guidRegex = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
|
|
10
|
+
if (!guidRegex.test(value.trim())) {
|
|
11
|
+
throw new Error(`${fieldName} must be a valid GUID format (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).`);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
5
14
|
const parseJsonArrayFlexible = (val, fieldLabel = 'DealItems') => {
|
|
6
15
|
if (val == null || val === '')
|
|
7
16
|
return [];
|
|
@@ -143,9 +152,11 @@ async function dealCreate(i, returnData) {
|
|
|
143
152
|
const personId = this.getNodeParameter('PersonId', i, '');
|
|
144
153
|
if (!personId)
|
|
145
154
|
throw new Error('PersonId is required.');
|
|
155
|
+
validateGuid(personId, 'PersonId');
|
|
146
156
|
const companyId = this.getNodeParameter('CompanyId', i, '');
|
|
147
157
|
if (!companyId)
|
|
148
158
|
throw new Error('CompanyId is required.');
|
|
159
|
+
validateGuid(companyId, 'CompanyId');
|
|
149
160
|
const status = this.getNodeParameter('Status', i, '');
|
|
150
161
|
if (!status)
|
|
151
162
|
throw new Error('Status is required.');
|
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.dealUpdate = dealUpdate;
|
|
4
4
|
const http_1 = require("../../lib/http");
|
|
5
|
+
// تابع اعتبارسنجی GUID
|
|
6
|
+
const validateGuid = (value, fieldName) => {
|
|
7
|
+
if (!value)
|
|
8
|
+
return; // اگر خالی باشد، اجازه میدهیم (اعتبارسنجی وجود در جای دیگر انجام میشود)
|
|
9
|
+
const guidRegex = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
|
|
10
|
+
if (!guidRegex.test(value.trim())) {
|
|
11
|
+
throw new Error(`${fieldName} must be a valid GUID format (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).`);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
5
14
|
const parseJsonArrayFlexible = (val, fieldLabel = 'DealItems') => {
|
|
6
15
|
if (val == null || val === '')
|
|
7
16
|
return [];
|
|
@@ -149,9 +158,11 @@ async function dealUpdate(i, returnData) {
|
|
|
149
158
|
const personId = this.getNodeParameter('PersonId', i, '');
|
|
150
159
|
if (!personId)
|
|
151
160
|
throw new Error('PersonId is required.');
|
|
161
|
+
validateGuid(personId, 'PersonId');
|
|
152
162
|
const companyId = this.getNodeParameter('CompanyId', i, '');
|
|
153
163
|
if (!companyId)
|
|
154
164
|
throw new Error('CompanyId is required.');
|
|
165
|
+
validateGuid(companyId, 'CompanyId');
|
|
155
166
|
const status = this.getNodeParameter('Status', i, '');
|
|
156
167
|
if (!status)
|
|
157
168
|
throw new Error('Status is required.');
|
|
@@ -11,6 +11,6 @@ exports.personGetByPhoneProperties = [
|
|
|
11
11
|
required: true,
|
|
12
12
|
displayOptions: showForPersonGetByPhone,
|
|
13
13
|
description: 'The mobile phone number to look up (exact match).',
|
|
14
|
-
placeholder: '
|
|
14
|
+
placeholder: 'Enter a mobile phone for lookup (e.g. 0939xxxxxxx)',
|
|
15
15
|
},
|
|
16
16
|
];
|