Skip to content

Commit ea828e1

Browse files
deps(dev): bump aegir from 46.0.0 to 47.0.6 (#325)
* deps(dev): bump aegir from 46.0.0 to 47.0.6 Bumps [aegir](https://github.com/ipfs/aegir) from 46.0.0 to 47.0.6. - [Release notes](https://github.com/ipfs/aegir/releases) - [Changelog](https://github.com/ipfs/aegir/blob/main/CHANGELOG.md) - [Commits](ipfs/aegir@v46.0.0...v47.0.6) --- updated-dependencies: - dependency-name: aegir dependency-version: 47.0.6 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * chore: fix lints --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Rod Vagg <[email protected]>
1 parent c65d07e commit ea828e1

12 files changed

+27
-36
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@
281281
"@stablelib/sha256": "^2.0.0",
282282
"@stablelib/sha512": "^2.0.0",
283283
"@types/node": "^22.0.0",
284-
"aegir": "^46.0.0",
284+
"aegir": "^47.0.7",
285285
"buffer": "^6.0.3",
286286
"cids": "^1.1.9",
287287
"crypto-hash": "^3.0.0"

src/bases/base.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ class ComposedDecoder<Prefix extends string> implements MultibaseDecoder<Prefix>
9494
}
9595

9696
export function or <L extends string, R extends string> (left: UnibaseDecoder<L> | CombobaseDecoder<L>, right: UnibaseDecoder<R> | CombobaseDecoder<R>): ComposedDecoder<L | R> {
97-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
9897
return new ComposedDecoder({
9998
...(left.decoders ?? { [(left as UnibaseDecoder<L>).prefix]: left }),
10099
...(right.decoders ?? { [(right as UnibaseDecoder<R>).prefix]: right })

src/block.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,12 @@ interface EncodeInput <T, Code extends number, Alg extends number> {
138138
* @template Alg - multicodec code corresponding to the hashing algorithm used in CID creation.
139139
*/
140140
export async function encode <T, Code extends number, Alg extends number> ({ value, codec, hasher }: EncodeInput<T, Code, Alg>): Promise<API.BlockView<T, Code, Alg>> {
141-
if (typeof value === 'undefined') throw new Error('Missing required argument "value"')
142-
if (codec == null || hasher == null) throw new Error('Missing required argument: codec or hasher')
141+
if (typeof value === 'undefined') { throw new Error('Missing required argument "value"') }
142+
if (codec == null || hasher == null) { throw new Error('Missing required argument: codec or hasher') }
143143

144144
const bytes = codec.encode(value)
145145
const hash = await hasher.digest(bytes)
146-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
146+
147147
const cid = CID.create(
148148
1,
149149
codec.code,
@@ -165,12 +165,12 @@ interface DecodeInput <T, Code extends number, Alg extends number> {
165165
* @template Alg - multicodec code corresponding to the hashing algorithm used in CID creation.
166166
*/
167167
export async function decode <T, Code extends number, Alg extends number> ({ bytes, codec, hasher }: DecodeInput<T, Code, Alg>): Promise<API.BlockView<T, Code, Alg>> {
168-
if (bytes == null) throw new Error('Missing required argument "bytes"')
169-
if (codec == null || hasher == null) throw new Error('Missing required argument: codec or hasher')
168+
if (bytes == null) { throw new Error('Missing required argument "bytes"') }
169+
if (codec == null || hasher == null) { throw new Error('Missing required argument: codec or hasher') }
170170

171171
const value = codec.decode(bytes)
172172
const hash = await hasher.digest(bytes)
173-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
173+
174174
const cid = CID.create(1, codec.code, hash) as CID<T, Code, Alg, 1>
175175

176176
return new Block({ value, bytes, cid })
@@ -195,12 +195,11 @@ type CreateUnsafeInput <T, Code extends number, Alg extends number, V extends AP
195195
* @template V - CID version
196196
*/
197197
export function createUnsafe <T, Code extends number, Alg extends number, V extends API.Version> ({ bytes, cid, value: maybeValue, codec }: CreateUnsafeInput<T, Code, Alg, V>): API.BlockView<T, Code, Alg, V> {
198-
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
199198
const value = maybeValue !== undefined
200199
? maybeValue
201200
: (codec?.decode(bytes))
202201

203-
if (value === undefined) throw new Error('Missing required argument, must either provide "value" or "codec"')
202+
if (value === undefined) { throw new Error('Missing required argument, must either provide "value" or "codec"') }
204203

205204
return new Block({
206205
cid: cid as CID<T, Code, Alg, V>,
@@ -223,8 +222,8 @@ interface CreateInput <T, Code extends number, Alg extends number, V extends API
223222
* @template V - CID version
224223
*/
225224
export async function create <T, Code extends number, Alg extends number, V extends API.Version> ({ bytes, cid, hasher, codec }: CreateInput<T, Code, Alg, V>): Promise<API.BlockView<T, Code, Alg, V>> {
226-
if (bytes == null) throw new Error('Missing required argument "bytes"')
227-
if (hasher == null) throw new Error('Missing required argument "hasher"')
225+
if (bytes == null) { throw new Error('Missing required argument "bytes"') }
226+
if (hasher == null) { throw new Error('Missing required argument "hasher"') }
228227
const value = codec.decode(bytes)
229228
const hash = await hasher.digest(bytes)
230229
if (!binary.equals(cid.multihash.bytes, hash.bytes)) {

src/bytes.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export function fromHex (hex: string): Uint8Array {
1010
}
1111

1212
export function equals (aa: Uint8Array, bb: Uint8Array): boolean {
13-
if (aa === bb) return true
13+
if (aa === bb) { return true }
1414
if (aa.byteLength !== bb.byteLength) {
1515
return false
1616
}
@@ -25,8 +25,8 @@ export function equals (aa: Uint8Array, bb: Uint8Array): boolean {
2525
}
2626

2727
export function coerce (o: ArrayBufferView | ArrayBuffer | Uint8Array): Uint8Array {
28-
if (o instanceof Uint8Array && o.constructor.name === 'Uint8Array') return o
29-
if (o instanceof ArrayBuffer) return new Uint8Array(o)
28+
if (o instanceof Uint8Array && o.constructor.name === 'Uint8Array') { return o }
29+
if (o instanceof ArrayBuffer) { return new Uint8Array(o) }
3030
if (ArrayBuffer.isView(o)) {
3131
return new Uint8Array(o.buffer, o.byteOffset, o.byteLength)
3232
}

src/link.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function isLink <L extends API.Link<unknown, number, number, 0 | 1>> (val
3838
return true
3939
}
4040

41-
const withAsCID = value as { 'asCID'?: unknown }
41+
const withAsCID = value as { asCID?: unknown }
4242

4343
if (withAsCID.asCID === value) {
4444
return true

src/link/interface.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
/* eslint-disable @typescript-eslint/no-unnecessary-type-constraint */
2-
/* eslint-disable no-use-before-define */
3-
41
import type { MultibaseEncoder, MultibaseDecoder, Multibase } from '../bases/interface.js'
52
import type { Phantom, ByteView } from '../block/interface.js'
63
import type { MultihashDigest } from '../hashes/interface.js'

test/test-bytes.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ describe('bytes', () => {
1111

1212
it('coerce', () => {
1313
const fixture = bytes.fromString('test')
14+
// @ts-expect-error
1415
assert.deepStrictEqual(bytes.coerce(fixture.buffer), fixture)
1516
assert.deepStrictEqual(bytes.coerce(new DataView(fixture.buffer)), fixture)
1617
})

test/test-cid.spec.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* globals describe, it */
2-
/* eslint-disable @typescript-eslint/strict-boolean-expressions */
32

43
import { assert } from 'aegir/chai'
54
import OLDCID from 'cids'
@@ -503,7 +502,6 @@ describe('CID', () => {
503502
this.asCID = this
504503
}
505504

506-
// eslint-disable-next-line @typescript-eslint/class-literal-property-style
507505
get [Symbol.for('@ipld/js-cid/CID')] (): boolean {
508506
return true
509507
}
@@ -513,7 +511,7 @@ describe('CID', () => {
513511
const code = 112
514512

515513
const incompatibleCID = new IncompatibleCID(version, code, hash)
516-
// eslint-disable-next-line @typescript-eslint/no-base-to-string
514+
517515
assert.strictEqual(incompatibleCID.toString(), '[object Object]')
518516
// @ts-expect-error - no such method
519517
assert.strictEqual(typeof incompatibleCID.toV0, 'undefined')
@@ -530,7 +528,7 @@ describe('CID', () => {
530528
const duckCID = { version, code, multihash: hash }
531529
// @ts-expect-error - no such property
532530
duckCID.asCID = duckCID
533-
const cid3 = (CID.asCID(duckCID) as CID)
531+
const cid3 = CID.asCID(duckCID) as CID
534532
assert.ok(cid3 instanceof CID)
535533
assert.strictEqual(cid3.code, code)
536534
assert.strictEqual(cid3.version, version)
@@ -567,7 +565,6 @@ describe('CID', () => {
567565
assert.deepStrictEqual(x.digest, y.digest)
568566
}
569567

570-
// eslint-disable-next-line @typescript-eslint/no-misused-promises
571568
describe('CID.parse', async () => {
572569
it('parse 32 encoded CIDv1', async () => {
573570
const hash = await sha256.digest(textEncoder.encode('abc'))

test/test-link.spec.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* globals describe, it */
2-
/* eslint-disable @typescript-eslint/strict-boolean-expressions */
32

43
import { assert } from 'aegir/chai'
54
import { sha256 } from '../src/hashes/sha2.js'
@@ -10,11 +9,9 @@ const utf8 = new TextEncoder()
109
const h1 = 'QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n'
1110
const h4 = 'bafyreidykglsfhoixmivffc5uwhcgshx4j465xwqntbmu43nb2dzqwfvae'
1211
const CBOR = 0x71
13-
const SHA256 = sha256.code
1412

15-
const sh1 = (
13+
const sh1 =
1614
Link.parse(h4).multihash as Link.MultihashDigest<typeof sha256.code>
17-
)
1815

1916
describe('Link', () => {
2017
it('isLink', () => {
@@ -55,11 +52,11 @@ describe('Link', () => {
5552
it('can parse any string', () => {
5653
const link = Link.parse(h1)
5754

58-
const t1 = link as Link.Link<unknown, typeof CBOR, typeof SHA256, 1>
55+
const t1 = link as Link.Link<unknown, typeof CBOR, typeof sha256.code, 1>
5956
assert.ok(t1)
6057

6158
// it is possible to manually cast
62-
const t2 = (link as Link.LegacyLink<unknown>)
59+
const t2 = link as Link.LegacyLink<unknown>
6360
assert.ok(t2)
6461
})
6562

@@ -76,7 +73,7 @@ describe('Link', () => {
7673
// ensure that you can't cast incorrectly
7774
const t2 =
7875
// @ts-expect-error - version is 1 not 0
79-
(link as Link.Link<unknown, typeof CBOR, typeof SHA256, 0>)
76+
link as Link.Link<unknown, typeof CBOR, typeof sha256.code, 0>
8077
assert.ok(t2)
8178
})
8279
})

test/test-multicodec.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ describe('multicodec', () => {
1515
it('encode/decode raw arraybuffer', () => {
1616
const buff = raw.encode(bytes.fromString('test'))
1717
assert.deepStrictEqual(buff, bytes.fromString('test'))
18+
// @ts-expect-error
1819
assert.deepStrictEqual(raw.decode(buff.buffer), bytes.fromString('test'))
1920
})
2021

@@ -27,6 +28,7 @@ describe('multicodec', () => {
2728
it('encode/decode json arraybuffer', () => {
2829
const buff = json.encode({ hello: 'world' })
2930
assert.deepStrictEqual(buff, bytes.fromString(JSON.stringify({ hello: 'world' })))
31+
// @ts-expect-error
3032
assert.deepStrictEqual(json.decode(buff.buffer), { hello: 'world' })
3133
})
3234

0 commit comments

Comments
 (0)