@tiledesk/tiledesk-server 2.3.89 → 2.3.91
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiledesk/tiledesk-server",
|
|
3
3
|
"description": "The Tiledesk server module",
|
|
4
|
-
"version": "2.3.
|
|
4
|
+
"version": "2.3.91",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "node ./bin/www",
|
|
7
7
|
"pretest": "mongodb-runner start",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@tiledesk/tiledesk-json-rules-engine": "^4.0.3",
|
|
44
44
|
"@tiledesk/tiledesk-kaleyra-proxy": "^0.1.7",
|
|
45
45
|
"@tiledesk/tiledesk-rasa-connector": "^1.0.10",
|
|
46
|
-
"@tiledesk/tiledesk-tybot-connector": "^0.1.
|
|
46
|
+
"@tiledesk/tiledesk-tybot-connector": "^0.1.59",
|
|
47
47
|
"@tiledesk/tiledesk-whatsapp-connector": "^0.1.33",
|
|
48
48
|
"amqplib": "^0.5.5",
|
|
49
49
|
"app-root-path": "^3.0.0",
|
|
@@ -91,22 +91,20 @@ class SubscriptionNotifier {
|
|
|
91
91
|
if (alg) {
|
|
92
92
|
signOptions.algorithm = alg;
|
|
93
93
|
}
|
|
94
|
-
|
|
95
|
-
secret = process.env.GLOBAL_SECRET || config.secret;
|
|
94
|
+
var tokensecret = process.env.GLOBAL_SECRET || config.secret;
|
|
96
95
|
var pKey = process.env.GLOBAL_SECRET_OR_PRIVATE_KEY;
|
|
97
96
|
// console.log("pKey",pKey);
|
|
98
97
|
|
|
99
98
|
if (pKey) {
|
|
100
|
-
|
|
99
|
+
tokensecret = pKey.replace(/\\n/g, '\n');
|
|
101
100
|
}
|
|
102
101
|
|
|
103
|
-
|
|
104
102
|
}
|
|
105
103
|
|
|
106
|
-
var token = jwt.sign(sJson,
|
|
104
|
+
var token = jwt.sign(sJson, tokensecret, signOptions); //priv_jwt pp_jwt
|
|
107
105
|
json["token"] = token;
|
|
108
106
|
|
|
109
|
-
|
|
107
|
+
winston.debug("Calling subscription " + s.event + " TO " + s.target + " with secret " +secret+ " with json " , json);
|
|
110
108
|
// for sync use no retry
|
|
111
109
|
|
|
112
110
|
request({
|
|
@@ -120,14 +118,15 @@ class SubscriptionNotifier {
|
|
|
120
118
|
json: json,
|
|
121
119
|
method: 'POST'
|
|
122
120
|
|
|
123
|
-
}, function(err, response,
|
|
124
|
-
winston.debug("SENT " + s.event + " TO " + s.target
|
|
121
|
+
}, function(err, response, jsonResponse){
|
|
122
|
+
winston.debug("subscription notifier SENT " + s.event + " TO " + s.target + " with error " , err);
|
|
125
123
|
winston.debug("SubscriptionLog response", response);
|
|
126
|
-
winston.debug("SubscriptionLog
|
|
124
|
+
winston.debug("SubscriptionLog jsonResponse", jsonResponse);
|
|
127
125
|
|
|
128
126
|
var subscriptionLog = new SubscriptionLog({event: s.event, target: s.target,
|
|
129
127
|
response: JSON.stringify(response),
|
|
130
|
-
body: JSON.stringify(
|
|
128
|
+
body: JSON.stringify(jsonResponse),
|
|
129
|
+
jsonRequest: JSON.stringify(json),
|
|
131
130
|
err: err, id_project:s.id_project});
|
|
132
131
|
|
|
133
132
|
subscriptionLog.save(function (errSL, sl) {
|
|
@@ -139,9 +138,9 @@ class SubscriptionNotifier {
|
|
|
139
138
|
});
|
|
140
139
|
|
|
141
140
|
if (err) {
|
|
142
|
-
winston.error("Error sending webhook for event " + s.event + " TO " + s.target
|
|
141
|
+
winston.error("Error sending webhook for event " + s.event + " TO " + s.target + " with error " , err);
|
|
143
142
|
if (callback) {
|
|
144
|
-
callback(err,
|
|
143
|
+
callback(err, jsonResponse);
|
|
145
144
|
}
|
|
146
145
|
|
|
147
146
|
}
|
|
@@ -149,7 +148,7 @@ class SubscriptionNotifier {
|
|
|
149
148
|
// console.log("callback qui1", callback);
|
|
150
149
|
if (callback) {
|
|
151
150
|
// console.log("callback qui", json);
|
|
152
|
-
callback(null,
|
|
151
|
+
callback(null, jsonResponse);
|
|
153
152
|
}
|
|
154
153
|
|
|
155
154
|
});
|
|
@@ -480,7 +479,7 @@ class SubscriptionNotifier {
|
|
|
480
479
|
subscriptionNotifier.findSubscriber(eventName, payload.id_project).then(function(subscriptions) {
|
|
481
480
|
//winston.debug("Subscription.notify subscriptionNotifier", subscriptions.length);
|
|
482
481
|
if (subscriptions && subscriptions.length>0) {
|
|
483
|
-
winston.debug("Subscription.notify", eventName, payload , "length", subscriptions.length);
|
|
482
|
+
winston.debug("found Subscription.notify", eventName, payload , "length", subscriptions.length);
|
|
484
483
|
subscriptionNotifier.notify(subscriptions, payload, callback);
|
|
485
484
|
} else {
|
|
486
485
|
if (callback) {
|