Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: bump aegir from 37.12.1 to 38.1.6 #183

Merged
merged 2 commits into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 6 additions & 43 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,46 +1,9 @@
docs
**/node_modules/
**/*.log
test/repo-tests*
**/bundle.js

# Logs
logs
*.log

coverage

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

build

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

lib
build
dist
test/test-data/go-ipfs-repo/LOCK
test/test-data/go-ipfs-repo/LOG
test/test-data/go-ipfs-repo/LOG.old

# while testing npm5
.docs
.coverage
node_modules
package-lock.json

# IDE files
.idea/
yarn.lock
.vscode
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"release": "aegir run release"
},
"dependencies": {
"aegir": "^37.9.1"
"aegir": "^38.1.6"
},
"workspaces": [
"packages/*"
Expand Down
5 changes: 2 additions & 3 deletions packages/libp2p-daemon-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
},
"dependencies": {
"@libp2p/daemon-protocol": "^3.0.0",
"@libp2p/interface-connection": "^3.0.8",
"@libp2p/interface-peer-id": "^2.0.0",
"@libp2p/interface-peer-info": "^1.0.1",
"@libp2p/interface-transport": "^2.0.0",
Expand All @@ -149,13 +150,11 @@
},
"devDependencies": {
"@libp2p/daemon-server": "^4.0.0",
"@libp2p/interface-compliance-tests": "^3.0.1",
"@libp2p/interface-dht": "^2.0.0",
"@libp2p/interface-mocks": "^9.0.0",
"@libp2p/interface-peer-store": "^1.0.0",
"@libp2p/interface-pubsub": "^3.0.0",
"@libp2p/peer-id-factory": "^2.0.0",
"aegir": "^37.9.1",
"aegir": "^38.1.6",
"it-all": "^2.0.0",
"it-pipe": "^2.0.3",
"sinon": "^15.0.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/libp2p-daemon-client/src/dht.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export class DHT {
/**
* Announce to the network that the peer have data addressed by the provided CID
*/
async provide (cid: CID) {
async provide (cid: CID): Promise<void> {
if (cid == null || CID.asCID(cid) == null) {
throw new CodeError('invalid cid received', 'ERR_INVALID_CID')
}
Expand Down Expand Up @@ -290,7 +290,7 @@ export class DHT {
/**
* Query the DHT routing table for a given peer's public key.
*/
async getPublicKey (peerId: PeerId) {
async getPublicKey (peerId: PeerId): Promise<Uint8Array | undefined> {
if (!isPeerId(peerId)) {
throw new CodeError('invalid peer id received', 'ERR_INVALID_PEER_ID')
}
Expand Down
4 changes: 2 additions & 2 deletions packages/libp2p-daemon-client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Client implements DaemonClient {
* Sends the request to the daemon and returns a stream. This
* should only be used when sending daemon requests.
*/
async send (request: Request) {
async send (request: Request): Promise<StreamHandler> {
const maConn = await this.connectDaemon()

const streamHandler = new StreamHandler({ stream: maConn })
Expand All @@ -62,7 +62,7 @@ class Client implements DaemonClient {
/**
* Connect requests a connection to a known peer on a given set of addresses
*/
async connect (peerId: PeerId, addrs: Multiaddr[]) {
async connect (peerId: PeerId, addrs: Multiaddr[]): Promise<void> {
if (!isPeerId(peerId)) {
throw new CodeError('invalid peer id received', 'ERR_INVALID_PEER_ID')
}
Expand Down
4 changes: 2 additions & 2 deletions packages/libp2p-daemon-client/src/pubsub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class Pubsub {
/**
* Publish data under a topic
*/
async publish (topic: string, data: Uint8Array) {
async publish (topic: string, data: Uint8Array): Promise<void> {
if (typeof topic !== 'string') {
throw new CodeError('invalid topic received', 'ERR_INVALID_TOPIC')
}
Expand Down Expand Up @@ -87,7 +87,7 @@ export class Pubsub {
/**
* Request to subscribe a certain topic
*/
async * subscribe (topic: string) {
async * subscribe (topic: string): AsyncGenerator<PSMessage, void, undefined> {
if (typeof topic !== 'string') {
throw new CodeError('invalid topic received', 'ERR_INVALID_TOPIC')
}
Expand Down
2 changes: 1 addition & 1 deletion packages/libp2p-daemon-client/test/dht.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import all from 'it-all'

const defaultMultiaddr = multiaddr('/ip4/0.0.0.0/tcp/12345')

function match (cid: CID) {
function match (cid: CID): sinon.SinonMatcher {
return sinon.match((c: CID) => c.toString() === cid.toString(), 'cid')
}

Expand Down
2 changes: 1 addition & 1 deletion packages/libp2p-daemon-protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
"uint8arraylist": "^2.3.2"
},
"devDependencies": {
"aegir": "^37.9.1",
"aegir": "^38.1.6",
"protons": "^7.0.2"
}
}
2 changes: 1 addition & 1 deletion packages/libp2p-daemon-protocol/src/stream-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class StreamHandler {
await this.close()
}

write (msg: Uint8Array | Uint8ArrayList) {
write (msg: Uint8Array | Uint8ArrayList): void {
log('write message')
this.shake.write(
lp.encode.single(msg).subarray()
Expand Down
9 changes: 5 additions & 4 deletions packages/libp2p-daemon-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,14 @@
},
"dependencies": {
"@libp2p/daemon-protocol": "^3.0.0",
"@libp2p/interface-connection": "^3.0.1",
"@libp2p/interface-connection": "^3.0.8",
"@libp2p/interface-dht": "^2.0.0",
"@libp2p/interface-peer-id": "^2.0.0",
"@libp2p/interface-peer-store": "^1.2.8",
"@libp2p/interface-pubsub": "^3.0.6",
"@libp2p/interface-registrar": "^2.0.1",
"@libp2p/interface-transport": "^2.0.0",
"@libp2p/interfaces": "^3.0.2",
"@libp2p/interfaces": "^3.2.0",
"@libp2p/logger": "^2.0.0",
"@libp2p/peer-id": "^2.0.0",
"@libp2p/tcp": "^6.0.8",
Expand All @@ -157,8 +159,7 @@
"uint8arrays": "^4.0.2"
},
"devDependencies": {
"aegir": "^37.9.1",
"sinon": "^15.0.1",
"aegir": "^38.1.6",
"sinon-ts": "^1.0.0"
}
}
14 changes: 7 additions & 7 deletions packages/libp2p-daemon-server/src/dht.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class DHTOperations {
this.dht = dht
}

async * provide (cid: CID) {
async * provide (cid: CID): AsyncGenerator<Uint8Array, void, undefined> {
try {
await drain(this.dht.provide(cid))
yield OkResponse()
Expand All @@ -35,7 +35,7 @@ export class DHTOperations {
}
}

async * getClosestPeers (key: Uint8Array) {
async * getClosestPeers (key: Uint8Array): AsyncGenerator<Uint8Array, void, undefined> {
yield OkResponse({
dht: {
type: DHTResponse.Type.BEGIN
Expand All @@ -56,11 +56,11 @@ export class DHTOperations {
})
}

async * getPublicKey (peerId: PeerId) {
async * getPublicKey (peerId: PeerId): AsyncGenerator<Uint8Array, void, undefined> {
yield ErrorResponse(new Error('FIX ME: not implemented'))
}

async * getValue (key: Uint8Array) {
async * getValue (key: Uint8Array): AsyncGenerator<Uint8Array, void, undefined> {
try {
for await (const event of this.dht.get(key)) {
if (event.name === 'VALUE') {
Expand All @@ -78,7 +78,7 @@ export class DHTOperations {
}
}

async * putValue (key: Uint8Array, value: Uint8Array) {
async * putValue (key: Uint8Array, value: Uint8Array): AsyncGenerator<Uint8Array, void, undefined> {
try {
await drain(this.dht.put(key, value))

Expand All @@ -89,7 +89,7 @@ export class DHTOperations {
}
}

async * findPeer (peerId: PeerId) {
async * findPeer (peerId: PeerId): AsyncGenerator<Uint8Array, void, undefined> {
try {
for await (const event of this.dht.findPeer(peerId)) {
if (event.name === 'FINAL_PEER') {
Expand All @@ -112,7 +112,7 @@ export class DHTOperations {
}
}

async * findProviders (cid: CID, count: number) {
async * findProviders (cid: CID, count: number): AsyncGenerator<Uint8Array, void, undefined> {
yield OkResponse({
dht: {
type: DHTResponse.Type.BEGIN
Expand Down
16 changes: 8 additions & 8 deletions packages/libp2p-daemon-server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,14 @@ export class Server implements Libp2pServer {
/**
* Listens for process exit to handle cleanup
*/
_listen () {
_listen (): void {
// listen for graceful termination
process.on('SIGTERM', this._onExit)
process.on('SIGINT', this._onExit)
process.on('SIGHUP', this._onExit)
}

_onExit () {
_onExit (): void {
void this.stop({ exit: true }).catch(err => {
log.error(err)
})
Expand All @@ -216,7 +216,7 @@ export class Server implements Libp2pServer {
/**
* Starts the daemon
*/
async start () {
async start (): Promise<void> {
this._listen()
await this.libp2p.start()
await this.listener.listen(this.multiaddr)
Expand All @@ -235,7 +235,7 @@ export class Server implements Libp2pServer {
/**
* Stops the daemon
*/
async stop (options = { exit: false }) {
async stop (options = { exit: false }): Promise<void> {
await this.libp2p.stop()
await this.listener.close()
if (options.exit) {
Expand All @@ -246,7 +246,7 @@ export class Server implements Libp2pServer {
process.removeListener('SIGHUP', this._onExit)
}

async * handlePeerStoreRequest (request: PeerstoreRequest) {
async * handlePeerStoreRequest (request: PeerstoreRequest): AsyncGenerator<Uint8Array, void, undefined> {
try {
switch (request.type) {
case PeerstoreRequest.Type.GET_PROTOCOLS:
Expand All @@ -273,7 +273,7 @@ export class Server implements Libp2pServer {
/**
* Parses and responds to PSRequests
*/
async * handlePubsubRequest (request: PSRequest) {
async * handlePubsubRequest (request: PSRequest): AsyncGenerator<Uint8Array, void, undefined> {
try {
if (this.libp2p.pubsub == null || (this.pubsubOperations == null)) {
throw new Error('PubSub not configured')
Expand Down Expand Up @@ -309,7 +309,7 @@ export class Server implements Libp2pServer {
/**
* Parses and responds to DHTRequests
*/
async * handleDHTRequest (request: DHTRequest) {
async * handleDHTRequest (request: DHTRequest): AsyncGenerator<Uint8Array, void, undefined> {
try {
if (this.libp2p.dht == null || (this.dhtOperations == null)) {
throw new Error('DHT not configured')
Expand Down Expand Up @@ -377,7 +377,7 @@ export class Server implements Libp2pServer {
/**
* Handles requests for the given connection
*/
handleConnection (connection: Connection) {
handleConnection (connection: Connection): void {
const daemon = this // eslint-disable-line @typescript-eslint/no-this-alias
// @ts-expect-error connection may actually be a maconn?
const streamHandler = new StreamHandler({ stream: connection, maxLength: LIMIT })
Expand Down
8 changes: 4 additions & 4 deletions packages/libp2p-daemon-server/src/pubsub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class PubSubOperations {
this.pubsub = pubsub
}

async * getTopics () {
async * getTopics (): AsyncGenerator<Uint8Array, void, undefined> {
try {
yield OkResponse({
pubsub: {
Expand All @@ -38,12 +38,12 @@ export class PubSubOperations {
}
}

async * subscribe (topic: string) {
async * subscribe (topic: string): AsyncGenerator<Uint8Array, void, undefined> {
try {
const onMessage = pushable()
this.pubsub.subscribe(topic)

await this.pubsub.addEventListener('message', (evt) => {
this.pubsub.addEventListener('message', (evt) => {
const msg = evt.detail

if (msg.topic !== topic) {
Expand Down Expand Up @@ -75,7 +75,7 @@ export class PubSubOperations {
}
}

async * publish (topic: string, data: Uint8Array) {
async * publish (topic: string, data: Uint8Array): AsyncGenerator<Uint8Array, void, undefined> {
try {
await this.pubsub.publish(topic, data)
yield OkResponse()
Expand Down
6 changes: 3 additions & 3 deletions packages/libp2p-daemon-server/test/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('server', () => {
it('should start', async () => {
const libp2p = stubInterface<Libp2p>()

const server = await createServer(ma, libp2p)
const server = createServer(ma, libp2p)

await server.start()

Expand All @@ -24,7 +24,7 @@ describe('server', () => {
it('should stop', async () => {
const libp2p = stubInterface<Libp2p>()

const server = await createServer(ma, libp2p)
const server = createServer(ma, libp2p)

await server.start()
await server.stop()
Expand All @@ -35,7 +35,7 @@ describe('server', () => {
it('should return multiaddrs', async () => {
const libp2p = stubInterface<Libp2p>()

const server = await createServer(ma, libp2p)
const server = createServer(ma, libp2p)

expect(() => server.getMultiaddr()).to.throw(/Not started/)

Expand Down
2 changes: 1 addition & 1 deletion packages/libp2p-daemon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
"yargs-promise": "^1.1.0"
},
"devDependencies": {
"aegir": "^37.9.1",
"aegir": "^38.1.6",
"sinon": "^15.0.1"
}
}
Loading