@finbheara/archive-client 0.17.0 → 0.19.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
@@ -100,7 +100,10 @@ A spec is `pinned` (the default: the user-local pin, else the latest), `latest`,
100
100
 
101
101
  EVERY FILE IS CHECKED before it lands: the downloaded bytes against the host's own sha256 digest,
102
102
  and the content against the manifest (a database's decompressed bytes against
103
- `databases.<name>.sha256`, a parquet file against `parquet.files[<name>].sha256`). A mismatch
103
+ `databases.<name>.sha256`, a side file's decompressed bytes against `sideFiles.<name>.sha256`, a
104
+ parquet file against `parquet.files[<name>].sha256`). A side file the manifest names under
105
+ `sideFiles` is published zstd'd (`<name>.zst`, or the `file` it states) and lands plain under its
106
+ own name. A mismatch
104
107
  refuses and leaves nothing in place. A file nothing vouches for is kept and its receipt says so
105
108
  (`strict: true` refuses it). A database is decompressed in process, streamed, never through a
106
109
  `zstd` binary.
@@ -558,16 +561,22 @@ c.dance; // "reel", "light-jig", "single-jig", "slip-jig", "treble-jig", "h
558
561
  // "treble-reel", "traditional-set", "set-dance", or null where the release names none
559
562
  c.from; // { feis_ids: ["fweb:ABC25"], year: 2025 } where an earlier year answered
560
563
  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
564
+ c.syllabus_source; // "syllabus-document" | "results": what the syllabus the answer read is read from
565
+ c.candidates[0].syllabus_entry; // the `syllabi` row the comp's number joined, or null
562
566
  await rel.comps.syllabus("fweb:ABC25"); // one feis-year's competitions, in printed order
563
567
  const syl = await rel.comps.syllabusFor("Ardvarna Spring", 2026); // or a `feises.series` answer
564
568
  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)
569
+ syl.source; // "syllabus-document" where every entry joins a `syllabi` row, else "results"
566
570
  syl.entries; // the comps, syl.championships how many are championships, syl.note where none
567
571
  ```
568
572
 
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.
573
+ EVERY SYLLABUS SAYS WHAT IT IS READ FROM. The comps are the ones the release's result captures
574
+ list: a comp the feis held whose results the platform did not tabulate is not in it. Where every
575
+ comp an answer read joins a row of the release's `syllabi` table (the syllabus document the event
576
+ published, the entry its number was read in), the answer says `syllabus-document`, else
577
+ `results`. A release ships the syllabi the corpus transcribes, today the majors' and a few
578
+ feiseanna's: a platform feis's answer says `results` until the corpus publishes that platform's
579
+ syllabi, and a release older than the table says `results` everywhere.
571
580
  A feis whose platform tabulated its grades only has a syllabus with no championship, and
572
581
  `syllabusFor` says so (`note`), as does a `none` answer of `resolve` on such a series.
573
582
 
@@ -27,6 +27,17 @@ function planAsset2(name, manifest) {
27
27
  contentSha256: manifest?.databases?.[name]?.sha256 ?? null
28
28
  };
29
29
  }
30
+ const side = manifest?.sideFiles?.[name];
31
+ if (side !== undefined) {
32
+ const file = side.file ?? `${name}.zst`;
33
+ return {
34
+ asked: name,
35
+ published: file === name ? [name] : [file, name],
36
+ local: name,
37
+ decompress: true,
38
+ contentSha256: side.sha256 ?? null
39
+ };
40
+ }
30
41
  return {
31
42
  asked: name,
32
43
  published: [name],
@@ -1811,7 +1822,7 @@ CREATE TABLE comp(
1811
1822
  code TEXT NOT NULL, code_fold TEXT NOT NULL, title TEXT, age TEXT, gender TEXT,
1812
1823
  feis_level INTEGER, round TEXT, platform TEXT NOT NULL, captures INTEGER NOT NULL,
1813
1824
  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
1825
+ gender_source TEXT, level_printed TEXT, dance_printed TEXT, dance TEXT, syllabus_entry TEXT
1815
1826
  );
1816
1827
  `;
1817
1828
  var INDEXES2 = [
@@ -1829,7 +1840,7 @@ var OPTIONAL = [
1829
1840
  var fold = (code) => code.trim().toLowerCase();
1830
1841
  var compsIndex = {
1831
1842
  name: "comps",
1832
- version: "3",
1843
+ version: "4",
1833
1844
  inputs: ["results"],
1834
1845
  says: "every competition by its feis and its own code, with its series and year",
1835
1846
  build(rel, out) {
@@ -1842,12 +1853,14 @@ var compsIndex = {
1842
1853
  const captures = new Map;
1843
1854
  for (const r of src.query("SELECT competition, count(*) AS n FROM competitions GROUP BY competition").all())
1844
1855
  captures.set(r.competition, r.n);
1845
- const put = out.prepare("INSERT OR IGNORE INTO comp VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
1856
+ const put = out.prepare("INSERT OR IGNORE INTO comp VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
1846
1857
  const has = new Set(src.query("PRAGMA table_info(competitions)").all().map((r) => r.name));
1847
1858
  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()) {
1859
+ const syllabi = has.has("syllabus_entry") && src.query("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'syllabi'").get() !== null;
1860
+ const entry = syllabi ? "(SELECT s.entry FROM syllabi s WHERE s.entry = competitions.syllabus_entry) AS syllabus_entry" : "NULL AS syllabus_entry";
1861
+ 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
1862
  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);
1863
+ 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
1864
  }
1852
1865
  for (const s of INDEXES2)
1853
1866
  out.run(s);
@@ -1878,9 +1891,13 @@ function compOf(r, codes = []) {
1878
1891
  round,
1879
1892
  canonical: canonicalOf2(lv, r.age),
1880
1893
  platform: r.platform,
1881
- captures: r.captures
1894
+ captures: r.captures,
1895
+ syllabus_entry: r.syllabus_entry ?? null
1882
1896
  };
1883
1897
  }
1898
+ function syllabusSourceOf2(comps) {
1899
+ return comps.length > 0 && comps.every((c) => c.syllabus_entry !== null) ? "syllabus-document" : "results";
1900
+ }
1884
1901
  function canonicalOf2(level, age) {
1885
1902
  if (level !== 600 && level !== 700 || age === null)
1886
1903
  return null;
@@ -2018,7 +2035,7 @@ class CompResolver2 {
2018
2035
  feis: place,
2019
2036
  year: read?.year ?? null,
2020
2037
  held: place.held,
2021
- source: read === null ? null : "results",
2038
+ source: read === null ? null : syllabusSourceOf2(entries),
2022
2039
  feis_ids: read?.feis_ids ?? [],
2023
2040
  entries,
2024
2041
  years,
@@ -2068,7 +2085,7 @@ class CompResolver2 {
2068
2085
  title: u?.title ?? null,
2069
2086
  competition: u?.competition ?? null,
2070
2087
  candidates,
2071
- syllabus_source: source === null ? null : "results",
2088
+ syllabus_source: source === null ? null : syllabusSourceOf2(candidates),
2072
2089
  ...more
2073
2090
  };
2074
2091
  };
@@ -3740,7 +3757,8 @@ class ReleaseManager2 {
3740
3757
  copyFileSync(src, raw);
3741
3758
  }
3742
3759
  const base = name.replace(/\.sqlite(\.zst)?$/, "");
3743
- const asked = base !== name && isDatabase(base) ? base : name;
3760
+ const side = Object.entries(manifest.sideFiles ?? {}).find(([k, f]) => (f.file ?? `${k}.zst`) === name)?.[0];
3761
+ const asked = base !== name && isDatabase(base) ? base : side ?? name;
3744
3762
  const plan = planAsset2(asked, manifest);
3745
3763
  const landed = await land(raw, { name, digest: null }, plan, join4(dest, plan.local), this.opts, log);
3746
3764
  receipt.files[plan.local] = landed;
@@ -3836,4 +3854,4 @@ function releases2(opts = {}) {
3836
3854
  return new ReleaseManager2(opts);
3837
3855
  }
3838
3856
 
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 };
3857
+ 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-gpaf165j.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-gpaf165j.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
  };
@@ -14,6 +14,11 @@ export interface ReleaseManifest {
14
14
  table?: string;
15
15
  }>;
16
16
  };
17
+ sideFiles?: Record<string, {
18
+ file?: string;
19
+ bytes?: number;
20
+ sha256?: string;
21
+ }>;
17
22
  [k: string]: unknown;
18
23
  }
19
24
  export declare const DATABASES: readonly ["results", "majors"];
@@ -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.19.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",