@finbheara/archive-client 0.38.0 → 0.40.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
@@ -93,6 +93,8 @@ c.features; // [{ feature: "dancers", state: "full" | "missing", missing: [...
93
93
  | `dancers.records` | `dancers.records` | 215 |
94
94
  | `dancers.records.names` | the `names_printed` a record of `dancers.records` carries; absent, never refused, without it | 215 |
95
95
  | `dancers.years` | `dancers.years` | 245 |
96
+ | `results.stream.competitors_printed`, `majors.stream.competitors_printed` | the `competitors_printed` a streamed row carries (the competed count the page printed); absent, never refused, without it | 345 |
97
+ | `dancers.years.printed` | the `printed_regions` a dancer-year of `dancers.years` carries (every region the year printed, where `region` picks one); absent, never refused, without it | 341 |
96
98
  | `majors.tabs` | `majors.tabulated` | 215 |
97
99
  | `teams` | `teams.results`, `teams.rosters`, `teams.resultRosters` | 260 |
98
100
  | `teams.fields` | the fields `teams.results` (`age`, `gender`, `printed_status`) and `teams.rosters` (`dance`, `school_printed_as_of`, a member's `gender`) carry; absent, never refused, without it | 266 |
@@ -596,10 +598,12 @@ THE COMPETITION FIELDS, where the release carries them (`rel.capability("results
596
598
  | `dance` | the competition's one dance as the release reads it (`reel`), null where it reads none |
597
599
  | `recalled_only` | true where the page printed the recalled dancers only |
598
600
  | `comp_flags` | what the page printed about itself, int-packed, one bit a flag (bit 10: recalled only). The release's `DATA-DICTIONARY.md` carries the register of every bit, and a published bit never moves |
599
- | `competitors_basis` | what `competitors` stands on: `printed` (the page printed a competed count), `counted` (the page printed the whole field, its cards counted), `entered` or `registered` (only the top was printed: the page's entered or registered count), null where there is no number |
601
+ | `competitors_basis` | what `competitors` stands on: `printed` (the page printed a competed count), `counted` (the page printed the whole field, its cards counted), `entered` or `registered` (only the top was printed: the page's entered or registered count), `estimated` (a majors sheet with no count that does not show its whole field: the recall rule over a recall-only sheet (twice the recalled, plus or minus 1, or the recalled where fewer than 10), else the dancers it printed, a FLOOR; never a count, so leave it out where a real count is needed), null where there is no number |
600
602
 
601
603
  A release without them streams every row with the six fields ABSENT, never null.
602
604
 
605
+ `competitors_printed` (feature `results.stream.competitors_printed`, `majors.stream.competitors_printed` for scope `majors`) is the competed count the page itself printed, null where it printed none. `competitors` stays the best value. A release without it streams the field ABSENT.
606
+
603
607
  THE COMPETITION'S KEY is `competition` (`<event-year>.<comp>` at a major, `<platform>:<host>.<comp>`
604
608
  at a feis), which holds across releases. Inside one release `(file, competition_line)` is exact: a
605
609
  competition captured twice (two files of one platform) carries one `competition` in both and two
@@ -622,6 +626,7 @@ await rel.dancers.records(); // every dancer: display, appeara
622
626
  // names_printed (dancers.records.names)
623
627
  await rel.dancers.records({ ids: [1001] });
624
628
  await rel.dancers.years({ ids: [1001], year: 2025 }); // region, region_source, nationals, geohash
629
+ // printed_regions (dancers.years.printed)
625
630
  await rel.feises.dates(); // every feis id with its first and last day
626
631
  await rel.majors.tabulated({ min_true_round: 3 }); // the majors addresses marked to round 3 or later
627
632
  ```
@@ -491,6 +491,18 @@ var FEATURES2 = [
491
491
  since: 270,
492
492
  calls: "the same competition fields on a row of results.stream and results.entries (scope majors): absent, never refused, on a release without them"
493
493
  },
494
+ {
495
+ feature: "results.stream.competitors_printed",
496
+ needs: ["results:competitions.competitors_printed"],
497
+ since: 345,
498
+ calls: "the `competitors_printed` a row of results.stream and results.entries carries (the competed count the page printed): absent, never refused, on a release without it"
499
+ },
500
+ {
501
+ feature: "majors.stream.competitors_printed",
502
+ needs: ["majors:competitions.competitors_printed"],
503
+ since: 345,
504
+ calls: "the same on a row of results.stream and results.entries (scope majors)"
505
+ },
494
506
  {
495
507
  feature: "majors.tabs",
496
508
  needs: ["majors:tabs.address", "majors:tabs.true_round"],
@@ -535,6 +547,12 @@ var FEATURES2 = [
535
547
  since: 245,
536
548
  calls: "dancers.years"
537
549
  },
550
+ {
551
+ feature: "dancers.years.printed",
552
+ needs: ["results:dancer_years.printed_regions"],
553
+ since: 341,
554
+ calls: "the `printed_regions` a dancer-year of dancers.years carries: absent, never refused, on a release without it"
555
+ },
538
556
  {
539
557
  feature: "teams",
540
558
  needs: [
@@ -1396,7 +1414,7 @@ function streamSql(q, shape = {}) {
1396
1414
  if (q.primary === true)
1397
1415
  where.push("(r.primary_source IS NULL OR r.primary_source = '')");
1398
1416
  return {
1399
- sql: `SELECT ${COLUMNS}${shape.competition === true ? COMPETITION_COLUMNS : ""} FROM results r JOIN competitions c ON c.file = r.file AND c.line = r.competition_line${where.length === 0 ? "" : ` WHERE ${where.join(" AND ")}`} ORDER BY r.file, r.line`,
1417
+ sql: `SELECT ${COLUMNS}${shape.competition === true ? COMPETITION_COLUMNS : ""}${shape.competitorsPrinted === true ? ", c.competitors_printed AS competitors_printed" : ""} FROM results r JOIN competitions c ON c.file = r.file AND c.line = r.competition_line${where.length === 0 ? "" : ` WHERE ${where.join(" AND ")}`} ORDER BY r.file, r.line`,
1400
1418
  args
1401
1419
  };
1402
1420
  }
@@ -1538,7 +1556,8 @@ class ResultFinder2 {
1538
1556
  await this.rel.fetch(db);
1539
1557
  await this.rel.require(db === "majors" ? "majors.stream" : "results.stream");
1540
1558
  const competition = (await this.rel.capability(`${db}.stream.competition`)).state === "full";
1541
- return { db: this.rel.db(db), shape: { competition } };
1559
+ const competitorsPrinted = (await this.rel.capability(`${db}.stream.competitors_printed`)).state === "full";
1560
+ return { db: this.rel.db(db), shape: { competition, competitorsPrinted } };
1542
1561
  }
1543
1562
  async* stream(q) {
1544
1563
  const { db, shape } = await this.streamDb(q);
@@ -2221,12 +2240,16 @@ class DancerResolver2 {
2221
2240
  await this.rel.fetch("results");
2222
2241
  await this.rel.require("dancers.years");
2223
2242
  const db = this.rel.db("results");
2224
- const sql = "SELECT dancer_id, year, region, region_source, nationals, nationals_source, geohash FROM dancer_years";
2243
+ const printed = (await this.rel.capability("dancers.years.printed")).state === "full";
2244
+ const sql = `SELECT dancer_id, year, region, region_source, nationals, nationals_source, geohash${printed ? ", printed_regions" : ""} FROM dancer_years`;
2225
2245
  const yearSql = q.year === undefined ? "" : " AND year = ?";
2226
2246
  const yearArgs = q.year === undefined ? [] : [q.year];
2227
2247
  const rows = q.ids === undefined ? db.query(`${sql} WHERE 1${yearSql} ORDER BY dancer_id, year`).all(...yearArgs) : idChunks(q.ids).flatMap((c) => db.query(`${sql} WHERE dancer_id IN (${c.map(() => "?").join(",")})${yearSql}`).all(...c, ...yearArgs));
2228
2248
  rows.sort((a, b) => a.dancer_id - b.dancer_id || a.year - b.year);
2229
- return { tag: this.rel.tag, years: rows };
2249
+ return {
2250
+ tag: this.rel.tag,
2251
+ years: rows.map(({ printed_regions: codes, ...y }) => codes === undefined ? y : { ...y, printed_regions: codes === "" ? [] : codes.split(",") })
2252
+ };
2230
2253
  }
2231
2254
  async resolve(q) {
2232
2255
  const db = await this.rel.indexDb("dancers");
package/dist/cli.js CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  latestCheck2,
22
22
  within,
23
23
  staleWarning2
24
- } from "./chunks/index-z9zxdmw5.js";
24
+ } from "./chunks/index-bs939h4v.js";
25
25
  import"./chunks/index-hghdy980.js";
26
26
 
27
27
  var USAGE_HEADER = "usage: idq <verb> [--cache <dir>] [--repo <owner/name>] [--json] [--live]";
package/dist/index.js CHANGED
@@ -80,7 +80,7 @@ import {
80
80
  readLatestCheck2,
81
81
  latestCheck2,
82
82
  staleWarning2
83
- } from "./chunks/index-z9zxdmw5.js";
83
+ } from "./chunks/index-bs939h4v.js";
84
84
  import {
85
85
  cacheRoot2,
86
86
  repoOf2
@@ -204,6 +204,7 @@ export interface DancerYear {
204
204
  nationals: string | null;
205
205
  nationals_source: string | null;
206
206
  geohash: string | null;
207
+ printed_regions?: string[];
207
208
  }
208
209
  export declare class DancerResolver {
209
210
  private readonly rel;
@@ -18,6 +18,7 @@ export interface StreamCompetition {
18
18
  recalled_only: boolean;
19
19
  comp_flags: number;
20
20
  competitors_basis: string | null;
21
+ competitors_printed?: number | null;
21
22
  }
22
23
  export interface StreamRow extends Partial<StreamCompetition> {
23
24
  address: string;
@@ -70,6 +71,7 @@ export interface EntryRow extends StreamRow {
70
71
  export declare function entryRank(section: string): number;
71
72
  export interface StreamShape {
72
73
  competition?: boolean;
74
+ competitorsPrinted?: boolean;
73
75
  }
74
76
  export declare const scopeDb: (s: StreamScope) => "majors" | "results";
75
77
  export declare function streamSql(q: StreamQuery, shape?: StreamShape): {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finbheara/archive-client",
3
- "version": "0.38.0",
3
+ "version": "0.40.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",