@finbheara/archive-client 0.36.0 → 0.38.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 +28 -6
- package/dist/chunks/{index-c08q1b0d.js → index-z9zxdmw5.js} +44 -27
- package/dist/cli.js +77 -15
- package/dist/index.js +1 -1
- package/dist/types/calendar.d.ts +4 -0
- package/dist/types/cli.d.ts +1 -0
- package/dist/types/dancers.d.ts +1 -0
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -104,6 +104,7 @@ c.features; // [{ feature: "dancers", state: "full" | "missing", missing: [...
|
|
|
104
104
|
| `calendar.expected` | each calendar stage's `expected`; absent, never refused, without it | 320 |
|
|
105
105
|
| `calendar.next` | `calendar.next` | 320 |
|
|
106
106
|
| `calendar.missing` | `calendar.missing` | 320 |
|
|
107
|
+
| `calendar.filed` | the `filed` of `calendar.missing`; empty, never refused, without it | 320 |
|
|
107
108
|
| `tabs`, `panels` | `tabs.query`, `tabs.stream`; `panels.query` | 184 |
|
|
108
109
|
| `feis-panels` | `feisPanels.query` | 260 |
|
|
109
110
|
| `staff.adjudicators` | `staff.adjudicators` | 230 |
|
|
@@ -324,6 +325,8 @@ r.initials; // an initials-only name with a school: { open, heldByDanceUp, re
|
|
|
324
325
|
r.unlinked; // rows printing a matched name that the release linked to no dancer
|
|
325
326
|
|
|
326
327
|
await rel.dancers.search({ surname: "Quellan" }); // or { like: "a* quellan" }, or { name }
|
|
328
|
+
// at most `limit` (default 50, 0 for all);
|
|
329
|
+
// `truncated` counts the rest
|
|
327
330
|
await rel.dancers.get(1001); // every print and school of one dancer
|
|
328
331
|
```
|
|
329
332
|
|
|
@@ -509,6 +512,9 @@ await rel.majors.competitions({ event: "<event>", year: 2023 });
|
|
|
509
512
|
await rel.majors.results({ dancer_id: 1001 }); // a dancer's majors
|
|
510
513
|
```
|
|
511
514
|
|
|
515
|
+
A query keeps at most `limit` rows (default 500; `0` is no limit) and `truncated` says how many
|
|
516
|
+
more there were. Check it is `0` before reading the rows as the whole answer.
|
|
517
|
+
|
|
512
518
|
A row carries the prints and the ids that stand for them: the address, the competition's title
|
|
513
519
|
and age, the place, the name and school as printed with the dancer and school ids. The majors are
|
|
514
520
|
read from `majors.sqlite`, fetched on first use.
|
|
@@ -776,7 +782,7 @@ const n = await rel.calendar.next({ brand: "plf" });
|
|
|
776
782
|
const m = await rel.calendar.missing({ stage: "results", kind: "platform-host" });
|
|
777
783
|
// stage, platform, tier, kind; { items: [{ item_id, stage, feis_instance_id, kind,
|
|
778
784
|
// platform, expected, expected_basis, expected_n, grace_days, due, overdue_days,
|
|
779
|
-
// hosts: [{ source, feis_id, url }], ... }], deferred }
|
|
785
|
+
// hosts: [{ source, feis_id, url }], ... }], filed: [{ ..., filed }], deferred }
|
|
780
786
|
```
|
|
781
787
|
|
|
782
788
|
ONE ROW PER FEIS INSTANCE, on the id its results carry: a feis-series instance (`<brand>.<year>`),
|
|
@@ -817,7 +823,9 @@ instance, or a feis-index listing no instance holds (`feis_instance_id` null, `i
|
|
|
817
823
|
occurrence id). `kind` is `platform-host` (a capture platform lists it, so a scrape of it should
|
|
818
824
|
bring it) or `listing-only` (only a calendar listing names it, no capture platform, and its results
|
|
819
825
|
may be published nowhere capture reads). A stage a capture's not-found record defers is not listed:
|
|
820
|
-
`deferred` counts those. A
|
|
826
|
+
`deferred` counts those. A stage already in a filed capture ticket (`calendar.filed`, the publisher's
|
|
827
|
+
filed record) is not in `items` either: `filed` lists it with its ticket (`owner/repo#N`), and it is
|
|
828
|
+
never counted against the threshold a capture epic is drafted over. A worklist, never an error.
|
|
821
829
|
|
|
822
830
|
## Teachers and adjudicators
|
|
823
831
|
|
|
@@ -972,9 +980,9 @@ is passed to the dancer resolver as asked (`rel.dancers`, above).
|
|
|
972
980
|
idq dancer [--release <spec>] <name> | --surname <s> | --like <glob> | --id <dancer_id>
|
|
973
981
|
[--order surname-first|given-first] [--school <print|id>]
|
|
974
982
|
[--yob <y> | --band <band> [--year <y>] | --comp <competition>] [--as-of <date>]
|
|
975
|
-
[--population girls|boys] [--oireachtas <region>[:<year>]] [--rows]
|
|
983
|
+
[--population girls|boys] [--oireachtas <region>[:<year>]] [--rows] [--limit <n>]
|
|
976
984
|
idq results [--release <spec>] [--dancer <id>] [--feis <id>] [--comp <c>] [--school <s>] [--year <y>] [--limit <n>]
|
|
977
|
-
idq majors [--release <spec>] [--event <e>] [--year <y>] [--comp <c>] [--dancer <id>] [--rows]
|
|
985
|
+
idq majors [--release <spec>] [--event <e>] [--year <y>] [--comp <c>] [--dancer <id>] [--rows] [--limit <n>]
|
|
978
986
|
idq stream [--release <spec>] --scope majors|transcribed|platform|all [--entries] [--event <e,...>]
|
|
979
987
|
[--year <y> | --year <from>..<to>] [--tier <t,...>] [--category <c,...>]
|
|
980
988
|
[--level <n,...>] [--dancer <id,...>] [--school <school_id>] [--primary]
|
|
@@ -1009,9 +1017,20 @@ is passed to the dancer resolver as asked (`rel.dancers`, above).
|
|
|
1009
1017
|
idq resolve dancer [<name>] [--school s] [--comp <feis>/<code> | --yob y | --band b --year y]
|
|
1010
1018
|
[--oireachtas <region>[:<year>]]
|
|
1011
1019
|
idq resolve registrations
|
|
1020
|
+
idq resolve teacher|adjudicator [<name|TD number>]
|
|
1012
1021
|
|
|
1013
1022
|
`stream` (and `tabs --stream`) prints one JSON line per row (or entry, or cell), as it reads them. `dancer` prints the results of the one dancer where the answer is unique (every candidate's with
|
|
1014
|
-
`--rows`). `--json` prints the call's answer as it is.
|
|
1023
|
+
`--rows`), and `--id` every row of the one dancer. `--json` prints the call's answer as it is.
|
|
1024
|
+
|
|
1025
|
+
A LIMIT THAT CUTS AN ANSWER SAYS SO. `results`, `majors --comp|--dancer` (500 rows) and a
|
|
1026
|
+
`dancer` search (50 candidates) take `--limit <n>`, and `--limit 0` is no limit. Where the limit
|
|
1027
|
+
cut the answer, one line goes to stderr, in text and `--json` alike, and stdout is unchanged:
|
|
1028
|
+
|
|
1029
|
+
answered 500 of 979 rows: pass --limit 979 (or --limit 0 for all) for the rest
|
|
1030
|
+
|
|
1031
|
+
A `dancer` search prints the same line of its candidates, and each trajectory it reads (one per
|
|
1032
|
+
candidate, 500 rows each) that was cut prints `answered 500 of 979 rows of dancer <id>: pass --id
|
|
1033
|
+
<id> for all of them`. `--cache` and `--repo` override the defaults.
|
|
1015
1034
|
|
|
1016
1035
|
`update` moves to the newest published release, as a package manager's `update` moves to the newest
|
|
1017
1036
|
version: it fetches it (verified as every download is), builds every index it knows, and only then
|
|
@@ -1058,7 +1077,10 @@ only when the release is published: `teams`, `events`) answers from the pinned r
|
|
|
1058
1077
|
`resolve` speaks JSON lines: one answer per line out, and with no positional question the
|
|
1059
1078
|
questions are JSON lines on stdin, one per line (`{feis, code, year?, title?}`,
|
|
1060
1079
|
`{name, school?, age?, population?, oireachtas?}`,
|
|
1061
|
-
`{name, school?, codes, feis, year?, population?, oireachtas?}
|
|
1080
|
+
`{name, school?, codes, feis, year?, population?, oireachtas?}`, and for `teacher` and
|
|
1081
|
+
`adjudicator` `{name}` or the TD number under the key `StaffPerson` carries it in, the number read
|
|
1082
|
+
first where a line has both, each answered by `rel.staff.teacher` / `rel.staff.adjudicator`, one
|
|
1083
|
+
`StaffAnswer` a line). A line that is no JSON object,
|
|
1062
1084
|
or no question of its kind, answers `{tag, line, error}` and the other lines still answer. The
|
|
1063
1085
|
exit is non-zero where any line erred. A dancer's age may be given as a comp
|
|
1064
1086
|
(`{"comp": "<feis>/<code>"}`, or `--comp` on the command line): `rel.registrations.dancer` reads
|
|
@@ -769,6 +769,12 @@ var FEATURES2 = [
|
|
|
769
769
|
since: 320,
|
|
770
770
|
calls: "calendar.missing"
|
|
771
771
|
},
|
|
772
|
+
{
|
|
773
|
+
feature: "calendar.filed",
|
|
774
|
+
needs: ["results:feis_calendar_missing.deferred_kind"],
|
|
775
|
+
since: 320,
|
|
776
|
+
calls: "calendar.missing's `filed` (empty, never refused, without it)"
|
|
777
|
+
},
|
|
772
778
|
{
|
|
773
779
|
feature: "upcoming.entrants",
|
|
774
780
|
needs: [
|
|
@@ -1496,7 +1502,7 @@ function queryResults(rel, db, q) {
|
|
|
1496
1502
|
where.push("c.year = ?");
|
|
1497
1503
|
args.push(q.year);
|
|
1498
1504
|
}
|
|
1499
|
-
const
|
|
1505
|
+
const asked = q.limit ?? 500;
|
|
1500
1506
|
const all = rel.db(db).query(`SELECT ${COLUMNS2} FROM results r JOIN competitions c ON c.file = r.file AND c.line = r.competition_line
|
|
1501
1507
|
WHERE ${where.join(" AND ")}
|
|
1502
1508
|
ORDER BY c.year, c.event, r.competition, r.place IS NULL, r.place, r.address`).all(...args);
|
|
@@ -1504,11 +1510,11 @@ function queryResults(rel, db, q) {
|
|
|
1504
1510
|
tag: rel.tag,
|
|
1505
1511
|
db,
|
|
1506
1512
|
asked: q,
|
|
1507
|
-
rows: all.slice(0,
|
|
1513
|
+
rows: (asked === 0 ? all : all.slice(0, asked)).map((r) => ({
|
|
1508
1514
|
...r,
|
|
1509
1515
|
dancer_scope: r.dancer_id === null ? null : r.dancer_id >= FEIS_LOCAL_ID_FLOOR2 ? "per-release" : "stable"
|
|
1510
1516
|
})),
|
|
1511
|
-
truncated: Math.max(0, all.length -
|
|
1517
|
+
truncated: asked === 0 ? 0 : Math.max(0, all.length - asked)
|
|
1512
1518
|
};
|
|
1513
1519
|
}
|
|
1514
1520
|
|
|
@@ -2231,6 +2237,7 @@ class DancerResolver2 {
|
|
|
2231
2237
|
asked: q,
|
|
2232
2238
|
arm: "none",
|
|
2233
2239
|
candidates: [],
|
|
2240
|
+
truncated: 0,
|
|
2234
2241
|
excluded: [],
|
|
2235
2242
|
unlinked: [],
|
|
2236
2243
|
refused: asked.printsNoName() ? "the print names no person" : "the print reads as no person (a bare word is a surname: search it)"
|
|
@@ -2342,7 +2349,13 @@ class DancerResolver2 {
|
|
|
2342
2349
|
return this.capped(a, q.limit);
|
|
2343
2350
|
}
|
|
2344
2351
|
capped(a, limit = 50) {
|
|
2345
|
-
|
|
2352
|
+
if (limit === 0 || a.candidates.length <= limit)
|
|
2353
|
+
return a;
|
|
2354
|
+
return {
|
|
2355
|
+
...a,
|
|
2356
|
+
candidates: a.candidates.slice(0, limit),
|
|
2357
|
+
truncated: a.candidates.length - limit
|
|
2358
|
+
};
|
|
2346
2359
|
}
|
|
2347
2360
|
async get(dancerId) {
|
|
2348
2361
|
const db = await this.rel.indexDb("dancers");
|
|
@@ -2600,6 +2613,7 @@ class DancerResolver2 {
|
|
|
2600
2613
|
asked: q,
|
|
2601
2614
|
arm: kept.length === 0 ? "none" : kept.length === 1 ? "unique" : "ambiguous",
|
|
2602
2615
|
candidates: kept,
|
|
2616
|
+
truncated: 0,
|
|
2603
2617
|
excluded,
|
|
2604
2618
|
...preferred !== undefined ? { preferred } : {},
|
|
2605
2619
|
unlinked: [...unlinked].map(([print, rows]) => ({ print, rows })).sort((a, b) => b.rows - a.rows || (a.print < b.print ? -1 : 1)),
|
|
@@ -4014,31 +4028,34 @@ class CalendarFinder2 {
|
|
|
4014
4028
|
const rows = db.query(`SELECT * FROM feis_calendar_missing${where.length === 0 ? "" : ` WHERE ${where.join(" AND ")}`}
|
|
4015
4029
|
ORDER BY CASE stage WHEN 'results' THEN 0 ELSE 1 END,
|
|
4016
4030
|
CASE kind WHEN 'platform-host' THEN 0 ELSE 1 END, platform, due, item_id`).all(...args);
|
|
4017
|
-
const
|
|
4031
|
+
const isDeferred = (r) => r.deferred !== null && r.deferred !== undefined;
|
|
4032
|
+
const isFiled = (r) => isDeferred(r) && r.deferred_kind === "filed";
|
|
4033
|
+
const item = (r) => ({
|
|
4034
|
+
item_id: r.item_id,
|
|
4035
|
+
stage: r.stage,
|
|
4036
|
+
feis_instance_id: r.feis_instance_id ?? null,
|
|
4037
|
+
feis_brand_id: r.feis_brand_id ?? null,
|
|
4038
|
+
tier: r.tier,
|
|
4039
|
+
name_printed: r.name_printed ?? null,
|
|
4040
|
+
date_lo: r.date_lo ?? null,
|
|
4041
|
+
date_hi: r.date_hi ?? null,
|
|
4042
|
+
occurrence_ids: json(r.occurrence_ids, []),
|
|
4043
|
+
feis_ids: json(r.feis_ids, []),
|
|
4044
|
+
kind: r.kind,
|
|
4045
|
+
platform: r.platform,
|
|
4046
|
+
expected: r.expected,
|
|
4047
|
+
expected_basis: r.expected_basis,
|
|
4048
|
+
expected_n: r.expected_n === null || r.expected_n === undefined ? null : Number(r.expected_n),
|
|
4049
|
+
grace_days: Number(r.grace_days),
|
|
4050
|
+
due: r.due,
|
|
4051
|
+
overdue_days: Number(r.overdue_days),
|
|
4052
|
+
hosts: json(r.hosts, [])
|
|
4053
|
+
});
|
|
4018
4054
|
return {
|
|
4019
4055
|
tag: this.rel.tag,
|
|
4020
|
-
items:
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
feis_instance_id: r.feis_instance_id ?? null,
|
|
4024
|
-
feis_brand_id: r.feis_brand_id ?? null,
|
|
4025
|
-
tier: r.tier,
|
|
4026
|
-
name_printed: r.name_printed ?? null,
|
|
4027
|
-
date_lo: r.date_lo ?? null,
|
|
4028
|
-
date_hi: r.date_hi ?? null,
|
|
4029
|
-
occurrence_ids: json(r.occurrence_ids, []),
|
|
4030
|
-
feis_ids: json(r.feis_ids, []),
|
|
4031
|
-
kind: r.kind,
|
|
4032
|
-
platform: r.platform,
|
|
4033
|
-
expected: r.expected,
|
|
4034
|
-
expected_basis: r.expected_basis,
|
|
4035
|
-
expected_n: r.expected_n === null || r.expected_n === undefined ? null : Number(r.expected_n),
|
|
4036
|
-
grace_days: Number(r.grace_days),
|
|
4037
|
-
due: r.due,
|
|
4038
|
-
overdue_days: Number(r.overdue_days),
|
|
4039
|
-
hosts: json(r.hosts, [])
|
|
4040
|
-
})),
|
|
4041
|
-
deferred: rows.length - live.length
|
|
4056
|
+
items: rows.filter((r) => !isDeferred(r)).map(item),
|
|
4057
|
+
filed: rows.filter(isFiled).map((r) => ({ ...item(r), filed: r.deferred })),
|
|
4058
|
+
deferred: rows.filter((r) => isDeferred(r) && !isFiled(r)).length
|
|
4042
4059
|
};
|
|
4043
4060
|
}
|
|
4044
4061
|
async get(id) {
|
package/dist/cli.js
CHANGED
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
latestCheck2,
|
|
22
22
|
within,
|
|
23
23
|
staleWarning2
|
|
24
|
-
} from "./chunks/index-
|
|
24
|
+
} from "./chunks/index-z9zxdmw5.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]";
|
|
@@ -199,20 +199,23 @@ var VERBS = [
|
|
|
199
199
|
"--comp",
|
|
200
200
|
"--as-of",
|
|
201
201
|
"--population",
|
|
202
|
-
"--oireachtas"
|
|
202
|
+
"--oireachtas",
|
|
203
|
+
"--limit"
|
|
203
204
|
],
|
|
204
205
|
bool: ["--rows"],
|
|
205
206
|
usage: [
|
|
206
207
|
" dancer [--release <spec>] <name> | --surname <s> | --like <glob> | --id <dancer_id>",
|
|
207
208
|
" [--order surname-first|given-first] [--school <print|id>]",
|
|
208
209
|
" [--yob <y> | --band <U10> [--year <y>] | --comp <competition>] [--as-of <date>]",
|
|
209
|
-
" [--population girls|boys] [--oireachtas <region>[:<year>]] [--rows]",
|
|
210
|
+
" [--population girls|boys] [--oireachtas <region>[:<year>]] [--rows] [--limit <n>]",
|
|
210
211
|
" the dancers a name reaches, each with its evidence",
|
|
211
212
|
" (name level, age, school, population, region) and the arm;",
|
|
212
213
|
" --oireachtas is the regional the roster is for, its region in",
|
|
213
214
|
" the release's spelling (SRO, MAO), its year the --as-of year",
|
|
214
215
|
" where none is given; the results of",
|
|
215
|
-
" the one dancer where one answers (or --rows for each
|
|
216
|
+
" the one dancer where one answers (or --rows for each, 500",
|
|
217
|
+
" rows a dancer; --id reads every row); at most --limit",
|
|
218
|
+
" candidates (default 50, 0 for all)"
|
|
216
219
|
]
|
|
217
220
|
},
|
|
218
221
|
{
|
|
@@ -222,17 +225,20 @@ var VERBS = [
|
|
|
222
225
|
usage: [
|
|
223
226
|
" results [--release <spec>] [--dancer <id>] [--feis <id>] [--comp <competition>]",
|
|
224
227
|
" [--school <print|id>] [--year <y>] [--limit <n>]",
|
|
225
|
-
" the published result rows, prints and ids"
|
|
228
|
+
" the published result rows, prints and ids; at most",
|
|
229
|
+
" --limit rows (default 500, 0 for all)"
|
|
226
230
|
]
|
|
227
231
|
},
|
|
228
232
|
{
|
|
229
233
|
verb: "majors",
|
|
230
|
-
value: ["--release", "--event", "--year", "--comp", "--dancer"],
|
|
234
|
+
value: ["--release", "--event", "--year", "--comp", "--dancer", "--limit"],
|
|
231
235
|
bool: [],
|
|
232
236
|
usage: [
|
|
233
237
|
" majors [--release <spec>] [--event <e>] [--year <y>] [--comp <competition>] [--dancer <id>]",
|
|
238
|
+
" [--limit <n>]",
|
|
234
239
|
" the majors: every event and its years; an event's",
|
|
235
|
-
" competitions; a competition's, an event's or a dancer's rows"
|
|
240
|
+
" competitions; a competition's, an event's or a dancer's rows",
|
|
241
|
+
" (at most --limit, default 500, 0 for all)"
|
|
236
242
|
]
|
|
237
243
|
},
|
|
238
244
|
{
|
|
@@ -424,7 +430,8 @@ var VERBS = [
|
|
|
424
430
|
" [--kind platform-host|listing-only]",
|
|
425
431
|
" the stages past their expected day plus the platform's",
|
|
426
432
|
" grace, the run in the last 365 days: hosts, urls, expected",
|
|
427
|
-
" day, grace and days overdue; the
|
|
433
|
+
" day, grace and days overdue; the filed (a capture ticket",
|
|
434
|
+
" names them) and the deferred counted apart"
|
|
428
435
|
]
|
|
429
436
|
},
|
|
430
437
|
{
|
|
@@ -490,11 +497,15 @@ var VERBS = [
|
|
|
490
497
|
" [--order <o>] [--as-of <date>] [--population girls|boys]",
|
|
491
498
|
" [--oireachtas <region>[:<year>]]",
|
|
492
499
|
" resolve registrations",
|
|
500
|
+
" resolve teacher|adjudicator [<name|TD number>]",
|
|
493
501
|
" JSONL out, one answer per line; with no positional the",
|
|
494
502
|
" questions are JSONL on stdin, one per line (a comp:",
|
|
495
503
|
" {feis, code, year?, title?}, a dancer: {name, school?, age?,",
|
|
496
504
|
" population?, oireachtas?}, a registration: {name, school?,",
|
|
497
|
-
" codes[], feis, year?, population?, oireachtas?}
|
|
505
|
+
" codes[], feis, year?, population?, oireachtas?}, a teacher or",
|
|
506
|
+
" adjudicator: {clrg} or {name}, the TD number first)",
|
|
507
|
+
" A line that is no question answers {tag, line, error}, and",
|
|
508
|
+
" the exit is 1 where any line erred"
|
|
498
509
|
]
|
|
499
510
|
}
|
|
500
511
|
];
|
|
@@ -599,6 +610,21 @@ function printResults(a, say) {
|
|
|
599
610
|
say(" * a feis-local dancer id: valid in this release only");
|
|
600
611
|
say(`${a.rows.length} row(s) from ${a.db} in ${a.tag}${a.truncated > 0 ? `, ${a.truncated} more past the limit` : ""}`);
|
|
601
612
|
}
|
|
613
|
+
function cutNotice(shown, more, what = "rows") {
|
|
614
|
+
if (more <= 0)
|
|
615
|
+
return null;
|
|
616
|
+
const total = shown + more;
|
|
617
|
+
return `answered ${shown} of ${total} ${what}: pass --limit ${total} (or --limit 0 for all) for the rest`;
|
|
618
|
+
}
|
|
619
|
+
function limitOf(p) {
|
|
620
|
+
const v = p.flags.get("--limit");
|
|
621
|
+
if (v === undefined)
|
|
622
|
+
return {};
|
|
623
|
+
const n = Number(v);
|
|
624
|
+
if (!Number.isInteger(n) || n < 0)
|
|
625
|
+
throw new Error(`--limit takes a count (0 for no limit), not "${v}"`);
|
|
626
|
+
return { limit: n };
|
|
627
|
+
}
|
|
602
628
|
function printStaff(a, say) {
|
|
603
629
|
say(`${a.arm} ${a.role} "${a.asked}" in ${a.tag}${a.refused !== undefined ? ` (refused: ${a.refused})` : ""}`);
|
|
604
630
|
for (const p of a.people) {
|
|
@@ -660,6 +686,14 @@ function oireachtasFlag(v) {
|
|
|
660
686
|
};
|
|
661
687
|
}
|
|
662
688
|
var checkDancer = (q) => typeof q.name !== "string" || q.name.trim() === "" ? "a dancer question needs name" : null;
|
|
689
|
+
function staffAsked(q) {
|
|
690
|
+
if (q.clrg !== undefined && q.clrg !== null) {
|
|
691
|
+
const n = typeof q.clrg === "string" && q.clrg.trim() !== "" ? Number(q.clrg) : q.clrg;
|
|
692
|
+
return typeof n === "number" && Number.isInteger(n) && n > 0 ? String(n) : null;
|
|
693
|
+
}
|
|
694
|
+
return typeof q.name === "string" && q.name.trim() !== "" ? q.name.trim() : null;
|
|
695
|
+
}
|
|
696
|
+
var checkStaff = (q) => q.clrg !== undefined && q.clrg !== null && staffAsked(q) === null ? "a staff question's clrg is a TD number" : staffAsked(q) === null ? "a staff question needs name or clrg" : null;
|
|
663
697
|
var checkRegistration = (r) => typeof r.name !== "string" || r.name.trim() === "" ? "a registration row needs name" : typeof r.feis !== "string" || r.feis.trim() === "" ? "a registration row needs feis" : !Array.isArray(r.codes) ? "a registration row needs codes[]" : null;
|
|
664
698
|
async function resolveVerb(rel, what, args, p, say, stdin) {
|
|
665
699
|
const year = p.flags.has("--year") ? Number(p.flags.get("--year")) : undefined;
|
|
@@ -742,8 +776,21 @@ async function resolveVerb(rel, what, args, p, say, stdin) {
|
|
|
742
776
|
await each(lines, async () => answers[k++]);
|
|
743
777
|
return errors > 0 ? 1 : 0;
|
|
744
778
|
}
|
|
779
|
+
case "teacher":
|
|
780
|
+
case "adjudicator": {
|
|
781
|
+
const qs = args.length > 0 ? [{ line: 0, value: { name: args.join(" ") } }] : jsonLines(await stdin(), checkStaff);
|
|
782
|
+
let none = 0;
|
|
783
|
+
await each(qs, async (q) => {
|
|
784
|
+
const asked = staffAsked(q);
|
|
785
|
+
const a = what === "teacher" ? await rel.staff.teacher(asked) : await rel.staff.adjudicator(asked);
|
|
786
|
+
if (a.arm === "none")
|
|
787
|
+
none++;
|
|
788
|
+
return a;
|
|
789
|
+
});
|
|
790
|
+
return errors > 0 || args.length > 0 && none === 1 ? 1 : 0;
|
|
791
|
+
}
|
|
745
792
|
default:
|
|
746
|
-
throw new Error("resolve comp|dancer|registrations");
|
|
793
|
+
throw new Error("resolve comp|dancer|registrations|teacher|adjudicator");
|
|
747
794
|
}
|
|
748
795
|
}
|
|
749
796
|
var SCOPES = ["majors", "transcribed", "platform", "all"];
|
|
@@ -1129,7 +1176,7 @@ async function main(argv, io = {}) {
|
|
|
1129
1176
|
const id = p.flags.get("--id");
|
|
1130
1177
|
if (id !== undefined) {
|
|
1131
1178
|
const d = await rel.dancers.get(Number(id));
|
|
1132
|
-
const rows = d === null ? null : await rel.results.query({ dancer_id: d.dancer_id });
|
|
1179
|
+
const rows = d === null ? null : await rel.results.query({ dancer_id: d.dancer_id, limit: 0 });
|
|
1133
1180
|
out({ dancer: d, results: rows }, () => {
|
|
1134
1181
|
if (d === null) {
|
|
1135
1182
|
say(`no dancer ${id} in ${rel.tag}`);
|
|
@@ -1157,7 +1204,7 @@ async function main(argv, io = {}) {
|
|
|
1157
1204
|
...p.flags.has("--as-of") ? { asOf: p.flags.get("--as-of") } : {},
|
|
1158
1205
|
...p.flags.has("--population") ? { population: p.flags.get("--population") } : {},
|
|
1159
1206
|
...oireachtasFlag(p.flags.get("--oireachtas")),
|
|
1160
|
-
...
|
|
1207
|
+
...limitOf(p)
|
|
1161
1208
|
};
|
|
1162
1209
|
const surname = p.flags.get("--surname");
|
|
1163
1210
|
const like = p.flags.get("--like");
|
|
@@ -1177,6 +1224,12 @@ async function main(argv, io = {}) {
|
|
|
1177
1224
|
printResults(t, say);
|
|
1178
1225
|
}
|
|
1179
1226
|
});
|
|
1227
|
+
const cut = cutNotice(a.candidates.length, a.truncated, "candidates");
|
|
1228
|
+
if (cut !== null)
|
|
1229
|
+
log(cut);
|
|
1230
|
+
for (const t of trajectories)
|
|
1231
|
+
if (t.truncated > 0)
|
|
1232
|
+
log(`answered ${t.rows.length} of ${t.rows.length + t.truncated} rows of dancer ${t.asked.dancer_id}: pass --id ${t.asked.dancer_id} for all of them`);
|
|
1180
1233
|
return a.candidates.length === 0 ? 1 : 0;
|
|
1181
1234
|
} finally {
|
|
1182
1235
|
rel.close();
|
|
@@ -1191,10 +1244,13 @@ async function main(argv, io = {}) {
|
|
|
1191
1244
|
...p.flags.has("--comp") ? { competition: p.flags.get("--comp") } : {},
|
|
1192
1245
|
...p.flags.has("--school") ? { school_id: await schoolIdOf(rel, p.flags.get("--school")) } : {},
|
|
1193
1246
|
...p.flags.has("--year") ? { year: Number(p.flags.get("--year")) } : {},
|
|
1194
|
-
...
|
|
1247
|
+
...limitOf(p)
|
|
1195
1248
|
};
|
|
1196
1249
|
const a = await rel.results.query(q);
|
|
1197
1250
|
out(a, () => printResults(a, say));
|
|
1251
|
+
const cut = cutNotice(a.rows.length, a.truncated);
|
|
1252
|
+
if (cut !== null)
|
|
1253
|
+
log(cut);
|
|
1198
1254
|
return a.rows.length === 0 ? 1 : 0;
|
|
1199
1255
|
} finally {
|
|
1200
1256
|
rel.close();
|
|
@@ -1213,9 +1269,12 @@ async function main(argv, io = {}) {
|
|
|
1213
1269
|
...dancer !== undefined ? { dancer_id: Number(dancer) } : {},
|
|
1214
1270
|
...event !== undefined ? { feis: event } : {},
|
|
1215
1271
|
...year !== undefined ? { year: Number(year) } : {},
|
|
1216
|
-
...
|
|
1272
|
+
...limitOf(p)
|
|
1217
1273
|
});
|
|
1218
1274
|
out(a, () => printResults(a, say));
|
|
1275
|
+
const cut = cutNotice(a.rows.length, a.truncated);
|
|
1276
|
+
if (cut !== null)
|
|
1277
|
+
log(cut);
|
|
1219
1278
|
return a.rows.length === 0 ? 1 : 0;
|
|
1220
1279
|
}
|
|
1221
1280
|
if (event !== undefined) {
|
|
@@ -1591,7 +1650,9 @@ async function main(argv, io = {}) {
|
|
|
1591
1650
|
for (const h of m.hosts)
|
|
1592
1651
|
say(` ${h.source} ${h.feis_id ?? "-"} ${h.url ?? "-"}`);
|
|
1593
1652
|
}
|
|
1594
|
-
|
|
1653
|
+
for (const m of a.filed)
|
|
1654
|
+
say(` ${m.due} ${m.item_id} ${m.stage} ${m.kind} ${m.platform} run ${m.date_lo ?? "?"} FILED ${m.filed}${m.name_printed !== null ? ` "${m.name_printed}"` : ""}`);
|
|
1655
|
+
say(`${a.items.length} missing, ${a.filed.length} filed, ${a.deferred} deferred, in ${a.tag}`);
|
|
1595
1656
|
});
|
|
1596
1657
|
return a.items.length === 0 ? 1 : 0;
|
|
1597
1658
|
}
|
|
@@ -1739,6 +1800,7 @@ export {
|
|
|
1739
1800
|
USAGE_FOOTER,
|
|
1740
1801
|
USAGE_HEADER,
|
|
1741
1802
|
VERBS,
|
|
1803
|
+
cutNotice,
|
|
1742
1804
|
jsonLines,
|
|
1743
1805
|
main,
|
|
1744
1806
|
parseArgs,
|
package/dist/index.js
CHANGED
package/dist/types/calendar.d.ts
CHANGED
|
@@ -93,9 +93,13 @@ export interface CalendarMissingQuery {
|
|
|
93
93
|
tier?: string;
|
|
94
94
|
kind?: CalendarMissingKind;
|
|
95
95
|
}
|
|
96
|
+
export interface CalendarFiled extends CalendarMissing {
|
|
97
|
+
filed: string;
|
|
98
|
+
}
|
|
96
99
|
export interface CalendarMissingAnswer {
|
|
97
100
|
tag: string;
|
|
98
101
|
items: CalendarMissing[];
|
|
102
|
+
filed: CalendarFiled[];
|
|
99
103
|
deferred: number;
|
|
100
104
|
}
|
|
101
105
|
export interface CalendarGetAnswer {
|
package/dist/types/cli.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export interface Parsed {
|
|
|
12
12
|
bools: Set<string>;
|
|
13
13
|
}
|
|
14
14
|
export declare function parseArgs(argv: readonly string[]): Parsed;
|
|
15
|
+
export declare function cutNotice(shown: number, more: number, what?: string): string | null;
|
|
15
16
|
type Line<T> = {
|
|
16
17
|
line: number;
|
|
17
18
|
value: T;
|
package/dist/types/dancers.d.ts
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -26,5 +26,5 @@ export { type EntryRow, type StreamCompetition, type StreamQuery, type StreamRow
|
|
|
26
26
|
export { type FeisPanelSeat, FeisPanelFinder, PanelFinder, type PanelSeat, type RegisterRow, type TabAnswer, TabFinder, type TabQuery, type TabRow, type TabStreamQuery, } from "./tabs.js";
|
|
27
27
|
export { EventFinder, type EventYear, type EventYearQuery, type ResultRoster, type RosterMember, type RosterTeam, TeamFinder, type TeamResult, } from "./teams.js";
|
|
28
28
|
export { type EntrantCandidate, FIELD_STATES, type FieldComp, DEPARTURE_REASONS, type DepartureReason, type FieldState, type HeldOut, type UpcomingDeparture, type UpcomingDepartureAnswer, type UpcomingDepartureQuery, type UpcomingEntrant, type UpcomingEntrantAnswer, type UpcomingEntrantQuery, type UpcomingFeis, type UpcomingFeisAnswer, type UpcomingFeisQuery, type UpcomingFeisState, type UpcomingField, type UpcomingFieldAnswer, type UpcomingFieldQuery, UpcomingFinder, type UpcomingHost, } from "./upcoming.js";
|
|
29
|
-
export { CALENDAR_STAGES, CALENDAR_STAGE_STATES, CALENDAR_TERMINALS, type CalendarAnswer, type CalendarEntry, type CalendarExpected, type CalendarExpectedBasis, type CalendarMissing, type CalendarMissingAnswer, type CalendarMissingHost, type CalendarMissingKind, type CalendarMissingQuery, type CalendarMissingStage, type CalendarNext, type CalendarNextAnswer, CalendarFinder, type CalendarGetAnswer, type CalendarQuery, type CalendarStage, type CalendarStageState, type CalendarStageValue, type CalendarTerminal, } from "./calendar.js";
|
|
29
|
+
export { CALENDAR_STAGES, CALENDAR_STAGE_STATES, CALENDAR_TERMINALS, type CalendarAnswer, type CalendarEntry, type CalendarExpected, type CalendarExpectedBasis, type CalendarFiled, type CalendarMissing, type CalendarMissingAnswer, type CalendarMissingHost, type CalendarMissingKind, type CalendarMissingQuery, type CalendarMissingStage, type CalendarNext, type CalendarNextAnswer, CalendarFinder, type CalendarGetAnswer, type CalendarQuery, type CalendarStage, type CalendarStageState, type CalendarStageValue, type CalendarTerminal, } from "./calendar.js";
|
|
30
30
|
export { ARCHIVE_TAG, type ArchiveTag, type ReleaseSpec, compareTagsNewestFirst, cutOf, parseArchiveTag, parseReleaseSpec, pickTag, renderArchiveTag, } from "./tag.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finbheara/archive-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.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",
|