akeyless-client-commons 1.1.100 → 1.1.102

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.
@@ -806,8 +806,8 @@ var simpleExtractData = function(doc2) {
806
806
  });
807
807
  };
808
808
  var set_document = /*#__PURE__*/ function() {
809
- var _ref = _async_to_generator(function(collection_path, doc_id, data) {
810
- var doc_ref, error;
809
+ var _ref = _async_to_generator(function(collection_path, doc_id, data, options) {
810
+ var doc_ref, _options_merge, error;
811
811
  return _ts_generator(this, function(_state) {
812
812
  switch(_state.label){
813
813
  case 0:
@@ -821,7 +821,7 @@ var set_document = /*#__PURE__*/ function() {
821
821
  return [
822
822
  4,
823
823
  (0, import_firestore2.setDoc)(doc_ref, data, {
824
- merge: true
824
+ merge: (_options_merge = options === null || options === void 0 ? void 0 : options.merge) !== null && _options_merge !== void 0 ? _options_merge : true
825
825
  })
826
826
  ];
827
827
  case 1:
@@ -847,7 +847,7 @@ var set_document = /*#__PURE__*/ function() {
847
847
  }
848
848
  });
849
849
  });
850
- return function set_document(collection_path, doc_id, data) {
850
+ return function set_document(collection_path, doc_id, data, options) {
851
851
  return _ref.apply(this, arguments);
852
852
  };
853
853
  }();
@@ -1248,11 +1248,25 @@ var SESSION_STORAGE_KEY = "sessionId";
1248
1248
  var SocketService = /*#__PURE__*/ function() {
1249
1249
  "use strict";
1250
1250
  function _SocketService() {
1251
+ var _this = this;
1251
1252
  _class_call_check(this, _SocketService);
1252
1253
  this.socket = null;
1253
1254
  this.connectCallbacks = [];
1254
1255
  this.disconnectCallbacks = [];
1255
1256
  this.authToken = null;
1257
+ this.isDisconnected = true;
1258
+ this.handleDisconnect = function(source, reason) {
1259
+ var _this_socket;
1260
+ if (_this.isDisconnected) {
1261
+ return;
1262
+ }
1263
+ _this.isDisconnected = true;
1264
+ var transport = (_this_socket = _this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.io.engine.transport.name;
1265
+ console.log("Socket disconnected (".concat(source, ") [transport=").concat(transport, "]:"), reason);
1266
+ _this.disconnectCallbacks.forEach(function(cb) {
1267
+ return cb();
1268
+ });
1269
+ };
1256
1270
  }
1257
1271
  _create_class(_SocketService, [
1258
1272
  {
@@ -1277,32 +1291,27 @@ var SocketService = /*#__PURE__*/ function() {
1277
1291
  ],
1278
1292
  reconnection: true,
1279
1293
  reconnectionAttempts: 30,
1280
- reconnectionDelay: 2 * 1e3
1294
+ reconnectionDelay: 2 * 1e3,
1295
+ reconnectionDelayMax: 10 * 1e3,
1296
+ timeout: 20 * 1e3
1281
1297
  });
1282
1298
  this.socket.on("connect", function() {
1283
- var _this_socket, _this_socket1;
1284
- console.log("\uD83D\uDFE2 Socket connected: ".concat((_this_socket = _this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.id, " (recovered - ").concat((_this_socket1 = _this.socket) === null || _this_socket1 === void 0 ? void 0 : _this_socket1.recovered, ")"));
1299
+ var _this_socket, _this_socket1, _this_socket2;
1300
+ var transport = (_this_socket = _this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.io.engine.transport.name;
1301
+ console.log("\uD83D\uDFE2 Socket connected: ".concat((_this_socket1 = _this.socket) === null || _this_socket1 === void 0 ? void 0 : _this_socket1.id, " (recovered - ").concat((_this_socket2 = _this.socket) === null || _this_socket2 === void 0 ? void 0 : _this_socket2.recovered, ") (transport - ").concat(transport, ")"));
1302
+ _this.isDisconnected = false;
1285
1303
  _this.connectCallbacks.forEach(function(cb) {
1286
1304
  return cb();
1287
1305
  });
1288
1306
  });
1289
1307
  this.socket.on("disconnect", function(reason) {
1290
- console.log("Socket disconnected:", reason);
1291
- _this.disconnectCallbacks.forEach(function(cb) {
1292
- return cb();
1293
- });
1308
+ _this.handleDisconnect("disconnect", reason);
1294
1309
  });
1295
1310
  this.socket.io.on("close", function(reason) {
1296
- console.log("Socket Manager close:", reason);
1297
- _this.disconnectCallbacks.forEach(function(cb) {
1298
- return cb();
1299
- });
1311
+ _this.handleDisconnect("manager_close", reason);
1300
1312
  });
1301
1313
  this.socket.io.engine.on("close", function(reason) {
1302
- console.log("Socket Engine close:", reason);
1303
- _this.disconnectCallbacks.forEach(function(cb) {
1304
- return cb();
1305
- });
1314
+ _this.handleDisconnect("engine_close", reason);
1306
1315
  });
1307
1316
  this.socket.on("session", function(param) {
1308
1317
  var session_id = param.session_id;
@@ -1313,6 +1322,16 @@ var SocketService = /*#__PURE__*/ function() {
1313
1322
  this.socket.on("connect_error", function(error) {
1314
1323
  console.error("Socket connection error:", error);
1315
1324
  });
1325
+ this.socket.io.on("reconnect_attempt", function(attempt) {
1326
+ console.log("Socket reconnect attempt:", attempt);
1327
+ });
1328
+ this.socket.io.on("reconnect_error", function(error) {
1329
+ console.error("Socket reconnect error:", error);
1330
+ });
1331
+ this.socket.io.on("reconnect", function(attempt) {
1332
+ console.log("Socket reconnected after attempts:", attempt);
1333
+ _this.isDisconnected = false;
1334
+ });
1316
1335
  }
1317
1336
  }
1318
1337
  },
@@ -1531,21 +1550,6 @@ var SocketService = /*#__PURE__*/ function() {
1531
1550
  });
1532
1551
  });
1533
1552
  }
1534
- },
1535
- {
1536
- key: "clearAllRedisData",
1537
- value: function clearAllRedisData() {
1538
- var s = this.getSocketInstance();
1539
- return new Promise(function(resolve, reject) {
1540
- s.emit("clear_all_redis_data", function(ack) {
1541
- if (ack.success) {
1542
- resolve(ack);
1543
- } else {
1544
- reject(new Error(ack.message || "Clear all Redis data operation failed"));
1545
- }
1546
- });
1547
- });
1548
- }
1549
1553
  }
1550
1554
  ], [
1551
1555
  {
@@ -579,8 +579,8 @@ var simpleExtractData = function(doc2) {
579
579
  });
580
580
  };
581
581
  var set_document = /*#__PURE__*/ function() {
582
- var _ref = _async_to_generator(function(collection_path, doc_id, data) {
583
- var doc_ref, error;
582
+ var _ref = _async_to_generator(function(collection_path, doc_id, data, options) {
583
+ var doc_ref, _options_merge, error;
584
584
  return _ts_generator(this, function(_state) {
585
585
  switch(_state.label){
586
586
  case 0:
@@ -594,7 +594,7 @@ var set_document = /*#__PURE__*/ function() {
594
594
  return [
595
595
  4,
596
596
  setDoc(doc_ref, data, {
597
- merge: true
597
+ merge: (_options_merge = options === null || options === void 0 ? void 0 : options.merge) !== null && _options_merge !== void 0 ? _options_merge : true
598
598
  })
599
599
  ];
600
600
  case 1:
@@ -620,7 +620,7 @@ var set_document = /*#__PURE__*/ function() {
620
620
  }
621
621
  });
622
622
  });
623
- return function set_document(collection_path, doc_id, data) {
623
+ return function set_document(collection_path, doc_id, data, options) {
624
624
  return _ref.apply(this, arguments);
625
625
  };
626
626
  }();
@@ -1020,11 +1020,25 @@ var SESSION_STORAGE_KEY = "sessionId";
1020
1020
  var SocketService = /*#__PURE__*/ function() {
1021
1021
  "use strict";
1022
1022
  function _SocketService() {
1023
+ var _this = this;
1023
1024
  _class_call_check(this, _SocketService);
1024
1025
  this.socket = null;
1025
1026
  this.connectCallbacks = [];
1026
1027
  this.disconnectCallbacks = [];
1027
1028
  this.authToken = null;
1029
+ this.isDisconnected = true;
1030
+ this.handleDisconnect = function(source, reason) {
1031
+ var _this_socket;
1032
+ if (_this.isDisconnected) {
1033
+ return;
1034
+ }
1035
+ _this.isDisconnected = true;
1036
+ var transport = (_this_socket = _this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.io.engine.transport.name;
1037
+ console.log("Socket disconnected (".concat(source, ") [transport=").concat(transport, "]:"), reason);
1038
+ _this.disconnectCallbacks.forEach(function(cb) {
1039
+ return cb();
1040
+ });
1041
+ };
1028
1042
  }
1029
1043
  _create_class(_SocketService, [
1030
1044
  {
@@ -1049,32 +1063,27 @@ var SocketService = /*#__PURE__*/ function() {
1049
1063
  ],
1050
1064
  reconnection: true,
1051
1065
  reconnectionAttempts: 30,
1052
- reconnectionDelay: 2 * 1e3
1066
+ reconnectionDelay: 2 * 1e3,
1067
+ reconnectionDelayMax: 10 * 1e3,
1068
+ timeout: 20 * 1e3
1053
1069
  });
1054
1070
  this.socket.on("connect", function() {
1055
- var _this_socket, _this_socket1;
1056
- console.log("\uD83D\uDFE2 Socket connected: ".concat((_this_socket = _this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.id, " (recovered - ").concat((_this_socket1 = _this.socket) === null || _this_socket1 === void 0 ? void 0 : _this_socket1.recovered, ")"));
1071
+ var _this_socket, _this_socket1, _this_socket2;
1072
+ var transport = (_this_socket = _this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.io.engine.transport.name;
1073
+ console.log("\uD83D\uDFE2 Socket connected: ".concat((_this_socket1 = _this.socket) === null || _this_socket1 === void 0 ? void 0 : _this_socket1.id, " (recovered - ").concat((_this_socket2 = _this.socket) === null || _this_socket2 === void 0 ? void 0 : _this_socket2.recovered, ") (transport - ").concat(transport, ")"));
1074
+ _this.isDisconnected = false;
1057
1075
  _this.connectCallbacks.forEach(function(cb) {
1058
1076
  return cb();
1059
1077
  });
1060
1078
  });
1061
1079
  this.socket.on("disconnect", function(reason) {
1062
- console.log("Socket disconnected:", reason);
1063
- _this.disconnectCallbacks.forEach(function(cb) {
1064
- return cb();
1065
- });
1080
+ _this.handleDisconnect("disconnect", reason);
1066
1081
  });
1067
1082
  this.socket.io.on("close", function(reason) {
1068
- console.log("Socket Manager close:", reason);
1069
- _this.disconnectCallbacks.forEach(function(cb) {
1070
- return cb();
1071
- });
1083
+ _this.handleDisconnect("manager_close", reason);
1072
1084
  });
1073
1085
  this.socket.io.engine.on("close", function(reason) {
1074
- console.log("Socket Engine close:", reason);
1075
- _this.disconnectCallbacks.forEach(function(cb) {
1076
- return cb();
1077
- });
1086
+ _this.handleDisconnect("engine_close", reason);
1078
1087
  });
1079
1088
  this.socket.on("session", function(param) {
1080
1089
  var session_id = param.session_id;
@@ -1085,6 +1094,16 @@ var SocketService = /*#__PURE__*/ function() {
1085
1094
  this.socket.on("connect_error", function(error) {
1086
1095
  console.error("Socket connection error:", error);
1087
1096
  });
1097
+ this.socket.io.on("reconnect_attempt", function(attempt) {
1098
+ console.log("Socket reconnect attempt:", attempt);
1099
+ });
1100
+ this.socket.io.on("reconnect_error", function(error) {
1101
+ console.error("Socket reconnect error:", error);
1102
+ });
1103
+ this.socket.io.on("reconnect", function(attempt) {
1104
+ console.log("Socket reconnected after attempts:", attempt);
1105
+ _this.isDisconnected = false;
1106
+ });
1088
1107
  }
1089
1108
  }
1090
1109
  },
@@ -1303,21 +1322,6 @@ var SocketService = /*#__PURE__*/ function() {
1303
1322
  });
1304
1323
  });
1305
1324
  }
1306
- },
1307
- {
1308
- key: "clearAllRedisData",
1309
- value: function clearAllRedisData() {
1310
- var s = this.getSocketInstance();
1311
- return new Promise(function(resolve, reject) {
1312
- s.emit("clear_all_redis_data", function(ack) {
1313
- if (ack.success) {
1314
- resolve(ack);
1315
- } else {
1316
- reject(new Error(ack.message || "Clear all Redis data operation failed"));
1317
- }
1318
- });
1319
- });
1320
- }
1321
1325
  }
1322
1326
  ], [
1323
1327
  {
@@ -133,7 +133,9 @@ declare const extractLocationData: (doc: DocumentSnapshot<DocumentData>) => {
133
133
  };
134
134
  declare const get_all_documents: (collection_path: string) => Promise<TObject<any>[]>;
135
135
  declare const get_document_by_id: (collection_path: string, doc_id: string) => Promise<TObject<any>>;
136
- declare const set_document: (collection_path: string, doc_id: string, data: DocumentData) => Promise<boolean>;
136
+ declare const set_document: (collection_path: string, doc_id: string, data: DocumentData, options?: {
137
+ merge?: boolean;
138
+ }) => Promise<boolean>;
137
139
  declare const add_document: (collection_path: string, data: DocumentData, include_id?: boolean) => Promise<boolean>;
138
140
  declare const delete_document: (collection_path: string, doc_id: string) => Promise<boolean>;
139
141
  declare const query_document: (collection_path: string, field_name: string, operator: WhereFilterOp, value: any, ignore_log?: boolean) => Promise<null | TObject<any>>;
@@ -300,6 +302,8 @@ declare class SocketService {
300
302
  private connectCallbacks;
301
303
  private disconnectCallbacks;
302
304
  private authToken;
305
+ private isDisconnected;
306
+ private handleDisconnect;
303
307
  private initSocket;
304
308
  private constructor();
305
309
  static getInstance(): SocketService;
@@ -320,7 +324,6 @@ declare class SocketService {
320
324
  key: string;
321
325
  collection_name: string;
322
326
  }): Promise<SocketCallbackResponse>;
323
- clearAllRedisData(): Promise<SocketCallbackResponse>;
324
327
  }
325
328
  declare const socketServiceInstance: SocketService;
326
329
 
@@ -133,7 +133,9 @@ declare const extractLocationData: (doc: DocumentSnapshot<DocumentData>) => {
133
133
  };
134
134
  declare const get_all_documents: (collection_path: string) => Promise<TObject<any>[]>;
135
135
  declare const get_document_by_id: (collection_path: string, doc_id: string) => Promise<TObject<any>>;
136
- declare const set_document: (collection_path: string, doc_id: string, data: DocumentData) => Promise<boolean>;
136
+ declare const set_document: (collection_path: string, doc_id: string, data: DocumentData, options?: {
137
+ merge?: boolean;
138
+ }) => Promise<boolean>;
137
139
  declare const add_document: (collection_path: string, data: DocumentData, include_id?: boolean) => Promise<boolean>;
138
140
  declare const delete_document: (collection_path: string, doc_id: string) => Promise<boolean>;
139
141
  declare const query_document: (collection_path: string, field_name: string, operator: WhereFilterOp, value: any, ignore_log?: boolean) => Promise<null | TObject<any>>;
@@ -300,6 +302,8 @@ declare class SocketService {
300
302
  private connectCallbacks;
301
303
  private disconnectCallbacks;
302
304
  private authToken;
305
+ private isDisconnected;
306
+ private handleDisconnect;
303
307
  private initSocket;
304
308
  private constructor();
305
309
  static getInstance(): SocketService;
@@ -320,7 +324,6 @@ declare class SocketService {
320
324
  key: string;
321
325
  collection_name: string;
322
326
  }): Promise<SocketCallbackResponse>;
323
- clearAllRedisData(): Promise<SocketCallbackResponse>;
324
327
  }
325
328
  declare const socketServiceInstance: SocketService;
326
329
 
@@ -1264,8 +1264,8 @@ var get_document_by_id = /*#__PURE__*/ function() {
1264
1264
  };
1265
1265
  }();
1266
1266
  var set_document = /*#__PURE__*/ function() {
1267
- var _ref = _async_to_generator(function(collection_path, doc_id, data) {
1268
- var doc_ref, error;
1267
+ var _ref = _async_to_generator(function(collection_path, doc_id, data, options) {
1268
+ var doc_ref, _options_merge, error;
1269
1269
  return _ts_generator(this, function(_state) {
1270
1270
  switch(_state.label){
1271
1271
  case 0:
@@ -1279,7 +1279,7 @@ var set_document = /*#__PURE__*/ function() {
1279
1279
  return [
1280
1280
  4,
1281
1281
  (0, import_firestore2.setDoc)(doc_ref, data, {
1282
- merge: true
1282
+ merge: (_options_merge = options === null || options === void 0 ? void 0 : options.merge) !== null && _options_merge !== void 0 ? _options_merge : true
1283
1283
  })
1284
1284
  ];
1285
1285
  case 1:
@@ -1305,7 +1305,7 @@ var set_document = /*#__PURE__*/ function() {
1305
1305
  }
1306
1306
  });
1307
1307
  });
1308
- return function set_document(collection_path, doc_id, data) {
1308
+ return function set_document(collection_path, doc_id, data, options) {
1309
1309
  return _ref.apply(this, arguments);
1310
1310
  };
1311
1311
  }();
@@ -2748,11 +2748,25 @@ var SESSION_STORAGE_KEY = "sessionId";
2748
2748
  var SocketService = /*#__PURE__*/ function() {
2749
2749
  "use strict";
2750
2750
  function _SocketService() {
2751
+ var _this = this;
2751
2752
  _class_call_check(this, _SocketService);
2752
2753
  this.socket = null;
2753
2754
  this.connectCallbacks = [];
2754
2755
  this.disconnectCallbacks = [];
2755
2756
  this.authToken = null;
2757
+ this.isDisconnected = true;
2758
+ this.handleDisconnect = function(source, reason) {
2759
+ var _this_socket;
2760
+ if (_this.isDisconnected) {
2761
+ return;
2762
+ }
2763
+ _this.isDisconnected = true;
2764
+ var transport = (_this_socket = _this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.io.engine.transport.name;
2765
+ console.log("Socket disconnected (".concat(source, ") [transport=").concat(transport, "]:"), reason);
2766
+ _this.disconnectCallbacks.forEach(function(cb) {
2767
+ return cb();
2768
+ });
2769
+ };
2756
2770
  }
2757
2771
  _create_class(_SocketService, [
2758
2772
  {
@@ -2777,32 +2791,27 @@ var SocketService = /*#__PURE__*/ function() {
2777
2791
  ],
2778
2792
  reconnection: true,
2779
2793
  reconnectionAttempts: 30,
2780
- reconnectionDelay: 2 * 1e3
2794
+ reconnectionDelay: 2 * 1e3,
2795
+ reconnectionDelayMax: 10 * 1e3,
2796
+ timeout: 20 * 1e3
2781
2797
  });
2782
2798
  this.socket.on("connect", function() {
2783
- var _this_socket, _this_socket1;
2784
- console.log("\uD83D\uDFE2 Socket connected: ".concat((_this_socket = _this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.id, " (recovered - ").concat((_this_socket1 = _this.socket) === null || _this_socket1 === void 0 ? void 0 : _this_socket1.recovered, ")"));
2799
+ var _this_socket, _this_socket1, _this_socket2;
2800
+ var transport = (_this_socket = _this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.io.engine.transport.name;
2801
+ console.log("\uD83D\uDFE2 Socket connected: ".concat((_this_socket1 = _this.socket) === null || _this_socket1 === void 0 ? void 0 : _this_socket1.id, " (recovered - ").concat((_this_socket2 = _this.socket) === null || _this_socket2 === void 0 ? void 0 : _this_socket2.recovered, ") (transport - ").concat(transport, ")"));
2802
+ _this.isDisconnected = false;
2785
2803
  _this.connectCallbacks.forEach(function(cb) {
2786
2804
  return cb();
2787
2805
  });
2788
2806
  });
2789
2807
  this.socket.on("disconnect", function(reason) {
2790
- console.log("Socket disconnected:", reason);
2791
- _this.disconnectCallbacks.forEach(function(cb) {
2792
- return cb();
2793
- });
2808
+ _this.handleDisconnect("disconnect", reason);
2794
2809
  });
2795
2810
  this.socket.io.on("close", function(reason) {
2796
- console.log("Socket Manager close:", reason);
2797
- _this.disconnectCallbacks.forEach(function(cb) {
2798
- return cb();
2799
- });
2811
+ _this.handleDisconnect("manager_close", reason);
2800
2812
  });
2801
2813
  this.socket.io.engine.on("close", function(reason) {
2802
- console.log("Socket Engine close:", reason);
2803
- _this.disconnectCallbacks.forEach(function(cb) {
2804
- return cb();
2805
- });
2814
+ _this.handleDisconnect("engine_close", reason);
2806
2815
  });
2807
2816
  this.socket.on("session", function(param) {
2808
2817
  var session_id = param.session_id;
@@ -2813,6 +2822,16 @@ var SocketService = /*#__PURE__*/ function() {
2813
2822
  this.socket.on("connect_error", function(error) {
2814
2823
  console.error("Socket connection error:", error);
2815
2824
  });
2825
+ this.socket.io.on("reconnect_attempt", function(attempt) {
2826
+ console.log("Socket reconnect attempt:", attempt);
2827
+ });
2828
+ this.socket.io.on("reconnect_error", function(error) {
2829
+ console.error("Socket reconnect error:", error);
2830
+ });
2831
+ this.socket.io.on("reconnect", function(attempt) {
2832
+ console.log("Socket reconnected after attempts:", attempt);
2833
+ _this.isDisconnected = false;
2834
+ });
2816
2835
  }
2817
2836
  }
2818
2837
  },
@@ -3031,21 +3050,6 @@ var SocketService = /*#__PURE__*/ function() {
3031
3050
  });
3032
3051
  });
3033
3052
  }
3034
- },
3035
- {
3036
- key: "clearAllRedisData",
3037
- value: function clearAllRedisData() {
3038
- var s = this.getSocketInstance();
3039
- return new Promise(function(resolve, reject) {
3040
- s.emit("clear_all_redis_data", function(ack) {
3041
- if (ack.success) {
3042
- resolve(ack);
3043
- } else {
3044
- reject(new Error(ack.message || "Clear all Redis data operation failed"));
3045
- }
3046
- });
3047
- });
3048
- }
3049
3053
  }
3050
3054
  ], [
3051
3055
  {
@@ -874,8 +874,8 @@ var get_document_by_id = /*#__PURE__*/ function() {
874
874
  };
875
875
  }();
876
876
  var set_document = /*#__PURE__*/ function() {
877
- var _ref = _async_to_generator(function(collection_path, doc_id, data) {
878
- var doc_ref, error;
877
+ var _ref = _async_to_generator(function(collection_path, doc_id, data, options) {
878
+ var doc_ref, _options_merge, error;
879
879
  return _ts_generator(this, function(_state) {
880
880
  switch(_state.label){
881
881
  case 0:
@@ -889,7 +889,7 @@ var set_document = /*#__PURE__*/ function() {
889
889
  return [
890
890
  4,
891
891
  setDoc(doc_ref, data, {
892
- merge: true
892
+ merge: (_options_merge = options === null || options === void 0 ? void 0 : options.merge) !== null && _options_merge !== void 0 ? _options_merge : true
893
893
  })
894
894
  ];
895
895
  case 1:
@@ -915,7 +915,7 @@ var set_document = /*#__PURE__*/ function() {
915
915
  }
916
916
  });
917
917
  });
918
- return function set_document(collection_path, doc_id, data) {
918
+ return function set_document(collection_path, doc_id, data, options) {
919
919
  return _ref.apply(this, arguments);
920
920
  };
921
921
  }();
@@ -2357,11 +2357,25 @@ var SESSION_STORAGE_KEY = "sessionId";
2357
2357
  var SocketService = /*#__PURE__*/ function() {
2358
2358
  "use strict";
2359
2359
  function _SocketService() {
2360
+ var _this = this;
2360
2361
  _class_call_check(this, _SocketService);
2361
2362
  this.socket = null;
2362
2363
  this.connectCallbacks = [];
2363
2364
  this.disconnectCallbacks = [];
2364
2365
  this.authToken = null;
2366
+ this.isDisconnected = true;
2367
+ this.handleDisconnect = function(source, reason) {
2368
+ var _this_socket;
2369
+ if (_this.isDisconnected) {
2370
+ return;
2371
+ }
2372
+ _this.isDisconnected = true;
2373
+ var transport = (_this_socket = _this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.io.engine.transport.name;
2374
+ console.log("Socket disconnected (".concat(source, ") [transport=").concat(transport, "]:"), reason);
2375
+ _this.disconnectCallbacks.forEach(function(cb) {
2376
+ return cb();
2377
+ });
2378
+ };
2365
2379
  }
2366
2380
  _create_class(_SocketService, [
2367
2381
  {
@@ -2386,32 +2400,27 @@ var SocketService = /*#__PURE__*/ function() {
2386
2400
  ],
2387
2401
  reconnection: true,
2388
2402
  reconnectionAttempts: 30,
2389
- reconnectionDelay: 2 * 1e3
2403
+ reconnectionDelay: 2 * 1e3,
2404
+ reconnectionDelayMax: 10 * 1e3,
2405
+ timeout: 20 * 1e3
2390
2406
  });
2391
2407
  this.socket.on("connect", function() {
2392
- var _this_socket, _this_socket1;
2393
- console.log("\uD83D\uDFE2 Socket connected: ".concat((_this_socket = _this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.id, " (recovered - ").concat((_this_socket1 = _this.socket) === null || _this_socket1 === void 0 ? void 0 : _this_socket1.recovered, ")"));
2408
+ var _this_socket, _this_socket1, _this_socket2;
2409
+ var transport = (_this_socket = _this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.io.engine.transport.name;
2410
+ console.log("\uD83D\uDFE2 Socket connected: ".concat((_this_socket1 = _this.socket) === null || _this_socket1 === void 0 ? void 0 : _this_socket1.id, " (recovered - ").concat((_this_socket2 = _this.socket) === null || _this_socket2 === void 0 ? void 0 : _this_socket2.recovered, ") (transport - ").concat(transport, ")"));
2411
+ _this.isDisconnected = false;
2394
2412
  _this.connectCallbacks.forEach(function(cb) {
2395
2413
  return cb();
2396
2414
  });
2397
2415
  });
2398
2416
  this.socket.on("disconnect", function(reason) {
2399
- console.log("Socket disconnected:", reason);
2400
- _this.disconnectCallbacks.forEach(function(cb) {
2401
- return cb();
2402
- });
2417
+ _this.handleDisconnect("disconnect", reason);
2403
2418
  });
2404
2419
  this.socket.io.on("close", function(reason) {
2405
- console.log("Socket Manager close:", reason);
2406
- _this.disconnectCallbacks.forEach(function(cb) {
2407
- return cb();
2408
- });
2420
+ _this.handleDisconnect("manager_close", reason);
2409
2421
  });
2410
2422
  this.socket.io.engine.on("close", function(reason) {
2411
- console.log("Socket Engine close:", reason);
2412
- _this.disconnectCallbacks.forEach(function(cb) {
2413
- return cb();
2414
- });
2423
+ _this.handleDisconnect("engine_close", reason);
2415
2424
  });
2416
2425
  this.socket.on("session", function(param) {
2417
2426
  var session_id = param.session_id;
@@ -2422,6 +2431,16 @@ var SocketService = /*#__PURE__*/ function() {
2422
2431
  this.socket.on("connect_error", function(error) {
2423
2432
  console.error("Socket connection error:", error);
2424
2433
  });
2434
+ this.socket.io.on("reconnect_attempt", function(attempt) {
2435
+ console.log("Socket reconnect attempt:", attempt);
2436
+ });
2437
+ this.socket.io.on("reconnect_error", function(error) {
2438
+ console.error("Socket reconnect error:", error);
2439
+ });
2440
+ this.socket.io.on("reconnect", function(attempt) {
2441
+ console.log("Socket reconnected after attempts:", attempt);
2442
+ _this.isDisconnected = false;
2443
+ });
2425
2444
  }
2426
2445
  }
2427
2446
  },
@@ -2640,21 +2659,6 @@ var SocketService = /*#__PURE__*/ function() {
2640
2659
  });
2641
2660
  });
2642
2661
  }
2643
- },
2644
- {
2645
- key: "clearAllRedisData",
2646
- value: function clearAllRedisData() {
2647
- var s = this.getSocketInstance();
2648
- return new Promise(function(resolve, reject) {
2649
- s.emit("clear_all_redis_data", function(ack) {
2650
- if (ack.success) {
2651
- resolve(ack);
2652
- } else {
2653
- reject(new Error(ack.message || "Clear all Redis data operation failed"));
2654
- }
2655
- });
2656
- });
2657
- }
2658
2662
  }
2659
2663
  ], [
2660
2664
  {
@@ -67,6 +67,8 @@ declare class SocketService {
67
67
  private connectCallbacks;
68
68
  private disconnectCallbacks;
69
69
  private authToken;
70
+ private isDisconnected;
71
+ private handleDisconnect;
70
72
  private initSocket;
71
73
  private constructor();
72
74
  static getInstance(): SocketService;
@@ -87,7 +89,6 @@ declare class SocketService {
87
89
  key: string;
88
90
  collection_name: string;
89
91
  }): Promise<SocketCallbackResponse>;
90
- clearAllRedisData(): Promise<SocketCallbackResponse>;
91
92
  }
92
93
  declare const socketServiceInstance: SocketService;
93
94
 
@@ -67,6 +67,8 @@ declare class SocketService {
67
67
  private connectCallbacks;
68
68
  private disconnectCallbacks;
69
69
  private authToken;
70
+ private isDisconnected;
71
+ private handleDisconnect;
70
72
  private initSocket;
71
73
  private constructor();
72
74
  static getInstance(): SocketService;
@@ -87,7 +89,6 @@ declare class SocketService {
87
89
  key: string;
88
90
  collection_name: string;
89
91
  }): Promise<SocketCallbackResponse>;
90
- clearAllRedisData(): Promise<SocketCallbackResponse>;
91
92
  }
92
93
  declare const socketServiceInstance: SocketService;
93
94
 
@@ -753,11 +753,25 @@ var SESSION_STORAGE_KEY = "sessionId";
753
753
  var SocketService = /*#__PURE__*/ function() {
754
754
  "use strict";
755
755
  function _SocketService() {
756
+ var _this = this;
756
757
  _class_call_check(this, _SocketService);
757
758
  this.socket = null;
758
759
  this.connectCallbacks = [];
759
760
  this.disconnectCallbacks = [];
760
761
  this.authToken = null;
762
+ this.isDisconnected = true;
763
+ this.handleDisconnect = function(source, reason) {
764
+ var _this_socket;
765
+ if (_this.isDisconnected) {
766
+ return;
767
+ }
768
+ _this.isDisconnected = true;
769
+ var transport = (_this_socket = _this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.io.engine.transport.name;
770
+ console.log("Socket disconnected (".concat(source, ") [transport=").concat(transport, "]:"), reason);
771
+ _this.disconnectCallbacks.forEach(function(cb) {
772
+ return cb();
773
+ });
774
+ };
761
775
  }
762
776
  _create_class(_SocketService, [
763
777
  {
@@ -782,32 +796,27 @@ var SocketService = /*#__PURE__*/ function() {
782
796
  ],
783
797
  reconnection: true,
784
798
  reconnectionAttempts: 30,
785
- reconnectionDelay: 2 * 1e3
799
+ reconnectionDelay: 2 * 1e3,
800
+ reconnectionDelayMax: 10 * 1e3,
801
+ timeout: 20 * 1e3
786
802
  });
787
803
  this.socket.on("connect", function() {
788
- var _this_socket, _this_socket1;
789
- console.log("\uD83D\uDFE2 Socket connected: ".concat((_this_socket = _this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.id, " (recovered - ").concat((_this_socket1 = _this.socket) === null || _this_socket1 === void 0 ? void 0 : _this_socket1.recovered, ")"));
804
+ var _this_socket, _this_socket1, _this_socket2;
805
+ var transport = (_this_socket = _this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.io.engine.transport.name;
806
+ console.log("\uD83D\uDFE2 Socket connected: ".concat((_this_socket1 = _this.socket) === null || _this_socket1 === void 0 ? void 0 : _this_socket1.id, " (recovered - ").concat((_this_socket2 = _this.socket) === null || _this_socket2 === void 0 ? void 0 : _this_socket2.recovered, ") (transport - ").concat(transport, ")"));
807
+ _this.isDisconnected = false;
790
808
  _this.connectCallbacks.forEach(function(cb) {
791
809
  return cb();
792
810
  });
793
811
  });
794
812
  this.socket.on("disconnect", function(reason) {
795
- console.log("Socket disconnected:", reason);
796
- _this.disconnectCallbacks.forEach(function(cb) {
797
- return cb();
798
- });
813
+ _this.handleDisconnect("disconnect", reason);
799
814
  });
800
815
  this.socket.io.on("close", function(reason) {
801
- console.log("Socket Manager close:", reason);
802
- _this.disconnectCallbacks.forEach(function(cb) {
803
- return cb();
804
- });
816
+ _this.handleDisconnect("manager_close", reason);
805
817
  });
806
818
  this.socket.io.engine.on("close", function(reason) {
807
- console.log("Socket Engine close:", reason);
808
- _this.disconnectCallbacks.forEach(function(cb) {
809
- return cb();
810
- });
819
+ _this.handleDisconnect("engine_close", reason);
811
820
  });
812
821
  this.socket.on("session", function(param) {
813
822
  var session_id = param.session_id;
@@ -818,6 +827,16 @@ var SocketService = /*#__PURE__*/ function() {
818
827
  this.socket.on("connect_error", function(error) {
819
828
  console.error("Socket connection error:", error);
820
829
  });
830
+ this.socket.io.on("reconnect_attempt", function(attempt) {
831
+ console.log("Socket reconnect attempt:", attempt);
832
+ });
833
+ this.socket.io.on("reconnect_error", function(error) {
834
+ console.error("Socket reconnect error:", error);
835
+ });
836
+ this.socket.io.on("reconnect", function(attempt) {
837
+ console.log("Socket reconnected after attempts:", attempt);
838
+ _this.isDisconnected = false;
839
+ });
821
840
  }
822
841
  }
823
842
  },
@@ -1036,21 +1055,6 @@ var SocketService = /*#__PURE__*/ function() {
1036
1055
  });
1037
1056
  });
1038
1057
  }
1039
- },
1040
- {
1041
- key: "clearAllRedisData",
1042
- value: function clearAllRedisData() {
1043
- var s = this.getSocketInstance();
1044
- return new Promise(function(resolve, reject) {
1045
- s.emit("clear_all_redis_data", function(ack) {
1046
- if (ack.success) {
1047
- resolve(ack);
1048
- } else {
1049
- reject(new Error(ack.message || "Clear all Redis data operation failed"));
1050
- }
1051
- });
1052
- });
1053
- }
1054
1058
  }
1055
1059
  ], [
1056
1060
  {
@@ -653,11 +653,25 @@ var SESSION_STORAGE_KEY = "sessionId";
653
653
  var SocketService = /*#__PURE__*/ function() {
654
654
  "use strict";
655
655
  function _SocketService() {
656
+ var _this = this;
656
657
  _class_call_check(this, _SocketService);
657
658
  this.socket = null;
658
659
  this.connectCallbacks = [];
659
660
  this.disconnectCallbacks = [];
660
661
  this.authToken = null;
662
+ this.isDisconnected = true;
663
+ this.handleDisconnect = function(source, reason) {
664
+ var _this_socket;
665
+ if (_this.isDisconnected) {
666
+ return;
667
+ }
668
+ _this.isDisconnected = true;
669
+ var transport = (_this_socket = _this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.io.engine.transport.name;
670
+ console.log("Socket disconnected (".concat(source, ") [transport=").concat(transport, "]:"), reason);
671
+ _this.disconnectCallbacks.forEach(function(cb) {
672
+ return cb();
673
+ });
674
+ };
661
675
  }
662
676
  _create_class(_SocketService, [
663
677
  {
@@ -682,32 +696,27 @@ var SocketService = /*#__PURE__*/ function() {
682
696
  ],
683
697
  reconnection: true,
684
698
  reconnectionAttempts: 30,
685
- reconnectionDelay: 2 * 1e3
699
+ reconnectionDelay: 2 * 1e3,
700
+ reconnectionDelayMax: 10 * 1e3,
701
+ timeout: 20 * 1e3
686
702
  });
687
703
  this.socket.on("connect", function() {
688
- var _this_socket, _this_socket1;
689
- console.log("\uD83D\uDFE2 Socket connected: ".concat((_this_socket = _this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.id, " (recovered - ").concat((_this_socket1 = _this.socket) === null || _this_socket1 === void 0 ? void 0 : _this_socket1.recovered, ")"));
704
+ var _this_socket, _this_socket1, _this_socket2;
705
+ var transport = (_this_socket = _this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.io.engine.transport.name;
706
+ console.log("\uD83D\uDFE2 Socket connected: ".concat((_this_socket1 = _this.socket) === null || _this_socket1 === void 0 ? void 0 : _this_socket1.id, " (recovered - ").concat((_this_socket2 = _this.socket) === null || _this_socket2 === void 0 ? void 0 : _this_socket2.recovered, ") (transport - ").concat(transport, ")"));
707
+ _this.isDisconnected = false;
690
708
  _this.connectCallbacks.forEach(function(cb) {
691
709
  return cb();
692
710
  });
693
711
  });
694
712
  this.socket.on("disconnect", function(reason) {
695
- console.log("Socket disconnected:", reason);
696
- _this.disconnectCallbacks.forEach(function(cb) {
697
- return cb();
698
- });
713
+ _this.handleDisconnect("disconnect", reason);
699
714
  });
700
715
  this.socket.io.on("close", function(reason) {
701
- console.log("Socket Manager close:", reason);
702
- _this.disconnectCallbacks.forEach(function(cb) {
703
- return cb();
704
- });
716
+ _this.handleDisconnect("manager_close", reason);
705
717
  });
706
718
  this.socket.io.engine.on("close", function(reason) {
707
- console.log("Socket Engine close:", reason);
708
- _this.disconnectCallbacks.forEach(function(cb) {
709
- return cb();
710
- });
719
+ _this.handleDisconnect("engine_close", reason);
711
720
  });
712
721
  this.socket.on("session", function(param) {
713
722
  var session_id = param.session_id;
@@ -718,6 +727,16 @@ var SocketService = /*#__PURE__*/ function() {
718
727
  this.socket.on("connect_error", function(error) {
719
728
  console.error("Socket connection error:", error);
720
729
  });
730
+ this.socket.io.on("reconnect_attempt", function(attempt) {
731
+ console.log("Socket reconnect attempt:", attempt);
732
+ });
733
+ this.socket.io.on("reconnect_error", function(error) {
734
+ console.error("Socket reconnect error:", error);
735
+ });
736
+ this.socket.io.on("reconnect", function(attempt) {
737
+ console.log("Socket reconnected after attempts:", attempt);
738
+ _this.isDisconnected = false;
739
+ });
721
740
  }
722
741
  }
723
742
  },
@@ -936,21 +955,6 @@ var SocketService = /*#__PURE__*/ function() {
936
955
  });
937
956
  });
938
957
  }
939
- },
940
- {
941
- key: "clearAllRedisData",
942
- value: function clearAllRedisData() {
943
- var s = this.getSocketInstance();
944
- return new Promise(function(resolve, reject) {
945
- s.emit("clear_all_redis_data", function(ack) {
946
- if (ack.success) {
947
- resolve(ack);
948
- } else {
949
- reject(new Error(ack.message || "Clear all Redis data operation failed"));
950
- }
951
- });
952
- });
953
- }
954
958
  }
955
959
  ], [
956
960
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akeyless-client-commons",
3
- "version": "1.1.100",
3
+ "version": "1.1.102",
4
4
  "scripts": {
5
5
  "build": "tsup",
6
6
  "deploy": "npm run build && npm version patch --no-git-tag-version && npm publish",