@finbheara/archive-client 0.16.0 → 0.16.2

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
@@ -285,7 +285,9 @@ joins: every school reached through any number of edges, in either direction (th
285
285
  split are joined through their predecessor, the schools of a merger through their successor). An
286
286
  earlier row at a joined school alone is no match. `r.school.lineage` lists the ids joined to the
287
287
  asked ones. A release that publishes no lineage (feature `schools.lineage`) joins
288
- nothing and its answer carries no `lineage`, never refused.
288
+ nothing and its answer carries no `lineage`, never refused. The line is read on the same school
289
+ graph as `rel.schools.line` (`@finbheara/domain/school-graph`): untimed, every path, and as of a
290
+ year, every path none of whose steps is dated after it, a rename at any year (`LINE_AS_OF`).
289
291
 
290
292
  `population` is how the dancer's published majors population meets the asked one: `same`,
291
293
  `contradicts`, `both`, `unknown`, `unasked`. A dancer's population is read only from its rows at
@@ -319,7 +321,8 @@ words):
319
321
  - `school`: every school row of the dancer up to the asked year reads to a school id (an id
320
322
  followed through the redirects, a print read by `rel.schools`), and none of them is the asked
321
323
  school or a school its line had joined by that year (lineage edges dated in or before the asked
322
- year). A dancer with no school row, or a print no school reads, is unknown and never refuted. A
324
+ year, and a rename at any year: one school under two names).
325
+ A dancer with no school row, or a print no school reads, is unknown and never refuted. A
323
326
  dancer that ever danced for the asked school's line is never refuted by the school. For an
324
327
  adult-category question (the asked band is the adult band, read by `@finbheara/domain`:
325
328
  `Adult`, `Advanced Adult`, `Adult Beginner`, `Open Adult`, `Adult Masters`), a row the
@@ -71,6 +71,7 @@ import { Age, DANCE_UP_YEARS, birthYearsMeet } from "@finbheara/domain/age";
71
71
  import { createIndex as createIndex2, indexSchema as indexSchema2, personEncoder } from "@finbheara/domain/noun-index";
72
72
  import domainPkg from "@finbheara/domain/package.json";
73
73
  import { dancerName } from "@finbheara/domain/person";
74
+ import { schoolGraph as schoolGraph2 } from "@finbheara/domain/school-graph";
74
75
  import {
75
76
  compTitle,
76
77
  populationIn,
@@ -634,12 +635,6 @@ class MajorsFinder2 {
634
635
  }
635
636
  }
636
637
 
637
- import { createIndex, indexSchema } from "@finbheara/domain/noun-index";
638
- import {
639
- DEFAULT_SCHOOL_NAME_READER,
640
- schoolEncoder
641
- } from "@finbheara/domain/school";
642
-
643
638
  import {
644
639
  schoolGraph
645
640
  } from "@finbheara/domain/school-graph";
@@ -674,6 +669,11 @@ async function releaseSchoolGraph2(rel) {
674
669
  return schoolGraph({ links, redirect: (id) => redirects.get(id) ?? null });
675
670
  }
676
671
 
672
+ import { createIndex, indexSchema } from "@finbheara/domain/noun-index";
673
+ import {
674
+ DEFAULT_SCHOOL_NAME_READER,
675
+ schoolEncoder
676
+ } from "@finbheara/domain/school";
677
677
  function readsSpanishNames2(candidates) {
678
678
  return candidates.some((c) => c.spanishNames !== undefined && (c.spanishNames.file || c.prints.some((p) => c.spanishNames?.prints.includes(p.trim()))));
679
679
  }
@@ -861,16 +861,15 @@ class SchoolResolver2 {
861
861
  }
862
862
  }
863
863
 
864
- var LINEAGE_FILE = "school-lineage.jsonl";
864
+ var LINE_AS_OF = {
865
+ name: "line-as-of",
866
+ keep: (s) => !s.flags.datedAfter || s.link.shape === "rename"
867
+ };
865
868
  function schoolLine(lineage, ids, year) {
866
869
  const reached = new Set(ids);
867
- const todo = [...ids];
868
- for (let id = todo.pop();id !== undefined; id = todo.pop())
869
- for (const [o, y] of lineage.get(id) ?? [])
870
- if (!reached.has(o) && (year === null || y === null || y <= year)) {
871
- reached.add(o);
872
- todo.push(o);
873
- }
870
+ for (const id of ids)
871
+ for (const x of lineage.within(id, LINE_AS_OF, year))
872
+ reached.add(x);
874
873
  return reached;
875
874
  }
876
875
  function initialsOnly2(name) {
@@ -1097,21 +1096,10 @@ class DancerResolver2 {
1097
1096
  this.lineageOf ??= (async () => {
1098
1097
  if ((await this.rel.capability("schools.lineage")).state !== "full")
1099
1098
  return null;
1100
- await this.rel.fetch(LINEAGE_FILE);
1101
- const out = new Map;
1102
- const join = (a, b, year) => {
1103
- const m = out.get(a) ?? new Map;
1104
- const was = m.get(b);
1105
- m.set(b, was === undefined ? year : was === null || year === null ? null : Math.min(was, year));
1106
- out.set(a, m);
1107
- };
1108
- for (const r of readJsonl(this.rel.path(LINEAGE_FILE)))
1109
- if (r.id !== r.other) {
1110
- const year = typeof r.year === "number" ? r.year : null;
1111
- join(r.id, r.other, year);
1112
- join(r.other, r.id, year);
1113
- }
1114
- return out;
1099
+ await this.rel.fetch(LINEAGE_FILE2);
1100
+ return schoolGraph2({
1101
+ links: linksOfLineage2(readJsonl(this.rel.path(LINEAGE_FILE2)))
1102
+ });
1115
1103
  })();
1116
1104
  return this.lineageOf;
1117
1105
  }
package/dist/cli.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  nameOrderOf,
5
5
  openRelease2,
6
6
  releases2
7
- } from "./chunks/index-zspxdmkd.js";
7
+ } from "./chunks/index-bpd2j026.js";
8
8
  import"./chunks/index-hne1wadw.js";
9
9
  import"./chunks/index-hghdy980.js";
10
10
 
package/dist/index.js CHANGED
@@ -50,7 +50,7 @@ import {
50
50
  openCached2,
51
51
  ReleaseManager2,
52
52
  releases2
53
- } from "./chunks/index-zspxdmkd.js";
53
+ } from "./chunks/index-bpd2j026.js";
54
54
  import {
55
55
  cacheRoot2,
56
56
  repoOf2
@@ -1,9 +1,11 @@
1
+ import { type SchoolGraph, type StepPolicy } from "@finbheara/domain/school-graph";
1
2
  import { type PersonName } from "@finbheara/names/normalize";
2
3
  import { type NameLevel } from "./dancers-names.js";
3
4
  import type { IndexBuilder } from "./indexes.js";
4
5
  import type { Release } from "./release.js";
5
6
  import { FEIS_LOCAL_ID_FLOOR } from "./results.js";
6
- export type Lineage = Map<string, Map<string, number | null>>;
7
+ export type Lineage = SchoolGraph;
8
+ export declare const LINE_AS_OF: StepPolicy;
7
9
  export declare function schoolLine(lineage: Lineage, ids: readonly string[], year: number | null): Set<string>;
8
10
  export declare function initialsOnly(name: PersonName): boolean;
9
11
  export { FEIS_LOCAL_ID_FLOOR };
@@ -1,7 +1,7 @@
1
1
  import { type LineAnswer, type LinkAnswer, type LinkQuery, type SchoolGraph, type SchoolLink } from "@finbheara/domain/school-graph";
2
2
  import type { Release } from "./release.js";
3
3
  export declare const LINEAGE_FILE = "school-lineage.jsonl";
4
- interface LineageLine {
4
+ export interface LineageLine {
5
5
  id: string;
6
6
  direction: "precedes" | "succeeds";
7
7
  other: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finbheara/archive-client",
3
- "version": "0.16.0",
3
+ "version": "0.16.2",
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",