Skip to content

Commit

Permalink
chore: fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-pousette committed Dec 28, 2024
1 parent 43c3c9c commit 74c36c1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
27 changes: 15 additions & 12 deletions packages/clients/peerbit-proxy/window/e2e/browser/child/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const client = await createClient("*");

export const App = () => {
const mounted = useRef<boolean>(false);
const dbRef = useRef<SharedLog>();
const dbRef = useRef<SharedLog<any, any>>();
const [_, forceUpdate] = useReducer((x) => x + 1, 0);
useEffect(() => {
const queryParameters = new URLSearchParams(window.location.search);
Expand All @@ -18,19 +18,22 @@ export const App = () => {
}
mounted.current = true;
client
.open<SharedLog<Uint8Array>>(new SharedLog({ id: new Uint8Array(32) }), {
args: {
onChange: (change: Change<Uint8Array>) => {
forceUpdate();
setTimeout(() => {
dbRef.current?.log.load().then(() => {
forceUpdate();
console.log(client.messages.id, dbRef.current?.log.length);
});
}, 1000);
.open<SharedLog<Uint8Array, any>>(
new SharedLog({ id: new Uint8Array(32) }),
{
args: {
onChange: (change: Change<Uint8Array>) => {
forceUpdate();
setTimeout(() => {
dbRef.current?.log.load().then(() => {
forceUpdate();
console.log(client.messages.id, dbRef.current?.log.length);
});
}, 1000);
},
},
},
})
)
.then((x: any) => {
dbRef.current = x;
if (queryParameters.get("read") !== "true") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { SharedLog } from "@peerbit/shared-log";
@variant("test-log")
export class TestLog extends Program {
@field({ type: SharedLog })
log: SharedLog<Uint8Array>;
log: SharedLog<Uint8Array, any>;

constructor() {
super();
Expand Down
3 changes: 2 additions & 1 deletion packages/clients/peerbit-server/node/test/api.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ describe("server", () => {
let node: Peerbit;

afterEach(async () => {
// @ts-ignore
await node?.stop();
// @ts-ignore
server?.close();
});
it("bootstrap on start", async () => {
Expand All @@ -92,7 +94,6 @@ describe("server", () => {
describe("api", () => {
let session: TestSession, peer: ProgramClient, server: http.Server;
let db: PermissionedString;

before(async () => {});

beforeEach(async () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/programs/data/string/src/string-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export type CanPerform = (
export type Args = {
canRead?: CanRead;
canPerform?: CanPerform;
log?: SharedLogOptions<StringOperation, ReplicationDomainHash>;
log?: SharedLogOptions<StringOperation, ReplicationDomainHash<any>>;
};

export type TransactionContext = {
Expand All @@ -62,7 +62,7 @@ export type TransactionContext = {
@variant("dstring")
export class DString extends Program<Args, StringEvents & ProgramEvents> {
@field({ type: SharedLog })
_log: SharedLog<StringOperation>;
_log: SharedLog<StringOperation, any>;

@field({ type: RPC })
query: RPC<SearchRequest, AbstractSearchResult>;
Expand Down

0 comments on commit 74c36c1

Please sign in to comment.