@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.
Files changed (2) hide show
  1. package/dist/indexer.js +27 -24
  2. 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
- for (const [cid, data] of blocks) {
377
- try {
378
- const { value: record } = cborDecode(data);
379
- if (record?.$type === collection) {
380
- const validationError = validateRecord(getLexiconArray(), collection, record);
381
- if (validationError) {
382
- emit('indexer', 'validation_skip', {
383
- uri,
384
- collection,
385
- path: validationError.path,
386
- error: validationError.message,
387
- });
388
- break;
389
- }
390
- const item = { collection, uri, cid, authorDid: did, record };
391
- // If DID is mid-backfill, buffer instead of writing directly
392
- if (pendingBuffers.has(did)) {
393
- pendingBuffers.get(did).push(item);
394
- }
395
- else {
396
- bufferWrite(item);
397
- }
398
- break;
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hatk/hatk",
3
- "version": "0.0.1-alpha.56",
3
+ "version": "0.0.1-alpha.57",
4
4
  "license": "MIT",
5
5
  "bin": {
6
6
  "hatk": "dist/cli.js"