@katlux/providers 0.1.1-alpha.114 → 0.1.1-alpha.115

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
@@ -4730,6 +4730,9 @@ class CFlatClientDataProvider extends AEncryptedClientProvider {
4730
4730
  const { rows, decrypted } = await this.decryptRows(this.pageData);
4731
4731
  if (decrypted) {
4732
4732
  this.pageData = rows;
4733
+ if (this.pageSize <= 0) {
4734
+ this._rowMap = rows;
4735
+ }
4733
4736
  }
4734
4737
  }
4735
4738
  } catch (err) {
@@ -7035,10 +7038,26 @@ class CFlatServerDataProvider extends ADataProvider {
7035
7038
  };
7036
7039
  };
7037
7040
  contextKey = "";
7041
+ encryption;
7038
7042
  latestRequestId = 0;
7039
7043
  abortController = null;
7040
7044
  constructor(options) {
7041
7045
  super(options);
7046
+ if (options?.encryption) {
7047
+ this.encryption = options.encryption;
7048
+ }
7049
+ }
7050
+ setEncryption(encryption) {
7051
+ if (this.encryption && this.encryption !== encryption) {
7052
+ clearCachedCipherProvider(this.encryption);
7053
+ }
7054
+ this.encryption = encryption;
7055
+ }
7056
+ clearEncryption() {
7057
+ if (this.encryption) {
7058
+ clearCachedCipherProvider(this.encryption);
7059
+ }
7060
+ this.encryption = void 0;
7042
7061
  }
7043
7062
  setContextKey(key) {
7044
7063
  this.contextKey = key;
@@ -7104,14 +7123,15 @@ class CFlatServerDataProvider extends ADataProvider {
7104
7123
  if (requestId !== this.latestRequestId) return;
7105
7124
  if (returnedData) {
7106
7125
  const normalized = normalizeDataResult(returnedData);
7126
+ let rows = normalized ? normalized.rows : returnedData.rows || [];
7127
+ const rowCount = normalized ? normalized.rowCount : returnedData.rowCount ?? 0;
7128
+ if (this.encryption?.enabled && rows && rows.length > 0) {
7129
+ const { rows: decRows, decrypted } = await decryptPageRows(rows, this.encryption, void 0, this.idKey);
7130
+ if (decrypted) rows = decRows;
7131
+ }
7107
7132
  this.batchUpdates(() => {
7108
- if (normalized) {
7109
- this.pageData = normalized.rows;
7110
- this.rowCount = normalized.rowCount;
7111
- } else {
7112
- this.pageData = returnedData.rows || [];
7113
- this.rowCount = returnedData.rowCount ?? 0;
7114
- }
7133
+ this.pageData = rows;
7134
+ this.rowCount = rowCount;
7115
7135
  this.initialLoad = false;
7116
7136
  });
7117
7137
  } else {
@@ -7174,11 +7194,11 @@ class CAPIFlatServerDataProvider extends CFlatServerDataProvider {
7174
7194
  });
7175
7195
  }
7176
7196
  setEncryption(encryption) {
7177
- this.encryption = encryption;
7197
+ super.setEncryption(encryption);
7178
7198
  this.requestProvider.setEncryption(encryption);
7179
7199
  }
7180
7200
  clearEncryption() {
7181
- this.encryption = void 0;
7201
+ super.clearEncryption();
7182
7202
  this.requestProvider.clearEncryption();
7183
7203
  }
7184
7204
  async refresh(hardRefresh = false) {
@@ -7721,6 +7741,9 @@ class CTreeClientDataProvider extends CFlatClientDataProvider {
7721
7741
  const { rows, decrypted } = await this.decryptRows(this.pageData);
7722
7742
  if (decrypted) {
7723
7743
  this.pageData = rows;
7744
+ if (this.pageSize <= 0) {
7745
+ this._rowMap = rows;
7746
+ }
7724
7747
  }
7725
7748
  }
7726
7749
  } catch (err) {
@@ -8156,6 +8179,7 @@ class CTreeServerDataProvider extends ADataProvider {
8156
8179
  // Server-side data handler
8157
8180
  pageDataHandler = null;
8158
8181
  contextKey = "";
8182
+ encryption;
8159
8183
  constructor(options) {
8160
8184
  super(options);
8161
8185
  this.expandedNodes = /* @__PURE__ */ new Set();
@@ -8165,6 +8189,19 @@ class CTreeServerDataProvider extends ADataProvider {
8165
8189
  if (options?.idKey) this.idKey = options.idKey;
8166
8190
  if (options?.expandedByDefault !== void 0) this.expandedByDefault = options.expandedByDefault;
8167
8191
  if (options?.paginateBy) this.paginateBy = options.paginateBy;
8192
+ if (options?.encryption) this.encryption = options.encryption;
8193
+ }
8194
+ setEncryption(encryption) {
8195
+ if (this.encryption && this.encryption !== encryption) {
8196
+ clearCachedCipherProvider(this.encryption);
8197
+ }
8198
+ this.encryption = encryption;
8199
+ }
8200
+ clearEncryption() {
8201
+ if (this.encryption) {
8202
+ clearCachedCipherProvider(this.encryption);
8203
+ }
8204
+ this.encryption = void 0;
8168
8205
  }
8169
8206
  setContextKey(key) {
8170
8207
  this.contextKey = key;
@@ -8247,14 +8284,15 @@ class CTreeServerDataProvider extends ADataProvider {
8247
8284
  if (requestId !== this.latestRequestId) return;
8248
8285
  if (returnedData) {
8249
8286
  const normalized = normalizeDataResult(returnedData);
8287
+ let rows = normalized ? normalized.rows : returnedData.rows || [];
8288
+ const rowCount = normalized ? normalized.rowCount : returnedData.rowCount ?? 0;
8289
+ if (this.encryption?.enabled && rows && rows.length > 0) {
8290
+ const { rows: decRows, decrypted } = await decryptPageRows(rows, this.encryption, void 0, this.idKey);
8291
+ if (decrypted) rows = decRows;
8292
+ }
8250
8293
  this.batchUpdates(() => {
8251
- if (normalized) {
8252
- this.pageData = normalized.rows;
8253
- this.rowCount = normalized.rowCount;
8254
- } else {
8255
- this.pageData = returnedData.rows || [];
8256
- this.rowCount = returnedData.rowCount ?? 0;
8257
- }
8294
+ this.pageData = rows;
8295
+ this.rowCount = rowCount;
8258
8296
  this.initialLoad = false;
8259
8297
  });
8260
8298
  } else {
@@ -8361,11 +8399,11 @@ class CAPITreeServerDataProvider extends CTreeServerDataProvider {
8361
8399
  });
8362
8400
  }
8363
8401
  setEncryption(encryption) {
8364
- this.encryption = encryption;
8402
+ super.setEncryption(encryption);
8365
8403
  this.requestProvider.setEncryption(encryption);
8366
8404
  }
8367
8405
  clearEncryption() {
8368
- this.encryption = void 0;
8406
+ super.clearEncryption();
8369
8407
  this.requestProvider.clearEncryption();
8370
8408
  }
8371
8409
  async refresh(hardRefresh = false) {
package/dist/index.d.cts CHANGED
@@ -618,7 +618,7 @@ declare abstract class AEncryptedClientProvider<TRow = TDataRow> extends ADataPr
618
618
  declare class CFlatClientDataProvider<TRow = TDataRow> extends AEncryptedClientProvider<TRow> {
619
619
  private _allData;
620
620
  filteredData: TRow[];
621
- private _rowMap;
621
+ protected _rowMap: TRow[];
622
622
  protected _filterDirty: boolean;
623
623
  protected _sortDirty: boolean;
624
624
  protected _activeFilterEvaluator: ((row: any) => boolean) | null;
@@ -754,9 +754,12 @@ declare class CAPIFlatClientDataProvider<TRow = TDataRow> extends CFlatClientDat
754
754
  declare class CFlatServerDataProvider<TRow = TDataRow> extends ADataProvider<TRow> {
755
755
  pageDataHandler: TPageDataHandler<TRow>;
756
756
  contextKey: string;
757
+ encryption?: IProviderEncryptionOptions;
757
758
  private latestRequestId;
758
759
  private abortController;
759
760
  constructor(options?: IDataProviderOptions);
761
+ setEncryption(encryption?: IProviderEncryptionOptions): void;
762
+ clearEncryption(): void;
760
763
  setContextKey(key: string): void;
761
764
  setPageDataHandler(handler: TPageDataHandler<TRow>): Promise<void>;
762
765
  loadPageData(options?: {
@@ -883,7 +886,10 @@ declare class CTreeServerDataProvider<TRow = TDataRow> extends ADataProvider<TRo
883
886
  expandedNodes: Set<string | number>;
884
887
  pageDataHandler: TTreePageDataHandler<TRow> | null;
885
888
  contextKey: string;
889
+ encryption?: IProviderEncryptionOptions;
886
890
  constructor(options?: ITreeDataProviderOptions);
891
+ setEncryption(encryption?: IProviderEncryptionOptions): void;
892
+ clearEncryption(): void;
887
893
  setContextKey(key: string): void;
888
894
  setPageDataHandler(handler: TTreePageDataHandler<TRow>): Promise<void>;
889
895
  private latestRequestId;
package/dist/index.d.mts CHANGED
@@ -618,7 +618,7 @@ declare abstract class AEncryptedClientProvider<TRow = TDataRow> extends ADataPr
618
618
  declare class CFlatClientDataProvider<TRow = TDataRow> extends AEncryptedClientProvider<TRow> {
619
619
  private _allData;
620
620
  filteredData: TRow[];
621
- private _rowMap;
621
+ protected _rowMap: TRow[];
622
622
  protected _filterDirty: boolean;
623
623
  protected _sortDirty: boolean;
624
624
  protected _activeFilterEvaluator: ((row: any) => boolean) | null;
@@ -754,9 +754,12 @@ declare class CAPIFlatClientDataProvider<TRow = TDataRow> extends CFlatClientDat
754
754
  declare class CFlatServerDataProvider<TRow = TDataRow> extends ADataProvider<TRow> {
755
755
  pageDataHandler: TPageDataHandler<TRow>;
756
756
  contextKey: string;
757
+ encryption?: IProviderEncryptionOptions;
757
758
  private latestRequestId;
758
759
  private abortController;
759
760
  constructor(options?: IDataProviderOptions);
761
+ setEncryption(encryption?: IProviderEncryptionOptions): void;
762
+ clearEncryption(): void;
760
763
  setContextKey(key: string): void;
761
764
  setPageDataHandler(handler: TPageDataHandler<TRow>): Promise<void>;
762
765
  loadPageData(options?: {
@@ -883,7 +886,10 @@ declare class CTreeServerDataProvider<TRow = TDataRow> extends ADataProvider<TRo
883
886
  expandedNodes: Set<string | number>;
884
887
  pageDataHandler: TTreePageDataHandler<TRow> | null;
885
888
  contextKey: string;
889
+ encryption?: IProviderEncryptionOptions;
886
890
  constructor(options?: ITreeDataProviderOptions);
891
+ setEncryption(encryption?: IProviderEncryptionOptions): void;
892
+ clearEncryption(): void;
887
893
  setContextKey(key: string): void;
888
894
  setPageDataHandler(handler: TTreePageDataHandler<TRow>): Promise<void>;
889
895
  private latestRequestId;
package/dist/index.d.ts CHANGED
@@ -618,7 +618,7 @@ declare abstract class AEncryptedClientProvider<TRow = TDataRow> extends ADataPr
618
618
  declare class CFlatClientDataProvider<TRow = TDataRow> extends AEncryptedClientProvider<TRow> {
619
619
  private _allData;
620
620
  filteredData: TRow[];
621
- private _rowMap;
621
+ protected _rowMap: TRow[];
622
622
  protected _filterDirty: boolean;
623
623
  protected _sortDirty: boolean;
624
624
  protected _activeFilterEvaluator: ((row: any) => boolean) | null;
@@ -754,9 +754,12 @@ declare class CAPIFlatClientDataProvider<TRow = TDataRow> extends CFlatClientDat
754
754
  declare class CFlatServerDataProvider<TRow = TDataRow> extends ADataProvider<TRow> {
755
755
  pageDataHandler: TPageDataHandler<TRow>;
756
756
  contextKey: string;
757
+ encryption?: IProviderEncryptionOptions;
757
758
  private latestRequestId;
758
759
  private abortController;
759
760
  constructor(options?: IDataProviderOptions);
761
+ setEncryption(encryption?: IProviderEncryptionOptions): void;
762
+ clearEncryption(): void;
760
763
  setContextKey(key: string): void;
761
764
  setPageDataHandler(handler: TPageDataHandler<TRow>): Promise<void>;
762
765
  loadPageData(options?: {
@@ -883,7 +886,10 @@ declare class CTreeServerDataProvider<TRow = TDataRow> extends ADataProvider<TRo
883
886
  expandedNodes: Set<string | number>;
884
887
  pageDataHandler: TTreePageDataHandler<TRow> | null;
885
888
  contextKey: string;
889
+ encryption?: IProviderEncryptionOptions;
886
890
  constructor(options?: ITreeDataProviderOptions);
891
+ setEncryption(encryption?: IProviderEncryptionOptions): void;
892
+ clearEncryption(): void;
887
893
  setContextKey(key: string): void;
888
894
  setPageDataHandler(handler: TTreePageDataHandler<TRow>): Promise<void>;
889
895
  private latestRequestId;
package/dist/index.mjs CHANGED
@@ -4713,6 +4713,9 @@ class CFlatClientDataProvider extends AEncryptedClientProvider {
4713
4713
  const { rows, decrypted } = await this.decryptRows(this.pageData);
4714
4714
  if (decrypted) {
4715
4715
  this.pageData = rows;
4716
+ if (this.pageSize <= 0) {
4717
+ this._rowMap = rows;
4718
+ }
4716
4719
  }
4717
4720
  }
4718
4721
  } catch (err) {
@@ -7018,10 +7021,26 @@ class CFlatServerDataProvider extends ADataProvider {
7018
7021
  };
7019
7022
  };
7020
7023
  contextKey = "";
7024
+ encryption;
7021
7025
  latestRequestId = 0;
7022
7026
  abortController = null;
7023
7027
  constructor(options) {
7024
7028
  super(options);
7029
+ if (options?.encryption) {
7030
+ this.encryption = options.encryption;
7031
+ }
7032
+ }
7033
+ setEncryption(encryption) {
7034
+ if (this.encryption && this.encryption !== encryption) {
7035
+ clearCachedCipherProvider(this.encryption);
7036
+ }
7037
+ this.encryption = encryption;
7038
+ }
7039
+ clearEncryption() {
7040
+ if (this.encryption) {
7041
+ clearCachedCipherProvider(this.encryption);
7042
+ }
7043
+ this.encryption = void 0;
7025
7044
  }
7026
7045
  setContextKey(key) {
7027
7046
  this.contextKey = key;
@@ -7087,14 +7106,15 @@ class CFlatServerDataProvider extends ADataProvider {
7087
7106
  if (requestId !== this.latestRequestId) return;
7088
7107
  if (returnedData) {
7089
7108
  const normalized = normalizeDataResult(returnedData);
7109
+ let rows = normalized ? normalized.rows : returnedData.rows || [];
7110
+ const rowCount = normalized ? normalized.rowCount : returnedData.rowCount ?? 0;
7111
+ if (this.encryption?.enabled && rows && rows.length > 0) {
7112
+ const { rows: decRows, decrypted } = await decryptPageRows(rows, this.encryption, void 0, this.idKey);
7113
+ if (decrypted) rows = decRows;
7114
+ }
7090
7115
  this.batchUpdates(() => {
7091
- if (normalized) {
7092
- this.pageData = normalized.rows;
7093
- this.rowCount = normalized.rowCount;
7094
- } else {
7095
- this.pageData = returnedData.rows || [];
7096
- this.rowCount = returnedData.rowCount ?? 0;
7097
- }
7116
+ this.pageData = rows;
7117
+ this.rowCount = rowCount;
7098
7118
  this.initialLoad = false;
7099
7119
  });
7100
7120
  } else {
@@ -7157,11 +7177,11 @@ class CAPIFlatServerDataProvider extends CFlatServerDataProvider {
7157
7177
  });
7158
7178
  }
7159
7179
  setEncryption(encryption) {
7160
- this.encryption = encryption;
7180
+ super.setEncryption(encryption);
7161
7181
  this.requestProvider.setEncryption(encryption);
7162
7182
  }
7163
7183
  clearEncryption() {
7164
- this.encryption = void 0;
7184
+ super.clearEncryption();
7165
7185
  this.requestProvider.clearEncryption();
7166
7186
  }
7167
7187
  async refresh(hardRefresh = false) {
@@ -7704,6 +7724,9 @@ class CTreeClientDataProvider extends CFlatClientDataProvider {
7704
7724
  const { rows, decrypted } = await this.decryptRows(this.pageData);
7705
7725
  if (decrypted) {
7706
7726
  this.pageData = rows;
7727
+ if (this.pageSize <= 0) {
7728
+ this._rowMap = rows;
7729
+ }
7707
7730
  }
7708
7731
  }
7709
7732
  } catch (err) {
@@ -8139,6 +8162,7 @@ class CTreeServerDataProvider extends ADataProvider {
8139
8162
  // Server-side data handler
8140
8163
  pageDataHandler = null;
8141
8164
  contextKey = "";
8165
+ encryption;
8142
8166
  constructor(options) {
8143
8167
  super(options);
8144
8168
  this.expandedNodes = /* @__PURE__ */ new Set();
@@ -8148,6 +8172,19 @@ class CTreeServerDataProvider extends ADataProvider {
8148
8172
  if (options?.idKey) this.idKey = options.idKey;
8149
8173
  if (options?.expandedByDefault !== void 0) this.expandedByDefault = options.expandedByDefault;
8150
8174
  if (options?.paginateBy) this.paginateBy = options.paginateBy;
8175
+ if (options?.encryption) this.encryption = options.encryption;
8176
+ }
8177
+ setEncryption(encryption) {
8178
+ if (this.encryption && this.encryption !== encryption) {
8179
+ clearCachedCipherProvider(this.encryption);
8180
+ }
8181
+ this.encryption = encryption;
8182
+ }
8183
+ clearEncryption() {
8184
+ if (this.encryption) {
8185
+ clearCachedCipherProvider(this.encryption);
8186
+ }
8187
+ this.encryption = void 0;
8151
8188
  }
8152
8189
  setContextKey(key) {
8153
8190
  this.contextKey = key;
@@ -8230,14 +8267,15 @@ class CTreeServerDataProvider extends ADataProvider {
8230
8267
  if (requestId !== this.latestRequestId) return;
8231
8268
  if (returnedData) {
8232
8269
  const normalized = normalizeDataResult(returnedData);
8270
+ let rows = normalized ? normalized.rows : returnedData.rows || [];
8271
+ const rowCount = normalized ? normalized.rowCount : returnedData.rowCount ?? 0;
8272
+ if (this.encryption?.enabled && rows && rows.length > 0) {
8273
+ const { rows: decRows, decrypted } = await decryptPageRows(rows, this.encryption, void 0, this.idKey);
8274
+ if (decrypted) rows = decRows;
8275
+ }
8233
8276
  this.batchUpdates(() => {
8234
- if (normalized) {
8235
- this.pageData = normalized.rows;
8236
- this.rowCount = normalized.rowCount;
8237
- } else {
8238
- this.pageData = returnedData.rows || [];
8239
- this.rowCount = returnedData.rowCount ?? 0;
8240
- }
8277
+ this.pageData = rows;
8278
+ this.rowCount = rowCount;
8241
8279
  this.initialLoad = false;
8242
8280
  });
8243
8281
  } else {
@@ -8344,11 +8382,11 @@ class CAPITreeServerDataProvider extends CTreeServerDataProvider {
8344
8382
  });
8345
8383
  }
8346
8384
  setEncryption(encryption) {
8347
- this.encryption = encryption;
8385
+ super.setEncryption(encryption);
8348
8386
  this.requestProvider.setEncryption(encryption);
8349
8387
  }
8350
8388
  clearEncryption() {
8351
- this.encryption = void 0;
8389
+ super.clearEncryption();
8352
8390
  this.requestProvider.clearEncryption();
8353
8391
  }
8354
8392
  async refresh(hardRefresh = false) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@katlux/providers",
3
- "version": "0.1.1-alpha.114",
3
+ "version": "0.1.1-alpha.115",
4
4
  "description": "Core data calculation and caching providers for the Katlux ecosystem",
5
5
  "author": "Katlux",
6
6
  "license": "Apache-2.0",