wingbot 3.52.2 → 3.52.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wingbot",
3
- "version": "3.52.2",
3
+ "version": "3.52.4",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/Processor.js CHANGED
@@ -241,14 +241,14 @@ class Processor extends EventEmitter {
241
241
  }
242
242
 
243
243
  _createPostBack (postbackAcumulator, req, res, features) {
244
- const postBack = (action, inputData = {}, dontWaitTillEndOfLoop = false) => {
244
+ const postBack = (action, inputData = {}, dispatchSync = false) => {
245
245
  let data = inputData;
246
246
  if (typeof data === 'function') {
247
247
  // @ts-ignore
248
248
  data = data();
249
249
  }
250
250
 
251
- if (dontWaitTillEndOfLoop) {
251
+ if (dispatchSync) {
252
252
  let previousAction;
253
253
  return Promise.resolve(data)
254
254
  .then((resolvedData) => {
@@ -283,7 +283,7 @@ class Processor extends EventEmitter {
283
283
  postbackAcumulator.push({ action, data, features });
284
284
  }
285
285
 
286
- return Promise.resolve();
286
+ return Promise.resolve(undefined);
287
287
  };
288
288
 
289
289
  return postBack;
package/src/Router.js CHANGED
@@ -15,18 +15,48 @@ function defaultPathContext () {
15
15
  }
16
16
 
17
17
  /**
18
- *
18
+ * @typedef {true|false|null|undefined|-1|void} RoutingInstruction
19
+ */
20
+
21
+ /**
22
+ * @callback PostBackDataCallback
23
+ * @returns {object|Promise<object>}
24
+ */
25
+
26
+ /**
27
+ * @callback PostBack postback function
28
+ * @param {string} [action]
29
+ * @param {object|PostBackDataCallback} [data]
30
+ * @param {boolean} [dispatchSync]
31
+ * @returns {Promise<RoutingInstruction>}
32
+ */
33
+
34
+ /**
19
35
  * @template {object} [S=object]
20
36
  * @template {object} [C=object]
21
37
  * @callback Resolver processing function
22
38
  * @param {Request<S,C>} [req]
23
39
  * @param {Responder} [res]
24
- * @param {Function} [postBack]
40
+ * @param {PostBack} [postBack]
41
+ * @returns {RoutingInstruction|Promise<RoutingInstruction>}
25
42
  */
26
43
 
27
44
  /**
45
+ * @template {object} [S=object]
46
+ * @template {object} [C=object]
47
+ * @callback Reduce processing function
48
+ * @param {Request<S,C>} [req]
49
+ * @param {Responder} [res]
50
+ * @param {PostBack} [postBack]
51
+ * @param {string} [path]
52
+ * @returns {Promise<RoutingInstruction>}
53
+ */
54
+
55
+ /**
56
+ * @template {object} [S=object]
57
+ * @template {object} [C=object]
28
58
  * @typedef {object} IRouter
29
- * @prop {Function} reduce
59
+ * @prop {Reduce<S,C>} reduce
30
60
  */
31
61
 
32
62
  /**