wingbot 3.63.0 → 3.64.0-alpha.1

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.63.0",
3
+ "version": "3.64.0-alpha.1",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -54,6 +54,7 @@
54
54
  },
55
55
  "dependencies": {
56
56
  "@amplitude/ua-parser-js": "^0.7.33",
57
+ "compress-json": "^2.1.2",
57
58
  "deep-extend": "^0.6.0",
58
59
  "form-data": "^4.0.0",
59
60
  "graphql": "^15.8.0",
@@ -67,4 +68,4 @@
67
68
  "axios": "^0.21.1",
68
69
  "handlebars": "^4.0.0"
69
70
  }
70
- }
71
+ }
@@ -31,9 +31,9 @@ module.exports = (params) => {
31
31
  });
32
32
 
33
33
  const typeOk = (!params.type || params.type === 'any')
34
- || (req.attachments.every((a) => a.type === params.type) && suffixOk);
34
+ || (req.attachments.every((a) => a.type === params.type));
35
35
 
36
- if (!typeOk) {
36
+ if (!typeOk || !suffixOk) {
37
37
  await res.run('badType');
38
38
  return Router.NEXT;
39
39
  }
@@ -3,6 +3,7 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
+ const { decompress } = require('compress-json');
6
7
  const { default: fetch } = require('node-fetch');
7
8
  const assert = require('assert');
8
9
  const path = require('path');
@@ -374,7 +375,8 @@ class BuildRouter extends Router {
374
375
  auth = await Promise.resolve(this._loadBotAuthorization);
375
376
  Object.assign(options, {
376
377
  headers: {
377
- Authorization: auth
378
+ Authorization: auth,
379
+ 'X-Compressed-Blocks': '1'
378
380
  }
379
381
  });
380
382
  }
@@ -402,6 +404,10 @@ class BuildRouter extends Router {
402
404
 
403
405
  const snapshot = await response.json();
404
406
 
407
+ if (snapshot && snapshot.compressedBlocks) {
408
+ snapshot.blocks = decompress(snapshot.compressedBlocks);
409
+ }
410
+
405
411
  this._validateBlocks(snapshot && snapshot.blocks, 'load');
406
412
 
407
413
  return snapshot;