akeyless-client-commons 1.1.30 → 1.1.32

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.
@@ -1349,7 +1349,7 @@ var SocketService = /*#__PURE__*/ function() {
1349
1349
  key: "disconnectSocket",
1350
1350
  value: function disconnectSocket() {
1351
1351
  if (this.socket) {
1352
- this.socket.io.engine.close();
1352
+ this.socket.disconnect();
1353
1353
  }
1354
1354
  }
1355
1355
  },
@@ -1367,8 +1367,9 @@ var SocketService = /*#__PURE__*/ function() {
1367
1367
  });
1368
1368
  var eventHandlers = [];
1369
1369
  config.forEach(function(configuration) {
1370
- var collectionName = configuration.collectionName, onAdd = configuration.onAdd, onFirstTime = configuration.onFirstTime, onModify = configuration.onModify, onRemove = configuration.onRemove, extraParsers = configuration.extraParsers, conditions = configuration.conditions, orderBy2 = configuration.orderBy;
1370
+ var collectionName = configuration.collectionName, onAdd = configuration.onAdd, onFirstTime = configuration.onFirstTime, onModify = configuration.onModify, onRemove = configuration.onRemove, extraParsers = configuration.extraParsers;
1371
1371
  var attach = function(eventName, handler) {
1372
+ if (!handler) return;
1372
1373
  _this.socket.off(eventName, handler);
1373
1374
  _this.socket.on(eventName, handler);
1374
1375
  eventHandlers.push({
@@ -1127,7 +1127,7 @@ var SocketService = /*#__PURE__*/ function() {
1127
1127
  key: "disconnectSocket",
1128
1128
  value: function disconnectSocket() {
1129
1129
  if (this.socket) {
1130
- this.socket.io.engine.close();
1130
+ this.socket.disconnect();
1131
1131
  }
1132
1132
  }
1133
1133
  },
@@ -1145,8 +1145,9 @@ var SocketService = /*#__PURE__*/ function() {
1145
1145
  });
1146
1146
  var eventHandlers = [];
1147
1147
  config.forEach(function(configuration) {
1148
- var collectionName = configuration.collectionName, onAdd = configuration.onAdd, onFirstTime = configuration.onFirstTime, onModify = configuration.onModify, onRemove = configuration.onRemove, extraParsers = configuration.extraParsers, conditions = configuration.conditions, orderBy2 = configuration.orderBy;
1148
+ var collectionName = configuration.collectionName, onAdd = configuration.onAdd, onFirstTime = configuration.onFirstTime, onModify = configuration.onModify, onRemove = configuration.onRemove, extraParsers = configuration.extraParsers;
1149
1149
  var attach = function(eventName, handler) {
1150
+ if (!handler) return;
1150
1151
  _this.socket.off(eventName, handler);
1151
1152
  _this.socket.on(eventName, handler);
1152
1153
  eventHandlers.push({
@@ -1446,9 +1446,14 @@ var snapshot = function(config, snapshotsFirstTime, settings) {
1446
1446
  });
1447
1447
  }
1448
1448
  var unsubscribe = (0, import_firestore.onSnapshot)(collectionRef, function(snapshot2) {
1449
- if (!snapshotsFirstTime.includes(config.collectionName)) {
1449
+ var firstTimeKey = JSON.stringify({
1450
+ collectionName: config.collectionName,
1451
+ conditions: config.conditions || [],
1452
+ orderBy: config.orderBy || []
1453
+ });
1454
+ if (!snapshotsFirstTime.includes(firstTimeKey)) {
1450
1455
  var _config_onFirstTime, _config_extraParsers;
1451
- snapshotsFirstTime.push(config.collectionName);
1456
+ snapshotsFirstTime.push(firstTimeKey);
1452
1457
  var documents = snapshot2.docs.map(function(doc2) {
1453
1458
  return simpleExtractData(doc2);
1454
1459
  });
@@ -2720,7 +2725,7 @@ var SocketService = /*#__PURE__*/ function() {
2720
2725
  key: "disconnectSocket",
2721
2726
  value: function disconnectSocket() {
2722
2727
  if (this.socket) {
2723
- this.socket.io.engine.close();
2728
+ this.socket.disconnect();
2724
2729
  }
2725
2730
  }
2726
2731
  },
@@ -2738,8 +2743,9 @@ var SocketService = /*#__PURE__*/ function() {
2738
2743
  });
2739
2744
  var eventHandlers = [];
2740
2745
  config.forEach(function(configuration) {
2741
- var collectionName = configuration.collectionName, onAdd = configuration.onAdd, onFirstTime = configuration.onFirstTime, onModify = configuration.onModify, onRemove = configuration.onRemove, extraParsers = configuration.extraParsers, conditions = configuration.conditions, orderBy2 = configuration.orderBy;
2746
+ var collectionName = configuration.collectionName, onAdd = configuration.onAdd, onFirstTime = configuration.onFirstTime, onModify = configuration.onModify, onRemove = configuration.onRemove, extraParsers = configuration.extraParsers;
2742
2747
  var attach = function(eventName, handler) {
2748
+ if (!handler) return;
2743
2749
  _this.socket.off(eventName, handler);
2744
2750
  _this.socket.on(eventName, handler);
2745
2751
  eventHandlers.push({
@@ -1068,9 +1068,14 @@ var snapshot = function(config, snapshotsFirstTime, settings) {
1068
1068
  });
1069
1069
  }
1070
1070
  var unsubscribe = onSnapshot(collectionRef, function(snapshot2) {
1071
- if (!snapshotsFirstTime.includes(config.collectionName)) {
1071
+ var firstTimeKey = JSON.stringify({
1072
+ collectionName: config.collectionName,
1073
+ conditions: config.conditions || [],
1074
+ orderBy: config.orderBy || []
1075
+ });
1076
+ if (!snapshotsFirstTime.includes(firstTimeKey)) {
1072
1077
  var _config_onFirstTime, _config_extraParsers;
1073
- snapshotsFirstTime.push(config.collectionName);
1078
+ snapshotsFirstTime.push(firstTimeKey);
1074
1079
  var documents = snapshot2.docs.map(function(doc2) {
1075
1080
  return simpleExtractData(doc2);
1076
1081
  });
@@ -2341,7 +2346,7 @@ var SocketService = /*#__PURE__*/ function() {
2341
2346
  key: "disconnectSocket",
2342
2347
  value: function disconnectSocket() {
2343
2348
  if (this.socket) {
2344
- this.socket.io.engine.close();
2349
+ this.socket.disconnect();
2345
2350
  }
2346
2351
  }
2347
2352
  },
@@ -2359,8 +2364,9 @@ var SocketService = /*#__PURE__*/ function() {
2359
2364
  });
2360
2365
  var eventHandlers = [];
2361
2366
  config.forEach(function(configuration) {
2362
- var collectionName = configuration.collectionName, onAdd = configuration.onAdd, onFirstTime = configuration.onFirstTime, onModify = configuration.onModify, onRemove = configuration.onRemove, extraParsers = configuration.extraParsers, conditions = configuration.conditions, orderBy2 = configuration.orderBy;
2367
+ var collectionName = configuration.collectionName, onAdd = configuration.onAdd, onFirstTime = configuration.onFirstTime, onModify = configuration.onModify, onRemove = configuration.onRemove, extraParsers = configuration.extraParsers;
2363
2368
  var attach = function(eventName, handler) {
2369
+ if (!handler) return;
2364
2370
  _this.socket.off(eventName, handler);
2365
2371
  _this.socket.on(eventName, handler);
2366
2372
  eventHandlers.push({
@@ -520,9 +520,14 @@ var snapshot = function(config, snapshotsFirstTime, settings) {
520
520
  });
521
521
  }
522
522
  var unsubscribe = (0, import_firestore.onSnapshot)(collectionRef, function(snapshot3) {
523
- if (!snapshotsFirstTime.includes(config.collectionName)) {
523
+ var firstTimeKey = JSON.stringify({
524
+ collectionName: config.collectionName,
525
+ conditions: config.conditions || [],
526
+ orderBy: config.orderBy || []
527
+ });
528
+ if (!snapshotsFirstTime.includes(firstTimeKey)) {
524
529
  var _config_onFirstTime, _config_extraParsers;
525
- snapshotsFirstTime.push(config.collectionName);
530
+ snapshotsFirstTime.push(firstTimeKey);
526
531
  var documents = snapshot3.docs.map(function(doc2) {
527
532
  return simpleExtractData(doc2);
528
533
  });
@@ -798,7 +803,7 @@ var SocketService = /*#__PURE__*/ function() {
798
803
  key: "disconnectSocket",
799
804
  value: function disconnectSocket() {
800
805
  if (this.socket) {
801
- this.socket.io.engine.close();
806
+ this.socket.disconnect();
802
807
  }
803
808
  }
804
809
  },
@@ -816,8 +821,9 @@ var SocketService = /*#__PURE__*/ function() {
816
821
  });
817
822
  var eventHandlers = [];
818
823
  config.forEach(function(configuration) {
819
- var collectionName = configuration.collectionName, onAdd = configuration.onAdd, onFirstTime = configuration.onFirstTime, onModify = configuration.onModify, onRemove = configuration.onRemove, extraParsers = configuration.extraParsers, conditions = configuration.conditions, orderBy2 = configuration.orderBy;
824
+ var collectionName = configuration.collectionName, onAdd = configuration.onAdd, onFirstTime = configuration.onFirstTime, onModify = configuration.onModify, onRemove = configuration.onRemove, extraParsers = configuration.extraParsers;
820
825
  var attach = function(eventName, handler) {
826
+ if (!handler) return;
821
827
  _this.socket.off(eventName, handler);
822
828
  _this.socket.on(eventName, handler);
823
829
  eventHandlers.push({
@@ -1185,6 +1191,9 @@ var useSocketSnapshots = function(configs, label, settings) {
1185
1191
  cleanupSubscriptions.forEach(function(cleanup) {
1186
1192
  return cleanup();
1187
1193
  });
1194
+ if (!(settings === null || settings === void 0 ? void 0 : settings.disableLogs) && configs.length > 0) {
1195
+ console.log("==> ".concat(label || "Cache snapshots", " unsubscribed. "));
1196
+ }
1188
1197
  };
1189
1198
  }, []);
1190
1199
  return {
@@ -427,9 +427,14 @@ var snapshot = function(config, snapshotsFirstTime, settings) {
427
427
  });
428
428
  }
429
429
  var unsubscribe = onSnapshot(collectionRef, function(snapshot3) {
430
- if (!snapshotsFirstTime.includes(config.collectionName)) {
430
+ var firstTimeKey = JSON.stringify({
431
+ collectionName: config.collectionName,
432
+ conditions: config.conditions || [],
433
+ orderBy: config.orderBy || []
434
+ });
435
+ if (!snapshotsFirstTime.includes(firstTimeKey)) {
431
436
  var _config_onFirstTime, _config_extraParsers;
432
- snapshotsFirstTime.push(config.collectionName);
437
+ snapshotsFirstTime.push(firstTimeKey);
433
438
  var documents = snapshot3.docs.map(function(doc2) {
434
439
  return simpleExtractData(doc2);
435
440
  });
@@ -704,7 +709,7 @@ var SocketService = /*#__PURE__*/ function() {
704
709
  key: "disconnectSocket",
705
710
  value: function disconnectSocket() {
706
711
  if (this.socket) {
707
- this.socket.io.engine.close();
712
+ this.socket.disconnect();
708
713
  }
709
714
  }
710
715
  },
@@ -722,8 +727,9 @@ var SocketService = /*#__PURE__*/ function() {
722
727
  });
723
728
  var eventHandlers = [];
724
729
  config.forEach(function(configuration) {
725
- var collectionName = configuration.collectionName, onAdd = configuration.onAdd, onFirstTime = configuration.onFirstTime, onModify = configuration.onModify, onRemove = configuration.onRemove, extraParsers = configuration.extraParsers, conditions = configuration.conditions, orderBy2 = configuration.orderBy;
730
+ var collectionName = configuration.collectionName, onAdd = configuration.onAdd, onFirstTime = configuration.onFirstTime, onModify = configuration.onModify, onRemove = configuration.onRemove, extraParsers = configuration.extraParsers;
726
731
  var attach = function(eventName, handler) {
732
+ if (!handler) return;
727
733
  _this.socket.off(eventName, handler);
728
734
  _this.socket.on(eventName, handler);
729
735
  eventHandlers.push({
@@ -1091,6 +1097,9 @@ var useSocketSnapshots = function(configs, label, settings) {
1091
1097
  cleanupSubscriptions.forEach(function(cleanup) {
1092
1098
  return cleanup();
1093
1099
  });
1100
+ if (!(settings === null || settings === void 0 ? void 0 : settings.disableLogs) && configs.length > 0) {
1101
+ console.log("==> ".concat(label || "Cache snapshots", " unsubscribed. "));
1102
+ }
1094
1103
  };
1095
1104
  }, []);
1096
1105
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akeyless-client-commons",
3
- "version": "1.1.30",
3
+ "version": "1.1.32",
4
4
  "scripts": {
5
5
  "build": "tsup",
6
6
  "deploy": "npm run build && npm version patch --no-git-tag-version && npm publish",