@tiledesk/tiledesk-tybot-connector 2.0.11 → 2.0.12-rc1
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/Logger.js +28 -16
- package/logs/app2.log +1882 -0
- package/package.json +3 -2
- package/tiledeskChatbotPlugs/DirectivesChatbotPlug.js +7 -0
- package/tiledeskChatbotPlugs/directives/DirAddTags.js +17 -11
- package/tiledeskChatbotPlugs/directives/DirAiPrompt.js +18 -2
- package/tiledeskChatbotPlugs/directives/DirAskGPT.js +2 -2
- package/tiledeskChatbotPlugs/directives/DirAskGPTV2.js +18 -2
- package/tiledeskChatbotPlugs/directives/DirAssign.js +0 -9
- package/tiledeskChatbotPlugs/directives/DirAssignFromFunction.js +1 -8
- package/tiledeskChatbotPlugs/directives/DirAssistant.js +13 -3
- package/tiledeskChatbotPlugs/directives/DirBrevo.js +11 -8
- package/tiledeskChatbotPlugs/directives/DirCaptureUserReply.js +10 -1
- package/tiledeskChatbotPlugs/directives/DirClearTranscript.js +5 -0
- package/tiledeskChatbotPlugs/directives/DirClose.js +8 -9
- package/tiledeskChatbotPlugs/directives/DirCode.js +9 -1
- package/tiledeskChatbotPlugs/directives/DirCondition.js +13 -1
- package/tiledeskChatbotPlugs/directives/DirContactUpdate.js +7 -9
- package/tiledeskChatbotPlugs/directives/DirCustomerio.js +11 -2
- package/tiledeskChatbotPlugs/directives/DirDeflectToHelpCenter.js +1 -7
- package/tiledeskChatbotPlugs/directives/DirDeleteVariable.js +14 -1
- package/tiledeskChatbotPlugs/directives/DirDepartment.js +13 -9
- package/tiledeskChatbotPlugs/directives/DirFireTiledeskEvent.js +2 -8
- package/tiledeskChatbotPlugs/directives/DirFlowLog.js +88 -0
- package/tiledeskChatbotPlugs/directives/DirForm.js +3 -10
- package/tiledeskChatbotPlugs/directives/DirGptTask.js +19 -7
- package/tiledeskChatbotPlugs/directives/DirGptTask_OLD.js +2 -1
- package/tiledeskChatbotPlugs/directives/DirHubspot.js +12 -3
- package/tiledeskChatbotPlugs/directives/DirIfOnlineAgents.js +3 -9
- package/tiledeskChatbotPlugs/directives/DirIfOnlineAgentsV2.js +12 -10
- package/tiledeskChatbotPlugs/directives/DirIfOpenHours.js +11 -1
- package/tiledeskChatbotPlugs/directives/DirIfOpenHours_OLD.js +3 -9
- package/tiledeskChatbotPlugs/directives/DirJSONCondition.js +14 -4
- package/tiledeskChatbotPlugs/directives/DirMake.js +6 -1
- package/tiledeskChatbotPlugs/directives/DirMessage.js +1 -7
- package/tiledeskChatbotPlugs/directives/DirMoveToAgent.js +5 -9
- package/tiledeskChatbotPlugs/directives/DirMoveToUnassigned.js +6 -9
- package/tiledeskChatbotPlugs/directives/DirQapla.js +7 -3
- package/tiledeskChatbotPlugs/directives/DirRandomReply.js +7 -9
- package/tiledeskChatbotPlugs/directives/DirRemoveCurrentBot.js +1 -7
- package/tiledeskChatbotPlugs/directives/DirReplaceBot.js +7 -9
- package/tiledeskChatbotPlugs/directives/DirReplaceBotV2.js +7 -9
- package/tiledeskChatbotPlugs/directives/DirReplaceBotV3.js +7 -9
- package/tiledeskChatbotPlugs/directives/DirReply.js +9 -16
- package/tiledeskChatbotPlugs/directives/DirReplyV2.js +8 -10
- package/tiledeskChatbotPlugs/directives/DirSendEmail.js +7 -9
- package/tiledeskChatbotPlugs/directives/DirSendWhatsapp.js +7 -2
- package/tiledeskChatbotPlugs/directives/DirSetAttributeV2.js +7 -1
- package/tiledeskChatbotPlugs/directives/DirSetConversationTags.js +2 -8
- package/tiledeskChatbotPlugs/directives/DirWait.js +6 -1
- package/tiledeskChatbotPlugs/directives/DirWebRequestV2.js +20 -5
- package/tiledeskChatbotPlugs/directives/DirWebRequestV2_old.js +2 -1
- package/tiledeskChatbotPlugs/directives/DirWebResponse.js +8 -40
- package/tiledeskChatbotPlugs/directives/DirWhatsappByAttribute.js +7 -1
- package/tiledeskChatbotPlugs/directives/Directives.js +1 -0
- package/utils/TiledeskChatbotUtil.js +2 -2
package/Logger.js
CHANGED
|
@@ -2,11 +2,14 @@ let { Publisher } = require("@tiledesk/tiledesk-multi-worker");
|
|
|
2
2
|
|
|
3
3
|
const FLOW_LOGS_ENABLED = process.env.FLOW_LOGS_ENABLED;
|
|
4
4
|
const AMQP_MANAGER_URL = process.env.AMQP_MANAGER_URL;
|
|
5
|
+
const LOGS_BASE_ROUTING_KEY = process.env.LOGS_BASE_ROUTING_KEY || "apps.tilechat.logs";
|
|
6
|
+
|
|
7
|
+
const levels = { error: 0, warn: 1, info: 2, debug: 3 };
|
|
8
|
+
|
|
5
9
|
let publisher = new Publisher(AMQP_MANAGER_URL, {
|
|
6
10
|
debug: false,
|
|
7
11
|
queueName: "logs_queue",
|
|
8
|
-
exchange: "
|
|
9
|
-
topic: "logs",
|
|
12
|
+
exchange: "amq.topic"
|
|
10
13
|
})
|
|
11
14
|
|
|
12
15
|
class Logger {
|
|
@@ -33,17 +36,15 @@ class Logger {
|
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
this.request_id = config.request_id;
|
|
39
|
+
this.intent_id = config.intent_id;
|
|
40
|
+
|
|
36
41
|
this.dev = false;
|
|
37
42
|
if (config.dev && config.dev === true) {
|
|
38
43
|
this.dev = true;
|
|
44
|
+
} else {
|
|
45
|
+
this._disableDebugMethods()
|
|
39
46
|
}
|
|
40
|
-
|
|
41
|
-
// if (!AMQP_MANAGER_URL) {
|
|
42
|
-
// console.error('AMQP_MANAGER_URL is undefined. Logger not available...');
|
|
43
|
-
// return;
|
|
44
|
-
// //throw new Error("Error starting logger: AMQP_MANAGER_URL is undefined.")
|
|
45
|
-
// }
|
|
46
|
-
|
|
47
|
+
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
error(...args) {
|
|
@@ -74,21 +75,27 @@ class Logger {
|
|
|
74
75
|
|
|
75
76
|
let data = {
|
|
76
77
|
request_id: this.request_id,
|
|
78
|
+
id_project: this.request_id.split("-")[2],
|
|
79
|
+
intent_id: this.intent_id,
|
|
77
80
|
text: text,
|
|
78
81
|
level: level,
|
|
82
|
+
nlevel: levels[level],
|
|
79
83
|
timestamp: new Date(),
|
|
80
84
|
dev: this.dev
|
|
81
85
|
}
|
|
82
86
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
+
if (this.request_id.startsWith('automation') && this.request_id.split("-")[4]) {
|
|
88
|
+
data.webhook_id = this.request_id.split("-")[4];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
let topic = LOGS_BASE_ROUTING_KEY + `.${this.request_id}`;
|
|
92
|
+
publisher.publish(data, topic);
|
|
93
|
+
return;
|
|
87
94
|
}
|
|
88
95
|
|
|
89
96
|
formatLog(args) {
|
|
90
97
|
return args
|
|
91
|
-
.map(arg => (typeof arg === "object" ? JSON.stringify(arg, null, 2) : arg
|
|
98
|
+
.map(arg => (typeof arg === "object" ? JSON.stringify(arg, null, 2) : arg))
|
|
92
99
|
.join(" ")
|
|
93
100
|
}
|
|
94
101
|
|
|
@@ -96,9 +103,14 @@ class Logger {
|
|
|
96
103
|
_disableMethods() {
|
|
97
104
|
const methods = ['error', 'warn', 'info', 'debug'];
|
|
98
105
|
methods.forEach(method => {
|
|
99
|
-
|
|
106
|
+
this[method] = () => { };
|
|
100
107
|
});
|
|
101
|
-
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
_disableDebugMethods() {
|
|
111
|
+
const method = 'debug';
|
|
112
|
+
this[method] = () => { };
|
|
113
|
+
}
|
|
102
114
|
|
|
103
115
|
}
|
|
104
116
|
|