@inerrata-corporation/errata 2.0.22-dev.4148 → 2.0.22-dev.4173

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.
@@ -18641,6 +18641,20 @@ var SqliteGraphStore = class {
18641
18641
  if (revived > 0) this.mutations++;
18642
18642
  return revived;
18643
18643
  }
18644
+ incomingEdgeCoverage(label, edgeTypes, cloudOnly) {
18645
+ if (edgeTypes.length === 0) return { count: 0, total: 0 };
18646
+ const r = this.db.prepare(
18647
+ `SELECT COUNT(*) AS total,
18648
+ COALESCE(SUM(CASE WHEN EXISTS (
18649
+ SELECT 1 FROM edges e WHERE e.to_id = n.id AND e.valid_to IS NULL
18650
+ AND e.type IN (${edgeTypes.map(() => "?").join(",")})
18651
+ ) THEN 1 ELSE 0 END), 0) AS count
18652
+ FROM nodes n
18653
+ WHERE n.label = ? AND n.valid_to IS NULL
18654
+ AND (? = 0 OR json_extract(n.attrs_json, '$.source') = 'cloud')`
18655
+ ).get(...edgeTypes, label, cloudOnly ? 1 : 0);
18656
+ return { count: Number(r.count), total: Number(r.total) };
18657
+ }
18644
18658
  recentEdgeAttrCoverage(marker, attr, limit) {
18645
18659
  const r = this.db.prepare(
18646
18660
  `SELECT COUNT(*) AS total,