@tiledesk/tiledesk-server 2.4.20 → 2.4.22

Sign up to get free protection for your applications and to get access to all the features.
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.20",
4
+ "version": "2.4.22",
5
5
  "scripts": {
6
6
  "start": "node ./bin/www",
7
7
  "pretest": "mongodb-runner start",
@@ -18,6 +18,24 @@
18
18
  var RoleConstants = require("../../models/roleConstants");
19
19
 
20
20
 
21
+ function del(client, key, callback) {
22
+ winston.debug("here1")
23
+ client.del(key, function (err, data) {
24
+ if (err) {
25
+ return callback(error);
26
+ } else {
27
+ return callback(null, data);
28
+ }
29
+ });
30
+
31
+ // client.del(key).then(function(result) {
32
+ // winston.debug("here2")
33
+ // return callback(null, result);
34
+ // }).catch(function(error) {
35
+ // winston.debug("here3")
36
+ // return callback(error);
37
+ // });
38
+ }
21
39
 
22
40
  function listen(client) {
23
41
 
@@ -70,7 +88,9 @@
70
88
  setImmediate(() => {
71
89
  var key = "projects:id:"+project.id;
72
90
  winston.verbose("Deleting cache for project.delete with key: " + key);
73
- client.del(key, (err, reply) => {
91
+ // found del
92
+ del(client._cache._engine.client, key, function (err, reply) { //tested
93
+ // client.del(key, (err, reply) => {
74
94
  winston.debug("Deleted cache for project.delete",reply);
75
95
  winston.verbose("Deleted cache for project.delete",{err:err});
76
96
  });
@@ -239,7 +259,9 @@
239
259
 
240
260
  var key = "users:id:"+user.id;
241
261
  winston.verbose("Deleting cache for user.delete with key: " + key);
242
- client.del(key, (err, reply) => {
262
+ // found del
263
+ del(client._cache._engine.client, key, function (err, reply) { //tested
264
+ // client.del(key, (err, reply) => {
243
265
  winston.debug("Deleted cache for user.delete",reply);
244
266
  winston.verbose("Deleted cache for user.delete",{err:err});
245
267
  });
@@ -289,21 +311,27 @@
289
311
  function invalidatRequestSimple(client, project_id, rid, request_id) {
290
312
  var key = project_id+":requests:id:"+rid+":simple";
291
313
  winston.verbose("Deleting cache for widgets with key: " + key);
292
- client.del(key, function (err, reply) {
314
+ // found del
315
+ del(client._cache._engine.client, key, function (err, reply) { //tested
316
+ // client.del(key, function (err, reply) {
293
317
  winston.debug("Deleted cache for invalidatRequestSimple",reply);
294
318
  winston.verbose("Deleted cache for invalidatRequestSimple",{err:err});
295
319
  });
296
320
 
297
321
  key = "requests:request_id:"+request_id+":simple"; //without project for chat21 webhook
298
322
  winston.verbose("Creating cache for request.create.simple for invalidatRequestSimple without project with key : " + key);
299
- client.del(key, function (err, reply) {
323
+ // found del
324
+ del(client._cache._engine.client, key, function (err, reply) { //tested
325
+ // client.del(key, function (err, reply) {
300
326
  winston.debug("Deleted cache for invalidatRequestSimple",reply);
301
327
  winston.verbose("Deleted cache for invalidatRequestSimple",{err:err});
302
328
  });
303
329
 
304
330
  key = project_id+":requests:request_id:"+request_id+":simple";
305
331
  winston.verbose("Creating cache for request.create.simple for invalidatRequestSimple with key: " + key);
306
- client.del(key, function (err, reply) {
332
+ // found del
333
+ del(client._cache._engine.client, key, function (err, reply) { //tested
334
+ // client.del(key, function (err, reply) {
307
335
  winston.debug("Deleted cache for invalidatRequestSimple",reply);
308
336
  winston.verbose("Deleted cache for invalidatRequestSimple",{err:err});
309
337
  });
@@ -455,7 +483,10 @@
455
483
 
456
484
  key = faq_kb.id_project+":faq_kbs:id:"+faq_kb._id+":secret";
457
485
  winston.verbose("Deleting cache for faq_kb.update secret with key: " + key);
458
- client.del(key, function (err, reply) { //tested
486
+ // found del
487
+ // winston.info("quiqui", client._cache);
488
+ del(client._cache._engine.client, key, function (err, reply) { //tested
489
+ // client.del(key, function (err, reply) { //tested
459
490
  winston.debug("Deleted cache for faq_kb.update secret",reply);
460
491
  winston.verbose("Deleted cache for faq_kb.update secret",{err:err});
461
492
  });
@@ -463,7 +494,9 @@
463
494
  // without project for tilebot
464
495
  key = "faq_kbs:id:"+faq_kb._id;
465
496
  winston.verbose("Deleting cache for faq_kb.update without project for tilebot with key: " + key);
466
- client.del(key, function (err, reply) {
497
+ // found del
498
+ del(client._cache._engine.client, key, function (err, reply) { //tested
499
+ // client.del(key, function (err, reply) {
467
500
  winston.debug("Deleted cache for faq_kb.update without project for tilebot ",reply);
468
501
  winston.verbose("Deleted cache for faq_kb.update without project for tilebot ",{err:err});
469
502
  });
@@ -479,7 +512,9 @@
479
512
  setImmediate(() => {
480
513
  var key = faq_kb.id_project+":faq_kbs:id:"+faq_kb._id;
481
514
  winston.verbose("Deleting cache for faqbot.delete with key: " + key);
482
- client.del(key, (err, reply) => {
515
+ // found del
516
+ del(client._cache._engine.client, key, function (err, reply) { //tested
517
+ // client.del(key, (err, reply) => {
483
518
  winston.debug("Deleted cache for faqbot.delete",reply);
484
519
  winston.verbose("Deleted cache for faqbot.delete",{err:err});
485
520
  });
@@ -487,7 +522,9 @@
487
522
 
488
523
  key = faq_kb.id_project+":faq_kbs:id:"+faq_kb._id+":secret";
489
524
  winston.verbose("Deleting cache for faq_kb.delete secret with key: " + key);
490
- client.del(key, function (err, reply) {
525
+ // found del
526
+ del(client._cache._engine.client, key, function (err, reply) { //tested
527
+ // client.del(key, function (err, reply) {
491
528
  winston.debug("Deleted cache for faq_kb.delete secret",reply);
492
529
  winston.verbose("Deleted cache for faq_kb.delete secret",{err:err});
493
530
  });
@@ -496,7 +533,9 @@
496
533
  // without project for tilebot
497
534
  key = "faq_kbs:id:"+faq_kb._id;
498
535
  winston.verbose("Deleting cache for faq_kb.update without project for tilebot with key: " + key);
499
- client.del(key, function (err, reply) {
536
+ // found del
537
+ del(client._cache._engine.client, key, function (err, reply) { //tested
538
+ // client.del(key, function (err, reply) {
500
539
  winston.debug("Deleted cache for faq_kb.update without project for tilebot ",reply);
501
540
  winston.verbose("Deleted cache for faq_kb.update without project for tilebot ",{err:err});
502
541
  });
@@ -592,7 +631,9 @@
592
631
  setImmediate(() => {
593
632
  var key = department.id_project+":departments:id:"+department._id;
594
633
  winston.verbose("Deleting cache for department.delete with key: " + key);
595
- client.del(key, (err, reply) => {
634
+ // found del
635
+ del(client._cache._engine.client, key, function (err, reply) { //tested
636
+ // client.del(key, (err, reply) => {
596
637
  winston.debug("Deleted cache for department.delete",reply);
597
638
  winston.verbose("Deleted cache for department.delete",{err:err});
598
639
  });
@@ -679,7 +720,9 @@
679
720
  // elimina delete con * e fai cancellazione puntuale
680
721
  var key =trigger.id_project+":subscriptions:*";
681
722
  winston.verbose("Deleting cache for subscription.create with key: " + key);
682
- client.del(key, function (err, reply) {
723
+ // found del
724
+ del(client._cache._engine.client, key, function (err, reply) { //tested
725
+ // client.del(key, function (err, reply) {
683
726
  winston.debug("Deleted cache for subscription.create",reply);
684
727
  winston.verbose("Deleted cache for subscription.create",{err:err});
685
728
  });
@@ -691,7 +734,9 @@
691
734
  // elimina delete con * e fai cancellazione puntuale
692
735
  var key =trigger.id_project+":subscriptions:*";
693
736
  winston.verbose("Deleting cache for subscription.update with key: " + key);
694
- client.del(key, function (err, reply) {
737
+ // found del
738
+ del(client._cache._engine.client, key, function (err, reply) { //tested
739
+ // client.del(key, function (err, reply) {
695
740
  winston.debug("Deleted cache for subscription.update",reply);
696
741
  winston.verbose("Deleted cache for subscription.update",{err:err});
697
742
  });
@@ -703,7 +748,9 @@
703
748
  // elimina delete con * e fai cancellazione puntuale
704
749
  var key =trigger.id_project+":subscriptions:*";
705
750
  winston.verbose("Deleting cache for subscription.delete with key: " + key);
706
- client.del(key, function (err, reply) {
751
+ // found del
752
+ del(client._cache._engine.client, key, function (err, reply) { //tested
753
+ // client.del(key, function (err, reply) {
707
754
  winston.debug("Deleted cache for subscription.delete",reply);
708
755
  winston.verbose("Deleted cache for subscription.delete",{err:err});
709
756
  });
@@ -719,7 +766,9 @@
719
766
  // elimina delete con * e fai cancellazione puntuale
720
767
  var key =trigger.id_project+":triggers:*";
721
768
  winston.verbose("Deleting cache for trigger.create with key: " + key);
722
- client.del(key, function (err, reply) {
769
+ // found del
770
+ del(client._cache._engine.client, key, function (err, reply) { //tested
771
+ // client.del(key, function (err, reply) {
723
772
  winston.debug("Deleted cache for trigger.create",reply);
724
773
  winston.verbose("Deleted cache for trigger.create",{err:err});
725
774
  });
@@ -731,7 +780,9 @@
731
780
  // elimina delete con * e fai cancellazione puntuale
732
781
  var key =trigger.id_project+":triggers:*";
733
782
  winston.verbose("Deleting cache for trigger.update with key: " + key);
734
- client.del(key, function (err, reply) {
783
+ // found del
784
+ del(client._cache._engine.client, key, function (err, reply) { //tested
785
+ // client.del(key, function (err, reply) {
735
786
  winston.debug("Deleted cache for trigger.update",reply);
736
787
  winston.verbose("Deleted cache for trigger.update",{err:err});
737
788
  });
@@ -743,7 +794,9 @@
743
794
  // elimina delete con * e fai cancellazione puntuale
744
795
  var key =trigger.id_project+":triggers:*";
745
796
  winston.verbose("Deleting cache for trigger.delete with key: " + key);
746
- client.del(key, function (err, reply) {
797
+ // found del
798
+ del(client._cache._engine.client, key, function (err, reply) { //tested
799
+ // client.del(key, function (err, reply) {
747
800
  winston.debug("Deleted cache for trigger.delete",reply);
748
801
  winston.verbose("Deleted cache for trigger.delete",{err:err});
749
802
  });
@@ -756,7 +809,9 @@
756
809
  function invalidateFaq(client, faq) {
757
810
  key = "faqs:botid:"+faq.id_faq_kb+":faq:id:*";
758
811
  winston.verbose("Deleting cache for faq with key: " + key);
759
- client.del(key, function (err, reply) {
812
+ // found del
813
+ del(client._cache._engine.client, key, function (err, reply) { //tested
814
+ // client.del(key, function (err, reply) {
760
815
  winston.debug("Deleted cache for faq",reply);
761
816
  winston.verbose("Deleted cache for faq",{err:err});
762
817
  });
@@ -767,7 +822,9 @@
767
822
  function invalidateWidgets(client, project_id) {
768
823
  let key = project_id+":widgets";
769
824
  winston.verbose("Deleting cache for widgets with key: " + key);
770
- client.del(key, function (err, reply) {
825
+ // found del
826
+ del(client._cache._engine.client, key, function (err, reply) { //tested
827
+ // client.del(key, function (err, reply) {
771
828
  winston.debug("Deleted cache for widgets",reply);
772
829
  winston.verbose("Deleted cache for widgets",{err:err});
773
830
  });
@@ -814,6 +871,9 @@ module.exports = function (mongoose, option) {
814
871
  });
815
872
 
816
873
  var client = cachegoose._cache;
874
+ // winston.info("client client", client);
875
+ // winston.info("client _cache._engine", client._cache._engine);
876
+ // winston.info("client _cache._engine.client", client._cache._engine.client);
817
877
  listen(client);
818
878
 
819
879
  return cachegoose;