*Update dist

This commit is contained in:
Derrick Hammer 2022-08-30 21:49:59 -04:00
parent 7efa878f15
commit 7916f6e4d6
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
3 changed files with 78 additions and 34 deletions

58
dist/index.d.ts vendored
View File

@ -1,7 +1,11 @@
/// <reference types="node" />
import { ErrTuple } from "libskynet";
import type { RPCRequest } from "@lumeweb/relay-types";
import { RpcQueryOptions, StreamHandlerFunction, StreamingRpcQueryOptions } from "@lumeweb/dht-rpc-client";
import {
RpcQueryOptions,
StreamHandlerFunction,
StreamingRpcQueryOptions,
} from "@lumeweb/dht-rpc-client";
import { Buffer } from "buffer";
export declare class RpcNetwork {
private _actionQueue;
@ -12,9 +16,28 @@ export declare class RpcNetwork {
removeRelay(pubkey: string): void;
clearRelays(): void;
private static deleteItem;
wisdomQuery(method: string, module: string, data?: object | any[], bypassCache?: boolean, options?: RpcQueryOptions): WisdomRpcQuery;
streamingQuery(relay: Buffer | string, method: string, module: string, streamHandler: StreamHandlerFunction, data?: object | any[], options?: RpcQueryOptions): StreamingRpcQuery;
simpleQuery(relay: Buffer | string, method: string, module: string, data?: object | any[], options?: RpcQueryOptions): SimpleRpcQuery;
wisdomQuery(
method: string,
module: string,
data?: object | any[],
bypassCache?: boolean,
options?: RpcQueryOptions
): WisdomRpcQuery;
streamingQuery(
relay: Buffer | string,
method: string,
module: string,
streamHandler: StreamHandlerFunction,
data?: object | any[],
options?: RpcQueryOptions
): StreamingRpcQuery;
simpleQuery(
relay: Buffer | string,
method: string,
module: string,
data?: object | any[],
options?: RpcQueryOptions
): SimpleRpcQuery;
processQueue(): Promise<void>;
}
export declare abstract class RpcQueryBase {
@ -23,19 +46,38 @@ export declare abstract class RpcQueryBase {
protected _query: RPCRequest;
protected _options: RpcQueryOptions;
protected _queryType: string;
constructor(network: RpcNetwork, query: RPCRequest, options: RpcQueryOptions | undefined, queryType: string);
constructor(
network: RpcNetwork,
query: RPCRequest,
options: RpcQueryOptions | undefined,
queryType: string
);
run(): this;
get result(): Promise<any>;
}
export declare class SimpleRpcQuery extends RpcQueryBase {
constructor(network: RpcNetwork, relay: string | Buffer, query: RPCRequest, options: RpcQueryOptions);
constructor(
network: RpcNetwork,
relay: string | Buffer,
query: RPCRequest,
options: RpcQueryOptions
);
}
export declare class StreamingRpcQuery extends RpcQueryBase {
protected _options: StreamingRpcQueryOptions;
constructor(network: RpcNetwork, relay: string | Buffer, query: RPCRequest, options: StreamingRpcQueryOptions);
constructor(
network: RpcNetwork,
relay: string | Buffer,
query: RPCRequest,
options: StreamingRpcQueryOptions
);
run(): this;
}
export declare class WisdomRpcQuery extends RpcQueryBase {
constructor(network: RpcNetwork, query: RPCRequest, options?: RpcQueryOptions);
constructor(
network: RpcNetwork,
query: RPCRequest,
options?: RpcQueryOptions
);
}
//# sourceMappingURL=index.d.ts.map

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,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,wBAAwB,EACzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAsBhC,qBAAa,UAAU;IACrB,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,YAAY,CAAgB;IAEpC,IAAI,KAAK,IAAI,OAAO,CAAC,QAAQ,CAAC,CAE7B;IAEM,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAM9B,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAMjC,WAAW,IAAI,IAAI;IAI1B,OAAO,CAAC,MAAM,CAAC,UAAU;IAQlB,WAAW,CAChB,MAAM,EAAE,MAAM,EACd,MAAM,EAA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() {
this._promise = this._network
.processQueue()
.then(() => callModule(RPC_MODULE, this._queryType, this._query));
this._promise = this._network.processQueue().then(() => callModule(RPC_MODULE, this._queryType, {
query: this._query,
options: this._options,
}));
return this;
}
get result() {
@ -114,9 +115,10 @@ export class StreamingRpcQuery extends RpcQueryBase {
this._options = options;
}
run() {
this._promise = this._network
.processQueue()
.then(() => connectModule(RPC_MODULE, this._queryType, this._query, this._options.streamHandler));
this._promise = this._network.processQueue().then(() => connectModule(RPC_MODULE, this._queryType, {
query: this._query,
options: this._options,
}, this._options.streamHandler));
return this;
}
}