From 361c38eeaa7318576697ad07905d2b95031109e6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 8 May 2026 12:34:52 +0000 Subject: [PATCH 1/6] deps: bump multiformats 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](https://github.com/multiformats/js-multiformats/compare/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] --- packages/blockstore-core/package.json | 2 +- packages/blockstore-fs/package.json | 2 +- packages/blockstore-idb/package.json | 2 +- packages/blockstore-level/package.json | 2 +- packages/blockstore-s3/package.json | 2 +- packages/interface-blockstore-tests/package.json | 2 +- packages/interface-blockstore/package.json | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/blockstore-core/package.json b/packages/blockstore-core/package.json index de4509d0..01efec1c 100644 --- a/packages/blockstore-core/package.json +++ b/packages/blockstore-core/package.json @@ -192,7 +192,7 @@ "it-all": "^3.0.9", "it-filter": "^3.1.4", "it-merge": "^3.0.12", - "multiformats": "^13.4.2" + "multiformats": "^14.0.0" }, "devDependencies": { "aegir": "^48.0.4", diff --git a/packages/blockstore-fs/package.json b/packages/blockstore-fs/package.json index 20198c59..03b7c831 100644 --- a/packages/blockstore-fs/package.json +++ b/packages/blockstore-fs/package.json @@ -167,7 +167,7 @@ "it-glob": "^3.0.4", "it-map": "^3.1.4", "it-parallel-batch": "^3.0.9", - "multiformats": "^13.4.2", + "multiformats": "^14.0.0", "race-signal": "^2.0.0", "steno": "^4.0.2" }, diff --git a/packages/blockstore-idb/package.json b/packages/blockstore-idb/package.json index 68d319d1..c8d63e0d 100644 --- a/packages/blockstore-idb/package.json +++ b/packages/blockstore-idb/package.json @@ -150,7 +150,7 @@ "interface-store": "^7.0.0", "it-all": "^3.0.9", "it-to-buffer": "^4.0.10", - "multiformats": "^13.4.2", + "multiformats": "^14.0.0", "race-signal": "^2.0.0" }, "devDependencies": { diff --git a/packages/blockstore-level/package.json b/packages/blockstore-level/package.json index 3ea1407d..08131867 100644 --- a/packages/blockstore-level/package.json +++ b/packages/blockstore-level/package.json @@ -153,7 +153,7 @@ "it-all": "^3.0.9", "it-to-buffer": "^4.0.10", "level": "^10.0.0", - "multiformats": "^13.4.2", + "multiformats": "^14.0.0", "race-signal": "^2.0.0", "uint8arrays": "^5.1.0" }, diff --git a/packages/blockstore-s3/package.json b/packages/blockstore-s3/package.json index 015bbbc7..fddfda11 100644 --- a/packages/blockstore-s3/package.json +++ b/packages/blockstore-s3/package.json @@ -149,7 +149,7 @@ "blockstore-core": "^6.0.0", "interface-blockstore": "^6.0.0", "interface-store": "^7.0.0", - "multiformats": "^13.4.2", + "multiformats": "^14.0.0", "uint8arrays": "^5.1.0" }, "devDependencies": { diff --git a/packages/interface-blockstore-tests/package.json b/packages/interface-blockstore-tests/package.json index c71b264a..f76219d9 100644 --- a/packages/interface-blockstore-tests/package.json +++ b/packages/interface-blockstore-tests/package.json @@ -141,7 +141,7 @@ "it-all": "^3.0.9", "it-drain": "^3.0.10", "it-map": "^3.1.4", - "multiformats": "^13.4.2", + "multiformats": "^14.0.0", "uint8arrays": "^5.1.0" }, "devDependencies": { diff --git a/packages/interface-blockstore/package.json b/packages/interface-blockstore/package.json index 95dfb6fa..0319940c 100644 --- a/packages/interface-blockstore/package.json +++ b/packages/interface-blockstore/package.json @@ -131,7 +131,7 @@ }, "dependencies": { "interface-store": "^7.0.0", - "multiformats": "^13.4.2" + "multiformats": "^14.0.0" }, "devDependencies": { "aegir": "^48.0.4" From 5df5e01f9321b0edb8758467347f1a9e197e45e2 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Fri, 8 May 2026 16:04:34 +0300 Subject: [PATCH 2/6] chore: remove deprecated code --- packages/blockstore-core/package.json | 4 ++-- packages/blockstore-core/src/base.ts | 3 ++- packages/blockstore-core/src/black-hole.ts | 3 ++- packages/blockstore-core/src/identity.ts | 3 ++- packages/blockstore-core/src/memory.ts | 3 ++- packages/blockstore-core/src/tiered.ts | 3 ++- packages/blockstore-core/test/identity.spec.ts | 2 +- packages/blockstore-fs/src/index.ts | 3 ++- packages/blockstore-idb/package.json | 2 +- packages/blockstore-idb/src/index.ts | 3 ++- packages/blockstore-level/package.json | 4 ++-- packages/blockstore-level/src/index.ts | 3 ++- packages/blockstore-s3/package.json | 2 +- packages/blockstore-s3/src/index.ts | 3 ++- packages/datastore-core/package.json | 2 +- packages/datastore-core/src/base.ts | 3 ++- packages/datastore-core/src/black-hole.ts | 3 ++- packages/datastore-core/src/keytransform.ts | 3 ++- packages/datastore-core/src/memory.ts | 3 ++- packages/datastore-core/src/mount.ts | 3 ++- packages/datastore-core/src/namespace.ts | 3 ++- packages/datastore-core/src/sharding.ts | 3 ++- packages/datastore-core/src/tiered.ts | 3 ++- packages/datastore-fs/src/index.ts | 3 ++- packages/datastore-idb/src/index.ts | 3 ++- packages/datastore-level/src/index.ts | 3 ++- packages/datastore-s3/package.json | 4 ++-- packages/datastore-s3/src/index.ts | 3 ++- packages/interface-blockstore-tests/package.json | 2 +- packages/interface-blockstore/src/index.ts | 8 ++------ packages/interface-datastore-tests/package.json | 2 +- packages/interface-datastore/package.json | 2 +- packages/interface-datastore/src/index.ts | 8 ++------ packages/interface-store/src/index.ts | 11 ++--------- 34 files changed, 61 insertions(+), 55 deletions(-) diff --git a/packages/blockstore-core/package.json b/packages/blockstore-core/package.json index 01efec1c..2d480c69 100644 --- a/packages/blockstore-core/package.json +++ b/packages/blockstore-core/package.json @@ -198,7 +198,7 @@ "aegir": "^48.0.4", "interface-blockstore-tests": "^8.0.0", "it-drain": "^3.0.10", - "it-to-buffer": "^4.0.10", - "uint8arrays": "^5.1.0" + "it-to-buffer": "^5.0.0", + "uint8arrays": "^6.1.1" } } diff --git a/packages/blockstore-core/src/base.ts b/packages/blockstore-core/src/base.ts index dcb216a0..ecbb805e 100644 --- a/packages/blockstore-core/src/base.ts +++ b/packages/blockstore-core/src/base.ts @@ -1,5 +1,6 @@ +import type { AbortOptions } from 'abort-error' import type { Blockstore, InputPair, Pair } from 'interface-blockstore' -import type { AbortOptions, Await, AwaitGenerator, AwaitIterable } from 'interface-store' +import type { Await, AwaitGenerator, AwaitIterable } from 'interface-store' import type { CID } from 'multiformats/cid' export class BaseBlockstore implements Blockstore { diff --git a/packages/blockstore-core/src/black-hole.ts b/packages/blockstore-core/src/black-hole.ts index f6576793..83653664 100644 --- a/packages/blockstore-core/src/black-hole.ts +++ b/packages/blockstore-core/src/black-hole.ts @@ -1,7 +1,8 @@ import { NotFoundError } from 'interface-store' import { BaseBlockstore } from './base.ts' +import type { AbortOptions } from 'abort-error' import type { Pair } from 'interface-blockstore' -import type { AbortOptions, Await, AwaitGenerator, AwaitIterable } from 'interface-store' +import type { Await, AwaitGenerator, AwaitIterable } from 'interface-store' import type { CID } from 'multiformats/cid' export class BlackHoleBlockstore extends BaseBlockstore { diff --git a/packages/blockstore-core/src/identity.ts b/packages/blockstore-core/src/identity.ts index 9021eaca..514f4fe3 100644 --- a/packages/blockstore-core/src/identity.ts +++ b/packages/blockstore-core/src/identity.ts @@ -1,7 +1,8 @@ import { NotFoundError } from 'interface-store' import { BaseBlockstore } from './base.ts' +import type { AbortOptions } from 'abort-error' import type { Blockstore, Pair } from 'interface-blockstore' -import type { AbortOptions, Await, AwaitIterable } from 'interface-store' +import type { Await, AwaitIterable } from 'interface-store' import type { CID } from 'multiformats/cid' // https://github.com/multiformats/multicodec/blob/d06fc6194710e8909bac64273c43f16b56ca4c34/table.csv#L2 diff --git a/packages/blockstore-core/src/memory.ts b/packages/blockstore-core/src/memory.ts index 2601f993..3cd36b7c 100644 --- a/packages/blockstore-core/src/memory.ts +++ b/packages/blockstore-core/src/memory.ts @@ -5,8 +5,9 @@ import { CID } from 'multiformats/cid' import * as raw from 'multiformats/codecs/raw' import * as Digest from 'multiformats/hashes/digest' import { BaseBlockstore } from './base.ts' +import type { AbortOptions } from 'abort-error' import type { Pair } from 'interface-blockstore' -import type { AbortOptions, Await, AwaitGenerator, AwaitIterable } from 'interface-store' +import type { Await, AwaitGenerator, AwaitIterable } from 'interface-store' function isPromise (p?: any): p is Promise { return typeof p?.then === 'function' diff --git a/packages/blockstore-core/src/tiered.ts b/packages/blockstore-core/src/tiered.ts index 61af77e6..6c964009 100644 --- a/packages/blockstore-core/src/tiered.ts +++ b/packages/blockstore-core/src/tiered.ts @@ -3,8 +3,9 @@ import { NotFoundError } from 'interface-store' import filter from 'it-filter' import merge from 'it-merge' import { BaseBlockstore } from './base.ts' +import type { AbortOptions } from 'abort-error' import type { Blockstore, InputPair, Pair } from 'interface-blockstore' -import type { AbortOptions, AwaitGenerator, AwaitIterable } from 'interface-store' +import type { AwaitGenerator, AwaitIterable } from 'interface-store' import type { CID } from 'multiformats/cid' const log = logger('blockstore:core:tiered') diff --git a/packages/blockstore-core/test/identity.spec.ts b/packages/blockstore-core/test/identity.spec.ts index cec98890..6f566baf 100644 --- a/packages/blockstore-core/test/identity.spec.ts +++ b/packages/blockstore-core/test/identity.spec.ts @@ -8,8 +8,8 @@ import { identity } from 'multiformats/hashes/identity' import { sha256 } from 'multiformats/hashes/sha2' import { IdentityBlockstore } from '../src/identity.ts' import { MemoryBlockstore } from '../src/memory.ts' +import type { AbortOptions } from 'abort-error' import type { Blockstore } from 'interface-blockstore' -import type { AbortOptions } from 'interface-store' describe('identity', () => { let blockstore: Blockstore diff --git a/packages/blockstore-fs/src/index.ts b/packages/blockstore-fs/src/index.ts index a5e6d303..d0f952cd 100644 --- a/packages/blockstore-fs/src/index.ts +++ b/packages/blockstore-fs/src/index.ts @@ -22,8 +22,9 @@ import { raceSignal } from 'race-signal' import { Writer } from 'steno' import { NextToLast } from './sharding.ts' import type { ShardingStrategy } from './sharding.ts' +import type { AbortOptions } from 'abort-error' import type { Blockstore, Pair } from 'interface-blockstore' -import type { AbortOptions, AwaitGenerator, AwaitIterable } from 'interface-store' +import type { AwaitGenerator, AwaitIterable } from 'interface-store' import type { CID } from 'multiformats/cid' import type { FileHandle } from 'node:fs/promises' diff --git a/packages/blockstore-idb/package.json b/packages/blockstore-idb/package.json index c8d63e0d..19c290b1 100644 --- a/packages/blockstore-idb/package.json +++ b/packages/blockstore-idb/package.json @@ -149,7 +149,7 @@ "interface-blockstore": "^6.0.0", "interface-store": "^7.0.0", "it-all": "^3.0.9", - "it-to-buffer": "^4.0.10", + "it-to-buffer": "^5.0.0", "multiformats": "^14.0.0", "race-signal": "^2.0.0" }, diff --git a/packages/blockstore-idb/src/index.ts b/packages/blockstore-idb/src/index.ts index c75ba256..a91cfb4f 100644 --- a/packages/blockstore-idb/src/index.ts +++ b/packages/blockstore-idb/src/index.ts @@ -22,9 +22,10 @@ import { CID } from 'multiformats/cid' import * as raw from 'multiformats/codecs/raw' import * as Digest from 'multiformats/hashes/digest' import { raceSignal } from 'race-signal' +import type { AbortOptions } from 'abort-error' import type { IDBPDatabase } from 'idb' import type { Pair } from 'interface-blockstore' -import type { AbortOptions, AwaitGenerator, AwaitIterable } from 'interface-store' +import type { AwaitGenerator, AwaitIterable } from 'interface-store' import type { MultibaseCodec } from 'multiformats/bases/interface' export interface IDBBlockstoreInit { diff --git a/packages/blockstore-level/package.json b/packages/blockstore-level/package.json index 08131867..94c76dd9 100644 --- a/packages/blockstore-level/package.json +++ b/packages/blockstore-level/package.json @@ -151,11 +151,11 @@ "interface-blockstore": "^6.0.0", "interface-store": "^7.0.0", "it-all": "^3.0.9", - "it-to-buffer": "^4.0.10", + "it-to-buffer": "^5.0.0", "level": "^10.0.0", "multiformats": "^14.0.0", "race-signal": "^2.0.0", - "uint8arrays": "^5.1.0" + "uint8arrays": "^6.1.1" }, "devDependencies": { "aegir": "^48.0.4", diff --git a/packages/blockstore-level/src/index.ts b/packages/blockstore-level/src/index.ts index 36785f5c..c1c53cba 100644 --- a/packages/blockstore-level/src/index.ts +++ b/packages/blockstore-level/src/index.ts @@ -23,8 +23,9 @@ import * as raw from 'multiformats/codecs/raw' import * as Digest from 'multiformats/hashes/digest' import { raceSignal } from 'race-signal' import { toString as uint8ArrayToString } from 'uint8arrays/to-string' +import type { AbortOptions } from 'abort-error' import type { Pair } from 'interface-blockstore' -import type { AbortOptions, AwaitGenerator, AwaitIterable } from 'interface-store' +import type { AwaitGenerator, AwaitIterable } from 'interface-store' import type { DatabaseOptions, OpenOptions, IteratorOptions } from 'level' import type { MultibaseCodec } from 'multiformats/bases/interface' diff --git a/packages/blockstore-s3/package.json b/packages/blockstore-s3/package.json index fddfda11..dd6d0439 100644 --- a/packages/blockstore-s3/package.json +++ b/packages/blockstore-s3/package.json @@ -150,7 +150,7 @@ "interface-blockstore": "^6.0.0", "interface-store": "^7.0.0", "multiformats": "^14.0.0", - "uint8arrays": "^5.1.0" + "uint8arrays": "^6.1.1" }, "devDependencies": { "@types/sinon": "^21.0.1", diff --git a/packages/blockstore-s3/src/index.ts b/packages/blockstore-s3/src/index.ts index 7601ad78..269e923f 100644 --- a/packages/blockstore-s3/src/index.ts +++ b/packages/blockstore-s3/src/index.ts @@ -49,8 +49,9 @@ import { fromString as uint8arrayFromString } from 'uint8arrays' import { NextToLast } from './sharding.ts' import type { ShardingStrategy } from './sharding.ts' import type { S3 } from '@aws-sdk/client-s3' +import type { AbortOptions } from 'abort-error' import type { Pair } from 'interface-blockstore' -import type { AbortOptions, AwaitGenerator } from 'interface-store' +import type { AwaitGenerator } from 'interface-store' import type { CID } from 'multiformats/cid' export type { ShardingStrategy } diff --git a/packages/datastore-core/package.json b/packages/datastore-core/package.json index 6505f953..5cc7e7ae 100644 --- a/packages/datastore-core/package.json +++ b/packages/datastore-core/package.json @@ -226,6 +226,6 @@ "aegir": "^48.0.4", "interface-datastore-tests": "^6.0.0", "it-all": "^3.0.9", - "uint8arrays": "^5.1.0" + "uint8arrays": "^6.1.1" } } diff --git a/packages/datastore-core/src/base.ts b/packages/datastore-core/src/base.ts index 9a97af7f..06a1b393 100644 --- a/packages/datastore-core/src/base.ts +++ b/packages/datastore-core/src/base.ts @@ -2,8 +2,9 @@ import drain from 'it-drain' import filter from 'it-filter' import sort from 'it-sort' import take from 'it-take' +import type { AbortOptions } from 'abort-error' import type { Batch, Datastore, Key, KeyQuery, Pair, Query } from 'interface-datastore' -import type { AbortOptions, Await, AwaitGenerator, AwaitIterable } from 'interface-store' +import type { Await, AwaitGenerator, AwaitIterable } from 'interface-store' export class BaseDatastore implements Datastore { put (key: Key, val: Uint8Array, options?: AbortOptions): Await { diff --git a/packages/datastore-core/src/black-hole.ts b/packages/datastore-core/src/black-hole.ts index 5aa8730d..bd0a52c3 100644 --- a/packages/datastore-core/src/black-hole.ts +++ b/packages/datastore-core/src/black-hole.ts @@ -1,8 +1,9 @@ import { NotFoundError } from 'interface-store' import { BaseDatastore } from './base.ts' +import type { AbortOptions } from 'abort-error' import type { Pair, Query, KeyQuery } from 'interface-datastore' import type { Key } from 'interface-datastore/key' -import type { AbortOptions, Await, AwaitGenerator } from 'interface-store' +import type { Await, AwaitGenerator } from 'interface-store' export class BlackHoleDatastore extends BaseDatastore { put (key: Key, value: Uint8Array, options?: AbortOptions): Await { diff --git a/packages/datastore-core/src/keytransform.ts b/packages/datastore-core/src/keytransform.ts index d68148da..b7f4ae4c 100644 --- a/packages/datastore-core/src/keytransform.ts +++ b/packages/datastore-core/src/keytransform.ts @@ -2,8 +2,9 @@ import map from 'it-map' import { pipe } from 'it-pipe' import { BaseDatastore } from './base.ts' import type { KeyTransform } from './index.ts' +import type { AbortOptions } from 'abort-error' import type { Batch, Datastore, Key, KeyQuery, Pair, Query } from 'interface-datastore' -import type { AbortOptions, AwaitGenerator, AwaitIterable } from 'interface-store' +import type { AwaitGenerator, AwaitIterable } from 'interface-store' /** * A datastore shim, that wraps around a given datastore, changing diff --git a/packages/datastore-core/src/memory.ts b/packages/datastore-core/src/memory.ts index b56e8b9e..5ff65595 100644 --- a/packages/datastore-core/src/memory.ts +++ b/packages/datastore-core/src/memory.ts @@ -1,8 +1,9 @@ import { Key } from 'interface-datastore/key' import { NotFoundError } from 'interface-store' import { BaseDatastore } from './base.ts' +import type { AbortOptions } from 'abort-error' import type { KeyQuery, Pair, Query } from 'interface-datastore' -import type { AbortOptions, Await, AwaitGenerator } from 'interface-store' +import type { Await, AwaitGenerator } from 'interface-store' export class MemoryDatastore extends BaseDatastore { private readonly data: Map diff --git a/packages/datastore-core/src/mount.ts b/packages/datastore-core/src/mount.ts index a95940f4..80065814 100644 --- a/packages/datastore-core/src/mount.ts +++ b/packages/datastore-core/src/mount.ts @@ -4,8 +4,9 @@ import merge from 'it-merge' import sort from 'it-sort' import take from 'it-take' import { BaseDatastore } from './base.ts' +import type { AbortOptions } from 'abort-error' import type { Batch, Datastore, Key, KeyQuery, Pair, Query } from 'interface-datastore' -import type { AbortOptions, AwaitGenerator } from 'interface-store' +import type { AwaitGenerator } from 'interface-store' /** * A datastore that can combine multiple stores inside various diff --git a/packages/datastore-core/src/namespace.ts b/packages/datastore-core/src/namespace.ts index 2f7ce311..4a7593c7 100644 --- a/packages/datastore-core/src/namespace.ts +++ b/packages/datastore-core/src/namespace.ts @@ -1,8 +1,9 @@ import { Key } from 'interface-datastore' import map from 'it-map' import { KeyTransformDatastore } from './keytransform.ts' +import type { AbortOptions } from 'abort-error' import type { Datastore, Query, Pair, KeyQuery } from 'interface-datastore' -import type { AbortOptions, AwaitGenerator } from 'interface-store' +import type { AwaitGenerator } from 'interface-store' /** * Wraps a given datastore into a keytransform which diff --git a/packages/datastore-core/src/sharding.ts b/packages/datastore-core/src/sharding.ts index dd483f80..a9e81f37 100644 --- a/packages/datastore-core/src/sharding.ts +++ b/packages/datastore-core/src/sharding.ts @@ -7,8 +7,9 @@ import { SHARDING_FN } from './shard.ts' import type { Shard } from './index.ts' +import type { AbortOptions } from 'abort-error' import type { Batch, KeyQuery, KeyQueryFilter, Pair, Query, QueryFilter, Datastore } from 'interface-datastore' -import type { AbortOptions, AwaitGenerator, AwaitIterable } from 'interface-store' +import type { AwaitGenerator, AwaitIterable } from 'interface-store' const shardKey = new Key(SHARDING_FN) diff --git a/packages/datastore-core/src/tiered.ts b/packages/datastore-core/src/tiered.ts index 3de38600..b9c4c2fc 100644 --- a/packages/datastore-core/src/tiered.ts +++ b/packages/datastore-core/src/tiered.ts @@ -1,8 +1,9 @@ import { logger } from '@libp2p/logger' import { NotFoundError } from 'interface-store' import { BaseDatastore } from './base.ts' +import type { AbortOptions } from 'abort-error' import type { Batch, Datastore, Key, KeyQuery, Pair, Query } from 'interface-datastore' -import type { AbortOptions, AwaitGenerator, AwaitIterable } from 'interface-store' +import type { AwaitGenerator, AwaitIterable } from 'interface-store' const log = logger('datastore:core:tiered') diff --git a/packages/datastore-fs/src/index.ts b/packages/datastore-fs/src/index.ts index f1116098..60ebd8a3 100644 --- a/packages/datastore-fs/src/index.ts +++ b/packages/datastore-fs/src/index.ts @@ -22,8 +22,9 @@ import map from 'it-map' import parallel from 'it-parallel-batch' import { raceSignal } from 'race-signal' import { Writer } from 'steno' +import type { AbortOptions } from 'abort-error' import type { KeyQuery, Pair, Query } from 'interface-datastore' -import type { AbortOptions, AwaitGenerator, AwaitIterable } from 'interface-store' +import type { AwaitGenerator, AwaitIterable } from 'interface-store' /** * Write a file atomically diff --git a/packages/datastore-idb/src/index.ts b/packages/datastore-idb/src/index.ts index eb040bc1..d76196b0 100644 --- a/packages/datastore-idb/src/index.ts +++ b/packages/datastore-idb/src/index.ts @@ -19,9 +19,10 @@ import { DeleteFailedError, GetFailedError, NotFoundError, OpenFailedError, PutF import filter from 'it-filter' import sort from 'it-sort' import { raceSignal } from 'race-signal' +import type { AbortOptions } from 'abort-error' import type { IDBPDatabase } from 'idb' import type { Batch, KeyQuery, Pair, Query } from 'interface-datastore' -import type { AbortOptions, AwaitGenerator } from 'interface-store' +import type { AwaitGenerator } from 'interface-store' export interface IDBDatastoreInit { /** diff --git a/packages/datastore-level/src/index.ts b/packages/datastore-level/src/index.ts index ab238572..b3804060 100644 --- a/packages/datastore-level/src/index.ts +++ b/packages/datastore-level/src/index.ts @@ -53,8 +53,9 @@ import sort from 'it-sort' import take from 'it-take' import { Level } from 'level' import { raceSignal } from 'race-signal' +import type { AbortOptions } from 'abort-error' import type { Batch, KeyQuery, Pair, Query } from 'interface-datastore' -import type { AbortOptions, AwaitGenerator } from 'interface-store' +import type { AwaitGenerator } from 'interface-store' import type { DatabaseOptions, OpenOptions, IteratorOptions } from 'level' interface BatchPut { diff --git a/packages/datastore-s3/package.json b/packages/datastore-s3/package.json index e56a01f5..2bbaca66 100644 --- a/packages/datastore-s3/package.json +++ b/packages/datastore-s3/package.json @@ -150,8 +150,8 @@ "interface-datastore": "^9.0.0", "interface-store": "^7.0.0", "it-filter": "^3.1.4", - "it-to-buffer": "^4.0.10", - "uint8arrays": "^5.1.0" + "it-to-buffer": "^5.0.0", + "uint8arrays": "^6.1.1" }, "devDependencies": { "@types/sinon": "^21.0.1", diff --git a/packages/datastore-s3/src/index.ts b/packages/datastore-s3/src/index.ts index 1832d252..5d453e58 100644 --- a/packages/datastore-s3/src/index.ts +++ b/packages/datastore-s3/src/index.ts @@ -46,8 +46,9 @@ import filter from 'it-filter' import toBuffer from 'it-to-buffer' import { fromString as uint8arrayFromString } from 'uint8arrays' import type { S3 } from '@aws-sdk/client-s3' +import type { AbortOptions } from 'abort-error' import type { KeyQuery, Pair, Query } from 'interface-datastore' -import type { AbortOptions, AwaitGenerator } from 'interface-store' +import type { AwaitGenerator } from 'interface-store' export interface S3DatastoreInit { /** diff --git a/packages/interface-blockstore-tests/package.json b/packages/interface-blockstore-tests/package.json index f76219d9..0e21ce5c 100644 --- a/packages/interface-blockstore-tests/package.json +++ b/packages/interface-blockstore-tests/package.json @@ -142,7 +142,7 @@ "it-drain": "^3.0.10", "it-map": "^3.1.4", "multiformats": "^14.0.0", - "uint8arrays": "^5.1.0" + "uint8arrays": "^6.1.1" }, "devDependencies": { "aegir": "^48.0.4" diff --git a/packages/interface-blockstore/src/index.ts b/packages/interface-blockstore/src/index.ts index 12d6978d..59b09c3d 100644 --- a/packages/interface-blockstore/src/index.ts +++ b/packages/interface-blockstore/src/index.ts @@ -14,12 +14,8 @@ * - S3: [`blockstore-s3`](https://github.com/ipfs/js-stores/tree/main/packages/blockstore-s3) */ -import type { - AbortOptions, - AwaitGenerator, - AwaitIterable, - Store -} from 'interface-store' +import type { AbortOptions } from 'abort-error' +import type { AwaitGenerator, AwaitIterable, Store } from 'interface-store' import type { CID } from 'multiformats/cid' export interface Pair { diff --git a/packages/interface-datastore-tests/package.json b/packages/interface-datastore-tests/package.json index 7369f473..08641ed4 100644 --- a/packages/interface-datastore-tests/package.json +++ b/packages/interface-datastore-tests/package.json @@ -142,7 +142,7 @@ "it-all": "^3.0.9", "it-drain": "^3.0.10", "it-length": "^3.0.9", - "uint8arrays": "^5.1.0" + "uint8arrays": "^6.1.1" }, "devDependencies": { "aegir": "^48.0.4" diff --git a/packages/interface-datastore/package.json b/packages/interface-datastore/package.json index 0eec6703..a225b428 100644 --- a/packages/interface-datastore/package.json +++ b/packages/interface-datastore/package.json @@ -165,7 +165,7 @@ }, "dependencies": { "interface-store": "^7.0.0", - "uint8arrays": "^5.1.0" + "uint8arrays": "^6.1.1" }, "devDependencies": { "aegir": "^48.0.4" diff --git a/packages/interface-datastore/src/index.ts b/packages/interface-datastore/src/index.ts index d7b395b1..721e98b9 100644 --- a/packages/interface-datastore/src/index.ts +++ b/packages/interface-datastore/src/index.ts @@ -97,12 +97,8 @@ */ import { Key } from './key.ts' -import type { - Await, - Store, - AbortOptions, - AwaitGenerator -} from 'interface-store' +import type { AbortOptions } from 'abort-error' +import type { Await, Store, AwaitGenerator } from 'interface-store' export interface Pair { key: Key diff --git a/packages/interface-store/src/index.ts b/packages/interface-store/src/index.ts index 686eef96..f7741d1f 100644 --- a/packages/interface-store/src/index.ts +++ b/packages/interface-store/src/index.ts @@ -4,6 +4,8 @@ * An abstraction of the Datastore/Blockstore codebases. */ +import type { AbortOptions } from 'abort-error' + /** * An iterable or async iterable of values */ @@ -19,15 +21,6 @@ export type AwaitGenerator = Generator = Promise | T -/** - * Options for async operations - * - * @deprecated import from 'abort-error' module instead - this will be removed in a future release - */ -export interface AbortOptions { - signal?: AbortSignal -} - export interface Store Date: Mon, 11 May 2026 17:05:36 +0300 Subject: [PATCH 3/6] chore: update deps --- packages/blockstore-core/src/base.ts | 17 +++++------ packages/blockstore-core/src/black-hole.ts | 9 +++--- packages/blockstore-core/src/identity.ts | 7 ++--- packages/blockstore-core/src/memory.ts | 11 ++++--- packages/blockstore-core/src/tiered.ts | 11 ++++--- packages/blockstore-fs/src/index.ts | 13 ++++---- packages/blockstore-idb/src/index.ts | 7 ++--- packages/blockstore-level/src/index.ts | 19 ++++++++---- packages/blockstore-s3/src/index.ts | 5 ++-- packages/datastore-core/src/base.ts | 23 +++++++------- packages/datastore-core/src/black-hole.ts | 13 ++++---- packages/datastore-core/src/keytransform.ts | 11 ++++--- packages/datastore-core/src/memory.ts | 13 ++++---- packages/datastore-core/src/mount.ts | 5 ++-- packages/datastore-core/src/namespace.ts | 5 ++-- packages/datastore-core/src/sharding.ts | 11 ++++--- packages/datastore-core/src/tiered.ts | 9 +++--- packages/datastore-fs/src/index.ts | 11 ++++--- packages/datastore-idb/src/index.ts | 5 ++-- packages/datastore-level/src/index.ts | 5 ++-- packages/datastore-s3/src/index.ts | 5 ++-- packages/interface-blockstore/src/index.ts | 10 +++---- packages/interface-datastore/src/index.ts | 10 +++---- packages/interface-store/src/index.ts | 33 ++++++--------------- 24 files changed, 120 insertions(+), 148 deletions(-) diff --git a/packages/blockstore-core/src/base.ts b/packages/blockstore-core/src/base.ts index ecbb805e..a90ef810 100644 --- a/packages/blockstore-core/src/base.ts +++ b/packages/blockstore-core/src/base.ts @@ -1,29 +1,28 @@ import type { AbortOptions } from 'abort-error' import type { Blockstore, InputPair, Pair } from 'interface-blockstore' -import type { Await, AwaitGenerator, AwaitIterable } from 'interface-store' import type { CID } from 'multiformats/cid' export class BaseBlockstore implements Blockstore { - has (key: CID, options?: AbortOptions): Await { + has (key: CID, options?: AbortOptions): boolean | Promise { return Promise.reject(new Error('.has is not implemented')) } - put (key: CID, val: Uint8Array | AwaitIterable, options?: AbortOptions): Await { + put (key: CID, val: Uint8Array | Iterable | AsyncIterable, options?: AbortOptions): CID | Promise { return Promise.reject(new Error('.put is not implemented')) } - async * putMany (source: AwaitIterable, options?: AbortOptions): AwaitGenerator { + async * putMany (source: Iterable | AsyncIterable, options?: AbortOptions): Generator | AsyncGenerator { for await (const { cid, bytes } of source) { await this.put(cid, bytes, options) yield cid } } - get (key: CID, options?: AbortOptions): AwaitGenerator { + get (key: CID, options?: AbortOptions): Generator | AsyncGenerator { throw new Error('.get is not implemented') } - async * getMany (source: AwaitIterable, options?: AbortOptions): AwaitGenerator { + async * getMany (source: Iterable | AsyncIterable, options?: AbortOptions): Generator | AsyncGenerator { for await (const key of source) { yield { cid: key, @@ -32,11 +31,11 @@ export class BaseBlockstore implements Blockstore { } } - delete (key: CID, options?: AbortOptions): Await { + delete (key: CID, options?: AbortOptions): void | Promise { return Promise.reject(new Error('.delete is not implemented')) } - async * deleteMany (source: AwaitIterable, options?: AbortOptions): AwaitGenerator { + async * deleteMany (source: Iterable | AsyncIterable, options?: AbortOptions): Generator | AsyncGenerator { for await (const key of source) { await this.delete(key, options) yield key @@ -46,7 +45,7 @@ export class BaseBlockstore implements Blockstore { /** * Extending classes should override `query` or implement this method */ - async * getAll (options?: AbortOptions): AwaitGenerator { // eslint-disable-line require-yield + async * getAll (options?: AbortOptions): Generator | AsyncGenerator { // eslint-disable-line require-yield throw new Error('.getAll is not implemented') } } diff --git a/packages/blockstore-core/src/black-hole.ts b/packages/blockstore-core/src/black-hole.ts index 83653664..6ed69c68 100644 --- a/packages/blockstore-core/src/black-hole.ts +++ b/packages/blockstore-core/src/black-hole.ts @@ -2,21 +2,20 @@ import { NotFoundError } from 'interface-store' import { BaseBlockstore } from './base.ts' import type { AbortOptions } from 'abort-error' import type { Pair } from 'interface-blockstore' -import type { Await, AwaitGenerator, AwaitIterable } from 'interface-store' import type { CID } from 'multiformats/cid' export class BlackHoleBlockstore extends BaseBlockstore { - put (key: CID, value: Uint8Array | AwaitIterable, options?: AbortOptions): Await { + put (key: CID, value: Uint8Array | Iterable | AsyncIterable, options?: AbortOptions): CID | Promise { options?.signal?.throwIfAborted() return key } - get (key: CID, options?: AbortOptions): AwaitGenerator { + get (key: CID, options?: AbortOptions): Generator | AsyncGenerator { options?.signal?.throwIfAborted() throw new NotFoundError() } - has (key: CID, options?: AbortOptions): Await { + has (key: CID, options?: AbortOptions): boolean | Promise { options?.signal?.throwIfAborted() return false } @@ -26,7 +25,7 @@ export class BlackHoleBlockstore extends BaseBlockstore { } // eslint-disable-next-line require-yield - async * getAll (options?: AbortOptions): AwaitGenerator { + async * getAll (options?: AbortOptions): Generator | AsyncGenerator { options?.signal?.throwIfAborted() } } diff --git a/packages/blockstore-core/src/identity.ts b/packages/blockstore-core/src/identity.ts index 514f4fe3..fb0f26fc 100644 --- a/packages/blockstore-core/src/identity.ts +++ b/packages/blockstore-core/src/identity.ts @@ -2,7 +2,6 @@ import { NotFoundError } from 'interface-store' import { BaseBlockstore } from './base.ts' import type { AbortOptions } from 'abort-error' import type { Blockstore, Pair } from 'interface-blockstore' -import type { Await, AwaitIterable } from 'interface-store' import type { CID } from 'multiformats/cid' // https://github.com/multiformats/multicodec/blob/d06fc6194710e8909bac64273c43f16b56ca4c34/table.csv#L2 @@ -28,7 +27,7 @@ export class IdentityBlockstore extends BaseBlockstore { this.maxDigestLength = init?.maxDigestLength } - put (key: CID, block: Uint8Array | AwaitIterable, options?: AbortOptions): Await { + put (key: CID, block: Uint8Array | Iterable | AsyncIterable, options?: AbortOptions): CID | Promise { if (key.multihash.code === IDENTITY_CODEC) { if (this.maxDigestLength != null && key.multihash.digest.byteLength > this.maxDigestLength) { throw new IdentityHashDigestTooLongError(`Identity digest too long - ${key.multihash.digest.byteLength} > this.maxDigestLength`) @@ -65,7 +64,7 @@ export class IdentityBlockstore extends BaseBlockstore { yield * this.child.get(key, options) } - has (key: CID, options?: AbortOptions): Await { + has (key: CID, options?: AbortOptions): boolean | Promise { if (key.multihash.code === IDENTITY_CODEC) { if (this.maxDigestLength != null && key.multihash.digest.byteLength > this.maxDigestLength) { throw new IdentityHashDigestTooLongError(`Identity digest too long - ${key.multihash.digest.byteLength} > this.maxDigestLength`) @@ -83,7 +82,7 @@ export class IdentityBlockstore extends BaseBlockstore { return this.child.has(key, options) } - delete (key: CID, options?: AbortOptions): Await { + delete (key: CID, options?: AbortOptions): void | Promise { if (key.code === IDENTITY_CODEC) { if (this.maxDigestLength != null && key.multihash.digest.byteLength > this.maxDigestLength) { throw new IdentityHashDigestTooLongError(`Identity digest too long - ${key.multihash.digest.byteLength} > this.maxDigestLength`) diff --git a/packages/blockstore-core/src/memory.ts b/packages/blockstore-core/src/memory.ts index 3cd36b7c..c518e098 100644 --- a/packages/blockstore-core/src/memory.ts +++ b/packages/blockstore-core/src/memory.ts @@ -7,7 +7,6 @@ import * as Digest from 'multiformats/hashes/digest' import { BaseBlockstore } from './base.ts' import type { AbortOptions } from 'abort-error' import type { Pair } from 'interface-blockstore' -import type { Await, AwaitGenerator, AwaitIterable } from 'interface-store' function isPromise (p?: any): p is Promise { return typeof p?.then === 'function' @@ -22,7 +21,7 @@ export class MemoryBlockstore extends BaseBlockstore { this.data = new Map() } - put (key: CID, val: Uint8Array | AwaitIterable, options?: AbortOptions): Await { + put (key: CID, val: Uint8Array | Iterable | AsyncIterable, options?: AbortOptions): CID | Promise { options?.signal?.throwIfAborted() let buf: Uint8Array[] @@ -44,7 +43,7 @@ export class MemoryBlockstore extends BaseBlockstore { return this._put(key, buf, options) } - private _put (key: CID, val: Uint8Array[], options?: AbortOptions): Await { + private _put (key: CID, val: Uint8Array[], options?: AbortOptions): CID | Promise { options?.signal?.throwIfAborted() this.data.set(base32.encode(key.multihash.bytes), val) @@ -52,7 +51,7 @@ export class MemoryBlockstore extends BaseBlockstore { return key } - * get (key: CID, options?: AbortOptions): AwaitGenerator { + * get (key: CID, options?: AbortOptions): Generator | AsyncGenerator { options?.signal?.throwIfAborted() const buf = this.data.get(base32.encode(key.multihash.bytes)) @@ -63,7 +62,7 @@ export class MemoryBlockstore extends BaseBlockstore { yield * buf } - has (key: CID, options?: AbortOptions): Await { + has (key: CID, options?: AbortOptions): boolean | Promise { options?.signal?.throwIfAborted() return this.data.has(base32.encode(key.multihash.bytes)) } @@ -73,7 +72,7 @@ export class MemoryBlockstore extends BaseBlockstore { this.data.delete(base32.encode(key.multihash.bytes)) } - * getAll (options?: AbortOptions): AwaitGenerator { + * getAll (options?: AbortOptions): Generator | AsyncGenerator { options?.signal?.throwIfAborted() for (const [key, value] of this.data.entries()) { diff --git a/packages/blockstore-core/src/tiered.ts b/packages/blockstore-core/src/tiered.ts index 6c964009..68d9199f 100644 --- a/packages/blockstore-core/src/tiered.ts +++ b/packages/blockstore-core/src/tiered.ts @@ -5,7 +5,6 @@ import merge from 'it-merge' import { BaseBlockstore } from './base.ts' import type { AbortOptions } from 'abort-error' import type { Blockstore, InputPair, Pair } from 'interface-blockstore' -import type { AwaitGenerator, AwaitIterable } from 'interface-store' import type { CID } from 'multiformats/cid' const log = logger('blockstore:core:tiered') @@ -25,7 +24,7 @@ export class TieredBlockstore extends BaseBlockstore { this.stores = stores.slice() } - async put (key: CID, value: Uint8Array | AwaitIterable, options?: AbortOptions): Promise { + async put (key: CID, value: Uint8Array | Iterable | AsyncIterable, options?: AbortOptions): Promise { await Promise.all( this.stores.map(async store => { await store.put(key, value, options) @@ -35,7 +34,7 @@ export class TieredBlockstore extends BaseBlockstore { return key } - async * get (key: CID, options?: AbortOptions): AwaitGenerator { + async * get (key: CID, options?: AbortOptions): Generator | AsyncGenerator { let error: Error | undefined for (const store of this.stores) { @@ -69,21 +68,21 @@ export class TieredBlockstore extends BaseBlockstore { ) } - async * putMany (source: AwaitIterable, options: AbortOptions = {}): AwaitGenerator { + async * putMany (source: Iterable | AsyncIterable, options: AbortOptions = {}): Generator | AsyncGenerator { for await (const pair of source) { await this.put(pair.cid, pair.bytes, options) yield pair.cid } } - async * deleteMany (source: AwaitIterable, options: AbortOptions = {}): AwaitGenerator { + async * deleteMany (source: Iterable | AsyncIterable, options: AbortOptions = {}): Generator | AsyncGenerator { for await (const cid of source) { await this.delete(cid, options) yield cid } } - async * getAll (options?: AbortOptions): AwaitGenerator { + async * getAll (options?: AbortOptions): Generator | AsyncGenerator { // deduplicate yielded pairs const seen = new Set() diff --git a/packages/blockstore-fs/src/index.ts b/packages/blockstore-fs/src/index.ts index d0f952cd..ee07518c 100644 --- a/packages/blockstore-fs/src/index.ts +++ b/packages/blockstore-fs/src/index.ts @@ -24,14 +24,13 @@ import { NextToLast } from './sharding.ts' import type { ShardingStrategy } from './sharding.ts' import type { AbortOptions } from 'abort-error' import type { Blockstore, Pair } from 'interface-blockstore' -import type { AwaitGenerator, AwaitIterable } from 'interface-store' import type { CID } from 'multiformats/cid' import type { FileHandle } from 'node:fs/promises' /** * Write a file atomically */ -async function writeFile (file: string, contents: Uint8Array | AwaitIterable, options?: AbortOptions): Promise { +async function writeFile (file: string, contents: Uint8Array | Iterable | AsyncIterable, options?: AbortOptions): Promise { try { options?.signal?.throwIfAborted() await raceSignal(fs.mkdir(path.dirname(file), { @@ -148,7 +147,7 @@ export class FsBlockstore implements Blockstore { await Promise.resolve() } - async put (key: CID, val: Uint8Array | AwaitIterable, options?: AbortOptions): Promise { + async put (key: CID, val: Uint8Array | Iterable | AsyncIterable, options?: AbortOptions): Promise { const { dir, file } = this.shardingStrategy.encode(key) try { @@ -160,7 +159,7 @@ export class FsBlockstore implements Blockstore { } } - async * putMany (source: AwaitIterable, options?: AbortOptions): AsyncGenerator { + async * putMany (source: Iterable | AsyncIterable, options?: AbortOptions): AsyncGenerator { yield * parallelBatch( map(source, ({ cid, bytes }) => { return async () => { @@ -192,7 +191,7 @@ export class FsBlockstore implements Blockstore { } } - async * getMany (source: AwaitIterable, options?: AbortOptions): AsyncGenerator { + async * getMany (source: Iterable | AsyncIterable, options?: AbortOptions): AsyncGenerator { yield * parallelBatch( map(source, key => { return async () => { @@ -221,7 +220,7 @@ export class FsBlockstore implements Blockstore { } } - async * deleteMany (source: AwaitIterable, options?: AbortOptions): AsyncGenerator { + async * deleteMany (source: Iterable | AsyncIterable, options?: AbortOptions): AsyncGenerator { yield * parallelBatch( map(source, key => { return async () => { @@ -246,7 +245,7 @@ export class FsBlockstore implements Blockstore { return true } - async * getAll (options?: AbortOptions): AwaitGenerator { + async * getAll (options?: AbortOptions): Generator | AsyncGenerator { const pattern = `**/*${this.shardingStrategy.extension}` .split(path.sep) .join('/') diff --git a/packages/blockstore-idb/src/index.ts b/packages/blockstore-idb/src/index.ts index a91cfb4f..31563744 100644 --- a/packages/blockstore-idb/src/index.ts +++ b/packages/blockstore-idb/src/index.ts @@ -25,7 +25,6 @@ import { raceSignal } from 'race-signal' import type { AbortOptions } from 'abort-error' import type { IDBPDatabase } from 'idb' import type { Pair } from 'interface-blockstore' -import type { AwaitGenerator, AwaitIterable } from 'interface-store' import type { MultibaseCodec } from 'multiformats/bases/interface' export interface IDBBlockstoreInit { @@ -88,7 +87,7 @@ export class IDBBlockstore extends BaseBlockstore { this.db?.close() } - async put (key: CID, val: Uint8Array | AwaitIterable, options?: AbortOptions): Promise { + async put (key: CID, val: Uint8Array | Iterable | AsyncIterable, options?: AbortOptions): Promise { if (this.db == null) { throw new Error('Blockstore needs to be opened.') } @@ -111,7 +110,7 @@ export class IDBBlockstore extends BaseBlockstore { return key } - async * get (key: CID, options?: AbortOptions): AwaitGenerator { + async * get (key: CID, options?: AbortOptions): Generator | AsyncGenerator { if (this.db == null) { throw new Error('Blockstore needs to be opened.') } @@ -160,7 +159,7 @@ export class IDBBlockstore extends BaseBlockstore { } } - async * getAll (options?: AbortOptions): AwaitGenerator { + async * getAll (options?: AbortOptions): Generator | AsyncGenerator { if (this.db == null) { throw new Error('Blockstore needs to be opened.') } diff --git a/packages/blockstore-level/src/index.ts b/packages/blockstore-level/src/index.ts index c1c53cba..68987885 100644 --- a/packages/blockstore-level/src/index.ts +++ b/packages/blockstore-level/src/index.ts @@ -25,7 +25,6 @@ import { raceSignal } from 'race-signal' import { toString as uint8ArrayToString } from 'uint8arrays/to-string' import type { AbortOptions } from 'abort-error' import type { Pair } from 'interface-blockstore' -import type { AwaitGenerator, AwaitIterable } from 'interface-store' import type { DatabaseOptions, OpenOptions, IteratorOptions } from 'level' import type { MultibaseCodec } from 'multiformats/bases/interface' @@ -37,6 +36,11 @@ export interface LevelBlockstoreInit extends DatabaseOptions base?: MultibaseCodec } +interface LevelQueryResult { + key: string + value: Generator | AsyncGenerator +} + /** * A blockstore backed by leveldb */ @@ -81,7 +85,7 @@ export class LevelBlockstore extends BaseBlockstore { } } - async put (key: CID, value: Uint8Array | AwaitIterable, options?: AbortOptions): Promise { + async put (key: CID, value: Uint8Array | Iterable | AsyncIterable, options?: AbortOptions): Promise { try { options?.signal?.throwIfAborted() @@ -101,7 +105,7 @@ export class LevelBlockstore extends BaseBlockstore { return key } - async * get (key: CID, options?: AbortOptions): AwaitGenerator { + async * get (key: CID, options?: AbortOptions): Generator | AsyncGenerator { let buf try { @@ -138,15 +142,18 @@ export class LevelBlockstore extends BaseBlockstore { await this.db.close() } - async * getAll (options?: AbortOptions | undefined): AwaitGenerator { + async * getAll (options?: AbortOptions | undefined): Generator | AsyncGenerator { options?.signal?.throwIfAborted() for await (const { key, value } of this.#query({ values: true }, options)) { - yield { cid: this.#decode(key), bytes: value } + yield { + cid: this.#decode(key), + bytes: value + } } } - async * #query (opts: { values: boolean, prefix?: string }, options?: AbortOptions): AwaitGenerator<{ key: string, value: AwaitGenerator }> { + async * #query (opts: { values: boolean, prefix?: string }, options?: AbortOptions): AsyncGenerator { options?.signal?.throwIfAborted() const iteratorOpts: IteratorOptions = { diff --git a/packages/blockstore-s3/src/index.ts b/packages/blockstore-s3/src/index.ts index 269e923f..8ff6002a 100644 --- a/packages/blockstore-s3/src/index.ts +++ b/packages/blockstore-s3/src/index.ts @@ -51,7 +51,6 @@ import type { ShardingStrategy } from './sharding.ts' import type { S3 } from '@aws-sdk/client-s3' import type { AbortOptions } from 'abort-error' import type { Pair } from 'interface-blockstore' -import type { AwaitGenerator } from 'interface-store' import type { CID } from 'multiformats/cid' export type { ShardingStrategy } @@ -119,7 +118,7 @@ export class S3Blockstore extends BaseBlockstore { /** * Read from s3 */ - async * get (key: CID, options?: AbortOptions): AwaitGenerator { + async * get (key: CID, options?: AbortOptions): Generator | AsyncGenerator { try { options?.signal?.throwIfAborted() const data = await this.s3.send( @@ -216,7 +215,7 @@ export class S3Blockstore extends BaseBlockstore { } } - async * getAll (options?: AbortOptions): AwaitGenerator { + async * getAll (options?: AbortOptions): Generator | AsyncGenerator { const params: Record = {} try { diff --git a/packages/datastore-core/src/base.ts b/packages/datastore-core/src/base.ts index 06a1b393..f1512dc1 100644 --- a/packages/datastore-core/src/base.ts +++ b/packages/datastore-core/src/base.ts @@ -4,33 +4,32 @@ import sort from 'it-sort' import take from 'it-take' import type { AbortOptions } from 'abort-error' import type { Batch, Datastore, Key, KeyQuery, Pair, Query } from 'interface-datastore' -import type { Await, AwaitGenerator, AwaitIterable } from 'interface-store' export class BaseDatastore implements Datastore { - put (key: Key, val: Uint8Array, options?: AbortOptions): Await { + put (key: Key, val: Uint8Array, options?: AbortOptions): Key | Promise { return Promise.reject(new Error('.put is not implemented')) } - get (key: Key, options?: AbortOptions): Await { + get (key: Key, options?: AbortOptions): Uint8Array | Promise { return Promise.reject(new Error('.get is not implemented')) } - has (key: Key, options?: AbortOptions): Await { + has (key: Key, options?: AbortOptions): boolean | Promise { return Promise.reject(new Error('.has is not implemented')) } - delete (key: Key, options?: AbortOptions): Await { + delete (key: Key, options?: AbortOptions): void | Promise { return Promise.reject(new Error('.delete is not implemented')) } - async * putMany (source: AwaitIterable, options: AbortOptions = {}): AwaitGenerator { + async * putMany (source: Iterable | AsyncIterable, options: AbortOptions = {}): Generator | AsyncGenerator { for await (const { key, value } of source) { await this.put(key, value, options) yield key } } - async * getMany (source: AwaitIterable, options: AbortOptions = {}): AwaitGenerator { + async * getMany (source: Iterable | AsyncIterable, options: AbortOptions = {}): Generator | AsyncGenerator { for await (const key of source) { yield { key, @@ -39,7 +38,7 @@ export class BaseDatastore implements Datastore { } } - async * deleteMany (source: AwaitIterable, options: AbortOptions = {}): AwaitGenerator { + async * deleteMany (source: Iterable | AsyncIterable, options: AbortOptions = {}): Generator | AsyncGenerator { for await (const key of source) { await this.delete(key, options) yield key @@ -71,7 +70,7 @@ export class BaseDatastore implements Datastore { * Extending classes should override `query` or implement this method */ // eslint-disable-next-line require-yield - async * _all (q: Query, options?: AbortOptions): AwaitGenerator { + async * _all (q: Query, options?: AbortOptions): Generator | AsyncGenerator { throw new Error('._all is not implemented') } @@ -79,11 +78,11 @@ export class BaseDatastore implements Datastore { * Extending classes should override `queryKeys` or implement this method */ // eslint-disable-next-line require-yield - async * _allKeys (q: KeyQuery, options?: AbortOptions): AwaitGenerator { + async * _allKeys (q: KeyQuery, options?: AbortOptions): Generator | AsyncGenerator { throw new Error('._allKeys is not implemented') } - query (q: Query, options?: AbortOptions): AwaitGenerator { + query (q: Query, options?: AbortOptions): Generator | AsyncGenerator { let it = this._all(q, options) if (q.prefix != null) { @@ -112,7 +111,7 @@ export class BaseDatastore implements Datastore { return it } - queryKeys (q: KeyQuery, options?: AbortOptions): AwaitGenerator { + queryKeys (q: KeyQuery, options?: AbortOptions): Generator | AsyncGenerator { let it = this._allKeys(q, options) if (q.prefix != null) { diff --git a/packages/datastore-core/src/black-hole.ts b/packages/datastore-core/src/black-hole.ts index bd0a52c3..a36e0fbd 100644 --- a/packages/datastore-core/src/black-hole.ts +++ b/packages/datastore-core/src/black-hole.ts @@ -3,35 +3,34 @@ import { BaseDatastore } from './base.ts' import type { AbortOptions } from 'abort-error' import type { Pair, Query, KeyQuery } from 'interface-datastore' import type { Key } from 'interface-datastore/key' -import type { Await, AwaitGenerator } from 'interface-store' export class BlackHoleDatastore extends BaseDatastore { - put (key: Key, value: Uint8Array, options?: AbortOptions): Await { + put (key: Key, value: Uint8Array, options?: AbortOptions): Key | Promise { options?.signal?.throwIfAborted() return key } - get (key: Key, options?: AbortOptions): Await { + get (key: Key, options?: AbortOptions): Uint8Array | Promise { options?.signal?.throwIfAborted() throw new NotFoundError() } - has (key: Key, options?: AbortOptions): Await { + has (key: Key, options?: AbortOptions): boolean | Promise { options?.signal?.throwIfAborted() return false } - delete (key: Key, options?: AbortOptions): Await { + delete (key: Key, options?: AbortOptions): void | Promise { options?.signal?.throwIfAborted() } // eslint-disable-next-line require-yield - * _all (q: Query, options?: AbortOptions): AwaitGenerator { + * _all (q: Query, options?: AbortOptions): Generator | AsyncGenerator { options?.signal?.throwIfAborted() } // eslint-disable-next-line require-yield - * _allKeys (q: KeyQuery, options?: AbortOptions): AwaitGenerator { + * _allKeys (q: KeyQuery, options?: AbortOptions): Generator | AsyncGenerator { options?.signal?.throwIfAborted() } } diff --git a/packages/datastore-core/src/keytransform.ts b/packages/datastore-core/src/keytransform.ts index b7f4ae4c..e4730cb9 100644 --- a/packages/datastore-core/src/keytransform.ts +++ b/packages/datastore-core/src/keytransform.ts @@ -4,7 +4,6 @@ import { BaseDatastore } from './base.ts' import type { KeyTransform } from './index.ts' import type { AbortOptions } from 'abort-error' import type { Batch, Datastore, Key, KeyQuery, Pair, Query } from 'interface-datastore' -import type { AwaitGenerator, AwaitIterable } from 'interface-store' /** * A datastore shim, that wraps around a given datastore, changing @@ -40,7 +39,7 @@ export class KeyTransformDatastore extends BaseDatastore { await this.child.delete(this.transform.convert(key), options) } - async * putMany (source: AwaitIterable, options: AbortOptions = {}): AwaitGenerator { + async * putMany (source: Iterable | AsyncIterable, options: AbortOptions = {}): Generator | AsyncGenerator { const transform = this.transform const child = this.child @@ -61,7 +60,7 @@ export class KeyTransformDatastore extends BaseDatastore { ) } - async * getMany (source: AwaitIterable, options: AbortOptions = {}): AwaitGenerator { + async * getMany (source: Iterable | AsyncIterable, options: AbortOptions = {}): Generator | AsyncGenerator { const transform = this.transform const child = this.child @@ -82,7 +81,7 @@ export class KeyTransformDatastore extends BaseDatastore { ) } - async * deleteMany (source: AwaitIterable, options: AbortOptions = {}): AwaitGenerator { + async * deleteMany (source: Iterable | AsyncIterable, options: AbortOptions = {}): Generator | AsyncGenerator { const transform = this.transform const child = this.child @@ -115,7 +114,7 @@ export class KeyTransformDatastore extends BaseDatastore { } } - query (q: Query, options?: AbortOptions): AwaitGenerator { + query (q: Query, options?: AbortOptions): Generator | AsyncGenerator { const query: Query = { ...q } @@ -149,7 +148,7 @@ export class KeyTransformDatastore extends BaseDatastore { }) } - queryKeys (q: KeyQuery, options?: AbortOptions): AwaitGenerator { + queryKeys (q: KeyQuery, options?: AbortOptions): Generator | AsyncGenerator { const query = { ...q } diff --git a/packages/datastore-core/src/memory.ts b/packages/datastore-core/src/memory.ts index 5ff65595..183d8a36 100644 --- a/packages/datastore-core/src/memory.ts +++ b/packages/datastore-core/src/memory.ts @@ -3,7 +3,6 @@ import { NotFoundError } from 'interface-store' import { BaseDatastore } from './base.ts' import type { AbortOptions } from 'abort-error' import type { KeyQuery, Pair, Query } from 'interface-datastore' -import type { Await, AwaitGenerator } from 'interface-store' export class MemoryDatastore extends BaseDatastore { private readonly data: Map @@ -14,7 +13,7 @@ export class MemoryDatastore extends BaseDatastore { this.data = new Map() } - put (key: Key, val: Uint8Array, options?: AbortOptions): Await { + put (key: Key, val: Uint8Array, options?: AbortOptions): Key | Promise { options?.signal?.throwIfAborted() this.data.set(key.toString(), val) @@ -22,7 +21,7 @@ export class MemoryDatastore extends BaseDatastore { return key } - get (key: Key, options?: AbortOptions): Await { + get (key: Key, options?: AbortOptions): Uint8Array | Promise { options?.signal?.throwIfAborted() const result = this.data.get(key.toString()) @@ -34,17 +33,17 @@ export class MemoryDatastore extends BaseDatastore { return result } - has (key: Key, options?: AbortOptions): Await { + has (key: Key, options?: AbortOptions): boolean | Promise { options?.signal?.throwIfAborted() return this.data.has(key.toString()) } - delete (key: Key, options?: AbortOptions): Await { + delete (key: Key, options?: AbortOptions): void | Promise { options?.signal?.throwIfAborted() this.data.delete(key.toString()) } - * _all (q: Query, options?: AbortOptions): AwaitGenerator { + * _all (q: Query, options?: AbortOptions): Generator | AsyncGenerator { options?.signal?.throwIfAborted() for (const [key, value] of this.data.entries()) { yield { key: new Key(key), value } @@ -52,7 +51,7 @@ export class MemoryDatastore extends BaseDatastore { } } - * _allKeys (q: KeyQuery, options?: AbortOptions): AwaitGenerator { + * _allKeys (q: KeyQuery, options?: AbortOptions): Generator | AsyncGenerator { options?.signal?.throwIfAborted() for (const key of this.data.keys()) { yield new Key(key) diff --git a/packages/datastore-core/src/mount.ts b/packages/datastore-core/src/mount.ts index 80065814..1c79f548 100644 --- a/packages/datastore-core/src/mount.ts +++ b/packages/datastore-core/src/mount.ts @@ -6,7 +6,6 @@ import take from 'it-take' import { BaseDatastore } from './base.ts' import type { AbortOptions } from 'abort-error' import type { Batch, Datastore, Key, KeyQuery, Pair, Query } from 'interface-datastore' -import type { AwaitGenerator } from 'interface-store' /** * A datastore that can combine multiple stores inside various @@ -109,7 +108,7 @@ export class MountDatastore extends BaseDatastore { } } - query (q: Query, options?: AbortOptions): AwaitGenerator { + query (q: Query, options?: AbortOptions): Generator | AsyncGenerator { const qs = this.mounts.map(m => { return m.datastore.query({ prefix: q.prefix, @@ -130,7 +129,7 @@ export class MountDatastore extends BaseDatastore { return it } - queryKeys (q: KeyQuery, options?: AbortOptions): AwaitGenerator { + queryKeys (q: KeyQuery, options?: AbortOptions): Generator | AsyncGenerator { const qs = this.mounts.map(m => { return m.datastore.queryKeys({ prefix: q.prefix, diff --git a/packages/datastore-core/src/namespace.ts b/packages/datastore-core/src/namespace.ts index 4a7593c7..02c94d0f 100644 --- a/packages/datastore-core/src/namespace.ts +++ b/packages/datastore-core/src/namespace.ts @@ -3,7 +3,6 @@ import map from 'it-map' import { KeyTransformDatastore } from './keytransform.ts' import type { AbortOptions } from 'abort-error' import type { Datastore, Query, Pair, KeyQuery } from 'interface-datastore' -import type { AwaitGenerator } from 'interface-store' /** * Wraps a given datastore into a keytransform which @@ -39,7 +38,7 @@ export class NamespaceDatastore extends KeyTransformDatastore { this.iKey = prefix } - query (q: Query, options?: AbortOptions): AwaitGenerator { + query (q: Query, options?: AbortOptions): Generator | AsyncGenerator { const query: Query = { ...q } @@ -75,7 +74,7 @@ export class NamespaceDatastore extends KeyTransformDatastore { }) } - queryKeys (q: KeyQuery, options?: AbortOptions): AwaitGenerator { + queryKeys (q: KeyQuery, options?: AbortOptions): Generator | AsyncGenerator { const query = { ...q } diff --git a/packages/datastore-core/src/sharding.ts b/packages/datastore-core/src/sharding.ts index a9e81f37..eafe327f 100644 --- a/packages/datastore-core/src/sharding.ts +++ b/packages/datastore-core/src/sharding.ts @@ -9,7 +9,6 @@ import { import type { Shard } from './index.ts' import type { AbortOptions } from 'abort-error' import type { Batch, KeyQuery, KeyQueryFilter, Pair, Query, QueryFilter, Datastore } from 'interface-datastore' -import type { AwaitGenerator, AwaitIterable } from 'interface-store' const shardKey = new Key(SHARDING_FN) @@ -100,15 +99,15 @@ export class ShardingDatastore extends BaseDatastore { await this.child.delete(key, options) } - async * putMany (source: AwaitIterable, options: AbortOptions = {}): AwaitGenerator { + async * putMany (source: Iterable | AsyncIterable, options: AbortOptions = {}): Generator | AsyncGenerator { yield * this.child.putMany(source, options) } - async * getMany (source: AwaitIterable, options: AbortOptions = {}): AwaitGenerator { + async * getMany (source: Iterable | AsyncIterable, options: AbortOptions = {}): Generator | AsyncGenerator { yield * this.child.getMany(source, options) } - async * deleteMany (source: AwaitIterable, options: AbortOptions = {}): AwaitGenerator { + async * deleteMany (source: Iterable | AsyncIterable, options: AbortOptions = {}): Generator | AsyncGenerator { yield * this.child.deleteMany(source, options) } @@ -116,7 +115,7 @@ export class ShardingDatastore extends BaseDatastore { return this.child.batch() } - query (q: Query, options?: AbortOptions): AwaitGenerator { + query (q: Query, options?: AbortOptions): Generator | AsyncGenerator { const omitShard: QueryFilter = ({ key }) => key.toString() !== shardKey.toString() const tq: Query = { @@ -129,7 +128,7 @@ export class ShardingDatastore extends BaseDatastore { return this.child.query(tq, options) } - queryKeys (q: KeyQuery, options?: AbortOptions): AwaitGenerator { + queryKeys (q: KeyQuery, options?: AbortOptions): Generator | AsyncGenerator { const omitShard: KeyQueryFilter = (key) => key.toString() !== shardKey.toString() const tq: KeyQuery = { diff --git a/packages/datastore-core/src/tiered.ts b/packages/datastore-core/src/tiered.ts index b9c4c2fc..882ec9cb 100644 --- a/packages/datastore-core/src/tiered.ts +++ b/packages/datastore-core/src/tiered.ts @@ -3,7 +3,6 @@ import { NotFoundError } from 'interface-store' import { BaseDatastore } from './base.ts' import type { AbortOptions } from 'abort-error' import type { Batch, Datastore, Key, KeyQuery, Pair, Query } from 'interface-datastore' -import type { AwaitGenerator, AwaitIterable } from 'interface-store' const log = logger('datastore:core:tiered') @@ -70,14 +69,14 @@ export class TieredDatastore extends BaseDatastore { ) } - async * putMany (source: AwaitIterable, options: AbortOptions = {}): AwaitGenerator { + async * putMany (source: Iterable | AsyncIterable, options: AbortOptions = {}): Generator | AsyncGenerator { for await (const pair of source) { await this.put(pair.key, pair.value, options) yield pair.key } } - async * deleteMany (source: AwaitIterable, options: AbortOptions = {}): AwaitGenerator { + async * deleteMany (source: Iterable | AsyncIterable, options: AbortOptions = {}): Generator | AsyncGenerator { for await (const key of source) { await this.delete(key, options) yield key @@ -102,11 +101,11 @@ export class TieredDatastore extends BaseDatastore { } } - query (q: Query, options?: AbortOptions): AwaitGenerator { + query (q: Query, options?: AbortOptions): Generator | AsyncGenerator { return this.stores[this.stores.length - 1].query(q, options) } - queryKeys (q: KeyQuery, options?: AbortOptions): AwaitGenerator { + queryKeys (q: KeyQuery, options?: AbortOptions): Generator | AsyncGenerator { return this.stores[this.stores.length - 1].queryKeys(q, options) } } diff --git a/packages/datastore-fs/src/index.ts b/packages/datastore-fs/src/index.ts index 60ebd8a3..7bd340ae 100644 --- a/packages/datastore-fs/src/index.ts +++ b/packages/datastore-fs/src/index.ts @@ -24,7 +24,6 @@ import { raceSignal } from 'race-signal' import { Writer } from 'steno' import type { AbortOptions } from 'abort-error' import type { KeyQuery, Pair, Query } from 'interface-datastore' -import type { AwaitGenerator, AwaitIterable } from 'interface-store' /** * Write a file atomically @@ -161,7 +160,7 @@ export class FsDatastore extends BaseDatastore { } } - async * putMany (source: AwaitIterable, options?: AbortOptions): AwaitGenerator { + async * putMany (source: Iterable | AsyncIterable, options?: AbortOptions): Generator | AsyncGenerator { yield * parallel( map(source, ({ key, value }) => { return async () => { @@ -184,7 +183,7 @@ export class FsDatastore extends BaseDatastore { } } - async * getMany (source: AwaitIterable, options?: AbortOptions): AwaitGenerator { + async * getMany (source: Iterable | AsyncIterable, options?: AbortOptions): Generator | AsyncGenerator { yield * parallel( map(source, key => { return async () => { @@ -198,7 +197,7 @@ export class FsDatastore extends BaseDatastore { ) } - async * deleteMany (source: AwaitIterable, options?: AbortOptions): AwaitGenerator { + async * deleteMany (source: Iterable | AsyncIterable, options?: AbortOptions): Generator | AsyncGenerator { yield * parallel( map(source, key => { return async () => { @@ -238,7 +237,7 @@ export class FsDatastore extends BaseDatastore { } } - async * _all (q: Query, options?: AbortOptions): AwaitGenerator { + async * _all (q: Query, options?: AbortOptions): Generator | AsyncGenerator { let prefix = q.prefix ?? '**' // strip leading slashes @@ -273,7 +272,7 @@ export class FsDatastore extends BaseDatastore { } } - async * _allKeys (q: KeyQuery, options?: AbortOptions): AwaitGenerator { + async * _allKeys (q: KeyQuery, options?: AbortOptions): Generator | AsyncGenerator { let prefix = q.prefix ?? '**' // strip leading slashes diff --git a/packages/datastore-idb/src/index.ts b/packages/datastore-idb/src/index.ts index d76196b0..91a97c0e 100644 --- a/packages/datastore-idb/src/index.ts +++ b/packages/datastore-idb/src/index.ts @@ -22,7 +22,6 @@ import { raceSignal } from 'race-signal' import type { AbortOptions } from 'abort-error' import type { IDBPDatabase } from 'idb' import type { Batch, KeyQuery, Pair, Query } from 'interface-datastore' -import type { AwaitGenerator } from 'interface-store' export interface IDBDatastoreInit { /** @@ -177,7 +176,7 @@ export class IDBDatastore extends BaseDatastore { } } - async * query (q: Query, options?: AbortOptions): AwaitGenerator { + async * query (q: Query, options?: AbortOptions): Generator | AsyncGenerator { let it = this.#queryIt(q, (key, value) => { return { key, value } }, options) @@ -193,7 +192,7 @@ export class IDBDatastore extends BaseDatastore { yield * it } - async * queryKeys (q: KeyQuery, options?: AbortOptions): AwaitGenerator { + async * queryKeys (q: KeyQuery, options?: AbortOptions): Generator | AsyncGenerator { let it = this.#queryIt(q, (key) => key, options) if (Array.isArray(q.filters)) { diff --git a/packages/datastore-level/src/index.ts b/packages/datastore-level/src/index.ts index b3804060..5379a4bf 100644 --- a/packages/datastore-level/src/index.ts +++ b/packages/datastore-level/src/index.ts @@ -55,7 +55,6 @@ import { Level } from 'level' import { raceSignal } from 'race-signal' import type { AbortOptions } from 'abort-error' import type { Batch, KeyQuery, Pair, Query } from 'interface-datastore' -import type { AwaitGenerator } from 'interface-store' import type { DatabaseOptions, OpenOptions, IteratorOptions } from 'level' interface BatchPut { @@ -180,7 +179,7 @@ export class LevelDatastore extends BaseDatastore { } } - query (q: Query, options?: AbortOptions): AwaitGenerator { + query (q: Query, options?: AbortOptions): Generator | AsyncGenerator { let it = map(this._query({ values: true, prefix: q.prefix @@ -210,7 +209,7 @@ export class LevelDatastore extends BaseDatastore { return it } - queryKeys (q: KeyQuery, options?: AbortOptions): AwaitGenerator { + queryKeys (q: KeyQuery, options?: AbortOptions): Generator | AsyncGenerator { let it = map(this._query({ values: false, prefix: q.prefix diff --git a/packages/datastore-s3/src/index.ts b/packages/datastore-s3/src/index.ts index 5d453e58..499276cf 100644 --- a/packages/datastore-s3/src/index.ts +++ b/packages/datastore-s3/src/index.ts @@ -48,7 +48,6 @@ import { fromString as uint8arrayFromString } from 'uint8arrays' import type { S3 } from '@aws-sdk/client-s3' import type { AbortOptions } from 'abort-error' import type { KeyQuery, Pair, Query } from 'interface-datastore' -import type { AwaitGenerator } from 'interface-store' export interface S3DatastoreInit { /** @@ -264,7 +263,7 @@ export class S3Datastore extends BaseDatastore { } } - async * _all (q: Query, options?: AbortOptions): AwaitGenerator { + async * _all (q: Query, options?: AbortOptions): Generator | AsyncGenerator { for await (const key of this._allKeys({ prefix: q.prefix }, options)) { try { const res: Pair = { @@ -282,7 +281,7 @@ export class S3Datastore extends BaseDatastore { } } - async * _allKeys (q: KeyQuery, options?: AbortOptions): AwaitGenerator { + async * _allKeys (q: KeyQuery, options?: AbortOptions): Generator | AsyncGenerator { const prefix = [this.path, q.prefix ?? ''].filter(Boolean).join('/').replace(/\/\/+/g, '/') // Get all the keys via list object, recursively as needed diff --git a/packages/interface-blockstore/src/index.ts b/packages/interface-blockstore/src/index.ts index 59b09c3d..805a7c73 100644 --- a/packages/interface-blockstore/src/index.ts +++ b/packages/interface-blockstore/src/index.ts @@ -15,23 +15,23 @@ */ import type { AbortOptions } from 'abort-error' -import type { AwaitGenerator, AwaitIterable, Store } from 'interface-store' +import type { Store } from 'interface-store' import type { CID } from 'multiformats/cid' export interface Pair { cid: CID - bytes: AwaitGenerator + bytes: Generator | AsyncGenerator } export interface InputPair { cid: CID - bytes: Uint8Array | AwaitIterable + bytes: Uint8Array | Iterable | AsyncIterable } export interface Blockstore extends Store, AwaitGenerator, InputPair, Pair, HasOptionsExtension, +DeleteOptionsExtension = {}, DeleteManyOptionsExtension = {}> extends Store | AsyncIterable, Generator | AsyncGenerator, InputPair, Pair, HasOptionsExtension, PutOptionsExtension, PutManyOptionsExtension, GetOptionsExtension, GetManyOptionsExtension, DeleteOptionsExtension, DeleteManyOptionsExtension> { @@ -46,5 +46,5 @@ DeleteOptionsExtension = {}, DeleteManyOptionsExtension = {}> extends Store + getAll(options?: AbortOptions & GetAllOptionsExtension): Generator | AsyncGenerator } diff --git a/packages/interface-datastore/src/index.ts b/packages/interface-datastore/src/index.ts index 721e98b9..08fe53ad 100644 --- a/packages/interface-datastore/src/index.ts +++ b/packages/interface-datastore/src/index.ts @@ -98,7 +98,7 @@ import { Key } from './key.ts' import type { AbortOptions } from 'abort-error' -import type { Await, Store, AwaitGenerator } from 'interface-store' +import type { Store } from 'interface-store' export interface Pair { key: Key @@ -108,7 +108,7 @@ export interface Pair { export interface Batch { put(key: Key, value: Uint8Array): void delete(key: Key): void - commit(options?: AbortOptions & BatchOptionsExtension): Await + commit(options?: AbortOptions & BatchOptionsExtension): void | Promise } export interface Datastore extends Store, Pair, Pair, HasOptionsExtension, +> extends Store, Pair, Pair, HasOptionsExtension, PutOptionsExtension, PutManyOptionsExtension, GetOptionsExtension, GetManyOptionsExtension, DeleteOptionsExtension, DeleteManyOptionsExtension> { @@ -151,7 +151,7 @@ BatchOptionsExtension = {} * console.log('ALL THE VALUES', list) * ``` */ - query(query: Query, options?: AbortOptions & QueryOptionsExtension): AwaitGenerator + query(query: Query, options?: AbortOptions & QueryOptionsExtension): Generator | AsyncGenerator /** * Query the datastore. @@ -166,7 +166,7 @@ BatchOptionsExtension = {} * console.log('ALL THE KEYS', key) * ``` */ - queryKeys(query: KeyQuery, options?: AbortOptions & QueryKeysOptionsExtension): AwaitGenerator + queryKeys(query: KeyQuery, options?: AbortOptions & QueryKeysOptionsExtension): Generator | AsyncGenerator } export interface QueryFilter { (item: Pair): boolean } diff --git a/packages/interface-store/src/index.ts b/packages/interface-store/src/index.ts index f7741d1f..5d87f6d9 100644 --- a/packages/interface-store/src/index.ts +++ b/packages/interface-store/src/index.ts @@ -6,21 +6,6 @@ import type { AbortOptions } from 'abort-error' -/** - * An iterable or async iterable of values - */ -export type AwaitIterable = Iterable | AsyncIterable - -/** - * A generator or async generator of values - */ -export type AwaitGenerator = Generator | AsyncGenerator - -/** - * A value or a promise of a value - */ -export type Await = Promise | T - export interface Store + has(key: Key, options?: AbortOptions & HasOptionsExtension): boolean | Promise /** * Store the passed value under the passed key @@ -51,7 +36,7 @@ export interface Store + put(key: Key, val: Input, options?: AbortOptions & PutOptionsExtension): Key | Promise /** * Store the given key/value pairs @@ -66,9 +51,9 @@ export interface Store, + source: Iterable | AsyncIterable, options?: AbortOptions & PutManyOptionsExtension - ): AwaitGenerator + ): Generator | AsyncGenerator /** * Retrieve the value stored under the given key @@ -94,9 +79,9 @@ export interface Store, + source: Iterable | AsyncIterable, options?: AbortOptions & GetManyOptionsExtension - ): AwaitGenerator + ): Generator | AsyncGenerator /** * Remove the record for the passed key @@ -108,7 +93,7 @@ export interface Store + delete(key: Key, options?: AbortOptions & DeleteOptionsExtension): void | Promise /** * Remove values for the passed keys @@ -124,9 +109,9 @@ export interface Store, + source: Iterable | AsyncIterable, options?: AbortOptions & DeleteManyOptionsExtension - ): AwaitGenerator + ): Generator | AsyncGenerator } export * from './errors.ts' From 5eb268cc29fccbcd3f8fbd1dbb5aa1793cff5542 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Mon, 11 May 2026 17:12:22 +0300 Subject: [PATCH 4/6] chore: add missing dep --- packages/interface-store/package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/interface-store/package.json b/packages/interface-store/package.json index 27a1dc43..2f68fa44 100644 --- a/packages/interface-store/package.json +++ b/packages/interface-store/package.json @@ -132,5 +132,8 @@ }, "devDependencies": { "aegir": "^48.0.4" + }, + "dependencies": { + "abort-error": "^1.0.2" } } From 91db1c32574306f45235c2f8790e90c292678b23 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Mon, 11 May 2026 17:15:31 +0300 Subject: [PATCH 5/6] chore: deps --- packages/blockstore-core/package.json | 1 + packages/blockstore-fs/package.json | 1 + packages/blockstore-idb/package.json | 1 + packages/blockstore-level/package.json | 1 + packages/blockstore-s3/package.json | 1 + packages/datastore-core/package.json | 1 + packages/datastore-fs/package.json | 1 + packages/datastore-idb/package.json | 1 + packages/datastore-level/package.json | 1 + packages/datastore-s3/package.json | 1 + packages/interface-datastore/package.json | 1 + 11 files changed, 11 insertions(+) diff --git a/packages/blockstore-core/package.json b/packages/blockstore-core/package.json index 2d480c69..4c6db6b1 100644 --- a/packages/blockstore-core/package.json +++ b/packages/blockstore-core/package.json @@ -187,6 +187,7 @@ }, "dependencies": { "@libp2p/logger": "^6.2.4", + "abort-error": "^1.0.2", "interface-blockstore": "^6.0.0", "interface-store": "^7.0.0", "it-all": "^3.0.9", diff --git a/packages/blockstore-fs/package.json b/packages/blockstore-fs/package.json index 03b7c831..6f3e04c0 100644 --- a/packages/blockstore-fs/package.json +++ b/packages/blockstore-fs/package.json @@ -162,6 +162,7 @@ "release": "aegir release" }, "dependencies": { + "abort-error": "^1.0.2", "interface-blockstore": "^6.0.0", "interface-store": "^7.0.0", "it-glob": "^3.0.4", diff --git a/packages/blockstore-idb/package.json b/packages/blockstore-idb/package.json index 19c290b1..b25be010 100644 --- a/packages/blockstore-idb/package.json +++ b/packages/blockstore-idb/package.json @@ -144,6 +144,7 @@ "release": "aegir release" }, "dependencies": { + "abort-error": "^1.0.2", "blockstore-core": "^6.0.0", "idb": "^8.0.3", "interface-blockstore": "^6.0.0", diff --git a/packages/blockstore-level/package.json b/packages/blockstore-level/package.json index 94c76dd9..b8d068dd 100644 --- a/packages/blockstore-level/package.json +++ b/packages/blockstore-level/package.json @@ -147,6 +147,7 @@ "release": "aegir release" }, "dependencies": { + "abort-error": "^1.0.2", "blockstore-core": "^6.0.0", "interface-blockstore": "^6.0.0", "interface-store": "^7.0.0", diff --git a/packages/blockstore-s3/package.json b/packages/blockstore-s3/package.json index dd6d0439..f6a885d3 100644 --- a/packages/blockstore-s3/package.json +++ b/packages/blockstore-s3/package.json @@ -146,6 +146,7 @@ }, "dependencies": { "@aws-sdk/client-s3": "^3.1028.0", + "abort-error": "^1.0.2", "blockstore-core": "^6.0.0", "interface-blockstore": "^6.0.0", "interface-store": "^7.0.0", diff --git a/packages/datastore-core/package.json b/packages/datastore-core/package.json index 5cc7e7ae..571a7f58 100644 --- a/packages/datastore-core/package.json +++ b/packages/datastore-core/package.json @@ -212,6 +212,7 @@ }, "dependencies": { "@libp2p/logger": "^6.2.4", + "abort-error": "^1.0.2", "interface-datastore": "^9.0.0", "interface-store": "^7.0.0", "it-drain": "^3.0.10", diff --git a/packages/datastore-fs/package.json b/packages/datastore-fs/package.json index 942978f1..5e279555 100644 --- a/packages/datastore-fs/package.json +++ b/packages/datastore-fs/package.json @@ -142,6 +142,7 @@ "release": "aegir release" }, "dependencies": { + "abort-error": "^1.0.2", "datastore-core": "^11.0.0", "interface-datastore": "^9.0.0", "interface-store": "^7.0.0", diff --git a/packages/datastore-idb/package.json b/packages/datastore-idb/package.json index 228f45d5..ea24c709 100644 --- a/packages/datastore-idb/package.json +++ b/packages/datastore-idb/package.json @@ -142,6 +142,7 @@ "release": "aegir release" }, "dependencies": { + "abort-error": "^1.0.2", "datastore-core": "^11.0.0", "idb": "^8.0.3", "interface-datastore": "^9.0.0", diff --git a/packages/datastore-level/package.json b/packages/datastore-level/package.json index 9e0ff697..9bbb8ea2 100644 --- a/packages/datastore-level/package.json +++ b/packages/datastore-level/package.json @@ -148,6 +148,7 @@ "release": "aegir release" }, "dependencies": { + "abort-error": "^1.0.2", "datastore-core": "^11.0.0", "interface-datastore": "^9.0.0", "interface-store": "^7.0.0", diff --git a/packages/datastore-s3/package.json b/packages/datastore-s3/package.json index 2bbaca66..9e50c6a4 100644 --- a/packages/datastore-s3/package.json +++ b/packages/datastore-s3/package.json @@ -146,6 +146,7 @@ }, "dependencies": { "@aws-sdk/client-s3": "^3.1028.0", + "abort-error": "^1.0.2", "datastore-core": "^11.0.0", "interface-datastore": "^9.0.0", "interface-store": "^7.0.0", diff --git a/packages/interface-datastore/package.json b/packages/interface-datastore/package.json index a225b428..4c314707 100644 --- a/packages/interface-datastore/package.json +++ b/packages/interface-datastore/package.json @@ -164,6 +164,7 @@ "release": "aegir release" }, "dependencies": { + "abort-error": "^1.0.2", "interface-store": "^7.0.0", "uint8arrays": "^6.1.1" }, From 6f68b513c22502d79084633ced7cc89e415146f8 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Mon, 11 May 2026 17:16:40 +0300 Subject: [PATCH 6/6] chore: formatting --- packages/interface-store/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/interface-store/package.json b/packages/interface-store/package.json index 2f68fa44..d1f3c005 100644 --- a/packages/interface-store/package.json +++ b/packages/interface-store/package.json @@ -130,10 +130,10 @@ "dep-check": "aegir dep-check", "release": "aegir release" }, - "devDependencies": { - "aegir": "^48.0.4" - }, "dependencies": { "abort-error": "^1.0.2" + }, + "devDependencies": { + "aegir": "^48.0.4" } }