mirror of
https://github.com/status-im/js-waku.git
synced 2025-02-22 18:08:14 +00:00
Merge pull request #982 from waku-org/chore/store-clean-up
This commit is contained in:
commit
b7d86c3266
@ -23,7 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
- Support for Waku Store 2.0.0-beta4.
|
- Support for Waku Store 2.0.0-beta3.
|
||||||
|
|
||||||
## [0.29.0] - 2022-09-21
|
## [0.29.0] - 2022-09-21
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import type { Uint8ArrayList } from "uint8arraylist";
|
import type { Uint8ArrayList } from "uint8arraylist";
|
||||||
import { v4 as uuid } from "uuid";
|
import { v4 as uuid } from "uuid";
|
||||||
|
|
||||||
import * as protoV2Beta4 from "../../proto/store_v2beta4";
|
import * as proto from "../../proto/store";
|
||||||
|
|
||||||
const OneMillion = BigInt(1_000_000);
|
const OneMillion = BigInt(1_000_000);
|
||||||
|
|
||||||
@ -17,17 +17,17 @@ export interface Params {
|
|||||||
pageSize: number;
|
pageSize: number;
|
||||||
startTime?: Date;
|
startTime?: Date;
|
||||||
endTime?: Date;
|
endTime?: Date;
|
||||||
cursor?: protoV2Beta4.Index;
|
cursor?: proto.Index;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class HistoryRPC {
|
export class HistoryRPC {
|
||||||
private constructor(public readonly proto: protoV2Beta4.HistoryRPC) {}
|
private constructor(public readonly proto: proto.HistoryRPC) {}
|
||||||
|
|
||||||
get query(): protoV2Beta4.HistoryQuery | undefined {
|
get query(): proto.HistoryQuery | undefined {
|
||||||
return this.proto.query;
|
return this.proto.query;
|
||||||
}
|
}
|
||||||
|
|
||||||
get response(): protoV2Beta4.HistoryResponse | undefined {
|
get response(): proto.HistoryResponse | undefined {
|
||||||
return this.proto.response;
|
return this.proto.response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ export class HistoryRPC {
|
|||||||
pageSize: BigInt(params.pageSize),
|
pageSize: BigInt(params.pageSize),
|
||||||
cursor: params.cursor,
|
cursor: params.cursor,
|
||||||
direction,
|
direction,
|
||||||
} as protoV2Beta4.PagingInfo;
|
} as proto.PagingInfo;
|
||||||
|
|
||||||
let startTime, endTime;
|
let startTime, endTime;
|
||||||
if (params.startTime) {
|
if (params.startTime) {
|
||||||
@ -71,24 +71,24 @@ export class HistoryRPC {
|
|||||||
}
|
}
|
||||||
|
|
||||||
decode(bytes: Uint8ArrayList): HistoryRPC {
|
decode(bytes: Uint8ArrayList): HistoryRPC {
|
||||||
const res = protoV2Beta4.HistoryRPC.decode(bytes);
|
const res = proto.HistoryRPC.decode(bytes);
|
||||||
return new HistoryRPC(res);
|
return new HistoryRPC(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
encode(): Uint8Array {
|
encode(): Uint8Array {
|
||||||
return protoV2Beta4.HistoryRPC.encode(this.proto);
|
return proto.HistoryRPC.encode(this.proto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function directionToProto(
|
function directionToProto(
|
||||||
pageDirection: PageDirection
|
pageDirection: PageDirection
|
||||||
): protoV2Beta4.PagingInfo.Direction {
|
): proto.PagingInfo.Direction {
|
||||||
switch (pageDirection) {
|
switch (pageDirection) {
|
||||||
case PageDirection.BACKWARD:
|
case PageDirection.BACKWARD:
|
||||||
return protoV2Beta4.PagingInfo.Direction.DIRECTION_BACKWARD_UNSPECIFIED;
|
return proto.PagingInfo.Direction.DIRECTION_BACKWARD_UNSPECIFIED;
|
||||||
case PageDirection.FORWARD:
|
case PageDirection.FORWARD:
|
||||||
return protoV2Beta4.PagingInfo.Direction.DIRECTION_FORWARD;
|
return proto.PagingInfo.Direction.DIRECTION_FORWARD;
|
||||||
default:
|
default:
|
||||||
return protoV2Beta4.PagingInfo.Direction.DIRECTION_BACKWARD_UNSPECIFIED;
|
return proto.PagingInfo.Direction.DIRECTION_BACKWARD_UNSPECIFIED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,7 @@ import { pipe } from "it-pipe";
|
|||||||
import { Libp2p } from "libp2p";
|
import { Libp2p } from "libp2p";
|
||||||
import { Uint8ArrayList } from "uint8arraylist";
|
import { Uint8ArrayList } from "uint8arraylist";
|
||||||
|
|
||||||
import * as protoV2Beta4 from "../../proto/store_v2beta4";
|
import * as proto from "../../proto/store";
|
||||||
import { HistoryResponse } from "../../proto/store_v2beta4";
|
|
||||||
import { DefaultPubSubTopic } from "../constants";
|
import { DefaultPubSubTopic } from "../constants";
|
||||||
import { Decoder, Message } from "../interfaces";
|
import { Decoder, Message } from "../interfaces";
|
||||||
import { selectConnection } from "../select_connection";
|
import { selectConnection } from "../select_connection";
|
||||||
@ -18,7 +17,7 @@ import { toProtoMessage } from "../to_proto_message";
|
|||||||
|
|
||||||
import { HistoryRPC, PageDirection, Params } from "./history_rpc";
|
import { HistoryRPC, PageDirection, Params } from "./history_rpc";
|
||||||
|
|
||||||
import HistoryError = HistoryResponse.HistoryError;
|
import HistoryError = proto.HistoryResponse.HistoryError;
|
||||||
|
|
||||||
const log = debug("waku:store");
|
const log = debug("waku:store");
|
||||||
|
|
||||||
@ -316,7 +315,7 @@ async function* paginate<T extends Message>(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = reply.response as protoV2Beta4.HistoryResponse;
|
const response = reply.response as proto.HistoryResponse;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
response.error &&
|
response.error &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user