akeyless-client-commons 1.1.129 → 1.1.131

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.
@@ -703,6 +703,190 @@ function sort_by_timestamp(a, b) {
703
703
  var reverse = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
704
704
  return reverse ? timestamp_to_millis(b) - timestamp_to_millis(a) : timestamp_to_millis(a) - timestamp_to_millis(b);
705
705
  }
706
+ // src/helpers/global.ts
707
+ import { CountryOptions, LanguageOptions } from "akeyless-types-commons";
708
+ import axios from "axios";
709
+ import { isEqual } from "lodash";
710
+ var calculateBearing = function(startLat, startLng, endLat, endLng) {
711
+ if (startLat === endLat || startLng === endLng) {
712
+ return 0;
713
+ }
714
+ if (startLat === void 0 || startLng === void 0 || endLat === void 0 || endLng === void 0) {
715
+ return 0;
716
+ }
717
+ var startLatRad = startLat * Math.PI / 180;
718
+ var startLngRad = startLng * Math.PI / 180;
719
+ var endLatRad = endLat * Math.PI / 180;
720
+ var endLngRad = endLng * Math.PI / 180;
721
+ var dLon = endLngRad - startLngRad;
722
+ var y = Math.sin(dLon) * Math.cos(endLatRad);
723
+ var x = Math.cos(startLatRad) * Math.sin(endLatRad) - Math.sin(startLatRad) * Math.cos(endLatRad) * Math.cos(dLon);
724
+ var bearing = Math.atan2(y, x) * 180 / Math.PI;
725
+ return (bearing + 360) % 360;
726
+ };
727
+ var renderOnce = function() {
728
+ return true;
729
+ };
730
+ var propsAreEqual = function(prevProps, nextProps) {
731
+ return isEqual(prevProps, nextProps);
732
+ };
733
+ var getUserCountryByIp = /*#__PURE__*/ function() {
734
+ var _ref = _async_to_generator(function() {
735
+ var response, data, error;
736
+ return _ts_generator(this, function(_state) {
737
+ switch(_state.label){
738
+ case 0:
739
+ _state.trys.push([
740
+ 0,
741
+ 3,
742
+ ,
743
+ 4
744
+ ]);
745
+ return [
746
+ 4,
747
+ fetch("https://ipapi.co/json/")
748
+ ];
749
+ case 1:
750
+ response = _state.sent();
751
+ return [
752
+ 4,
753
+ response.json()
754
+ ];
755
+ case 2:
756
+ data = _state.sent();
757
+ return [
758
+ 2,
759
+ (data.country_code || CountryOptions.IL).toLowerCase()
760
+ ];
761
+ case 3:
762
+ error = _state.sent();
763
+ console.error("Error fetching Country:", error);
764
+ return [
765
+ 2,
766
+ CountryOptions.IL
767
+ ];
768
+ case 4:
769
+ return [
770
+ 2
771
+ ];
772
+ }
773
+ });
774
+ });
775
+ return function getUserCountryByIp() {
776
+ return _ref.apply(this, arguments);
777
+ };
778
+ }();
779
+ var userNameFormat = function(user) {
780
+ return "".concat((user === null || user === void 0 ? void 0 : user.first_name) || "", " ").concat((user === null || user === void 0 ? void 0 : user.last_name) || "").trim();
781
+ };
782
+ var multiStringFormat = function(str1, str2, str3) {
783
+ return "".concat(str1, " ").concat(str2 || "", " ").concat(str3 || "").trim();
784
+ };
785
+ var getLocationUrl = function(lng, lat) {
786
+ return "https://www.google.com/maps?q=".concat(lat, ",").concat(lng);
787
+ };
788
+ var isNodeEnv = typeof process !== "undefined" && process.env;
789
+ var _ref = {
790
+ mode: isNodeEnv ? process.env.NEXT_PUBLIC_MODE : import.meta.env.VITE_MODE,
791
+ isLocal: (isNodeEnv ? process.env.NEXT_PUBLIC_IS_LOCAL : import.meta.env.VITE_is_local) === "true"
792
+ }, mode = _ref.mode, isLocal = _ref.isLocal;
793
+ var getFixedNumber = function() {
794
+ var number = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0, fix = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 4;
795
+ var sum_value = number % 1 === 0 ? number : number.toFixed(fix).replace(/\.?0+$/, "");
796
+ return String(sum_value);
797
+ };
798
+ var getAddressByGeo = /*#__PURE__*/ function() {
799
+ var _ref = _async_to_generator(function(param, currentLanguage) {
800
+ var lat, lng, language, apiKey, url, _response_data, response, error;
801
+ return _ts_generator(this, function(_state) {
802
+ switch(_state.label){
803
+ case 0:
804
+ lat = param.lat, lng = param.lng;
805
+ language = currentLanguage === LanguageOptions.He ? "iw" : "en";
806
+ apiKey = isNodeEnv ? process.env.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY : import.meta.env.VITE_api_google_key;
807
+ url = "https://maps.googleapis.com/maps/api/geocode/json?latlng=".concat(lat, ",").concat(lng, "&key=").concat(apiKey, "&language=").concat(language);
808
+ _state.label = 1;
809
+ case 1:
810
+ _state.trys.push([
811
+ 1,
812
+ 3,
813
+ ,
814
+ 4
815
+ ]);
816
+ return [
817
+ 4,
818
+ axios.get(url)
819
+ ];
820
+ case 2:
821
+ response = _state.sent();
822
+ if (response === null || response === void 0 ? void 0 : (_response_data = response.data) === null || _response_data === void 0 ? void 0 : _response_data.results[0]) {
823
+ return [
824
+ 2,
825
+ response.data.results[0].formatted_address.slice(0, 35)
826
+ ];
827
+ } else {
828
+ return [
829
+ 2,
830
+ "address not found"
831
+ ];
832
+ }
833
+ return [
834
+ 3,
835
+ 4
836
+ ];
837
+ case 3:
838
+ error = _state.sent();
839
+ console.error("getAddressByGeo error:", error);
840
+ return [
841
+ 3,
842
+ 4
843
+ ];
844
+ case 4:
845
+ return [
846
+ 2
847
+ ];
848
+ }
849
+ });
850
+ });
851
+ return function getAddressByGeo(_, currentLanguage) {
852
+ return _ref.apply(this, arguments);
853
+ };
854
+ }();
855
+ var validateAndCast = function(variable, condition) {
856
+ return !!condition;
857
+ };
858
+ var checkConditions = function(document2, conditions) {
859
+ if (!conditions || conditions.length === 0) return true;
860
+ return conditions.every(function(condition) {
861
+ var fieldValue = document2[condition.field_name];
862
+ switch(condition.operator){
863
+ case "==":
864
+ return fieldValue === condition.value;
865
+ case "!=":
866
+ return fieldValue !== condition.value;
867
+ case "<":
868
+ return fieldValue < condition.value;
869
+ case "<=":
870
+ return fieldValue <= condition.value;
871
+ case ">":
872
+ return fieldValue > condition.value;
873
+ case ">=":
874
+ return fieldValue >= condition.value;
875
+ case "in":
876
+ return Array.isArray(condition.value) && condition.value.includes(fieldValue);
877
+ case "not-in":
878
+ return Array.isArray(condition.value) && !condition.value.includes(fieldValue);
879
+ case "array-contains":
880
+ return Array.isArray(fieldValue) && fieldValue.includes(condition.value);
881
+ case "array-contains-any":
882
+ return Array.isArray(fieldValue) && Array.isArray(condition.value) && condition.value.some(function(v) {
883
+ return fieldValue.includes(v);
884
+ });
885
+ default:
886
+ return false;
887
+ }
888
+ });
889
+ };
706
890
  // src/helpers/firebase.ts
707
891
  var initApp = function() {
708
892
  var isNodeEnv2 = typeof process !== "undefined" && process.env;
@@ -1453,30 +1637,6 @@ var snapshotDocument = function(config, snapshotsFirstTime) {
1453
1637
  unsubscribe: unsubscribe
1454
1638
  };
1455
1639
  };
1456
- var checkConditions = function(document2, conditions) {
1457
- if (!conditions || conditions.length === 0) return true;
1458
- return conditions.every(function(condition) {
1459
- var fieldValue = document2[condition.field_name];
1460
- switch(condition.operator){
1461
- case "==":
1462
- return fieldValue === condition.value;
1463
- case "!=":
1464
- return fieldValue !== condition.value;
1465
- case "<":
1466
- return fieldValue < condition.value;
1467
- case "<=":
1468
- return fieldValue <= condition.value;
1469
- case ">":
1470
- return fieldValue > condition.value;
1471
- case ">=":
1472
- return fieldValue >= condition.value;
1473
- case "array-contains":
1474
- return Array.isArray(fieldValue) && fieldValue.includes(condition.value);
1475
- default:
1476
- return false;
1477
- }
1478
- });
1479
- };
1480
1640
  var cleanNxSites = /*#__PURE__*/ function() {
1481
1641
  var _ref = _async_to_generator(function() {
1482
1642
  var clients, sites, allSitesToDelete;
@@ -1946,158 +2106,6 @@ var parseSnapshotAsArray = function(setState2, options) {
1946
2106
  }
1947
2107
  };
1948
2108
  };
1949
- // src/helpers/global.ts
1950
- import { CountryOptions, LanguageOptions } from "akeyless-types-commons";
1951
- import axios from "axios";
1952
- import { isEqual } from "lodash";
1953
- var calculateBearing = function(startLat, startLng, endLat, endLng) {
1954
- if (startLat === endLat || startLng === endLng) {
1955
- return 0;
1956
- }
1957
- if (startLat === void 0 || startLng === void 0 || endLat === void 0 || endLng === void 0) {
1958
- return 0;
1959
- }
1960
- var startLatRad = startLat * Math.PI / 180;
1961
- var startLngRad = startLng * Math.PI / 180;
1962
- var endLatRad = endLat * Math.PI / 180;
1963
- var endLngRad = endLng * Math.PI / 180;
1964
- var dLon = endLngRad - startLngRad;
1965
- var y = Math.sin(dLon) * Math.cos(endLatRad);
1966
- var x = Math.cos(startLatRad) * Math.sin(endLatRad) - Math.sin(startLatRad) * Math.cos(endLatRad) * Math.cos(dLon);
1967
- var bearing = Math.atan2(y, x) * 180 / Math.PI;
1968
- return (bearing + 360) % 360;
1969
- };
1970
- var renderOnce = function() {
1971
- return true;
1972
- };
1973
- var propsAreEqual = function(prevProps, nextProps) {
1974
- return isEqual(prevProps, nextProps);
1975
- };
1976
- var getUserCountryByIp = /*#__PURE__*/ function() {
1977
- var _ref = _async_to_generator(function() {
1978
- var response, data, error;
1979
- return _ts_generator(this, function(_state) {
1980
- switch(_state.label){
1981
- case 0:
1982
- _state.trys.push([
1983
- 0,
1984
- 3,
1985
- ,
1986
- 4
1987
- ]);
1988
- return [
1989
- 4,
1990
- fetch("https://ipapi.co/json/")
1991
- ];
1992
- case 1:
1993
- response = _state.sent();
1994
- return [
1995
- 4,
1996
- response.json()
1997
- ];
1998
- case 2:
1999
- data = _state.sent();
2000
- return [
2001
- 2,
2002
- (data.country_code || CountryOptions.IL).toLowerCase()
2003
- ];
2004
- case 3:
2005
- error = _state.sent();
2006
- console.error("Error fetching Country:", error);
2007
- return [
2008
- 2,
2009
- CountryOptions.IL
2010
- ];
2011
- case 4:
2012
- return [
2013
- 2
2014
- ];
2015
- }
2016
- });
2017
- });
2018
- return function getUserCountryByIp() {
2019
- return _ref.apply(this, arguments);
2020
- };
2021
- }();
2022
- var userNameFormat = function(user) {
2023
- return "".concat((user === null || user === void 0 ? void 0 : user.first_name) || "", " ").concat((user === null || user === void 0 ? void 0 : user.last_name) || "").trim();
2024
- };
2025
- var multiStringFormat = function(str1, str2, str3) {
2026
- return "".concat(str1, " ").concat(str2 || "", " ").concat(str3 || "").trim();
2027
- };
2028
- var getLocationUrl = function(lng, lat) {
2029
- return "https://www.google.com/maps?q=".concat(lat, ",").concat(lng);
2030
- };
2031
- var isNodeEnv = typeof process !== "undefined" && process.env;
2032
- var _ref = {
2033
- mode: isNodeEnv ? process.env.NEXT_PUBLIC_MODE : import.meta.env.VITE_MODE,
2034
- isLocal: (isNodeEnv ? process.env.NEXT_PUBLIC_IS_LOCAL : import.meta.env.VITE_is_local) === "true"
2035
- }, mode = _ref.mode, isLocal = _ref.isLocal;
2036
- var getFixedNumber = function() {
2037
- var number = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0, fix = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 4;
2038
- var sum_value = number % 1 === 0 ? number : number.toFixed(fix).replace(/\.?0+$/, "");
2039
- return String(sum_value);
2040
- };
2041
- var getAddressByGeo = /*#__PURE__*/ function() {
2042
- var _ref = _async_to_generator(function(param, currentLanguage) {
2043
- var lat, lng, language, apiKey, url, _response_data, response, error;
2044
- return _ts_generator(this, function(_state) {
2045
- switch(_state.label){
2046
- case 0:
2047
- lat = param.lat, lng = param.lng;
2048
- language = currentLanguage === LanguageOptions.He ? "iw" : "en";
2049
- apiKey = isNodeEnv ? process.env.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY : import.meta.env.VITE_api_google_key;
2050
- url = "https://maps.googleapis.com/maps/api/geocode/json?latlng=".concat(lat, ",").concat(lng, "&key=").concat(apiKey, "&language=").concat(language);
2051
- _state.label = 1;
2052
- case 1:
2053
- _state.trys.push([
2054
- 1,
2055
- 3,
2056
- ,
2057
- 4
2058
- ]);
2059
- return [
2060
- 4,
2061
- axios.get(url)
2062
- ];
2063
- case 2:
2064
- response = _state.sent();
2065
- if (response === null || response === void 0 ? void 0 : (_response_data = response.data) === null || _response_data === void 0 ? void 0 : _response_data.results[0]) {
2066
- return [
2067
- 2,
2068
- response.data.results[0].formatted_address.slice(0, 35)
2069
- ];
2070
- } else {
2071
- return [
2072
- 2,
2073
- "address not found"
2074
- ];
2075
- }
2076
- return [
2077
- 3,
2078
- 4
2079
- ];
2080
- case 3:
2081
- error = _state.sent();
2082
- console.error("getAddressByGeo error:", error);
2083
- return [
2084
- 3,
2085
- 4
2086
- ];
2087
- case 4:
2088
- return [
2089
- 2
2090
- ];
2091
- }
2092
- });
2093
- });
2094
- return function getAddressByGeo(_, currentLanguage) {
2095
- return _ref.apply(this, arguments);
2096
- };
2097
- }();
2098
- var validateAndCast = function(variable, condition) {
2099
- return !!condition;
2100
- };
2101
2109
  // src/helpers/forms.ts
2102
2110
  import XRegExp from "xregexp";
2103
2111
  var textRegex = XRegExp(String.raw(_templateObject()), "gu");
@@ -2537,6 +2545,9 @@ var SocketService = /*#__PURE__*/ function() {
2537
2545
  this.disconnectCallbacks = [];
2538
2546
  this.authToken = null;
2539
2547
  this.isDisconnected = true;
2548
+ /// the data-socket keeps one subscription per collection per socket, so a second condition set
2549
+ /// for a collection never reaches it and would silently receive the first one's documents
2550
+ this.activeConditions = /* @__PURE__ */ new Map();
2540
2551
  this.handleDisconnect = function(source, reason) {
2541
2552
  var _this_socket;
2542
2553
  if (_this.isDisconnected) {
@@ -2704,6 +2715,39 @@ var SocketService = /*#__PURE__*/ function() {
2704
2715
  }
2705
2716
  }
2706
2717
  },
2718
+ {
2719
+ key: "registerConditions",
2720
+ value: function registerConditions(collectionName) {
2721
+ var conditions = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
2722
+ var signature = JSON.stringify(conditions);
2723
+ var active = this.activeConditions.get(collectionName);
2724
+ if (!active) {
2725
+ this.activeConditions.set(collectionName, {
2726
+ signature: signature,
2727
+ conditions: conditions,
2728
+ count: 1
2729
+ });
2730
+ return;
2731
+ }
2732
+ active.count++;
2733
+ if (active.signature !== signature) {
2734
+ console.error('[socket] "'.concat(collectionName, '" is already subscribed with different conditions, and a collection supports one condition set at a time. The active set stays in effect, so this subscription receives its documents instead of its own. active: ').concat(active.signature, " requested: ").concat(signature));
2735
+ }
2736
+ }
2737
+ },
2738
+ {
2739
+ key: "releaseConditions",
2740
+ value: function releaseConditions(collectionName) {
2741
+ var active = this.activeConditions.get(collectionName);
2742
+ if (!active) {
2743
+ return;
2744
+ }
2745
+ active.count--;
2746
+ if (active.count <= 0) {
2747
+ this.activeConditions.delete(collectionName);
2748
+ }
2749
+ }
2750
+ },
2707
2751
  {
2708
2752
  key: "disconnectSocket",
2709
2753
  value: function disconnectSocket() {
@@ -2715,6 +2759,8 @@ var SocketService = /*#__PURE__*/ function() {
2715
2759
  },
2716
2760
  {
2717
2761
  /// subscribe to collections
2762
+ /// conditions are derived from OnSnapshotConfig.conditions, never passed in, so a caller cannot
2763
+ /// set them in a second place and have them silently overwritten
2718
2764
  key: "subscribeToCollections",
2719
2765
  value: function subscribeToCollections(config, options) {
2720
2766
  var _this = this;
@@ -2727,26 +2773,77 @@ var SocketService = /*#__PURE__*/ function() {
2727
2773
  });
2728
2774
  var eventHandlers = [];
2729
2775
  config.forEach(function(configuration) {
2730
- var collectionName = configuration.collectionName, onAdd = configuration.onAdd, onFirstTime = configuration.onFirstTime, onModify = configuration.onModify, onRemove = configuration.onRemove, extraParsers = configuration.extraParsers;
2776
+ var collectionName = configuration.collectionName, conditions = configuration.conditions;
2777
+ var parsers = [
2778
+ configuration
2779
+ ].concat(_to_consumable_array(configuration.extraParsers || []));
2780
+ var matchedIds = /* @__PURE__ */ new Set();
2731
2781
  var attach = function(eventName, handler) {
2732
- if (!handler) return;
2733
- _this.socket.off(eventName, handler);
2734
2782
  _this.socket.on(eventName, handler);
2735
2783
  eventHandlers.push({
2736
2784
  eventName: eventName,
2737
2785
  handler: handler
2738
2786
  });
2739
2787
  };
2740
- attach("initial:".concat(collectionName), onFirstTime);
2741
- attach("add:".concat(collectionName), onAdd);
2742
- attach("update:".concat(collectionName), onModify);
2743
- attach("delete:".concat(collectionName), onRemove);
2744
- extraParsers === null || extraParsers === void 0 ? void 0 : extraParsers.forEach(function(parsers) {
2745
- var extraOnAdd = parsers.onAdd, extraOnFirstTime = parsers.onFirstTime, extraOnModify = parsers.onModify, extraOnRemove = parsers.onRemove;
2746
- attach("initial:".concat(collectionName), extraOnFirstTime);
2747
- attach("add:".concat(collectionName), extraOnAdd);
2748
- attach("update:".concat(collectionName), extraOnModify);
2749
- attach("delete:".concat(collectionName), extraOnRemove);
2788
+ var toDocs = function(payload) {
2789
+ return Array.isArray(payload) ? payload : payload ? [
2790
+ payload
2791
+ ] : [];
2792
+ };
2793
+ var run = function(op, docs) {
2794
+ return parsers.forEach(function(parser) {
2795
+ var _parser_op;
2796
+ return (_parser_op = parser[op]) === null || _parser_op === void 0 ? void 0 : _parser_op.call(parser, docs, configuration);
2797
+ });
2798
+ };
2799
+ var runIfAny = function(op, docs) {
2800
+ if (docs.length) {
2801
+ run(op, docs);
2802
+ }
2803
+ };
2804
+ attach("initial:".concat(collectionName), function(payload) {
2805
+ var docs = toDocs(payload).filter(function(doc2) {
2806
+ return checkConditions(doc2, conditions);
2807
+ });
2808
+ matchedIds.clear();
2809
+ docs.forEach(function(doc2) {
2810
+ return matchedIds.add(doc2.id);
2811
+ });
2812
+ run("onFirstTime", docs);
2813
+ });
2814
+ var handleUpsert = function(payload, defaultOp) {
2815
+ var added = [];
2816
+ var modified = [];
2817
+ var removed = [];
2818
+ toDocs(payload).forEach(function(doc2) {
2819
+ if (!(conditions === null || conditions === void 0 ? void 0 : conditions.length)) {
2820
+ (defaultOp === "onAdd" ? added : modified).push(doc2);
2821
+ return;
2822
+ }
2823
+ var wasMatching = matchedIds.has(doc2.id);
2824
+ if (checkConditions(doc2, conditions)) {
2825
+ matchedIds.add(doc2.id);
2826
+ (wasMatching ? modified : added).push(doc2);
2827
+ } else if (wasMatching) {
2828
+ matchedIds.delete(doc2.id);
2829
+ removed.push(doc2);
2830
+ }
2831
+ });
2832
+ runIfAny("onAdd", added);
2833
+ runIfAny("onModify", modified);
2834
+ runIfAny("onRemove", removed);
2835
+ };
2836
+ attach("add:".concat(collectionName), function(payload) {
2837
+ return handleUpsert(payload, "onAdd");
2838
+ });
2839
+ attach("update:".concat(collectionName), function(payload) {
2840
+ return handleUpsert(payload, "onModify");
2841
+ });
2842
+ attach("delete:".concat(collectionName), function(payload) {
2843
+ var docs = toDocs(payload).filter(function(doc2) {
2844
+ return !(conditions === null || conditions === void 0 ? void 0 : conditions.length) || matchedIds.delete(doc2.id);
2845
+ });
2846
+ runIfAny("onRemove", docs);
2750
2847
  });
2751
2848
  });
2752
2849
  var acknowledge = function(callback) {
@@ -2756,12 +2853,28 @@ var SocketService = /*#__PURE__*/ function() {
2756
2853
  console.error("Failed to subscribe to ".concat(config.join(", "), ": ").concat(callback.message));
2757
2854
  }
2758
2855
  };
2759
- if (options) {
2760
- s.emit("subscribe_options", options);
2856
+ config.forEach(function(c) {
2857
+ return _this.registerConditions(c.collectionName, c.conditions);
2858
+ });
2859
+ var conditionsByCollection = config.reduce(function(acc, c) {
2860
+ var active = _this.activeConditions.get(c.collectionName);
2861
+ if (active === null || active === void 0 ? void 0 : active.conditions.length) {
2862
+ acc[c.collectionName] = active.conditions;
2863
+ }
2864
+ return acc;
2865
+ }, {});
2866
+ var subscribeOptions = Object.keys(conditionsByCollection).length ? _object_spread_props(_object_spread({}, options), {
2867
+ conditions: conditionsByCollection
2868
+ }) : options;
2869
+ if (subscribeOptions) {
2870
+ s.emit("subscribe_options", subscribeOptions);
2761
2871
  }
2762
2872
  s.emit("subscribe_collections", collectionsNames, acknowledge);
2763
2873
  return function() {
2764
2874
  console.log("Cleaning up subscriptions for: ".concat(collectionsNames.join(", ")));
2875
+ collectionsNames.forEach(function(name) {
2876
+ return _this.releaseConditions(name);
2877
+ });
2765
2878
  s.emit("unsubscribe_collections", collectionsNames);
2766
2879
  eventHandlers.forEach(function(eh) {
2767
2880
  s.off(eh.eventName, eh.handler);
@@ -2861,5 +2974,5 @@ var add = function(a, b) {
2861
2974
  var subtract = function(a, b) {
2862
2975
  return a - b;
2863
2976
  };
2864
- export { add, addAuditRecord, addLoginAudit, addNxProblem, add_document, addressRegex, akeylessOnlineDomain, app, appCheck, auth, baseDomain, biDomain, calculateBearing, callCenterEventsDomain, callCenterGeoDomain, carsRegex, chargeDomain, chartsRegex, checkUserPermissions, cleanNxSites, cn, collections, colorRegex, createAttachmentFromBlob, createAttachmentFromUrl, createSelectors, dataSocketDomain, dataSyncDomain, db, delete_document, devicesDomain, displayFormatPhoneNumber, durationToSeconds, emailRegex, endUsersDomain, extractAlertsData, extractBoardsData, extractCanbusData, extractCarsData, extractClientData, extractLocationData, extractSiteData, fire_base_TIME_TEMP, formatCarNumber, getAddressByGeo, getFileUrlFromStorage, 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, isFixedOrServiceNumber, isInternational, isInternationalIsraelPhone, isLocal, isNodeEnv, isSimProviderCelcom, isSimProviderMonogoto, isSimProviderPartner, isSimProviderPelephone, is_iccid, local_israel_phone_format, longShortPhoneNumbers, mode, multiStringFormat, multiply, notificationsDomain, numbersOnlyRegex, numbersRegex, nxApiCall, parseMultiSelectInput, parsePermissions, parseSnapshotAsArray, parseSnapshotAsObject, priceRegex, propsAreEqual, query_document, query_document_by_conditions, query_documents, query_documents_by_conditions, renderOnce, secondsToDuration, sendEmail, setFormElementValue, setState, set_document, simpleExtractData, snapshot, snapshotDocument, socketServiceInstance, sort_by_timestamp, storage, subtract, textNumbersRegex, textRegex, timestamp_to_millis, timestamp_to_string, uploadFileToStorage, useLoginWithGoogle, useStoreValues, useValidation, userNameFormat, validateAndCast, validateUserStatusAndPermissions };
2977
+ export { add, addAuditRecord, addLoginAudit, addNxProblem, add_document, addressRegex, akeylessOnlineDomain, app, appCheck, auth, baseDomain, biDomain, calculateBearing, callCenterEventsDomain, callCenterGeoDomain, carsRegex, chargeDomain, chartsRegex, checkConditions, checkUserPermissions, cleanNxSites, cn, collections, colorRegex, createAttachmentFromBlob, createAttachmentFromUrl, createSelectors, dataSocketDomain, dataSyncDomain, db, delete_document, devicesDomain, displayFormatPhoneNumber, durationToSeconds, emailRegex, endUsersDomain, extractAlertsData, extractBoardsData, extractCanbusData, extractCarsData, extractClientData, extractLocationData, extractSiteData, fire_base_TIME_TEMP, formatCarNumber, getAddressByGeo, getFileUrlFromStorage, 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, isFixedOrServiceNumber, isInternational, isInternationalIsraelPhone, isLocal, isNodeEnv, isSimProviderCelcom, isSimProviderMonogoto, isSimProviderPartner, isSimProviderPelephone, is_iccid, local_israel_phone_format, longShortPhoneNumbers, mode, multiStringFormat, multiply, notificationsDomain, numbersOnlyRegex, numbersRegex, nxApiCall, parseMultiSelectInput, parsePermissions, parseSnapshotAsArray, parseSnapshotAsObject, priceRegex, propsAreEqual, query_document, query_document_by_conditions, query_documents, query_documents_by_conditions, renderOnce, secondsToDuration, sendEmail, setFormElementValue, setState, set_document, simpleExtractData, snapshot, snapshotDocument, socketServiceInstance, sort_by_timestamp, storage, subtract, textNumbersRegex, textRegex, timestamp_to_millis, timestamp_to_string, uploadFileToStorage, useLoginWithGoogle, useStoreValues, useValidation, userNameFormat, validateAndCast, validateUserStatusAndPermissions };
2865
2978
  //# sourceMappingURL=index.mjs.map
@@ -52,6 +52,7 @@ declare class SocketService {
52
52
  private disconnectCallbacks;
53
53
  private authToken;
54
54
  private isDisconnected;
55
+ private activeConditions;
55
56
  private handleDisconnect;
56
57
  private initSocket;
57
58
  private constructor();
@@ -64,8 +65,10 @@ declare class SocketService {
64
65
  offDisconnect(callback: () => void): void;
65
66
  isConnected(): boolean;
66
67
  setAuthToken(token: string): void;
68
+ private registerConditions;
69
+ private releaseConditions;
67
70
  disconnectSocket(): void;
68
- subscribeToCollections(config: OnSnapshotConfig[], options?: SubscribeCollectionsOptions): () => void;
71
+ subscribeToCollections(config: OnSnapshotConfig[], options?: Omit<SubscribeCollectionsOptions, "conditions">): () => void;
69
72
  setData<UpdateType extends RedisUpdateType, DataType = any>(payload: RedisUpdatePayload<UpdateType, DataType>): Promise<SocketCallbackResponse>;
70
73
  getCollectionData<T>(payload: Omit<GetDataPayload<T>, "key">): void;
71
74
  getDocumentData<T>(payload: GetDataPayload<T>): void;
@@ -107,7 +110,7 @@ interface UseDbSnapshotsSettings {
107
110
  worker?: UseWebWorkerOptions;
108
111
  socket?: {
109
112
  getSocket?: (socket: typeof socketServiceInstance) => void;
110
- subscribeOptions?: SubscribeCollectionsOptions;
113
+ subscribeOptions?: Omit<SubscribeCollectionsOptions, "conditions">;
111
114
  };
112
115
  }
113
116
  declare const useDbSnapshots: (configs: OnSnapshotConfig[], label?: string, settings?: UseDbSnapshotsSettings) => void;
@@ -52,6 +52,7 @@ declare class SocketService {
52
52
  private disconnectCallbacks;
53
53
  private authToken;
54
54
  private isDisconnected;
55
+ private activeConditions;
55
56
  private handleDisconnect;
56
57
  private initSocket;
57
58
  private constructor();
@@ -64,8 +65,10 @@ declare class SocketService {
64
65
  offDisconnect(callback: () => void): void;
65
66
  isConnected(): boolean;
66
67
  setAuthToken(token: string): void;
68
+ private registerConditions;
69
+ private releaseConditions;
67
70
  disconnectSocket(): void;
68
- subscribeToCollections(config: OnSnapshotConfig[], options?: SubscribeCollectionsOptions): () => void;
71
+ subscribeToCollections(config: OnSnapshotConfig[], options?: Omit<SubscribeCollectionsOptions, "conditions">): () => void;
69
72
  setData<UpdateType extends RedisUpdateType, DataType = any>(payload: RedisUpdatePayload<UpdateType, DataType>): Promise<SocketCallbackResponse>;
70
73
  getCollectionData<T>(payload: Omit<GetDataPayload<T>, "key">): void;
71
74
  getDocumentData<T>(payload: GetDataPayload<T>): void;
@@ -107,7 +110,7 @@ interface UseDbSnapshotsSettings {
107
110
  worker?: UseWebWorkerOptions;
108
111
  socket?: {
109
112
  getSocket?: (socket: typeof socketServiceInstance) => void;
110
- subscribeOptions?: SubscribeCollectionsOptions;
113
+ subscribeOptions?: Omit<SubscribeCollectionsOptions, "conditions">;
111
114
  };
112
115
  }
113
116
  declare const useDbSnapshots: (configs: OnSnapshotConfig[], label?: string, settings?: UseDbSnapshotsSettings) => void;