@tiledesk/tiledesk-tybot-connector 0.2.132 → 0.2.133

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/CHANGELOG.md CHANGED
@@ -17,6 +17,9 @@ available on:
17
17
  - Added flowError on JSONCondition when result = null
18
18
  - Added fix on Filler -->
19
19
 
20
+ # v0.2.133
21
+ - Removed MAX_STEPS and MAX_EXECUTION_TIME as static variable of TiledeskChatbot
22
+
20
23
  # v0.2.132
21
24
  - Added support for external API_ENDPOINT
22
25
  - Removed logs
package/index.js CHANGED
@@ -21,6 +21,8 @@ router.use(bodyParser.urlencoded({ extended: true , limit: '50mb'}));
21
21
 
22
22
  let log = false;
23
23
  let tdcache = null;
24
+ let MAX_STEPS = 1000;
25
+ let MAX_EXECUTION_TIME = 1000 * 3600 * 8;
24
26
 
25
27
  // DEV
26
28
  // const { MessagePipeline } = require('./tiledeskChatbotPlugs/MessagePipeline');
@@ -165,6 +167,8 @@ router.post('/ext/:botid', async (req, res) => {
165
167
  tdcache: tdcache,
166
168
  requestId: requestId,
167
169
  projectId: projectId,
170
+ MAX_STEPS: MAX_STEPS,
171
+ MAX_EXECUTION_TIME: MAX_EXECUTION_TIME,
168
172
  log: log
169
173
  });
170
174
  if (log) {console.log("MESSAGE CONTAINS:", message.text);}
@@ -638,6 +642,19 @@ async function startApp(settings, completionCallback) {
638
642
  log = true;
639
643
  }
640
644
  console.log("(Tilebot) log:", log);
645
+
646
+
647
+ if (process.env.CHATBOT_MAX_STEPS) {
648
+ MAX_STEPS = Number(process.env.CHATBOT_MAX_STEPS);
649
+ }
650
+
651
+ if (process.env.CHATBOT_MAX_EXECUTION_TIME) {
652
+ MAX_EXECUTION_TIME = Number(process.env.CHATBOT_MAX_EXECUTION_TIME);// test // prod1000 * 3600 * 4; // 4 hours
653
+ }
654
+
655
+ console.log("(Tilebot) MAX_STEPS: ", MAX_STEPS)
656
+ console.log("(Tilebot) MAX_EXECUTION_TIME: ", MAX_EXECUTION_TIME)
657
+
641
658
  var pjson = require('./package.json');
642
659
  console.log("(Tilebot) Starting Tilebot connector v" + pjson.version);
643
660
 
@@ -12,8 +12,8 @@ const { DirUnlockIntent } = require('../tiledeskChatbotPlugs/directives/DirUnloc
12
12
 
13
13
  class TiledeskChatbot {
14
14
 
15
- static MAX_STEPS = process.env.CHATBOT_MAX_STEPS || 1000; // prod 1000;
16
- static MAX_EXECUTION_TIME = process.env.CHATBOT_MAX_EXECUTION_TIME || 1000 * 3600 * 8;// test // prod1000 * 3600 * 4; // 4 hours
15
+ // static MAX_STEPS = process.env.CHATBOT_MAX_STEPS || 1000; // prod 1000;
16
+ // static MAX_EXECUTION_TIME = process.env.CHATBOT_MAX_EXECUTION_TIME || 1000 * 3600 * 8;// test // prod1000 * 3600 * 4; // 4 hours
17
17
 
18
18
  constructor(config) {
19
19
  if (!config.botsDataSource) {
@@ -39,6 +39,8 @@ class TiledeskChatbot {
39
39
  this.APIKEY = config.APIKEY;
40
40
  this.requestId = config.requestId;
41
41
  this.projectId = config.projectId;
42
+ this.MAX_STEPS = config.MAX_STEPS;
43
+ this.MAX_EXECUTION_TIME = config.MAX_EXECUTION_TIME;
42
44
  this.log = config.log;
43
45
  }
44
46
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-tybot-connector",
3
- "version": "0.2.132",
3
+ "version": "0.2.133",
4
4
  "description": "Tiledesk Tybot connector",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -178,7 +178,7 @@ class DirectivesChatbotPlug {
178
178
  async nextDirective(directives) {
179
179
  if (this.log) {console.log("....nextDirective() checkStep():");}
180
180
  const go_on = await TiledeskChatbot.checkStep(
181
- this.context.tdcache, this.context.requestId, TiledeskChatbot.MAX_STEPS, TiledeskChatbot.MAX_EXECUTION_TIME, this.log
181
+ this.context.tdcache, this.context.requestId, this.chatbot.MAX_STEPS, this.chatbot.MAX_EXECUTION_TIME, this.log
182
182
  );
183
183
  // const current_step = await TiledeskChatbot.currentStep(this.context.tdcache, this.context.requestId);
184
184
  // if (this.log) {console.log("........nextDirective() currentStep:", current_step);}