Compare commits

..

3 Commits

Author SHA1 Message Date
Derrick Hammer 4e460a182d
*Update dist 2023-01-07 23:40:24 -05:00
Derrick Hammer 65211fe144
*Ensure all imports are type imports 2023-01-07 23:40:08 -05:00
Derrick Hammer e6941a34e2
*add plugin util types 2023-01-07 23:39:42 -05:00
5 changed files with 25 additions and 7 deletions

8
dist/plugin.d.ts vendored
View File

@ -1,10 +1,11 @@
import type { EventEmitter2 } from "eventemitter2"; import type { EventEmitter2 } from "eventemitter2";
import { RPCMethod, RPCServer } from "./rpc.js"; import type { RPCMethod, RPCServer } from "./rpc.js";
import { Logger } from "pino"; import type { Logger } from "pino";
import SSLManager from "./ssl.js"; import type SSLManager from "./ssl.js";
import type { HDKey } from "micro-ed25519-hdkey"; import type { HDKey } from "micro-ed25519-hdkey";
import type Config from "@lumeweb/cfg"; import type Config from "@lumeweb/cfg";
import type { ProtocolManager } from "./swarm.js"; import type { ProtocolManager } from "./swarm.js";
import type { Util } from "./util.js";
export type PluginFunction = (api: PluginAPI) => Promise<void>; export type PluginFunction = (api: PluginAPI) => Promise<void>;
export interface Plugin { export interface Plugin {
name: string; name: string;
@ -24,6 +25,7 @@ export declare class PluginAPI extends EventEmitter2 {
server: RPCServer; server: RPCServer;
swarm: any; swarm: any;
}); });
get util(): Util;
get swarm(): any; get swarm(): any;
get config(): Config; get config(): Config;
get pluginConfig(): Config; get pluginConfig(): Config;

View File

@ -1 +1 @@
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,UAAU,MAAM,UAAU,CAAC;AAClC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,MAAM,MAAM,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AAO,CAAC,MAAM,CAAC;IACvE,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,IAAI;CAC5D"}

View File

@ -5,7 +5,9 @@
"type": "module", "type": "module",
"devDependencies": { "devDependencies": {
"@lumeweb/cfg": "https://git.lumeweb.com/LumeWeb/cfg.git", "@lumeweb/cfg": "https://git.lumeweb.com/LumeWeb/cfg.git",
"@types/b4a": "^1.6.0",
"@types/node": "^18.11.17", "@types/node": "^18.11.17",
"c": "^1.1.1",
"express": "^4.18.1", "express": "^4.18.1",
"node-cache": "^5.1.2", "node-cache": "^5.1.2",
"prettier": "^2.8.1", "prettier": "^2.8.1",

View File

@ -1,10 +1,11 @@
import type { EventEmitter2 } from "eventemitter2"; import type { EventEmitter2 } from "eventemitter2";
import { RPCMethod, RPCServer } from "./rpc.js"; import type { RPCMethod, RPCServer } from "./rpc.js";
import { Logger } from "pino"; import type { Logger } from "pino";
import SSLManager from "./ssl.js"; import type SSLManager from "./ssl.js";
import type { HDKey } from "micro-ed25519-hdkey"; import type { HDKey } from "micro-ed25519-hdkey";
import type Config from "@lumeweb/cfg"; import type Config from "@lumeweb/cfg";
import type { ProtocolManager } from "./swarm.js"; import type { ProtocolManager } from "./swarm.js";
import type { Util } from "./util.js";
export type PluginFunction = (api: PluginAPI) => Promise<void>; export type PluginFunction = (api: PluginAPI) => Promise<void>;
@ -27,6 +28,7 @@ export declare class PluginAPI extends EventEmitter2 {
server: RPCServer; server: RPCServer;
swarm: any; swarm: any;
}); });
get util(): Util;
get swarm(): any; get swarm(): any;
get config(): Config; get config(): Config;
get pluginConfig(): Config; get pluginConfig(): Config;

12
src/util.ts Normal file
View File

@ -0,0 +1,12 @@
import type b4a from "b4a";
import type c from "compact-encoding";
export declare class Util {
private _crypto;
get crypto(): Crypto;
get bufferEncoding(): typeof b4a;
get binaryEncoding(): typeof c;
}
export declare class Crypto {
createHash(data: string): Buffer;
}