@hatk/hatk 0.0.1-alpha.68 → 0.0.1-alpha.69
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/dist/backfill.d.ts +9 -0
- package/dist/backfill.d.ts.map +1 -1
- package/dist/backfill.js +19 -1
- package/package.json +1 -1
package/dist/backfill.d.ts
CHANGED
|
@@ -8,6 +8,15 @@
|
|
|
8
8
|
* Exported for tests.
|
|
9
9
|
*/
|
|
10
10
|
export declare function purgeableCollections(collections: Iterable<string>): string[];
|
|
11
|
+
/**
|
|
12
|
+
* Whether a repo with this stored status should be queued for backfill.
|
|
13
|
+
*
|
|
14
|
+
* Takendown repos are excluded: re-backfilling one ends in
|
|
15
|
+
* `setRepoStatus(did, 'active')`, which would silently reinstate an account an
|
|
16
|
+
* admin took down — takedowns must survive every redeploy. Reinstatement goes
|
|
17
|
+
* through `/admin/reverse-takedown` only. Exported for tests.
|
|
18
|
+
*/
|
|
19
|
+
export declare function backfillEligible(status: string | null): boolean;
|
|
11
20
|
import type { BackfillConfig } from './config.ts';
|
|
12
21
|
/** Options passed to {@link runBackfill}. */
|
|
13
22
|
interface BackfillOpts {
|
package/dist/backfill.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backfill.d.ts","sourceRoot":"","sources":["../src/backfill.ts"],"names":[],"mappings":"AAiBA;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CAE5E;AAGD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAIjD,6CAA6C;AAC7C,UAAU,YAAY;IACpB,wFAAwF;IACxF,MAAM,EAAE,MAAM,CAAA;IACd,8FAA8F;IAC9F,MAAM,EAAE,MAAM,CAAA;IACd,yEAAyE;IACzE,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACxB,wDAAwD;IACxD,MAAM,EAAE,cAAc,CAAA;CACvB;AA+FD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"backfill.d.ts","sourceRoot":"","sources":["../src/backfill.ts"],"names":[],"mappings":"AAiBA;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CAE5E;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAE/D;AAGD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAIjD,6CAA6C;AAC7C,UAAU,YAAY;IACpB,wFAAwF;IACxF,MAAM,EAAE,MAAM,CAAA;IACd,8FAA8F;IAC9F,MAAM,EAAE,MAAM,CAAA;IACd,yEAAyE;IACzE,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACxB,wDAAwD;IACxD,MAAM,EAAE,cAAc,CAAA;CACvB;AA+FD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAyK/G;AA8BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAkIrE"}
|
package/dist/backfill.js
CHANGED
|
@@ -15,6 +15,17 @@ import { isPrivateCollection } from "./private-collections.js";
|
|
|
15
15
|
export function purgeableCollections(collections) {
|
|
16
16
|
return [...collections].filter((c) => !isPrivateCollection(c));
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Whether a repo with this stored status should be queued for backfill.
|
|
20
|
+
*
|
|
21
|
+
* Takendown repos are excluded: re-backfilling one ends in
|
|
22
|
+
* `setRepoStatus(did, 'active')`, which would silently reinstate an account an
|
|
23
|
+
* admin took down — takedowns must survive every redeploy. Reinstatement goes
|
|
24
|
+
* through `/admin/reverse-takedown` only. Exported for tests.
|
|
25
|
+
*/
|
|
26
|
+
export function backfillEligible(status) {
|
|
27
|
+
return status !== 'active' && status !== 'takendown';
|
|
28
|
+
}
|
|
18
29
|
import { emit, timer } from "./logger.js";
|
|
19
30
|
import { validateRecord } from '@bigmoves/lexicon';
|
|
20
31
|
import { getLexiconArray } from "./database/schema.js";
|
|
@@ -131,6 +142,13 @@ async function* listReposByCollection(pdsUrl, collection) {
|
|
|
131
142
|
* ```
|
|
132
143
|
*/
|
|
133
144
|
export async function backfillRepo(did, collections, fetchTimeout) {
|
|
145
|
+
// A takendown repo must never be re-imported: the success path ends in
|
|
146
|
+
// setRepoStatus('active'), which would reinstate the account. Guarding here
|
|
147
|
+
// covers every caller (boot scan, auto-backfill, admin re-index).
|
|
148
|
+
if ((await getRepoStatus(did)) === 'takendown') {
|
|
149
|
+
emit('backfill', 'takedown_skip', { did });
|
|
150
|
+
return 0;
|
|
151
|
+
}
|
|
134
152
|
const elapsed = timer();
|
|
135
153
|
let count = 0;
|
|
136
154
|
let carSizeBytes;
|
|
@@ -385,7 +403,7 @@ export async function runBackfill(opts) {
|
|
|
385
403
|
const pending = [];
|
|
386
404
|
for (const did of dids) {
|
|
387
405
|
const status = await getRepoStatus(did);
|
|
388
|
-
if (status
|
|
406
|
+
if (backfillEligible(status)) {
|
|
389
407
|
if (!status)
|
|
390
408
|
await setRepoStatus(did, 'pending');
|
|
391
409
|
pending.push(did);
|