@hatk/hatk 0.0.1-alpha.23 → 0.0.1-alpha.24
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.map +1 -1
- package/dist/backfill.js +12 -0
- package/package.json +1 -1
package/dist/backfill.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backfill.d.ts","sourceRoot":"","sources":["../src/backfill.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"backfill.d.ts","sourceRoot":"","sources":["../src/backfill.ts"],"names":[],"mappings":"AAiBA,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;AAoGD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAkK/G;AA8BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAkIrE"}
|
package/dist/backfill.js
CHANGED
|
@@ -3,6 +3,8 @@ import { cborDecode } from "./cbor.js";
|
|
|
3
3
|
import { walkMst } from "./mst.js";
|
|
4
4
|
import { setRepoStatus, getRepoStatus, getRepoRev, getRepoRetryInfo, listRetryEligibleRepos, listPendingRepos, querySQL, runSQL, getSchema, bulkInsertRecords, } from "./database/db.js";
|
|
5
5
|
import { emit, timer } from "./logger.js";
|
|
6
|
+
import { validateRecord } from '@bigmoves/lexicon';
|
|
7
|
+
import { getLexiconArray } from "./database/schema.js";
|
|
6
8
|
/** In-memory cache of DID → PDS resolution results to avoid redundant lookups. */
|
|
7
9
|
const pdsCache = new Map();
|
|
8
10
|
let plcUrl;
|
|
@@ -212,6 +214,16 @@ export async function backfillRepo(did, collections, fetchTimeout) {
|
|
|
212
214
|
continue;
|
|
213
215
|
const rkey = entry.path.split('/').slice(1).join('/');
|
|
214
216
|
const uri = `at://${did}/${collection}/${rkey}`;
|
|
217
|
+
const validationError = validateRecord(getLexiconArray(), collection, record);
|
|
218
|
+
if (validationError) {
|
|
219
|
+
emit('backfill', 'validation_skip', {
|
|
220
|
+
uri,
|
|
221
|
+
collection,
|
|
222
|
+
path: validationError.path,
|
|
223
|
+
error: validationError.message,
|
|
224
|
+
});
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
215
227
|
chunk.push({ collection, uri, cid: entry.cid, did, record });
|
|
216
228
|
if (chunk.length >= CHUNK_SIZE) {
|
|
217
229
|
count += await bulkInsertRecords(chunk);
|