@north-light/api 0.3.743 → 0.3.744

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.
@@ -52,7 +52,9 @@ export async function rosterEdges(visible = null) {
52
52
  const ids = visible === null ? null : [...visible];
53
53
  const rows = ids === null
54
54
  ? await treeEdges(await openDb(), '')
55
- : await treeEdges(await openDb(), 'AND wo.id = ANY(?::text[]) AND oo.id = ANY(?::text[])', ids, ids);
55
+ // `IN (SELECT unnest(...))`, not `= ANY(...)`: the planner hashes the set instead of scanning the array per joined row
56
+ // (thousands of ids made `ANY` a linear filter: 5.6 s against 0.3 s on the fleet database).
57
+ : await treeEdges(await openDb(), 'AND wo.id IN (SELECT unnest(?::text[])) AND oo.id IN (SELECT unnest(?::text[]))', ids, ids);
56
58
  return rows.map(({ from_id, to_id, active, created }) => ({ from_id, to_id, active, created }));
57
59
  }
58
60
  /** `subscriber` asks to watch `publisher` (an `ask` watch, in the tree). Re-running sets the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/api",
3
- "version": "0.3.743",
3
+ "version": "0.3.744",
4
4
  "description": "Typed crtrd /v1 API contract — DTOs, route builders, the error contract, the CrtrClient, and the command-plugin manifest format. Zero runtime dependencies.",
5
5
  "type": "module",
6
6
  "main": "./dist/api/index.js",