diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 290ad02..0bc3b42 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,3 +6,6 @@ updates: interval: daily time: "10:00" open-pull-requests-limit: 10 + commit-message: + prefix: "deps" + prefix-development: "deps(dev)" diff --git a/README.md b/README.md index 1462157..2ca3a3b 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,31 @@ # datastore-pubsub -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![](https://img.shields.io/codecov/c/github/ipfs/js-datastore-pubsub.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-datastore-pubsub) -[![Build Status](https://github.com/ipfs/js-datastore-pubsub/actions/workflows/js-test-and-release.yml/badge.svg?branch=master)](https://github.com/ipfs/js-datastore-pubsub/actions/workflows/js-test-and-release.yml) -[![Dependency Status](https://david-dm.org/ipfs/js-datastore-pubsub.svg?style=flat-square)](https://david-dm.org/ipfs/js-datastore-pubsub) -[![standard-readme](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) -[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard) +[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io) +[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) +[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs) +[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-datastore-pubsub.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-datastore-pubsub) +[![CI](https://img.shields.io/github/workflow/status/ipfs/js-datastore-pubsub/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-datastore-pubsub/actions/workflows/js-test-and-release.yml) -> provides an implementation of an api for pubsub to be used as a datastore with TieredDatastore +> Responsible for providing an interface-datastore compliant api to pubsub -## Table of Contents +## Table of contents +- [Install](#install) - [Usage](#usage) - [API](#api) - - [Setup](#setup) + - - [Setup](#setup) - [Get](#get) - [Put](#put) - [Unsubscribe](#unsubscribe) - [Contribute](#contribute) - [License](#license) +- [Contribute](#contribute-1) -### Install +## Install -> npm install datastore-pubsub +```console +$ npm i datastore-pubsub +``` ## Usage @@ -111,4 +112,15 @@ This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/c ## License -Copyright (c) Protocol Labs, Inc. under the **MIT License**. See [LICENSE file](./LICENSE) for details. +Licensed under either of + +- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) +- MIT ([LICENSE-MIT](LICENSE-MIT) / ) + +## Contribute + +Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/js-ipfs-unixfs-importer/issues)! + +This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). + +[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md) diff --git a/package.json b/package.json index 6fe2c4d..b498793 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ ], "exports": { ".": { + "types": "./dist/src/index.d.ts", "import": "./src/index.js" } }, @@ -83,15 +84,15 @@ "release": "patch" }, { - "type": "chore", + "type": "docs", "release": "patch" }, { - "type": "docs", + "type": "test", "release": "patch" }, { - "type": "test", + "type": "deps", "release": "patch" }, { @@ -121,7 +122,11 @@ }, { "type": "docs", - "section": "Trivial Changes" + "section": "Documentation" + }, + { + "type": "deps", + "section": "Dependencies" }, { "type": "test", @@ -153,20 +158,20 @@ }, "dependencies": { "@libp2p/interface-dht": "^1.0.1", - "@libp2p/interface-pubsub": "^1.0.4", + "@libp2p/interface-pubsub": "^2.0.1", "@libp2p/interfaces": "^3.0.3", "@libp2p/logger": "^2.0.0", - "datastore-core": "^7.0.0", + "datastore-core": "^8.0.1", "debug": "^4.2.0", "err-code": "^3.0.1", - "interface-datastore": "^6.0.2", + "interface-datastore": "^7.0.0", "uint8arrays": "^3.0.0" }, "devDependencies": { "@libp2p/components": "^2.0.0", "@libp2p/floodsub": "^3.0.0", "@libp2p/interface-compliance-tests": "^3.0.2", - "@libp2p/interface-mocks": "^3.0.1", + "@libp2p/interface-mocks": "^4.0.2", "@libp2p/peer-id-factory": "^1.0.9", "@libp2p/record": "^2.0.0", "@types/detect-node": "^2.0.0", @@ -177,7 +182,7 @@ "it-pair": "^2.0.2", "libp2p": "next", "npm": "^8.10.0", - "p-wait-for": "^4.1.0", + "p-wait-for": "^5.0.0", "peer-id": "^0.16.0", "rimraf": "^3.0.2", "sinon": "^14.0.0", diff --git a/src/index.js b/src/index.js index 6fa40e6..5e41194 100644 --- a/src/index.js +++ b/src/index.js @@ -183,6 +183,12 @@ export class PubSubDatastore extends BaseDatastore { */ async _onMessage (evt) { const msg = evt.detail + + if (msg.type !== 'signed') { + log.error('unsigned message received, this module can only work with signed messages') + return + } + const { data, from, topic } = msg let key try {