@tiledesk/tiledesk-server 2.4.90 → 2.4.91

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,9 @@
5
5
  🚀 IN PRODUCTION 🚀
6
6
  (https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.77)
7
7
 
8
+ # 2.4.91
9
+ - Bug fix: globals will no longer exported in chatbot export
10
+
8
11
  # 2.4.90
9
12
  - Updated tybot-connector to 0.2.45
10
13
 
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.4.90",
4
+ "version": "2.4.91",
5
5
  "scripts": {
6
6
  "start": "node ./bin/www",
7
7
  "pretest": "mongodb-runner start",
package/routes/faq_kb.js CHANGED
@@ -988,6 +988,10 @@ router.get('/exportjson/:id_faq_kb', (req, res) => {
988
988
  // delete from exclude map intent_id
989
989
  const intents = faqs.map(({ _id, id_project, topic, status, id_faq_kb, createdBy, createdAt, updatedAt, __v, ...keepAttrs }) => keepAttrs)
990
990
 
991
+ if (faq_kb.attributes) {
992
+ delete faq_kb.attributes.globals;
993
+ }
994
+
991
995
  let json = {
992
996
  webhook_enabled: faq_kb.webhook_enabled,
993
997
  webhook_url: faq_kb.webhook_url,
@@ -1013,6 +1017,7 @@ router.get('/exportjson/:id_faq_kb', (req, res) => {
1013
1017
  // return res.status(200).send(json);
1014
1018
  // }
1015
1019
  let json_string = JSON.stringify(json);
1020
+ console.log("json_string: ", json_string)
1016
1021
  res.set({ "Content-Disposition": "attachment; filename=\"bot.json\"" });
1017
1022
  return res.send(json_string);
1018
1023
  }
@@ -766,7 +766,7 @@ describe('FaqKBRoute', () => {
766
766
  })
767
767
 
768
768
 
769
- it('export json', (done) => {
769
+ it('exportjson', (done) => {
770
770
 
771
771
 
772
772
  // this.timeout();
@@ -795,28 +795,40 @@ describe('FaqKBRoute', () => {
795
795
  }
796
796
 
797
797
  chai.request(server)
798
- .get('/' + savedProject._id + '/faq?id_faq_kb=' + id_faq_kb)
799
- .auth(email, pwd)
800
- .end((err, res) => {
801
- if (log) {
802
- console.log("faq_list: ", res.body);
803
- }
804
- res.should.have.status(200);
805
- res.body.should.be.an('array').that.is.not.empty;
806
-
807
- chai.request(server)
808
- .get('/' + savedProject._id + '/faq_kb/exportjson/' + id_faq_kb)
809
- .auth(email, pwd)
810
- .end((err, res) => {
811
- if (log) {
798
+ .get('/' + savedProject._id + '/faq?id_faq_kb=' + id_faq_kb)
799
+ .auth(email, pwd)
800
+ .end((err, res) => {
801
+ if (log) {
802
+ console.log("faq_list: ", res.body);
803
+ }
804
+ res.should.have.status(200);
805
+ res.body.should.be.an('array').that.is.not.empty;
806
+
807
+ chai.request(server)
808
+ .get('/' + savedProject._id + '/faq_kb/exportjson/' + id_faq_kb)
809
+ .auth(email, pwd)
810
+ .end((err, res) => {
811
+ if (log) {
812
+ console.log("export json res: ", res.body);
813
+ }
812
814
  console.log("export json res: ", res.body);
813
- }
814
- res.should.have.status(200);
815
- //res.body.should.be.a('string');
815
+ res.should.have.status(200);
816
+ //res.body.should.be.a('string');
817
+
818
+ done();
819
+ })
820
+ })
821
+
822
+ // chai.request(server)
823
+ // .patch('/' + savedProject._id + '/faq_kb/' + id_faq_kb + '/attributes')
824
+ // .auth(email, pwd)
825
+ // .send({ variables: { var1: "var1", var2: "var2" }, globals: [{ key: 'test', value: 'test]'}] })
826
+ // .end((err, res) => {
827
+ // console.log("res.body: ", res.body)
828
+
829
+
830
+ // })
816
831
 
817
- done();
818
- })
819
- })
820
832
  });
821
833
  });
822
834
  });