@finbheara/archive-client 0.29.0 → 0.30.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
@@ -777,7 +777,11 @@ codes, a plausible answer and a wrong one. So an unheld feis-year there answers
777
777
  over the newest earlier syllabus, and a code with no title is `none`, saying why. The code of a
778
778
  held feis-year is still read from that feis-year's own competitions.
779
779
 
780
- A feis the release holds names itself, its year and its series. A series instance or brand id
780
+ A feis the release holds names itself, its year and its series. A platform feis id
781
+ (`<token>:<host>`) the release holds competitions of and no `feises` line names (a source that
782
+ carried a feis's results and not the feis itself) is held too, on its own id and its competitions'
783
+ year (`via: "id"`, as a feis with its line is), its series the one its host code reaches if
784
+ exactly one brand matches the stem, else null. A majors or championship event id is never held so. A series instance or brand id
781
785
  names the series. A feis id the release does not hold is placed in a series by its host code
782
786
  (`<token>:<stem><yy>` where the held codes of that stem carry their own year), and a stem two
783
787
  series share answers `ambiguous`. A host id of digits alone (`qf:926`, `fw:1001`) is a sequence
@@ -2114,6 +2114,7 @@ var entryOf = (c) => ({
2114
2114
  ...c.age !== null ? { age: c.age } : {},
2115
2115
  comp: c
2116
2116
  });
2117
+ var PLATFORM_FEIS_ID = /^[a-z]+:[^:\s]+$/;
2117
2118
 
2118
2119
  class CompResolver2 {
2119
2120
  rel;
@@ -2156,9 +2157,19 @@ class CompResolver2 {
2156
2157
  return this.ofSeries(asked, only, y, "series");
2157
2158
  }
2158
2159
  const m = /^([^:]+):(.*?)(\d{2})$/.exec(asked);
2159
- if (m !== null && !/^\d+$/.test(`${m[2]}${m[3]}`)) {
2160
- const [, token, stem, yy] = m;
2161
- const brands = await this.rel.feises.codeStem(token, stem);
2160
+ const stemmed = m !== null && !/^\d+$/.test(`${m[2]}${m[3]}`);
2161
+ const [, token, stem, yy] = m ?? [];
2162
+ const brands = stemmed ? await this.rel.feises.codeStem(token, stem) : [];
2163
+ const own = PLATFORM_FEIS_ID.test(asked) ? await this.compYears(asked) : [];
2164
+ if (own.length === 1) {
2165
+ const held = own[0];
2166
+ const y = year ?? held;
2167
+ const brand = brands.length === 1 ? brands[0] : null;
2168
+ if (y === held || brand === null)
2169
+ return { asked, feis_ids: [asked], brand_id: brand, year: y, held: y === held, via: "id" };
2170
+ return this.ofSeries(asked, brand, y, "id");
2171
+ }
2172
+ if (stemmed) {
2162
2173
  const y = year ?? 2000 + Number(yy);
2163
2174
  if (brands.length === 1)
2164
2175
  return this.ofSeries(asked, brands[0], y, "code-stem");
@@ -2184,6 +2195,10 @@ class CompResolver2 {
2184
2195
  const ids = year === null ? [] : db.query("SELECT feis_id FROM feis WHERE brand_id = ? AND year = ? ORDER BY feis_id").all(brand, year).map((r) => r.feis_id);
2185
2196
  return { asked, feis_ids: ids, brand_id: brand, year, held: ids.length > 0, via };
2186
2197
  }
2198
+ async compYears(feisId) {
2199
+ const db = await this.rel.indexDb("comps");
2200
+ return db.query("SELECT DISTINCT year FROM comp WHERE feis_id = ? AND year IS NOT NULL ORDER BY year").all(feisId).map((r) => r.year);
2201
+ }
2187
2202
  async years(brand) {
2188
2203
  if (brand === null)
2189
2204
  return [];
package/dist/cli.js CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  latestCheck2,
22
22
  within,
23
23
  staleWarning2
24
- } from "./chunks/index-2sdphw48.js";
24
+ } from "./chunks/index-db578n4y.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
@@ -75,7 +75,7 @@ import {
75
75
  readLatestCheck2,
76
76
  latestCheck2,
77
77
  staleWarning2
78
- } from "./chunks/index-2sdphw48.js";
78
+ } from "./chunks/index-db578n4y.js";
79
79
  import {
80
80
  cacheRoot2,
81
81
  repoOf2
@@ -130,6 +130,7 @@ export declare class CompResolver {
130
130
  constructor(rel: Release);
131
131
  place(feis: string, year?: number): Promise<FeisPlace>;
132
132
  private ofSeries;
133
+ private compYears;
133
134
  private years;
134
135
  private compsOf;
135
136
  private idsOf;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finbheara/archive-client",
3
- "version": "0.29.0",
3
+ "version": "0.30.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",