akeyless-client-commons 1.1.25 → 1.1.26

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.
@@ -163,8 +163,8 @@ declare const addAuditRecord: (action: string, entity: string, details: TObject<
163
163
  declare const validateUserStatusAndPermissions: (user: NxUser, app: AppName) => TObject<TObject<boolean>>;
164
164
  declare const getFileUrlFromStorage: (filePath: string) => Promise<string>;
165
165
  declare const uploadFileToStorage: (file: File, filePath: string) => Promise<string>;
166
- declare const parsSnapshotAsObject: (setState: SetState<any>) => OnSnapshotParsers;
167
- declare const parsSnapshotAsArray: (setState: SetState<any>, collectionName: string) => OnSnapshotParsers;
166
+ declare const parsSnapshotAsObject: (setState: SetState<any>, filterCondition?: (v: any) => boolean) => OnSnapshotParsers;
167
+ declare const parsSnapshotAsArray: (setState: SetState<any>, filterCondition?: (v: any) => boolean) => OnSnapshotParsers;
168
168
 
169
169
  declare const calculateBearing: (startLat: any, startLng: any, endLat: any, endLng: any) => number;
170
170
  declare const renderOnce: () => boolean;
@@ -163,8 +163,8 @@ declare const addAuditRecord: (action: string, entity: string, details: TObject<
163
163
  declare const validateUserStatusAndPermissions: (user: NxUser, app: AppName) => TObject<TObject<boolean>>;
164
164
  declare const getFileUrlFromStorage: (filePath: string) => Promise<string>;
165
165
  declare const uploadFileToStorage: (file: File, filePath: string) => Promise<string>;
166
- declare const parsSnapshotAsObject: (setState: SetState<any>) => OnSnapshotParsers;
167
- declare const parsSnapshotAsArray: (setState: SetState<any>, collectionName: string) => OnSnapshotParsers;
166
+ declare const parsSnapshotAsObject: (setState: SetState<any>, filterCondition?: (v: any) => boolean) => OnSnapshotParsers;
167
+ declare const parsSnapshotAsArray: (setState: SetState<any>, filterCondition?: (v: any) => boolean) => OnSnapshotParsers;
168
168
 
169
169
  declare const calculateBearing: (startLat: any, startLng: any, endLat: any, endLng: any) => number;
170
170
  declare const renderOnce: () => boolean;
@@ -1946,9 +1946,12 @@ var uploadFileToStorage = /*#__PURE__*/ function() {
1946
1946
  return _ref.apply(this, arguments);
1947
1947
  };
1948
1948
  }();
1949
- var parsSnapshotAsObject = function(setState2) {
1949
+ var parsSnapshotAsObject = function(setState2, filterCondition) {
1950
1950
  return {
1951
1951
  onFirstTime: function(docs) {
1952
+ if (filterCondition) {
1953
+ docs = docs.filter(filterCondition);
1954
+ }
1952
1955
  var object = docs.reduce(function(acc, doc2) {
1953
1956
  acc[doc2.id] = doc2.data;
1954
1957
  return acc;
@@ -1956,6 +1959,9 @@ var parsSnapshotAsObject = function(setState2) {
1956
1959
  setState2(object);
1957
1960
  },
1958
1961
  onAdd: function(docs) {
1962
+ if (filterCondition) {
1963
+ docs = docs.filter(filterCondition);
1964
+ }
1959
1965
  var object = docs.reduce(function(acc, doc2) {
1960
1966
  acc[doc2.id] = doc2.data;
1961
1967
  return acc;
@@ -1965,6 +1971,9 @@ var parsSnapshotAsObject = function(setState2) {
1965
1971
  });
1966
1972
  },
1967
1973
  onModify: function(docs) {
1974
+ if (filterCondition) {
1975
+ docs = docs.filter(filterCondition);
1976
+ }
1968
1977
  var object = docs.reduce(function(acc, doc2) {
1969
1978
  acc[doc2.id] = doc2.data;
1970
1979
  return acc;
@@ -1974,6 +1983,9 @@ var parsSnapshotAsObject = function(setState2) {
1974
1983
  });
1975
1984
  },
1976
1985
  onRemove: function(docs) {
1986
+ if (filterCondition) {
1987
+ docs = docs.filter(filterCondition);
1988
+ }
1977
1989
  setState2(function(prev) {
1978
1990
  var newState = _object_spread({}, prev);
1979
1991
  docs.forEach(function(doc2) {
@@ -1984,18 +1996,26 @@ var parsSnapshotAsObject = function(setState2) {
1984
1996
  }
1985
1997
  };
1986
1998
  };
1987
- var parsSnapshotAsArray = function(setState2, collectionName) {
1999
+ var parsSnapshotAsArray = function(setState2, filterCondition) {
1988
2000
  return {
1989
2001
  onFirstTime: function(docs) {
1990
- console.log("".concat(collectionName, " => onFirstTime"), docs);
2002
+ if (filterCondition) {
2003
+ docs = docs.filter(filterCondition);
2004
+ }
1991
2005
  setState2(docs);
1992
2006
  },
1993
2007
  onAdd: function(docs) {
2008
+ if (filterCondition) {
2009
+ docs = docs.filter(filterCondition);
2010
+ }
1994
2011
  setState2(function(prev) {
1995
2012
  return _to_consumable_array(prev).concat(_to_consumable_array(docs));
1996
2013
  });
1997
2014
  },
1998
2015
  onModify: function(docs) {
2016
+ if (filterCondition) {
2017
+ docs = docs.filter(filterCondition);
2018
+ }
1999
2019
  setState2(function(prev) {
2000
2020
  var newState = _to_consumable_array(prev);
2001
2021
  docs.forEach(function(doc2) {
@@ -2010,6 +2030,9 @@ var parsSnapshotAsArray = function(setState2, collectionName) {
2010
2030
  });
2011
2031
  },
2012
2032
  onRemove: function(docs) {
2033
+ if (filterCondition) {
2034
+ docs = docs.filter(filterCondition);
2035
+ }
2013
2036
  setState2(function(prev) {
2014
2037
  return prev.filter(function(doc2) {
2015
2038
  return !docs.some(function(d) {
@@ -1565,9 +1565,12 @@ var uploadFileToStorage = /*#__PURE__*/ function() {
1565
1565
  return _ref.apply(this, arguments);
1566
1566
  };
1567
1567
  }();
1568
- var parsSnapshotAsObject = function(setState2) {
1568
+ var parsSnapshotAsObject = function(setState2, filterCondition) {
1569
1569
  return {
1570
1570
  onFirstTime: function(docs) {
1571
+ if (filterCondition) {
1572
+ docs = docs.filter(filterCondition);
1573
+ }
1571
1574
  var object = docs.reduce(function(acc, doc2) {
1572
1575
  acc[doc2.id] = doc2.data;
1573
1576
  return acc;
@@ -1575,6 +1578,9 @@ var parsSnapshotAsObject = function(setState2) {
1575
1578
  setState2(object);
1576
1579
  },
1577
1580
  onAdd: function(docs) {
1581
+ if (filterCondition) {
1582
+ docs = docs.filter(filterCondition);
1583
+ }
1578
1584
  var object = docs.reduce(function(acc, doc2) {
1579
1585
  acc[doc2.id] = doc2.data;
1580
1586
  return acc;
@@ -1584,6 +1590,9 @@ var parsSnapshotAsObject = function(setState2) {
1584
1590
  });
1585
1591
  },
1586
1592
  onModify: function(docs) {
1593
+ if (filterCondition) {
1594
+ docs = docs.filter(filterCondition);
1595
+ }
1587
1596
  var object = docs.reduce(function(acc, doc2) {
1588
1597
  acc[doc2.id] = doc2.data;
1589
1598
  return acc;
@@ -1593,6 +1602,9 @@ var parsSnapshotAsObject = function(setState2) {
1593
1602
  });
1594
1603
  },
1595
1604
  onRemove: function(docs) {
1605
+ if (filterCondition) {
1606
+ docs = docs.filter(filterCondition);
1607
+ }
1596
1608
  setState2(function(prev) {
1597
1609
  var newState = _object_spread({}, prev);
1598
1610
  docs.forEach(function(doc2) {
@@ -1603,18 +1615,26 @@ var parsSnapshotAsObject = function(setState2) {
1603
1615
  }
1604
1616
  };
1605
1617
  };
1606
- var parsSnapshotAsArray = function(setState2, collectionName) {
1618
+ var parsSnapshotAsArray = function(setState2, filterCondition) {
1607
1619
  return {
1608
1620
  onFirstTime: function(docs) {
1609
- console.log("".concat(collectionName, " => onFirstTime"), docs);
1621
+ if (filterCondition) {
1622
+ docs = docs.filter(filterCondition);
1623
+ }
1610
1624
  setState2(docs);
1611
1625
  },
1612
1626
  onAdd: function(docs) {
1627
+ if (filterCondition) {
1628
+ docs = docs.filter(filterCondition);
1629
+ }
1613
1630
  setState2(function(prev) {
1614
1631
  return _to_consumable_array(prev).concat(_to_consumable_array(docs));
1615
1632
  });
1616
1633
  },
1617
1634
  onModify: function(docs) {
1635
+ if (filterCondition) {
1636
+ docs = docs.filter(filterCondition);
1637
+ }
1618
1638
  setState2(function(prev) {
1619
1639
  var newState = _to_consumable_array(prev);
1620
1640
  docs.forEach(function(doc2) {
@@ -1629,6 +1649,9 @@ var parsSnapshotAsArray = function(setState2, collectionName) {
1629
1649
  });
1630
1650
  },
1631
1651
  onRemove: function(docs) {
1652
+ if (filterCondition) {
1653
+ docs = docs.filter(filterCondition);
1654
+ }
1632
1655
  setState2(function(prev) {
1633
1656
  return prev.filter(function(doc2) {
1634
1657
  return !docs.some(function(d) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akeyless-client-commons",
3
- "version": "1.1.25",
3
+ "version": "1.1.26",
4
4
  "scripts": {
5
5
  "build": "tsup",
6
6
  "deploy": "npm run build && npm version patch --no-git-tag-version && npm publish",