simplify and rename ILightPush interface

This commit is contained in:
Sasha 2024-10-02 00:12:33 +02:00
parent 7580eeb110
commit 800eae20ff
No known key found for this signature in database
4 changed files with 10 additions and 11 deletions

View File

@ -1,5 +1,4 @@
import { IBaseProtocolCore, IBaseProtocolSDK } from "./protocols.js"; import { IBaseProtocolCore } from "./protocols.js";
import type { ISender } from "./sender.js"; import type { ISender } from "./sender.js";
export type ILightPushSDK = ISender & export type ILightPush = ISender & { protocol: IBaseProtocolCore };
IBaseProtocolSDK & { protocol: IBaseProtocolCore };

View File

@ -5,7 +5,7 @@ import { IConnectionManager } from "./connection_manager.js";
import type { IFilterSDK } from "./filter.js"; import type { IFilterSDK } from "./filter.js";
import { IHealthManager } from "./health_manager.js"; import { IHealthManager } from "./health_manager.js";
import type { Libp2p } from "./libp2p.js"; import type { Libp2p } from "./libp2p.js";
import type { ILightPushSDK } from "./light_push.js"; import type { ILightPush } from "./light_push.js";
import { Protocols } from "./protocols.js"; import { Protocols } from "./protocols.js";
import type { IRelay } from "./relay.js"; import type { IRelay } from "./relay.js";
import type { IStoreSDK } from "./store.js"; import type { IStoreSDK } from "./store.js";
@ -15,7 +15,7 @@ export interface Waku {
relay?: IRelay; relay?: IRelay;
store?: IStoreSDK; store?: IStoreSDK;
filter?: IFilterSDK; filter?: IFilterSDK;
lightPush?: ILightPushSDK; lightPush?: ILightPush;
connectionManager: IConnectionManager; connectionManager: IConnectionManager;
@ -36,7 +36,7 @@ export interface LightNode extends Waku {
relay: undefined; relay: undefined;
store: IStoreSDK; store: IStoreSDK;
filter: IFilterSDK; filter: IFilterSDK;
lightPush: ILightPushSDK; lightPush: ILightPush;
} }
export interface RelayNode extends Waku { export interface RelayNode extends Waku {

View File

@ -3,7 +3,7 @@ import { ConnectionManager, LightPushCore } from "@waku/core";
import { import {
Failure, Failure,
type IEncoder, type IEncoder,
ILightPushSDK, ILightPush,
type IMessage, type IMessage,
type Libp2p, type Libp2p,
type ProtocolCreateOptions, type ProtocolCreateOptions,
@ -19,7 +19,7 @@ import { BaseProtocolSDK } from "../base_protocol.js";
const log = new Logger("sdk:light-push"); const log = new Logger("sdk:light-push");
class LightPushSDK extends BaseProtocolSDK implements ILightPushSDK { class LightPushSDK extends BaseProtocolSDK implements ILightPush {
public readonly protocol: LightPushCore; public readonly protocol: LightPushCore;
private readonly reliabilityMonitor: SenderReliabilityMonitor; private readonly reliabilityMonitor: SenderReliabilityMonitor;
@ -131,6 +131,6 @@ class LightPushSDK extends BaseProtocolSDK implements ILightPushSDK {
export function wakuLightPush( export function wakuLightPush(
connectionManager: ConnectionManager, connectionManager: ConnectionManager,
init: Partial<ProtocolCreateOptions> = {} init: Partial<ProtocolCreateOptions> = {}
): (libp2p: Libp2p) => ILightPushSDK { ): (libp2p: Libp2p) => ILightPush {
return (libp2p: Libp2p) => new LightPushSDK(connectionManager, libp2p, init); return (libp2p: Libp2p) => new LightPushSDK(connectionManager, libp2p, init);
} }

View File

@ -5,7 +5,7 @@ import { ConnectionManager, getHealthManager } from "@waku/core";
import type { import type {
IFilterSDK, IFilterSDK,
IHealthManager, IHealthManager,
ILightPushSDK, ILightPush,
IRelay, IRelay,
IStoreSDK, IStoreSDK,
Libp2p, Libp2p,
@ -64,7 +64,7 @@ export class WakuNode implements Waku {
public relay?: IRelay; public relay?: IRelay;
public store?: IStoreSDK; public store?: IStoreSDK;
public filter?: IFilterSDK; public filter?: IFilterSDK;
public lightPush?: ILightPushSDK; public lightPush?: ILightPush;
public connectionManager: ConnectionManager; public connectionManager: ConnectionManager;
public readonly health: IHealthManager; public readonly health: IHealthManager;