decentralised sync engine
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor: nullable opts

serenity 0a968f67 c43f0a2f

+14 -16
+14 -16
src/lib/utils/prism.ts
··· 2 2 import { PRISM_URL } from "@/lib/env"; 3 3 import WebSocket from "ws"; 4 4 5 - export const connectToPrism = ({ 6 - wantedCollections, 7 - wantedDids, 8 - cursor, 9 - }: { 5 + export const connectToPrism = (opts?: { 10 6 wantedCollections?: Array<string>; 11 7 wantedDids?: Array<string>; 12 - cursor: number; 8 + cursor?: number; 13 9 }) => { 14 10 const endpoint = PRISM_URL; 15 - if (wantedCollections) 16 - wantedCollections.forEach((collection) => { 17 - endpoint.searchParams.append("wantedCollections", collection); 18 - }); 19 - if (wantedDids) 20 - wantedDids.forEach((did) => { 21 - endpoint.searchParams.append("wantedDids", did); 22 - }); 23 - if (cursor) endpoint.searchParams.append("cursor", cursor.toString()); 24 - 11 + if (opts) { 12 + const { wantedCollections, wantedDids, cursor } = opts; 13 + if (wantedCollections) 14 + wantedCollections.forEach((collection) => { 15 + endpoint.searchParams.append("wantedCollections", collection); 16 + }); 17 + if (wantedDids) 18 + wantedDids.forEach((did) => { 19 + endpoint.searchParams.append("wantedDids", did); 20 + }); 21 + if (cursor) endpoint.searchParams.append("cursor", cursor.toString()); 22 + } 25 23 return new WebSocket(endpoint); 26 24 };