@finbheara/archive-client 0.3.0 → 0.3.1

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/README.md CHANGED
@@ -189,7 +189,8 @@ print exactly as the release published it, then the print read by `@finbheara/do
189
189
  reader at its filing key (`sn3`) and at its real words. `ambiguous` and `none` are answers: a
190
190
  best guess is never promoted to `unique`. `region` drops only a candidate the registry places in
191
191
  other regions, and keeps one it places nowhere. A print the reader refuses (a placeholder)
192
- answers `none` with the reason.
192
+ answers `none` with the reason. An id (or a retired id followed) answers with every print its
193
+ rows were published under and their rows, so it agrees with each print lookup of that school.
193
194
 
194
195
  Every answer carries the release tag it came from.
195
196
 
@@ -1459,7 +1459,7 @@ var encoderOf = (r) => schoolEncoder({ reader: r.reader });
1459
1459
  var TABLE = "school_name";
1460
1460
  var schoolsIndex = {
1461
1461
  name: "schools",
1462
- version: "1",
1462
+ version: "2",
1463
1463
  inputs: ["results", "school-registry.jsonl", "school-redirects.jsonl"],
1464
1464
  says: "every published school print and its ids, read at the school reader's slots",
1465
1465
  keyParts: (rel) => [`reader=${rel.schoolReader().id}`],
@@ -1475,6 +1475,7 @@ var schoolsIndex = {
1475
1475
  const putPair = out.prepare("INSERT INTO print_id VALUES (?, ?, ?)");
1476
1476
  for (const r of pairs)
1477
1477
  putPair.run(r.p, r.s, r.n);
1478
+ out.run("CREATE INDEX print_id_school ON print_id(school_id)");
1478
1479
  const names = createIndex3(out, encoder, {
1479
1480
  table: TABLE
1480
1481
  });
@@ -1534,9 +1535,13 @@ class SchoolResolver2 {
1534
1535
  ...extra
1535
1536
  };
1536
1537
  };
1538
+ const byId = (id, by) => {
1539
+ const rs = db.query("SELECT print, rows FROM print_id WHERE school_id = ? ORDER BY print").all(id);
1540
+ return candidate(id, by, rs.reduce((n, r) => n + r.rows, 0), rs.map((r) => r.print));
1541
+ };
1537
1542
  const a = asked.trim();
1538
1543
  if (reg.get(a) !== null)
1539
- return answer([candidate(a, "id", 0, [])]);
1544
+ return answer([byId(a, "id")]);
1540
1545
  let live = a;
1541
1546
  const seen = new Set;
1542
1547
  for (;; ) {
@@ -1547,7 +1552,7 @@ class SchoolResolver2 {
1547
1552
  live = r.new_id;
1548
1553
  }
1549
1554
  if (live !== a)
1550
- return answer([candidate(live, "redirect", 0, [])], { redirected: { from: a, to: live } });
1555
+ return answer([byId(live, "redirect")], { redirected: { from: a, to: live } });
1551
1556
  const byPrints = (prints, by) => {
1552
1557
  const ids = new Map;
1553
1558
  const q2 = db.query("SELECT school_id, rows FROM print_id WHERE print = ?");
package/dist/cli.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  nameOrderOf,
5
5
  openRelease2,
6
6
  releases2
7
- } from "./chunks/index-kp811fb0.js";
7
+ } from "./chunks/index-3va2jzse.js";
8
8
  import"./chunks/index-hne1wadw.js";
9
9
  import"./chunks/index-hghdy980.js";
10
10
 
package/dist/index.js CHANGED
@@ -41,7 +41,7 @@ import {
41
41
  openCached2,
42
42
  ReleaseManager2,
43
43
  releases2
44
- } from "./chunks/index-kp811fb0.js";
44
+ } from "./chunks/index-3va2jzse.js";
45
45
  import {
46
46
  cacheRoot2,
47
47
  repoOf2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finbheara/archive-client",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Open a versioned release of an Irish dance results archive: download, verify, decompress and cache it by tag, keep the cache, and resolve feises and schools against it",
5
5
  "keywords": ["irish-dance", "results", "release", "cache", "sqlite"],
6
6
  "license": "MIT",