@finbheara/archive-client 0.17.0 → 0.18.0

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
@@ -558,16 +558,22 @@ c.dance; // "reel", "light-jig", "single-jig", "slip-jig", "treble-jig", "h
558
558
  // "treble-reel", "traditional-set", "set-dance", or null where the release names none
559
559
  c.from; // { feis_ids: ["fweb:ABC25"], year: 2025 } where an earlier year answered
560
560
  c.check; // "unchecked", or what the caller's `title` says about the earlier comp
561
- c.syllabus_source; // "results": what the syllabus the answer read is read from
561
+ c.syllabus_source; // "syllabus-document" | "results": what the syllabus the answer read is read from
562
+ c.candidates[0].syllabus_entry; // the `syllabi` row the comp's number joined, or null
562
563
  await rel.comps.syllabus("fweb:ABC25"); // one feis-year's competitions, in printed order
563
564
  const syl = await rel.comps.syllabusFor("Ardvarna Spring", 2026); // or a `feises.series` answer
564
565
  syl.year; // the asked year where the release holds it, else its newest (syl.held, syl.why)
565
- syl.source; // "results" (a syllabus document is a source of its own name, shipped by no release yet)
566
+ syl.source; // "syllabus-document" where every entry joins a `syllabi` row, else "results"
566
567
  syl.entries; // the comps, syl.championships how many are championships, syl.note where none
567
568
  ```
568
569
 
569
- EVERY SYLLABUS SAYS WHAT IT IS READ FROM. Today that is the comps the release's result captures
570
- list (`results`): a comp the feis held whose results the platform did not tabulate is not in it.
570
+ EVERY SYLLABUS SAYS WHAT IT IS READ FROM. The comps are the ones the release's result captures
571
+ list: a comp the feis held whose results the platform did not tabulate is not in it. Where every
572
+ comp an answer read joins a row of the release's `syllabi` table (the syllabus document the event
573
+ published, the entry its number was read in), the answer says `syllabus-document`, else
574
+ `results`. A release ships the syllabi the corpus transcribes, today the majors' and a few
575
+ feiseanna's: a platform feis's answer says `results` until the corpus publishes that platform's
576
+ syllabi, and a release older than the table says `results` everywhere.
571
577
  A feis whose platform tabulated its grades only has a syllabus with no championship, and
572
578
  `syllabusFor` says so (`note`), as does a `none` answer of `resolve` on such a series.
573
579
 
@@ -1811,7 +1811,7 @@ CREATE TABLE comp(
1811
1811
  code TEXT NOT NULL, code_fold TEXT NOT NULL, title TEXT, age TEXT, gender TEXT,
1812
1812
  feis_level INTEGER, round TEXT, platform TEXT NOT NULL, captures INTEGER NOT NULL,
1813
1813
  file TEXT NOT NULL, line INTEGER NOT NULL, age_source TEXT, age_printed TEXT,
1814
- gender_source TEXT, level_printed TEXT, dance_printed TEXT, dance TEXT
1814
+ gender_source TEXT, level_printed TEXT, dance_printed TEXT, dance TEXT, syllabus_entry TEXT
1815
1815
  );
1816
1816
  `;
1817
1817
  var INDEXES2 = [
@@ -1829,7 +1829,7 @@ var OPTIONAL = [
1829
1829
  var fold = (code) => code.trim().toLowerCase();
1830
1830
  var compsIndex = {
1831
1831
  name: "comps",
1832
- version: "3",
1832
+ version: "4",
1833
1833
  inputs: ["results"],
1834
1834
  says: "every competition by its feis and its own code, with its series and year",
1835
1835
  build(rel, out) {
@@ -1842,12 +1842,14 @@ var compsIndex = {
1842
1842
  const captures = new Map;
1843
1843
  for (const r of src.query("SELECT competition, count(*) AS n FROM competitions GROUP BY competition").all())
1844
1844
  captures.set(r.competition, r.n);
1845
- const put = out.prepare("INSERT OR IGNORE INTO comp VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
1845
+ const put = out.prepare("INSERT OR IGNORE INTO comp VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
1846
1846
  const has = new Set(src.query("PRAGMA table_info(competitions)").all().map((r) => r.name));
1847
1847
  const opt = (col) => has.has(col) ? col : `NULL AS ${col}`;
1848
- for (const c of src.query(`SELECT competition, event, year, comp_no, title, age, gender, feis_level, round, source, file, line, ${OPTIONAL.map(opt).join(", ")} FROM competitions WHERE comp_no IS NOT NULL AND trim(comp_no) != '' ORDER BY file, line`).iterate()) {
1848
+ const syllabi = has.has("syllabus_entry") && src.query("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'syllabi'").get() !== null;
1849
+ const entry = syllabi ? "(SELECT s.entry FROM syllabi s WHERE s.entry = competitions.syllabus_entry) AS syllabus_entry" : "NULL AS syllabus_entry";
1850
+ for (const c of src.query(`SELECT competition, event, year, comp_no, title, age, gender, feis_level, round, source, file, line, ${OPTIONAL.map(opt).join(", ")}, ${entry} FROM competitions WHERE comp_no IS NOT NULL AND trim(comp_no) != '' ORDER BY file, line`).iterate()) {
1849
1851
  const f = brand.get(c.event);
1850
- put.run(c.competition, c.event, f?.brand ?? null, c.year ?? f?.year ?? null, c.comp_no.trim(), fold(c.comp_no), c.title, c.age, c.gender, c.feis_level, c.round, c.source, captures.get(c.competition) ?? 1, c.file, c.line, c.age_source, c.age_printed, c.gender_source, c.level_printed, c.dance_printed, c.dance);
1852
+ put.run(c.competition, c.event, f?.brand ?? null, c.year ?? f?.year ?? null, c.comp_no.trim(), fold(c.comp_no), c.title, c.age, c.gender, c.feis_level, c.round, c.source, captures.get(c.competition) ?? 1, c.file, c.line, c.age_source, c.age_printed, c.gender_source, c.level_printed, c.dance_printed, c.dance, c.syllabus_entry);
1851
1853
  }
1852
1854
  for (const s of INDEXES2)
1853
1855
  out.run(s);
@@ -1878,9 +1880,13 @@ function compOf(r, codes = []) {
1878
1880
  round,
1879
1881
  canonical: canonicalOf2(lv, r.age),
1880
1882
  platform: r.platform,
1881
- captures: r.captures
1883
+ captures: r.captures,
1884
+ syllabus_entry: r.syllabus_entry ?? null
1882
1885
  };
1883
1886
  }
1887
+ function syllabusSourceOf2(comps) {
1888
+ return comps.length > 0 && comps.every((c) => c.syllabus_entry !== null) ? "syllabus-document" : "results";
1889
+ }
1884
1890
  function canonicalOf2(level, age) {
1885
1891
  if (level !== 600 && level !== 700 || age === null)
1886
1892
  return null;
@@ -2018,7 +2024,7 @@ class CompResolver2 {
2018
2024
  feis: place,
2019
2025
  year: read?.year ?? null,
2020
2026
  held: place.held,
2021
- source: read === null ? null : "results",
2027
+ source: read === null ? null : syllabusSourceOf2(entries),
2022
2028
  feis_ids: read?.feis_ids ?? [],
2023
2029
  entries,
2024
2030
  years,
@@ -2068,7 +2074,7 @@ class CompResolver2 {
2068
2074
  title: u?.title ?? null,
2069
2075
  competition: u?.competition ?? null,
2070
2076
  candidates,
2071
- syllabus_source: source === null ? null : "results",
2077
+ syllabus_source: source === null ? null : syllabusSourceOf2(candidates),
2072
2078
  ...more
2073
2079
  };
2074
2080
  };
@@ -3836,4 +3842,4 @@ function releases2(opts = {}) {
3836
3842
  return new ReleaseManager2(opts);
3837
3843
  }
3838
3844
 
3839
- export { DATABASES2, planAsset2, sha256File2, unzstdTo2, NAME_LEVELS2, nameLevel2, NO_CALENDAR2, FeisFinder2, entryRank2, FEIS_LOCAL_ID_FLOOR2, ResultFinder2, MajorsFinder2, LINEAGE_FILE2, linksOfLineage2, releaseSchoolGraph2, readsSpanishNames2, SchoolResolver2, initialsOnly2, nameOrderOf, DancerResolver2, readPopulation2, canonicalOf2, CompResolver2, StaffFinder2, TeamFinder2, EventFinder2, defaultBuilders2, indexPath2, indexKey2, isCurrent2, buildIndex2, ensureIndex2, listIndexes2, readPin2, youngest2, dancerResolverOf2, RegistrationResolver2, ghRemote2, httpsRemote2, fallbackRemote2, setRemote2, columnsOf2, FEATURES2, capabilityOf2, needsRelease2, resolveTag2, Release2, openRelease2, openCached2, ReleaseManager2, releases2 };
3845
+ export { DATABASES2, planAsset2, sha256File2, unzstdTo2, NAME_LEVELS2, nameLevel2, NO_CALENDAR2, FeisFinder2, entryRank2, FEIS_LOCAL_ID_FLOOR2, ResultFinder2, MajorsFinder2, LINEAGE_FILE2, linksOfLineage2, releaseSchoolGraph2, readsSpanishNames2, SchoolResolver2, initialsOnly2, nameOrderOf, DancerResolver2, readPopulation2, syllabusSourceOf2, canonicalOf2, CompResolver2, StaffFinder2, TeamFinder2, EventFinder2, defaultBuilders2, indexPath2, indexKey2, isCurrent2, buildIndex2, ensureIndex2, listIndexes2, readPin2, youngest2, dancerResolverOf2, RegistrationResolver2, ghRemote2, httpsRemote2, fallbackRemote2, setRemote2, columnsOf2, FEATURES2, capabilityOf2, needsRelease2, resolveTag2, Release2, openRelease2, openCached2, ReleaseManager2, releases2 };
package/dist/cli.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  nameOrderOf,
5
5
  openRelease2,
6
6
  releases2
7
- } from "./chunks/index-598c5w9d.js";
7
+ } from "./chunks/index-tr14vc1c.js";
8
8
  import"./chunks/index-hne1wadw.js";
9
9
  import"./chunks/index-hghdy980.js";
10
10
 
package/dist/index.js CHANGED
@@ -20,6 +20,7 @@ import {
20
20
  initialsOnly2,
21
21
  DancerResolver2,
22
22
  readPopulation2,
23
+ syllabusSourceOf2,
23
24
  canonicalOf2,
24
25
  CompResolver2,
25
26
  StaffFinder2,
@@ -50,7 +51,7 @@ import {
50
51
  openCached2,
51
52
  ReleaseManager2,
52
53
  releases2
53
- } from "./chunks/index-598c5w9d.js";
54
+ } from "./chunks/index-tr14vc1c.js";
54
55
  import {
55
56
  cacheRoot2,
56
57
  repoOf2
@@ -122,6 +123,7 @@ export {
122
123
  resolveTag2 as resolveTag,
123
124
  setRemote2 as setRemote,
124
125
  sha256File2 as sha256File,
126
+ syllabusSourceOf2 as syllabusSourceOf,
125
127
  unzstdTo2 as unzstdTo,
126
128
  youngest2 as youngest
127
129
  };
@@ -25,6 +25,7 @@ export interface Comp {
25
25
  canonical: string | null;
26
26
  platform: string;
27
27
  captures: number;
28
+ syllabus_entry: string | null;
28
29
  }
29
30
  export interface CompQuery {
30
31
  feis: string;
@@ -118,8 +119,10 @@ interface CompRow {
118
119
  level_printed?: string | null;
119
120
  dance_printed?: string | null;
120
121
  dance?: string | null;
122
+ syllabus_entry?: string | null;
121
123
  }
122
124
  export declare function compOf(r: CompRow, codes?: readonly string[]): Comp;
125
+ export declare function syllabusSourceOf(comps: readonly Comp[]): SyllabusSource;
123
126
  export declare function canonicalOf(level: number | null, age: string | null): string | null;
124
127
  export declare const CODE_READER: import("@finbheara/domain/code").CodeReader;
125
128
  export declare class CompResolver {
@@ -2,7 +2,7 @@ export { type AssetPlan, DATABASES, type DatabaseName, type LandedFile, type Rec
2
2
  export { sha256File, unzstdTo } from "./bytes.js";
3
3
  export { type AgeAsked, type AgeEvidence, type DancerAnswer, type DancerBulkRecord, type DancerCandidate, type DancerQuery, type DancerRecord, DancerResolver, type DancerRegion, type DancerSchool, type DancerSearchQuery, type DancerYear, type ExcludedCandidate, FEIS_LOCAL_ID_FLOOR, type InitialsRefuted, type Narrowing, initialsOnly, type OireachtasAsked, type PopulationEvidence, type RegionEvidence, type SchoolEvidence, readPopulation, } from "./dancers.js";
4
4
  export { NAME_LEVELS, type NameLevel, nameLevel } from "./dancers-names.js";
5
- export { type Comp, type CompAnswer, type CompDance, type CompKind, type CompQuery, CompResolver, type CompSource, type FeisPlace, type SyllabusAnswer, type SyllabusForAnswer, type SyllabusSource, type TitleCheck, canonicalOf, } from "./comps.js";
5
+ export { type Comp, type CompAnswer, type CompDance, type CompKind, type CompQuery, CompResolver, type CompSource, type FeisPlace, type SyllabusAnswer, type SyllabusForAnswer, type SyllabusSource, type TitleCheck, canonicalOf, syllabusSourceOf, } from "./comps.js";
6
6
  export { type ClientOptions, cacheRoot, repoOf } from "./config.js";
7
7
  export { type Feis, type FeisAnswer, FeisFinder, type FeisQuery, NO_CALENDAR, type Series, type SeriesAnswer, type SeriesInstance, type SeriesNext, } from "./feises.js";
8
8
  export { type IndexBuilder, type IndexFile, buildIndex, defaultBuilders, ensureIndex, indexKey, indexPath, isCurrent, listIndexes, } from "./indexes.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finbheara/archive-client",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
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",