refactor: have IPFSClient extend NetworkClient
This commit is contained in:
parent
ece86a88e6
commit
6fb3186352
|
@ -8,7 +8,7 @@
|
||||||
"name": "@lumeweb/kernel-ipfs-client",
|
"name": "@lumeweb/kernel-ipfs-client",
|
||||||
"version": "0.1.0-develop.6",
|
"version": "0.1.0-develop.6",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@lumeweb/libkernel": "^0.1.0-develop.20",
|
"@lumeweb/libkernel": "^0.1.0-develop.27",
|
||||||
"p-defer": "^4.0.0"
|
"p-defer": "^4.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -2037,12 +2037,13 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@lumeweb/libkernel": {
|
"node_modules/@lumeweb/libkernel": {
|
||||||
"version": "0.1.0-develop.20",
|
"version": "0.1.0-develop.27",
|
||||||
"resolved": "https://registry.npmjs.org/@lumeweb/libkernel/-/libkernel-0.1.0-develop.20.tgz",
|
"resolved": "https://registry.npmjs.org/@lumeweb/libkernel/-/libkernel-0.1.0-develop.27.tgz",
|
||||||
"integrity": "sha512-z7yRk6B0P0bxPe+a4Xm5/Bl6eIfkDCB2IJhNK2Gm+o7j4RbWbizRk79+zgBFWMrYzo8bVrpBKK7nGI3iNOgT9g==",
|
"integrity": "sha512-XkO16wzr2k1j9CrraVrL5vm5ysY+wJGwfJf9/PAknpLGko8j8Z/TbO5h/Q43iNjYjLlwBL2cGngX8orCZBWVDA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@lumeweb/libweb": "0.2.0-develop.26",
|
"@lumeweb/libweb": "0.2.0-develop.27",
|
||||||
"emittery": "^1.0.1"
|
"emittery": "^1.0.1",
|
||||||
|
"p-defer": "^4.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@lumeweb/libkernel/node_modules/emittery": {
|
"node_modules/@lumeweb/libkernel/node_modules/emittery": {
|
||||||
|
@ -2091,9 +2092,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@lumeweb/libweb": {
|
"node_modules/@lumeweb/libweb": {
|
||||||
"version": "0.2.0-develop.26",
|
"version": "0.2.0-develop.27",
|
||||||
"resolved": "https://registry.npmjs.org/@lumeweb/libweb/-/libweb-0.2.0-develop.26.tgz",
|
"resolved": "https://registry.npmjs.org/@lumeweb/libweb/-/libweb-0.2.0-develop.27.tgz",
|
||||||
"integrity": "sha512-XRIDiqRFqlEbcwjxAfkv7UYnyTflN3Q4rki8YAd9QrLQM2vycslgPLYS53vVJVL9GPH93V5J9z2V4DPQZlOOkQ==",
|
"integrity": "sha512-obS4a6mcHJNoWXy5fCDuGAIVMee0ivK8q/q0semqoS3v0PS7t7sUmRX5ajyCwGbACXYqEdq3vU7RwzxhUkuNGg==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@lumeweb/community-portals": "^0.1.0-develop.6",
|
"@lumeweb/community-portals": "^0.1.0-develop.6",
|
||||||
"@lumeweb/libportal": "^0.2.0-develop.16",
|
"@lumeweb/libportal": "^0.2.0-develop.16",
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
"semantic-release": "semantic-release"
|
"semantic-release": "semantic-release"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@lumeweb/libkernel": "^0.1.0-develop.20",
|
"@lumeweb/libkernel": "^0.1.0-develop.27",
|
||||||
"p-defer": "^4.0.0"
|
"p-defer": "^4.0.0"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
|
12
src/index.ts
12
src/index.ts
|
@ -1,4 +1,4 @@
|
||||||
import { Client, factory } from "@lumeweb/libkernel/module";
|
import { Client, factory, NetworkClient } from "@lumeweb/libkernel/module";
|
||||||
import defer from "p-defer";
|
import defer from "p-defer";
|
||||||
import { CatOptions, LsOptions, StatOptions } from "@helia/unixfs";
|
import { CatOptions, LsOptions, StatOptions } from "@helia/unixfs";
|
||||||
|
|
||||||
|
@ -10,11 +10,7 @@ interface AbortableGenerator {
|
||||||
export const MODULE =
|
export const MODULE =
|
||||||
"zduTMEiWaceB5Zew41fZnC4MbJybZNWY3fZDYUXQMxbpg1C671Bv3gjES3";
|
"zduTMEiWaceB5Zew41fZnC4MbJybZNWY3fZDYUXQMxbpg1C671Bv3gjES3";
|
||||||
|
|
||||||
export class IPFSClient extends Client {
|
export class IPFSClient extends NetworkClient {
|
||||||
public async ready() {
|
|
||||||
return this.callModuleReturn("ready");
|
|
||||||
}
|
|
||||||
|
|
||||||
public async stat(cid: string, options?: Partial<StatOptions>) {
|
public async stat(cid: string, options?: Partial<StatOptions>) {
|
||||||
return this.callModuleReturn("stat", { cid, options });
|
return this.callModuleReturn("stat", { cid, options });
|
||||||
}
|
}
|
||||||
|
@ -84,10 +80,6 @@ export class IPFSClient extends Client {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public async register() {
|
|
||||||
return this.callModuleReturn("register");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const createClient = factory<IPFSClient>(IPFSClient, MODULE);
|
export const createClient = factory<IPFSClient>(IPFSClient, MODULE);
|
||||||
|
|
Loading…
Reference in New Issue