Compare commits

..

No commits in common. "fe9045cf82a30aef89ebc74559485ebbe8cd18cc" and "bda0af49faedced803df88be85b12bfbfbb20d51" have entirely different histories.

5 changed files with 16 additions and 19 deletions

7
dist/index.d.ts vendored
View File

@ -1,14 +1,13 @@
import { Client } from "@lumeweb/libkernel-universal";
import { CatOptions, LsOptions, StatOptions } from "@helia/unixfs";
interface AbortableGenerator {
abort: () => void;
iterable: AsyncGenerator<object>;
}
export declare class IPFSClient extends Client {
ready(): Promise<any>;
stat(cid: string, options?: Partial<StatOptions>): Promise<any>;
ls(cid: string, options?: Partial<LsOptions>): AbortableGenerator;
cat(cid: string, options?: Partial<CatOptions>): AbortableGenerator;
stat(cid: string): Promise<any>;
ls(cid: string): AbortableGenerator;
cat(cid: string): AbortableGenerator;
ipns(cid: string): Promise<string>;
activePeers(): Promise<number>;
private connectModuleGenerator;

2
dist/index.d.ts.map vendored
View File

@ -1 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAW,MAAM,8BAA8B,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEnE,UAAU,kBAAkB;IAC1B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,QAAQ,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;CAClC;AAED,qBAAa,UAAW,SAAQ,MAAM;IACvB,KAAK;IAIL,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC;IAItD,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,kBAAkB;IAIjE,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,kBAAkB;IAI7D,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIlC,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAI3C,OAAO,CAAC,sBAAsB;CAgC/B;AAED,eAAO,MAAM,YAAY,8BAGxB,CAAC"}
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAW,MAAM,8BAA8B,CAAC;AAG/D,UAAU,kBAAkB;IAC1B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,QAAQ,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;CAClC;AAED,qBAAa,UAAW,SAAQ,MAAM;IACvB,KAAK;IAIL,IAAI,CAAC,GAAG,EAAE,MAAM;IAItB,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,kBAAkB;IAInC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,kBAAkB;IAI9B,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIlC,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAI3C,OAAO,CAAC,sBAAsB;CAgC/B;AAED,eAAO,MAAM,YAAY,8BAGxB,CAAC"}

12
dist/index.js vendored
View File

@ -4,14 +4,14 @@ export class IPFSClient extends Client {
async ready() {
return this.callModuleReturn("ready");
}
async stat(cid, options) {
return this.callModuleReturn("stat", { options });
async stat(cid) {
return this.callModuleReturn("stat");
}
ls(cid, options) {
return this.connectModuleGenerator("ls", { cid, options });
ls(cid) {
return this.connectModuleGenerator("ls", { cid });
}
cat(cid, options) {
return this.connectModuleGenerator("cat", { cid, options });
cat(cid) {
return this.connectModuleGenerator("cat", { cid });
}
async ipns(cid) {
return this.callModuleReturn("ipnsResolve");

View File

@ -10,7 +10,6 @@
"p-defer": "^4.0.0"
},
"devDependencies": {
"@helia/unixfs": "^1.2.1",
"@types/node": "^18.0.6",
"prettier": "^2.7.1",
"typescript": "^5.0.3"

View File

@ -1,6 +1,5 @@
import { Client, factory } from "@lumeweb/libkernel-universal";
import defer from "p-defer";
import { CatOptions, LsOptions, StatOptions } from "@helia/unixfs";
interface AbortableGenerator {
abort: () => void;
@ -12,16 +11,16 @@ export class IPFSClient extends Client {
return this.callModuleReturn("ready");
}
public async stat(cid: string, options?: Partial<StatOptions>) {
return this.callModuleReturn("stat", { options });
public async stat(cid: string) {
return this.callModuleReturn("stat");
}
public ls(cid: string, options?: Partial<LsOptions>): AbortableGenerator {
return this.connectModuleGenerator("ls", { cid, options });
public ls(cid: string): AbortableGenerator {
return this.connectModuleGenerator("ls", { cid });
}
public cat(cid: string, options?: Partial<CatOptions>): AbortableGenerator {
return this.connectModuleGenerator("cat", { cid, options });
public cat(cid: string): AbortableGenerator {
return this.connectModuleGenerator("cat", { cid });
}
public async ipns(cid: string): Promise<string> {