Skip to content

Commit 5bc9912

Browse files
deps!: bump multiformats from 13.4.2 to 14.0.0 (#372)
Bumps the interplanetary-deps group with 1 update in the / directory: [multiformats](https://github.com/multiformats/js-multiformats). Updates `multiformats` from 13.4.2 to 14.0.0 - [Release notes](https://github.com/multiformats/js-multiformats/releases) - [Changelog](https://github.com/multiformats/js-multiformats/blob/master/CHANGELOG.md) - [Commits](multiformats/js-multiformats@v13.4.2...v14.0.0) --- updated-dependencies: - dependency-name: multiformats dependency-version: 14.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: interplanetary-deps ... --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: achingbrain <alex@achingbrain.net>
1 parent be6174f commit 5bc9912

40 files changed

Lines changed: 178 additions & 186 deletions

File tree

packages/blockstore-core/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,18 +187,19 @@
187187
},
188188
"dependencies": {
189189
"@libp2p/logger": "^6.2.4",
190+
"abort-error": "^1.0.2",
190191
"interface-blockstore": "^6.0.0",
191192
"interface-store": "^7.0.0",
192193
"it-all": "^3.0.9",
193194
"it-filter": "^3.1.4",
194195
"it-merge": "^3.0.12",
195-
"multiformats": "^13.4.2"
196+
"multiformats": "^14.0.0"
196197
},
197198
"devDependencies": {
198199
"aegir": "^48.0.4",
199200
"interface-blockstore-tests": "^8.0.0",
200201
"it-drain": "^3.0.10",
201-
"it-to-buffer": "^4.0.10",
202-
"uint8arrays": "^5.1.0"
202+
"it-to-buffer": "^5.0.0",
203+
"uint8arrays": "^6.1.1"
203204
}
204205
}
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1+
import type { AbortOptions } from 'abort-error'
12
import type { Blockstore, InputPair, Pair } from 'interface-blockstore'
2-
import type { AbortOptions, Await, AwaitGenerator, AwaitIterable } from 'interface-store'
33
import type { CID } from 'multiformats/cid'
44

55
export class BaseBlockstore implements Blockstore {
6-
has (key: CID, options?: AbortOptions): Await<boolean> {
6+
has (key: CID, options?: AbortOptions): boolean | Promise<boolean> {
77
return Promise.reject(new Error('.has is not implemented'))
88
}
99

10-
put (key: CID, val: Uint8Array | AwaitIterable<Uint8Array>, options?: AbortOptions): Await<CID> {
10+
put (key: CID, val: Uint8Array | Iterable<Uint8Array> | AsyncIterable<Uint8Array>, options?: AbortOptions): CID | Promise<CID> {
1111
return Promise.reject(new Error('.put is not implemented'))
1212
}
1313

14-
async * putMany (source: AwaitIterable<InputPair>, options?: AbortOptions): AwaitGenerator<CID> {
14+
async * putMany (source: Iterable<InputPair> | AsyncIterable<InputPair>, options?: AbortOptions): Generator<CID> | AsyncGenerator<CID> {
1515
for await (const { cid, bytes } of source) {
1616
await this.put(cid, bytes, options)
1717
yield cid
1818
}
1919
}
2020

21-
get (key: CID, options?: AbortOptions): AwaitGenerator<Uint8Array> {
21+
get (key: CID, options?: AbortOptions): Generator<Uint8Array> | AsyncGenerator<Uint8Array> {
2222
throw new Error('.get is not implemented')
2323
}
2424

25-
async * getMany (source: AwaitIterable<CID>, options?: AbortOptions): AwaitGenerator<Pair> {
25+
async * getMany (source: Iterable<CID> | AsyncIterable<CID>, options?: AbortOptions): Generator<Pair> | AsyncGenerator<Pair> {
2626
for await (const key of source) {
2727
yield {
2828
cid: key,
@@ -31,11 +31,11 @@ export class BaseBlockstore implements Blockstore {
3131
}
3232
}
3333

34-
delete (key: CID, options?: AbortOptions): Await<void> {
34+
delete (key: CID, options?: AbortOptions): void | Promise<void> {
3535
return Promise.reject(new Error('.delete is not implemented'))
3636
}
3737

38-
async * deleteMany (source: AwaitIterable<CID>, options?: AbortOptions): AwaitGenerator<CID> {
38+
async * deleteMany (source: Iterable<CID> | AsyncIterable<CID>, options?: AbortOptions): Generator<CID> | AsyncGenerator<CID> {
3939
for await (const key of source) {
4040
await this.delete(key, options)
4141
yield key
@@ -45,7 +45,7 @@ export class BaseBlockstore implements Blockstore {
4545
/**
4646
* Extending classes should override `query` or implement this method
4747
*/
48-
async * getAll (options?: AbortOptions): AwaitGenerator<Pair> { // eslint-disable-line require-yield
48+
async * getAll (options?: AbortOptions): Generator<Pair> | AsyncGenerator<Pair> { // eslint-disable-line require-yield
4949
throw new Error('.getAll is not implemented')
5050
}
5151
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import { NotFoundError } from 'interface-store'
22
import { BaseBlockstore } from './base.ts'
3+
import type { AbortOptions } from 'abort-error'
34
import type { Pair } from 'interface-blockstore'
4-
import type { AbortOptions, Await, AwaitGenerator, AwaitIterable } from 'interface-store'
55
import type { CID } from 'multiformats/cid'
66

77
export class BlackHoleBlockstore extends BaseBlockstore {
8-
put (key: CID, value: Uint8Array | AwaitIterable<Uint8Array>, options?: AbortOptions): Await<CID> {
8+
put (key: CID, value: Uint8Array | Iterable<Uint8Array> | AsyncIterable<Uint8Array>, options?: AbortOptions): CID | Promise<CID> {
99
options?.signal?.throwIfAborted()
1010
return key
1111
}
1212

13-
get (key: CID, options?: AbortOptions): AwaitGenerator<Uint8Array> {
13+
get (key: CID, options?: AbortOptions): Generator<Uint8Array> | AsyncGenerator<Uint8Array> {
1414
options?.signal?.throwIfAborted()
1515
throw new NotFoundError()
1616
}
1717

18-
has (key: CID, options?: AbortOptions): Await<boolean> {
18+
has (key: CID, options?: AbortOptions): boolean | Promise<boolean> {
1919
options?.signal?.throwIfAborted()
2020
return false
2121
}
@@ -25,7 +25,7 @@ export class BlackHoleBlockstore extends BaseBlockstore {
2525
}
2626

2727
// eslint-disable-next-line require-yield
28-
async * getAll (options?: AbortOptions): AwaitGenerator<Pair> {
28+
async * getAll (options?: AbortOptions): Generator<Pair> | AsyncGenerator<Pair> {
2929
options?.signal?.throwIfAborted()
3030
}
3131
}

packages/blockstore-core/src/identity.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { NotFoundError } from 'interface-store'
22
import { BaseBlockstore } from './base.ts'
3+
import type { AbortOptions } from 'abort-error'
34
import type { Blockstore, Pair } from 'interface-blockstore'
4-
import type { AbortOptions, Await, AwaitIterable } from 'interface-store'
55
import type { CID } from 'multiformats/cid'
66

77
// https://github.com/multiformats/multicodec/blob/d06fc6194710e8909bac64273c43f16b56ca4c34/table.csv#L2
@@ -27,7 +27,7 @@ export class IdentityBlockstore extends BaseBlockstore {
2727
this.maxDigestLength = init?.maxDigestLength
2828
}
2929

30-
put (key: CID, block: Uint8Array | AwaitIterable<Uint8Array>, options?: AbortOptions): Await<CID> {
30+
put (key: CID, block: Uint8Array | Iterable<Uint8Array> | AsyncIterable<Uint8Array>, options?: AbortOptions): CID | Promise<CID> {
3131
if (key.multihash.code === IDENTITY_CODEC) {
3232
if (this.maxDigestLength != null && key.multihash.digest.byteLength > this.maxDigestLength) {
3333
throw new IdentityHashDigestTooLongError(`Identity digest too long - ${key.multihash.digest.byteLength} > this.maxDigestLength`)
@@ -64,7 +64,7 @@ export class IdentityBlockstore extends BaseBlockstore {
6464
yield * this.child.get(key, options)
6565
}
6666

67-
has (key: CID, options?: AbortOptions): Await<boolean> {
67+
has (key: CID, options?: AbortOptions): boolean | Promise<boolean> {
6868
if (key.multihash.code === IDENTITY_CODEC) {
6969
if (this.maxDigestLength != null && key.multihash.digest.byteLength > this.maxDigestLength) {
7070
throw new IdentityHashDigestTooLongError(`Identity digest too long - ${key.multihash.digest.byteLength} > this.maxDigestLength`)
@@ -82,7 +82,7 @@ export class IdentityBlockstore extends BaseBlockstore {
8282
return this.child.has(key, options)
8383
}
8484

85-
delete (key: CID, options?: AbortOptions): Await<void> {
85+
delete (key: CID, options?: AbortOptions): void | Promise<void> {
8686
if (key.code === IDENTITY_CODEC) {
8787
if (this.maxDigestLength != null && key.multihash.digest.byteLength > this.maxDigestLength) {
8888
throw new IdentityHashDigestTooLongError(`Identity digest too long - ${key.multihash.digest.byteLength} > this.maxDigestLength`)

packages/blockstore-core/src/memory.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { CID } from 'multiformats/cid'
55
import * as raw from 'multiformats/codecs/raw'
66
import * as Digest from 'multiformats/hashes/digest'
77
import { BaseBlockstore } from './base.ts'
8+
import type { AbortOptions } from 'abort-error'
89
import type { Pair } from 'interface-blockstore'
9-
import type { AbortOptions, Await, AwaitGenerator, AwaitIterable } from 'interface-store'
1010

1111
function isPromise <T> (p?: any): p is Promise<T> {
1212
return typeof p?.then === 'function'
@@ -21,7 +21,7 @@ export class MemoryBlockstore extends BaseBlockstore {
2121
this.data = new Map()
2222
}
2323

24-
put (key: CID, val: Uint8Array | AwaitIterable<Uint8Array>, options?: AbortOptions): Await<CID> {
24+
put (key: CID, val: Uint8Array | Iterable<Uint8Array> | AsyncIterable<Uint8Array>, options?: AbortOptions): CID | Promise<CID> {
2525
options?.signal?.throwIfAborted()
2626

2727
let buf: Uint8Array[]
@@ -43,15 +43,15 @@ export class MemoryBlockstore extends BaseBlockstore {
4343
return this._put(key, buf, options)
4444
}
4545

46-
private _put (key: CID, val: Uint8Array[], options?: AbortOptions): Await<CID> {
46+
private _put (key: CID, val: Uint8Array[], options?: AbortOptions): CID | Promise<CID> {
4747
options?.signal?.throwIfAborted()
4848

4949
this.data.set(base32.encode(key.multihash.bytes), val)
5050

5151
return key
5252
}
5353

54-
* get (key: CID, options?: AbortOptions): AwaitGenerator<Uint8Array> {
54+
* get (key: CID, options?: AbortOptions): Generator<Uint8Array> | AsyncGenerator<Uint8Array> {
5555
options?.signal?.throwIfAborted()
5656
const buf = this.data.get(base32.encode(key.multihash.bytes))
5757

@@ -62,7 +62,7 @@ export class MemoryBlockstore extends BaseBlockstore {
6262
yield * buf
6363
}
6464

65-
has (key: CID, options?: AbortOptions): Await<boolean> {
65+
has (key: CID, options?: AbortOptions): boolean | Promise<boolean> {
6666
options?.signal?.throwIfAborted()
6767
return this.data.has(base32.encode(key.multihash.bytes))
6868
}
@@ -72,7 +72,7 @@ export class MemoryBlockstore extends BaseBlockstore {
7272
this.data.delete(base32.encode(key.multihash.bytes))
7373
}
7474

75-
* getAll (options?: AbortOptions): AwaitGenerator<Pair> {
75+
* getAll (options?: AbortOptions): Generator<Pair> | AsyncGenerator<Pair> {
7676
options?.signal?.throwIfAborted()
7777

7878
for (const [key, value] of this.data.entries()) {

packages/blockstore-core/src/tiered.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { NotFoundError } from 'interface-store'
33
import filter from 'it-filter'
44
import merge from 'it-merge'
55
import { BaseBlockstore } from './base.ts'
6+
import type { AbortOptions } from 'abort-error'
67
import type { Blockstore, InputPair, Pair } from 'interface-blockstore'
7-
import type { AbortOptions, AwaitGenerator, AwaitIterable } from 'interface-store'
88
import type { CID } from 'multiformats/cid'
99

1010
const log = logger('blockstore:core:tiered')
@@ -24,7 +24,7 @@ export class TieredBlockstore extends BaseBlockstore {
2424
this.stores = stores.slice()
2525
}
2626

27-
async put (key: CID, value: Uint8Array | AwaitIterable<Uint8Array>, options?: AbortOptions): Promise<CID> {
27+
async put (key: CID, value: Uint8Array | Iterable<Uint8Array> | AsyncIterable<Uint8Array>, options?: AbortOptions): Promise<CID> {
2828
await Promise.all(
2929
this.stores.map(async store => {
3030
await store.put(key, value, options)
@@ -34,7 +34,7 @@ export class TieredBlockstore extends BaseBlockstore {
3434
return key
3535
}
3636

37-
async * get (key: CID, options?: AbortOptions): AwaitGenerator<Uint8Array> {
37+
async * get (key: CID, options?: AbortOptions): Generator<Uint8Array> | AsyncGenerator<Uint8Array> {
3838
let error: Error | undefined
3939

4040
for (const store of this.stores) {
@@ -68,21 +68,21 @@ export class TieredBlockstore extends BaseBlockstore {
6868
)
6969
}
7070

71-
async * putMany (source: AwaitIterable<InputPair>, options: AbortOptions = {}): AwaitGenerator<CID> {
71+
async * putMany (source: Iterable<InputPair> | AsyncIterable<InputPair>, options: AbortOptions = {}): Generator<CID> | AsyncGenerator<CID> {
7272
for await (const pair of source) {
7373
await this.put(pair.cid, pair.bytes, options)
7474
yield pair.cid
7575
}
7676
}
7777

78-
async * deleteMany (source: AwaitIterable<CID>, options: AbortOptions = {}): AwaitGenerator<CID> {
78+
async * deleteMany (source: Iterable<CID> | AsyncIterable<CID>, options: AbortOptions = {}): Generator<CID> | AsyncGenerator<CID> {
7979
for await (const cid of source) {
8080
await this.delete(cid, options)
8181
yield cid
8282
}
8383
}
8484

85-
async * getAll (options?: AbortOptions): AwaitGenerator<Pair> {
85+
async * getAll (options?: AbortOptions): Generator<Pair> | AsyncGenerator<Pair> {
8686
// deduplicate yielded pairs
8787
const seen = new Set<string>()
8888

packages/blockstore-core/test/identity.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import { identity } from 'multiformats/hashes/identity'
88
import { sha256 } from 'multiformats/hashes/sha2'
99
import { IdentityBlockstore } from '../src/identity.ts'
1010
import { MemoryBlockstore } from '../src/memory.ts'
11+
import type { AbortOptions } from 'abort-error'
1112
import type { Blockstore } from 'interface-blockstore'
12-
import type { AbortOptions } from 'interface-store'
1313

1414
describe('identity', () => {
1515
let blockstore: Blockstore

packages/blockstore-fs/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,13 @@
162162
"release": "aegir release"
163163
},
164164
"dependencies": {
165+
"abort-error": "^1.0.2",
165166
"interface-blockstore": "^6.0.0",
166167
"interface-store": "^7.0.0",
167168
"it-glob": "^3.0.4",
168169
"it-map": "^3.1.4",
169170
"it-parallel-batch": "^3.0.9",
170-
"multiformats": "^13.4.2",
171+
"multiformats": "^14.0.0",
171172
"race-signal": "^2.0.0",
172173
"steno": "^4.0.2"
173174
},

packages/blockstore-fs/src/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ import { raceSignal } from 'race-signal'
2222
import { Writer } from 'steno'
2323
import { NextToLast } from './sharding.ts'
2424
import type { ShardingStrategy } from './sharding.ts'
25+
import type { AbortOptions } from 'abort-error'
2526
import type { Blockstore, Pair } from 'interface-blockstore'
26-
import type { AbortOptions, AwaitGenerator, AwaitIterable } from 'interface-store'
2727
import type { CID } from 'multiformats/cid'
2828
import type { FileHandle } from 'node:fs/promises'
2929

3030
/**
3131
* Write a file atomically
3232
*/
33-
async function writeFile (file: string, contents: Uint8Array | AwaitIterable<Uint8Array>, options?: AbortOptions): Promise<void> {
33+
async function writeFile (file: string, contents: Uint8Array | Iterable<Uint8Array> | AsyncIterable<Uint8Array>, options?: AbortOptions): Promise<void> {
3434
try {
3535
options?.signal?.throwIfAborted()
3636
await raceSignal(fs.mkdir(path.dirname(file), {
@@ -147,7 +147,7 @@ export class FsBlockstore implements Blockstore {
147147
await Promise.resolve()
148148
}
149149

150-
async put (key: CID, val: Uint8Array | AwaitIterable<Uint8Array>, options?: AbortOptions): Promise<CID> {
150+
async put (key: CID, val: Uint8Array | Iterable<Uint8Array> | AsyncIterable<Uint8Array>, options?: AbortOptions): Promise<CID> {
151151
const { dir, file } = this.shardingStrategy.encode(key)
152152

153153
try {
@@ -159,7 +159,7 @@ export class FsBlockstore implements Blockstore {
159159
}
160160
}
161161

162-
async * putMany (source: AwaitIterable<Pair>, options?: AbortOptions): AsyncGenerator<CID> {
162+
async * putMany (source: Iterable<Pair> | AsyncIterable<Pair>, options?: AbortOptions): AsyncGenerator<CID> {
163163
yield * parallelBatch(
164164
map(source, ({ cid, bytes }) => {
165165
return async () => {
@@ -191,7 +191,7 @@ export class FsBlockstore implements Blockstore {
191191
}
192192
}
193193

194-
async * getMany (source: AwaitIterable<CID>, options?: AbortOptions): AsyncGenerator<Pair> {
194+
async * getMany (source: Iterable<CID> | AsyncIterable<CID>, options?: AbortOptions): AsyncGenerator<Pair> {
195195
yield * parallelBatch(
196196
map(source, key => {
197197
return async () => {
@@ -220,7 +220,7 @@ export class FsBlockstore implements Blockstore {
220220
}
221221
}
222222

223-
async * deleteMany (source: AwaitIterable<CID>, options?: AbortOptions): AsyncGenerator<CID> {
223+
async * deleteMany (source: Iterable<CID> | AsyncIterable<CID>, options?: AbortOptions): AsyncGenerator<CID> {
224224
yield * parallelBatch(
225225
map(source, key => {
226226
return async () => {
@@ -245,7 +245,7 @@ export class FsBlockstore implements Blockstore {
245245
return true
246246
}
247247

248-
async * getAll (options?: AbortOptions): AwaitGenerator<Pair> {
248+
async * getAll (options?: AbortOptions): Generator<Pair> | AsyncGenerator<Pair> {
249249
const pattern = `**/*${this.shardingStrategy.extension}`
250250
.split(path.sep)
251251
.join('/')

packages/blockstore-idb/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,14 @@
144144
"release": "aegir release"
145145
},
146146
"dependencies": {
147+
"abort-error": "^1.0.2",
147148
"blockstore-core": "^6.0.0",
148149
"idb": "^8.0.3",
149150
"interface-blockstore": "^6.0.0",
150151
"interface-store": "^7.0.0",
151152
"it-all": "^3.0.9",
152-
"it-to-buffer": "^4.0.10",
153-
"multiformats": "^13.4.2",
153+
"it-to-buffer": "^5.0.0",
154+
"multiformats": "^14.0.0",
154155
"race-signal": "^2.0.0"
155156
},
156157
"devDependencies": {

0 commit comments

Comments
 (0)