From e5178c832c52c5feae766ca81e362f86be6a243f Mon Sep 17 00:00:00 2001 From: web3-bot <81333946+web3-bot@users.noreply.github.com> Date: Mon, 14 Nov 2022 16:13:18 +0100 Subject: [PATCH 1/9] update .github/workflows/js-test-and-release.yml (#143) --- .github/workflows/js-test-and-release.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/js-test-and-release.yml b/.github/workflows/js-test-and-release.yml index 65d30bd..ed17349 100644 --- a/.github/workflows/js-test-and-release.yml +++ b/.github/workflows/js-test-and-release.yml @@ -7,8 +7,6 @@ on: branches: - master # with #262 - ${{{ github.default_branch }}} pull_request: - branches: - - master # with #262 - ${{{ github.default_branch }}} jobs: From a684497c4991d80d77ec273c2088255c0c56f79a Mon Sep 17 00:00:00 2001 From: web3-bot <81333946+web3-bot@users.noreply.github.com> Date: Fri, 25 Nov 2022 19:14:13 +0100 Subject: [PATCH 2/9] update .github/workflows/js-test-and-release.yml (#144) --- .github/workflows/js-test-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/js-test-and-release.yml b/.github/workflows/js-test-and-release.yml index ed17349..c6897e3 100644 --- a/.github/workflows/js-test-and-release.yml +++ b/.github/workflows/js-test-and-release.yml @@ -27,7 +27,7 @@ jobs: strategy: matrix: os: [windows-latest, ubuntu-latest, macos-latest] - node: [16] + node: [lts/*] fail-fast: true steps: - uses: actions/checkout@v3 From 6ba706f87768c4cfe23bbca47a32e816713b6fb7 Mon Sep 17 00:00:00 2001 From: web3-bot <81333946+web3-bot@users.noreply.github.com> Date: Wed, 14 Dec 2022 12:47:37 +0100 Subject: [PATCH 3/9] update .github/workflows/js-test-and-release.yml (#145) --- .github/workflows/js-test-and-release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/js-test-and-release.yml b/.github/workflows/js-test-and-release.yml index c6897e3..da74793 100644 --- a/.github/workflows/js-test-and-release.yml +++ b/.github/workflows/js-test-and-release.yml @@ -144,3 +144,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - run: npm run --if-present docs + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 35ead25ca6e9db0f138076d76f35ae16ac783de8 Mon Sep 17 00:00:00 2001 From: web3-bot <81333946+web3-bot@users.noreply.github.com> Date: Thu, 15 Dec 2022 10:02:56 +0100 Subject: [PATCH 4/9] update .github/workflows/js-test-and-release.yml (#146) --- .github/workflows/js-test-and-release.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/js-test-and-release.yml b/.github/workflows/js-test-and-release.yml index da74793..c6897e3 100644 --- a/.github/workflows/js-test-and-release.yml +++ b/.github/workflows/js-test-and-release.yml @@ -144,6 +144,3 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - - run: npm run --if-present docs - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 414109e2d47554814c84fd7467f0a62ac4c7546f Mon Sep 17 00:00:00 2001 From: web3-bot <81333946+web3-bot@users.noreply.github.com> Date: Wed, 1 Feb 2023 17:59:59 +0100 Subject: [PATCH 5/9] update .github/workflows/js-test-and-release.yml (#156) --- .github/workflows/js-test-and-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/js-test-and-release.yml b/.github/workflows/js-test-and-release.yml index c6897e3..55c45a8 100644 --- a/.github/workflows/js-test-and-release.yml +++ b/.github/workflows/js-test-and-release.yml @@ -5,7 +5,7 @@ name: test & maybe release on: push: branches: - - master # with #262 - ${{{ github.default_branch }}} + - master pull_request: jobs: @@ -127,7 +127,7 @@ jobs: release: needs: [test-node, test-chrome, test-chrome-webworker, test-firefox, test-firefox-webworker, test-electron-main, test-electron-renderer] runs-on: ubuntu-latest - if: github.event_name == 'push' && github.ref == 'refs/heads/master' # with #262 - 'refs/heads/${{{ github.default_branch }}}' + if: github.event_name == 'push' && github.ref == 'refs/heads/master' steps: - uses: actions/checkout@v3 with: From d372c7e102772eb0f33328ac7143010863d760ac Mon Sep 17 00:00:00 2001 From: web3-bot <81333946+web3-bot@users.noreply.github.com> Date: Wed, 8 Feb 2023 16:37:19 +0100 Subject: [PATCH 6/9] update .github/workflows/js-test-and-release.yml (#159) --- .github/workflows/js-test-and-release.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/js-test-and-release.yml b/.github/workflows/js-test-and-release.yml index 55c45a8..ef28bb0 100644 --- a/.github/workflows/js-test-and-release.yml +++ b/.github/workflows/js-test-and-release.yml @@ -36,7 +36,7 @@ jobs: node-version: ${{ matrix.node }} - uses: ipfs/aegir/actions/cache-node-modules@master - run: npm run --if-present test:node - - uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 + - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1 with: flags: node @@ -50,7 +50,7 @@ jobs: node-version: lts/* - uses: ipfs/aegir/actions/cache-node-modules@master - run: npm run --if-present test:chrome - - uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 + - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1 with: flags: chrome @@ -64,7 +64,7 @@ jobs: node-version: lts/* - uses: ipfs/aegir/actions/cache-node-modules@master - run: npm run --if-present test:chrome-webworker - - uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 + - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1 with: flags: chrome-webworker @@ -78,7 +78,7 @@ jobs: node-version: lts/* - uses: ipfs/aegir/actions/cache-node-modules@master - run: npm run --if-present test:firefox - - uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 + - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1 with: flags: firefox @@ -92,7 +92,7 @@ jobs: node-version: lts/* - uses: ipfs/aegir/actions/cache-node-modules@master - run: npm run --if-present test:firefox-webworker - - uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 + - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1 with: flags: firefox-webworker @@ -106,7 +106,7 @@ jobs: node-version: lts/* - uses: ipfs/aegir/actions/cache-node-modules@master - run: npx xvfb-maybe npm run --if-present test:electron-main - - uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 + - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1 with: flags: electron-main @@ -120,7 +120,7 @@ jobs: node-version: lts/* - uses: ipfs/aegir/actions/cache-node-modules@master - run: npx xvfb-maybe npm run --if-present test:electron-renderer - - uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 + - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1 with: flags: electron-renderer @@ -142,5 +142,5 @@ jobs: docker-username: ${{ secrets.DOCKER_USERNAME }} - run: npm run --if-present release env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ github.token }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} From c35186f9fb8e79562e3e3a149e0fb8017ce6ceb5 Mon Sep 17 00:00:00 2001 From: web3-bot <81333946+web3-bot@users.noreply.github.com> Date: Thu, 23 Feb 2023 18:03:49 +0100 Subject: [PATCH 7/9] update .github/workflows/js-test-and-release.yml (#164) Co-authored-by: web3-bot --- .github/workflows/js-test-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/js-test-and-release.yml b/.github/workflows/js-test-and-release.yml index ef28bb0..74b2386 100644 --- a/.github/workflows/js-test-and-release.yml +++ b/.github/workflows/js-test-and-release.yml @@ -142,5 +142,5 @@ jobs: docker-username: ${{ secrets.DOCKER_USERNAME }} - run: npm run --if-present release env: - GITHUB_TOKEN: ${{ github.token }} + GITHUB_TOKEN: ${{ secrets.UCI_GITHUB_TOKEN || github.token }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} From 178d235254805f2abdd919e0860bd86af5b48582 Mon Sep 17 00:00:00 2001 From: Alex Potsides Date: Mon, 13 Mar 2023 20:52:26 +0100 Subject: [PATCH 8/9] deps!: update to interface-datastore 8.x.x (#172) - Updates datastore interface - Converts project to typescript BREAKING CHANGE: this module now implements interface-datastore@8.x.x --- package.json | 18 +- src/{index.js => index.ts} | 177 ++++++++---------- test/{browser.js => browser.ts} | 8 +- ...troy.js => test-level-iterator-destroy.ts} | 4 +- test/{index.spec.js => index.spec.ts} | 26 ++- test/{node.js => node.ts} | 69 +++---- ...HSCRTXCYHGIOBXKWUMKFR3UPAFHQ5WK5362FQ.data | 4 - ...DDTF32OIR4FWLKT5YLL7MLDVIT7DC3NHOK5VA.data | 23 --- ...B5FJNHZPTSVA7IB6OHXSQ2XSVEEKMKK6RT75I.data | Bin 101 -> 0 bytes ...7E32LQAL6236OUKZTMHPQSFIXPWXNZHQOV7JQ.data | 55 ------ ...SIM3AK7AD554D3BWZPAGEAQYQOWMFZQDUUAEI.data | 3 - ...YVY4BA22FPHUIODJEXS4LCTQDWA275XAJDAPI.data | Bin 309 -> 0 bytes ...LZHQZUR2R3GECRFV3WPKNL7PL2SKFIL2LXC4Y.data | 4 - ...774EZOYCYNHPRVFD53ZSAU7237F67XDSQGCYQ.data | Bin 10807 -> 0 bytes ...LJNXLLHZOPGSL2PBC65D4UIVWM6TI5F5TAFNI.data | 24 --- ...VXLWEU4FWPVGT24VJT7DUZPTNLF25N25IGGQA.data | 4 - ...WJNESD7XHQSXA5EGJVNTPVHD7444C2KLKXHDI.data | Bin 10765 -> 0 bytes ...AJNF2GF5UHUAGGHC6LLAH6VYDEKLQMD4QLILY.data | 8 - ...TJNUP57QHR4SKHZ74OIITBBGLOMCO3ZOLWLGA.data | 9 - ...33ROGCKOFZLXJJ2MPKYZBTV4H3N7GYHXMAO6A.data | 3 - ...HTQ7R247ZI7KJWP3QWPQYS43LFULQC5ANLQFI.data | Bin 10765 -> 0 bytes ...57JSEZN64SIJ5OIHSGJG4TJSSJLGI3PBJLQVI.data | 0 ...JOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data | 28 --- ...LP4OS5EAVHFMCX2HD7FZUC2B3WUU3D4LGKS5A.data | 3 - test/test-repo/blocks/SHARDING | 1 - ...ANT6IBNTFN7WR5RPD5F6GN6MBKUUO25DNOTWQ.data | Bin 10891 -> 0 bytes ...NH7VEGIQJRPL6J7FT2XYVKAXT4MQPXXPUYUNY.data | Bin 10765 -> 0 bytes ...LOQ45VUM2GUZCGAXLWCTOKKPGTUWPXHBNIVOY.data | 114 ----------- ...2BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data | 2 - ...2FSMG76VV256I4PXBULZZ5ASNLK4FL4EG7XOI.data | Bin 10849 -> 0 bytes test/test-repo/blocks/_README | 30 --- test/test-repo/config | 85 --------- test/test-repo/datastore/000002.ldb | Bin 211 -> 0 bytes test/test-repo/datastore/000005.ldb | Bin 1120 -> 0 bytes test/test-repo/datastore/CURRENT | 1 - test/test-repo/datastore/LOCK | 0 test/test-repo/datastore/LOG | 3 - test/test-repo/datastore/LOG.old | 1 - test/test-repo/version | 1 - tsconfig.json | 3 +- 40 files changed, 135 insertions(+), 576 deletions(-) rename src/{index.js => index.ts} (54%) rename test/{browser.js => browser.ts} (74%) rename test/fixtures/{test-level-iterator-destroy.js => test-level-iterator-destroy.ts} (86%) rename test/{index.spec.js => index.spec.ts} (67%) rename test/{node.js => node.ts} (54%) delete mode 100644 test/test-repo/blocks/2F/CIQEUWUVLBXVFYSYCHHSCRTXCYHGIOBXKWUMKFR3UPAFHQ5WK5362FQ.data delete mode 100644 test/test-repo/blocks/5V/CIQFFRR4O52TS2Z7QLDDTF32OIR4FWLKT5YLL7MLDVIT7DC3NHOK5VA.data delete mode 100644 test/test-repo/blocks/75/CIQMB7DLJFKD267QJ2B5FJNHZPTSVA7IB6OHXSQ2XSVEEKMKK6RT75I.data delete mode 100644 test/test-repo/blocks/7J/CIQKKLBWAIBQZOIS5X7E32LQAL6236OUKZTMHPQSFIXPWXNZHQOV7JQ.data delete mode 100644 test/test-repo/blocks/AE/CIQONICFQZH7QVU6IPSIM3AK7AD554D3BWZPAGEAQYQOWMFZQDUUAEI.data delete mode 100644 test/test-repo/blocks/AP/CIQHAKDLTL5GMIFGN5YVY4BA22FPHUIODJEXS4LCTQDWA275XAJDAPI.data delete mode 100644 test/test-repo/blocks/C4/CIQDDZ5EDQK5AP7LRTLZHQZUR2R3GECRFV3WPKNL7PL2SKFIL2LXC4Y.data delete mode 100644 test/test-repo/blocks/CY/CIQDMKFEUGKSLXMEXO774EZOYCYNHPRVFD53ZSAU7237F67XDSQGCYQ.data delete mode 100644 test/test-repo/blocks/FN/CIQIXBZMUTXFC5QIGMLJNXLLHZOPGSL2PBC65D4UIVWM6TI5F5TAFNI.data delete mode 100644 test/test-repo/blocks/GQ/CIQH7OEYWXL34RWYL7VXLWEU4FWPVGT24VJT7DUZPTNLF25N25IGGQA.data delete mode 100644 test/test-repo/blocks/HD/CIQDDVW2EZIJF4NQH7WJNESD7XHQSXA5EGJVNTPVHD7444C2KLKXHDI.data delete mode 100644 test/test-repo/blocks/IL/CIQJFGRQHQ45VCQLM7AJNF2GF5UHUAGGHC6LLAH6VYDEKLQMD4QLILY.data delete mode 100644 test/test-repo/blocks/LG/CIQJBQD2O6K4CGJVCCTJNUP57QHR4SKHZ74OIITBBGLOMCO3ZOLWLGA.data delete mode 100644 test/test-repo/blocks/O6/CIQOYW2THIZBRGI7IN33ROGCKOFZLXJJ2MPKYZBTV4H3N7GYHXMAO6A.data delete mode 100644 test/test-repo/blocks/QF/CIQGPALRQ24P6NS4OWHTQ7R247ZI7KJWP3QWPQYS43LFULQC5ANLQFI.data delete mode 100644 test/test-repo/blocks/QV/CIQOHMGEIKMPYHAUTL57JSEZN64SIJ5OIHSGJG4TJSSJLGI3PBJLQVI.data delete mode 100644 test/test-repo/blocks/R3/CIQBED3K6YA5I3QQWLJOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data delete mode 100644 test/test-repo/blocks/S5/CIQHBGZNZRPWVEFNMTLP4OS5EAVHFMCX2HD7FZUC2B3WUU3D4LGKS5A.data delete mode 100644 test/test-repo/blocks/SHARDING delete mode 100644 test/test-repo/blocks/TW/CIQFEAGMNNXXTYKYQSANT6IBNTFN7WR5RPD5F6GN6MBKUUO25DNOTWQ.data delete mode 100644 test/test-repo/blocks/UN/CIQOMBKARLB7PAITVSNH7VEGIQJRPL6J7FT2XYVKAXT4MQPXXPUYUNY.data delete mode 100644 test/test-repo/blocks/VO/CIQGFTQ7FSI2COUXWWLOQ45VUM2GUZCGAXLWCTOKKPGTUWPXHBNIVOY.data delete mode 100644 test/test-repo/blocks/X3/CIQFTFEEHEDF6KLBT32BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data delete mode 100644 test/test-repo/blocks/XO/CIQJGO2B2N75IUEM372FSMG76VV256I4PXBULZZ5ASNLK4FL4EG7XOI.data delete mode 100644 test/test-repo/blocks/_README delete mode 100644 test/test-repo/config delete mode 100644 test/test-repo/datastore/000002.ldb delete mode 100644 test/test-repo/datastore/000005.ldb delete mode 100644 test/test-repo/datastore/CURRENT delete mode 100644 test/test-repo/datastore/LOCK delete mode 100644 test/test-repo/datastore/LOG delete mode 100644 test/test-repo/datastore/LOG.old delete mode 100644 test/test-repo/version diff --git a/package.json b/package.json index 8f1c4ea..240cf37 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "exports": { ".": { "types": "./dist/src/index.d.ts", - "import": "./src/index.js" + "import": "./dist/src/index.js" } }, "eslintConfig": { @@ -161,9 +161,8 @@ "dep-check": "aegir dep-check" }, "dependencies": { - "abstract-level": "^1.0.3", - "datastore-core": "^8.0.1", - "interface-datastore": "^7.0.0", + "datastore-core": "^9.0.1", + "interface-datastore": "^8.0.0", "it-filter": "^2.0.0", "it-map": "^2.0.0", "it-sort": "^2.0.0", @@ -171,14 +170,9 @@ "level": "^8.0.0" }, "devDependencies": { - "@ipld/dag-cbor": "^8.0.0", - "@types/rimraf": "^3.0.2", - "aegir": "^37.5.1", - "interface-datastore-tests": "^3.0.0", + "aegir": "^38.1.7", + "interface-datastore-tests": "^4.0.0", "ipfs-utils": "^9.0.4", - "level-mem": "^6.0.1", - "memory-level": "^1.0.0", - "multiformats": "^10.0.2", - "rimraf": "^3.0.2" + "memory-level": "^1.0.0" } } diff --git a/src/index.js b/src/index.ts similarity index 54% rename from src/index.js rename to src/index.ts index 74ddaaa..1649355 100644 --- a/src/index.js +++ b/src/index.ts @@ -1,33 +1,35 @@ -import { Key } from 'interface-datastore' +import { Batch, Key, KeyQuery, Pair, Query } from 'interface-datastore' import { BaseDatastore, Errors } from 'datastore-core' import filter from 'it-filter' import map from 'it-map' import take from 'it-take' import sort from 'it-sort' import { Level } from 'level' +import type { DatabaseOptions, OpenOptions, IteratorOptions } from 'level' -/** - * @typedef {import('interface-datastore').Datastore} Datastore - * @typedef {import('interface-datastore').Pair} Pair - * @typedef {import('interface-datastore').Batch} Batch - * @typedef {import('interface-datastore').Query} Query - * @typedef {import('interface-datastore').KeyQuery} KeyQuery - * @typedef {import('interface-datastore').Options} QueryOptions - * @typedef {import('abstract-level').AbstractLevel} LevelDb - */ +interface BatchPut { + type: 'put' + key: string + value: Uint8Array +} + +interface BatchDel { + type: 'del' + key: string +} + +type BatchOp = BatchPut | BatchDel /** * A datastore backed by leveldb */ export class LevelDatastore extends BaseDatastore { - /** - * @param {string | LevelDb} path - * @param {import('level').DatabaseOptions & import('level').OpenOptions} [opts] - */ - constructor (path, opts = {}) { + public db: Level + private readonly opts: OpenOptions + + constructor (path: string | Level, opts: DatabaseOptions & OpenOptions = {}) { super() - /** @type {LevelDb} */ this.db = typeof path === 'string' ? new Level(path, { ...opts, @@ -36,7 +38,6 @@ export class LevelDatastore extends BaseDatastore { }) : path - /** @type {import('level').OpenOptions} */ this.opts = { createIfMissing: true, compression: false, // same default as go @@ -44,83 +45,70 @@ export class LevelDatastore extends BaseDatastore { } } - async open () { + async open (): Promise { try { await this.db.open(this.opts) - } catch (/** @type {any} */ err) { + } catch (err: any) { throw Errors.dbOpenFailedError(err) } } - /** - * @param {Key} key - * @param {Uint8Array} value - */ - async put (key, value) { + async put (key: Key, value: Uint8Array): Promise { try { await this.db.put(key.toString(), value) - } catch (/** @type {any} */ err) { + } catch (err: any) { throw Errors.dbWriteFailedError(err) } } - /** - * @param {Key} key - * @returns {Promise} - */ - async get (key) { + async get (key: Key): Promise { let data try { data = await this.db.get(key.toString()) - } catch (/** @type {any} */ err) { - if (err.notFound) throw Errors.notFoundError(err) + } catch (err: any) { + if (err.notFound != null) { + throw Errors.notFoundError(err) + } + throw Errors.dbWriteFailedError(err) } return data } - /** - * @param {Key} key - * @returns {Promise} - */ - async has (key) { + async has (key: Key): Promise { try { await this.db.get(key.toString()) - } catch (/** @type {any} */ err) { - if (err.notFound) return false + } catch (err: any) { + if (err.notFound != null) { + return false + } + throw err } return true } - /** - * @param {Key} key - * @returns {Promise} - */ - async delete (key) { + async delete (key: Key): Promise { try { await this.db.del(key.toString()) - } catch (/** @type {any} */ err) { + } catch (err: any) { throw Errors.dbDeleteFailedError(err) } } - close () { - return this.db && this.db.close() + async close (): Promise { + await this.db.close() } - /** - * @returns {Batch} - */ - batch () { - /** @type {Array<{ type: 'put', key: string, value: Uint8Array; } | { type: 'del', key: string }>} */ - const ops = [] + batch (): Batch { + const ops: BatchOp[] = [] + return { put: (key, value) => { ops.push({ type: 'put', key: key.toString(), - value: value + value }) }, delete: (key) => { @@ -129,16 +117,17 @@ export class LevelDatastore extends BaseDatastore { key: key.toString() }) }, - commit: () => { - return this.db.batch(ops) + commit: async () => { + if (this.db.batch == null) { + throw new Error('Batch operations unsupported by underlying Level') + } + + await this.db.batch(ops) } } } - /** - * @param {Query} q - */ - query (q) { + query (q: Query): AsyncIterable { let it = this._query({ values: true, prefix: q.prefix @@ -153,22 +142,19 @@ export class LevelDatastore extends BaseDatastore { } const { offset, limit } = q - if (offset) { + if (offset != null) { let i = 0 it = filter(it, () => i++ >= offset) } - if (limit) { + if (limit != null) { it = take(it, limit) } return it } - /** - * @param {KeyQuery} q - */ - queryKeys (q) { + queryKeys (q: KeyQuery): AsyncIterable { let it = map(this._query({ values: false, prefix: q.prefix @@ -183,27 +169,20 @@ export class LevelDatastore extends BaseDatastore { } const { offset, limit } = q - if (offset) { + if (offset != null) { let i = 0 it = filter(it, () => i++ >= offset) } - if (limit) { + if (limit != null) { it = take(it, limit) } return it } - /** - * @param {object} opts - * @param {boolean} opts.values - * @param {string} [opts.prefix] - * @returns {AsyncIterable} - */ - _query (opts) { - /** @type {import('level').IteratorOptions} */ - const iteratorOpts = { + _query (opts: { values: boolean, prefix?: string }): AsyncIterable { + const iteratorOpts: IteratorOptions = { keys: true, keyEncoding: 'buffer', values: opts.values @@ -220,7 +199,7 @@ export class LevelDatastore extends BaseDatastore { const iterator = this.db.iterator(iteratorOpts) - if (iterator[Symbol.asyncIterator]) { + if (iterator[Symbol.asyncIterator] != null) { return levelIteratorToIterator(iterator) } @@ -234,11 +213,7 @@ export class LevelDatastore extends BaseDatastore { } } -/** - * @param {import('level').Iterator} li - Level iterator - * @returns {AsyncIterable} - */ -async function * levelIteratorToIterator (li) { +async function * levelIteratorToIterator (li: AsyncIterable<[string, Uint8Array]> & { close: () => Promise }): AsyncIterable { for await (const [key, value] of li) { yield { key: new Key(key, false), value } } @@ -246,35 +221,37 @@ async function * levelIteratorToIterator (li) { await li.close() } -/** - * @typedef {object} LevelIterator - * @property {(cb: (err: Error, key: string | Uint8Array | null, value: any)=> void)=>void} next - * @property {(cb: (err: Error) => void) => void } end - */ +interface OldLevelIterator { + next: (cb: (err: Error, key: string | Uint8Array | null, value: any) => void) => void + end: (cb: (err: Error) => void) => void +} -/** - * @param {LevelIterator} li - Level iterator - * @returns {AsyncIterable} - */ -function oldLevelIteratorToIterator (li) { +function oldLevelIteratorToIterator (li: OldLevelIterator): AsyncIterable { return { [Symbol.asyncIterator] () { return { - next: () => new Promise((resolve, reject) => { + next: async () => await new Promise((resolve, reject) => { li.next((err, key, value) => { - if (err) return reject(err) + if (err != null) { + reject(err); return + } if (key == null) { - return li.end(err => { - if (err) return reject(err) + li.end(err => { + if (err != null) { + reject(err) + return + } resolve({ done: true, value: undefined }) - }) + }); return } resolve({ done: false, value: { key: new Key(key, false), value } }) }) }), - return: () => new Promise((resolve, reject) => { + return: async () => await new Promise((resolve, reject) => { li.end(err => { - if (err) return reject(err) + if (err != null) { + reject(err); return + } resolve({ done: true, value: undefined }) }) }) diff --git a/test/browser.js b/test/browser.ts similarity index 74% rename from test/browser.js rename to test/browser.ts index eb10f61..e86adac 100644 --- a/test/browser.js +++ b/test/browser.ts @@ -8,7 +8,7 @@ import { interfaceDatastoreTests } from 'interface-datastore-tests' describe('LevelDatastore', () => { describe('interface-datastore (leveljs)', () => { interfaceDatastoreTests({ - setup: () => new LevelDatastore('hello-' + Math.random()), + setup: () => new LevelDatastore(`hello-${Math.random()}`), teardown: () => {} }) }) @@ -18,13 +18,13 @@ describe('LevelDatastore', () => { setup () { return new MountDatastore([{ prefix: new Key('/a'), - datastore: new LevelDatastore('one-' + Math.random()) + datastore: new LevelDatastore(`one-${Math.random()}`) }, { prefix: new Key('/q'), - datastore: new LevelDatastore('two-' + Math.random()) + datastore: new LevelDatastore(`two-${Math.random()}`) }, { prefix: new Key('/z'), - datastore: new LevelDatastore('three-' + Math.random()) + datastore: new LevelDatastore(`three-${Math.random()}`) }]) }, teardown () {} diff --git a/test/fixtures/test-level-iterator-destroy.js b/test/fixtures/test-level-iterator-destroy.ts similarity index 86% rename from test/fixtures/test-level-iterator-destroy.js rename to test/fixtures/test-level-iterator-destroy.ts index 7b1f125..ac94563 100644 --- a/test/fixtures/test-level-iterator-destroy.js +++ b/test/fixtures/test-level-iterator-destroy.ts @@ -2,7 +2,7 @@ import { Key } from 'interface-datastore/key' import { LevelDatastore } from '../../src/index.js' import tempdir from 'ipfs-utils/src/temp-dir.js' -async function testLevelIteratorDestroy () { +async function testLevelIteratorDestroy (): Promise { const store = new LevelDatastore(tempdir()) await store.open() await store.put(new Key(`/test/key${Date.now()}`), new TextEncoder().encode(`TESTDATA${Date.now()}`)) @@ -14,4 +14,4 @@ async function testLevelIteratorDestroy () { // Will exit with: // > Assertion failed: (ended_), function ~Iterator, file ../binding.cc, line 546. // If iterator gets destroyed (in c++ land) and .end() was not called on it. -testLevelIteratorDestroy() +void testLevelIteratorDestroy() diff --git a/test/index.spec.js b/test/index.spec.ts similarity index 67% rename from test/index.spec.js rename to test/index.spec.ts index c0f4b85..41b7cb2 100644 --- a/test/index.spec.js +++ b/test/index.spec.ts @@ -18,6 +18,7 @@ describe('LevelDatastore', () => { it('should be able to override the database', async () => { const levelStore = new LevelDatastore( + // @ts-expect-error MemoryLevel does not implement the same interface as Level new MemoryLevel({ keyEncoding: 'utf8', valueEncoding: 'view' @@ -32,19 +33,30 @@ describe('LevelDatastore', () => { describe('interface-datastore MemoryLevel', () => { interfaceDatastoreTests({ - setup: () => new LevelDatastore( - new MemoryLevel({ - keyEncoding: 'utf8', - valueEncoding: 'view' - }) - ), + async setup () { + const store = new LevelDatastore( + // @ts-expect-error MemoryLevel does not implement the same interface as Level + new MemoryLevel({ + keyEncoding: 'utf8', + valueEncoding: 'view' + }) + ) + await store.open() + + return store + }, teardown () {} }) }) describe('interface-datastore Level', () => { interfaceDatastoreTests({ - setup: () => new LevelDatastore(tempdir()), + async setup () { + const store = new LevelDatastore(tempdir()) + await store.open() + + return store + }, teardown () {} }) }) diff --git a/test/node.js b/test/node.ts similarity index 54% rename from test/node.js rename to test/node.ts index 5d43961..075af85 100644 --- a/test/node.js +++ b/test/node.ts @@ -3,12 +3,7 @@ import { expect } from 'aegir/chai' import path from 'path' import { Key } from 'interface-datastore/key' -import rimraf from 'rimraf' import { MountDatastore } from 'datastore-core' -import { CID } from 'multiformats/cid' -import * as Digest from 'multiformats/hashes/digest' -import * as dagCbor from '@ipld/dag-cbor' -import { promisify } from 'util' import childProcess from 'child_process' import { interfaceDatastoreTests } from 'interface-datastore-tests' import { LevelDatastore } from '../src/index.js' @@ -16,52 +11,40 @@ import tempdir from 'ipfs-utils/src/temp-dir.js' describe('LevelDatastore', () => { describe('interface-datastore (leveldown)', () => { - const dir = tempdir() interfaceDatastoreTests({ - setup: () => new LevelDatastore(dir), - teardown: () => promisify(rimraf)(dir) + async setup () { + const store = new LevelDatastore(tempdir()) + await store.open() + + return store + }, + teardown () {} }) }) describe('interface-datastore (mount(leveldown, leveldown, leveldown))', () => { - const dirs = [ - tempdir(), - tempdir(), - tempdir() - ] - interfaceDatastoreTests({ - setup () { - return new MountDatastore([{ - prefix: new Key('/a'), - datastore: new LevelDatastore(dirs[0]) - }, { - prefix: new Key('/q'), - datastore: new LevelDatastore(dirs[1]) - }, { - prefix: new Key('/z'), - datastore: new LevelDatastore(dirs[2]) - }]) + async setup () { + return new MountDatastore( + await Promise.all( + ['/a', '/q', '/z'].map(async prefix => { + const datastore = new LevelDatastore(tempdir()) + await datastore.open() + + return { + prefix: new Key(prefix), + datastore + } + }) + ) + ) }, - teardown () { - return Promise.all(dirs.map(dir => promisify(rimraf)(dir))) + async teardown () { + } }) }) - it.skip('interop with go', async () => { - const store = new LevelDatastore(path.join(__dirname, 'test-repo', 'datastore')) - - const cids = [] - - for await (const e of store.query({})) { - cids.push(CID.createV1(dagCbor.code, Digest.decode(e.key.uint8Array()))) - } - - expect(cids[0].version).to.be.eql(0) - expect(cids).to.have.length(4) - }) - // The `.end()` method MUST be called on LevelDB iterators or they remain open, // leaking memory. // @@ -78,12 +61,12 @@ describe('LevelDatastore', () => { // // https://github.com/Level/leveldown/blob/d3453fbde4d2a8aa04d9091101c25c999649069b/binding.cc#L545 it('should not leave iterators open and leak memory', (done) => { - const cp = childProcess.fork(path.join(process.cwd(), '/test/fixtures/test-level-iterator-destroy'), { stdio: 'pipe' }) + const cp = childProcess.fork(path.join(process.cwd(), '/dist/test/fixtures/test-level-iterator-destroy'), { stdio: 'pipe' }) let out = '' const { stdout, stderr } = cp - stdout && stdout.on('data', d => { out += d }) - stderr && stderr.on('data', d => { out += d }) + stdout?.on('data', d => { out = `${out}${d}` }) + stderr?.on('data', d => { out = `${out}${d}` }) cp.on('exit', code => { expect(code).to.equal(0) diff --git a/test/test-repo/blocks/2F/CIQEUWUVLBXVFYSYCHHSCRTXCYHGIOBXKWUMKFR3UPAFHQ5WK5362FQ.data b/test/test-repo/blocks/2F/CIQEUWUVLBXVFYSYCHHSCRTXCYHGIOBXKWUMKFR3UPAFHQ5WK5362FQ.data deleted file mode 100644 index 4145619..0000000 --- a/test/test-repo/blocks/2F/CIQEUWUVLBXVFYSYCHHSCRTXCYHGIOBXKWUMKFR3UPAFHQ5WK5362FQ.data +++ /dev/null @@ -1,4 +0,0 @@ - -ys# js-ipfs-repo -Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript -s \ No newline at end of file diff --git a/test/test-repo/blocks/5V/CIQFFRR4O52TS2Z7QLDDTF32OIR4FWLKT5YLL7MLDVIT7DC3NHOK5VA.data b/test/test-repo/blocks/5V/CIQFFRR4O52TS2Z7QLDDTF32OIR4FWLKT5YLL7MLDVIT7DC3NHOK5VA.data deleted file mode 100644 index 951bfe0..0000000 --- a/test/test-repo/blocks/5V/CIQFFRR4O52TS2Z7QLDDTF32OIR4FWLKT5YLL7MLDVIT7DC3NHOK5VA.data +++ /dev/null @@ -1,23 +0,0 @@ - -€ø IPFS Alpha Security Notes - -We try hard to ensure our system is safe and robust, but all software -has bugs, especially new software. This distribution is meant to be an -alpha preview, don't use it for anything mission critical. - -Please note the following: - -- This is alpha software and has not been audited. It is our goal - to conduct a proper security audit once we close in on a 1.0 release. - -- ipfs is a networked program, and may have serious undiscovered - vulnerabilities. It is written in Go, and we do not execute any - user provided data. But please point any problems out to us in a - github issue, or email security@ipfs.io privately. - -- ipfs uses encryption for all communication, but it's NOT PROVEN SECURE - YET! It may be totally broken. For now, the code is included to make - sure we benchmark our operations with encryption in mind. In the future, - there will be an "unsafe" mode for high performance intranet apps. - If this is a blocking feature for you, please contact us. -ø \ No newline at end of file diff --git a/test/test-repo/blocks/75/CIQMB7DLJFKD267QJ2B5FJNHZPTSVA7IB6OHXSQ2XSVEEKMKK6RT75I.data b/test/test-repo/blocks/75/CIQMB7DLJFKD267QJ2B5FJNHZPTSVA7IB6OHXSQ2XSVEEKMKK6RT75I.data deleted file mode 100644 index c9885c45d7e7c10d02b98208d40cfd7b8bfaed21..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 101 zcmWgA=TZ_+Kwo-;;PadOz%uNME$6+{JHE$$U!OUW!sO)in> z4G}T|X$WFClbv7rFrua5=1<0)Q}=J#b|1g=` -- browsers or extensions can learn to use `ipfs://` directly -- hash-addressed content guarantees authenticity - -IPFS is modular: -- connection layer over any network protocol -- routing layer -- uses a routing layer DHT (kademlia/coral) -- uses a path-based naming service -- uses bittorrent-inspired block exchange - -IPFS uses crypto: -- cryptographic-hash content addressing -- block-level deduplication -- file integrity + versioning -- filesystem-level encryption + signing support - -IPFS is p2p: -- worldwide peer-to-peer file transfers -- completely decentralized architecture -- **no** central point of failure - -IPFS is a cdn: -- add a file to the filesystem locally, and it's now available to the world -- caching-friendly (content-hash naming) -- bittorrent-based bandwidth distribution - -IPFS has a name service: -- IPNS, an SFS inspired name system -- global namespace based on PKI -- serves to build trust chains -- compatible with other NSes -- can map DNS, .onion, .bit, etc to IPNS - \ No newline at end of file diff --git a/test/test-repo/blocks/AE/CIQONICFQZH7QVU6IPSIM3AK7AD554D3BWZPAGEAQYQOWMFZQDUUAEI.data b/test/test-repo/blocks/AE/CIQONICFQZH7QVU6IPSIM3AK7AD554D3BWZPAGEAQYQOWMFZQDUUAEI.data deleted file mode 100644 index 6860441..0000000 --- a/test/test-repo/blocks/AE/CIQONICFQZH7QVU6IPSIM3AK7AD554D3BWZPAGEAQYQOWMFZQDUUAEI.data +++ /dev/null @@ -1,3 +0,0 @@ -/ -" gq†¸ÿ6\u8~:çò©6~ágÃæÖZ.è¸directT2 -" 6(¤¡•%Ý„»¿þ.À°Ó¾5(û¼Èþ·òû÷ ab recursive·T \ No newline at end of file diff --git a/test/test-repo/blocks/AP/CIQHAKDLTL5GMIFGN5YVY4BA22FPHUIODJEXS4LCTQDWA275XAJDAPI.data b/test/test-repo/blocks/AP/CIQHAKDLTL5GMIFGN5YVY4BA22FPHUIODJEXS4LCTQDWA275XAJDAPI.data deleted file mode 100644 index 74de75af616ff437b5c7a3a5272281eac2146b6c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 309 zcmWgA<5Ch*SgK>j#LTl(=mjz6J*Z#Z`mUeibke1%>*qt`A@ymo*6O-~wOC)CS z3K@XZPnu<5V|lBKJN>}4>2CTNRSd^0_H1qVw~ozKk4Ii%i@p$ha(-S(VseSZ2}U7Z zkd6rls>-Jxlr$AsHtpiyKm2l@?&p6zQA*^T_KfrP>FKF6gjh0Ca|$F5F$tM~lqa2& z*O|D`YWmh`FN(J=HpxnHW4)f}dn)*>RpfVzsIJ{Y+=Zo?$=SNaC5c5P5({~S^g+6W z__Mw-Uda>Kbm^hob(zph@di$ZR2iSh3b{RB`110NH$rShsfj7MsS@Wngv>!2f{xjg zms)1qHyyK_UR9)g=w{aZf~|kMWdrSdqBHNTyCTF_oSIx(lvz@#o0ngbS}f7b!NtVE F2moEFc%uLS diff --git a/test/test-repo/blocks/C4/CIQDDZ5EDQK5AP7LRTLZHQZUR2R3GECRFV3WPKNL7PL2SKFIL2LXC4Y.data b/test/test-repo/blocks/C4/CIQDDZ5EDQK5AP7LRTLZHQZUR2R3GECRFV3WPKNL7PL2SKFIL2LXC4Y.data deleted file mode 100644 index ecce105..0000000 --- a/test/test-repo/blocks/C4/CIQDDZ5EDQK5AP7LRTLZHQZUR2R3GECRFV3WPKNL7PL2SKFIL2LXC4Y.data +++ /dev/null @@ -1,4 +0,0 @@ -5 -" ¸˜µ×¾FØ_ëuØ”álúšzåS?Ž™|Ú²ë­×Pc@ js-ipfs-repoŸ - - \ No newline at end of file diff --git a/test/test-repo/blocks/CY/CIQDMKFEUGKSLXMEXO774EZOYCYNHPRVFD53ZSAU7237F67XDSQGCYQ.data b/test/test-repo/blocks/CY/CIQDMKFEUGKSLXMEXO774EZOYCYNHPRVFD53ZSAU7237F67XDSQGCYQ.data deleted file mode 100644 index bbe6bda78d0a52f6d87da578f452d43718b9aa9f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10807 zcmeI&tqQ_m6vpvsQC>mhU=TmxWeCpZ4H&eDU=nNw5wR?6Yue0K5w>X*qZns5SS{Xw z-hn1RK)egXzn^qC&+{usEM\óIzxEî”ElÏM/fµLICENSE»1 -" JZ•XoRâXÏ!Fwd87U¨Å;£ÀSöWwí README.md{ - \ No newline at end of file diff --git a/test/test-repo/blocks/HD/CIQDDVW2EZIJF4NQH7WJNESD7XHQSXA5EGJVNTPVHD7444C2KLKXHDI.data b/test/test-repo/blocks/HD/CIQDDVW2EZIJF4NQH7WJNESD7XHQSXA5EGJVNTPVHD7444C2KLKXHDI.data deleted file mode 100644 index 5ea0edda6f82982c276a4a3813a50c0e35121c68..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10765 zcmeIzF%AJy6a~;Rm3)!Nk3xb(CK9$mt(wFR^jf72s6=9D)srdd6*gc6EI~I4+fbbT zRX6Y66Q?1IqgQpGAHRd{ss22Q^=&*UXYbW{zqlNV{wBXJW712aODXvf?XV11kq9)T zAq{CrLmJYMhBTxh4QWV28q$!4G^8O7X-GpF(vXHUq#+GyNJARZkcKp*;U8!iTA|tK KY}4Vho$h|}9P~&4 diff --git a/test/test-repo/blocks/IL/CIQJFGRQHQ45VCQLM7AJNF2GF5UHUAGGHC6LLAH6VYDEKLQMD4QLILY.data b/test/test-repo/blocks/IL/CIQJFGRQHQ45VCQLM7AJNF2GF5UHUAGGHC6LLAH6VYDEKLQMD4QLILY.data deleted file mode 100644 index 62d1c29..0000000 --- a/test/test-repo/blocks/IL/CIQJFGRQHQ45VCQLM7AJNF2GF5UHUAGGHC6LLAH6VYDEKLQMD4QLILY.data +++ /dev/null @@ -1,8 +0,0 @@ - -ŽCome hang out in our IRC chat room if you have any questions. - -Contact the ipfs dev team: -- Bugs: https://github.com/ipfs/go-ipfs/issues -- Help: irc.freenode.org/#ipfs -- Email: dev@ipfs.io -½ \ No newline at end of file diff --git a/test/test-repo/blocks/LG/CIQJBQD2O6K4CGJVCCTJNUP57QHR4SKHZ74OIITBBGLOMCO3ZOLWLGA.data b/test/test-repo/blocks/LG/CIQJBQD2O6K4CGJVCCTJNUP57QHR4SKHZ74OIITBBGLOMCO3ZOLWLGA.data deleted file mode 100644 index 71be805..0000000 --- a/test/test-repo/blocks/LG/CIQJBQD2O6K4CGJVCCTJNUP57QHR4SKHZ74OIITBBGLOMCO3ZOLWLGA.data +++ /dev/null @@ -1,9 +0,0 @@ - -¿·Some helpful resources for finding your way around ipfs: - -- quick-start: a quick show of various ipfs features. -- ipfs commands: a list of all commands -- ipfs --help: every command describes itself -- https://github.com/ipfs/go-ipfs -- the src repository -- #ipfs on irc.freenode.org -- the community irc channel -· \ No newline at end of file diff --git a/test/test-repo/blocks/O6/CIQOYW2THIZBRGI7IN33ROGCKOFZLXJJ2MPKYZBTV4H3N7GYHXMAO6A.data b/test/test-repo/blocks/O6/CIQOYW2THIZBRGI7IN33ROGCKOFZLXJJ2MPKYZBTV4H3N7GYHXMAO6A.data deleted file mode 100644 index 7b58d6c..0000000 --- a/test/test-repo/blocks/O6/CIQOYW2THIZBRGI7IN33ROGCKOFZLXJJ2MPKYZBTV4H3N7GYHXMAO6A.data +++ /dev/null @@ -1,3 +0,0 @@ -/ -" æ@ŠÃ÷¬šÔ†D¯Éùg«âªçÆA÷»éŠ7directT2 -" “;AÓÔPŒßôY0ßõk®ù}ÃEç=šµp«á û¹ recursiveáT \ No newline at end of file diff --git a/test/test-repo/blocks/QF/CIQGPALRQ24P6NS4OWHTQ7R247ZI7KJWP3QWPQYS43LFULQC5ANLQFI.data b/test/test-repo/blocks/QF/CIQGPALRQ24P6NS4OWHTQ7R247ZI7KJWP3QWPQYS43LFULQC5ANLQFI.data deleted file mode 100644 index a8f98693b7d4797d0a55704b16c15a6aa7d34bd5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10765 zcmeIzF%AJy6a~Szz&}ww{ J&EYejEr0X~^v?hQ diff --git a/test/test-repo/blocks/QV/CIQOHMGEIKMPYHAUTL57JSEZN64SIJ5OIHSGJG4TJSSJLGI3PBJLQVI.data b/test/test-repo/blocks/QV/CIQOHMGEIKMPYHAUTL57JSEZN64SIJ5OIHSGJG4TJSSJLGI3PBJLQVI.data deleted file mode 100644 index e69de29..0000000 diff --git a/test/test-repo/blocks/R3/CIQBED3K6YA5I3QQWLJOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data b/test/test-repo/blocks/R3/CIQBED3K6YA5I3QQWLJOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data deleted file mode 100644 index 389e111..0000000 --- a/test/test-repo/blocks/R3/CIQBED3K6YA5I3QQWLJOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data +++ /dev/null @@ -1,28 +0,0 @@ - -ËÃHello and Welcome to IPFS! - -██╗██████╗ ███████╗███████╗ -██║██╔â•â•██╗██╔â•â•â•â•â•██╔â•â•â•â•â• -██║██████╔â•█████╗ ███████╗ -██║██╔â•â•â•╠██╔â•â•╠╚â•â•â•â•██║ -██║██║ ██║ ███████║ -╚â•â•╚â•╠╚â•╠╚â•â•â•â•â•â•â• - -If you're seeing this, you have successfully installed -IPFS and are now interfacing with the ipfs merkledag! - - ------------------------------------------------------- -| Warning: | -| This is alpha software. Use at your own discretion! | -| Much is missing or lacking polish. There are bugs. | -| Not yet secure. Read the security notes for more. | - ------------------------------------------------------- - -Check out some of the other files in this directory: - - ./about - ./help - ./quick-start <-- usage examples - ./readme <-- this file - ./security-notes -à \ No newline at end of file diff --git a/test/test-repo/blocks/S5/CIQHBGZNZRPWVEFNMTLP4OS5EAVHFMCX2HD7FZUC2B3WUU3D4LGKS5A.data b/test/test-repo/blocks/S5/CIQHBGZNZRPWVEFNMTLP4OS5EAVHFMCX2HD7FZUC2B3WUU3D4LGKS5A.data deleted file mode 100644 index 3a99c36..0000000 --- a/test/test-repo/blocks/S5/CIQHBGZNZRPWVEFNMTLP4OS5EAVHFMCX2HD7FZUC2B3WUU3D4LGKS5A.data +++ /dev/null @@ -1,3 +0,0 @@ -4 -" Y”„9_)ažô€Ë¹2¾RÅm™Å–keà9ð˜»ï js-ipfs-repo - \ No newline at end of file diff --git a/test/test-repo/blocks/SHARDING b/test/test-repo/blocks/SHARDING deleted file mode 100644 index a153331..0000000 --- a/test/test-repo/blocks/SHARDING +++ /dev/null @@ -1 +0,0 @@ -/repo/flatfs/shard/v1/next-to-last/2 diff --git a/test/test-repo/blocks/TW/CIQFEAGMNNXXTYKYQSANT6IBNTFN7WR5RPD5F6GN6MBKUUO25DNOTWQ.data b/test/test-repo/blocks/TW/CIQFEAGMNNXXTYKYQSANT6IBNTFN7WR5RPD5F6GN6MBKUUO25DNOTWQ.data deleted file mode 100644 index 10aa2ae4f1291a62edd84980f1c05b09b95f78ff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10891 zcmWgA;8GG&c)a0=(~LhdBC~#fIWaSTr;7SI$0sSXC;Kd!I#aqLXh*0Jg9L-nsLIh$ z8ciXixns0s7%de?YlP9-aI`iYtqn(O!_nGsv^E^A4M%Ik(b{mdHXN-DM{C2;+HkZs z9IXvUYs1mnaI`iYtqn(O!_nGsv^E^A4M%Ik(b{mdHXN-DM{C2;+HkZs9IXvUYs1mn zaI`iYG__&mlom_2c+JFlUxXS??=;#MbToJ7(P`PK4+MoQKg`(u9q~6w(px+ cb8FMhello - ipfs add hello - - -View it: - - ipfs cat - - -Try a directory: - - mkdir foo - mkdir foo/bar - echo "baz" > foo/baz - echo "baz" > foo/bar/baz - ipfs add -r foo - - -View things: - - ipfs ls - ipfs ls /bar - ipfs cat /baz - ipfs cat /bar/baz - ipfs cat /bar - ipfs ls /baz - - -References: - - ipfs refs - ipfs refs -r - ipfs refs --help - - -Get: - - ipfs get foo2 - diff foo foo2 - - -Objects: - - ipfs object get - ipfs object get /foo2 - ipfs object --help - - -Pin + GC: - - ipfs pin -r - ipfs gc - ipfs ls - ipfs unpin -r - ipfs gc - - -Daemon: - - ipfs daemon (in another terminal) - ipfs id - - -Network: - - (must be online) - ipfs swarm peers - ipfs id - ipfs cat - - -Mount: - - (warning: fuse is finicky!) - ipfs mount - cd /ipfs/< - - -Tool: - - ipfs version - ipfs update - ipfs commands - ipfs config --help - open http://localhost:5001/webui - - -Browse: - - webui: - - http://localhost:5001/webui - - video: - - http://localhost:8080/ipfs/QmVc6zuAneKJzicnJpfrqCH9gSy6bz54JhcypfJYhGUFQu/play#/ipfs/QmTKZgRNwDNZwHtJSjCp6r5FYefzpULfy37JvMt9DwvXse - - images: - - http://localhost:8080/ipfs/QmZpc3HvfjEXvLWGQPWbHk3AjD5j8NEN4gmFN8Jmrd5g83/cs - - markdown renderer app: - - http://localhost:8080/ipfs/QmX7M9CiYXjVeFnkfVGf3y5ixTZ2ACeSGyL1vBJY1HvQPp/mdown -– \ No newline at end of file diff --git a/test/test-repo/blocks/X3/CIQFTFEEHEDF6KLBT32BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data b/test/test-repo/blocks/X3/CIQFTFEEHEDF6KLBT32BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data deleted file mode 100644 index 9553a94..0000000 --- a/test/test-repo/blocks/X3/CIQFTFEEHEDF6KLBT32BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/test/test-repo/blocks/XO/CIQJGO2B2N75IUEM372FSMG76VV256I4PXBULZZ5ASNLK4FL4EG7XOI.data b/test/test-repo/blocks/XO/CIQJGO2B2N75IUEM372FSMG76VV256I4PXBULZZ5ASNLK4FL4EG7XOI.data deleted file mode 100644 index d899663bf7a13bb0563304b1d96985a784c2d515..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10849 zcmWgA;8GG&c)a0=(~LhdBC~#fIWaSTr;7SI$0sSXC;Kd!I#aqLXh*0Jg9L-nsLIh$ z8ciXixns0s7%de?YlP9-aI`iYtqn(O!_nGsv^E^A4M%Ik(b{mdHXN-DM{C2;+HkZs z9IXvUYs1mnaI`iYtqn(O!_nGsv^E^A4M%Ik(b{mdHXN-DM{C2;+HkZs9IXvUYs1mn zaI`iYG__&mlom_2c+JFlUxXS??=;#MbToJ7(P`PK4+MoQKg`(u9.data. Where is the -"base32" encoding of the CID (as specified in -https://github.com/multiformats/multibase) without the 'B' prefix. -All the object files are placed in a tree of directories, based on a -function of the CID. This is a form of sharding similar to -the objects directory in git repositories. Previously, we used -prefixes, we now use the next-to-last two charters. - - func NextToLast(base32cid string) { - nextToLastLen := 2 - offset := len(base32cid) - nextToLastLen - 1 - return str[offset : offset+nextToLastLen] - } - -For example, an object with a base58 CIDv1 of - - zb2rhYSxw4ZjuzgCnWSt19Q94ERaeFhu9uSqRgjSdx9bsgM6f - -has a base32 CIDv1 of - - BAFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA - -and will be placed at - - SC/AFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA.data - -with 'SC' being the last-to-next two characters and the 'B' at the -beginning of the CIDv1 string is the multibase prefix that is not -stored in the filename. diff --git a/test/test-repo/config b/test/test-repo/config deleted file mode 100644 index dc6d6e7..0000000 --- a/test/test-repo/config +++ /dev/null @@ -1,85 +0,0 @@ -{ - "Identity": { - "PeerID": "QmQ2zigjQikYnyYUSXZydNXrDRhBut2mubwJBaLXobMt3A", - "PrivKey": "CAASpgkwggSiAgEAAoIBAQC2SKo/HMFZeBml1AF3XijzrxrfQXdJzjePBZAbdxqKR1Mc6juRHXij6HXYPjlAk01BhF1S3Ll4Lwi0cAHhggf457sMg55UWyeGKeUv0ucgvCpBwlR5cQ020i0MgzjPWOLWq1rtvSbNcAi2ZEVn6+Q2EcHo3wUvWRtLeKz+DZSZfw2PEDC+DGPJPl7f8g7zl56YymmmzH9liZLNrzg/qidokUv5u1pdGrcpLuPNeTODk0cqKB+OUbuKj9GShYECCEjaybJDl9276oalL9ghBtSeEv20kugatTvYy590wFlJkkvyl+nPxIH0EEYMKK9XRWlu9XYnoSfboiwcv8M3SlsjAgMBAAECggEAZtju/bcKvKFPz0mkHiaJcpycy9STKphorpCT83srBVQi59CdFU6Mj+aL/xt0kCPMVigJw8P3/YCEJ9J+rS8BsoWE+xWUEsJvtXoT7vzPHaAtM3ci1HZd302Mz1+GgS8Epdx+7F5p80XAFLDUnELzOzKftvWGZmWfSeDnslwVONkL/1VAzwKy7Ce6hk4SxRE7l2NE2OklSHOzCGU1f78ZzVYKSnS5Ag9YrGjOAmTOXDbKNKN/qIorAQ1bovzGoCwx3iGIatQKFOxyVCyO1PsJYT7JO+kZbhBWRRE+L7l+ppPER9bdLFxs1t5CrKc078h+wuUr05S1P1JjXk68pk3+kQKBgQDeK8AR11373Mzib6uzpjGzgNRMzdYNuExWjxyxAzz53NAR7zrPHvXvfIqjDScLJ4NcRO2TddhXAfZoOPVH5k4PJHKLBPKuXZpWlookCAyENY7+Pd55S8r+a+MusrMagYNljb5WbVTgN8cgdpim9lbbIFlpN6SZaVjLQL3J8TWH6wKBgQDSChzItkqWX11CNstJ9zJyUE20I7LrpyBJNgG1gtvz3ZMUQCn3PxxHtQzN9n1P0mSSYs+jBKPuoSyYLt1wwe10/lpgL4rkKWU3/m1Myt0tveJ9WcqHh6tzcAbb/fXpUFT/o4SWDimWkPkuCb+8j//2yiXk0a/T2f36zKMuZvujqQKBgC6B7BAQDG2H2B/ijofp12ejJU36nL98gAZyqOfpLJ+FeMz4TlBDQ+phIMhnHXA5UkdDapQ+zA3SrFk+6yGk9Vw4Hf46B+82SvOrSbmnMa+PYqKYIvUzR4gg34rL/7AhwnbEyD5hXq4dHwMNsIDq+l2elPjwm/U9V0gdAl2+r50HAoGALtsKqMvhv8HucAMBPrLikhXP/8um8mMKFMrzfqZ+otxfHzlhI0L08Bo3jQrb0Z7ByNY6M8epOmbCKADsbWcVre/AAY0ZkuSZK/CaOXNX/AhMKmKJh8qAOPRY02LIJRBCpfS4czEdnfUhYV/TYiFNnKRj57PPYZdTzUsxa/yVTmECgYBr7slQEjb5Onn5mZnGDh+72BxLNdgwBkhO0OCdpdISqk0F0Pxby22DFOKXZEpiyI9XYP1C8wPiJsShGm2yEwBPWXnrrZNWczaVuCbXHrZkWQogBDG3HGXNdU4MAWCyiYlyinIBpPpoAJZSzpGLmWbMWh28+RJS6AQX6KHrK1o2uw==" - }, - "Datastore": { - "Type": "", - "Path": "", - "StorageMax": "", - "StorageGCWatermark": 0, - "GCPeriod": "", - "Params": null, - "NoSync": false - }, - "Addresses": { - "Swarm": [ - "/ip4/0.0.0.0/tcp/4001", - "/ip6/::/tcp/4001" - ], - "API": "/ip4/127.0.0.1/tcp/5001", - "Gateway": "/ip4/127.0.0.1/tcp/8080" - }, - "Mounts": { - "IPFS": "/ipfs", - "IPNS": "/ipns", - "FuseAllowOther": false - }, - "Version": { - "Current": "0.4.0-dev", - "Check": "error", - "CheckDate": "0001-01-01T00:00:00Z", - "CheckPeriod": "172800000000000", - "AutoUpdate": "minor" - }, - "Discovery": { - "MDNS": { - "Enabled": true, - "Interval": 10 - } - }, - "Ipns": { - "RepublishPeriod": "", - "RecordLifetime": "", - "ResolveCacheSize": 128 - }, - "Bootstrap": [ - "/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ", - "/dnsaddr/bootstrap.libp2p.io/ipfs/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN", - "/dnsaddr/bootstrap.libp2p.io/ipfs/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa", - "/dnsaddr/bootstrap.libp2p.io/ipfs/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb", - "/dnsaddr/bootstrap.libp2p.io/ipfs/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt", - "/dnsaddr/bootstrap.libp2p.io/ipfs/QmZa1sAxajnQjVM8WjWXoMbmPd7NsWhfKsPkErzpm9wGkp" - ], - "Tour": { - "Last": "" - }, - "Gateway": { - "HTTPHeaders": null, - "RootRedirect": "", - "Writable": false - }, - "SupernodeRouting": { - "Servers": [ - "/ip4/104.236.176.52/tcp/4002/ipfs/QmXdb7tWTxdFEQEFgWBqkuYSrZd3mXrC7HxkD4krGNYx2U", - "/ip4/104.236.179.241/tcp/4002/ipfs/QmVRqViDByUxjUMoPnjurjKvZhaEMFDtK35FJXHAM4Lkj6", - "/ip4/104.236.151.122/tcp/4002/ipfs/QmSZwGx8Tn8tmcM4PtDJaMeUQNRhNFdBLVGPzRiNaRJtFH", - "/ip4/162.243.248.213/tcp/4002/ipfs/QmbHVEEepCi7rn7VL7Exxpd2Ci9NNB6ifvqwhsrbRMgQFP", - "/ip4/128.199.219.111/tcp/4002/ipfs/Qmb3brdCYmKG1ycwqCbo6LUwWxTuo3FisnJV2yir7oN92R", - "/ip4/104.236.76.40/tcp/4002/ipfs/QmdRBCV8Cz2dGhoKLkD3YjPwVFECmqADQkx5ZteF2c6Fy4", - "/ip4/178.62.158.247/tcp/4002/ipfs/QmUdiMPci7YoEUBkyFZAh2pAbjqcPr7LezyiPD2artLw3v", - "/ip4/178.62.61.185/tcp/4002/ipfs/QmVw6fGNqBixZE4bewRLT2VXX7fAHUHs8JyidDiJ1P7RUN" - ] - }, - "API": { - "HTTPHeaders": null - }, - "Swarm": { - "AddrFilters": null - }, - "Log": { - "MaxSizeMB": 250, - "MaxBackups": 1, - "MaxAgeDays": 0 - } -} \ No newline at end of file diff --git a/test/test-repo/datastore/000002.ldb b/test/test-repo/datastore/000002.ldb deleted file mode 100644 index fc04d660e9ab26bb5d27b3b6b33d212bd1e34f0b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 211 zcmZROP}0xIPfpCyPs_|nEiTH>FJWY200SX~$SEzBZ1I|j^S%f*oZe})FX(9Q%%jt? zQy&NlS$>$Y`#n34QbA^3F(V^P!?OjhZT>&P<~cuU%i;RLe(ysy@1_qD4Q&dq4R$uX zbPxoo11sKKRu>QF9Qd?w0|O_M0pouNU?_u2-8}VndNoG}qZmkp00{rx(5+JHej5PO CoIXSV diff --git a/test/test-repo/datastore/000005.ldb b/test/test-repo/datastore/000005.ldb deleted file mode 100644 index 63d9d260b936415ee42b5aeda6c79fb941664398..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1120 zcmZQDSjViNS&&z(FQg!8*qs;0^V3RMWIveo0t|Brg#j3VRkisv@!=|IgJvNC_dNx9y@%e`@arzW`upR#0^RR3Lu1P3 zgny1+s9JOHtH$|N^V2^pIaU+*`j0Vdf^UEA=Y(L*NL7==e45ubJUDbI<}5@1nZ5i@ zU-f@onB_6=BHQa-tVc_VRZiT0AST5ib<){%%1r}PkJe@8+6(<3{`CFeMP?prC*c znwwdgM`+7O$B&?~72w>77RV zf{y0SJUT5q^?{&}<%b!&-?Q^56=dcWGqS)myonCBGLo1n?_9oP$D!cvsdqIm%dJT< zUeCYn&kfrf>=lfOBoQtW6k&$7W$0~c7gOL@IORq4N$7y_CFLmFs-1D4yKkEePa;Yx&V3}9e z6J;wFzbL(7XX!B6*Rdrw=+4dxeU2>!j1QaGe>~sK(>yOETD?v4ss5$s3VXC14~0|~ z@|s=JZrGS)y@`hY)f%XfBnQv@ZgL4too7C-W6;9@lKgp&)Y9xu#YGC zq+Q(oPkf)J&zo^7bJ>~t)Xqs~*IU@HQqP#^{d0FztkiZ*y~k%OjhiRCYiY>$1@7+Z zzc{J2k%`0O*2zuI)9>zn)wWdsh9cXQc|w1;OnM=;)%wQi`6UM;Jtuj8n*Q?qk;X3q zZaf<6!(B7;zLu#kRKLAQM`r(FbFXM+CT2zkqS6H@{24)n$QSJzIOo8pg&P<+nGG2K hLjXe)2VAZvSyQK-gJTMZI7kRT2>;#Cty1cK8vstu!bkuB diff --git a/test/test-repo/datastore/CURRENT b/test/test-repo/datastore/CURRENT deleted file mode 100644 index e8c0266..0000000 --- a/test/test-repo/datastore/CURRENT +++ /dev/null @@ -1 +0,0 @@ -MANIFEST-000063 diff --git a/test/test-repo/datastore/LOCK b/test/test-repo/datastore/LOCK deleted file mode 100644 index e69de29..0000000 diff --git a/test/test-repo/datastore/LOG b/test/test-repo/datastore/LOG deleted file mode 100644 index 66aee60..0000000 --- a/test/test-repo/datastore/LOG +++ /dev/null @@ -1,3 +0,0 @@ -2017/05/23-14:42:56.239864 700009de0000 Recovering log #92 -2017/05/23-14:42:56.241220 700009de0000 Delete type=0 #92 -2017/05/23-14:42:56.241292 700009de0000 Delete type=3 #61 diff --git a/test/test-repo/datastore/LOG.old b/test/test-repo/datastore/LOG.old deleted file mode 100644 index 53861c1..0000000 --- a/test/test-repo/datastore/LOG.old +++ /dev/null @@ -1 +0,0 @@ -2017/03/23-00:02:26.660354 70000c41d000 Delete type=3 #59 diff --git a/test/test-repo/version b/test/test-repo/version deleted file mode 100644 index 7ed6ff8..0000000 --- a/test/test-repo/version +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/tsconfig.json b/tsconfig.json index 2742a08..17006c2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,8 +1,7 @@ { "extends": "aegir/src/config/tsconfig.aegir.json", "compilerOptions": { - "outDir": "dist", - "emitDeclarationOnly": true + "outDir": "dist" }, "include": [ "test", From 981f3ae6583243f500df525a72e12e18c389306f Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 13 Mar 2023 19:58:57 +0000 Subject: [PATCH 9/9] chore(release): 10.0.0 [skip ci] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## [10.0.0](https://github.com/ipfs/js-datastore-level/compare/v9.0.4...v10.0.0) (2023-03-13) ### âš  BREAKING CHANGES * this module now implements interface-datastore@8.x.x ### Dependencies * update to interface-datastore 8.x.x ([#172](https://github.com/ipfs/js-datastore-level/issues/172)) ([178d235](https://github.com/ipfs/js-datastore-level/commit/178d235254805f2abdd919e0860bd86af5b48582)) --- CHANGELOG.md | 11 +++++++++++ package.json | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d3cd94..33dd21b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +## [10.0.0](https://github.com/ipfs/js-datastore-level/compare/v9.0.4...v10.0.0) (2023-03-13) + + +### âš  BREAKING CHANGES + +* this module now implements interface-datastore@8.x.x + +### Dependencies + +* update to interface-datastore 8.x.x ([#172](https://github.com/ipfs/js-datastore-level/issues/172)) ([178d235](https://github.com/ipfs/js-datastore-level/commit/178d235254805f2abdd919e0860bd86af5b48582)) + ## [9.0.4](https://github.com/ipfs/js-datastore-level/compare/v9.0.3...v9.0.4) (2022-11-03) diff --git a/package.json b/package.json index 240cf37..fc66bf2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "datastore-level", - "version": "9.0.4", + "version": "10.0.0", "description": "Datastore implementation with level(up|down) backend", "author": "Friedel Ziegelmayer", "license": "Apache-2.0 OR MIT",