Compare commits
16 Commits
master
...
v0.1.0-dev
Author | SHA1 | Date |
---|---|---|
semantic-release-bot | 6de017f59c | |
Derrick Hammer | 6c906a65ab | |
Derrick Hammer | ca1ff4c040 | |
semantic-release-bot | 8f8ff60a0b | |
Derrick Hammer | afe6c9c4b8 | |
Derrick Hammer | 7eccec5df9 | |
semantic-release-bot | 8f2ae2aadd | |
Derrick Hammer | 4e34b589d9 | |
Derrick Hammer | e9c9944003 | |
Derrick Hammer | 93a1e7e884 | |
Derrick Hammer | 20bc173aae | |
semantic-release-bot | 7255ee7b86 | |
Derrick Hammer | 440fddda34 | |
Derrick Hammer | be8591985a | |
Derrick Hammer | 7fc2375fa2 | |
Derrick Hammer | 2ee6531298 |
|
@ -0,0 +1,13 @@
|
||||||
|
name: Build/Publish
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- develop
|
||||||
|
- develop-*
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
main:
|
||||||
|
uses: lumeweb/github-node-deploy-workflow/.github/workflows/main.yml@master
|
||||||
|
secrets: inherit
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"preset": [
|
||||||
|
"@lumeweb/node-library-preset"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
# [0.1.0-develop.3](https://git.lumeweb.com/LumeWeb/kernel-ipfs-client/compare/v0.1.0-develop.2...v0.1.0-develop.3) (2023-07-19)
|
||||||
|
|
||||||
|
# [0.1.0-develop.2](https://git.lumeweb.com/LumeWeb/kernel-ipfs-client/compare/v0.1.0-develop.1...v0.1.0-develop.2) (2023-07-19)
|
||||||
|
|
||||||
|
# [0.1.0-develop.1](https://git.lumeweb.com/LumeWeb/kernel-ipfs-client/compare/v0.0.2-develop.1...v0.1.0-develop.1) (2023-07-19)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add register method for network registry ([e9c9944](https://git.lumeweb.com/LumeWeb/kernel-ipfs-client/commit/e9c994400325467fb2c146f4f5b3bea1a77d6502))
|
||||||
|
|
||||||
|
## [0.0.2-develop.1](https://git.lumeweb.com/LumeWeb/kernel-ipfs-client/compare/v0.0.1...v0.0.2-develop.1) (2023-07-14)
|
|
@ -1,2 +1,2 @@
|
||||||
# kernel-ipfs-http-client
|
# kernel-ipfs-client
|
||||||
IPFS client interface to @lumeweb/kernel-ipfs-http module
|
IPFS client interface to @lumeweb/kernel-ipfs module
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
import { Client } from "@lumeweb/libkernel-universal";
|
|
||||||
import { CatOptions, LsOptions, StatOptions } from "@helia/unixfs";
|
|
||||||
interface AbortableGenerator {
|
|
||||||
abort: () => void;
|
|
||||||
iterable: () => AsyncIterable<Uint8Array>;
|
|
||||||
}
|
|
||||||
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;
|
|
||||||
ipns(cid: string): Promise<string>;
|
|
||||||
activePeers(): Promise<number>;
|
|
||||||
private connectModuleGenerator;
|
|
||||||
}
|
|
||||||
export declare const createClient: (...args: any) => IPFSClient;
|
|
||||||
export {};
|
|
||||||
//# sourceMappingURL=index.d.ts.map
|
|
|
@ -1 +0,0 @@
|
||||||
{"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,MAAM,aAAa,CAAC,UAAU,CAAC,CAAC;CAC3C;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;CAiD/B;AAED,eAAO,MAAM,YAAY,8BAGxB,CAAC"}
|
|
|
@ -1,62 +0,0 @@
|
||||||
import { Client, factory } from "@lumeweb/libkernel-universal";
|
|
||||||
import defer from "p-defer";
|
|
||||||
export class IPFSClient extends Client {
|
|
||||||
async ready() {
|
|
||||||
return this.callModuleReturn("ready");
|
|
||||||
}
|
|
||||||
async stat(cid, options) {
|
|
||||||
return this.callModuleReturn("stat", { cid, options });
|
|
||||||
}
|
|
||||||
ls(cid, options) {
|
|
||||||
return this.connectModuleGenerator("ls", { cid, options });
|
|
||||||
}
|
|
||||||
cat(cid, options) {
|
|
||||||
return this.connectModuleGenerator("cat", { cid, options });
|
|
||||||
}
|
|
||||||
async ipns(cid) {
|
|
||||||
return this.callModuleReturn("ipnsResolve", { cid });
|
|
||||||
}
|
|
||||||
async activePeers() {
|
|
||||||
return this.callModuleReturn("getActivePeers");
|
|
||||||
}
|
|
||||||
connectModuleGenerator(method, data) {
|
|
||||||
let pipe = defer();
|
|
||||||
const [update, result] = this.connectModule(method, data, (item) => {
|
|
||||||
pipe.resolve(item);
|
|
||||||
});
|
|
||||||
(async () => {
|
|
||||||
const ret = await result;
|
|
||||||
this.handleError(ret);
|
|
||||||
pipe.resolve(undefined);
|
|
||||||
})();
|
|
||||||
return {
|
|
||||||
abort() {
|
|
||||||
update("abort");
|
|
||||||
},
|
|
||||||
iterable() {
|
|
||||||
return {
|
|
||||||
[Symbol.asyncIterator]() {
|
|
||||||
return {
|
|
||||||
async next() {
|
|
||||||
const chunk = await pipe.promise;
|
|
||||||
if (chunk === undefined) {
|
|
||||||
return {
|
|
||||||
value: new Uint8Array(),
|
|
||||||
done: true,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
pipe = defer();
|
|
||||||
update("next");
|
|
||||||
return {
|
|
||||||
value: chunk,
|
|
||||||
done: false,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export const createClient = factory(IPFSClient, "AAA0F0m8xP2YVcP0YZ-1QT8nLqYPZjgANotOQO3nGST1Bg");
|
|
File diff suppressed because it is too large
Load Diff
35
package.json
35
package.json
|
@ -1,18 +1,31 @@
|
||||||
{
|
{
|
||||||
"name": "@lumeweb/kernel-ipfs-client",
|
"name": "@lumeweb/kernel-ipfs-client",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0-develop.3",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/index.js",
|
"main": "lib/index.js",
|
||||||
"dependencies": {
|
"repository": {
|
||||||
"@lumeweb/libkernel-universal": "git+https://git.lumeweb.com/LumeWeb/libkernel-universal.git",
|
"type": "git",
|
||||||
"libkernel": "^0.1.43",
|
"url": "gitea@git.lumeweb.com:LumeWeb/kernel-ipfs-client.git"
|
||||||
"libkmodule": "^0.2.44",
|
|
||||||
"p-defer": "^4.0.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@helia/unixfs": "^1.2.1",
|
"@helia/unixfs": "^1.4.0",
|
||||||
"@types/node": "^18.0.6",
|
"@lumeweb/node-library-preset": "^0.2.7",
|
||||||
"prettier": "^2.7.1",
|
"presetter": "*"
|
||||||
"typescript": "^5.0.3"
|
},
|
||||||
|
"readme": "ERROR: No README data found!",
|
||||||
|
"scripts": {
|
||||||
|
"prepare": "presetter bootstrap",
|
||||||
|
"build": "run build",
|
||||||
|
"semantic-release": "semantic-release"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@lumeweb/libkernel": "^0.1.0-develop.20",
|
||||||
|
"p-defer": "^4.0.0"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"lib"
|
||||||
|
],
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
16
src/index.ts
16
src/index.ts
|
@ -1,4 +1,4 @@
|
||||||
import { Client, factory } from "@lumeweb/libkernel-universal";
|
import { Client, factory } 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";
|
||||||
|
|
||||||
|
@ -7,6 +7,9 @@ interface AbortableGenerator {
|
||||||
iterable: () => AsyncIterable<Uint8Array>;
|
iterable: () => AsyncIterable<Uint8Array>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const MODULE =
|
||||||
|
"zduK1zTsuL84p2AK1pPZy1RenyBFqVbbYqV9NEuEgv3f1J9d4kkng6wKxb";
|
||||||
|
|
||||||
export class IPFSClient extends Client {
|
export class IPFSClient extends Client {
|
||||||
public async ready() {
|
public async ready() {
|
||||||
return this.callModuleReturn("ready");
|
return this.callModuleReturn("ready");
|
||||||
|
@ -34,7 +37,7 @@ export class IPFSClient extends Client {
|
||||||
|
|
||||||
private connectModuleGenerator(
|
private connectModuleGenerator(
|
||||||
method: string,
|
method: string,
|
||||||
data: any
|
data: any,
|
||||||
): AbortableGenerator {
|
): AbortableGenerator {
|
||||||
let pipe = defer<Uint8Array>();
|
let pipe = defer<Uint8Array>();
|
||||||
|
|
||||||
|
@ -81,9 +84,10 @@ export class IPFSClient extends Client {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async register() {
|
||||||
|
return this.callModuleReturn("register");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const createClient = factory<IPFSClient>(
|
export const createClient = factory<IPFSClient>(IPFSClient, MODULE);
|
||||||
IPFSClient,
|
|
||||||
"AAA0F0m8xP2YVcP0YZ-1QT8nLqYPZjgANotOQO3nGST1Bg"
|
|
||||||
);
|
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"declaration": true,
|
|
||||||
"strict": true,
|
|
||||||
"module": "esnext",
|
|
||||||
"target": "esnext",
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"sourceMap": false,
|
|
||||||
"rootDir": "src",
|
|
||||||
"outDir": "dist",
|
|
||||||
"typeRoots": [
|
|
||||||
"node_modules/@types",
|
|
||||||
],
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"declarationMap": true,
|
|
||||||
"declarationDir": "dist",
|
|
||||||
"emitDeclarationOnly": false,
|
|
||||||
"allowJs": true
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"src"
|
|
||||||
]
|
|
||||||
}
|
|
Loading…
Reference in New Issue