akeyless-client-commons 1.1.47 → 1.1.48
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 +39 -1
- package/dist/hooks/index.d.ts +39 -1
- package/dist/hooks/index.js +3 -1
- package/dist/hooks/index.mjs +3 -1
- package/package.json +1 -1
package/dist/hooks/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CountryOptions } from 'akeyless-types-commons';
|
|
1
|
+
import { CountryOptions, RedisUpdateType, RedisUpdatePayload, SocketCallbackResponse } from 'akeyless-types-commons';
|
|
2
2
|
import { Dispatch, SetStateAction, EffectCallback } from 'react';
|
|
3
3
|
import { WhereFilterOp } from 'firebase/firestore';
|
|
4
4
|
|
|
@@ -49,6 +49,42 @@ interface OnSnapshotConfig extends OnSnapshotParsers {
|
|
|
49
49
|
subscribeTo?: "cache" | "db";
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
interface GetDataPayload<T = any> {
|
|
53
|
+
key: string;
|
|
54
|
+
collection_name: string;
|
|
55
|
+
callback: (value: T) => void;
|
|
56
|
+
defaultValue: T;
|
|
57
|
+
}
|
|
58
|
+
declare class SocketService {
|
|
59
|
+
private static instance;
|
|
60
|
+
private socket;
|
|
61
|
+
private connectCallbacks;
|
|
62
|
+
private disconnectCallbacks;
|
|
63
|
+
private authToken;
|
|
64
|
+
private initSocket;
|
|
65
|
+
private constructor();
|
|
66
|
+
static getInstance(): SocketService;
|
|
67
|
+
private getSocketInstance;
|
|
68
|
+
startSession(token: string): void;
|
|
69
|
+
onConnect(callback: () => void): () => void;
|
|
70
|
+
offConnect(callback: () => void): void;
|
|
71
|
+
onDisconnect(callback: () => void): () => void;
|
|
72
|
+
offDisconnect(callback: () => void): void;
|
|
73
|
+
isConnected(): boolean;
|
|
74
|
+
setAuthToken(token: string): void;
|
|
75
|
+
disconnectSocket(): void;
|
|
76
|
+
subscribeToCollections(config: OnSnapshotConfig[]): () => void;
|
|
77
|
+
setData<UpdateType extends RedisUpdateType, DataType = any>(payload: RedisUpdatePayload<UpdateType, DataType>): Promise<SocketCallbackResponse>;
|
|
78
|
+
getCollectionData<T>(payload: Omit<GetDataPayload<T>, "key">): void;
|
|
79
|
+
getDocumentData<T>(payload: GetDataPayload<T>): void;
|
|
80
|
+
deleteData(payload: {
|
|
81
|
+
key: string;
|
|
82
|
+
collection_name: string;
|
|
83
|
+
}): Promise<SocketCallbackResponse>;
|
|
84
|
+
clearAllRedisData(): Promise<SocketCallbackResponse>;
|
|
85
|
+
}
|
|
86
|
+
declare const socketServiceInstance: SocketService;
|
|
87
|
+
|
|
52
88
|
interface UseDbSnapshotsSettings {
|
|
53
89
|
cleanupForConfigChange?: boolean;
|
|
54
90
|
disableLogs?: boolean;
|
|
@@ -56,6 +92,8 @@ interface UseDbSnapshotsSettings {
|
|
|
56
92
|
socket?: {
|
|
57
93
|
onDisconnect?: (unsubscribe: () => void) => void;
|
|
58
94
|
onConnect?: (unsubscribe: () => void) => void;
|
|
95
|
+
callback?: () => void;
|
|
96
|
+
getSocket?: (socket: typeof socketServiceInstance) => void;
|
|
59
97
|
};
|
|
60
98
|
}
|
|
61
99
|
declare const useDbSnapshots: (configs: OnSnapshotConfig[], label?: string, settings?: UseDbSnapshotsSettings) => void;
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CountryOptions } from 'akeyless-types-commons';
|
|
1
|
+
import { CountryOptions, RedisUpdateType, RedisUpdatePayload, SocketCallbackResponse } from 'akeyless-types-commons';
|
|
2
2
|
import { Dispatch, SetStateAction, EffectCallback } from 'react';
|
|
3
3
|
import { WhereFilterOp } from 'firebase/firestore';
|
|
4
4
|
|
|
@@ -49,6 +49,42 @@ interface OnSnapshotConfig extends OnSnapshotParsers {
|
|
|
49
49
|
subscribeTo?: "cache" | "db";
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
interface GetDataPayload<T = any> {
|
|
53
|
+
key: string;
|
|
54
|
+
collection_name: string;
|
|
55
|
+
callback: (value: T) => void;
|
|
56
|
+
defaultValue: T;
|
|
57
|
+
}
|
|
58
|
+
declare class SocketService {
|
|
59
|
+
private static instance;
|
|
60
|
+
private socket;
|
|
61
|
+
private connectCallbacks;
|
|
62
|
+
private disconnectCallbacks;
|
|
63
|
+
private authToken;
|
|
64
|
+
private initSocket;
|
|
65
|
+
private constructor();
|
|
66
|
+
static getInstance(): SocketService;
|
|
67
|
+
private getSocketInstance;
|
|
68
|
+
startSession(token: string): void;
|
|
69
|
+
onConnect(callback: () => void): () => void;
|
|
70
|
+
offConnect(callback: () => void): void;
|
|
71
|
+
onDisconnect(callback: () => void): () => void;
|
|
72
|
+
offDisconnect(callback: () => void): void;
|
|
73
|
+
isConnected(): boolean;
|
|
74
|
+
setAuthToken(token: string): void;
|
|
75
|
+
disconnectSocket(): void;
|
|
76
|
+
subscribeToCollections(config: OnSnapshotConfig[]): () => void;
|
|
77
|
+
setData<UpdateType extends RedisUpdateType, DataType = any>(payload: RedisUpdatePayload<UpdateType, DataType>): Promise<SocketCallbackResponse>;
|
|
78
|
+
getCollectionData<T>(payload: Omit<GetDataPayload<T>, "key">): void;
|
|
79
|
+
getDocumentData<T>(payload: GetDataPayload<T>): void;
|
|
80
|
+
deleteData(payload: {
|
|
81
|
+
key: string;
|
|
82
|
+
collection_name: string;
|
|
83
|
+
}): Promise<SocketCallbackResponse>;
|
|
84
|
+
clearAllRedisData(): Promise<SocketCallbackResponse>;
|
|
85
|
+
}
|
|
86
|
+
declare const socketServiceInstance: SocketService;
|
|
87
|
+
|
|
52
88
|
interface UseDbSnapshotsSettings {
|
|
53
89
|
cleanupForConfigChange?: boolean;
|
|
54
90
|
disableLogs?: boolean;
|
|
@@ -56,6 +92,8 @@ interface UseDbSnapshotsSettings {
|
|
|
56
92
|
socket?: {
|
|
57
93
|
onDisconnect?: (unsubscribe: () => void) => void;
|
|
58
94
|
onConnect?: (unsubscribe: () => void) => void;
|
|
95
|
+
callback?: () => void;
|
|
96
|
+
getSocket?: (socket: typeof socketServiceInstance) => void;
|
|
59
97
|
};
|
|
60
98
|
}
|
|
61
99
|
declare const useDbSnapshots: (configs: OnSnapshotConfig[], label?: string, settings?: UseDbSnapshotsSettings) => void;
|
package/dist/hooks/index.js
CHANGED
|
@@ -1555,7 +1555,7 @@ var useSocketSnapshots = function(configs, label, settings) {
|
|
|
1555
1555
|
});
|
|
1556
1556
|
};
|
|
1557
1557
|
useDeepCompareEffect(function() {
|
|
1558
|
-
var _offConnectRef_current, _offDisconnectRef_current;
|
|
1558
|
+
var _offConnectRef_current, _offDisconnectRef_current, _settings_socket_callback, _settings_socket, _settings_socket_getSocket, _settings_socket1;
|
|
1559
1559
|
if (!auth.currentUser) {
|
|
1560
1560
|
return;
|
|
1561
1561
|
}
|
|
@@ -1640,6 +1640,8 @@ var useSocketSnapshots = function(configs, label, settings) {
|
|
|
1640
1640
|
activeCollectionsRef.current = /* @__PURE__ */ new Set();
|
|
1641
1641
|
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);
|
|
1642
1642
|
});
|
|
1643
|
+
settings === null || settings === void 0 ? void 0 : (_settings_socket = settings.socket) === null || _settings_socket === void 0 ? void 0 : (_settings_socket_callback = _settings_socket.callback) === null || _settings_socket_callback === void 0 ? void 0 : _settings_socket_callback.call(_settings_socket);
|
|
1644
|
+
settings === null || settings === void 0 ? void 0 : (_settings_socket1 = settings.socket) === null || _settings_socket1 === void 0 ? void 0 : (_settings_socket_getSocket = _settings_socket1.getSocket) === null || _settings_socket_getSocket === void 0 ? void 0 : _settings_socket_getSocket.call(_settings_socket1, socketServiceInstance);
|
|
1643
1645
|
if (settings === null || settings === void 0 ? void 0 : settings.cleanupForConfigChange) {
|
|
1644
1646
|
return function() {
|
|
1645
1647
|
var _offConnectRef_current, _offDisconnectRef_current;
|
package/dist/hooks/index.mjs
CHANGED
|
@@ -1458,7 +1458,7 @@ var useSocketSnapshots = function(configs, label, settings) {
|
|
|
1458
1458
|
});
|
|
1459
1459
|
};
|
|
1460
1460
|
useDeepCompareEffect(function() {
|
|
1461
|
-
var _offConnectRef_current, _offDisconnectRef_current;
|
|
1461
|
+
var _offConnectRef_current, _offDisconnectRef_current, _settings_socket_callback, _settings_socket, _settings_socket_getSocket, _settings_socket1;
|
|
1462
1462
|
if (!auth.currentUser) {
|
|
1463
1463
|
return;
|
|
1464
1464
|
}
|
|
@@ -1543,6 +1543,8 @@ var useSocketSnapshots = function(configs, label, settings) {
|
|
|
1543
1543
|
activeCollectionsRef.current = /* @__PURE__ */ new Set();
|
|
1544
1544
|
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);
|
|
1545
1545
|
});
|
|
1546
|
+
settings === null || settings === void 0 ? void 0 : (_settings_socket = settings.socket) === null || _settings_socket === void 0 ? void 0 : (_settings_socket_callback = _settings_socket.callback) === null || _settings_socket_callback === void 0 ? void 0 : _settings_socket_callback.call(_settings_socket);
|
|
1547
|
+
settings === null || settings === void 0 ? void 0 : (_settings_socket1 = settings.socket) === null || _settings_socket1 === void 0 ? void 0 : (_settings_socket_getSocket = _settings_socket1.getSocket) === null || _settings_socket_getSocket === void 0 ? void 0 : _settings_socket_getSocket.call(_settings_socket1, socketServiceInstance);
|
|
1546
1548
|
if (settings === null || settings === void 0 ? void 0 : settings.cleanupForConfigChange) {
|
|
1547
1549
|
return function() {
|
|
1548
1550
|
var _offConnectRef_current, _offDisconnectRef_current;
|