n8n-nodes-didar-crm 0.0.3 → 0.0.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/lib/http.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.didarRequest = didarRequest;
|
|
4
4
|
async function didarRequest(that, i, opts) {
|
|
5
|
-
var _a, _b, _c;
|
|
5
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
6
6
|
const creds = await that.getCredentials('didarApi');
|
|
7
7
|
const baseUrl = creds.baseUrl;
|
|
8
8
|
const apiKey = creds.apiKey;
|
|
@@ -29,8 +29,11 @@ async function didarRequest(that, i, opts) {
|
|
|
29
29
|
return (await that.helpers.httpRequest(options));
|
|
30
30
|
}
|
|
31
31
|
catch (err) {
|
|
32
|
+
// تلاش برای استخراج پیام سرور
|
|
32
33
|
const status = (_b = (_a = err === null || err === void 0 ? void 0 : err.statusCode) !== null && _a !== void 0 ? _a : err === null || err === void 0 ? void 0 : err.code) !== null && _b !== void 0 ? _b : 'ERR';
|
|
33
34
|
const msg = (_c = err === null || err === void 0 ? void 0 : err.message) !== null && _c !== void 0 ? _c : 'Request failed';
|
|
34
|
-
|
|
35
|
+
const data = (_h = (_g = (_e = (_d = err === null || err === void 0 ? void 0 : err.response) === null || _d === void 0 ? void 0 : _d.body) !== null && _e !== void 0 ? _e : (_f = err === null || err === void 0 ? void 0 : err.response) === null || _f === void 0 ? void 0 : _f.data) !== null && _g !== void 0 ? _g : err === null || err === void 0 ? void 0 : err.error) !== null && _h !== void 0 ? _h : '';
|
|
36
|
+
const details = typeof data === 'string' ? data : JSON.stringify(data);
|
|
37
|
+
throw new Error(`[Didar] ${opts.method} ${opts.path} → ${status}: ${msg}\nServer says: ${details}`);
|
|
35
38
|
}
|
|
36
39
|
}
|
|
@@ -298,13 +298,6 @@ class DidarCrm {
|
|
|
298
298
|
default: '0',
|
|
299
299
|
description: 'Deal price/amount.',
|
|
300
300
|
},
|
|
301
|
-
{
|
|
302
|
-
displayName: 'Currency ID',
|
|
303
|
-
name: 'CurrencyId',
|
|
304
|
-
type: 'string',
|
|
305
|
-
default: '',
|
|
306
|
-
description: 'Currency ID for the deal.',
|
|
307
|
-
},
|
|
308
301
|
{
|
|
309
302
|
displayName: 'Visibility Type',
|
|
310
303
|
name: 'VisibilityType',
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.dealCreate = dealCreate;
|
|
4
4
|
const http_1 = require("../../lib/http");
|
|
5
5
|
async function dealCreate(i, returnData) {
|
|
6
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
|
6
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
7
7
|
// --- Required composed: Owner / Pipeline / Stage ---
|
|
8
8
|
const ownerMode = this.getNodeParameter('OwnerMode', i);
|
|
9
9
|
const ownerId = ownerMode === 'select'
|
|
@@ -46,8 +46,7 @@ async function dealCreate(i, returnData) {
|
|
|
46
46
|
const lostReasonOther = (_f = add.LostReasonOther) !== null && _f !== void 0 ? _f : '';
|
|
47
47
|
const creatorId = (_g = add.CreatorId) !== null && _g !== void 0 ? _g : ownerId;
|
|
48
48
|
const price = (_h = add.Price) !== null && _h !== void 0 ? _h : '0';
|
|
49
|
-
const
|
|
50
|
-
const visibilityType = (_k = add.VisibilityType) !== null && _k !== void 0 ? _k : '1';
|
|
49
|
+
const visibilityType = (_j = add.VisibilityType) !== null && _j !== void 0 ? _j : '1';
|
|
51
50
|
// Custom fields
|
|
52
51
|
let fields;
|
|
53
52
|
if (typeof add.Fields === 'string' && add.Fields.trim()) {
|
|
@@ -76,7 +75,6 @@ async function dealCreate(i, returnData) {
|
|
|
76
75
|
LostReasonNote: lostReasonNote,
|
|
77
76
|
LostReasonOther: lostReasonOther,
|
|
78
77
|
Price: price,
|
|
79
|
-
CurrencyId: currencyId,
|
|
80
78
|
VisibilityType: visibilityType,
|
|
81
79
|
Status: status,
|
|
82
80
|
};
|