@katlux/providers 0.1.1-alpha.122 → 0.1.1-alpha.123

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/index.cjs CHANGED
@@ -4868,18 +4868,24 @@ class CFlatClientDataProvider extends AEncryptedClientProvider {
4868
4868
  this.error = null;
4869
4869
  try {
4870
4870
  this._computeFilteredAndSorted();
4871
- if (this._rowMap && this._rowMap.length > 0) {
4872
- const { rows, decrypted } = await this.decryptRows(this._rowMap);
4873
- if (decrypted) {
4874
- this._rowMap = rows;
4875
- }
4876
- }
4877
4871
  if (this.pageSize <= 0) {
4872
+ if (this._rowMap && this._rowMap.length > 0) {
4873
+ const { rows, decrypted } = await this.decryptRows(this._rowMap);
4874
+ if (decrypted) {
4875
+ this._rowMap = rows;
4876
+ }
4877
+ }
4878
4878
  this.pageData = this._rowMap;
4879
4879
  } else {
4880
4880
  const startIndex = (this.currentPage - 1) * this.pageSize;
4881
4881
  const endIndex = startIndex + this.pageSize;
4882
- this.pageData = this._rowMap.slice(startIndex, endIndex);
4882
+ const pageSlice = this._rowMap.slice(startIndex, endIndex);
4883
+ if (pageSlice && pageSlice.length > 0) {
4884
+ const { rows, decrypted } = await this.decryptRows(pageSlice);
4885
+ this.pageData = decrypted ? rows : pageSlice;
4886
+ } else {
4887
+ this.pageData = [];
4888
+ }
4883
4889
  }
4884
4890
  } catch (err) {
4885
4891
  this.error = err;
@@ -7915,25 +7921,40 @@ class CTreeClientDataProvider extends CFlatClientDataProvider {
7915
7921
  __treeNode: node
7916
7922
  };
7917
7923
  });
7918
- if (visibleNodes.length > 0) {
7919
- const { rows, decrypted } = await this.decryptRows(visibleNodes);
7920
- if (decrypted) {
7921
- for (const r of rows) {
7922
- const id = r[this.idKey] ?? r.id;
7923
- if (id !== void 0 && id !== null) {
7924
- this._decryptedNodeMap.set(id, r);
7924
+ if (this.pageSize <= 0) {
7925
+ if (visibleNodes.length > 0) {
7926
+ const { rows, decrypted } = await this.decryptRows(visibleNodes);
7927
+ if (decrypted) {
7928
+ for (const r of rows) {
7929
+ const id = r[this.idKey] ?? r.id;
7930
+ if (id !== void 0 && id !== null) {
7931
+ this._decryptedNodeMap.set(id, r);
7932
+ }
7925
7933
  }
7926
7934
  }
7935
+ this._allVisibleRowsCache = decrypted ? rows : visibleNodes;
7936
+ } else {
7937
+ this._allVisibleRowsCache = [];
7927
7938
  }
7928
- this._allVisibleRowsCache = decrypted ? rows : visibleNodes;
7929
- } else {
7930
- this._allVisibleRowsCache = [];
7931
- }
7932
- if (this.pageSize <= 0) {
7933
7939
  this.pageData = [...this._allVisibleRowsCache];
7934
7940
  } else {
7941
+ this._allVisibleRowsCache = null;
7935
7942
  const startIndex = (this.currentPage - 1) * this.pageSize;
7936
- this.pageData = this._allVisibleRowsCache.slice(startIndex, startIndex + this.pageSize);
7943
+ const pageSlice = visibleNodes.slice(startIndex, startIndex + this.pageSize);
7944
+ if (pageSlice.length > 0) {
7945
+ const { rows, decrypted } = await this.decryptRows(pageSlice);
7946
+ if (decrypted) {
7947
+ for (const r of rows) {
7948
+ const id = r[this.idKey] ?? r.id;
7949
+ if (id !== void 0 && id !== null) {
7950
+ this._decryptedNodeMap.set(id, r);
7951
+ }
7952
+ }
7953
+ }
7954
+ this.pageData = decrypted ? rows : pageSlice;
7955
+ } else {
7956
+ this.pageData = [];
7957
+ }
7937
7958
  }
7938
7959
  if (this.allData.length > 0) {
7939
7960
  this.initialLoad = false;
package/dist/index.mjs CHANGED
@@ -4851,18 +4851,24 @@ class CFlatClientDataProvider extends AEncryptedClientProvider {
4851
4851
  this.error = null;
4852
4852
  try {
4853
4853
  this._computeFilteredAndSorted();
4854
- if (this._rowMap && this._rowMap.length > 0) {
4855
- const { rows, decrypted } = await this.decryptRows(this._rowMap);
4856
- if (decrypted) {
4857
- this._rowMap = rows;
4858
- }
4859
- }
4860
4854
  if (this.pageSize <= 0) {
4855
+ if (this._rowMap && this._rowMap.length > 0) {
4856
+ const { rows, decrypted } = await this.decryptRows(this._rowMap);
4857
+ if (decrypted) {
4858
+ this._rowMap = rows;
4859
+ }
4860
+ }
4861
4861
  this.pageData = this._rowMap;
4862
4862
  } else {
4863
4863
  const startIndex = (this.currentPage - 1) * this.pageSize;
4864
4864
  const endIndex = startIndex + this.pageSize;
4865
- this.pageData = this._rowMap.slice(startIndex, endIndex);
4865
+ const pageSlice = this._rowMap.slice(startIndex, endIndex);
4866
+ if (pageSlice && pageSlice.length > 0) {
4867
+ const { rows, decrypted } = await this.decryptRows(pageSlice);
4868
+ this.pageData = decrypted ? rows : pageSlice;
4869
+ } else {
4870
+ this.pageData = [];
4871
+ }
4866
4872
  }
4867
4873
  } catch (err) {
4868
4874
  this.error = err;
@@ -7898,25 +7904,40 @@ class CTreeClientDataProvider extends CFlatClientDataProvider {
7898
7904
  __treeNode: node
7899
7905
  };
7900
7906
  });
7901
- if (visibleNodes.length > 0) {
7902
- const { rows, decrypted } = await this.decryptRows(visibleNodes);
7903
- if (decrypted) {
7904
- for (const r of rows) {
7905
- const id = r[this.idKey] ?? r.id;
7906
- if (id !== void 0 && id !== null) {
7907
- this._decryptedNodeMap.set(id, r);
7907
+ if (this.pageSize <= 0) {
7908
+ if (visibleNodes.length > 0) {
7909
+ const { rows, decrypted } = await this.decryptRows(visibleNodes);
7910
+ if (decrypted) {
7911
+ for (const r of rows) {
7912
+ const id = r[this.idKey] ?? r.id;
7913
+ if (id !== void 0 && id !== null) {
7914
+ this._decryptedNodeMap.set(id, r);
7915
+ }
7908
7916
  }
7909
7917
  }
7918
+ this._allVisibleRowsCache = decrypted ? rows : visibleNodes;
7919
+ } else {
7920
+ this._allVisibleRowsCache = [];
7910
7921
  }
7911
- this._allVisibleRowsCache = decrypted ? rows : visibleNodes;
7912
- } else {
7913
- this._allVisibleRowsCache = [];
7914
- }
7915
- if (this.pageSize <= 0) {
7916
7922
  this.pageData = [...this._allVisibleRowsCache];
7917
7923
  } else {
7924
+ this._allVisibleRowsCache = null;
7918
7925
  const startIndex = (this.currentPage - 1) * this.pageSize;
7919
- this.pageData = this._allVisibleRowsCache.slice(startIndex, startIndex + this.pageSize);
7926
+ const pageSlice = visibleNodes.slice(startIndex, startIndex + this.pageSize);
7927
+ if (pageSlice.length > 0) {
7928
+ const { rows, decrypted } = await this.decryptRows(pageSlice);
7929
+ if (decrypted) {
7930
+ for (const r of rows) {
7931
+ const id = r[this.idKey] ?? r.id;
7932
+ if (id !== void 0 && id !== null) {
7933
+ this._decryptedNodeMap.set(id, r);
7934
+ }
7935
+ }
7936
+ }
7937
+ this.pageData = decrypted ? rows : pageSlice;
7938
+ } else {
7939
+ this.pageData = [];
7940
+ }
7920
7941
  }
7921
7942
  if (this.allData.length > 0) {
7922
7943
  this.initialLoad = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@katlux/providers",
3
- "version": "0.1.1-alpha.122",
3
+ "version": "0.1.1-alpha.123",
4
4
  "description": "Core data calculation and caching providers for the Katlux ecosystem",
5
5
  "author": "Katlux",
6
6
  "license": "Apache-2.0",