akeyless-client-commons 1.1.17-test.3 → 1.1.17-test.5

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.
@@ -1200,6 +1200,7 @@ var SocketService = /*#__PURE__*/ function() {
1200
1200
  this.socket = null;
1201
1201
  this.connectCallbacks = [];
1202
1202
  this.disconnectCallbacks = [];
1203
+ this.authToken = null;
1203
1204
  }
1204
1205
  _create_class(_SocketService, [
1205
1206
  {
@@ -1213,7 +1214,10 @@ var SocketService = /*#__PURE__*/ function() {
1213
1214
  path: "/api/data-socket/connect",
1214
1215
  transports: [
1215
1216
  "websocket"
1216
- ]
1217
+ ],
1218
+ auth: this.authToken ? {
1219
+ token: this.authToken
1220
+ } : void 0
1217
1221
  });
1218
1222
  this.socket.on("connect", function() {
1219
1223
  var _this_socket;
@@ -1449,6 +1453,21 @@ var SocketService = /*#__PURE__*/ function() {
1449
1453
  var _this_socket;
1450
1454
  return ((_this_socket = this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.connected) || false;
1451
1455
  }
1456
+ },
1457
+ {
1458
+ key: "setAuthToken",
1459
+ value: function setAuthToken(token) {
1460
+ this.authToken = token;
1461
+ if (this.socket) {
1462
+ this.socket.auth = {
1463
+ token: token
1464
+ };
1465
+ if (this.socket.connected) {
1466
+ this.socket.disconnect();
1467
+ }
1468
+ this.socket.connect();
1469
+ }
1470
+ }
1452
1471
  }
1453
1472
  ], [
1454
1473
  {
@@ -978,6 +978,7 @@ var SocketService = /*#__PURE__*/ function() {
978
978
  this.socket = null;
979
979
  this.connectCallbacks = [];
980
980
  this.disconnectCallbacks = [];
981
+ this.authToken = null;
981
982
  }
982
983
  _create_class(_SocketService, [
983
984
  {
@@ -991,7 +992,10 @@ var SocketService = /*#__PURE__*/ function() {
991
992
  path: "/api/data-socket/connect",
992
993
  transports: [
993
994
  "websocket"
994
- ]
995
+ ],
996
+ auth: this.authToken ? {
997
+ token: this.authToken
998
+ } : void 0
995
999
  });
996
1000
  this.socket.on("connect", function() {
997
1001
  var _this_socket;
@@ -1227,6 +1231,21 @@ var SocketService = /*#__PURE__*/ function() {
1227
1231
  var _this_socket;
1228
1232
  return ((_this_socket = this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.connected) || false;
1229
1233
  }
1234
+ },
1235
+ {
1236
+ key: "setAuthToken",
1237
+ value: function setAuthToken(token) {
1238
+ this.authToken = token;
1239
+ if (this.socket) {
1240
+ this.socket.auth = {
1241
+ token: token
1242
+ };
1243
+ if (this.socket.connected) {
1244
+ this.socket.disconnect();
1245
+ }
1246
+ this.socket.connect();
1247
+ }
1248
+ }
1230
1249
  }
1231
1250
  ], [
1232
1251
  {
@@ -274,6 +274,7 @@ declare class SocketService {
274
274
  private socket;
275
275
  private connectCallbacks;
276
276
  private disconnectCallbacks;
277
+ private authToken;
277
278
  private initSocket;
278
279
  private constructor();
279
280
  static getInstance(): SocketService;
@@ -292,6 +293,7 @@ declare class SocketService {
292
293
  onDisconnect(callback: () => void): void;
293
294
  offDisconnect(callback: () => void): void;
294
295
  isConnected(): boolean;
296
+ setAuthToken(token: string): void;
295
297
  }
296
298
  declare const socketServiceInstance: SocketService;
297
299
 
@@ -274,6 +274,7 @@ declare class SocketService {
274
274
  private socket;
275
275
  private connectCallbacks;
276
276
  private disconnectCallbacks;
277
+ private authToken;
277
278
  private initSocket;
278
279
  private constructor();
279
280
  static getInstance(): SocketService;
@@ -292,6 +293,7 @@ declare class SocketService {
292
293
  onDisconnect(callback: () => void): void;
293
294
  offDisconnect(callback: () => void): void;
294
295
  isConnected(): boolean;
296
+ setAuthToken(token: string): void;
295
297
  }
296
298
  declare const socketServiceInstance: SocketService;
297
299
 
@@ -2306,6 +2306,7 @@ var SocketService = /*#__PURE__*/ function() {
2306
2306
  this.socket = null;
2307
2307
  this.connectCallbacks = [];
2308
2308
  this.disconnectCallbacks = [];
2309
+ this.authToken = null;
2309
2310
  }
2310
2311
  _create_class(_SocketService, [
2311
2312
  {
@@ -2319,7 +2320,10 @@ var SocketService = /*#__PURE__*/ function() {
2319
2320
  path: "/api/data-socket/connect",
2320
2321
  transports: [
2321
2322
  "websocket"
2322
- ]
2323
+ ],
2324
+ auth: this.authToken ? {
2325
+ token: this.authToken
2326
+ } : void 0
2323
2327
  });
2324
2328
  this.socket.on("connect", function() {
2325
2329
  var _this_socket;
@@ -2555,6 +2559,21 @@ var SocketService = /*#__PURE__*/ function() {
2555
2559
  var _this_socket;
2556
2560
  return ((_this_socket = this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.connected) || false;
2557
2561
  }
2562
+ },
2563
+ {
2564
+ key: "setAuthToken",
2565
+ value: function setAuthToken(token) {
2566
+ this.authToken = token;
2567
+ if (this.socket) {
2568
+ this.socket.auth = {
2569
+ token: token
2570
+ };
2571
+ if (this.socket.connected) {
2572
+ this.socket.disconnect();
2573
+ }
2574
+ this.socket.connect();
2575
+ }
2576
+ }
2558
2577
  }
2559
2578
  ], [
2560
2579
  {
@@ -1942,6 +1942,7 @@ var SocketService = /*#__PURE__*/ function() {
1942
1942
  this.socket = null;
1943
1943
  this.connectCallbacks = [];
1944
1944
  this.disconnectCallbacks = [];
1945
+ this.authToken = null;
1945
1946
  }
1946
1947
  _create_class(_SocketService, [
1947
1948
  {
@@ -1955,7 +1956,10 @@ var SocketService = /*#__PURE__*/ function() {
1955
1956
  path: "/api/data-socket/connect",
1956
1957
  transports: [
1957
1958
  "websocket"
1958
- ]
1959
+ ],
1960
+ auth: this.authToken ? {
1961
+ token: this.authToken
1962
+ } : void 0
1959
1963
  });
1960
1964
  this.socket.on("connect", function() {
1961
1965
  var _this_socket;
@@ -2191,6 +2195,21 @@ var SocketService = /*#__PURE__*/ function() {
2191
2195
  var _this_socket;
2192
2196
  return ((_this_socket = this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.connected) || false;
2193
2197
  }
2198
+ },
2199
+ {
2200
+ key: "setAuthToken",
2201
+ value: function setAuthToken(token) {
2202
+ this.authToken = token;
2203
+ if (this.socket) {
2204
+ this.socket.auth = {
2205
+ token: token
2206
+ };
2207
+ if (this.socket.connected) {
2208
+ this.socket.disconnect();
2209
+ }
2210
+ this.socket.connect();
2211
+ }
2212
+ }
2194
2213
  }
2195
2214
  ], [
2196
2215
  {
@@ -651,6 +651,7 @@ var SocketService = /*#__PURE__*/ function() {
651
651
  this.socket = null;
652
652
  this.connectCallbacks = [];
653
653
  this.disconnectCallbacks = [];
654
+ this.authToken = null;
654
655
  }
655
656
  _create_class(_SocketService, [
656
657
  {
@@ -664,7 +665,10 @@ var SocketService = /*#__PURE__*/ function() {
664
665
  path: "/api/data-socket/connect",
665
666
  transports: [
666
667
  "websocket"
667
- ]
668
+ ],
669
+ auth: this.authToken ? {
670
+ token: this.authToken
671
+ } : void 0
668
672
  });
669
673
  this.socket.on("connect", function() {
670
674
  var _this_socket;
@@ -900,6 +904,21 @@ var SocketService = /*#__PURE__*/ function() {
900
904
  var _this_socket;
901
905
  return ((_this_socket = this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.connected) || false;
902
906
  }
907
+ },
908
+ {
909
+ key: "setAuthToken",
910
+ value: function setAuthToken(token) {
911
+ this.authToken = token;
912
+ if (this.socket) {
913
+ this.socket.auth = {
914
+ token: token
915
+ };
916
+ if (this.socket.connected) {
917
+ this.socket.disconnect();
918
+ }
919
+ this.socket.connect();
920
+ }
921
+ }
903
922
  }
904
923
  ], [
905
924
  {
@@ -961,10 +980,13 @@ var useSocketSubscription = function(configs, label, settings) {
961
980
  }).join(", ")));
962
981
  }
963
982
  } else {
964
- socketServiceInstance.getSocketInstance();
965
- if (!(settings === null || settings === void 0 ? void 0 : settings.disableLogs) && configs.length > 0) {
966
- console.log("==> ".concat(label || "Cache snapshots", " started... "));
967
- }
983
+ auth.currentUser.getIdToken().then(function(token) {
984
+ socketServiceInstance.setAuthToken(token);
985
+ socketServiceInstance.getSocketInstance();
986
+ if (!(settings === null || settings === void 0 ? void 0 : settings.disableLogs) && configs.length > 0) {
987
+ console.log("==> ".concat(label || "Cache snapshots", " started... "));
988
+ }
989
+ });
968
990
  }
969
991
  var uiOnConnect = function() {
970
992
  setSocketConnected(true);
@@ -557,6 +557,7 @@ var SocketService = /*#__PURE__*/ function() {
557
557
  this.socket = null;
558
558
  this.connectCallbacks = [];
559
559
  this.disconnectCallbacks = [];
560
+ this.authToken = null;
560
561
  }
561
562
  _create_class(_SocketService, [
562
563
  {
@@ -570,7 +571,10 @@ var SocketService = /*#__PURE__*/ function() {
570
571
  path: "/api/data-socket/connect",
571
572
  transports: [
572
573
  "websocket"
573
- ]
574
+ ],
575
+ auth: this.authToken ? {
576
+ token: this.authToken
577
+ } : void 0
574
578
  });
575
579
  this.socket.on("connect", function() {
576
580
  var _this_socket;
@@ -806,6 +810,21 @@ var SocketService = /*#__PURE__*/ function() {
806
810
  var _this_socket;
807
811
  return ((_this_socket = this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.connected) || false;
808
812
  }
813
+ },
814
+ {
815
+ key: "setAuthToken",
816
+ value: function setAuthToken(token) {
817
+ this.authToken = token;
818
+ if (this.socket) {
819
+ this.socket.auth = {
820
+ token: token
821
+ };
822
+ if (this.socket.connected) {
823
+ this.socket.disconnect();
824
+ }
825
+ this.socket.connect();
826
+ }
827
+ }
809
828
  }
810
829
  ], [
811
830
  {
@@ -867,10 +886,13 @@ var useSocketSubscription = function(configs, label, settings) {
867
886
  }).join(", ")));
868
887
  }
869
888
  } else {
870
- socketServiceInstance.getSocketInstance();
871
- if (!(settings === null || settings === void 0 ? void 0 : settings.disableLogs) && configs.length > 0) {
872
- console.log("==> ".concat(label || "Cache snapshots", " started... "));
873
- }
889
+ auth.currentUser.getIdToken().then(function(token) {
890
+ socketServiceInstance.setAuthToken(token);
891
+ socketServiceInstance.getSocketInstance();
892
+ if (!(settings === null || settings === void 0 ? void 0 : settings.disableLogs) && configs.length > 0) {
893
+ console.log("==> ".concat(label || "Cache snapshots", " started... "));
894
+ }
895
+ });
874
896
  }
875
897
  var uiOnConnect = function() {
876
898
  setSocketConnected(true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akeyless-client-commons",
3
- "version": "1.1.17-test.3",
3
+ "version": "1.1.17-test.5",
4
4
  "scripts": {
5
5
  "build": "tsup",
6
6
  "deploy": "npm run build && npm version patch --no-git-tag-version && npm publish",