@dcupl/bundle 2.0.0-beta.10 → 2.0.0-beta.11

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.
@@ -521,24 +521,24 @@
521
521
  g$1.Request = Request;
522
522
  g$1.Response = Response;
523
523
  }
524
- var Ot$1 = typeof global == "object" && global && global.Object === Object && global, fr$1 = typeof self == "object" && self && self.Object === Object && self, O$2 = Ot$1 || fr$1 || Function("return this")(), A$1 = O$2.Symbol, $t$1 = Object.prototype, lr$1 = $t$1.hasOwnProperty, dr$1 = $t$1.toString, G$3 = A$1 ? A$1.toStringTag : void 0;
524
+ var Ot$1 = typeof global == "object" && global && global.Object === Object && global, fr$1 = typeof self == "object" && self && self.Object === Object && self, O$2 = Ot$1 || fr$1 || Function("return this")(), A$1 = O$2.Symbol, $t$1 = Object.prototype, lr$1 = $t$1.hasOwnProperty, dr$1 = $t$1.toString, k$3 = A$1 ? A$1.toStringTag : void 0;
525
525
  function hr$1(r) {
526
- var e = lr$1.call(r, G$3), t = r[G$3];
526
+ var e = lr$1.call(r, k$3), t = r[k$3];
527
527
  try {
528
- r[G$3] = void 0;
528
+ r[k$3] = void 0;
529
529
  var n = true;
530
530
  } catch {
531
531
  }
532
532
  var s = dr$1.call(r);
533
- return n && (e ? r[G$3] = t : delete r[G$3]), s;
533
+ return n && (e ? r[k$3] = t : delete r[k$3]), s;
534
534
  }
535
535
  var pr$1 = Object.prototype, gr$1 = pr$1.toString;
536
536
  function yr$1(r) {
537
537
  return gr$1.call(r);
538
538
  }
539
- var mr$1 = "[object Null]", br$1 = "[object Undefined]", Ge$1 = A$1 ? A$1.toStringTag : void 0;
539
+ var mr$1 = "[object Null]", br$1 = "[object Undefined]", ke$1 = A$1 ? A$1.toStringTag : void 0;
540
540
  function N$2(r) {
541
- return r == null ? r === void 0 ? br$1 : mr$1 : Ge$1 && Ge$1 in Object(r) ? hr$1(r) : yr$1(r);
541
+ return r == null ? r === void 0 ? br$1 : mr$1 : ke$1 && ke$1 in Object(r) ? hr$1(r) : yr$1(r);
542
542
  }
543
543
  function T$2(r) {
544
544
  return r != null && typeof r == "object";
@@ -552,7 +552,7 @@
552
552
  s[t] = e(r[t], t, r);
553
553
  return s;
554
554
  }
555
- var v$1 = Array.isArray, ke$1 = A$1 ? A$1.prototype : void 0, Be$2 = ke$1 ? ke$1.toString : void 0;
555
+ var v$1 = Array.isArray, Ge$1 = A$1 ? A$1.prototype : void 0, Be$2 = Ge$1 ? Ge$1.toString : void 0;
556
556
  function ce$1(r) {
557
557
  if (typeof r == "string")
558
558
  return r;
@@ -638,8 +638,8 @@
638
638
  }
639
639
  return "";
640
640
  }
641
- var Pr$1 = /[\\^$.*+?()[\]{}|]/g, Rr$1 = /^\[object .+?Constructor\]$/, Fr$1 = Function.prototype, Lr$1 = Object.prototype, Gr$1 = Fr$1.toString, kr$1 = Lr$1.hasOwnProperty, Br$1 = RegExp(
642
- "^" + Gr$1.call(kr$1).replace(Pr$1, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
641
+ var Pr$1 = /[\\^$.*+?()[\]{}|]/g, Rr$1 = /^\[object .+?Constructor\]$/, Fr$1 = Function.prototype, Lr$1 = Object.prototype, kr$1 = Fr$1.toString, Gr$1 = Lr$1.hasOwnProperty, Br$1 = RegExp(
642
+ "^" + kr$1.call(Gr$1).replace(Pr$1, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
643
643
  );
644
644
  function zr$1(r) {
645
645
  if (!E$3(r) || jr$1(r))
@@ -803,8 +803,8 @@
803
803
  function xn$1() {
804
804
  return false;
805
805
  }
806
- var Et$1 = typeof exports == "object" && exports && !exports.nodeType && exports, Xe$2 = Et$1 && typeof module == "object" && module && !module.nodeType && module, Sn$1 = Xe$2 && Xe$2.exports === Et$1, Ve$3 = Sn$1 ? O$2.Buffer : void 0, Tn$1 = Ve$3 ? Ve$3.isBuffer : void 0, ae$1 = Tn$1 || xn$1, On$1 = "[object Arguments]", $n$1 = "[object Array]", _n$1 = "[object Boolean]", Cn$1 = "[object Date]", Mn$1 = "[object Error]", Dn$1 = "[object Function]", In$1 = "[object Map]", En$1 = "[object Number]", Qn$1 = "[object Object]", Nn$1 = "[object RegExp]", jn$1 = "[object Set]", qn$1 = "[object String]", Kn$1 = "[object WeakMap]", Pn$1 = "[object ArrayBuffer]", Rn$1 = "[object DataView]", Fn$1 = "[object Float32Array]", Ln$1 = "[object Float64Array]", Gn$1 = "[object Int8Array]", kn$1 = "[object Int16Array]", Bn$1 = "[object Int32Array]", zn$1 = "[object Uint8Array]", Un$1 = "[object Uint8ClampedArray]", Hn$1 = "[object Uint16Array]", Wn$1 = "[object Uint32Array]", y = {};
807
- y[Fn$1] = y[Ln$1] = y[Gn$1] = y[kn$1] = y[Bn$1] = y[zn$1] = y[Un$1] = y[Hn$1] = y[Wn$1] = true;
806
+ var Et$1 = typeof exports == "object" && exports && !exports.nodeType && exports, Xe$2 = Et$1 && typeof module == "object" && module && !module.nodeType && module, Sn$1 = Xe$2 && Xe$2.exports === Et$1, Ve$3 = Sn$1 ? O$2.Buffer : void 0, Tn$1 = Ve$3 ? Ve$3.isBuffer : void 0, ae$1 = Tn$1 || xn$1, On$1 = "[object Arguments]", $n$1 = "[object Array]", _n$1 = "[object Boolean]", Cn$1 = "[object Date]", Mn$1 = "[object Error]", Dn$1 = "[object Function]", In$1 = "[object Map]", En$1 = "[object Number]", Qn$1 = "[object Object]", Nn$1 = "[object RegExp]", jn$1 = "[object Set]", qn$1 = "[object String]", Kn$1 = "[object WeakMap]", Pn$1 = "[object ArrayBuffer]", Rn$1 = "[object DataView]", Fn$1 = "[object Float32Array]", Ln$1 = "[object Float64Array]", kn$1 = "[object Int8Array]", Gn$1 = "[object Int16Array]", Bn$1 = "[object Int32Array]", zn$1 = "[object Uint8Array]", Un$1 = "[object Uint8ClampedArray]", Hn$1 = "[object Uint16Array]", Wn$1 = "[object Uint32Array]", y = {};
807
+ y[Fn$1] = y[Ln$1] = y[kn$1] = y[Gn$1] = y[Bn$1] = y[zn$1] = y[Un$1] = y[Hn$1] = y[Wn$1] = true;
808
808
  y[On$1] = y[$n$1] = y[Pn$1] = y[_n$1] = y[Rn$1] = y[Cn$1] = y[Mn$1] = y[Dn$1] = y[In$1] = y[En$1] = y[Qn$1] = y[Nn$1] = y[jn$1] = y[qn$1] = y[Kn$1] = false;
809
809
  function Zn$1(r) {
810
810
  return T$2(r) && Ee$2(r.length) && !!y[N$2(r)];
@@ -1042,7 +1042,7 @@
1042
1042
  }
1043
1043
  return s;
1044
1044
  }
1045
- var Ks$1 = jt$1(Object.getPrototypeOf, Object), Ps$1 = "\\ud800-\\udfff", Rs$1 = "\\u0300-\\u036f", Fs$1 = "\\ufe20-\\ufe2f", Ls$1 = "\\u20d0-\\u20ff", Gs$1 = Rs$1 + Fs$1 + Ls$1, ks$1 = "\\ufe0e\\ufe0f", Bs$1 = "\\u200d", zs$1 = RegExp("[" + Bs$1 + Ps$1 + Gs$1 + ks$1 + "]");
1045
+ var Ks$1 = jt$1(Object.getPrototypeOf, Object), Ps$1 = "\\ud800-\\udfff", Rs$1 = "\\u0300-\\u036f", Fs$1 = "\\ufe20-\\ufe2f", Ls$1 = "\\u20d0-\\u20ff", ks$1 = Rs$1 + Fs$1 + Ls$1, Gs$1 = "\\ufe0e\\ufe0f", Bs$1 = "\\u200d", zs$1 = RegExp("[" + Bs$1 + Ps$1 + ks$1 + Gs$1 + "]");
1046
1046
  function Us$1(r) {
1047
1047
  return zs$1.test(r);
1048
1048
  }
@@ -1193,17 +1193,17 @@
1193
1193
  function Li(r) {
1194
1194
  return typeof r.constructor == "function" && !Dt$1(r) ? Hr$1(Ks$1(r)) : {};
1195
1195
  }
1196
- var Gi = "[object Map]";
1197
- function ki(r) {
1198
- return T$2(r) && w(r) == Gi;
1196
+ var ki = "[object Map]";
1197
+ function Gi(r) {
1198
+ return T$2(r) && w(r) == ki;
1199
1199
  }
1200
- var dt$1 = R$2 && R$2.isMap, Bi = dt$1 ? X$2(dt$1) : ki, zi = "[object Set]";
1200
+ var dt$1 = R$2 && R$2.isMap, Bi = dt$1 ? X$2(dt$1) : Gi, zi = "[object Set]";
1201
1201
  function Ui(r) {
1202
1202
  return T$2(r) && w(r) == zi;
1203
1203
  }
1204
- var ht = R$2 && R$2.isSet, Hi = ht ? X$2(ht) : Ui, Wi = 1, Lt$1 = "[object Arguments]", Zi = "[object Array]", Ji = "[object Boolean]", Xi = "[object Date]", Vi = "[object Error]", Gt$1 = "[object Function]", Yi = "[object GeneratorFunction]", eo$1 = "[object Map]", to$1 = "[object Number]", kt$1 = "[object Object]", ro$1 = "[object RegExp]", no$1 = "[object Set]", so$1 = "[object String]", io$1 = "[object Symbol]", oo$1 = "[object WeakMap]", ao$1 = "[object ArrayBuffer]", uo$1 = "[object DataView]", co$1 = "[object Float32Array]", fo$1 = "[object Float64Array]", lo$1 = "[object Int8Array]", ho$1 = "[object Int16Array]", po$1 = "[object Int32Array]", go$1 = "[object Uint8Array]", yo$1 = "[object Uint8ClampedArray]", mo$1 = "[object Uint16Array]", bo$1 = "[object Uint32Array]", g = {};
1205
- g[Lt$1] = g[Zi] = g[ao$1] = g[uo$1] = g[Ji] = g[Xi] = g[co$1] = g[fo$1] = g[lo$1] = g[ho$1] = g[po$1] = g[eo$1] = g[to$1] = g[kt$1] = g[ro$1] = g[no$1] = g[so$1] = g[io$1] = g[go$1] = g[yo$1] = g[mo$1] = g[bo$1] = true;
1206
- g[Vi] = g[Gt$1] = g[oo$1] = false;
1204
+ var ht = R$2 && R$2.isSet, Hi = ht ? X$2(ht) : Ui, Wi = 1, Lt$1 = "[object Arguments]", Zi = "[object Array]", Ji = "[object Boolean]", Xi = "[object Date]", Vi = "[object Error]", kt$1 = "[object Function]", Yi = "[object GeneratorFunction]", eo$1 = "[object Map]", to$1 = "[object Number]", Gt$1 = "[object Object]", ro$1 = "[object RegExp]", no$1 = "[object Set]", so$1 = "[object String]", io$1 = "[object Symbol]", oo$1 = "[object WeakMap]", ao$1 = "[object ArrayBuffer]", uo$1 = "[object DataView]", co$1 = "[object Float32Array]", fo$1 = "[object Float64Array]", lo$1 = "[object Int8Array]", ho$1 = "[object Int16Array]", po$1 = "[object Int32Array]", go$1 = "[object Uint8Array]", yo$1 = "[object Uint8ClampedArray]", mo$1 = "[object Uint16Array]", bo$1 = "[object Uint32Array]", g = {};
1205
+ g[Lt$1] = g[Zi] = g[ao$1] = g[uo$1] = g[Ji] = g[Xi] = g[co$1] = g[fo$1] = g[lo$1] = g[ho$1] = g[po$1] = g[eo$1] = g[to$1] = g[Gt$1] = g[ro$1] = g[no$1] = g[so$1] = g[io$1] = g[go$1] = g[yo$1] = g[mo$1] = g[bo$1] = true;
1206
+ g[Vi] = g[kt$1] = g[oo$1] = false;
1207
1207
  function ie(r, e, t, n, s, i) {
1208
1208
  var o, a = e & Wi;
1209
1209
  if (o !== void 0)
@@ -1214,10 +1214,10 @@
1214
1214
  if (u)
1215
1215
  o = gi(r);
1216
1216
  else {
1217
- var c = w(r), f = c == Gt$1 || c == Yi;
1217
+ var c = w(r), f = c == kt$1 || c == Yi;
1218
1218
  if (ae$1(r))
1219
1219
  return ei(r, a);
1220
- if (c == kt$1 || c == Lt$1 || f && !s)
1220
+ if (c == Gt$1 || c == Lt$1 || f && !s)
1221
1221
  o = f ? {} : Li(r);
1222
1222
  else {
1223
1223
  if (!g[c])
@@ -1313,7 +1313,7 @@
1313
1313
  }), t;
1314
1314
  }
1315
1315
  var Mo = 1, Do = 2, Io$1 = "[object Boolean]", Eo$1 = "[object Date]", Qo = "[object Error]", No = "[object Map]", jo$1 = "[object Number]", qo = "[object RegExp]", Ko = "[object Set]", Po$1 = "[object String]", Ro = "[object Symbol]", Fo$1 = "[object ArrayBuffer]", Lo = "[object DataView]", pt$1 = A$1 ? A$1.prototype : void 0, me$1 = pt$1 ? pt$1.valueOf : void 0;
1316
- function Go(r, e, t, n, s, i, o) {
1316
+ function ko$1(r, e, t, n, s, i, o) {
1317
1317
  switch (t) {
1318
1318
  case Lo:
1319
1319
  if (r.byteLength != e.byteLength || r.byteOffset != e.byteOffset)
@@ -1348,9 +1348,9 @@
1348
1348
  }
1349
1349
  return false;
1350
1350
  }
1351
- var ko$1 = 1, Bo = Object.prototype, zo = Bo.hasOwnProperty;
1351
+ var Go = 1, Bo = Object.prototype, zo = Bo.hasOwnProperty;
1352
1352
  function Uo$1(r, e, t, n, s, i) {
1353
- var o = t & ko$1, a = Ae$2(r), u = a.length, c = Ae$2(e), f = c.length;
1353
+ var o = t & Go, a = Ae$2(r), u = a.length, c = Ae$2(e), f = c.length;
1354
1354
  if (u != f && !o)
1355
1355
  return false;
1356
1356
  for (var l = u; l--; ) {
@@ -1391,7 +1391,7 @@
1391
1391
  o = true, f = false;
1392
1392
  }
1393
1393
  if (d && !f)
1394
- return i || (i = new S$2()), o || Nt$1(r) ? zt$1(r, e, t, n, s, i) : Go(r, e, u, t, n, s, i);
1394
+ return i || (i = new S$2()), o || Nt$1(r) ? zt$1(r, e, t, n, s, i) : ko$1(r, e, u, t, n, s, i);
1395
1395
  if (!(t & Ho)) {
1396
1396
  var h2 = f && mt.call(r, "__wrapped__"), p2 = l && mt.call(e, "__wrapped__");
1397
1397
  if (h2 || p2) {
@@ -1667,14 +1667,14 @@
1667
1667
  function La(r) {
1668
1668
  return Us$1(r) ? Fa(r) : Ca(r);
1669
1669
  }
1670
- var Ga = "[object Map]", ka = "[object Set]";
1670
+ var ka = "[object Map]", Ga = "[object Set]";
1671
1671
  function Ba(r) {
1672
1672
  if (r == null)
1673
1673
  return 0;
1674
1674
  if (F$1(r))
1675
1675
  return xa(r) ? La(r) : r.length;
1676
1676
  var e = w(r);
1677
- return e == Ga || e == ka ? r.size : qt$1(r).length;
1677
+ return e == ka || e == Ga ? r.size : qt$1(r).length;
1678
1678
  }
1679
1679
  function za(r, e, t) {
1680
1680
  return r = qe$3(r), t = t == null ? 0 : Rt$1(De$2(t), 0, r.length), e = ce$1(e), r.slice(t, t + e.length) == e;
@@ -3242,7 +3242,7 @@
3242
3242
  }
3243
3243
  return n;
3244
3244
  };
3245
- let k$3 = class k extends Error {
3245
+ let G$3 = class G extends Error {
3246
3246
  query;
3247
3247
  constructor(e, t) {
3248
3248
  const n = `Query Error: ${e} in ${JSON.stringify(t, null, 2)}`;
@@ -3426,12 +3426,12 @@
3426
3426
  validateQuery(e) {
3427
3427
  const t = [];
3428
3428
  if (this.isQuery(e))
3429
- return e.attribute || t.push(new k$3("Missing attribute", e)), e.operator || t.push(new k$3("Missing operator", e)), typeof e.value > "u" && t.push(new k$3("Missing value", e)), e.operator === "find" && Array.isArray(e.value) && t.push(new k$3("find operator cannot have array value", e)), t.length > 0 ? { valid: false, errors: t } : { valid: true };
3429
+ return e.attribute || t.push(new G$3("Missing attribute", e)), e.operator || t.push(new G$3("Missing operator", e)), typeof e.value > "u" && t.push(new G$3("Missing value", e)), e.operator === "find" && Array.isArray(e.value) && t.push(new G$3("find operator cannot have array value", e)), t.length > 0 ? { valid: false, errors: t } : { valid: true };
3430
3430
  if (this.isQueryGroup(e)) {
3431
3431
  const n = e.queries.map((s) => this.validateQuery(s)).filter((s) => !s.valid).map((s) => s.errors).flat();
3432
3432
  return n.length > 0 ? { valid: false, errors: n } : { valid: true };
3433
3433
  }
3434
- return t.push(new k$3("Invalid query definition", e)), { valid: false, errors: t };
3434
+ return t.push(new G$3("Invalid query definition", e)), { valid: false, errors: t };
3435
3435
  }
3436
3436
  /**
3437
3437
  * Get all attribute names used in the query.
@@ -4022,6 +4022,15 @@
4022
4022
  reset(e) {
4023
4023
  e ? (this.indexMap.delete(e), this.dataMap.delete(e), this.indexMetadata.delete(e)) : (this.indexMap.clear(), this.dataMap.clear(), this.indexMetadata.clear());
4024
4024
  }
4025
+ /**
4026
+ * Removes every index the predicate selects. Used to drop indices that
4027
+ * were built from now-stale data; the next read lazily rebuilds them via
4028
+ * {@link getOrCreateIndex}.
4029
+ */
4030
+ resetIndicesWhere(e) {
4031
+ for (const t of Array.from(this.indexMap.keys()))
4032
+ e(t) && this.reset(t);
4033
+ }
4025
4034
  fillDataMap(e, t) {
4026
4035
  let n = this.dataMap.get(e);
4027
4036
  n || (n = /* @__PURE__ */ new Map(), this.dataMap.set(e, n));
@@ -4617,8 +4626,10 @@
4617
4626
  return o;
4618
4627
  }
4619
4628
  queryData(e, t, n, s) {
4629
+ if (t.queries.length === 0)
4630
+ return e;
4620
4631
  const i = new Map(e);
4621
- return t.queries.length === 0 ? e : (t.groupKey || (t.groupKey = "root"), t.groupType || (t.groupType = "and"), t.queries || (t.queries = []), this.validateQuery(t), this.evaluateQueryGroup(t, t, i, n, s));
4632
+ return t.groupKey || (t.groupKey = "root"), t.groupType || (t.groupType = "and"), t.queries || (t.queries = []), this.validateQuery(t), this.evaluateQueryGroup(t, t, i, n, s);
4622
4633
  }
4623
4634
  // public getRelevantQueryData(data: any, options: DcuplGlobalQueryOptions<any>, model: DcuplModel<ListItem>) {
4624
4635
  // // detect if any of the query attributes are a deep query.
@@ -4714,8 +4725,17 @@
4714
4725
  indicesController;
4715
4726
  queryManager;
4716
4727
  initialData;
4717
- filteredData;
4728
+ _filteredData;
4729
+ /** Set when caches were dropped without an eager recompute — the next
4730
+ * filteredData read recomputes from initialData (#245). */
4731
+ filteredDataStale = false;
4718
4732
  model;
4733
+ get filteredData() {
4734
+ return this.filteredDataStale && (this.filteredDataStale = false, this._filteredData = this.getFilteredData(this.initialData, false)), this._filteredData;
4735
+ }
4736
+ set filteredData(e) {
4737
+ this._filteredData = e, this.filteredDataStale = false;
4738
+ }
4719
4739
  filterItems = /* @__PURE__ */ new Map();
4720
4740
  queryBuilder;
4721
4741
  cacheCtrl;
@@ -4793,7 +4813,7 @@
4793
4813
  this.model = e, this.initialData = t, this.indicesController = r, this.invalidateAllCaches(i), this.filteredData = this.getFilteredData(this.initialData, false), this.initFilterItems({ skipProcessing: true });
4794
4814
  }
4795
4815
  resetCache() {
4796
- this.invalidateAllCaches();
4816
+ this.invalidateAllCaches(), this.filteredDataStale = true;
4797
4817
  }
4798
4818
  /**
4799
4819
  * Extract all deep query attributes from the query
@@ -5363,7 +5383,7 @@
5363
5383
  (s = A2[n]) && (i = s(e, t, i) || i);
5364
5384
  return i && U$1(e, t, i), i;
5365
5385
  };
5366
- let p$2 = class p {
5386
+ let p$3 = class p {
5367
5387
  constructor(e, t, r) {
5368
5388
  this.dcuplApi = e, this.cdRef = t, this.indicesController = r, this.itemService = new K$2(
5369
5389
  this.dcuplApi.modelParser,
@@ -5904,7 +5924,7 @@
5904
5924
  connectMessage: true,
5905
5925
  connectMessageResult: true
5906
5926
  })
5907
- ], p$2.prototype, "_getMetadata");
5927
+ ], p$3.prototype, "_getMetadata");
5908
5928
  C$2([
5909
5929
  Eu({
5910
5930
  scope: "list",
@@ -5913,7 +5933,7 @@
5913
5933
  connectMessage: true,
5914
5934
  connectMessageResult: true
5915
5935
  })
5916
- ], p$2.prototype, "_getFilters");
5936
+ ], p$3.prototype, "_getFilters");
5917
5937
  C$2([
5918
5938
  Eu({
5919
5939
  scope: "list",
@@ -5922,20 +5942,20 @@
5922
5942
  connectMessage: true,
5923
5943
  connectMessageResult: true
5924
5944
  })
5925
- ], p$2.prototype, "_getFilter");
5945
+ ], p$3.prototype, "_getFilter");
5926
5946
  C$2([
5927
5947
  Eu({
5928
5948
  scope: "list",
5929
5949
  type: "query_get",
5930
5950
  cloneResult: true
5931
5951
  })
5932
- ], p$2.prototype, "getQuery");
5952
+ ], p$3.prototype, "getQuery");
5933
5953
  C$2([
5934
5954
  Eu({
5935
5955
  scope: "list",
5936
5956
  type: "query_has"
5937
5957
  })
5938
- ], p$2.prototype, "hasGroupOrQueryKey");
5958
+ ], p$3.prototype, "hasGroupOrQueryKey");
5939
5959
  C$2([
5940
5960
  Eu({
5941
5961
  scope: "list",
@@ -5944,7 +5964,7 @@
5944
5964
  connectMessage: true,
5945
5965
  connectMessageResult: true
5946
5966
  })
5947
- ], p$2.prototype, "applyQuery");
5967
+ ], p$3.prototype, "applyQuery");
5948
5968
  C$2([
5949
5969
  Eu({
5950
5970
  scope: "list",
@@ -5953,7 +5973,7 @@
5953
5973
  connectMessage: true,
5954
5974
  connectMessageResult: true
5955
5975
  })
5956
- ], p$2.prototype, "applyOptions");
5976
+ ], p$3.prototype, "applyOptions");
5957
5977
  C$2([
5958
5978
  Eu({
5959
5979
  scope: "list",
@@ -5962,7 +5982,7 @@
5962
5982
  connectMessage: true,
5963
5983
  connectMessageResult: true
5964
5984
  })
5965
- ], p$2.prototype, "removeQuery");
5985
+ ], p$3.prototype, "removeQuery");
5966
5986
  C$2([
5967
5987
  Eu({
5968
5988
  scope: "list",
@@ -5971,7 +5991,7 @@
5971
5991
  connectMessage: true,
5972
5992
  connectMessageResult: true
5973
5993
  })
5974
- ], p$2.prototype, "resetQuery");
5994
+ ], p$3.prototype, "resetQuery");
5975
5995
  C$2([
5976
5996
  Eu({
5977
5997
  scope: "list",
@@ -5980,7 +6000,7 @@
5980
6000
  connectMessage: true,
5981
6001
  connectMessageResult: true
5982
6002
  })
5983
- ], p$2.prototype, "executeQuery");
6003
+ ], p$3.prototype, "executeQuery");
5984
6004
  C$2([
5985
6005
  Eu({
5986
6006
  scope: "list",
@@ -5989,7 +6009,7 @@
5989
6009
  connectMessage: true,
5990
6010
  connectMessageResult: true
5991
6011
  })
5992
- ], p$2.prototype, "_getSections");
6012
+ ], p$3.prototype, "_getSections");
5993
6013
  C$2([
5994
6014
  Eu({
5995
6015
  scope: "list",
@@ -5998,7 +6018,7 @@
5998
6018
  connectMessage: true,
5999
6019
  connectMessageResult: true
6000
6020
  })
6001
- ], p$2.prototype, "_getItem");
6021
+ ], p$3.prototype, "_getItem");
6002
6022
  C$2([
6003
6023
  Eu({
6004
6024
  scope: "list",
@@ -6007,7 +6027,7 @@
6007
6027
  connectMessage: true,
6008
6028
  connectMessageResult: true
6009
6029
  })
6010
- ], p$2.prototype, "_getManyItems");
6030
+ ], p$3.prototype, "_getManyItems");
6011
6031
  C$2([
6012
6032
  Eu({
6013
6033
  scope: "list",
@@ -6016,7 +6036,7 @@
6016
6036
  connectMessage: true,
6017
6037
  connectMessageResult: true
6018
6038
  })
6019
- ], p$2.prototype, "_getSuggestions");
6039
+ ], p$3.prototype, "_getSuggestions");
6020
6040
  C$2([
6021
6041
  Eu({
6022
6042
  scope: "list",
@@ -6025,7 +6045,7 @@
6025
6045
  connectMessage: true,
6026
6046
  connectMessageResult: true
6027
6047
  })
6028
- ], p$2.prototype, "_getFacets");
6048
+ ], p$3.prototype, "_getFacets");
6029
6049
  C$2([
6030
6050
  Eu({
6031
6051
  scope: "list",
@@ -6034,7 +6054,7 @@
6034
6054
  connectMessage: true,
6035
6055
  connectMessageResult: true
6036
6056
  })
6037
- ], p$2.prototype, "getAggregate");
6057
+ ], p$3.prototype, "getAggregate");
6038
6058
  C$2([
6039
6059
  Eu({
6040
6060
  scope: "list",
@@ -6043,8 +6063,8 @@
6043
6063
  connectMessage: true,
6044
6064
  connectMessageResult: true
6045
6065
  })
6046
- ], p$2.prototype, "_getPivot");
6047
- let G$2 = class G extends p$2 {
6066
+ ], p$3.prototype, "_getPivot");
6067
+ let G$2 = class G extends p$3 {
6048
6068
  constructor(e, t, r) {
6049
6069
  super(e, t, r), this.dcuplApi = e, this.cdRef = t, this.indicesController = r;
6050
6070
  }
@@ -6155,8 +6175,8 @@
6155
6175
  }
6156
6176
  var c = i ? i(n, a, t + "", d, e, o) : void 0, f = c === void 0;
6157
6177
  if (f) {
6158
- var u = v$1(a), y2 = !u && ae$1(a), p2 = !u && !y2 && Nt$1(a);
6159
- c = a, u || y2 || p2 ? v$1(n) ? c = n : be$1(n) ? c = Pe$1(n) : y2 ? (f = false, c = ei(a, true)) : p2 ? (f = false, c = wi(a, true)) : c = [] : we$1(a) || Qe$2(a) ? (c = n, Qe$2(n) ? c = Oe$2(n) : (!E$3(n) || _t$1(n)) && (c = Li(a))) : f = false;
6178
+ var u = v$1(a), y2 = !u && ae$1(a), h2 = !u && !y2 && Nt$1(a);
6179
+ c = a, u || y2 || h2 ? v$1(n) ? c = n : be$1(n) ? c = Pe$1(n) : y2 ? (f = false, c = ei(a, true)) : h2 ? (f = false, c = wi(a, true)) : c = [] : we$1(a) || Qe$2(a) ? (c = n, Qe$2(n) ? c = Oe$2(n) : (!E$3(n) || _t$1(n)) && (c = Li(a))) : f = false;
6160
6180
  }
6161
6181
  f && (o.set(a, c), r(c, a, s, i, o), o.delete(a)), x$1(d, t, c);
6162
6182
  }
@@ -6179,7 +6199,7 @@
6179
6199
  var P = Ce$1(function(d, e, t) {
6180
6200
  z(d, e, t);
6181
6201
  });
6182
- const h$1 = (d, e, t) => ({
6202
+ const p$2 = (d, e, t) => ({
6183
6203
  title: d,
6184
6204
  type: "model",
6185
6205
  errorGroup: "ModelDefinitionError",
@@ -6201,39 +6221,39 @@
6201
6221
  "string"
6202
6222
  ];
6203
6223
  if (!d.key)
6204
- return h$1("Invalid Property", d.key, "Property key is missing");
6224
+ return p$2("Invalid Property", d.key, "Property key is missing");
6205
6225
  if (!d.type || e.indexOf(d.type) === -1)
6206
- return h$1("Invalid Property", d.key, "Property type is invalid");
6226
+ return p$2("Invalid Property", d.key, "Property type is invalid");
6207
6227
  if ("derive" in d) {
6208
6228
  if (!d.derive?.localReference)
6209
- return h$1("Invalid Property", d.key, "Derived Property localReference is missing");
6229
+ return p$2("Invalid Property", d.key, "Derived Property localReference is missing");
6210
6230
  if (!d.derive.remoteProperty)
6211
- return h$1("Invalid Property", d.key, "Derived Property remoteProperty is missing");
6231
+ return p$2("Invalid Property", d.key, "Derived Property remoteProperty is missing");
6212
6232
  }
6213
6233
  if ("expression" in d && typeof d.expression != "string")
6214
- return h$1("Invalid Property", d.key, "Expression is invalid");
6234
+ return p$2("Invalid Property", d.key, "Expression is invalid");
6215
6235
  }, Le$1 = (d) => {
6216
6236
  const e = ["multiValued", "singleValued"];
6217
6237
  if (!d.key)
6218
- return h$1("Invalid Reference", d.key, "Reference key is missing");
6238
+ return p$2("Invalid Reference", d.key, "Reference key is missing");
6219
6239
  if (!d.type || e.indexOf(d.type) === -1)
6220
- return h$1("Invalid Reference", d.key, "Reference type is invalid");
6240
+ return p$2("Invalid Reference", d.key, "Reference type is invalid");
6221
6241
  if (!d.model)
6222
- return h$1("Invalid Reference", d.key, "Reference model is missing");
6242
+ return p$2("Invalid Reference", d.key, "Reference model is missing");
6223
6243
  if ("derive" in d) {
6224
6244
  if (!d.derive.localReference)
6225
- return h$1("Invalid Reference", d.key, "Derived Reference localReference is missing");
6245
+ return p$2("Invalid Reference", d.key, "Derived Reference localReference is missing");
6226
6246
  if (!d.derive.remoteReference)
6227
- return h$1("Invalid Reference", d.key, "Derived Reference remoteReference is missing");
6247
+ return p$2("Invalid Reference", d.key, "Derived Reference remoteReference is missing");
6228
6248
  }
6229
6249
  if ("resolve" in d) {
6230
6250
  if (!d.resolve.reference)
6231
- return h$1("Invalid Reference", d.key, "Resolved Reference reference is missing");
6251
+ return p$2("Invalid Reference", d.key, "Resolved Reference reference is missing");
6232
6252
  if (!d.resolve.model)
6233
- return h$1("Invalid Reference", d.key, "Resolved Reference model is missing");
6253
+ return p$2("Invalid Reference", d.key, "Resolved Reference model is missing");
6234
6254
  }
6235
6255
  if ("groupBy" in d && !d.groupBy.reference)
6236
- return h$1("Invalid Reference", d.key, "Grouped Reference reference is missing");
6256
+ return p$2("Invalid Reference", d.key, "Grouped Reference reference is missing");
6237
6257
  }, je$1 = (d) => {
6238
6258
  if (typeof d.key != "string" || d.key.length === 0)
6239
6259
  throw new Error("Invalid Model: key must be a non-empty string");
@@ -7227,7 +7247,7 @@
7227
7247
  }
7228
7248
  }
7229
7249
  let n;
7230
- e.type === "singleValued" ? n = { key: o[0] } : n = o.map((a) => ({ key: a })), this.indicesController.fillInverseIndex(e.key, t.key, o), t[e.key] = n;
7250
+ e.type === "singleValued" ? n = { key: o[0] } : n = o.map((a) => ({ key: a })), this.indicesController.fillInverseIndex(e.key, t.key, o), this.groupedRefReverseIndex.delete(e.key), t[e.key] = n;
7231
7251
  }
7232
7252
  asStringArray(e) {
7233
7253
  return e ? Array.isArray(e) ? e.map((t) => t.key) : [e.key] : [];
@@ -7267,6 +7287,25 @@
7267
7287
  resetIndexMap() {
7268
7288
  this.indicesController.reset();
7269
7289
  }
7290
+ /**
7291
+ * Drops model-level indices derived from the given attributes after a
7292
+ * partial update (#243): lazily built plain indices (facets/pivot
7293
+ * fallback), context-hashed indices (aggregate/sections/suggest) and
7294
+ * deep-query indices are built from data a partial update silently
7295
+ * invalidates — the next read rebuilds them from current data. A
7296
+ * reference's plain index stays: it is maintained eagerly during
7297
+ * processing, and the generic lazy rebuild cannot reproduce its shape.
7298
+ */
7299
+ resetIndicesForChangedAttributes(e) {
7300
+ this.indicesController.resetIndicesWhere((t) => {
7301
+ if (this.references.has(t))
7302
+ return false;
7303
+ for (const s of e)
7304
+ if (t === s || t.startsWith(`${s}_`) || t.startsWith(`${s}.`))
7305
+ return true;
7306
+ return false;
7307
+ });
7308
+ }
7270
7309
  deleteDataEntries(e) {
7271
7310
  for (const t of e.data) {
7272
7311
  const s = String(t.key);
@@ -7443,12 +7482,12 @@
7443
7482
  for (const l of r) {
7444
7483
  const c = this.attributeQualityConfigs.get(l.key);
7445
7484
  l.origin && (o[l.key] = o[l.origin]);
7446
- const f = this.valueMappings.find((p2) => p2.attributes.includes(l.key));
7485
+ const f = this.valueMappings.find((h2) => h2.attributes.includes(l.key));
7447
7486
  this.isValidValueMapping(f) && (o = this.mapRawValueUsingValueMapping(o, l.key, f));
7448
7487
  let u = o[l.key];
7449
7488
  typeof u == "number" && (u = String(u));
7450
7489
  const y2 = n[l.key];
7451
- if (!u) {
7490
+ if (this.groupedRefReverseIndex.delete(l.key), !u) {
7452
7491
  y2 && this.indicesController.removeFromInverseIndex(l.key, n.key, [y2]), this.indicesController.fillInverseIndex(l.key, n.key, [void 0]), delete n[l.key], c?.required && this.setError({
7453
7492
  title: "Undefined Value",
7454
7493
  type: "model",
@@ -7480,8 +7519,8 @@
7480
7519
  }
7481
7520
  });
7482
7521
  else if (l.type === "multiValued") {
7483
- const p2 = this.getValueAsArray(u, l?.separator);
7484
- Array.isArray(p2) ? (y2 && Array.isArray(y2) && this.indicesController.removeFromInverseIndex(l.key, n.key, y2), this.processMultiValuedReference(l, p2, n)) : this.setError({
7522
+ const h2 = this.getValueAsArray(u, l?.separator);
7523
+ Array.isArray(h2) ? (y2 && Array.isArray(y2) && this.indicesController.removeFromInverseIndex(l.key, n.key, y2), this.processMultiValuedReference(l, h2, n)) : this.setError({
7485
7524
  title: "Wrong Data Type",
7486
7525
  type: "model",
7487
7526
  errorGroup: "ReferenceDataError",
@@ -7517,8 +7556,8 @@
7517
7556
  const f = c.getQuery();
7518
7557
  if (f.queries.length > 0) {
7519
7558
  const y2 = this.modelParser.dcuplInstance.query.execute(f);
7520
- r.type === "singleValued" ? y2[0] && (n[r.key] = { key: y2[0].key, _dcupl_ref_: "hit" }) : r.type === "multiValued" && (y2.forEach((p2) => {
7521
- p2._dcupl_ref_ = "hit";
7559
+ r.type === "singleValued" ? y2[0] && (n[r.key] = { key: y2[0].key, _dcupl_ref_: "hit" }) : r.type === "multiValued" && (y2.forEach((h2) => {
7560
+ h2._dcupl_ref_ = "hit";
7522
7561
  }), n[r.key] = y2);
7523
7562
  } else
7524
7563
  r.type === "singleValued" ? n[r.key] = null : r.type === "multiValued" && (n[r.key] = []);
@@ -7746,6 +7785,8 @@
7746
7785
  let e = 0;
7747
7786
  for (const t of this.changedItems.values())
7748
7787
  e += t.size;
7788
+ for (const t of this.deletedItems.values())
7789
+ e += t.size;
7749
7790
  return e;
7750
7791
  }
7751
7792
  /**
@@ -8069,11 +8110,11 @@ These attributes will default to Step 1 processing which may be incorrect. This
8069
8110
  };
8070
8111
  if (this.attributeDependencyGraph.addAttributeDependency(r, f), a.length > 1) {
8071
8112
  let u = l, y2 = e;
8072
- for (let p2 = 0; p2 < a.length - 1; p2++) {
8073
- const R2 = a[p2], v2 = u.references.get(R2);
8113
+ for (let h2 = 0; h2 < a.length - 1; h2++) {
8114
+ const R2 = a[h2], v2 = u.references.get(R2);
8074
8115
  if (v2) {
8075
8116
  const _2 = this.models.get(v2.model);
8076
- if (_2 && (u = _2, y2 = v2.model, p2 === a.length - 2)) {
8117
+ if (_2 && (u = _2, y2 = v2.model, h2 === a.length - 2)) {
8077
8118
  const H2 = a[a.length - 1], J2 = {
8078
8119
  modelKey: y2,
8079
8120
  attributeKey: H2,
@@ -8555,6 +8596,15 @@ These attributes will default to Step 1 processing which may be incorrect. This
8555
8596
  }
8556
8597
  for (const o of [1, 2, 3, 4])
8557
8598
  await this.processAttributesForStep(o, i, e);
8599
+ for (const [o, n] of i.entries()) {
8600
+ const a = this.models.get(o);
8601
+ if (!a) continue;
8602
+ const l = /* @__PURE__ */ new Set();
8603
+ for (const c of n.values())
8604
+ for (const f of c)
8605
+ l.add(f);
8606
+ a.resetIndicesForChangedAttributes(l);
8607
+ }
8558
8608
  for (const o of e) {
8559
8609
  const n = this.models.get(o.model);
8560
8610
  if (n && this.qualityController.enabled) {
@@ -8589,9 +8639,9 @@ These attributes will default to Step 1 processing which may be incorrect. This
8589
8639
  for (const f of c) {
8590
8640
  const u = l.references.get(f);
8591
8641
  if (u && S$1(u)) {
8592
- const y2 = u.resolve.model, p2 = u.resolve.reference, R2 = this.models.get(y2);
8642
+ const y2 = u.resolve.model, h2 = u.resolve.reference, R2 = this.models.get(y2);
8593
8643
  if (R2) {
8594
- const v2 = R2.references.get(p2);
8644
+ const v2 = R2.references.get(h2);
8595
8645
  v2 && S$1(v2) && t.get(a).add(y2);
8596
8646
  }
8597
8647
  }
@@ -8806,23 +8856,23 @@ These attributes will default to Step 1 processing which may be incorrect. This
8806
8856
  type: "dcupl_handle_datacontainer"
8807
8857
  })
8808
8858
  ], E$2.prototype, "handleDataContainer");
8809
- function q$1(d, e) {
8859
+ function q$1(u, e) {
8810
8860
  return B$3(e, function(t) {
8811
- return d[t];
8861
+ return u[t];
8812
8862
  });
8813
8863
  }
8814
- function B$2(d) {
8815
- return d == null ? [] : q$1(d, le$1(d));
8864
+ function B$2(u) {
8865
+ return u == null ? [] : q$1(u, le$1(u));
8816
8866
  }
8817
8867
  var W$1 = Math.max;
8818
- function Q$1(d, e, t, r) {
8819
- d = F$1(d) ? d : B$2(d), t = t ? De$2(t) : 0;
8820
- var s = d.length;
8821
- return t < 0 && (t = W$1(s + t, 0)), xa(d) ? t <= s && d.indexOf(e, t) > -1 : !!s && on$1(d, e, t) > -1;
8822
- }
8823
- var j = Object.defineProperty, N$1 = Object.getOwnPropertyDescriptor, k$2 = (d, e, t, r) => {
8824
- for (var s = N$1(e, t), o = d.length - 1, a; o >= 0; o--)
8825
- (a = d[o]) && (s = a(e, t, s) || s);
8868
+ function Q$1(u, e, t, r) {
8869
+ u = F$1(u) ? u : B$2(u), t = t ? De$2(t) : 0;
8870
+ var s = u.length;
8871
+ return t < 0 && (t = W$1(s + t, 0)), xa(u) ? t <= s && u.indexOf(e, t) > -1 : !!s && on$1(u, e, t) > -1;
8872
+ }
8873
+ var j = Object.defineProperty, N$1 = Object.getOwnPropertyDescriptor, k$2 = (u, e, t, r) => {
8874
+ for (var s = N$1(e, t), o = u.length - 1, i; o >= 0; o--)
8875
+ (i = u[o]) && (s = i(e, t, s) || s);
8826
8876
  return s && j(e, t, s), s;
8827
8877
  };
8828
8878
  let E$1 = class E {
@@ -8895,6 +8945,17 @@ These attributes will default to Step 1 processing which may be incorrect. This
8895
8945
  update(e) {
8896
8946
  (e && e.reprocessData || !e) && this.setup(this.options);
8897
8947
  }
8948
+ /**
8949
+ * Drops the list's query/result caches; the filtered data is recomputed
8950
+ * lazily on the next read from the list's current data, without
8951
+ * re-deriving a scoped list's item set (that is what {@link update} does).
8952
+ * dcupl.update() calls this for affected lists that do not auto-update, so
8953
+ * a query executed before the update can never keep serving its pre-update
8954
+ * cached result — while lists nobody reads pay no eager recompute.
8955
+ */
8956
+ invalidate() {
8957
+ this.catalog && this.catalog.filter.resetCache();
8958
+ }
8898
8959
  on(e) {
8899
8960
  return this.cdRef.on(e);
8900
8961
  }
@@ -8914,9 +8975,9 @@ These attributes will default to Step 1 processing which may be incorrect. This
8914
8975
  connectMessage: true
8915
8976
  })
8916
8977
  ], E$1.prototype, "update");
8917
- var Z$2 = Object.defineProperty, H = Object.getOwnPropertyDescriptor, J$1 = (d, e, t, r) => {
8918
- for (var s = H(e, t), o = d.length - 1, a; o >= 0; o--)
8919
- (a = d[o]) && (s = a(e, t, s) || s);
8978
+ var Z$2 = Object.defineProperty, H = Object.getOwnPropertyDescriptor, J$1 = (u, e, t, r) => {
8979
+ for (var s = H(e, t), o = u.length - 1, i; o >= 0; o--)
8980
+ (i = u[o]) && (s = i(e, t, s) || s);
8920
8981
  return s && Z$2(e, t, s), s;
8921
8982
  };
8922
8983
  class C {
@@ -9095,49 +9156,49 @@ These attributes will default to Step 1 processing which may be incorrect. This
9095
9156
  const r = this.dcupl?.getContainerSourceMetadata(t), s = t.model;
9096
9157
  if (r) {
9097
9158
  const o = r.coercionFailureSamples ?? {};
9098
- for (const a of Object.keys(o)) {
9099
- const l = o[a];
9159
+ for (const i of Object.keys(o)) {
9160
+ const l = o[i];
9100
9161
  if (!l || l.count <= 0)
9101
9162
  continue;
9102
- for (const n of this.getModelErrors(s))
9103
- n.attribute === a && n.itemKey != null && (n.errorType === "UndefinedValue" || n.errorType === "WrongDataType") && this.removeError(n.key);
9104
- const i = e.properties.get(a)?.type ?? l.expected;
9105
- this.setError(this.buildColumnCoercionError(s, a, l.rawValue, i, l.count));
9163
+ for (const a of this.getModelErrors(s))
9164
+ a.attribute === i && a.itemKey != null && (a.errorType === "UndefinedValue" || a.errorType === "WrongDataType") && this.removeError(a.key);
9165
+ const n = e.properties.get(i)?.type ?? l.expected;
9166
+ this.setError(this.buildColumnCoercionError(s, i, l.rawValue, n, l.count));
9106
9167
  }
9107
- for (const [a] of e.properties) {
9108
- if (o[a] || r.sourceColumns.includes(a))
9168
+ for (const [i] of e.properties) {
9169
+ if (o[i] || r.sourceColumns.includes(i))
9109
9170
  continue;
9110
- const l = this.getGroupCount(s, a, "UndefinedValue");
9171
+ const l = this.getGroupCount(s, i, "UndefinedValue");
9111
9172
  if (l > 0 && l === t.data.length) {
9112
- for (const i of this.getModelErrors(s))
9113
- i.attribute === a && i.itemKey != null && i.errorType === "UndefinedValue" && this.removeError(i.key);
9114
- this.setError(this.buildAbsentColumnError(s, a));
9173
+ for (const n of this.getModelErrors(s))
9174
+ n.attribute === i && n.itemKey != null && n.errorType === "UndefinedValue" && this.removeError(n.key);
9175
+ this.setError(this.buildAbsentColumnError(s, i));
9115
9176
  }
9116
9177
  }
9117
9178
  } else {
9118
9179
  const o = new Set(
9119
- this.getModelErrors(s).filter((i) => i.errorType === "UndefinedValue" && i.attribute != null).map((i) => i.attribute)
9180
+ this.getModelErrors(s).filter((n) => n.errorType === "UndefinedValue" && n.attribute != null).map((n) => n.attribute)
9120
9181
  );
9121
- for (const i of o) {
9122
- const n = this.getGroupCount(s, i, "UndefinedValue");
9123
- if (n > 0 && n === t.data.length) {
9124
- for (const u of this.getModelErrors(s))
9125
- u.attribute === i && u.itemKey != null && u.errorType === "UndefinedValue" && this.removeError(u.key);
9126
- this.setError(this.buildAbsentColumnError(s, i));
9182
+ for (const n of o) {
9183
+ const a = this.getGroupCount(s, n, "UndefinedValue");
9184
+ if (a > 0 && a === t.data.length) {
9185
+ for (const d of this.getModelErrors(s))
9186
+ d.attribute === n && d.itemKey != null && d.errorType === "UndefinedValue" && this.removeError(d.key);
9187
+ this.setError(this.buildAbsentColumnError(s, n));
9127
9188
  }
9128
9189
  }
9129
- const a = this.getModelErrors(s).filter(
9130
- (i) => i.errorType === "WrongDataType" && i.errorGroup === "PropertyDataError" && i.title === "Wrong Data Type" && i.itemKey != null
9131
- ), l = Ne$1(a, "attribute");
9132
- for (const i in l) {
9133
- const n = l[i];
9134
- if (!n?.length)
9190
+ const i = this.getModelErrors(s).filter(
9191
+ (n) => n.errorType === "WrongDataType" && n.errorGroup === "PropertyDataError" && n.title === "Wrong Data Type" && n.itemKey != null
9192
+ ), l = Ne$1(i, "attribute");
9193
+ for (const n in l) {
9194
+ const a = l[n];
9195
+ if (!a?.length)
9135
9196
  continue;
9136
- const u = n[0].meta, f = e.properties.get(i)?.type ?? u?.expected ?? "unknown";
9137
- for (const y2 of n)
9138
- this.removeError(y2.key);
9197
+ const d = a[0].meta, y2 = e.properties.get(n)?.type ?? d?.expected ?? "unknown";
9198
+ for (const f of a)
9199
+ this.removeError(f.key);
9139
9200
  this.setError(
9140
- this.buildColumnCoercionError(s, i, String(u?.rawValue ?? ""), f, n.length)
9201
+ this.buildColumnCoercionError(s, n, String(d?.rawValue ?? ""), y2, a.length)
9141
9202
  );
9142
9203
  }
9143
9204
  }
@@ -9182,14 +9243,14 @@ These attributes will default to Step 1 processing which may be incorrect. This
9182
9243
  * @param errorType - Optional error type to filter by
9183
9244
  */
9184
9245
  cleanUpErrorsForItems(e, t, r, s) {
9185
- let o, a;
9186
- typeof r == "string" ? a = r : r instanceof Set && (o = r, a = s);
9187
- const l = this.getModelErrors(e.key), i = a ? l.filter((n) => n.errorType === a) : l;
9188
- for (const n of i)
9189
- if (n.itemKey && t.has(n.itemKey)) {
9190
- if (o && n.attribute && !o.has(n.attribute))
9246
+ let o, i;
9247
+ typeof r == "string" ? i = r : r instanceof Set && (o = r, i = s);
9248
+ const l = this.getModelErrors(e.key), n = i ? l.filter((a) => a.errorType === i) : l;
9249
+ for (const a of n)
9250
+ if (a.itemKey && t.has(a.itemKey)) {
9251
+ if (o && a.attribute && !o.has(a.attribute))
9191
9252
  continue;
9192
- this.removeError(n.key);
9253
+ this.removeError(a.key);
9193
9254
  }
9194
9255
  }
9195
9256
  /**
@@ -9211,19 +9272,19 @@ These attributes will default to Step 1 processing which may be incorrect. This
9211
9272
  validateItemsPartial(e, t, r) {
9212
9273
  if (!e)
9213
9274
  return [];
9214
- const s = [], o = e.getData(), a = e.getAttributes();
9215
- for (const l of a) {
9275
+ const s = [], o = e.getData(), i = e.getAttributes();
9276
+ for (const l of i) {
9216
9277
  if (!r.has(l.key))
9217
9278
  continue;
9218
- const i = l.quality?.validators;
9219
- if (i)
9220
- for (const n of t) {
9221
- const u = o.get(n);
9222
- if (!u)
9279
+ const n = l.quality?.validators;
9280
+ if (n)
9281
+ for (const a of t) {
9282
+ const d = o.get(a);
9283
+ if (!d)
9223
9284
  continue;
9224
- const f = u[l.key], y2 = this.validateAttribute(f, i, l.key);
9225
- for (const g2 of y2)
9226
- g2.model = e.key, g2.itemKey = u.key, s.push(g2);
9285
+ const y2 = d[l.key], f = this.validateAttribute(y2, n, l.key);
9286
+ for (const g2 of f)
9287
+ g2.model = e.key, g2.itemKey = d.key, s.push(g2);
9227
9288
  }
9228
9289
  }
9229
9290
  return s;
@@ -9364,10 +9425,10 @@ These attributes will default to Step 1 processing which may be incorrect. This
9364
9425
  const o = this.dcupl.modelParser.models.get(s);
9365
9426
  if (!o)
9366
9427
  return;
9367
- const a = o?.getBasicProperties() || [], l = o?.getBasicReferences() || [], i = a.length + l.length;
9368
- t += i;
9369
- const u = o.data?.size || 0;
9370
- e += u, r += i * u;
9428
+ const i = o?.getBasicProperties() || [], l = o?.getBasicReferences() || [], n = i.length + l.length;
9429
+ t += n;
9430
+ const d = o.data?.size || 0;
9431
+ e += d, r += n * d;
9371
9432
  }), this.values.counts.rows = e, this.values.counts.attributes = t, this.values.counts.dataEntries = r;
9372
9433
  }
9373
9434
  calculateTiming() {
@@ -9403,17 +9464,17 @@ These attributes will default to Step 1 processing which may be incorrect. This
9403
9464
  calculateSizesForModels() {
9404
9465
  const t = this.dcupl.analyticsController.getByType("resource").filter((o) => o.value?.type === "data"), r = Ne$1(t, (o) => o.value?.model);
9405
9466
  return Object.keys(r).map((o) => {
9406
- const a = r[o]?.reduce((i, n) => {
9407
- const u = n.value.encodedBodySize;
9408
- return i + u;
9409
- }, 0), l = r[o]?.reduce((i, n) => {
9410
- const u = n.value.decodedBodySize;
9411
- return i + u;
9467
+ const i = r[o]?.reduce((n, a) => {
9468
+ const d = a.value.encodedBodySize;
9469
+ return n + d;
9470
+ }, 0), l = r[o]?.reduce((n, a) => {
9471
+ const d = a.value.decodedBodySize;
9472
+ return n + d;
9412
9473
  }, 0);
9413
9474
  return {
9414
9475
  model: o,
9415
9476
  decodedBodySize: l,
9416
- encodedBodySize: a
9477
+ encodedBodySize: i
9417
9478
  };
9418
9479
  });
9419
9480
  }
@@ -9424,8 +9485,8 @@ These attributes will default to Step 1 processing which may be incorrect. This
9424
9485
  const s = this.dcupl.modelParser.unprocessedData.find((l) => l.model === r)?.data || [], o = this.getUnusedAttributesFromModel(this.dcupl, r);
9425
9486
  if (!o.length)
9426
9487
  return;
9427
- const a = this.getDataWithAttributes(s, o);
9428
- t += JSON.stringify(a).length;
9488
+ const i = this.getDataWithAttributes(s, o);
9489
+ t += JSON.stringify(i).length;
9429
9490
  }), t;
9430
9491
  }
9431
9492
  getDataWithAttributes(e, t) {
@@ -9437,10 +9498,10 @@ These attributes will default to Step 1 processing which may be incorrect. This
9437
9498
  });
9438
9499
  }
9439
9500
  getUnusedAttributesFromModel(e, t) {
9440
- const r = e.modelParser.models.get(t), s = r?.getBasicProperties() || [], o = r?.getBasicReferences() || [], a = r?.keyProperty, l = [...s, ...o].map((n) => n.key);
9441
- typeof a == "string" ? l.push(a) : Array.isArray(a) ? l.push(...a) : l.push("key"), l.push("key");
9442
- const i = e.modelParser.unprocessedData.find((n) => n.model === t)?.data || [];
9443
- return this.getUnusedAttributes(i, l);
9501
+ const r = e.modelParser.models.get(t), s = r?.getBasicProperties() || [], o = r?.getBasicReferences() || [], i = r?.keyProperty, l = [...s, ...o].map((a) => a.key);
9502
+ typeof i == "string" ? l.push(i) : Array.isArray(i) ? l.push(...i) : l.push("key"), l.push("key");
9503
+ const n = e.modelParser.unprocessedData.find((a) => a.model === t)?.data || [];
9504
+ return this.getUnusedAttributes(n, l);
9444
9505
  }
9445
9506
  getUnusedAttributes(e, t) {
9446
9507
  const r = /* @__PURE__ */ new Set();
@@ -9499,8 +9560,8 @@ These attributes will default to Step 1 processing which may be incorrect. This
9499
9560
  return [];
9500
9561
  const t = e.getAttributes(), r = e.getDataAsArray(), s = [];
9501
9562
  for (const o of t) {
9502
- const a = o.quality?.validators;
9503
- if (a && a.unique) {
9563
+ const i = o.quality?.validators;
9564
+ if (i && i.unique) {
9504
9565
  const l = this.validateUnique(r, o.key, e);
9505
9566
  s.push(...l);
9506
9567
  }
@@ -9509,22 +9570,22 @@ These attributes will default to Step 1 processing which may be incorrect. This
9509
9570
  }
9510
9571
  validateUnique(e, t, r) {
9511
9572
  const s = [], o = /* @__PURE__ */ new Set(), l = r.attributeQualityConfigs?.get(t)?.validatorHandling !== "loose";
9512
- for (const i of e) {
9513
- const n = i[t];
9514
- if (o.has(n)) {
9515
- const u = {
9573
+ for (const n of e) {
9574
+ const a = n[t];
9575
+ if (o.has(a)) {
9576
+ const d = {
9516
9577
  title: "Validator Error - Unique",
9517
9578
  type: "model",
9518
9579
  errorGroup: "PropertyDataError",
9519
9580
  model: r.key,
9520
9581
  errorType: "InvalidValidator",
9521
9582
  attribute: t,
9522
- itemKey: i.key,
9523
- description: `The value "${n}" is not unique`
9583
+ itemKey: n.key,
9584
+ description: `The value "${a}" is not unique`
9524
9585
  };
9525
- s.push(u), l && delete i[t];
9586
+ s.push(d), l && delete n[t];
9526
9587
  } else
9527
- o.add(n);
9588
+ o.add(a);
9528
9589
  }
9529
9590
  return s;
9530
9591
  }
@@ -9669,9 +9730,9 @@ These attributes will default to Step 1 processing which may be incorrect. This
9669
9730
  }
9670
9731
  }
9671
9732
  };
9672
- var X$1 = Object.defineProperty, ee$1 = Object.getOwnPropertyDescriptor, h = (d, e, t, r) => {
9673
- for (var s = ee$1(e, t), o = d.length - 1, a; o >= 0; o--)
9674
- (a = d[o]) && (s = a(e, t, s) || s);
9733
+ var X$1 = Object.defineProperty, ee$1 = Object.getOwnPropertyDescriptor, h = (u, e, t, r) => {
9734
+ for (var s = ee$1(e, t), o = u.length - 1, i; o >= 0; o--)
9735
+ (i = u[o]) && (s = i(e, t, s) || s);
9675
9736
  return s && X$1(e, t, s), s;
9676
9737
  };
9677
9738
  let p$1 = class p {
@@ -9896,32 +9957,31 @@ These attributes will default to Step 1 processing which may be incorrect. This
9896
9957
  })), e.query ? t.catalog.query.apply(e.query, { mode: "set" }) : t.catalog.query.reset(), t;
9897
9958
  }
9898
9959
  /**
9899
- * Gets all models that are affected by changes to the specified models/attributes
9900
- * This includes both the changed models and any downstream dependencies
9960
+ * Gets all models that are affected by changes to the specified models/attributes.
9961
+ * Includes the changed models themselves, models that (transitively) reference
9962
+ * them (their lists can observe the change through deep queries), and models
9963
+ * reached through the attribute-level cascade (resolved/derived attributes
9964
+ * live on models the reference graph does not point at) (#241).
9901
9965
  */
9902
9966
  getAffectedModels(e) {
9903
- const t = /* @__PURE__ */ new Set();
9904
- for (const s of e.keys())
9905
- t.add(s);
9906
- const r = this.modelParser.dependencyGraph;
9967
+ const t = new Set(e.keys()), r = this.modelParser.dependencyGraph;
9907
9968
  if (r)
9908
- for (const s of e.keys())
9909
- this.getDownstreamDependencies(s, r).forEach((a) => t.add(a));
9969
+ for (const o of r.getImpactedNodes(Array.from(e.keys()), "downstream"))
9970
+ t.add(o);
9971
+ const s = this.modelParser.attributeDependencyGraph;
9972
+ if (s) {
9973
+ const o = [];
9974
+ for (const [i, l] of e)
9975
+ if (l.size > 0)
9976
+ for (const n of l)
9977
+ o.push({ modelKey: i, attributeKey: n, type: "property", processingStep: 1 });
9978
+ else
9979
+ o.push(...s.getAttributesForModel(i));
9980
+ for (const i of s.getImpactedAttributes(o))
9981
+ t.add(i.modelKey);
9982
+ }
9910
9983
  return Array.from(t);
9911
9984
  }
9912
- /**
9913
- * Recursively gets all models that depend on the given model
9914
- */
9915
- getDownstreamDependencies(e, t) {
9916
- const r = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), o = (a) => {
9917
- if (!s.has(a)) {
9918
- s.add(a);
9919
- for (const [l, i] of Object.entries(t.dependencies || {}))
9920
- Array.isArray(i) && i.includes(a) && (r.add(l), o(l));
9921
- }
9922
- };
9923
- return o(e), r;
9924
- }
9925
9985
  /**
9926
9986
  * Update lists based on auto-update configuration and affected models.
9927
9987
  *
@@ -9931,24 +9991,25 @@ These attributes will default to Step 1 processing which may be incorrect. This
9931
9991
  updateFnLists(e, t) {
9932
9992
  const r = this.initOptions.performance?.partialUpdates?.enableDetailedLogging ?? false;
9933
9993
  for (const s of this.lists.getAll()) {
9934
- if (!this.shouldAutoUpdateList(s, t)) {
9935
- r && this.log.debug("List skipped (auto-update disabled)", {
9994
+ if (e && !this.isListAffectedByChanges(s, e.affectedModels)) {
9995
+ r && this.log.debug("List skipped (not affected)", {
9936
9996
  listKey: s.key,
9937
9997
  modelKey: s.modelKey
9938
9998
  });
9939
9999
  continue;
9940
10000
  }
9941
- e ? this.isListAffectedByChanges(s, e.affectedModels) ? (r && this.log.debug("List auto-updating (affected by changes)", {
9942
- listKey: s.key,
9943
- modelKey: s.modelKey,
9944
- affectedModels: e.affectedModels
9945
- }), s.update()) : r && this.log.debug("List skipped (not affected)", {
9946
- listKey: s.key,
9947
- modelKey: s.modelKey
9948
- }) : (r && this.log.debug("List auto-updating (full update)", {
9949
- listKey: s.key,
9950
- modelKey: s.modelKey
9951
- }), s.update());
10001
+ try {
10002
+ this.shouldAutoUpdateList(s, t) ? (r && this.log.debug("List auto-updating", {
10003
+ listKey: s.key,
10004
+ modelKey: s.modelKey,
10005
+ affectedModels: e?.affectedModels ?? "all"
10006
+ }), s.update()) : (r && this.log.debug("List caches invalidated (auto-update disabled)", {
10007
+ listKey: s.key,
10008
+ modelKey: s.modelKey
10009
+ }), s.invalidate());
10010
+ } catch (o) {
10011
+ this.log.error(`List refresh failed for '${s.key}'`, o);
10012
+ }
9952
10013
  }
9953
10014
  }
9954
10015
  /**
@@ -9983,51 +10044,55 @@ These attributes will default to Step 1 processing which may be incorrect. This
9983
10044
  }
9984
10045
  async init() {
9985
10046
  try {
9986
- return await this.performUpdate(() => this.modelParser.init()), this.cacheCtrl.clear(), true;
10047
+ return await this.performUpdate(() => this.modelParser.init()), this.cacheCtrl.clear(), this.updateFnLists(null), true;
9987
10048
  } catch (e) {
9988
10049
  return this.log.error("Initialization failed", e), false;
9989
10050
  }
9990
10051
  }
9991
10052
  async update(e) {
9992
10053
  try {
9993
- const t = this.modelParser.changeTracker, r = t.hasChanges(), s = r ? new Map(t.getChangedAttributes()) : null, o = r ? new Set(t.getModelsWithFullReset()) : null, a = r ? t.getTotalChangedItemCount() : 0, l = this.cacheCtrl.getStats();
10054
+ const t = this.modelParser.changeTracker, r = t.hasChanges(), s = r ? new Map(t.getChangedAttributes()) : null, o = r ? new Set(t.getModelsWithFullReset()) : null, i = r ? new Set(t.getModelsWithChanges()) : null, l = r ? t.getTotalChangedItemCount() : 0, n = this.cacheCtrl.getStats();
9994
10055
  if (await this.performUpdate(() => this.modelParser.update()), r && this.cacheCtrl.enabled && s) {
9995
- const i = this.modelParser.getTotalItemCount(), n = a, u = i > 0 ? n / i : 0, f = this.initOptions.performance?.partialUpdates?.cacheInvalidationThreshold ?? 0.7, y2 = this.initOptions.performance?.partialUpdates?.enableDetailedLogging ?? false;
9996
- o && o.size > 0 ? (y2 && this.log.debug("Cache invalidation: Full clear", { reason: "full_reset_detected" }), this.cacheCtrl.clear()) : u > f ? (y2 && this.log.debug("Cache invalidation: Full clear", {
10056
+ const a = this.modelParser.getTotalItemCount(), d = l, y2 = a > 0 ? d / a : 0, f = this.initOptions.performance?.partialUpdates?.cacheInvalidationThreshold ?? 0.7, g2 = this.initOptions.performance?.partialUpdates?.enableDetailedLogging ?? false;
10057
+ o && o.size > 0 ? (g2 && this.log.debug("Cache invalidation: Full clear", { reason: "full_reset_detected" }), this.cacheCtrl.clear()) : y2 > f ? (g2 && this.log.debug("Cache invalidation: Full clear", {
9997
10058
  reason: "high_item_ratio",
9998
- ratio: u.toFixed(2),
10059
+ ratio: y2.toFixed(2),
9999
10060
  threshold: f,
10000
- changedItems: n,
10001
- totalItems: i
10002
- }), this.cacheCtrl.clear()) : (y2 && this.log.debug("Cache invalidation: Selective", {
10003
- changedItems: n,
10004
- totalItems: i,
10005
- ratio: u.toFixed(2)
10061
+ changedItems: d,
10062
+ totalItems: a
10063
+ }), this.cacheCtrl.clear()) : (g2 && this.log.debug("Cache invalidation: Selective", {
10064
+ changedItems: d,
10065
+ totalItems: a,
10066
+ ratio: y2.toFixed(2)
10006
10067
  }), this.cacheCtrl.invalidateByDependencies(s));
10007
10068
  } else
10008
10069
  (this.initOptions.performance?.partialUpdates?.enableDetailedLogging ?? false) && this.log.debug("Cache invalidation: Full clear", { reason: "full_update" }), this.cacheCtrl.clear();
10009
10070
  if (this.cacheCtrl.getStats) {
10010
- const i = this.cacheCtrl.getStats(), n = this.modelParser.partialUpdateMetrics.getLastUpdates(1);
10011
- if (n.length > 0 && n[0]) {
10012
- const u = n[0];
10013
- u.cacheStats = {
10014
- entriesInvalidated: l.totalEntries - i.totalEntries,
10015
- totalEntries: l.totalEntries
10071
+ const a = this.cacheCtrl.getStats(), d = this.modelParser.partialUpdateMetrics.getLastUpdates(1);
10072
+ if (d.length > 0 && d[0]) {
10073
+ const y2 = d[0];
10074
+ y2.cacheStats = {
10075
+ entriesInvalidated: n.totalEntries - a.totalEntries,
10076
+ totalEntries: n.totalEntries
10016
10077
  };
10017
10078
  }
10018
10079
  }
10019
10080
  if (r && s) {
10020
- const i = {
10081
+ const a = new Map(s);
10082
+ for (const y2 of [i, o])
10083
+ for (const f of y2 ?? [])
10084
+ a.has(f) || a.set(f, /* @__PURE__ */ new Set());
10085
+ const d = {
10021
10086
  isPartialUpdate: true,
10022
- changedModels: Array.from(s.keys()),
10087
+ changedModels: Array.from(a.keys()),
10023
10088
  changedAttributes: s,
10024
- affectedModels: this.getAffectedModels(s)
10089
+ affectedModels: this.getAffectedModels(a)
10025
10090
  };
10026
- this.cdRef.trigger({
10091
+ this.updateFnLists(d, e?.autoUpdateLists), this.cdRef.trigger({
10027
10092
  scope: "global",
10028
10093
  type: "dcupl_partial_update",
10029
- args: [i]
10030
- }), this.updateFnLists(i, e?.autoUpdateLists);
10094
+ args: [d]
10095
+ });
10031
10096
  } else
10032
10097
  this.updateFnLists(null, e?.autoUpdateLists);
10033
10098
  return true;