akeyless-client-commons 1.1.45 → 1.1.46
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.
- package/dist/hooks/index.d.mts +4 -0
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/index.js +17 -0
- package/dist/hooks/index.mjs +17 -0
- package/package.json +1 -1
package/dist/hooks/index.d.mts
CHANGED
|
@@ -53,6 +53,10 @@ interface UseDbSnapshotsSettings {
|
|
|
53
53
|
cleanupForConfigChange?: boolean;
|
|
54
54
|
disableLogs?: boolean;
|
|
55
55
|
worker?: UseWebWorkerOptions;
|
|
56
|
+
socket?: {
|
|
57
|
+
onDisconnect?: (unsubscribe: () => void) => void;
|
|
58
|
+
onConnect?: (unsubscribe: () => void) => void;
|
|
59
|
+
};
|
|
56
60
|
}
|
|
57
61
|
declare const useDbSnapshots: (configs: OnSnapshotConfig[], label?: string, settings?: UseDbSnapshotsSettings) => void;
|
|
58
62
|
declare const useSmartSnapshots: (configs: OnSnapshotConfig[], label?: string, settings?: UseDbSnapshotsSettings) => {
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -53,6 +53,10 @@ interface UseDbSnapshotsSettings {
|
|
|
53
53
|
cleanupForConfigChange?: boolean;
|
|
54
54
|
disableLogs?: boolean;
|
|
55
55
|
worker?: UseWebWorkerOptions;
|
|
56
|
+
socket?: {
|
|
57
|
+
onDisconnect?: (unsubscribe: () => void) => void;
|
|
58
|
+
onConnect?: (unsubscribe: () => void) => void;
|
|
59
|
+
};
|
|
56
60
|
}
|
|
57
61
|
declare const useDbSnapshots: (configs: OnSnapshotConfig[], label?: string, settings?: UseDbSnapshotsSettings) => void;
|
|
58
62
|
declare const useSmartSnapshots: (configs: OnSnapshotConfig[], label?: string, settings?: UseDbSnapshotsSettings) => {
|
package/dist/hooks/index.js
CHANGED
|
@@ -1604,15 +1604,31 @@ var useSocketSnapshots = function(configs, label, settings) {
|
|
|
1604
1604
|
if (socketServiceInstance.isConnected()) {
|
|
1605
1605
|
setSocketConnected(true);
|
|
1606
1606
|
subscribe();
|
|
1607
|
+
} else if (!socketStarted.current) {
|
|
1608
|
+
socketStarted.current = true;
|
|
1609
|
+
auth.currentUser.getIdToken().then(function(token) {
|
|
1610
|
+
socketServiceInstance.startSession(token);
|
|
1611
|
+
if (!(settings === null || settings === void 0 ? void 0 : settings.disableLogs)) {
|
|
1612
|
+
console.log("==> ".concat(label || "Cache snapshots", " started... "));
|
|
1613
|
+
}
|
|
1614
|
+
}).catch(function(err) {
|
|
1615
|
+
socketStarted.current = false;
|
|
1616
|
+
if (!(settings === null || settings === void 0 ? void 0 : settings.disableLogs)) {
|
|
1617
|
+
console.error("==> ".concat(label || "Cache snapshots", " failed to acquire token:"), err);
|
|
1618
|
+
}
|
|
1619
|
+
});
|
|
1607
1620
|
}
|
|
1608
1621
|
(_offConnectRef_current = offConnectRef.current) === null || _offConnectRef_current === void 0 ? void 0 : _offConnectRef_current.call(offConnectRef);
|
|
1609
1622
|
(_offDisconnectRef_current = offDisconnectRef.current) === null || _offDisconnectRef_current === void 0 ? void 0 : _offDisconnectRef_current.call(offDisconnectRef);
|
|
1610
1623
|
offConnectRef.current = socketServiceInstance.onConnect(function() {
|
|
1624
|
+
var _settings_socket_onConnect, _settings_socket;
|
|
1611
1625
|
setSocketConnected(true);
|
|
1612
1626
|
socketStarted.current = false;
|
|
1613
1627
|
subscribe();
|
|
1628
|
+
settings === null || settings === void 0 ? void 0 : (_settings_socket = settings.socket) === null || _settings_socket === void 0 ? void 0 : (_settings_socket_onConnect = _settings_socket.onConnect) === null || _settings_socket_onConnect === void 0 ? void 0 : _settings_socket_onConnect.call(_settings_socket, offConnectRef.current);
|
|
1614
1629
|
});
|
|
1615
1630
|
offDisconnectRef.current = socketServiceInstance.onDisconnect(function() {
|
|
1631
|
+
var _settings_socket_onDisconnect, _settings_socket;
|
|
1616
1632
|
setSocketConnected(false);
|
|
1617
1633
|
cleanupSubscriptionsRef.current.forEach(function(cleanup) {
|
|
1618
1634
|
return cleanup();
|
|
@@ -1620,6 +1636,7 @@ var useSocketSnapshots = function(configs, label, settings) {
|
|
|
1620
1636
|
cleanupSubscriptionsRef.current = [];
|
|
1621
1637
|
activeSubscriptionKeyRef.current = null;
|
|
1622
1638
|
activeCollectionsRef.current = /* @__PURE__ */ new Set();
|
|
1639
|
+
settings === null || settings === void 0 ? void 0 : (_settings_socket = settings.socket) === null || _settings_socket === void 0 ? void 0 : (_settings_socket_onDisconnect = _settings_socket.onDisconnect) === null || _settings_socket_onDisconnect === void 0 ? void 0 : _settings_socket_onDisconnect.call(_settings_socket, offDisconnectRef.current);
|
|
1623
1640
|
});
|
|
1624
1641
|
if (settings === null || settings === void 0 ? void 0 : settings.cleanupForConfigChange) {
|
|
1625
1642
|
return function() {
|
package/dist/hooks/index.mjs
CHANGED
|
@@ -1507,15 +1507,31 @@ var useSocketSnapshots = function(configs, label, settings) {
|
|
|
1507
1507
|
if (socketServiceInstance.isConnected()) {
|
|
1508
1508
|
setSocketConnected(true);
|
|
1509
1509
|
subscribe();
|
|
1510
|
+
} else if (!socketStarted.current) {
|
|
1511
|
+
socketStarted.current = true;
|
|
1512
|
+
auth.currentUser.getIdToken().then(function(token) {
|
|
1513
|
+
socketServiceInstance.startSession(token);
|
|
1514
|
+
if (!(settings === null || settings === void 0 ? void 0 : settings.disableLogs)) {
|
|
1515
|
+
console.log("==> ".concat(label || "Cache snapshots", " started... "));
|
|
1516
|
+
}
|
|
1517
|
+
}).catch(function(err) {
|
|
1518
|
+
socketStarted.current = false;
|
|
1519
|
+
if (!(settings === null || settings === void 0 ? void 0 : settings.disableLogs)) {
|
|
1520
|
+
console.error("==> ".concat(label || "Cache snapshots", " failed to acquire token:"), err);
|
|
1521
|
+
}
|
|
1522
|
+
});
|
|
1510
1523
|
}
|
|
1511
1524
|
(_offConnectRef_current = offConnectRef.current) === null || _offConnectRef_current === void 0 ? void 0 : _offConnectRef_current.call(offConnectRef);
|
|
1512
1525
|
(_offDisconnectRef_current = offDisconnectRef.current) === null || _offDisconnectRef_current === void 0 ? void 0 : _offDisconnectRef_current.call(offDisconnectRef);
|
|
1513
1526
|
offConnectRef.current = socketServiceInstance.onConnect(function() {
|
|
1527
|
+
var _settings_socket_onConnect, _settings_socket;
|
|
1514
1528
|
setSocketConnected(true);
|
|
1515
1529
|
socketStarted.current = false;
|
|
1516
1530
|
subscribe();
|
|
1531
|
+
settings === null || settings === void 0 ? void 0 : (_settings_socket = settings.socket) === null || _settings_socket === void 0 ? void 0 : (_settings_socket_onConnect = _settings_socket.onConnect) === null || _settings_socket_onConnect === void 0 ? void 0 : _settings_socket_onConnect.call(_settings_socket, offConnectRef.current);
|
|
1517
1532
|
});
|
|
1518
1533
|
offDisconnectRef.current = socketServiceInstance.onDisconnect(function() {
|
|
1534
|
+
var _settings_socket_onDisconnect, _settings_socket;
|
|
1519
1535
|
setSocketConnected(false);
|
|
1520
1536
|
cleanupSubscriptionsRef.current.forEach(function(cleanup) {
|
|
1521
1537
|
return cleanup();
|
|
@@ -1523,6 +1539,7 @@ var useSocketSnapshots = function(configs, label, settings) {
|
|
|
1523
1539
|
cleanupSubscriptionsRef.current = [];
|
|
1524
1540
|
activeSubscriptionKeyRef.current = null;
|
|
1525
1541
|
activeCollectionsRef.current = /* @__PURE__ */ new Set();
|
|
1542
|
+
settings === null || settings === void 0 ? void 0 : (_settings_socket = settings.socket) === null || _settings_socket === void 0 ? void 0 : (_settings_socket_onDisconnect = _settings_socket.onDisconnect) === null || _settings_socket_onDisconnect === void 0 ? void 0 : _settings_socket_onDisconnect.call(_settings_socket, offDisconnectRef.current);
|
|
1526
1543
|
});
|
|
1527
1544
|
if (settings === null || settings === void 0 ? void 0 : settings.cleanupForConfigChange) {
|
|
1528
1545
|
return function() {
|