@finbheara/archive-client 0.21.0 → 0.22.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 +16 -4
- package/dist/chunks/{index-pfsxe80h.js → index-zwecpq08.js} +25 -5
- package/dist/cli.js +27 -10
- package/dist/index.js +3 -1
- package/dist/types/cli.d.ts +1 -1
- package/dist/types/config.d.ts +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/manager.d.ts +23 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -139,13 +139,23 @@ m.unpin();
|
|
|
139
139
|
await m.add("<dir>", "archive-YYYY.MM.DD-N"); // a release built locally, under its own tag
|
|
140
140
|
await m.index("pinned"); // build every index
|
|
141
141
|
m.prune({ keep: 2, dryRun: true }); // the plan: what would go, and its bytes
|
|
142
|
+
await m.use("latest"); // fetch, index, pin, then prune to the newest 2
|
|
142
143
|
m.remove("<tag>"); // refuses the pinned release
|
|
143
144
|
m.dropIndexes(); // the index files only
|
|
144
145
|
await m.verify("<tag>"); // re-hash every cached file against its receipt
|
|
145
146
|
```
|
|
146
147
|
|
|
147
148
|
Every removal answers its plan first (`dryRun`), keeps the pinned release, and touches nothing
|
|
148
|
-
outside the cache root.
|
|
149
|
+
outside the cache root. A release's indexes live under its directory and go with it.
|
|
150
|
+
|
|
151
|
+
THE CACHE KEEPS ITSELF. A release is gigabytes, so a `use` (and so an `update`) that lands its
|
|
152
|
+
release prunes the cache once the pin has moved: it keeps the newest `keep` releases by tag (date,
|
|
153
|
+
cut, fraction), the new pin, and the pin before it, so a reader still on the previous release is
|
|
154
|
+
not cut off. A release fetched with `--release` and never pinned counts like any other. `keep` is
|
|
155
|
+
the call's own (`--keep N`, `use(spec, { keep })`), else the user-local `config keep <N>`, else
|
|
156
|
+
`DEFAULT_KEEP` (2), and a plain `prune` reads the same count. `--no-prune` (`prune: false`) skips
|
|
157
|
+
it, and a fetch or index that fails prunes nothing. The answer carries the plan (`pruned`), and
|
|
158
|
+
the command line prints one line per release removed and the MB freed.
|
|
149
159
|
|
|
150
160
|
## The indexes
|
|
151
161
|
|
|
@@ -707,10 +717,11 @@ is passed to the dancer resolver as asked (`rel.dancers`, above).
|
|
|
707
717
|
## The command line
|
|
708
718
|
|
|
709
719
|
idq config repo <owner/name>
|
|
720
|
+
idq config keep <N>
|
|
710
721
|
idq list [--remote]
|
|
711
722
|
idq fetch [--release <spec>] [--assets results,majors,<file>...]
|
|
712
|
-
idq update [--assets results,majors,<file>...]
|
|
713
|
-
idq use <spec> [--assets results,majors,<file>...]
|
|
723
|
+
idq update [--assets results,majors,<file>...] [--keep N] [--no-prune]
|
|
724
|
+
idq use <spec> [--assets results,majors,<file>...] [--keep N] [--no-prune]
|
|
714
725
|
idq pin <spec> | unpin | current
|
|
715
726
|
idq add <dir> --tag <tag>
|
|
716
727
|
idq index [--release <spec>] [<name>...] [--force]
|
|
@@ -752,7 +763,8 @@ is passed to the dancer resolver as asked (`rel.dancers`, above).
|
|
|
752
763
|
|
|
753
764
|
`update` moves to the newest published release, as a package manager's `update` moves to the newest
|
|
754
765
|
version: it fetches it (verified as every download is), builds every index it knows, and only then
|
|
755
|
-
pins it, so a fetch or index that fails leaves the old pin in force
|
|
766
|
+
pins it, so a fetch or index that fails leaves the old pin in force, and then prunes the cache to
|
|
767
|
+
the newest releases (above: the pin and the one before it always stay). `use <spec>` does the same for
|
|
756
768
|
the release a spec names, older or newer (`releases().use(spec)` in the API; `update` is
|
|
757
769
|
`use("latest")`).
|
|
758
770
|
|
|
@@ -3741,6 +3741,12 @@ function openCached2(tag, opts = {}) {
|
|
|
3741
3741
|
return new Release2(tag, root, JSON.parse(readFileSync3(p, "utf8")), opts);
|
|
3742
3742
|
}
|
|
3743
3743
|
|
|
3744
|
+
var DEFAULT_KEEP2 = 2;
|
|
3745
|
+
function checkKeep(keep) {
|
|
3746
|
+
if (!Number.isInteger(keep) || keep < 0)
|
|
3747
|
+
throw new Error(`prune: --keep ${keep} is not a count`);
|
|
3748
|
+
return keep;
|
|
3749
|
+
}
|
|
3744
3750
|
function duBytes(p) {
|
|
3745
3751
|
if (!existsSync5(p))
|
|
3746
3752
|
return 0;
|
|
@@ -3801,13 +3807,24 @@ class ReleaseManager2 {
|
|
|
3801
3807
|
return pin;
|
|
3802
3808
|
}
|
|
3803
3809
|
async use(spec, o = {}) {
|
|
3810
|
+
const keep = o.prune === false ? null : this.keepCount(o.keep);
|
|
3804
3811
|
const was = readPin2(this.root)?.tag ?? null;
|
|
3805
3812
|
const rel = await this.fetch(spec, o);
|
|
3806
3813
|
const tag = rel.tag;
|
|
3807
3814
|
rel.close();
|
|
3808
3815
|
const { built } = await this.index(tag);
|
|
3809
3816
|
const pin = await this.pin(tag);
|
|
3810
|
-
|
|
3817
|
+
if (keep === null)
|
|
3818
|
+
return { tag, was, pin, built, pruned: null };
|
|
3819
|
+
try {
|
|
3820
|
+
const hold = was === null || was === tag ? [] : [{ tag: was, why: "the pin before this one" }];
|
|
3821
|
+
return { tag, was, pin, built, pruned: this.prune({ keep, hold }) };
|
|
3822
|
+
} catch (e) {
|
|
3823
|
+
return { tag, was, pin, built, pruned: null, pruneError: e.message };
|
|
3824
|
+
}
|
|
3825
|
+
}
|
|
3826
|
+
keepCount(keep) {
|
|
3827
|
+
return checkKeep(keep ?? readConfig2(this.root).keep ?? DEFAULT_KEEP2);
|
|
3811
3828
|
}
|
|
3812
3829
|
unpin() {
|
|
3813
3830
|
return clearPin(this.root);
|
|
@@ -3819,6 +3836,8 @@ class ReleaseManager2 {
|
|
|
3819
3836
|
config(patch) {
|
|
3820
3837
|
if (patch.repo !== undefined)
|
|
3821
3838
|
repoOf2({ ...this.opts, repo: patch.repo });
|
|
3839
|
+
if (patch.keep !== undefined)
|
|
3840
|
+
checkKeep(patch.keep);
|
|
3822
3841
|
return writeConfig2(this.root, patch);
|
|
3823
3842
|
}
|
|
3824
3843
|
readConfig() {
|
|
@@ -3896,16 +3915,17 @@ class ReleaseManager2 {
|
|
|
3896
3915
|
return p;
|
|
3897
3916
|
}
|
|
3898
3917
|
prune(o = {}) {
|
|
3899
|
-
const keep = o.keep
|
|
3900
|
-
if (!Number.isInteger(keep) || keep < 0)
|
|
3901
|
-
throw new Error(`prune: --keep ${keep} is not a count`);
|
|
3918
|
+
const keep = this.keepCount(o.keep);
|
|
3902
3919
|
const pin = readPin2(this.root);
|
|
3903
3920
|
const p = this.plan(o.dryRun ?? false);
|
|
3904
3921
|
this.cachedTags().forEach((tag, i) => {
|
|
3922
|
+
const held = (o.hold ?? []).filter((h) => h.tag === tag).map((h) => h.why);
|
|
3905
3923
|
if (tag === pin?.tag)
|
|
3906
3924
|
p.keep.push({ tag, why: "pinned" });
|
|
3907
3925
|
else if (i < keep)
|
|
3908
3926
|
p.keep.push({ tag, why: `among the ${keep} newest` });
|
|
3927
|
+
else if (held.length > 0)
|
|
3928
|
+
p.keep.push({ tag, why: [...new Set(held)].join("; ") });
|
|
3909
3929
|
else
|
|
3910
3930
|
this.planRemove(p, tagDir(this.root, tag), `older than the ${keep} newest`);
|
|
3911
3931
|
});
|
|
@@ -4035,4 +4055,4 @@ function staleWarning2(answered, latest, floor, tags = [], command = "idq") {
|
|
|
4035
4055
|
return `answered from ${answered}. ${floorTag ?? `cut ${floor.cut}`} is required${why}: run \`${command} use ${floor.cut}\` to get it`;
|
|
4036
4056
|
}
|
|
4037
4057
|
|
|
4038
|
-
export { DATABASES2, planAsset2, sha256File2, unzstdTo2, NAME_LEVELS2, nameLevel2, NO_CALENDAR2, FeisFinder2, ADVANCEMENT_DANCES2, 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, defaultRemote, columnsOf2, FEATURES2, capabilityOf2, needsRelease2, resolveTag2, Release2, openRelease2, openCached2, ReleaseManager2, releases2, LATEST_CHECK_MS2, LATEST_CHECK_BUDGET_MS2, latestCheckPath2, readLatestCheck2, latestCheck2, within, staleWarning2 };
|
|
4058
|
+
export { DATABASES2, planAsset2, sha256File2, unzstdTo2, NAME_LEVELS2, nameLevel2, NO_CALENDAR2, FeisFinder2, ADVANCEMENT_DANCES2, 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, defaultRemote, columnsOf2, FEATURES2, capabilityOf2, needsRelease2, resolveTag2, Release2, openRelease2, openCached2, DEFAULT_KEEP2, ReleaseManager2, releases2, LATEST_CHECK_MS2, LATEST_CHECK_BUDGET_MS2, latestCheckPath2, readLatestCheck2, latestCheck2, within, staleWarning2 };
|
package/dist/cli.js
CHANGED
|
@@ -13,19 +13,24 @@ import {
|
|
|
13
13
|
latestCheck2,
|
|
14
14
|
within,
|
|
15
15
|
staleWarning2
|
|
16
|
-
} from "./chunks/index-
|
|
16
|
+
} from "./chunks/index-zwecpq08.js";
|
|
17
17
|
import"./chunks/index-hghdy980.js";
|
|
18
18
|
|
|
19
19
|
var USAGE = `usage: idq <verb> [--cache <dir>] [--repo <owner/name>] [--json]
|
|
20
20
|
|
|
21
21
|
config repo <owner/name> set the user-local repository the releases come from
|
|
22
|
+
config keep <N> how many of the newest releases a prune keeps (default 2)
|
|
22
23
|
list [--remote] the cached releases (size, files, indexes, the pin), and
|
|
23
24
|
with --remote the published tags
|
|
24
25
|
fetch [--release <spec>] [--assets results,majors,<file>...]
|
|
25
26
|
download, verify and cache a release (default: results)
|
|
26
|
-
update [--assets ...]
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
update [--assets ...] [--keep N] [--no-prune]
|
|
28
|
+
move to the newest published release: fetch it (verified),
|
|
29
|
+
build its indexes, pin it, then prune the cache to the N
|
|
30
|
+
newest releases (default: config keep, else 2), keeping the
|
|
31
|
+
new pin and the one before it
|
|
32
|
+
use <spec> [--assets ...] [--keep N] [--no-prune]
|
|
33
|
+
the same for the release a spec names
|
|
29
34
|
pin <spec> the user-local pin: what a bare open (spec "pinned") opens
|
|
30
35
|
unpin remove the pin (a bare open is then "latest")
|
|
31
36
|
current the pin, and whether it is cached
|
|
@@ -37,8 +42,8 @@ var USAGE = `usage: idq <verb> [--cache <dir>] [--repo <owner/name>] [--json]
|
|
|
37
42
|
capabilities [--release <spec>] what the release carries of what the client reads, from
|
|
38
43
|
its own schema: each feature full or missing (its calls
|
|
39
44
|
refuse, naming the first cut that publishes it)
|
|
40
|
-
prune [--keep N] [--dry-run] remove all but the N newest cached releases (default
|
|
41
|
-
and the pinned one
|
|
45
|
+
prune [--keep N] [--dry-run] remove all but the N newest cached releases (default:
|
|
46
|
+
config keep, else 2) and the pinned one
|
|
42
47
|
rm <tag> [--dry-run] remove one cached release (not the pinned one)
|
|
43
48
|
drop-indexes [<tag>] [--dry-run] remove the index files (of one release, or of every one)
|
|
44
49
|
feis [--release <spec>] [--platform <p>] [--code <c>] [--id <id>] [--name <glob>] [--year <y>]
|
|
@@ -177,6 +182,9 @@ var mb = (n) => `${(n / 1e6).toFixed(1)} MB`;
|
|
|
177
182
|
function printPlan(p, say) {
|
|
178
183
|
for (const k of p.keep)
|
|
179
184
|
say(`keep ${k.tag} (${k.why})`);
|
|
185
|
+
printRemovals(p, say);
|
|
186
|
+
}
|
|
187
|
+
function printRemovals(p, say) {
|
|
180
188
|
for (const r of p.remove)
|
|
181
189
|
say(`${p.dryRun ? "would remove" : "removed"} ${r.path} ${mb(r.bytes)} (${r.why})`);
|
|
182
190
|
say(`${p.dryRun ? "would free" : "freed"} ${mb(p.bytes)}${p.dryRun ? " (dry run: nothing removed)" : ""}`);
|
|
@@ -488,12 +496,12 @@ async function main(argv, io = {}) {
|
|
|
488
496
|
try {
|
|
489
497
|
switch (verb) {
|
|
490
498
|
case "config": {
|
|
491
|
-
if (rest[0] !== "repo" || rest[1] === undefined) {
|
|
499
|
+
if (rest[0] !== "repo" && rest[0] !== "keep" || rest[1] === undefined) {
|
|
492
500
|
out(m.readConfig(), () => say(JSON.stringify(m.readConfig())));
|
|
493
501
|
return rest.length === 0 ? 0 : 2;
|
|
494
502
|
}
|
|
495
|
-
const c = m.config({ repo: rest[1] });
|
|
496
|
-
out(c, () => say(`repo ${c.repo}`));
|
|
503
|
+
const c = rest[0] === "repo" ? m.config({ repo: rest[1] }) : m.config({ keep: Number(rest[1]) });
|
|
504
|
+
out(c, () => say(rest[0] === "repo" ? `repo ${c.repo}` : `keep ${c.keep}`));
|
|
497
505
|
return 0;
|
|
498
506
|
}
|
|
499
507
|
case "list": {
|
|
@@ -538,12 +546,21 @@ async function main(argv, io = {}) {
|
|
|
538
546
|
return 2;
|
|
539
547
|
}
|
|
540
548
|
const assets = (p.flags.get("--assets") ?? "results").split(",").filter((a) => a !== "");
|
|
541
|
-
const
|
|
549
|
+
const keep = p.flags.has("--keep") ? Number(p.flags.get("--keep")) : undefined;
|
|
550
|
+
const u = await m.use(target, {
|
|
551
|
+
assets,
|
|
552
|
+
prune: !p.bools.has("--no-prune"),
|
|
553
|
+
...keep !== undefined ? { keep } : {}
|
|
554
|
+
});
|
|
542
555
|
out(u, () => {
|
|
543
556
|
for (const b of u.built)
|
|
544
557
|
say(`${u.tag} ${b.name} ${b.path}`);
|
|
545
558
|
say(u.was === u.tag ? `pinned ${u.tag} (already pinned; its indexes are built)` : `pinned ${u.tag}${u.was === null ? "" : ` (was ${u.was})`}`);
|
|
559
|
+
if (u.pruned !== null && u.pruned.remove.length > 0)
|
|
560
|
+
printRemovals(u.pruned, say);
|
|
546
561
|
});
|
|
562
|
+
if (u.pruneError !== undefined)
|
|
563
|
+
log(`prune after ${verb} failed: ${u.pruneError}`);
|
|
547
564
|
return 0;
|
|
548
565
|
}
|
|
549
566
|
case "unpin": {
|
package/dist/index.js
CHANGED
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
Release2,
|
|
51
51
|
openRelease2,
|
|
52
52
|
openCached2,
|
|
53
|
+
DEFAULT_KEEP2,
|
|
53
54
|
ReleaseManager2,
|
|
54
55
|
releases2,
|
|
55
56
|
LATEST_CHECK_MS2,
|
|
@@ -58,7 +59,7 @@ import {
|
|
|
58
59
|
readLatestCheck2,
|
|
59
60
|
latestCheck2,
|
|
60
61
|
staleWarning2
|
|
61
|
-
} from "./chunks/index-
|
|
62
|
+
} from "./chunks/index-zwecpq08.js";
|
|
62
63
|
import {
|
|
63
64
|
cacheRoot2,
|
|
64
65
|
repoOf2
|
|
@@ -77,6 +78,7 @@ export {
|
|
|
77
78
|
ARCHIVE_TAG2 as ARCHIVE_TAG,
|
|
78
79
|
CompResolver2 as CompResolver,
|
|
79
80
|
DATABASES2 as DATABASES,
|
|
81
|
+
DEFAULT_KEEP2 as DEFAULT_KEEP,
|
|
80
82
|
DancerResolver2 as DancerResolver,
|
|
81
83
|
EventFinder2 as EventFinder,
|
|
82
84
|
FEATURES2 as FEATURES,
|
package/dist/types/cli.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { type FreshnessFloor } from "./freshness.js";
|
|
3
3
|
import type { OpenOptions } from "./release.js";
|
|
4
4
|
import type { StreamQuery } from "./stream.js";
|
|
5
|
-
export declare const USAGE = "usage: idq <verb> [--cache <dir>] [--repo <owner/name>] [--json]\n\n config repo <owner/name> set the user-local repository the releases come from\n list [--remote] the cached releases (size, files, indexes, the pin), and\n with --remote the published tags\n fetch [--release <spec>] [--assets results,majors,<file>...]\n download, verify and cache a release (default: results)\n update [--assets ...]
|
|
5
|
+
export declare const USAGE = "usage: idq <verb> [--cache <dir>] [--repo <owner/name>] [--json]\n\n config repo <owner/name> set the user-local repository the releases come from\n config keep <N> how many of the newest releases a prune keeps (default 2)\n list [--remote] the cached releases (size, files, indexes, the pin), and\n with --remote the published tags\n fetch [--release <spec>] [--assets results,majors,<file>...]\n download, verify and cache a release (default: results)\n update [--assets ...] [--keep N] [--no-prune]\n move to the newest published release: fetch it (verified),\n build its indexes, pin it, then prune the cache to the N\n newest releases (default: config keep, else 2), keeping the\n new pin and the one before it\n use <spec> [--assets ...] [--keep N] [--no-prune]\n the same for the release a spec names\n pin <spec> the user-local pin: what a bare open (spec \"pinned\") opens\n unpin remove the pin (a bare open is then \"latest\")\n current the pin, and whether it is cached\n add <dir> --tag <tag> add a release built locally (its MANIFEST.json and files)\n to the cache under its tag\n index [--release <spec>] [<name>...] [--force]\n build the per-tag indexes (default: every one)\n verify [--release <spec>] re-hash every cached file against its receipt\n capabilities [--release <spec>] what the release carries of what the client reads, from\n its own schema: each feature full or missing (its calls\n refuse, naming the first cut that publishes it)\n prune [--keep N] [--dry-run] remove all but the N newest cached releases (default:\n config keep, else 2) and the pinned one\n rm <tag> [--dry-run] remove one cached release (not the pinned one)\n drop-indexes [<tag>] [--dry-run] remove the index files (of one release, or of every one)\n feis [--release <spec>] [--platform <p>] [--code <c>] [--id <id>] [--name <glob>] [--year <y>]\n the feises a query names\n series [--release <spec>] <name|host code|feis id>\n the series a name, a host code (fweb:ABC) or any feis id\n names: its years, hosts, codes and next instance\n school [--release <spec>] <print|school_id> [--region <code>]\n a school print or id to the published schools\n dancer [--release <spec>] <name> | --surname <s> | --like <glob> | --id <dancer_id>\n [--order surname-first|given-first] [--school <print|id>]\n [--yob <y> | --band <U10> [--year <y>] | --comp <competition>] [--as-of <date>]\n [--population girls|boys] [--oireachtas <region>[:<year>]] [--rows]\n the dancers a name reaches, each with its evidence\n (name level, age, school, population, region) and the arm;\n --oireachtas is the regional the roster is for, its region in\n the release's spelling (SRO, MAO), its year the --as-of year\n where none is given; the results of\n the one dancer where one answers (or --rows for each)\n results [--release <spec>] [--dancer <id>] [--feis <id>] [--comp <competition>]\n [--school <print|id>] [--year <y>] [--limit <n>]\n the published result rows, prints and ids\n majors [--release <spec>] [--event <e>] [--year <y>] [--comp <competition>] [--dancer <id>]\n the majors: every event and its years; an event's\n competitions; a competition's, an event's or a dancer's rows\n stream [--release <spec>] --scope majors|transcribed|platform|all [--entries] [--event <e,...>]\n [--year <y> | --year <from>..<to>] [--tier <t,...>] [--category <c,...>]\n [--level <feis_level,...>] [--dancer <id,...>] [--school <school_id>] [--primary]\n every row a scope holds, one JSON line each, never the\n whole table in memory; --entries one per address (the row\n it stands for, with its recall order)\n records [--release <spec>] [--dancer <id,...>]\n every dancer's record: display, appearances, birth window,\n populations\n records --years [--release <spec>] [--dancer <id,...>] [--year <y>]\n each dancer's region, nationals and place per year\n feis-dates [--release <spec>] every feis's first and last day\n tabulated [--release <spec>] [--min-round <n>]\n the majors addresses the marks sheets tabulate to round n\n or later (default 3)\n teams [--release <spec>] [--event <e>] [--year <y>] [--rosters | --joins]\n the team result rows of an event-year; with --rosters its\n roster teams and their dancers; with --joins how each roster\n team meets the results\n events [--release <spec>] [--event <e>] [--year <y>]\n each event-year's dates and place\n teacher [--release <spec>] <name|TD number>\n the staff lists' people: where they taught, the register,\n where they sat\n adjudicator [--release <spec>] <name|TD number>\n the register's and the panels' people: the same answer\n comp [--release <spec>] <feis> <code> [--year <y>] [--title <t>]\n a feis's own comp code to the comp it names, through that\n feis's syllabus (the prior year's only where the platform\n numbers every feis alike; elsewhere the title)\n syllabus [--release <spec>] <feis> [year]\n one feis-year's comps, in printed order\n syllabus [--release <spec>] --for <series> [year]\n a series' syllabus for a year: that year's where held,\n else the newest, saying which and what it is read from\n resolve comp [<feis> <code>] [--year <y>] [--title <t>]\n resolve dancer [<name>] [--school <s>] [--comp <feis>/<code> | --yob <y> | --band <b> --year <y>]\n [--order <o>] [--as-of <date>] [--population girls|boys]\n [--oireachtas <region>[:<year>]]\n resolve registrations\n JSONL out, one answer per line; with no positional the\n questions are JSONL on stdin, one per line (a comp:\n {feis, code, year?, title?}, a dancer: {name, school?, age?,\n population?, oireachtas?}, a registration: {name, school?,\n codes[], feis, year?, population?, oireachtas?})\n\n A query on the default spec prints one warning line on stderr when its release is older than\n the newest published one (the remote asked at most once per hour, <cache>/LATEST.json); the\n answer and the exit code are unchanged, and an offline check says nothing.\n\n <spec>: pinned (the default) | latest | a cut (42, 42.1) | a tag (archive-YYYY.MM.DD-N)";
|
|
6
6
|
export interface Parsed {
|
|
7
7
|
positional: string[];
|
|
8
8
|
flags: Map<string, string>;
|
package/dist/types/config.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare function expandHome(p: string): string;
|
|
|
7
7
|
export declare function cacheRoot(opts?: ClientOptions): string;
|
|
8
8
|
export interface UserConfig {
|
|
9
9
|
repo?: string;
|
|
10
|
+
keep?: number;
|
|
10
11
|
}
|
|
11
12
|
export declare const configPath: (root: string) => string;
|
|
12
13
|
export declare function readConfig(root: string): UserConfig;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export { type Comp, type CompAnswer, type CompDance, type CompKind, type CompQue
|
|
|
7
7
|
export { type ClientOptions, cacheRoot, repoOf } from "./config.js";
|
|
8
8
|
export { type Feis, type FeisAnswer, FeisFinder, type FeisQuery, NO_CALENDAR, type Series, type SeriesAnswer, type SeriesInstance, type SeriesNext, } from "./feises.js";
|
|
9
9
|
export { type IndexBuilder, type IndexFile, buildIndex, defaultBuilders, ensureIndex, indexKey, indexPath, isCurrent, listIndexes, } from "./indexes.js";
|
|
10
|
-
export { type CachedRelease, type ReleaseList, ReleaseManager, type RemovalPlan, releases, } from "./manager.js";
|
|
10
|
+
export { type CachedRelease, DEFAULT_KEEP, type ReleaseList, ReleaseManager, type RemovalPlan, type UseResult, releases, } from "./manager.js";
|
|
11
11
|
export { type Registered, type Sat, type StaffAnswer, StaffFinder, type StaffPerson, type Taught, type TdLink, } from "./people.js";
|
|
12
12
|
export { type FreshnessFloor, LATEST_CHECK_BUDGET_MS, LATEST_CHECK_MS, type LatestCheck, latestCheck, latestCheckPath, readLatestCheck, staleWarning, } from "./freshness.js";
|
|
13
13
|
export { type Pin, readPin } from "./pin.js";
|
package/dist/types/manager.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type LandedFile } from "./assets.js";
|
|
2
|
+
import { type UserConfig } from "./config.js";
|
|
2
3
|
import { type IndexFile } from "./indexes.js";
|
|
3
4
|
import { type Pin } from "./pin.js";
|
|
4
5
|
import { type OpenOptions, type Release, resolveTag } from "./release.js";
|
|
@@ -35,6 +36,18 @@ export interface RemovalPlan {
|
|
|
35
36
|
}[];
|
|
36
37
|
bytes: number;
|
|
37
38
|
}
|
|
39
|
+
export declare const DEFAULT_KEEP = 2;
|
|
40
|
+
export interface UseResult {
|
|
41
|
+
tag: string;
|
|
42
|
+
was: string | null;
|
|
43
|
+
pin: Pin;
|
|
44
|
+
built: {
|
|
45
|
+
name: string;
|
|
46
|
+
path: string;
|
|
47
|
+
}[];
|
|
48
|
+
pruned: RemovalPlan | null;
|
|
49
|
+
pruneError?: string;
|
|
50
|
+
}
|
|
38
51
|
export declare class ReleaseManager {
|
|
39
52
|
private readonly opts;
|
|
40
53
|
readonly root: string;
|
|
@@ -50,28 +63,17 @@ export declare class ReleaseManager {
|
|
|
50
63
|
pin(spec: string | number): Promise<Pin>;
|
|
51
64
|
use(spec: string | number, o?: {
|
|
52
65
|
assets?: readonly string[];
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
built: {
|
|
58
|
-
name: string;
|
|
59
|
-
path: string;
|
|
60
|
-
}[];
|
|
61
|
-
}>;
|
|
66
|
+
prune?: boolean;
|
|
67
|
+
keep?: number;
|
|
68
|
+
}): Promise<UseResult>;
|
|
69
|
+
keepCount(keep?: number): number;
|
|
62
70
|
unpin(): boolean;
|
|
63
71
|
current(): {
|
|
64
72
|
pin: Pin | null;
|
|
65
73
|
cached: boolean;
|
|
66
74
|
};
|
|
67
|
-
config(patch:
|
|
68
|
-
|
|
69
|
-
}): {
|
|
70
|
-
repo?: string;
|
|
71
|
-
};
|
|
72
|
-
readConfig(): {
|
|
73
|
-
repo?: string;
|
|
74
|
-
};
|
|
75
|
+
config(patch: UserConfig): UserConfig;
|
|
76
|
+
readConfig(): UserConfig;
|
|
75
77
|
add(dir: string, tag: string): Promise<Release>;
|
|
76
78
|
index(spec: string | number, names?: readonly string[], o?: {
|
|
77
79
|
force?: boolean;
|
|
@@ -88,6 +90,10 @@ export declare class ReleaseManager {
|
|
|
88
90
|
prune(o?: {
|
|
89
91
|
keep?: number;
|
|
90
92
|
dryRun?: boolean;
|
|
93
|
+
hold?: readonly {
|
|
94
|
+
tag: string;
|
|
95
|
+
why: string;
|
|
96
|
+
}[];
|
|
91
97
|
}): RemovalPlan;
|
|
92
98
|
remove(tag: string, o?: {
|
|
93
99
|
dryRun?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finbheara/archive-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.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",
|