akeyless-client-commons 1.1.1 → 1.1.3
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/components/index.css +22 -0
- package/dist/components/index.css.map +1 -1
- package/dist/components/index.d.mts +15 -1
- package/dist/components/index.d.ts +15 -1
- package/dist/components/index.js +94 -278
- package/dist/components/index.mjs +91 -279
- package/dist/helpers/index.d.mts +2 -34
- package/dist/helpers/index.d.ts +2 -34
- package/dist/helpers/index.js +0 -295
- package/dist/helpers/index.mjs +1 -292
- package/dist/hooks/index.d.mts +1 -5
- package/dist/hooks/index.d.ts +1 -5
- package/dist/hooks/index.js +1 -374
- package/dist/hooks/index.mjs +1 -370
- package/dist/types/index.d.mts +14 -1
- package/dist/types/index.d.ts +14 -1
- package/package.json +2 -4
package/dist/helpers/index.js
CHANGED
|
@@ -39,25 +39,6 @@ function _async_to_generator(fn) {
|
|
|
39
39
|
});
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
function _class_call_check(instance, Constructor) {
|
|
43
|
-
if (!(instance instanceof Constructor)) {
|
|
44
|
-
throw new TypeError("Cannot call a class as a function");
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function _defineProperties(target, props) {
|
|
48
|
-
for(var i = 0; i < props.length; i++){
|
|
49
|
-
var descriptor = props[i];
|
|
50
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
51
|
-
descriptor.configurable = true;
|
|
52
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
53
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
57
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
58
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
59
|
-
return Constructor;
|
|
60
|
-
}
|
|
61
42
|
function _define_property(obj, key, value) {
|
|
62
43
|
if (key in obj) {
|
|
63
44
|
Object.defineProperty(obj, key, {
|
|
@@ -567,9 +548,6 @@ __export(index_exports, {
|
|
|
567
548
|
snapshotDocument: function() {
|
|
568
549
|
return snapshotDocument;
|
|
569
550
|
},
|
|
570
|
-
socketServiceInstance: function() {
|
|
571
|
-
return socketServiceInstance;
|
|
572
|
-
},
|
|
573
551
|
sort_by_timestamp: function() {
|
|
574
552
|
return sort_by_timestamp;
|
|
575
553
|
},
|
|
@@ -2249,278 +2227,6 @@ var nxApiCall = /*#__PURE__*/ function() {
|
|
|
2249
2227
|
return _ref.apply(this, arguments);
|
|
2250
2228
|
};
|
|
2251
2229
|
}();
|
|
2252
|
-
// src/helpers/socket.ts
|
|
2253
|
-
var import_socket = require("socket.io-client");
|
|
2254
|
-
var SocketService = /*#__PURE__*/ function() {
|
|
2255
|
-
"use strict";
|
|
2256
|
-
function _SocketService() {
|
|
2257
|
-
_class_call_check(this, _SocketService);
|
|
2258
|
-
this.socket = null;
|
|
2259
|
-
this.connectCallbacks = [];
|
|
2260
|
-
this.disconnectCallbacks = [];
|
|
2261
|
-
this.initSocket();
|
|
2262
|
-
}
|
|
2263
|
-
_create_class(_SocketService, [
|
|
2264
|
-
{
|
|
2265
|
-
/// Initialize the socket connection
|
|
2266
|
-
key: "initSocket",
|
|
2267
|
-
value: function initSocket() {
|
|
2268
|
-
var _this = this;
|
|
2269
|
-
if (!this.socket) {
|
|
2270
|
-
var SOCKET_SERVER_URL = "http://localhost:9009";
|
|
2271
|
-
var SOCKET_PATH = "/api/data-socket/connect";
|
|
2272
|
-
this.socket = (0, import_socket.io)(SOCKET_SERVER_URL, {
|
|
2273
|
-
path: SOCKET_PATH,
|
|
2274
|
-
transports: [
|
|
2275
|
-
"websocket"
|
|
2276
|
-
]
|
|
2277
|
-
});
|
|
2278
|
-
this.socket.on("connect", function() {
|
|
2279
|
-
var _this_socket;
|
|
2280
|
-
console.log("Socket connected:", (_this_socket = _this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.id);
|
|
2281
|
-
_this.connectCallbacks.forEach(function(cb) {
|
|
2282
|
-
return cb();
|
|
2283
|
-
});
|
|
2284
|
-
});
|
|
2285
|
-
this.socket.on("disconnect", function(reason) {
|
|
2286
|
-
console.log("Socket disconnected:", reason);
|
|
2287
|
-
_this.disconnectCallbacks.forEach(function(cb) {
|
|
2288
|
-
return cb();
|
|
2289
|
-
});
|
|
2290
|
-
});
|
|
2291
|
-
this.socket.on("connect_error", function(error) {
|
|
2292
|
-
console.error("Socket connection error:", error);
|
|
2293
|
-
});
|
|
2294
|
-
}
|
|
2295
|
-
}
|
|
2296
|
-
},
|
|
2297
|
-
{
|
|
2298
|
-
/// get socket instance
|
|
2299
|
-
key: "getSocketInstance",
|
|
2300
|
-
value: function getSocketInstance() {
|
|
2301
|
-
if (!this.socket) {
|
|
2302
|
-
this.initSocket();
|
|
2303
|
-
}
|
|
2304
|
-
if (!this.socket) {
|
|
2305
|
-
throw new Error("Socket not initialized");
|
|
2306
|
-
}
|
|
2307
|
-
if (!this.socket.connected) {
|
|
2308
|
-
this.socket.connect();
|
|
2309
|
-
}
|
|
2310
|
-
return this.socket;
|
|
2311
|
-
}
|
|
2312
|
-
},
|
|
2313
|
-
{
|
|
2314
|
-
/// subscribe to collections
|
|
2315
|
-
key: "subscribeToCollections",
|
|
2316
|
-
value: function subscribeToCollections(config) {
|
|
2317
|
-
var s = this.getSocketInstance();
|
|
2318
|
-
var collectionsNames = config.map(function(c) {
|
|
2319
|
-
return c.collectionName;
|
|
2320
|
-
});
|
|
2321
|
-
var eventHandlers = [];
|
|
2322
|
-
config.forEach(function(configuration) {
|
|
2323
|
-
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;
|
|
2324
|
-
s.on("initial:".concat(collectionName), onFirstTime);
|
|
2325
|
-
eventHandlers.push({
|
|
2326
|
-
eventName: "initial:".concat(collectionName),
|
|
2327
|
-
handler: onFirstTime
|
|
2328
|
-
});
|
|
2329
|
-
s.on("add:".concat(collectionName), onAdd);
|
|
2330
|
-
eventHandlers.push({
|
|
2331
|
-
eventName: "add:".concat(collectionName),
|
|
2332
|
-
handler: onAdd
|
|
2333
|
-
});
|
|
2334
|
-
s.on("update:".concat(collectionName), onModify);
|
|
2335
|
-
eventHandlers.push({
|
|
2336
|
-
eventName: "update:".concat(collectionName),
|
|
2337
|
-
handler: onModify
|
|
2338
|
-
});
|
|
2339
|
-
s.on("delete:".concat(collectionName), onRemove);
|
|
2340
|
-
eventHandlers.push({
|
|
2341
|
-
eventName: "delete:".concat(collectionName),
|
|
2342
|
-
handler: onRemove
|
|
2343
|
-
});
|
|
2344
|
-
extraParsers === null || extraParsers === void 0 ? void 0 : extraParsers.forEach(function(parsers) {
|
|
2345
|
-
var extraOnAdd = parsers.onAdd, extraOnFirstTime = parsers.onFirstTime, extraOnModify = parsers.onModify, extraOnRemove = parsers.onRemove;
|
|
2346
|
-
s.on("initial:".concat(collectionName), extraOnFirstTime);
|
|
2347
|
-
eventHandlers.push({
|
|
2348
|
-
eventName: "initial:".concat(collectionName),
|
|
2349
|
-
handler: extraOnFirstTime
|
|
2350
|
-
});
|
|
2351
|
-
s.on("add:".concat(collectionName), extraOnAdd);
|
|
2352
|
-
eventHandlers.push({
|
|
2353
|
-
eventName: "add:".concat(collectionName),
|
|
2354
|
-
handler: extraOnAdd
|
|
2355
|
-
});
|
|
2356
|
-
s.on("update:".concat(collectionName), extraOnModify);
|
|
2357
|
-
eventHandlers.push({
|
|
2358
|
-
eventName: "update:".concat(collectionName),
|
|
2359
|
-
handler: extraOnModify
|
|
2360
|
-
});
|
|
2361
|
-
s.on("delete:".concat(collectionName), extraOnRemove);
|
|
2362
|
-
eventHandlers.push({
|
|
2363
|
-
eventName: "delete:".concat(collectionName),
|
|
2364
|
-
handler: extraOnRemove
|
|
2365
|
-
});
|
|
2366
|
-
});
|
|
2367
|
-
});
|
|
2368
|
-
s.emit("subscribe_collections", collectionsNames, function(callback) {
|
|
2369
|
-
if (callback.success) {
|
|
2370
|
-
console.log("Successfully subscribed to: ".concat(collectionsNames.join(", ")));
|
|
2371
|
-
} else {
|
|
2372
|
-
console.error("Failed to subscribe to ".concat(config.join(", "), ": ").concat(callback.message));
|
|
2373
|
-
}
|
|
2374
|
-
});
|
|
2375
|
-
return function() {
|
|
2376
|
-
console.log("Cleaning up subscriptions for: ".concat(collectionsNames.join(", ")));
|
|
2377
|
-
s.emit("unsubscribe_collections", collectionsNames);
|
|
2378
|
-
eventHandlers.forEach(function(eh) {
|
|
2379
|
-
s.off(eh.eventName, eh.handler);
|
|
2380
|
-
});
|
|
2381
|
-
};
|
|
2382
|
-
}
|
|
2383
|
-
},
|
|
2384
|
-
{
|
|
2385
|
-
/// set data
|
|
2386
|
-
key: "setData",
|
|
2387
|
-
value: function setData(payload) {
|
|
2388
|
-
var s = this.getSocketInstance();
|
|
2389
|
-
return new Promise(function(resolve, reject) {
|
|
2390
|
-
s.emit("set_data", payload, function(callback) {
|
|
2391
|
-
if (callback.success) {
|
|
2392
|
-
console.log("Data saved successfully:", payload);
|
|
2393
|
-
console.log("ack", callback);
|
|
2394
|
-
resolve(callback);
|
|
2395
|
-
} else {
|
|
2396
|
-
reject(new Error(callback.message || "Save operation failed"));
|
|
2397
|
-
}
|
|
2398
|
-
});
|
|
2399
|
-
});
|
|
2400
|
-
}
|
|
2401
|
-
},
|
|
2402
|
-
{
|
|
2403
|
-
/// get data
|
|
2404
|
-
key: "getCollectionData",
|
|
2405
|
-
value: function getCollectionData(payload) {
|
|
2406
|
-
var s = this.getSocketInstance();
|
|
2407
|
-
s.emit("get_data", {
|
|
2408
|
-
collection_name: payload.collection_name
|
|
2409
|
-
}, function(socketCallback) {
|
|
2410
|
-
if (socketCallback.success && socketCallback.data) {
|
|
2411
|
-
payload.callback(socketCallback.data);
|
|
2412
|
-
} else {
|
|
2413
|
-
payload.callback(payload.defaultValue);
|
|
2414
|
-
}
|
|
2415
|
-
});
|
|
2416
|
-
}
|
|
2417
|
-
},
|
|
2418
|
-
{
|
|
2419
|
-
key: "getDocumentData",
|
|
2420
|
-
value: function getDocumentData(payload) {
|
|
2421
|
-
var s = this.getSocketInstance();
|
|
2422
|
-
s.emit("get_data", {
|
|
2423
|
-
collection_name: payload.collection_name,
|
|
2424
|
-
key: payload.key
|
|
2425
|
-
}, function(socketCallback) {
|
|
2426
|
-
if (socketCallback.success && socketCallback.data) {
|
|
2427
|
-
payload.callback(socketCallback.data);
|
|
2428
|
-
} else {
|
|
2429
|
-
payload.callback(payload.defaultValue);
|
|
2430
|
-
}
|
|
2431
|
-
});
|
|
2432
|
-
}
|
|
2433
|
-
},
|
|
2434
|
-
{
|
|
2435
|
-
/// delete data
|
|
2436
|
-
key: "deleteData",
|
|
2437
|
-
value: function deleteData(payload) {
|
|
2438
|
-
var s = this.getSocketInstance();
|
|
2439
|
-
return new Promise(function(resolve, reject) {
|
|
2440
|
-
s.emit("delete_data", payload, function(callback) {
|
|
2441
|
-
if (callback.success) {
|
|
2442
|
-
console.log("Data deleted successfully:", payload);
|
|
2443
|
-
console.log("delete ack", callback);
|
|
2444
|
-
resolve(callback);
|
|
2445
|
-
} else {
|
|
2446
|
-
reject(new Error(callback.message || "Delete operation failed"));
|
|
2447
|
-
}
|
|
2448
|
-
});
|
|
2449
|
-
});
|
|
2450
|
-
}
|
|
2451
|
-
},
|
|
2452
|
-
{
|
|
2453
|
-
key: "clearAllRedisData",
|
|
2454
|
-
value: function clearAllRedisData() {
|
|
2455
|
-
var s = this.getSocketInstance();
|
|
2456
|
-
return new Promise(function(resolve, reject) {
|
|
2457
|
-
s.emit("clear_all_redis_data", function(ack) {
|
|
2458
|
-
if (ack.success) {
|
|
2459
|
-
resolve(ack);
|
|
2460
|
-
} else {
|
|
2461
|
-
reject(new Error(ack.message || "Clear all Redis data operation failed"));
|
|
2462
|
-
}
|
|
2463
|
-
});
|
|
2464
|
-
});
|
|
2465
|
-
}
|
|
2466
|
-
},
|
|
2467
|
-
{
|
|
2468
|
-
/// connection management methods
|
|
2469
|
-
key: "onConnect",
|
|
2470
|
-
value: function onConnect(callback) {
|
|
2471
|
-
var _this_socket;
|
|
2472
|
-
this.connectCallbacks.push(callback);
|
|
2473
|
-
if ((_this_socket = this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.connected) {
|
|
2474
|
-
callback();
|
|
2475
|
-
}
|
|
2476
|
-
}
|
|
2477
|
-
},
|
|
2478
|
-
{
|
|
2479
|
-
key: "offConnect",
|
|
2480
|
-
value: function offConnect(callback) {
|
|
2481
|
-
this.connectCallbacks = this.connectCallbacks.filter(function(cb) {
|
|
2482
|
-
return cb !== callback;
|
|
2483
|
-
});
|
|
2484
|
-
}
|
|
2485
|
-
},
|
|
2486
|
-
{
|
|
2487
|
-
key: "onDisconnect",
|
|
2488
|
-
value: function onDisconnect(callback) {
|
|
2489
|
-
this.disconnectCallbacks.push(callback);
|
|
2490
|
-
if (this.socket && !this.socket.connected) {
|
|
2491
|
-
callback();
|
|
2492
|
-
}
|
|
2493
|
-
}
|
|
2494
|
-
},
|
|
2495
|
-
{
|
|
2496
|
-
key: "offDisconnect",
|
|
2497
|
-
value: function offDisconnect(callback) {
|
|
2498
|
-
this.disconnectCallbacks = this.disconnectCallbacks.filter(function(cb) {
|
|
2499
|
-
return cb !== callback;
|
|
2500
|
-
});
|
|
2501
|
-
}
|
|
2502
|
-
},
|
|
2503
|
-
{
|
|
2504
|
-
key: "isConnected",
|
|
2505
|
-
value: function isConnected() {
|
|
2506
|
-
var _this_socket;
|
|
2507
|
-
return ((_this_socket = this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.connected) || false;
|
|
2508
|
-
}
|
|
2509
|
-
}
|
|
2510
|
-
], [
|
|
2511
|
-
{
|
|
2512
|
-
key: "getInstance",
|
|
2513
|
-
value: function getInstance() {
|
|
2514
|
-
if (!_SocketService.instance) {
|
|
2515
|
-
_SocketService.instance = new _SocketService();
|
|
2516
|
-
}
|
|
2517
|
-
return _SocketService.instance;
|
|
2518
|
-
}
|
|
2519
|
-
}
|
|
2520
|
-
]);
|
|
2521
|
-
return _SocketService;
|
|
2522
|
-
}();
|
|
2523
|
-
var socketServiceInstance = SocketService.getInstance();
|
|
2524
2230
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2525
2231
|
0 && (module.exports = {
|
|
2526
2232
|
addAuditRecord: addAuditRecord,
|
|
@@ -2604,7 +2310,6 @@ var socketServiceInstance = SocketService.getInstance();
|
|
|
2604
2310
|
simpleExtractData: simpleExtractData,
|
|
2605
2311
|
snapshot: snapshot,
|
|
2606
2312
|
snapshotDocument: snapshotDocument,
|
|
2607
|
-
socketServiceInstance: socketServiceInstance,
|
|
2608
2313
|
sort_by_timestamp: sort_by_timestamp,
|
|
2609
2314
|
storage: storage,
|
|
2610
2315
|
textNumbersRegex: textNumbersRegex,
|
package/dist/helpers/index.mjs
CHANGED
|
@@ -39,25 +39,6 @@ function _async_to_generator(fn) {
|
|
|
39
39
|
});
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
function _class_call_check(instance, Constructor) {
|
|
43
|
-
if (!(instance instanceof Constructor)) {
|
|
44
|
-
throw new TypeError("Cannot call a class as a function");
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function _defineProperties(target, props) {
|
|
48
|
-
for(var i = 0; i < props.length; i++){
|
|
49
|
-
var descriptor = props[i];
|
|
50
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
51
|
-
descriptor.configurable = true;
|
|
52
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
53
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
57
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
58
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
59
|
-
return Constructor;
|
|
60
|
-
}
|
|
61
42
|
function _define_property(obj, key, value) {
|
|
62
43
|
if (key in obj) {
|
|
63
44
|
Object.defineProperty(obj, key, {
|
|
@@ -1897,277 +1878,5 @@ var nxApiCall = /*#__PURE__*/ function() {
|
|
|
1897
1878
|
return _ref.apply(this, arguments);
|
|
1898
1879
|
};
|
|
1899
1880
|
}();
|
|
1900
|
-
|
|
1901
|
-
import { io } from "socket.io-client";
|
|
1902
|
-
var SocketService = /*#__PURE__*/ function() {
|
|
1903
|
-
"use strict";
|
|
1904
|
-
function _SocketService() {
|
|
1905
|
-
_class_call_check(this, _SocketService);
|
|
1906
|
-
this.socket = null;
|
|
1907
|
-
this.connectCallbacks = [];
|
|
1908
|
-
this.disconnectCallbacks = [];
|
|
1909
|
-
this.initSocket();
|
|
1910
|
-
}
|
|
1911
|
-
_create_class(_SocketService, [
|
|
1912
|
-
{
|
|
1913
|
-
/// Initialize the socket connection
|
|
1914
|
-
key: "initSocket",
|
|
1915
|
-
value: function initSocket() {
|
|
1916
|
-
var _this = this;
|
|
1917
|
-
if (!this.socket) {
|
|
1918
|
-
var SOCKET_SERVER_URL = "http://localhost:9009";
|
|
1919
|
-
var SOCKET_PATH = "/api/data-socket/connect";
|
|
1920
|
-
this.socket = io(SOCKET_SERVER_URL, {
|
|
1921
|
-
path: SOCKET_PATH,
|
|
1922
|
-
transports: [
|
|
1923
|
-
"websocket"
|
|
1924
|
-
]
|
|
1925
|
-
});
|
|
1926
|
-
this.socket.on("connect", function() {
|
|
1927
|
-
var _this_socket;
|
|
1928
|
-
console.log("Socket connected:", (_this_socket = _this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.id);
|
|
1929
|
-
_this.connectCallbacks.forEach(function(cb) {
|
|
1930
|
-
return cb();
|
|
1931
|
-
});
|
|
1932
|
-
});
|
|
1933
|
-
this.socket.on("disconnect", function(reason) {
|
|
1934
|
-
console.log("Socket disconnected:", reason);
|
|
1935
|
-
_this.disconnectCallbacks.forEach(function(cb) {
|
|
1936
|
-
return cb();
|
|
1937
|
-
});
|
|
1938
|
-
});
|
|
1939
|
-
this.socket.on("connect_error", function(error) {
|
|
1940
|
-
console.error("Socket connection error:", error);
|
|
1941
|
-
});
|
|
1942
|
-
}
|
|
1943
|
-
}
|
|
1944
|
-
},
|
|
1945
|
-
{
|
|
1946
|
-
/// get socket instance
|
|
1947
|
-
key: "getSocketInstance",
|
|
1948
|
-
value: function getSocketInstance() {
|
|
1949
|
-
if (!this.socket) {
|
|
1950
|
-
this.initSocket();
|
|
1951
|
-
}
|
|
1952
|
-
if (!this.socket) {
|
|
1953
|
-
throw new Error("Socket not initialized");
|
|
1954
|
-
}
|
|
1955
|
-
if (!this.socket.connected) {
|
|
1956
|
-
this.socket.connect();
|
|
1957
|
-
}
|
|
1958
|
-
return this.socket;
|
|
1959
|
-
}
|
|
1960
|
-
},
|
|
1961
|
-
{
|
|
1962
|
-
/// subscribe to collections
|
|
1963
|
-
key: "subscribeToCollections",
|
|
1964
|
-
value: function subscribeToCollections(config) {
|
|
1965
|
-
var s = this.getSocketInstance();
|
|
1966
|
-
var collectionsNames = config.map(function(c) {
|
|
1967
|
-
return c.collectionName;
|
|
1968
|
-
});
|
|
1969
|
-
var eventHandlers = [];
|
|
1970
|
-
config.forEach(function(configuration) {
|
|
1971
|
-
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;
|
|
1972
|
-
s.on("initial:".concat(collectionName), onFirstTime);
|
|
1973
|
-
eventHandlers.push({
|
|
1974
|
-
eventName: "initial:".concat(collectionName),
|
|
1975
|
-
handler: onFirstTime
|
|
1976
|
-
});
|
|
1977
|
-
s.on("add:".concat(collectionName), onAdd);
|
|
1978
|
-
eventHandlers.push({
|
|
1979
|
-
eventName: "add:".concat(collectionName),
|
|
1980
|
-
handler: onAdd
|
|
1981
|
-
});
|
|
1982
|
-
s.on("update:".concat(collectionName), onModify);
|
|
1983
|
-
eventHandlers.push({
|
|
1984
|
-
eventName: "update:".concat(collectionName),
|
|
1985
|
-
handler: onModify
|
|
1986
|
-
});
|
|
1987
|
-
s.on("delete:".concat(collectionName), onRemove);
|
|
1988
|
-
eventHandlers.push({
|
|
1989
|
-
eventName: "delete:".concat(collectionName),
|
|
1990
|
-
handler: onRemove
|
|
1991
|
-
});
|
|
1992
|
-
extraParsers === null || extraParsers === void 0 ? void 0 : extraParsers.forEach(function(parsers) {
|
|
1993
|
-
var extraOnAdd = parsers.onAdd, extraOnFirstTime = parsers.onFirstTime, extraOnModify = parsers.onModify, extraOnRemove = parsers.onRemove;
|
|
1994
|
-
s.on("initial:".concat(collectionName), extraOnFirstTime);
|
|
1995
|
-
eventHandlers.push({
|
|
1996
|
-
eventName: "initial:".concat(collectionName),
|
|
1997
|
-
handler: extraOnFirstTime
|
|
1998
|
-
});
|
|
1999
|
-
s.on("add:".concat(collectionName), extraOnAdd);
|
|
2000
|
-
eventHandlers.push({
|
|
2001
|
-
eventName: "add:".concat(collectionName),
|
|
2002
|
-
handler: extraOnAdd
|
|
2003
|
-
});
|
|
2004
|
-
s.on("update:".concat(collectionName), extraOnModify);
|
|
2005
|
-
eventHandlers.push({
|
|
2006
|
-
eventName: "update:".concat(collectionName),
|
|
2007
|
-
handler: extraOnModify
|
|
2008
|
-
});
|
|
2009
|
-
s.on("delete:".concat(collectionName), extraOnRemove);
|
|
2010
|
-
eventHandlers.push({
|
|
2011
|
-
eventName: "delete:".concat(collectionName),
|
|
2012
|
-
handler: extraOnRemove
|
|
2013
|
-
});
|
|
2014
|
-
});
|
|
2015
|
-
});
|
|
2016
|
-
s.emit("subscribe_collections", collectionsNames, function(callback) {
|
|
2017
|
-
if (callback.success) {
|
|
2018
|
-
console.log("Successfully subscribed to: ".concat(collectionsNames.join(", ")));
|
|
2019
|
-
} else {
|
|
2020
|
-
console.error("Failed to subscribe to ".concat(config.join(", "), ": ").concat(callback.message));
|
|
2021
|
-
}
|
|
2022
|
-
});
|
|
2023
|
-
return function() {
|
|
2024
|
-
console.log("Cleaning up subscriptions for: ".concat(collectionsNames.join(", ")));
|
|
2025
|
-
s.emit("unsubscribe_collections", collectionsNames);
|
|
2026
|
-
eventHandlers.forEach(function(eh) {
|
|
2027
|
-
s.off(eh.eventName, eh.handler);
|
|
2028
|
-
});
|
|
2029
|
-
};
|
|
2030
|
-
}
|
|
2031
|
-
},
|
|
2032
|
-
{
|
|
2033
|
-
/// set data
|
|
2034
|
-
key: "setData",
|
|
2035
|
-
value: function setData(payload) {
|
|
2036
|
-
var s = this.getSocketInstance();
|
|
2037
|
-
return new Promise(function(resolve, reject) {
|
|
2038
|
-
s.emit("set_data", payload, function(callback) {
|
|
2039
|
-
if (callback.success) {
|
|
2040
|
-
console.log("Data saved successfully:", payload);
|
|
2041
|
-
console.log("ack", callback);
|
|
2042
|
-
resolve(callback);
|
|
2043
|
-
} else {
|
|
2044
|
-
reject(new Error(callback.message || "Save operation failed"));
|
|
2045
|
-
}
|
|
2046
|
-
});
|
|
2047
|
-
});
|
|
2048
|
-
}
|
|
2049
|
-
},
|
|
2050
|
-
{
|
|
2051
|
-
/// get data
|
|
2052
|
-
key: "getCollectionData",
|
|
2053
|
-
value: function getCollectionData(payload) {
|
|
2054
|
-
var s = this.getSocketInstance();
|
|
2055
|
-
s.emit("get_data", {
|
|
2056
|
-
collection_name: payload.collection_name
|
|
2057
|
-
}, function(socketCallback) {
|
|
2058
|
-
if (socketCallback.success && socketCallback.data) {
|
|
2059
|
-
payload.callback(socketCallback.data);
|
|
2060
|
-
} else {
|
|
2061
|
-
payload.callback(payload.defaultValue);
|
|
2062
|
-
}
|
|
2063
|
-
});
|
|
2064
|
-
}
|
|
2065
|
-
},
|
|
2066
|
-
{
|
|
2067
|
-
key: "getDocumentData",
|
|
2068
|
-
value: function getDocumentData(payload) {
|
|
2069
|
-
var s = this.getSocketInstance();
|
|
2070
|
-
s.emit("get_data", {
|
|
2071
|
-
collection_name: payload.collection_name,
|
|
2072
|
-
key: payload.key
|
|
2073
|
-
}, function(socketCallback) {
|
|
2074
|
-
if (socketCallback.success && socketCallback.data) {
|
|
2075
|
-
payload.callback(socketCallback.data);
|
|
2076
|
-
} else {
|
|
2077
|
-
payload.callback(payload.defaultValue);
|
|
2078
|
-
}
|
|
2079
|
-
});
|
|
2080
|
-
}
|
|
2081
|
-
},
|
|
2082
|
-
{
|
|
2083
|
-
/// delete data
|
|
2084
|
-
key: "deleteData",
|
|
2085
|
-
value: function deleteData(payload) {
|
|
2086
|
-
var s = this.getSocketInstance();
|
|
2087
|
-
return new Promise(function(resolve, reject) {
|
|
2088
|
-
s.emit("delete_data", payload, function(callback) {
|
|
2089
|
-
if (callback.success) {
|
|
2090
|
-
console.log("Data deleted successfully:", payload);
|
|
2091
|
-
console.log("delete ack", callback);
|
|
2092
|
-
resolve(callback);
|
|
2093
|
-
} else {
|
|
2094
|
-
reject(new Error(callback.message || "Delete operation failed"));
|
|
2095
|
-
}
|
|
2096
|
-
});
|
|
2097
|
-
});
|
|
2098
|
-
}
|
|
2099
|
-
},
|
|
2100
|
-
{
|
|
2101
|
-
key: "clearAllRedisData",
|
|
2102
|
-
value: function clearAllRedisData() {
|
|
2103
|
-
var s = this.getSocketInstance();
|
|
2104
|
-
return new Promise(function(resolve, reject) {
|
|
2105
|
-
s.emit("clear_all_redis_data", function(ack) {
|
|
2106
|
-
if (ack.success) {
|
|
2107
|
-
resolve(ack);
|
|
2108
|
-
} else {
|
|
2109
|
-
reject(new Error(ack.message || "Clear all Redis data operation failed"));
|
|
2110
|
-
}
|
|
2111
|
-
});
|
|
2112
|
-
});
|
|
2113
|
-
}
|
|
2114
|
-
},
|
|
2115
|
-
{
|
|
2116
|
-
/// connection management methods
|
|
2117
|
-
key: "onConnect",
|
|
2118
|
-
value: function onConnect(callback) {
|
|
2119
|
-
var _this_socket;
|
|
2120
|
-
this.connectCallbacks.push(callback);
|
|
2121
|
-
if ((_this_socket = this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.connected) {
|
|
2122
|
-
callback();
|
|
2123
|
-
}
|
|
2124
|
-
}
|
|
2125
|
-
},
|
|
2126
|
-
{
|
|
2127
|
-
key: "offConnect",
|
|
2128
|
-
value: function offConnect(callback) {
|
|
2129
|
-
this.connectCallbacks = this.connectCallbacks.filter(function(cb) {
|
|
2130
|
-
return cb !== callback;
|
|
2131
|
-
});
|
|
2132
|
-
}
|
|
2133
|
-
},
|
|
2134
|
-
{
|
|
2135
|
-
key: "onDisconnect",
|
|
2136
|
-
value: function onDisconnect(callback) {
|
|
2137
|
-
this.disconnectCallbacks.push(callback);
|
|
2138
|
-
if (this.socket && !this.socket.connected) {
|
|
2139
|
-
callback();
|
|
2140
|
-
}
|
|
2141
|
-
}
|
|
2142
|
-
},
|
|
2143
|
-
{
|
|
2144
|
-
key: "offDisconnect",
|
|
2145
|
-
value: function offDisconnect(callback) {
|
|
2146
|
-
this.disconnectCallbacks = this.disconnectCallbacks.filter(function(cb) {
|
|
2147
|
-
return cb !== callback;
|
|
2148
|
-
});
|
|
2149
|
-
}
|
|
2150
|
-
},
|
|
2151
|
-
{
|
|
2152
|
-
key: "isConnected",
|
|
2153
|
-
value: function isConnected() {
|
|
2154
|
-
var _this_socket;
|
|
2155
|
-
return ((_this_socket = this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.connected) || false;
|
|
2156
|
-
}
|
|
2157
|
-
}
|
|
2158
|
-
], [
|
|
2159
|
-
{
|
|
2160
|
-
key: "getInstance",
|
|
2161
|
-
value: function getInstance() {
|
|
2162
|
-
if (!_SocketService.instance) {
|
|
2163
|
-
_SocketService.instance = new _SocketService();
|
|
2164
|
-
}
|
|
2165
|
-
return _SocketService.instance;
|
|
2166
|
-
}
|
|
2167
|
-
}
|
|
2168
|
-
]);
|
|
2169
|
-
return _SocketService;
|
|
2170
|
-
}();
|
|
2171
|
-
var socketServiceInstance = SocketService.getInstance();
|
|
2172
|
-
export { addAuditRecord, addLoginAudit, add_document, addressRegex, akeylessOnlineDomain, app, appCheck, auth, baseDomain, biDomain, calculateBearing, callCenterEventsDomain, callCenterGeoDomain, carsRegex, chartsRegex, checkUserPermissions, cleanNxSites, cn, collections, colorRegex, createSelectors, db, delete_document, devicesDomain, displayFormatPhoneNumber, emailRegex, extractAlertsData, extractBoardsData, extractCanbusData, extractCarsData, extractClientData, extractLocationData, extractSiteData, fire_base_TIME_TEMP, formatCarNumber, getAddressByGeo, getFixedNumber, getFormCheckboxValue, getFormElementValue, getLocationUrl, getUserByEmail, getUserByIdentifier, getUserByPhone, getUserCountryByIp, get_all_documents, get_document_by_id, get_international_phone_number, googleLoginProvider, handleChange, handleInvalid, handlePaste, initializeUserPermissions, international_israel_phone_format, isInternational, isInternationalIsraelPhone, isLocal, isNodeEnv, is_iccid, local_israel_phone_format, mode, multiStringFormat, notificationsDomain, numbersOnlyRegex, numbersRegex, nxApiCall, parseMultiSelectInput, parsePermissions, parseSnapshotAsArray, priceRegex, propsAreEqual, query_document, query_document_by_conditions, query_documents, query_documents_by_conditions, renderOnce, setFormElementValue, setState, set_document, simpleExtractData, snapshot, snapshotDocument, socketServiceInstance, sort_by_timestamp, storage, textNumbersRegex, textRegex, timestamp_to_millis, timestamp_to_string, useLoginWithGoogle, useStoreValues, useValidation, userNameFormat, validateAndCast, validateUserStatusAndPermissions };
|
|
1881
|
+
export { addAuditRecord, addLoginAudit, add_document, addressRegex, akeylessOnlineDomain, app, appCheck, auth, baseDomain, biDomain, calculateBearing, callCenterEventsDomain, callCenterGeoDomain, carsRegex, chartsRegex, checkUserPermissions, cleanNxSites, cn, collections, colorRegex, createSelectors, db, delete_document, devicesDomain, displayFormatPhoneNumber, emailRegex, extractAlertsData, extractBoardsData, extractCanbusData, extractCarsData, extractClientData, extractLocationData, extractSiteData, fire_base_TIME_TEMP, formatCarNumber, getAddressByGeo, getFixedNumber, getFormCheckboxValue, getFormElementValue, getLocationUrl, getUserByEmail, getUserByIdentifier, getUserByPhone, getUserCountryByIp, get_all_documents, get_document_by_id, get_international_phone_number, googleLoginProvider, handleChange, handleInvalid, handlePaste, initializeUserPermissions, international_israel_phone_format, isInternational, isInternationalIsraelPhone, isLocal, isNodeEnv, is_iccid, local_israel_phone_format, mode, multiStringFormat, notificationsDomain, numbersOnlyRegex, numbersRegex, nxApiCall, parseMultiSelectInput, parsePermissions, parseSnapshotAsArray, priceRegex, propsAreEqual, query_document, query_document_by_conditions, query_documents, query_documents_by_conditions, renderOnce, setFormElementValue, setState, set_document, simpleExtractData, snapshot, snapshotDocument, sort_by_timestamp, storage, textNumbersRegex, textRegex, timestamp_to_millis, timestamp_to_string, useLoginWithGoogle, useStoreValues, useValidation, userNameFormat, validateAndCast, validateUserStatusAndPermissions };
|
|
2173
1882
|
//# sourceMappingURL=index.mjs.map
|
package/dist/hooks/index.d.mts
CHANGED
|
@@ -35,8 +35,4 @@ declare function useSafeEffect(callback: () => void, dependencies: any[], error_
|
|
|
35
35
|
declare const useDeepCompareMemo: <T>(factory: () => T, dependencies: any[]) => T;
|
|
36
36
|
declare function useDeepCompareEffect(effect: EffectCallback, dependencies: any[]): void;
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
socketConnected: boolean;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export { useDeepCompareEffect, useDeepCompareMemo, useDocumentTitle, useSafeEffect, useSetUserCountry, useSnapshotBulk, useSocketSubscription };
|
|
38
|
+
export { useDeepCompareEffect, useDeepCompareMemo, useDocumentTitle, useSafeEffect, useSetUserCountry, useSnapshotBulk };
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -35,8 +35,4 @@ declare function useSafeEffect(callback: () => void, dependencies: any[], error_
|
|
|
35
35
|
declare const useDeepCompareMemo: <T>(factory: () => T, dependencies: any[]) => T;
|
|
36
36
|
declare function useDeepCompareEffect(effect: EffectCallback, dependencies: any[]): void;
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
socketConnected: boolean;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export { useDeepCompareEffect, useDeepCompareMemo, useDocumentTitle, useSafeEffect, useSetUserCountry, useSnapshotBulk, useSocketSubscription };
|
|
38
|
+
export { useDeepCompareEffect, useDeepCompareMemo, useDocumentTitle, useSafeEffect, useSetUserCountry, useSnapshotBulk };
|