-
Notifications
You must be signed in to change notification settings - Fork 9
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
feat(helia): helia-ipns #6
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Nishant Arora <[email protected]>
I cannot push a branch here (see #8) but here are the patches to fix the type problem: index 4c3194e..29f34f1 100644
--- a/package.json
+++ b/package.json
@@ -47,6 +47,7 @@
"dependencies": {
"@helia/ipns": "2.0.1",
"@helia/unixfs": "1.x",
+ "@libp2p/interface": "^0.1.3",
"express": "4.x",
"express-prom-bundle": "6.x",
"file-type": "18.x", index 3d2197a..7f52ae6 100644
--- a/src/heliaFetch.ts
+++ b/src/heliaFetch.ts
@@ -8,6 +8,8 @@ import { createHelia, type Helia } from 'helia'
import { LRUCache } from 'lru-cache'
import { CID } from 'multiformats/cid'
import pTryEach from 'p-try-each'
+import type { Libp2p } from '@libp2p/interface'
+import type { PubSub } from '@libp2p/interface/pubsub'
const ROOT_FILE_PATTERNS = [
'index.html',
@@ -22,7 +24,7 @@ export class HeliaFetch {
private fs!: UnixFS
private readonly log: debug.Debugger
private readonly rootFilePatterns: string[]
- public node!: Helia
+ public node!: Helia<Libp2p<{ pubsub: PubSub }>>
public ready: Promise<void>
private ipns!: ReturnType<typeof ipns>
private readonly ipnsResolutionCache = new LRUCache<string, string>({
@@ -35,7 +37,7 @@ export class HeliaFetch {
rootFilePatterns = ROOT_FILE_PATTERNS,
logger
}: {
- node?: Helia
+ node?: Helia<Libp2p<{ pubsub: PubSub }>>
rootFilePatterns?: string[]
logger?: debug.Debugger
} = {}) {
@@ -64,16 +66,7 @@ export class HeliaFetch {
})
this.ipns = ipns(this.node, [
dht(this.node),
- pubsub({
- datastore: this.node.datastore,
- libp2p: {
- peerId: this.node.libp2p.peerId,
- services: {
- // mismatch types
- pubsub: this.node.libp2p.services.pubsub
- }
- }
- })
+ pubsub(this.node)
])
this.fs = unixfs(this.node)
this.log('Helia Setup Complete!') The This is necessary because users can configure their own |
Signed-off-by: Nishant Arora <[email protected]>
@achingbrain that fixes the type issue but looks like it still doesn't work as expected 🤔 |
* main: (27 commits) feat(e2e): add /api/v0/repo/gc test chore: disable METRICS on CI e2e test runs test: add e2e test for /api/v0/version endpoint feat(server): ⚡️ Subdomain Gateway Using Fastify (#31) feat: use production level docker settings (#26) chore: remove unused playwright init code fix: use active LTS in package.json engines fix: playwright CI node-version=20 test: get clinic flame & doctor output from e2e tests test: e2e updates fix: use HOST constant in healthcheck fix: use HOST constant test: cleanup playwright test code test: add playwright tests feat: move HOST,PORT to src/constants.ts fix: ✏️ Fixing urls. (#23) fix: ✏️ helia-docker -> helia-http-gateway (#22) build(deps): Bump @babel/traverse and depcheck (#13) feat: add health-check (#21) fix(server): 🩹 Using sessionID as a fallback to requests where referer is missing. (#20) ... Signed-off-by: Nishant Arora <[email protected]>
…to feat/helia-ipns * refs/remotes/origin/feat/helia-ipns:
Signed-off-by: Nishant Arora <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In this PR:
helia-ipns