Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

linkdex

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

linkdex - npm Package Compare versions

Comparing version 2.2.0 to 3.0.0

12

dist/index.d.ts

@@ -1,3 +0,6 @@

/** @typedef { 'Complete' | 'Partial' | 'Unknown' } DagStructure */
/**
* @typedef { 'Complete' | 'Partial' | 'Unknown' } DagStructure
* @typedef {import('multiformats').UnknownLink} UnknownLink
*/
/**
* @typedef {Object} Report

@@ -33,5 +36,5 @@ * @property {DagStructure} structure - Are there any Linked CIDs that are not present in the set of blocks

* Map block CID to the set of CIDs it links to
* @type {Map<string, Set<string>>}
* */
idx: Map<string, Set<string>>;
* @type {Map<UnknownLink, Set<UnknownLink>>}
*/
idx: Map<UnknownLink, Set<UnknownLink>>;
blocksIndexed: number;

@@ -86,2 +89,3 @@ undecodable: number;

export type DagStructure = 'Complete' | 'Partial' | 'Unknown';
export type UnknownLink = import('multiformats').UnknownLink;
export type Report = {

@@ -88,0 +92,0 @@ /**

import { CarBlockIterator } from '@ipld/car/iterator'
import { Map as LinkMap } from 'lnmap'
import { Set as LinkSet } from 'lnset'
import { maybeDecode } from './decode.js'
/** @typedef { 'Complete' | 'Partial' | 'Unknown' } DagStructure */
/**
* @typedef { 'Complete' | 'Partial' | 'Unknown' } DagStructure
* @typedef {import('multiformats').UnknownLink} UnknownLink
*/

@@ -55,5 +60,5 @@ /**

* Map block CID to the set of CIDs it links to
* @type {Map<string, Set<string>>}
* */
this.idx = new Map()
* @type {Map<UnknownLink, Set<UnknownLink>>}
*/
this.idx = new LinkMap()
this.blocksIndexed = 0

@@ -107,9 +112,8 @@ this.undecodable = 0

_index (block) {
const key = block.cid.toString()
if (this.idx.has(key)) {
if (this.idx.has(block.cid)) {
return // already indexed this block
}
const targets = new Set()
const targets = new LinkSet()
for (const [, targetCid] of block.links()) {
targets.add(targetCid.toString())
targets.add(targetCid)
if (targetCid.multihash.code === 0x0) {

@@ -119,3 +123,3 @@ this._decodeAndIndexIdentityCidLink(targetCid)

}
this.idx.set(key, targets)
this.idx.set(block.cid, targets)
}

@@ -122,0 +126,0 @@

{
"name": "linkdex",
"version": "2.2.0",
"version": "3.0.0",
"type": "module",

@@ -43,2 +43,4 @@ "description": "An index mapping block CID to linked block CID.",

"@web3-storage/car-block-validator": "^1.2.0",
"lnmap": "^1.0.1",
"lnset": "^1.2.0",
"multiformats": "^11.0.2",

@@ -45,0 +47,0 @@ "sade": "^1.8.1"

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc