akeyless-client-commons 1.1.17-test.9 → 1.1.19

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.
@@ -1189,310 +1189,6 @@ var biDomain = isLocal ? "http://localhost:9002/api/bi" : baseDomain + "/bi";
1189
1189
  var notificationsDomain = isLocal ? "http://localhost:9006/api/notifications" : baseDomain + "/notifications";
1190
1190
  var callCenterGeoDomain = isLocal ? "http://localhost:9007/api/call-center/geo" : baseDomain + "/call-center/geo";
1191
1191
  var callCenterEventsDomain = isLocal ? "http://localhost:9008/api/call-center/events" : baseDomain + "/call-center/events";
1192
- var dataSocketDomain = isLocal ? "http://localhost:9009/api/data-socket" : baseDomain + "/data-socket";
1193
- var dataSyncDomain = isLocal ? "http://localhost:9010/api/data-sync" : baseDomain + "/data-sync";
1194
- // src/helpers/socket.ts
1195
- var import_socket = require("socket.io-client");
1196
- var SESSION_STORAGE_KEY = "sessionId";
1197
- var SocketService = /*#__PURE__*/ function() {
1198
- "use strict";
1199
- function _SocketService() {
1200
- _class_call_check(this, _SocketService);
1201
- this.socket = null;
1202
- this.connectCallbacks = [];
1203
- this.disconnectCallbacks = [];
1204
- this.authToken = null;
1205
- }
1206
- _create_class(_SocketService, [
1207
- {
1208
- /// Initialize the socket connection
1209
- key: "initSocket",
1210
- value: function initSocket() {
1211
- var _this = this;
1212
- if (!this.socket) {
1213
- var socketUrl = isLocal ? "http://localhost:9009" : mode === "qa" ? "https://nx-api.xyz" : "https://nx-api.info";
1214
- this.socket = (0, import_socket.io)(socketUrl, {
1215
- path: "/api/data-socket/connect",
1216
- auth: function(cb) {
1217
- var sessionId = localStorage.getItem(SESSION_STORAGE_KEY) || void 0;
1218
- var token = _this.authToken;
1219
- var authPayload = {};
1220
- if (token) authPayload.token = token;
1221
- if (sessionId) authPayload.sessionId = sessionId;
1222
- cb(authPayload);
1223
- },
1224
- reconnection: true,
1225
- reconnectionAttempts: 30,
1226
- reconnectionDelay: 2 * 1e3
1227
- });
1228
- this.socket.on("connect", function() {
1229
- var _this_socket, _this_socket1;
1230
- 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, ")"));
1231
- _this.connectCallbacks.forEach(function(cb) {
1232
- return cb();
1233
- });
1234
- });
1235
- this.socket.on("disconnect", function(reason) {
1236
- console.log("Socket disconnected:", reason);
1237
- _this.disconnectCallbacks.forEach(function(cb) {
1238
- return cb();
1239
- });
1240
- });
1241
- this.socket.on("session", function(param) {
1242
- var sessionId = param.sessionId;
1243
- if (sessionId) {
1244
- localStorage.setItem(SESSION_STORAGE_KEY, sessionId);
1245
- }
1246
- });
1247
- this.socket.on("connect_error", function(error) {
1248
- console.error("Socket connection error:", error);
1249
- });
1250
- }
1251
- }
1252
- },
1253
- {
1254
- /// get socket instance
1255
- key: "getSocketInstance",
1256
- value: function getSocketInstance() {
1257
- if (!this.socket) {
1258
- this.initSocket();
1259
- }
1260
- if (!this.socket) {
1261
- throw new Error("Socket not initialized");
1262
- }
1263
- if (!this.socket.connected) {
1264
- this.socket.connect();
1265
- }
1266
- return this.socket;
1267
- }
1268
- },
1269
- {
1270
- /// connection management methods
1271
- key: "startSession",
1272
- value: function startSession(token) {
1273
- this.setAuthToken(token);
1274
- this.initSocket();
1275
- }
1276
- },
1277
- {
1278
- key: "onConnect",
1279
- value: function onConnect(callback) {
1280
- var _this = this;
1281
- var _this_socket;
1282
- if (!this.connectCallbacks.includes(callback)) {
1283
- this.connectCallbacks.push(callback);
1284
- }
1285
- if ((_this_socket = this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.connected) {
1286
- callback();
1287
- }
1288
- return function() {
1289
- return _this.offConnect(callback);
1290
- };
1291
- }
1292
- },
1293
- {
1294
- key: "offConnect",
1295
- value: function offConnect(callback) {
1296
- this.connectCallbacks = this.connectCallbacks.filter(function(cb) {
1297
- return cb !== callback;
1298
- });
1299
- }
1300
- },
1301
- {
1302
- key: "onDisconnect",
1303
- value: function onDisconnect(callback) {
1304
- var _this = this;
1305
- if (!this.disconnectCallbacks.includes(callback)) {
1306
- this.disconnectCallbacks.push(callback);
1307
- }
1308
- if (this.socket && !this.socket.connected) {
1309
- callback();
1310
- }
1311
- return function() {
1312
- return _this.offDisconnect(callback);
1313
- };
1314
- }
1315
- },
1316
- {
1317
- key: "offDisconnect",
1318
- value: function offDisconnect(callback) {
1319
- this.disconnectCallbacks = this.disconnectCallbacks.filter(function(cb) {
1320
- return cb !== callback;
1321
- });
1322
- }
1323
- },
1324
- {
1325
- key: "isConnected",
1326
- value: function isConnected() {
1327
- var _this_socket;
1328
- return ((_this_socket = this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.connected) || false;
1329
- }
1330
- },
1331
- {
1332
- key: "setAuthToken",
1333
- value: function setAuthToken(token) {
1334
- this.authToken = token;
1335
- if (this.socket) {
1336
- this.socket.connect();
1337
- }
1338
- }
1339
- },
1340
- {
1341
- key: "disconnectSocket",
1342
- value: function disconnectSocket() {
1343
- if (this.socket) {
1344
- this.socket.io.engine.close();
1345
- }
1346
- }
1347
- },
1348
- {
1349
- /// subscribe to collections
1350
- key: "subscribeToCollections",
1351
- value: function subscribeToCollections(config) {
1352
- var _this = this;
1353
- if (config.length === 0) {
1354
- return function() {};
1355
- }
1356
- var s = this.getSocketInstance();
1357
- var collectionsNames = config.map(function(c) {
1358
- return c.collectionName;
1359
- });
1360
- var eventHandlers = [];
1361
- config.forEach(function(configuration) {
1362
- 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;
1363
- var attach = function(eventName, handler) {
1364
- _this.socket.off(eventName, handler);
1365
- _this.socket.on(eventName, handler);
1366
- eventHandlers.push({
1367
- eventName: eventName,
1368
- handler: handler
1369
- });
1370
- };
1371
- attach("initial:".concat(collectionName), onFirstTime);
1372
- attach("add:".concat(collectionName), onAdd);
1373
- attach("update:".concat(collectionName), onModify);
1374
- attach("delete:".concat(collectionName), onRemove);
1375
- extraParsers === null || extraParsers === void 0 ? void 0 : extraParsers.forEach(function(parsers) {
1376
- var extraOnAdd = parsers.onAdd, extraOnFirstTime = parsers.onFirstTime, extraOnModify = parsers.onModify, extraOnRemove = parsers.onRemove;
1377
- attach("initial:".concat(collectionName), extraOnFirstTime);
1378
- attach("add:".concat(collectionName), extraOnAdd);
1379
- attach("update:".concat(collectionName), extraOnModify);
1380
- attach("delete:".concat(collectionName), extraOnRemove);
1381
- });
1382
- });
1383
- s.emit("subscribe_collections", collectionsNames, function(callback) {
1384
- if (callback.success) {
1385
- console.log("Successfully subscribed to: ".concat(collectionsNames.join(", ")));
1386
- } else {
1387
- console.error("Failed to subscribe to ".concat(config.join(", "), ": ").concat(callback.message));
1388
- }
1389
- });
1390
- return function() {
1391
- console.log("Cleaning up subscriptions for: ".concat(collectionsNames.join(", ")));
1392
- s.emit("unsubscribe_collections", collectionsNames);
1393
- eventHandlers.forEach(function(eh) {
1394
- s.off(eh.eventName, eh.handler);
1395
- });
1396
- };
1397
- }
1398
- },
1399
- {
1400
- /// set data
1401
- key: "setData",
1402
- value: function setData(payload) {
1403
- var s = this.getSocketInstance();
1404
- return new Promise(function(resolve, reject) {
1405
- s.emit("set_data", payload, function(callback) {
1406
- if (callback.success) {
1407
- console.log("Data saved successfully:", payload);
1408
- console.log("ack", callback);
1409
- resolve(callback);
1410
- } else {
1411
- reject(new Error(callback.message || "Save operation failed"));
1412
- }
1413
- });
1414
- });
1415
- }
1416
- },
1417
- {
1418
- /// get data
1419
- key: "getCollectionData",
1420
- value: function getCollectionData(payload) {
1421
- var s = this.getSocketInstance();
1422
- s.emit("get_data", {
1423
- collection_name: payload.collection_name
1424
- }, function(socketCallback) {
1425
- if (socketCallback.success && socketCallback.data) {
1426
- payload.callback(socketCallback.data);
1427
- } else {
1428
- payload.callback(payload.defaultValue);
1429
- }
1430
- });
1431
- }
1432
- },
1433
- {
1434
- key: "getDocumentData",
1435
- value: function getDocumentData(payload) {
1436
- var s = this.getSocketInstance();
1437
- s.emit("get_data", {
1438
- collection_name: payload.collection_name,
1439
- key: payload.key
1440
- }, function(socketCallback) {
1441
- if (socketCallback.success && socketCallback.data) {
1442
- payload.callback(socketCallback.data);
1443
- } else {
1444
- payload.callback(payload.defaultValue);
1445
- }
1446
- });
1447
- }
1448
- },
1449
- {
1450
- /// delete data
1451
- key: "deleteData",
1452
- value: function deleteData(payload) {
1453
- var s = this.getSocketInstance();
1454
- return new Promise(function(resolve, reject) {
1455
- s.emit("delete_data", payload, function(callback) {
1456
- if (callback.success) {
1457
- console.log("Data deleted successfully:", payload);
1458
- console.log("delete ack", callback);
1459
- resolve(callback);
1460
- } else {
1461
- reject(new Error(callback.message || "Delete operation failed"));
1462
- }
1463
- });
1464
- });
1465
- }
1466
- },
1467
- {
1468
- key: "clearAllRedisData",
1469
- value: function clearAllRedisData() {
1470
- var s = this.getSocketInstance();
1471
- return new Promise(function(resolve, reject) {
1472
- s.emit("clear_all_redis_data", function(ack) {
1473
- if (ack.success) {
1474
- resolve(ack);
1475
- } else {
1476
- reject(new Error(ack.message || "Clear all Redis data operation failed"));
1477
- }
1478
- });
1479
- });
1480
- }
1481
- }
1482
- ], [
1483
- {
1484
- key: "getInstance",
1485
- value: function getInstance() {
1486
- if (!_SocketService.instance) {
1487
- _SocketService.instance = new _SocketService();
1488
- }
1489
- return _SocketService.instance;
1490
- }
1491
- }
1492
- ]);
1493
- return _SocketService;
1494
- }();
1495
- var socketServiceInstance = SocketService.getInstance();
1496
1192
  // src/components/utils/Checkboxes.tsx
1497
1193
  var import_react2 = require("react");
1498
1194
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -4045,14 +3741,14 @@ function rectsAreEqual(a, b) {
4045
3741
  return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
4046
3742
  }
4047
3743
  function observeMove(element, onMove) {
4048
- var io2 = null;
3744
+ var io = null;
4049
3745
  var timeoutId;
4050
3746
  var root = getDocumentElement(element);
4051
3747
  function cleanup() {
4052
3748
  var _io;
4053
3749
  clearTimeout(timeoutId);
4054
- (_io = io2) == null || _io.disconnect();
4055
- io2 = null;
3750
+ (_io = io) == null || _io.disconnect();
3751
+ io = null;
4056
3752
  }
4057
3753
  function refresh(skip, threshold) {
4058
3754
  if (skip === void 0) {
@@ -4100,14 +3796,14 @@ function observeMove(element, onMove) {
4100
3796
  isFirstUpdate = false;
4101
3797
  }
4102
3798
  try {
4103
- io2 = new IntersectionObserver(handleObserve, _object_spread_props(_object_spread({}, options), {
3799
+ io = new IntersectionObserver(handleObserve, _object_spread_props(_object_spread({}, options), {
4104
3800
  // Handle <iframe>s
4105
3801
  root: root.ownerDocument
4106
3802
  }));
4107
3803
  } catch (e) {
4108
- io2 = new IntersectionObserver(handleObserve, options);
3804
+ io = new IntersectionObserver(handleObserve, options);
4109
3805
  }
4110
- io2.observe(element);
3806
+ io.observe(element);
4111
3807
  }
4112
3808
  refresh(true);
4113
3809
  return cleanup;
@@ -6151,9 +5847,9 @@ var InputContainer = function(param) {
6151
5847
  minLength: minLength,
6152
5848
  placeholder: placeholder,
6153
5849
  className: cn("flex-1 bg-inherit h-9 py-2 px-3", defaultFormElementBorderClassName, elementClassName),
6154
- defaultValue: defaultValue
5850
+ defaultValue: value ? void 0 : defaultValue,
5851
+ value: defaultValue ? void 0 : value
6155
5852
  }), validationProps), {
6156
- value: value,
6157
5853
  onChange: function(e) {
6158
5854
  return handleChangeFunction(e);
6159
5855
  },
@@ -6379,13 +6075,13 @@ var TextAreaContainer = function(param) {
6379
6075
  ]);
6380
6076
  return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(FormElementContainer, _object_spread_props(_object_spread({}, containerProps), {
6381
6077
  children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("textarea", _object_spread_props(_object_spread({}, props), {
6382
- value: value,
6078
+ defaultValue: value ? void 0 : defaultValue,
6079
+ value: defaultValue ? void 0 : value,
6383
6080
  onChange: onChange,
6384
6081
  dir: direction,
6385
6082
  minLength: minLength,
6386
6083
  placeholder: placeholder,
6387
6084
  className: cn("flex-1 bg-inherit min-h-16 max-h-52 overflow-auto px-2 py-1", defaultFormElementBorderClassName, elementClassName),
6388
- defaultValue: defaultValue,
6389
6085
  required: required,
6390
6086
  name: name,
6391
6087
  onKeyDown: onKeyDown