@hatk/hatk 0.0.1-alpha.56 → 0.0.1-alpha.57
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/indexer.js +27 -24
- package/package.json +1 -1
package/dist/indexer.js
CHANGED
|
@@ -373,32 +373,35 @@ function processMessage(bytes, collections) {
|
|
|
373
373
|
}]);
|
|
374
374
|
continue;
|
|
375
375
|
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
376
|
+
const opCid = typeof op.cid === 'string' ? op.cid : op.cid?.$link;
|
|
377
|
+
if (!opCid)
|
|
378
|
+
continue;
|
|
379
|
+
const data = blocks.get(opCid);
|
|
380
|
+
if (!data)
|
|
381
|
+
continue;
|
|
382
|
+
try {
|
|
383
|
+
const { value: record } = cborDecode(data);
|
|
384
|
+
if (record?.$type === collection) {
|
|
385
|
+
const validationError = validateRecord(getLexiconArray(), collection, record);
|
|
386
|
+
if (validationError) {
|
|
387
|
+
emit('indexer', 'validation_skip', {
|
|
388
|
+
uri,
|
|
389
|
+
collection,
|
|
390
|
+
path: validationError.path,
|
|
391
|
+
error: validationError.message,
|
|
392
|
+
});
|
|
393
|
+
continue;
|
|
394
|
+
}
|
|
395
|
+
const item = { collection, uri, cid: opCid, authorDid: did, record };
|
|
396
|
+
// If DID is mid-backfill, buffer instead of writing directly
|
|
397
|
+
if (pendingBuffers.has(did)) {
|
|
398
|
+
pendingBuffers.get(did).push(item);
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
bufferWrite(item);
|
|
399
402
|
}
|
|
400
403
|
}
|
|
401
|
-
catch { }
|
|
402
404
|
}
|
|
405
|
+
catch { }
|
|
403
406
|
}
|
|
404
407
|
}
|