refactor: move S5NodeConfig to types and make network optional
This commit is contained in:
parent
bbda50ddfb
commit
6e74ef6d8f
14
src/node.ts
14
src/node.ts
|
@ -1,6 +1,6 @@
|
||||||
import { Multihash } from "./multihash.js";
|
import { Multihash } from "./multihash.js";
|
||||||
import NodeId from "./nodeId.js";
|
import NodeId from "./nodeId.js";
|
||||||
import { Logger, S5Config, S5Services } from "./types.js";
|
import { Logger, S5Config, S5NodeConfig, S5Services } from "./types.js";
|
||||||
import Unpacker from "./serialization/unpack.js";
|
import Unpacker from "./serialization/unpack.js";
|
||||||
import Packer from "./serialization/pack.js";
|
import Packer from "./serialization/pack.js";
|
||||||
import StorageLocation from "./storage.js";
|
import StorageLocation from "./storage.js";
|
||||||
|
@ -26,18 +26,6 @@ const DEFAULT_LOGGER = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface S5NodeConfig {
|
|
||||||
p2p?: {
|
|
||||||
network: string;
|
|
||||||
peers?: {
|
|
||||||
initial?: string[];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
keyPair: KeyPairEd25519;
|
|
||||||
db: AbstractLevel<Uint8Array, string, Uint8Array>;
|
|
||||||
logger?: Logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class S5Node {
|
export class S5Node {
|
||||||
private _nodeConfig: S5NodeConfig;
|
private _nodeConfig: S5NodeConfig;
|
||||||
|
|
||||||
|
|
15
src/types.ts
15
src/types.ts
|
@ -51,7 +51,7 @@ export interface S5Services {
|
||||||
|
|
||||||
export interface S5Config {
|
export interface S5Config {
|
||||||
p2p?: {
|
p2p?: {
|
||||||
network: string;
|
network?: string;
|
||||||
peers?: {
|
peers?: {
|
||||||
initial?: string[];
|
initial?: string[];
|
||||||
};
|
};
|
||||||
|
@ -62,6 +62,19 @@ export interface S5Config {
|
||||||
cacheDb: AbstractLevel<Uint8Array, string, Uint8Array>;
|
cacheDb: AbstractLevel<Uint8Array, string, Uint8Array>;
|
||||||
services: S5Services;
|
services: S5Services;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface S5NodeConfig {
|
||||||
|
p2p?: {
|
||||||
|
network?: string;
|
||||||
|
peers?: {
|
||||||
|
initial?: string[];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
keyPair: KeyPairEd25519;
|
||||||
|
db: AbstractLevel<Uint8Array, string, Uint8Array>;
|
||||||
|
logger?: Logger;
|
||||||
|
}
|
||||||
|
|
||||||
export interface SignedMessage {
|
export interface SignedMessage {
|
||||||
nodeId: NodeId;
|
nodeId: NodeId;
|
||||||
message: Uint8Array;
|
message: Uint8Array;
|
||||||
|
|
Loading…
Reference in New Issue