From 646bed9b864105f1337097835be4118471fe7495 Mon Sep 17 00:00:00 2001 From: MSGhais Date: Thu, 8 Aug 2024 14:23:50 +0200 Subject: [PATCH 01/16] refacto --- apps/website/package.json | 7 +- apps/website/src/app/_app.tsx | 19 +++ apps/website/src/app/app/page.tsx | 109 ++++++++++++++++++ .../src/app/components/NavigationLinks.tsx | 3 + .../app/components/{ => landing}/About.tsx | 0 .../app/components/{ => landing}/AboutUs.tsx | 4 +- .../{ => landing}/ContributeSection.tsx | 0 .../{ => landing}/DescriptionSection.tsx | 0 .../{ => landing}/DownloadSection.tsx | 0 .../src/app/components/{ => landing}/Faq.tsx | 2 +- .../app/components/{ => landing}/Feature.tsx | 0 .../components/{ => landing}/HeroSection.tsx | 0 .../features/DescriptionFeatures.tsx | 0 apps/website/src/app/features/page.tsx | 2 +- apps/website/src/app/layout.tsx | 9 +- apps/website/src/app/page.tsx | 12 +- apps/website/src/app/providers.tsx | 14 +++ apps/website/tsconfig.json | 3 +- packages/afk_nostr_sdk/.eslintrc.cjs | 20 ++++ .../{nostr_sdk => afk_nostr_sdk}/.gitignore | 0 packages/afk_nostr_sdk/.prettierrc | 8 ++ .../context/NostrContext.tsx | 1 - .../context/TanstackProvider.tsx | 14 +++ .../hooks/channel/useChannels.ts | 40 +++++++ .../hooks/channel/useCreateChannel.ts | 35 ++++++ .../hooks/channel/useMessagesChannel.ts | 40 +++++++ .../hooks/channel/useSendMessage.ts | 20 ++++ .../hooks/index.ts | 3 + .../hooks/messages/useSendPrivateMessage.ts | 20 ++++ .../afk_nostr_sdk/hooks/search/useSearch.tsx | 45 ++++++++ .../hooks/search/useSearchUsers.tsx | 43 +++++++ .../hooks/useContacts.ts | 2 +- .../hooks/useEditContacts.ts | 5 +- .../hooks/useEditProfile.ts | 8 +- .../hooks/useNote.ts | 4 +- .../hooks/useProfile.ts | 5 +- .../hooks/useReact.ts | 2 +- .../hooks/useReactions.ts | 2 +- .../hooks/useReplyNotes.ts | 2 +- .../hooks/useReposts.ts | 2 +- .../hooks/useRootNotes.ts | 5 +- .../afk_nostr_sdk/hooks/useSearchNotes.ts | 39 +++++++ .../hooks/useSendNote.ts | 3 +- packages/afk_nostr_sdk/index.ts | 9 ++ .../{nostr_sdk => afk_nostr_sdk}/package.json | 4 +- .../store/auth.ts | 0 .../store/createBoundedUseStore.ts | 0 .../tsconfig.json | 0 packages/afk_nostr_sdk/utils/relay.ts | 20 ++++ packages/nostr_sdk/index.ts | 3 - packages/nostr_sdk/utils/relay.ts | 6 - 51 files changed, 550 insertions(+), 44 deletions(-) create mode 100644 apps/website/src/app/_app.tsx create mode 100644 apps/website/src/app/app/page.tsx rename apps/website/src/app/components/{ => landing}/About.tsx (100%) rename apps/website/src/app/components/{ => landing}/AboutUs.tsx (99%) rename apps/website/src/app/components/{ => landing}/ContributeSection.tsx (100%) rename apps/website/src/app/components/{ => landing}/DescriptionSection.tsx (100%) rename apps/website/src/app/components/{ => landing}/DownloadSection.tsx (100%) rename apps/website/src/app/components/{ => landing}/Faq.tsx (98%) rename apps/website/src/app/components/{ => landing}/Feature.tsx (100%) rename apps/website/src/app/components/{ => landing}/HeroSection.tsx (100%) rename apps/website/src/app/components/{ => landing}/features/DescriptionFeatures.tsx (100%) create mode 100644 apps/website/src/app/providers.tsx create mode 100644 packages/afk_nostr_sdk/.eslintrc.cjs rename packages/{nostr_sdk => afk_nostr_sdk}/.gitignore (100%) create mode 100644 packages/afk_nostr_sdk/.prettierrc rename packages/{nostr_sdk => afk_nostr_sdk}/context/NostrContext.tsx (99%) create mode 100644 packages/afk_nostr_sdk/context/TanstackProvider.tsx create mode 100644 packages/afk_nostr_sdk/hooks/channel/useChannels.ts create mode 100644 packages/afk_nostr_sdk/hooks/channel/useCreateChannel.ts create mode 100644 packages/afk_nostr_sdk/hooks/channel/useMessagesChannel.ts create mode 100644 packages/afk_nostr_sdk/hooks/channel/useSendMessage.ts rename packages/{nostr_sdk => afk_nostr_sdk}/hooks/index.ts (75%) create mode 100644 packages/afk_nostr_sdk/hooks/messages/useSendPrivateMessage.ts create mode 100644 packages/afk_nostr_sdk/hooks/search/useSearch.tsx create mode 100644 packages/afk_nostr_sdk/hooks/search/useSearchUsers.tsx rename packages/{nostr_sdk => afk_nostr_sdk}/hooks/useContacts.ts (91%) rename packages/{nostr_sdk => afk_nostr_sdk}/hooks/useEditContacts.ts (91%) rename packages/{nostr_sdk => afk_nostr_sdk}/hooks/useEditProfile.ts (73%) rename packages/{nostr_sdk => afk_nostr_sdk}/hooks/useNote.ts (75%) rename packages/{nostr_sdk => afk_nostr_sdk}/hooks/useProfile.ts (73%) rename packages/{nostr_sdk => afk_nostr_sdk}/hooks/useReact.ts (91%) rename packages/{nostr_sdk => afk_nostr_sdk}/hooks/useReactions.ts (92%) rename packages/{nostr_sdk => afk_nostr_sdk}/hooks/useReplyNotes.ts (95%) rename packages/{nostr_sdk => afk_nostr_sdk}/hooks/useReposts.ts (94%) rename packages/{nostr_sdk => afk_nostr_sdk}/hooks/useRootNotes.ts (90%) create mode 100644 packages/afk_nostr_sdk/hooks/useSearchNotes.ts rename packages/{nostr_sdk => afk_nostr_sdk}/hooks/useSendNote.ts (80%) create mode 100644 packages/afk_nostr_sdk/index.ts rename packages/{nostr_sdk => afk_nostr_sdk}/package.json (95%) rename packages/{nostr_sdk => afk_nostr_sdk}/store/auth.ts (100%) rename packages/{nostr_sdk => afk_nostr_sdk}/store/createBoundedUseStore.ts (100%) rename packages/{nostr_sdk => afk_nostr_sdk}/tsconfig.json (100%) create mode 100644 packages/afk_nostr_sdk/utils/relay.ts delete mode 100644 packages/nostr_sdk/index.ts delete mode 100644 packages/nostr_sdk/utils/relay.ts diff --git a/apps/website/package.json b/apps/website/package.json index a7da4fe8..8c448431 100644 --- a/apps/website/package.json +++ b/apps/website/package.json @@ -19,10 +19,11 @@ "next": "^14.2.3", "nostr-tools": "^2.7.0", "qs": "^6.12.3", - "react": "^18.3.1", - "react-dom": "^18.3.1", "starknet": "6.9.0", - "zod": "^3.23.8" + "zod": "^3.23.8", + "afk_nostr_sdk":"workspace:*", + "@nostr-dev-kit/ndk": "^2.8.2" + }, "devDependencies": { "@types/node": "^20", diff --git a/apps/website/src/app/_app.tsx b/apps/website/src/app/_app.tsx new file mode 100644 index 00000000..d46453d3 --- /dev/null +++ b/apps/website/src/app/_app.tsx @@ -0,0 +1,19 @@ +import './index.css'; +import type { Metadata } from 'next'; +import Providers from './providers'; + +export const metadata: Metadata = { + title: 'afk community portal', + description: 'afk community portal', +}; +import { AppProps } from 'next/app'; + +function MyApp({ Component, pageProps }: AppProps) { + return ( + + + + ); +} + +export default MyApp; \ No newline at end of file diff --git a/apps/website/src/app/app/page.tsx b/apps/website/src/app/app/page.tsx new file mode 100644 index 00000000..57fa8794 --- /dev/null +++ b/apps/website/src/app/app/page.tsx @@ -0,0 +1,109 @@ +"use client"; + +import { ContributeSection } from '../components/landing/ContributeSection'; +import { Footer } from '../components/Footer'; +import { Navbar } from '../components/Navbar'; +import { useRootNotes } from 'afk_nostr_sdk/hooks/useRootNotes'; +// import { NDKEvent } from 'afk_nostr_sdk'; + +import Providers from '../providers'; +import NDK, { NDKEvent, NDKFilter, NDKKind } from '@nostr-dev-kit/ndk'; +import { AFK_RELAYS } from 'afk_nostr_sdk/utils/relay'; +import { useEffect } from 'react'; +import { useNostrContext } from 'afk_nostr_sdk/context/NostrContext'; +import { useSearch, useSearchNotes } from 'afk_nostr_sdk/hooks'; +import { useState } from 'react'; + +export default function AppHomepage() { + + const nostr = useNostrContext() + + const [events, setEvents] = useState([]) + const [isInitDone, setIsInitDone] = useState(false) + + useEffect(() => { + + if (!isInitDone) { + fetch() + setIsInitDone(true) + } + + }) + const fetch = async () => { + const filter: NDKFilter = { + kinds: [NDKKind.Text, NDKKind.ChannelMetadata, NDKKind.Metadata], + + }; + let events_package = await nostr?.ndk?.fetchEvents(filter) + // console.log("events_package", events_package) + setEvents([ + ...events_package, + ...eventsSearch?.data?.pages + ]) + } + + const eventsSearch = useSearchNotes({ + kinds: [ + NDKKind.Text, + // NDKKind.ChannelMetadata + ] + + }); + // const events = useRootNotes(); + console.log("events hooks", eventsSearch?.data?.pages) + return ( + // +
+ + + + + + +
+ {events?.length > 0 && events.map((e: NDKEvent, i) => { + // console.log("e", e) + return ( + + ) + })} +
+ +
+ {eventsSearch?.data?.pages?.map((e: NDKEvent) => { + console.log("e", e) + return ( + + ) + })} +
+ + + + +
+
+ //
+ + ); +} diff --git a/apps/website/src/app/components/NavigationLinks.tsx b/apps/website/src/app/components/NavigationLinks.tsx index f588ae97..5751c19f 100644 --- a/apps/website/src/app/components/NavigationLinks.tsx +++ b/apps/website/src/app/components/NavigationLinks.tsx @@ -7,6 +7,9 @@ export function NavigationLinks() {
  • Features
  • + {/*
  • + App +
  • */} {/*
  • Ecosystem
  • */} {/*
  • Developers
  • */} diff --git a/apps/website/src/app/components/About.tsx b/apps/website/src/app/components/landing/About.tsx similarity index 100% rename from apps/website/src/app/components/About.tsx rename to apps/website/src/app/components/landing/About.tsx diff --git a/apps/website/src/app/components/AboutUs.tsx b/apps/website/src/app/components/landing/AboutUs.tsx similarity index 99% rename from apps/website/src/app/components/AboutUs.tsx rename to apps/website/src/app/components/landing/AboutUs.tsx index cfae9327..d75c22db 100644 --- a/apps/website/src/app/components/AboutUs.tsx +++ b/apps/website/src/app/components/landing/AboutUs.tsx @@ -1,7 +1,7 @@ import {motion} from 'framer-motion'; -import {Footer} from './Footer'; -import {Navbar} from './Navbar'; +import {Footer} from '../Footer'; +import {Navbar} from '../Navbar'; const AboutUs: React.FC = () => { return ( diff --git a/apps/website/src/app/components/ContributeSection.tsx b/apps/website/src/app/components/landing/ContributeSection.tsx similarity index 100% rename from apps/website/src/app/components/ContributeSection.tsx rename to apps/website/src/app/components/landing/ContributeSection.tsx diff --git a/apps/website/src/app/components/DescriptionSection.tsx b/apps/website/src/app/components/landing/DescriptionSection.tsx similarity index 100% rename from apps/website/src/app/components/DescriptionSection.tsx rename to apps/website/src/app/components/landing/DescriptionSection.tsx diff --git a/apps/website/src/app/components/DownloadSection.tsx b/apps/website/src/app/components/landing/DownloadSection.tsx similarity index 100% rename from apps/website/src/app/components/DownloadSection.tsx rename to apps/website/src/app/components/landing/DownloadSection.tsx diff --git a/apps/website/src/app/components/Faq.tsx b/apps/website/src/app/components/landing/Faq.tsx similarity index 98% rename from apps/website/src/app/components/Faq.tsx rename to apps/website/src/app/components/landing/Faq.tsx index 3f3d69cb..4239c37c 100644 --- a/apps/website/src/app/components/Faq.tsx +++ b/apps/website/src/app/components/landing/Faq.tsx @@ -1,6 +1,6 @@ 'use client'; -import {FaqBar} from './FaqBar'; +import {FaqBar} from '../FaqBar'; export function Faq() { return ( diff --git a/apps/website/src/app/components/Feature.tsx b/apps/website/src/app/components/landing/Feature.tsx similarity index 100% rename from apps/website/src/app/components/Feature.tsx rename to apps/website/src/app/components/landing/Feature.tsx diff --git a/apps/website/src/app/components/HeroSection.tsx b/apps/website/src/app/components/landing/HeroSection.tsx similarity index 100% rename from apps/website/src/app/components/HeroSection.tsx rename to apps/website/src/app/components/landing/HeroSection.tsx diff --git a/apps/website/src/app/components/features/DescriptionFeatures.tsx b/apps/website/src/app/components/landing/features/DescriptionFeatures.tsx similarity index 100% rename from apps/website/src/app/components/features/DescriptionFeatures.tsx rename to apps/website/src/app/components/landing/features/DescriptionFeatures.tsx diff --git a/apps/website/src/app/features/page.tsx b/apps/website/src/app/features/page.tsx index f65ebe96..9184f417 100644 --- a/apps/website/src/app/features/page.tsx +++ b/apps/website/src/app/features/page.tsx @@ -1,4 +1,4 @@ -import {ContributeSection} from '../components/ContributeSection'; +import {ContributeSection} from '../components/landing/ContributeSection'; import {DescriptionFeatures} from '../components/features/DescriptionFeatures'; import {Footer} from '../components/Footer'; import {Navbar} from '../components/Navbar'; diff --git a/apps/website/src/app/layout.tsx b/apps/website/src/app/layout.tsx index fbb1f951..00577340 100644 --- a/apps/website/src/app/layout.tsx +++ b/apps/website/src/app/layout.tsx @@ -1,16 +1,19 @@ import './index.css'; -import type {Metadata} from 'next'; +import type { Metadata } from 'next'; +import Providers from './providers'; export const metadata: Metadata = { title: 'afk community portal', description: 'afk community portal', }; -export default function RootLayout({children}: {children: React.ReactNode}) { +export default function RootLayout({ children }: { children: React.ReactNode }) { return ( - {children} + + {children} + ); } diff --git a/apps/website/src/app/page.tsx b/apps/website/src/app/page.tsx index cd672681..42094203 100644 --- a/apps/website/src/app/page.tsx +++ b/apps/website/src/app/page.tsx @@ -1,10 +1,10 @@ -import {About} from './components/About'; -import {ContributeSection} from './components/ContributeSection'; -import {DescriptionSection} from './components/DescriptionSection'; -import {DownloadSection} from './components/DownloadSection'; -import {Faq} from './components/Faq'; +import {About} from './components/landing/About'; +import {ContributeSection} from './components/landing/ContributeSection'; +import {DescriptionSection} from './components/landing/DescriptionSection'; +import {DownloadSection} from './components/landing/DownloadSection'; +import {Faq} from './components/landing/Faq'; import {Footer} from './components/Footer'; -import {HeroSection} from './components/HeroSection'; +import {HeroSection} from './components/landing/HeroSection'; import {Navbar} from './components/Navbar'; export default function App() { diff --git a/apps/website/src/app/providers.tsx b/apps/website/src/app/providers.tsx new file mode 100644 index 00000000..020bb711 --- /dev/null +++ b/apps/website/src/app/providers.tsx @@ -0,0 +1,14 @@ +"use client"; + +import { NostrProvider } from 'afk_nostr_sdk/context/NostrContext'; +import { TanstackProvider } from 'afk_nostr_sdk/context/TanstackProvider'; + +export default function Providers({ children }: { children: React.ReactNode }) { + return ( + + + {children} + + + ); +} diff --git a/apps/website/tsconfig.json b/apps/website/tsconfig.json index 24370694..067909ee 100644 --- a/apps/website/tsconfig.json +++ b/apps/website/tsconfig.json @@ -1,10 +1,12 @@ { "compilerOptions": { + "target": "ESNext", "lib": [ "dom", "dom.iterable", "esnext" ], + "module": "ES6", "allowJs": true, "skipLibCheck": true, "strict": true, @@ -12,7 +14,6 @@ "forceConsistentCasingInFileNames": true, "noFallthroughCasesInSwitch": true, "esModuleInterop": true, - "module": "esnext", "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, diff --git a/packages/afk_nostr_sdk/.eslintrc.cjs b/packages/afk_nostr_sdk/.eslintrc.cjs new file mode 100644 index 00000000..04253717 --- /dev/null +++ b/packages/afk_nostr_sdk/.eslintrc.cjs @@ -0,0 +1,20 @@ +require('@uniswap/eslint-config/load'); + +module.exports = { + extends: ['next/core-web-vitals', '@uniswap/eslint-config/node'], + overrides: [ + { + files: ['*.ts', '*.tsx', '*.js', '*.jsx'], + rules: { + 'import/no-unused-modules': 'off', + + 'prettier/prettier': [ + 'error', + { + endOfLine: 'auto', + }, + ], + }, + }, + ], +}; diff --git a/packages/nostr_sdk/.gitignore b/packages/afk_nostr_sdk/.gitignore similarity index 100% rename from packages/nostr_sdk/.gitignore rename to packages/afk_nostr_sdk/.gitignore diff --git a/packages/afk_nostr_sdk/.prettierrc b/packages/afk_nostr_sdk/.prettierrc new file mode 100644 index 00000000..dfa3383a --- /dev/null +++ b/packages/afk_nostr_sdk/.prettierrc @@ -0,0 +1,8 @@ +{ + "bracketSpacing": false, + "singleQuote": true, + "trailingComma": "all", + "printWidth": 100, + "semi": true, + "endOfLine": "lf" +} diff --git a/packages/nostr_sdk/context/NostrContext.tsx b/packages/afk_nostr_sdk/context/NostrContext.tsx similarity index 99% rename from packages/nostr_sdk/context/NostrContext.tsx rename to packages/afk_nostr_sdk/context/NostrContext.tsx index e9362281..74508428 100644 --- a/packages/nostr_sdk/context/NostrContext.tsx +++ b/packages/afk_nostr_sdk/context/NostrContext.tsx @@ -1,6 +1,5 @@ import NDK, {NDKPrivateKeySigner} from '@nostr-dev-kit/ndk'; import {createContext, useContext, useEffect, useState} from 'react'; - import { useAuth } from '../store/auth'; import {AFK_RELAYS} from "../utils/relay" export type NostrContextType = { diff --git a/packages/afk_nostr_sdk/context/TanstackProvider.tsx b/packages/afk_nostr_sdk/context/TanstackProvider.tsx new file mode 100644 index 00000000..8b2b446b --- /dev/null +++ b/packages/afk_nostr_sdk/context/TanstackProvider.tsx @@ -0,0 +1,14 @@ +import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; +import { PropsWithChildren } from "react"; + +const queryClient = new QueryClient({ + defaultOptions: { queries: { retry: 2 } }, +}); + +export const TanstackProvider: React.FC = ({ children }) => { + return ( + + {children} + + ) +} diff --git a/packages/afk_nostr_sdk/hooks/channel/useChannels.ts b/packages/afk_nostr_sdk/hooks/channel/useChannels.ts new file mode 100644 index 00000000..56042cd4 --- /dev/null +++ b/packages/afk_nostr_sdk/hooks/channel/useChannels.ts @@ -0,0 +1,40 @@ +import {NDKKind} from '@nostr-dev-kit/ndk'; +import {useInfiniteQuery} from '@tanstack/react-query'; + +import {useNostrContext} from '../../context/NostrContext'; + +export type UseRootNotesOptions = { + authors?: string[]; + search?: string; +}; + +export const useChannels = (options?: UseRootNotesOptions) => { + const {ndk} = useNostrContext(); + + return useInfiniteQuery({ + initialPageParam: 0, + queryKey: ['channels', options?.authors, options?.search, ndk], + getNextPageParam: (lastPage: any, allPages, lastPageParam) => { + if (!lastPage?.length) return undefined; + + const pageParam = lastPage[lastPage.length - 1].created_at - 1; + + if (!pageParam || pageParam === lastPageParam) return undefined; + return pageParam; + }, + queryFn: async ({pageParam}) => { + const notes = await ndk.fetchEvents({ + kinds: [NDKKind.ChannelCreation], + authors: options?.authors, + search: options?.search, + until: pageParam || Math.round(Date.now() / 1000), + limit: 20, + }); + + console.log('notes', notes); + + return [...notes].filter((note) => note.tags.every((tag) => tag[0] !== 'e')); + }, + placeholderData: {pages: [], pageParams: []}, + }); +}; diff --git a/packages/afk_nostr_sdk/hooks/channel/useCreateChannel.ts b/packages/afk_nostr_sdk/hooks/channel/useCreateChannel.ts new file mode 100644 index 00000000..33927e3a --- /dev/null +++ b/packages/afk_nostr_sdk/hooks/channel/useCreateChannel.ts @@ -0,0 +1,35 @@ +import {NDKEvent, NDKKind} from '@nostr-dev-kit/ndk'; +import {useMutation} from '@tanstack/react-query'; + +import {useAuth} from '../../store/auth'; + +import {useNostrContext} from '../../context/NostrContext'; + +export const useCreateChannel = () => { + const {ndk} = useNostrContext(); + const {publicKey} = useAuth(); + + return useMutation({ + mutationKey: ['createChannel', ndk], + mutationFn: async (data: {content: string; channel_name: string; tags?: string[][]}) => { + try { + const user = ndk.getUser({pubkey: publicKey}); + + // if (!user.profile) { + // throw new Error('Profile not found'); + // } + const event = new NDKEvent(ndk); + event.kind = NDKKind.ChannelCreation; + event.content = data.content; + event.author = user; + event.tags = data.tags ?? []; + await event.publish(); + + return event; + } catch (error) { + console.error('Error create channel', error); + throw error; + } + }, + }); +}; diff --git a/packages/afk_nostr_sdk/hooks/channel/useMessagesChannel.ts b/packages/afk_nostr_sdk/hooks/channel/useMessagesChannel.ts new file mode 100644 index 00000000..46906f0c --- /dev/null +++ b/packages/afk_nostr_sdk/hooks/channel/useMessagesChannel.ts @@ -0,0 +1,40 @@ +import {NDKKind} from '@nostr-dev-kit/ndk'; +import {useInfiniteQuery} from '@tanstack/react-query'; +import {useNostrContext} from '../../context/NostrContext'; + +export type UseReplyNotesOptions = { + noteId?: string; + channelId?: string; + authors?: string[]; + search?: string; +}; + +export const useMessagesChannels = (options?: UseReplyNotesOptions) => { + const {ndk} = useNostrContext(); + + return useInfiniteQuery({ + initialPageParam: 0, + queryKey: ['messagesChannels', options?.noteId, options?.authors, options?.search, ndk], + getNextPageParam: (lastPage: any, allPages, lastPageParam) => { + if (!lastPage?.length) return undefined; + + const pageParam = lastPage[lastPage.length - 1].created_at - 1; + + if (!pageParam || pageParam === lastPageParam) return undefined; + return pageParam; + }, + queryFn: async ({pageParam}) => { + const notes = await ndk.fetchEvents({ + kinds: [NDKKind.ChannelMessage], + authors: options?.authors, + search: options?.search, + until: pageParam || Math.round(Date.now() / 1000), + limit: 20, + '#e': options?.noteId ? [options.noteId] : undefined, + }); + + return [...notes].filter((note) => note.tags.every((tag) => tag[0] === 'e')); + }, + placeholderData: {pages: [], pageParams: []}, + }); +}; diff --git a/packages/afk_nostr_sdk/hooks/channel/useSendMessage.ts b/packages/afk_nostr_sdk/hooks/channel/useSendMessage.ts new file mode 100644 index 00000000..cc8ef8d7 --- /dev/null +++ b/packages/afk_nostr_sdk/hooks/channel/useSendMessage.ts @@ -0,0 +1,20 @@ +import {NDKEvent, NDKKind} from '@nostr-dev-kit/ndk'; +import {useMutation} from '@tanstack/react-query'; + +import {useNostrContext} from '../../context/NostrContext'; + +export const useSendMessageChannel = () => { + const {ndk} = useNostrContext(); + + return useMutation({ + mutationKey: ['sendNoteChannel', ndk], + mutationFn: async (data: {content: string; tags?: string[][]}) => { + const event = new NDKEvent(ndk); + event.kind = NDKKind.ChannelMessage; + event.content = data.content; + event.tags = data.tags ?? []; + + return event.publish(); + }, + }); +}; diff --git a/packages/nostr_sdk/hooks/index.ts b/packages/afk_nostr_sdk/hooks/index.ts similarity index 75% rename from packages/nostr_sdk/hooks/index.ts rename to packages/afk_nostr_sdk/hooks/index.ts index 49e6d3eb..d66288e2 100644 --- a/packages/nostr_sdk/hooks/index.ts +++ b/packages/afk_nostr_sdk/hooks/index.ts @@ -9,3 +9,6 @@ export {useReplyNotes} from './useReplyNotes'; export {useReposts} from './useReposts'; export {useRootNotes} from './useRootNotes'; export {useSendNote} from './useSendNote'; +export {useSearchUsers} from './search/useSearchUsers'; +export {useSearch} from './search/useSearch'; +export {useSearchNotes} from './useSearchNotes'; diff --git a/packages/afk_nostr_sdk/hooks/messages/useSendPrivateMessage.ts b/packages/afk_nostr_sdk/hooks/messages/useSendPrivateMessage.ts new file mode 100644 index 00000000..f241e3cf --- /dev/null +++ b/packages/afk_nostr_sdk/hooks/messages/useSendPrivateMessage.ts @@ -0,0 +1,20 @@ +import {NDKEvent} from '@nostr-dev-kit/ndk'; +import {useMutation} from '@tanstack/react-query'; +import {useNostrContext} from '../../context/NostrContext'; + +export const useSendPrivateMessage = () => { + const {ndk} = useNostrContext(); + + return useMutation({ + mutationKey: ['sendPrivateMessage', ndk], + mutationFn: async (data: {content: string; tags?: string[][]}) => { + const event = new NDKEvent(ndk); + event.kind = 14; + // const encryptedContent = nip44 + event.content = data.content; + event.tags = data.tags ?? []; + + return event.publish(); + }, + }); +}; diff --git a/packages/afk_nostr_sdk/hooks/search/useSearch.tsx b/packages/afk_nostr_sdk/hooks/search/useSearch.tsx new file mode 100644 index 00000000..106d2533 --- /dev/null +++ b/packages/afk_nostr_sdk/hooks/search/useSearch.tsx @@ -0,0 +1,45 @@ +// useSearchUsers.ts +import {NDKKind} from '@nostr-dev-kit/ndk'; +import {useInfiniteQuery} from '@tanstack/react-query'; +import {useNostrContext} from '../../context/NostrContext'; + +export type UseSearch = { + authors?: string[]; + search?: string; + kind?: NDKKind; + kinds?: NDKKind[]; +}; + +export const useSearch = (options?: UseSearch) => { + const {ndk} = useNostrContext(); + + return useInfiniteQuery({ + initialPageParam: 0, + queryKey: ['search', options?.authors, options?.search, options?.kind, options?.kinds, ndk], + getNextPageParam: (lastPage: any, allPages, lastPageParam) => { + if (!lastPage?.length) return undefined; + + const pageParam = lastPage[lastPage.length - 1].created_at - 1; + + if (!pageParam || pageParam === lastPageParam) return undefined; + return pageParam; + }, + queryFn: async ({pageParam}) => { + console.log('search query', options?.search); + const notes = await ndk.fetchEvents({ + kinds: options?.kinds ?? [options?.kind ?? NDKKind.Text], + authors: options?.authors, + search: options?.search, + // content: options?.search, + until: pageParam || Math.round(Date.now() / 1000), + limit: 20, + }); + + return [notes]; + // return [...notes].filter((note) => note.tags.every((tag) => tag[0] !== 'e')); + }, + placeholderData: {pages: [], pageParams: []}, + }); +}; + +export default useSearch; diff --git a/packages/afk_nostr_sdk/hooks/search/useSearchUsers.tsx b/packages/afk_nostr_sdk/hooks/search/useSearchUsers.tsx new file mode 100644 index 00000000..c1b7ac12 --- /dev/null +++ b/packages/afk_nostr_sdk/hooks/search/useSearchUsers.tsx @@ -0,0 +1,43 @@ +// useSearchUsers.ts +import {NDKKind} from '@nostr-dev-kit/ndk'; +import {useInfiniteQuery} from '@tanstack/react-query'; + +import {useNostrContext} from '../../context/NostrContext'; + +export type UseSearchUsers = { + authors?: string[]; + search?: string; + kind?: NDKKind; +}; + +export const useSearchUsers = (options?: UseSearchUsers) => { + const {ndk} = useNostrContext(); + + return useInfiniteQuery({ + initialPageParam: 0, + queryKey: ['search_user', options?.authors, options?.search, ndk], + getNextPageParam: (lastPage: any, allPages, lastPageParam) => { + if (!lastPage?.length) return undefined; + + const pageParam = lastPage[lastPage.length - 1].created_at - 1; + + if (!pageParam || pageParam === lastPageParam) return undefined; + return pageParam; + }, + queryFn: async ({pageParam}) => { + const notes = await ndk.fetchEvents({ + kinds: [options?.kind ?? NDKKind.Text], + authors: options?.authors, + search: options?.search, + until: pageParam || Math.round(Date.now() / 1000), + limit: 20, + }); + + // return [...notes].filter((note) => note.tags.every((tag) => tag[0] !== 'e')); + return [...notes]; + }, + placeholderData: {pages: [], pageParams: []}, + }); +}; + +export default useSearchUsers; diff --git a/packages/nostr_sdk/hooks/useContacts.ts b/packages/afk_nostr_sdk/hooks/useContacts.ts similarity index 91% rename from packages/nostr_sdk/hooks/useContacts.ts rename to packages/afk_nostr_sdk/hooks/useContacts.ts index 86d99b22..33fc820e 100644 --- a/packages/nostr_sdk/hooks/useContacts.ts +++ b/packages/afk_nostr_sdk/hooks/useContacts.ts @@ -1,7 +1,7 @@ import {NDKKind} from '@nostr-dev-kit/ndk'; import {useQuery} from '@tanstack/react-query'; -import {useNostrContext} from '../../context/NostrContext'; +import {useNostrContext} from '../context/NostrContext'; export type UseContactsOptions = { authors?: string[]; diff --git a/packages/nostr_sdk/hooks/useEditContacts.ts b/packages/afk_nostr_sdk/hooks/useEditContacts.ts similarity index 91% rename from packages/nostr_sdk/hooks/useEditContacts.ts rename to packages/afk_nostr_sdk/hooks/useEditContacts.ts index 8b38d15b..ffdda5f2 100644 --- a/packages/nostr_sdk/hooks/useEditContacts.ts +++ b/packages/afk_nostr_sdk/hooks/useEditContacts.ts @@ -1,8 +1,9 @@ import {NDKEvent, NDKKind} from '@nostr-dev-kit/ndk'; import {useMutation} from '@tanstack/react-query'; -import {useNostrContext} from '../../context/NostrContext'; -import {useAuth} from '../../store/auth'; +import {useNostrContext} from '../context/NostrContext'; + +import {useAuth} from '../store/auth'; export const useEditContacts = () => { const {ndk} = useNostrContext(); diff --git a/packages/nostr_sdk/hooks/useEditProfile.ts b/packages/afk_nostr_sdk/hooks/useEditProfile.ts similarity index 73% rename from packages/nostr_sdk/hooks/useEditProfile.ts rename to packages/afk_nostr_sdk/hooks/useEditProfile.ts index 2fdb9110..a9bece6d 100644 --- a/packages/nostr_sdk/hooks/useEditProfile.ts +++ b/packages/afk_nostr_sdk/hooks/useEditProfile.ts @@ -1,9 +1,13 @@ import {NDKUserProfile} from '@nostr-dev-kit/ndk'; import {useMutation} from '@tanstack/react-query'; -import {useNostrContext} from '../../context/NostrContext'; -import {useAuth} from '../../store/auth'; +// import {useNostrContext} from '../../context/NostrContext'; +// import {useAuth} from '../../store/auth'; +// import {useNostrContext} from '../context/NostrContext'; +import {useNostrContext} from '../context/NostrContext'; + +import {useAuth} from '../store/auth'; export const useEditProfile = () => { const {ndk} = useNostrContext(); const {publicKey} = useAuth(); diff --git a/packages/nostr_sdk/hooks/useNote.ts b/packages/afk_nostr_sdk/hooks/useNote.ts similarity index 75% rename from packages/nostr_sdk/hooks/useNote.ts rename to packages/afk_nostr_sdk/hooks/useNote.ts index bdacc1f7..87609fd3 100644 --- a/packages/nostr_sdk/hooks/useNote.ts +++ b/packages/afk_nostr_sdk/hooks/useNote.ts @@ -1,8 +1,10 @@ import {NDKKind} from '@nostr-dev-kit/ndk'; import {useQuery} from '@tanstack/react-query'; -import {useNostrContext} from '../../context/NostrContext'; +// import {useNostrContext} from '../../context/NostrContext'; +import {useNostrContext} from '../context/NostrContext'; +import {useAuth} from '../store/auth'; export type UseNoteOptions = { noteId: string; }; diff --git a/packages/nostr_sdk/hooks/useProfile.ts b/packages/afk_nostr_sdk/hooks/useProfile.ts similarity index 73% rename from packages/nostr_sdk/hooks/useProfile.ts rename to packages/afk_nostr_sdk/hooks/useProfile.ts index 3b2110d0..9b0da55b 100644 --- a/packages/nostr_sdk/hooks/useProfile.ts +++ b/packages/afk_nostr_sdk/hooks/useProfile.ts @@ -1,7 +1,10 @@ import {useQuery} from '@tanstack/react-query'; -import {useNostrContext} from '../../context/NostrContext'; +// import {useNostrContext} from '../../context/NostrContext'; +import {useNostrContext} from '../context/NostrContext'; + +import {useAuth} from '../store/auth'; export type UseProfileOptions = { publicKey?: string; }; diff --git a/packages/nostr_sdk/hooks/useReact.ts b/packages/afk_nostr_sdk/hooks/useReact.ts similarity index 91% rename from packages/nostr_sdk/hooks/useReact.ts rename to packages/afk_nostr_sdk/hooks/useReact.ts index 2a21214b..88db5608 100644 --- a/packages/nostr_sdk/hooks/useReact.ts +++ b/packages/afk_nostr_sdk/hooks/useReact.ts @@ -1,7 +1,7 @@ import {NDKEvent, NDKKind} from '@nostr-dev-kit/ndk'; import {useMutation} from '@tanstack/react-query'; -import {useNostrContext} from '../../context/NostrContext'; +import {useNostrContext} from '../context/NostrContext'; export const useReact = () => { const {ndk} = useNostrContext(); diff --git a/packages/nostr_sdk/hooks/useReactions.ts b/packages/afk_nostr_sdk/hooks/useReactions.ts similarity index 92% rename from packages/nostr_sdk/hooks/useReactions.ts rename to packages/afk_nostr_sdk/hooks/useReactions.ts index d58dee34..78f12c3a 100644 --- a/packages/nostr_sdk/hooks/useReactions.ts +++ b/packages/afk_nostr_sdk/hooks/useReactions.ts @@ -1,7 +1,7 @@ import {NDKKind} from '@nostr-dev-kit/ndk'; import {useQuery} from '@tanstack/react-query'; -import {useNostrContext} from '../../context/NostrContext'; +import {useNostrContext} from '../context/NostrContext'; export type UseReactionsOptions = { authors?: string[]; diff --git a/packages/nostr_sdk/hooks/useReplyNotes.ts b/packages/afk_nostr_sdk/hooks/useReplyNotes.ts similarity index 95% rename from packages/nostr_sdk/hooks/useReplyNotes.ts rename to packages/afk_nostr_sdk/hooks/useReplyNotes.ts index 6fed31f2..85a2708b 100644 --- a/packages/nostr_sdk/hooks/useReplyNotes.ts +++ b/packages/afk_nostr_sdk/hooks/useReplyNotes.ts @@ -1,7 +1,7 @@ import {NDKKind} from '@nostr-dev-kit/ndk'; import {useInfiniteQuery} from '@tanstack/react-query'; -import {useNostrContext} from '../../context/NostrContext'; +import {useNostrContext} from '../context/NostrContext'; export type UseReplyNotesOptions = { noteId?: string; diff --git a/packages/nostr_sdk/hooks/useReposts.ts b/packages/afk_nostr_sdk/hooks/useReposts.ts similarity index 94% rename from packages/nostr_sdk/hooks/useReposts.ts rename to packages/afk_nostr_sdk/hooks/useReposts.ts index 1320a52d..c6a4c4f4 100644 --- a/packages/nostr_sdk/hooks/useReposts.ts +++ b/packages/afk_nostr_sdk/hooks/useReposts.ts @@ -1,7 +1,7 @@ import {NDKKind} from '@nostr-dev-kit/ndk'; import {useInfiniteQuery} from '@tanstack/react-query'; -import {useNostrContext} from '../../context/NostrContext'; +import {useNostrContext} from '../context/NostrContext'; export type UseRepostsOptions = { authors?: string[]; diff --git a/packages/nostr_sdk/hooks/useRootNotes.ts b/packages/afk_nostr_sdk/hooks/useRootNotes.ts similarity index 90% rename from packages/nostr_sdk/hooks/useRootNotes.ts rename to packages/afk_nostr_sdk/hooks/useRootNotes.ts index c04b2343..2065aa5f 100644 --- a/packages/nostr_sdk/hooks/useRootNotes.ts +++ b/packages/afk_nostr_sdk/hooks/useRootNotes.ts @@ -1,7 +1,6 @@ import {NDKKind} from '@nostr-dev-kit/ndk'; import {useInfiniteQuery} from '@tanstack/react-query'; - -import {useNostrContext} from '../../context/NostrContext'; +import {useNostrContext} from '../context/NostrContext'; export type UseRootNotesOptions = { authors?: string[]; @@ -24,7 +23,7 @@ export const useRootNotes = (options?: UseRootNotesOptions) => { }, queryFn: async ({pageParam}) => { const notes = await ndk.fetchEvents({ - kinds: [NDKKind.Text], + kinds: [NDKKind.Text, NDKKind.ChannelMetadata], authors: options?.authors, search: options?.search, until: pageParam || Math.round(Date.now() / 1000), diff --git a/packages/afk_nostr_sdk/hooks/useSearchNotes.ts b/packages/afk_nostr_sdk/hooks/useSearchNotes.ts new file mode 100644 index 00000000..acc7751a --- /dev/null +++ b/packages/afk_nostr_sdk/hooks/useSearchNotes.ts @@ -0,0 +1,39 @@ +import {NDKKind} from '@nostr-dev-kit/ndk'; +import {useInfiniteQuery} from '@tanstack/react-query'; + +import {useNostrContext} from '../context/NostrContext'; + +export type UseRootNotesOptions = { + authors?: string[]; + search?: string; + kinds?: NDKKind[]; +}; + +export const useSearchNotes = (options?: UseRootNotesOptions) => { + const {ndk} = useNostrContext(); + + return useInfiniteQuery({ + initialPageParam: 0, + queryKey: ['searchNotes', options?.authors, options?.search, options?.kinds, ndk], + getNextPageParam: (lastPage: any, allPages, lastPageParam) => { + if (!lastPage?.length) return undefined; + + const pageParam = lastPage[lastPage.length - 1].created_at - 1; + + if (!pageParam || pageParam === lastPageParam) return undefined; + return pageParam; + }, + queryFn: async ({pageParam}) => { + const notes = await ndk.fetchEvents({ + kinds: options?.kinds ?? [NDKKind.Text], + authors: options?.authors, + search: options?.search, + until: pageParam || Math.round(Date.now() / 1000), + limit: 20, + }); + + return [...notes].filter((note) => note.tags.every((tag) => tag[0] !== 'e')); + }, + placeholderData: {pages: [], pageParams: []}, + }); +}; diff --git a/packages/nostr_sdk/hooks/useSendNote.ts b/packages/afk_nostr_sdk/hooks/useSendNote.ts similarity index 80% rename from packages/nostr_sdk/hooks/useSendNote.ts rename to packages/afk_nostr_sdk/hooks/useSendNote.ts index 49cd18f6..f674c94f 100644 --- a/packages/nostr_sdk/hooks/useSendNote.ts +++ b/packages/afk_nostr_sdk/hooks/useSendNote.ts @@ -1,7 +1,8 @@ import {NDKEvent, NDKKind} from '@nostr-dev-kit/ndk'; import {useMutation} from '@tanstack/react-query'; +import { useNostrContext } from '../context/NostrContext'; -import {useNostrContext} from '../../context/NostrContext'; +// import {useNostrContext} from '../context/NostrContext'; export const useSendNote = () => { const {ndk} = useNostrContext(); diff --git a/packages/afk_nostr_sdk/index.ts b/packages/afk_nostr_sdk/index.ts new file mode 100644 index 00000000..8734a0aa --- /dev/null +++ b/packages/afk_nostr_sdk/index.ts @@ -0,0 +1,9 @@ +import { NostrContext } from "./context/NostrContext"; +import { TanstackProvider } from "./context/TanstackProvider"; +import * as hooks from "./hooks" +import {NDKKind, NDKEvent, NDKUser} from "@nostr-dev-kit/ndk" +import { AFK_RELAYS } from "./utils/relay"; +export default {hooks, NostrContext, TanstackProvider , + NDKEvent, NDKKind, NDKUser, + AFK_RELAYS +}; \ No newline at end of file diff --git a/packages/nostr_sdk/package.json b/packages/afk_nostr_sdk/package.json similarity index 95% rename from packages/nostr_sdk/package.json rename to packages/afk_nostr_sdk/package.json index 965cbd96..6bfe515e 100644 --- a/packages/nostr_sdk/package.json +++ b/packages/afk_nostr_sdk/package.json @@ -15,8 +15,8 @@ "dependencies": { "@nostr-dev-kit/ndk": "^2.8.2", "@tanstack/react-query": "^5.40.0", - "react": "18.2.0", - "react-dom": "18.2.0", + "react": "^18.3.1", + "react-dom": "^18.3.1", "zustand": "^4.5.2" }, "devDependencies": { diff --git a/packages/nostr_sdk/store/auth.ts b/packages/afk_nostr_sdk/store/auth.ts similarity index 100% rename from packages/nostr_sdk/store/auth.ts rename to packages/afk_nostr_sdk/store/auth.ts diff --git a/packages/nostr_sdk/store/createBoundedUseStore.ts b/packages/afk_nostr_sdk/store/createBoundedUseStore.ts similarity index 100% rename from packages/nostr_sdk/store/createBoundedUseStore.ts rename to packages/afk_nostr_sdk/store/createBoundedUseStore.ts diff --git a/packages/nostr_sdk/tsconfig.json b/packages/afk_nostr_sdk/tsconfig.json similarity index 100% rename from packages/nostr_sdk/tsconfig.json rename to packages/afk_nostr_sdk/tsconfig.json diff --git a/packages/afk_nostr_sdk/utils/relay.ts b/packages/afk_nostr_sdk/utils/relay.ts new file mode 100644 index 00000000..6ed136b0 --- /dev/null +++ b/packages/afk_nostr_sdk/utils/relay.ts @@ -0,0 +1,20 @@ +export const RELAYS_PROD = ['wss://relay.n057r.club', 'wss://relay.nostr.net']; + +export const AFK_RELAYS = + process.env.EXPO_NODE_ENV == 'production' || process.env.NODE_ENV == 'production' + ? [ + // 'wss://nostr.joyboy.community', + 'wss://nostr-relay-nestjs-production.up.railway.app', + // 'ws://localhost:3000', // comment if you don't run a relayer in localhost + ] + : [ + // 'wss://nostr.joyboy.community', + // 'ws://nostr-relay-nestjs-production.up.railway.app', + 'wss://nostr-relay-nestjs-production.up.railway.app', + // 'ws://localhost:8080', // comment if you don't run a relayer in localhost + ]; + +// export const AFK_RELAYS = [ +// 'wss://nostr.joyboy.community', +// // 'ws://localhost:3000', // comment if you don't run a relayer in localhost +// ]; diff --git a/packages/nostr_sdk/index.ts b/packages/nostr_sdk/index.ts deleted file mode 100644 index 283d6976..00000000 --- a/packages/nostr_sdk/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { NostrContext } from "./context/NostrContext"; -import * as hooks from "./hooks" -export default {hooks, NostrContext}; \ No newline at end of file diff --git a/packages/nostr_sdk/utils/relay.ts b/packages/nostr_sdk/utils/relay.ts deleted file mode 100644 index 70ae385a..00000000 --- a/packages/nostr_sdk/utils/relay.ts +++ /dev/null @@ -1,6 +0,0 @@ -export const RELAYS_PROD = ['wss://relay.n057r.club', 'wss://relay.nostr.net']; - -export const AFK_RELAYS = [ - 'wss://nostr.joyboy.community', - // 'ws://localhost:3000', // comment if you don't run a relayer in localhost -]; From fe9d6a55c96813d5fe4ed1c6fc707bef851e1255 Mon Sep 17 00:00:00 2001 From: MSGhais Date: Thu, 8 Aug 2024 16:02:24 +0200 Subject: [PATCH 02/16] fix website build --- apps/website/src/app/_app.tsx | 20 ++-- apps/website/src/app/app/page.tsx | 124 ++++++++++++------------- apps/website/src/app/features/page.tsx | 4 +- apps/website/src/app/layout.tsx | 5 +- apps/website/src/app/page.tsx | 2 +- apps/website/src/app/providers.tsx | 12 +-- apps/website/tsconfig.json | 2 +- 7 files changed, 83 insertions(+), 86 deletions(-) diff --git a/apps/website/src/app/_app.tsx b/apps/website/src/app/_app.tsx index d46453d3..7bde7667 100644 --- a/apps/website/src/app/_app.tsx +++ b/apps/website/src/app/_app.tsx @@ -1,19 +1,21 @@ import './index.css'; -import type { Metadata } from 'next'; + +import type {Metadata} from 'next'; + import Providers from './providers'; export const metadata: Metadata = { title: 'afk community portal', description: 'afk community portal', }; -import { AppProps } from 'next/app'; +import {AppProps} from 'next/app'; -function MyApp({ Component, pageProps }: AppProps) { - return ( - - - - ); +function MyApp({Component, pageProps}: AppProps) { + return ( + + + + ); } -export default MyApp; \ No newline at end of file +export default MyApp; diff --git a/apps/website/src/app/app/page.tsx b/apps/website/src/app/app/page.tsx index 57fa8794..7318a8af 100644 --- a/apps/website/src/app/app/page.tsx +++ b/apps/website/src/app/app/page.tsx @@ -1,109 +1,105 @@ -"use client"; +'use client'; -import { ContributeSection } from '../components/landing/ContributeSection'; -import { Footer } from '../components/Footer'; -import { Navbar } from '../components/Navbar'; -import { useRootNotes } from 'afk_nostr_sdk/hooks/useRootNotes'; // import { NDKEvent } from 'afk_nostr_sdk'; +import {NDKEvent, NDKFilter, NDKKind} from '@nostr-dev-kit/ndk'; +import {useNostrContext} from 'afk_nostr_sdk/context/NostrContext'; +import {useSearchNotes} from 'afk_nostr_sdk/hooks'; +import {useEffect} from 'react'; +import {useState} from 'react'; -import Providers from '../providers'; -import NDK, { NDKEvent, NDKFilter, NDKKind } from '@nostr-dev-kit/ndk'; -import { AFK_RELAYS } from 'afk_nostr_sdk/utils/relay'; -import { useEffect } from 'react'; -import { useNostrContext } from 'afk_nostr_sdk/context/NostrContext'; -import { useSearch, useSearchNotes } from 'afk_nostr_sdk/hooks'; -import { useState } from 'react'; +import {Footer} from '../components/Footer'; +import {Navbar} from '../components/Navbar'; export default function AppHomepage() { + const nostr = useNostrContext(); - const nostr = useNostrContext() - - const [events, setEvents] = useState([]) - const [isInitDone, setIsInitDone] = useState(false) + const [events, setEvents] = useState([]); + const [isInitDone, setIsInitDone] = useState(false); useEffect(() => { - if (!isInitDone) { - fetch() - setIsInitDone(true) + fetch(); + setIsInitDone(true); } - - }) + }); const fetch = async () => { const filter: NDKFilter = { kinds: [NDKKind.Text, NDKKind.ChannelMetadata, NDKKind.Metadata], - }; - let events_package = await nostr?.ndk?.fetchEvents(filter) + const events_package = await nostr?.ndk?.fetchEvents(filter); // console.log("events_package", events_package) setEvents([ ...events_package, - ...eventsSearch?.data?.pages - ]) - } + // [...eventsSearch?.data?.pages] + ]); + }; const eventsSearch = useSearchNotes({ kinds: [ - NDKKind.Text, + NDKKind.Text, // NDKKind.ChannelMetadata - ] - + ], }); // const events = useRootNotes(); - console.log("events hooks", eventsSearch?.data?.pages) + console.log('events hooks', eventsSearch?.data?.pages); return ( //
    - - - -
    - {events?.length > 0 && events.map((e: NDKEvent, i) => { - // console.log("e", e) - return ( - - ) - })} +
    + {events?.length > 0 && + events.map((e: NDKEvent, i) => { + return ( + + ); + })}
    -
    + // - ); } diff --git a/apps/website/src/app/features/page.tsx b/apps/website/src/app/features/page.tsx index 9184f417..0c9775fc 100644 --- a/apps/website/src/app/features/page.tsx +++ b/apps/website/src/app/features/page.tsx @@ -1,6 +1,6 @@ -import {ContributeSection} from '../components/landing/ContributeSection'; -import {DescriptionFeatures} from '../components/features/DescriptionFeatures'; import {Footer} from '../components/Footer'; +import {ContributeSection} from '../components/landing/ContributeSection'; +import {DescriptionFeatures} from '../components/landing/features/DescriptionFeatures'; import {Navbar} from '../components/Navbar'; export default function Features() { diff --git a/apps/website/src/app/layout.tsx b/apps/website/src/app/layout.tsx index 00577340..8430c0d6 100644 --- a/apps/website/src/app/layout.tsx +++ b/apps/website/src/app/layout.tsx @@ -1,6 +1,7 @@ import './index.css'; -import type { Metadata } from 'next'; +import type {Metadata} from 'next'; + import Providers from './providers'; export const metadata: Metadata = { @@ -8,7 +9,7 @@ export const metadata: Metadata = { description: 'afk community portal', }; -export default function RootLayout({ children }: { children: React.ReactNode }) { +export default function RootLayout({children}: {children: React.ReactNode}) { return ( diff --git a/apps/website/src/app/page.tsx b/apps/website/src/app/page.tsx index 42094203..c6568fed 100644 --- a/apps/website/src/app/page.tsx +++ b/apps/website/src/app/page.tsx @@ -1,9 +1,9 @@ +import {Footer} from './components/Footer'; import {About} from './components/landing/About'; import {ContributeSection} from './components/landing/ContributeSection'; import {DescriptionSection} from './components/landing/DescriptionSection'; import {DownloadSection} from './components/landing/DownloadSection'; import {Faq} from './components/landing/Faq'; -import {Footer} from './components/Footer'; import {HeroSection} from './components/landing/HeroSection'; import {Navbar} from './components/Navbar'; diff --git a/apps/website/src/app/providers.tsx b/apps/website/src/app/providers.tsx index 020bb711..0ea0da00 100644 --- a/apps/website/src/app/providers.tsx +++ b/apps/website/src/app/providers.tsx @@ -1,14 +1,12 @@ -"use client"; +'use client'; -import { NostrProvider } from 'afk_nostr_sdk/context/NostrContext'; -import { TanstackProvider } from 'afk_nostr_sdk/context/TanstackProvider'; +import {NostrProvider} from 'afk_nostr_sdk/context/NostrContext'; +import {TanstackProvider} from 'afk_nostr_sdk/context/TanstackProvider'; -export default function Providers({ children }: { children: React.ReactNode }) { +export default function Providers({children}: {children: React.ReactNode}) { return ( - - {children} - + {children} ); } diff --git a/apps/website/tsconfig.json b/apps/website/tsconfig.json index 067909ee..2289e197 100644 --- a/apps/website/tsconfig.json +++ b/apps/website/tsconfig.json @@ -6,7 +6,7 @@ "dom.iterable", "esnext" ], - "module": "ES6", + "module": "esnext", "allowJs": true, "skipLibCheck": true, "strict": true, From 9fae8be1bc021d641f71f9ffde822979a2fcf870 Mon Sep 17 00:00:00 2001 From: MSGhais Date: Thu, 8 Aug 2024 16:25:00 +0200 Subject: [PATCH 03/16] build package nostr_sdk --- apps/website/package.json | 3 ++- apps/website/vercel.json | 17 ++++++++++++++++- package.json | 1 + packages/afk_nostr_sdk/package.json | 4 +++- packages/afk_nostr_sdk/tsconfig.json | 4 +++- 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/apps/website/package.json b/apps/website/package.json index 8c448431..a40400a8 100644 --- a/apps/website/package.json +++ b/apps/website/package.json @@ -5,7 +5,8 @@ "scripts": { "dev": "next dev", "start": "next start", - "build": "next build", + "build": "pnpm run build:nostr_sdk && next build", + "build:nostr_sdk": "cd ../.. && pnpm run build:nostr_sdk", "lint": "next lint", "lint:fix":"next lint --fix", "prettier:fix":"pnpm prettier --write 'src/**/*.tsx'", diff --git a/apps/website/vercel.json b/apps/website/vercel.json index 2220ae79..e58f737e 100644 --- a/apps/website/vercel.json +++ b/apps/website/vercel.json @@ -4,6 +4,21 @@ "PNPM_VERSION": "8.15.9", "installCommand": "pnpm install" - } + }, + "builds": [ + { + "src": "apps/website/package.json", + "use": "@vercel/static-build", + "config": { + "distDir": "build" + } + } + ], + "routes": [ + { + "src": "/(.*)", + "dest": "/apps/website/$1" + } + ] } \ No newline at end of file diff --git a/package.json b/package.json index 5874855a..ca6f9e68 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "dev:website":"cd apps/website && pnpm run dev", "build:mobile":"cd apps/mobile && pnpm run build", "dev:mobile":"cd apps/mobile && pnpm run start", + "build:nostr_sdk":"cd packages/afk_nostr_sdk && pnpm run build", "dev": "turbo run dev", "web":"turbo run dev --filter=website", "mobile":"turbo run start --filter=mobile", diff --git a/packages/afk_nostr_sdk/package.json b/packages/afk_nostr_sdk/package.json index 6bfe515e..9be8a430 100644 --- a/packages/afk_nostr_sdk/package.json +++ b/packages/afk_nostr_sdk/package.json @@ -3,6 +3,8 @@ "version": "1.0.0", "main": "index.js", "scripts": { + "install": "pnpm install .", + "build": "tsc", "format": "prettier --write \"src/**/*.{ts,tsx}\"", "format:check": "prettier -c \"src/**/*.{ts,tsx}\"", "lint": "eslint \"src/**/*.{ts,tsx}\"", @@ -35,4 +37,4 @@ "typescript": "~5.3.3" }, "private": true -} +} \ No newline at end of file diff --git a/packages/afk_nostr_sdk/tsconfig.json b/packages/afk_nostr_sdk/tsconfig.json index e30ce24e..7810c43f 100644 --- a/packages/afk_nostr_sdk/tsconfig.json +++ b/packages/afk_nostr_sdk/tsconfig.json @@ -23,7 +23,9 @@ "downlevelIteration": true, "allowSyntheticDefaultImports": true, "jsx": "react-native", - "module": "ES6" + "module": "ES6", + "outDir": "./dist", + "declaration": true, }, "exclude": ["node_modules", "dist", "babel.config.js", "metro.config.js", "jest.config.js"], "include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"] From f1f8952337376b0767538426dce556e6195b0c2a Mon Sep 17 00:00:00 2001 From: MSGhais Date: Thu, 8 Aug 2024 16:29:06 +0200 Subject: [PATCH 04/16] fix vercel --- apps/website/vercel.json | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/apps/website/vercel.json b/apps/website/vercel.json index e58f737e..79bdcfd8 100644 --- a/apps/website/vercel.json +++ b/apps/website/vercel.json @@ -4,21 +4,7 @@ "PNPM_VERSION": "8.15.9", "installCommand": "pnpm install" - }, - "builds": [ - { - "src": "apps/website/package.json", - "use": "@vercel/static-build", - "config": { - "distDir": "build" - } - } - ], - "routes": [ - { - "src": "/(.*)", - "dest": "/apps/website/$1" - } - ] + } + } \ No newline at end of file From 294502d0674551f036bf7bae925f401eb8106460 Mon Sep 17 00:00:00 2001 From: MSGhais Date: Thu, 8 Aug 2024 16:37:36 +0200 Subject: [PATCH 05/16] change package json --- apps/website/package.json | 7 +++++-- packages/afk_nostr_sdk/package.json | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/website/package.json b/apps/website/package.json index a40400a8..675012d7 100644 --- a/apps/website/package.json +++ b/apps/website/package.json @@ -5,7 +5,8 @@ "scripts": { "dev": "next dev", "start": "next start", - "build": "pnpm run build:nostr_sdk && next build", + "build:app": "pnpm run build:nostr_sdk && next build", + "build": "next build", "build:nostr_sdk": "cd ../.. && pnpm run build:nostr_sdk", "lint": "next lint", "lint:fix":"next lint --fix", @@ -22,9 +23,11 @@ "qs": "^6.12.3", "starknet": "6.9.0", "zod": "^3.23.8", + "@tanstack/react-query": "^5.40.0", + "react": "^18.3.1", + "react-dom": "^18.3.1", "afk_nostr_sdk":"workspace:*", "@nostr-dev-kit/ndk": "^2.8.2" - }, "devDependencies": { "@types/node": "^20", diff --git a/packages/afk_nostr_sdk/package.json b/packages/afk_nostr_sdk/package.json index 9be8a430..256fafb4 100644 --- a/packages/afk_nostr_sdk/package.json +++ b/packages/afk_nostr_sdk/package.json @@ -3,7 +3,6 @@ "version": "1.0.0", "main": "index.js", "scripts": { - "install": "pnpm install .", "build": "tsc", "format": "prettier --write \"src/**/*.{ts,tsx}\"", "format:check": "prettier -c \"src/**/*.{ts,tsx}\"", @@ -17,6 +16,7 @@ "dependencies": { "@nostr-dev-kit/ndk": "^2.8.2", "@tanstack/react-query": "^5.40.0", + "afk_nostr_sdk": "link:", "react": "^18.3.1", "react-dom": "^18.3.1", "zustand": "^4.5.2" @@ -24,6 +24,8 @@ "devDependencies": { "@babel/core": "^7.20.0", "@babel/plugin-proposal-export-namespace-from": "^7.18.9", + "@types/react": "^18.3.1", + "@types/react-dom": "^18.3.0", "@uniswap/eslint-config": "^1.2.0", "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", From 283ca0a4a28553b56a6e98fe80c1b89785528f8c Mon Sep 17 00:00:00 2001 From: MSGhais Date: Thu, 8 Aug 2024 16:41:45 +0200 Subject: [PATCH 06/16] fix afk lib --- packages/afk_nostr_sdk/package.json | 1 + packages/afk_nostr_sdk/tsconfig.json | 7 ------- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/afk_nostr_sdk/package.json b/packages/afk_nostr_sdk/package.json index 256fafb4..e629ea11 100644 --- a/packages/afk_nostr_sdk/package.json +++ b/packages/afk_nostr_sdk/package.json @@ -26,6 +26,7 @@ "@babel/plugin-proposal-export-namespace-from": "^7.18.9", "@types/react": "^18.3.1", "@types/react-dom": "^18.3.0", + "@types/react-query": "^1.2.9", "@uniswap/eslint-config": "^1.2.0", "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", diff --git a/packages/afk_nostr_sdk/tsconfig.json b/packages/afk_nostr_sdk/tsconfig.json index 7810c43f..d4ff7bc6 100644 --- a/packages/afk_nostr_sdk/tsconfig.json +++ b/packages/afk_nostr_sdk/tsconfig.json @@ -8,24 +8,17 @@ "forceConsistentCasingInFileNames": true, "noEmit": true, "esModuleInterop": true, - "strict": true, - "alwaysStrict": true, "strictNullChecks": true, "noUnusedLocals": false, "noFallthroughCasesInSwitch": true, - "noImplicitAny": true, - "noImplicitThis": true, - "noImplicitReturns": true, "useUnknownInCatchVariables": false, "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, "downlevelIteration": true, "allowSyntheticDefaultImports": true, - "jsx": "react-native", "module": "ES6", "outDir": "./dist", - "declaration": true, }, "exclude": ["node_modules", "dist", "babel.config.js", "metro.config.js", "jest.config.js"], "include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"] From d74ebb6e6dc57fa9e4c0978f477b988deeb32b11 Mon Sep 17 00:00:00 2001 From: MSGhais Date: Thu, 8 Aug 2024 16:42:19 +0200 Subject: [PATCH 07/16] delete config expo on afk --- packages/afk_nostr_sdk/tsconfig.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/afk_nostr_sdk/tsconfig.json b/packages/afk_nostr_sdk/tsconfig.json index d4ff7bc6..93143e35 100644 --- a/packages/afk_nostr_sdk/tsconfig.json +++ b/packages/afk_nostr_sdk/tsconfig.json @@ -1,5 +1,4 @@ { - "extends": "expo/tsconfig.base", "compilerOptions": { "target": "ESNext", "lib": ["dom", "esnext"], From 4bea696b0be93150b1e43a21bede79f99571315a Mon Sep 17 00:00:00 2001 From: MSGhais Date: Thu, 8 Aug 2024 16:46:02 +0200 Subject: [PATCH 08/16] add lib package jsx --- packages/afk_nostr_sdk/tsconfig.json | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/afk_nostr_sdk/tsconfig.json b/packages/afk_nostr_sdk/tsconfig.json index 93143e35..fb1fcf14 100644 --- a/packages/afk_nostr_sdk/tsconfig.json +++ b/packages/afk_nostr_sdk/tsconfig.json @@ -1,24 +1,20 @@ { "compilerOptions": { "target": "ESNext", - "lib": ["dom", "esnext"], + "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, "noEmit": true, "esModuleInterop": true, - "strictNullChecks": true, - "noUnusedLocals": false, - "noFallthroughCasesInSwitch": true, - "useUnknownInCatchVariables": false, - "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, "downlevelIteration": true, "allowSyntheticDefaultImports": true, "module": "ES6", + "moduleResolution": "node", "outDir": "./dist", + "jsx": "react", // Add this line for React projects }, "exclude": ["node_modules", "dist", "babel.config.js", "metro.config.js", "jest.config.js"], - "include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"] + "include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "next-env.d.ts",] } From 653a75328721c6dae33f834ab9a9143d12cd5113 Mon Sep 17 00:00:00 2001 From: MSGhais Date: Thu, 8 Aug 2024 16:53:14 +0200 Subject: [PATCH 09/16] change tsconfig --- packages/afk_nostr_sdk/index.js | 9 ++++ packages/afk_nostr_sdk/index.ts | 8 ++-- .../afk_nostr_sdk/src/context/NostrContext.js | 29 ++++++++++++ .../{ => src}/context/NostrContext.tsx | 0 .../src/context/TanstackProvider.js | 8 ++++ .../{ => src}/context/TanstackProvider.tsx | 1 + .../src/hooks/channel/useChannels.js | 39 ++++++++++++++++ .../{ => src}/hooks/channel/useChannels.ts | 0 .../src/hooks/channel/useCreateChannel.js | 40 +++++++++++++++++ .../hooks/channel/useCreateChannel.ts | 0 .../src/hooks/channel/useMessagesChannel.js | 39 ++++++++++++++++ .../hooks/channel/useMessagesChannel.ts | 0 .../src/hooks/channel/useSendMessage.js | 26 +++++++++++ .../{ => src}/hooks/channel/useSendMessage.ts | 0 packages/afk_nostr_sdk/src/hooks/index.js | 14 ++++++ .../afk_nostr_sdk/{ => src}/hooks/index.ts | 0 .../hooks/messages/useSendPrivateMessage.js | 27 ++++++++++++ .../hooks/messages/useSendPrivateMessage.ts | 1 + .../src/hooks/search/useSearch.js | 44 +++++++++++++++++++ .../{ => src}/hooks/search/useSearch.tsx | 0 .../src/hooks/search/useSearchUsers.js | 42 ++++++++++++++++++ .../{ => src}/hooks/search/useSearchUsers.tsx | 1 - .../afk_nostr_sdk/src/hooks/useContacts.js | 28 ++++++++++++ .../{ => src}/hooks/useContacts.ts | 0 .../src/hooks/useEditContacts.js | 43 ++++++++++++++++++ .../{ => src}/hooks/useEditContacts.ts | 1 - .../afk_nostr_sdk/src/hooks/useEditProfile.js | 37 ++++++++++++++++ .../{ => src}/hooks/useEditProfile.ts | 2 +- packages/afk_nostr_sdk/src/hooks/useNote.js | 25 +++++++++++ .../afk_nostr_sdk/{ => src}/hooks/useNote.ts | 1 - .../afk_nostr_sdk/src/hooks/useProfile.js | 22 ++++++++++ .../{ => src}/hooks/useProfile.ts | 5 --- packages/afk_nostr_sdk/src/hooks/useReact.js | 30 +++++++++++++ .../afk_nostr_sdk/{ => src}/hooks/useReact.ts | 1 - .../afk_nostr_sdk/src/hooks/useReactions.js | 28 ++++++++++++ .../{ => src}/hooks/useReactions.ts | 1 - .../afk_nostr_sdk/src/hooks/useReplyNotes.js | 39 ++++++++++++++++ .../{ => src}/hooks/useReplyNotes.ts | 0 .../afk_nostr_sdk/src/hooks/useReposts.js | 38 ++++++++++++++++ .../{ => src}/hooks/useReposts.ts | 1 - .../afk_nostr_sdk/src/hooks/useRootNotes.js | 38 ++++++++++++++++ .../{ => src}/hooks/useRootNotes.ts | 0 .../afk_nostr_sdk/src/hooks/useSearchNotes.js | 39 ++++++++++++++++ .../{ => src}/hooks/useSearchNotes.ts | 1 - .../afk_nostr_sdk/src/hooks/useSendNote.js | 26 +++++++++++ .../{ => src}/hooks/useSendNote.ts | 4 +- packages/afk_nostr_sdk/src/store/auth.js | 12 +++++ .../afk_nostr_sdk/{ => src}/store/auth.ts | 0 .../src/store/createBoundedUseStore.js | 6 +++ .../{ => src}/store/createBoundedUseStore.ts | 0 packages/afk_nostr_sdk/src/utils/relay.js | 17 +++++++ .../afk_nostr_sdk/{ => src}/utils/relay.ts | 0 packages/afk_nostr_sdk/tsconfig copy.json | 20 +++++++++ packages/afk_nostr_sdk/tsconfig.json | 21 +++++---- 54 files changed, 785 insertions(+), 29 deletions(-) create mode 100644 packages/afk_nostr_sdk/index.js create mode 100644 packages/afk_nostr_sdk/src/context/NostrContext.js rename packages/afk_nostr_sdk/{ => src}/context/NostrContext.tsx (100%) create mode 100644 packages/afk_nostr_sdk/src/context/TanstackProvider.js rename packages/afk_nostr_sdk/{ => src}/context/TanstackProvider.tsx (93%) create mode 100644 packages/afk_nostr_sdk/src/hooks/channel/useChannels.js rename packages/afk_nostr_sdk/{ => src}/hooks/channel/useChannels.ts (100%) create mode 100644 packages/afk_nostr_sdk/src/hooks/channel/useCreateChannel.js rename packages/afk_nostr_sdk/{ => src}/hooks/channel/useCreateChannel.ts (100%) create mode 100644 packages/afk_nostr_sdk/src/hooks/channel/useMessagesChannel.js rename packages/afk_nostr_sdk/{ => src}/hooks/channel/useMessagesChannel.ts (100%) create mode 100644 packages/afk_nostr_sdk/src/hooks/channel/useSendMessage.js rename packages/afk_nostr_sdk/{ => src}/hooks/channel/useSendMessage.ts (100%) create mode 100644 packages/afk_nostr_sdk/src/hooks/index.js rename packages/afk_nostr_sdk/{ => src}/hooks/index.ts (100%) create mode 100644 packages/afk_nostr_sdk/src/hooks/messages/useSendPrivateMessage.js rename packages/afk_nostr_sdk/{ => src}/hooks/messages/useSendPrivateMessage.ts (99%) create mode 100644 packages/afk_nostr_sdk/src/hooks/search/useSearch.js rename packages/afk_nostr_sdk/{ => src}/hooks/search/useSearch.tsx (100%) create mode 100644 packages/afk_nostr_sdk/src/hooks/search/useSearchUsers.js rename packages/afk_nostr_sdk/{ => src}/hooks/search/useSearchUsers.tsx (99%) create mode 100644 packages/afk_nostr_sdk/src/hooks/useContacts.js rename packages/afk_nostr_sdk/{ => src}/hooks/useContacts.ts (100%) create mode 100644 packages/afk_nostr_sdk/src/hooks/useEditContacts.js rename packages/afk_nostr_sdk/{ => src}/hooks/useEditContacts.ts (99%) create mode 100644 packages/afk_nostr_sdk/src/hooks/useEditProfile.js rename packages/afk_nostr_sdk/{ => src}/hooks/useEditProfile.ts (100%) create mode 100644 packages/afk_nostr_sdk/src/hooks/useNote.js rename packages/afk_nostr_sdk/{ => src}/hooks/useNote.ts (90%) create mode 100644 packages/afk_nostr_sdk/src/hooks/useProfile.js rename packages/afk_nostr_sdk/{ => src}/hooks/useProfile.ts (82%) create mode 100644 packages/afk_nostr_sdk/src/hooks/useReact.js rename packages/afk_nostr_sdk/{ => src}/hooks/useReact.ts (99%) create mode 100644 packages/afk_nostr_sdk/src/hooks/useReactions.js rename packages/afk_nostr_sdk/{ => src}/hooks/useReactions.ts (99%) create mode 100644 packages/afk_nostr_sdk/src/hooks/useReplyNotes.js rename packages/afk_nostr_sdk/{ => src}/hooks/useReplyNotes.ts (100%) create mode 100644 packages/afk_nostr_sdk/src/hooks/useReposts.js rename packages/afk_nostr_sdk/{ => src}/hooks/useReposts.ts (99%) create mode 100644 packages/afk_nostr_sdk/src/hooks/useRootNotes.js rename packages/afk_nostr_sdk/{ => src}/hooks/useRootNotes.ts (100%) create mode 100644 packages/afk_nostr_sdk/src/hooks/useSearchNotes.js rename packages/afk_nostr_sdk/{ => src}/hooks/useSearchNotes.ts (99%) create mode 100644 packages/afk_nostr_sdk/src/hooks/useSendNote.js rename packages/afk_nostr_sdk/{ => src}/hooks/useSendNote.ts (80%) create mode 100644 packages/afk_nostr_sdk/src/store/auth.js rename packages/afk_nostr_sdk/{ => src}/store/auth.ts (100%) create mode 100644 packages/afk_nostr_sdk/src/store/createBoundedUseStore.js rename packages/afk_nostr_sdk/{ => src}/store/createBoundedUseStore.ts (100%) create mode 100644 packages/afk_nostr_sdk/src/utils/relay.js rename packages/afk_nostr_sdk/{ => src}/utils/relay.ts (100%) create mode 100644 packages/afk_nostr_sdk/tsconfig copy.json diff --git a/packages/afk_nostr_sdk/index.js b/packages/afk_nostr_sdk/index.js new file mode 100644 index 00000000..a1755378 --- /dev/null +++ b/packages/afk_nostr_sdk/index.js @@ -0,0 +1,9 @@ +import { NostrContext } from "./src/context/NostrContext"; +import { TanstackProvider } from "./src/context/TanstackProvider"; +import * as hooks from "./src/hooks"; +import { NDKKind, NDKEvent, NDKUser } from "@nostr-dev-kit/ndk"; +import { AFK_RELAYS } from "./src/utils/relay"; +export default { hooks, NostrContext, TanstackProvider, + NDKEvent, NDKKind, NDKUser, + AFK_RELAYS +}; diff --git a/packages/afk_nostr_sdk/index.ts b/packages/afk_nostr_sdk/index.ts index 8734a0aa..af3431f0 100644 --- a/packages/afk_nostr_sdk/index.ts +++ b/packages/afk_nostr_sdk/index.ts @@ -1,8 +1,8 @@ -import { NostrContext } from "./context/NostrContext"; -import { TanstackProvider } from "./context/TanstackProvider"; -import * as hooks from "./hooks" +import { NostrContext } from "./src/context/NostrContext"; +import { TanstackProvider } from "./src/context/TanstackProvider"; +import * as hooks from "./src/hooks" import {NDKKind, NDKEvent, NDKUser} from "@nostr-dev-kit/ndk" -import { AFK_RELAYS } from "./utils/relay"; +import { AFK_RELAYS } from "./src/utils/relay"; export default {hooks, NostrContext, TanstackProvider , NDKEvent, NDKKind, NDKUser, AFK_RELAYS diff --git a/packages/afk_nostr_sdk/src/context/NostrContext.js b/packages/afk_nostr_sdk/src/context/NostrContext.js new file mode 100644 index 00000000..515c610f --- /dev/null +++ b/packages/afk_nostr_sdk/src/context/NostrContext.js @@ -0,0 +1,29 @@ +import { jsx as _jsx } from "react/jsx-runtime"; +import NDK, { NDKPrivateKeySigner } from '@nostr-dev-kit/ndk'; +import { createContext, useContext, useEffect, useState } from 'react'; +import { useAuth } from '../store/auth'; +import { AFK_RELAYS } from "../utils/relay"; +export const NostrContext = createContext(null); +export const NostrProvider = ({ children }) => { + const privateKey = useAuth((state) => state.privateKey); + const [ndk, setNdk] = useState(new NDK({ + explicitRelayUrls: AFK_RELAYS, + })); + useEffect(() => { + const newNdk = new NDK({ + explicitRelayUrls: AFK_RELAYS, + signer: privateKey ? new NDKPrivateKeySigner(privateKey) : undefined, + }); + newNdk.connect().then(() => { + setNdk(newNdk); + }); + }, [privateKey]); + return _jsx(NostrContext.Provider, { value: { ndk }, children: children }); +}; +export const useNostrContext = () => { + const nostr = useContext(NostrContext); + if (!nostr) { + throw new Error('NostrContext must be used within a NostrProvider'); + } + return nostr; +}; diff --git a/packages/afk_nostr_sdk/context/NostrContext.tsx b/packages/afk_nostr_sdk/src/context/NostrContext.tsx similarity index 100% rename from packages/afk_nostr_sdk/context/NostrContext.tsx rename to packages/afk_nostr_sdk/src/context/NostrContext.tsx diff --git a/packages/afk_nostr_sdk/src/context/TanstackProvider.js b/packages/afk_nostr_sdk/src/context/TanstackProvider.js new file mode 100644 index 00000000..a47b6b28 --- /dev/null +++ b/packages/afk_nostr_sdk/src/context/TanstackProvider.js @@ -0,0 +1,8 @@ +import { jsx as _jsx } from "react/jsx-runtime"; +import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; +const queryClient = new QueryClient({ + defaultOptions: { queries: { retry: 2 } }, +}); +export const TanstackProvider = ({ children }) => { + return (_jsx(QueryClientProvider, { client: queryClient, children: children })); +}; diff --git a/packages/afk_nostr_sdk/context/TanstackProvider.tsx b/packages/afk_nostr_sdk/src/context/TanstackProvider.tsx similarity index 93% rename from packages/afk_nostr_sdk/context/TanstackProvider.tsx rename to packages/afk_nostr_sdk/src/context/TanstackProvider.tsx index 8b2b446b..c5699454 100644 --- a/packages/afk_nostr_sdk/context/TanstackProvider.tsx +++ b/packages/afk_nostr_sdk/src/context/TanstackProvider.tsx @@ -1,4 +1,5 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; +import React from "react"; import { PropsWithChildren } from "react"; const queryClient = new QueryClient({ diff --git a/packages/afk_nostr_sdk/src/hooks/channel/useChannels.js b/packages/afk_nostr_sdk/src/hooks/channel/useChannels.js new file mode 100644 index 00000000..1ad8ed8b --- /dev/null +++ b/packages/afk_nostr_sdk/src/hooks/channel/useChannels.js @@ -0,0 +1,39 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { NDKKind } from '@nostr-dev-kit/ndk'; +import { useInfiniteQuery } from '@tanstack/react-query'; +import { useNostrContext } from '../../context/NostrContext'; +export const useChannels = (options) => { + const { ndk } = useNostrContext(); + return useInfiniteQuery({ + initialPageParam: 0, + queryKey: ['channels', options === null || options === void 0 ? void 0 : options.authors, options === null || options === void 0 ? void 0 : options.search, ndk], + getNextPageParam: (lastPage, allPages, lastPageParam) => { + if (!(lastPage === null || lastPage === void 0 ? void 0 : lastPage.length)) + return undefined; + const pageParam = lastPage[lastPage.length - 1].created_at - 1; + if (!pageParam || pageParam === lastPageParam) + return undefined; + return pageParam; + }, + queryFn: ({ pageParam }) => __awaiter(void 0, void 0, void 0, function* () { + const notes = yield ndk.fetchEvents({ + kinds: [NDKKind.ChannelCreation], + authors: options === null || options === void 0 ? void 0 : options.authors, + search: options === null || options === void 0 ? void 0 : options.search, + until: pageParam || Math.round(Date.now() / 1000), + limit: 20, + }); + console.log('notes', notes); + return [...notes].filter((note) => note.tags.every((tag) => tag[0] !== 'e')); + }), + placeholderData: { pages: [], pageParams: [] }, + }); +}; diff --git a/packages/afk_nostr_sdk/hooks/channel/useChannels.ts b/packages/afk_nostr_sdk/src/hooks/channel/useChannels.ts similarity index 100% rename from packages/afk_nostr_sdk/hooks/channel/useChannels.ts rename to packages/afk_nostr_sdk/src/hooks/channel/useChannels.ts diff --git a/packages/afk_nostr_sdk/src/hooks/channel/useCreateChannel.js b/packages/afk_nostr_sdk/src/hooks/channel/useCreateChannel.js new file mode 100644 index 00000000..f9c21d9e --- /dev/null +++ b/packages/afk_nostr_sdk/src/hooks/channel/useCreateChannel.js @@ -0,0 +1,40 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk'; +import { useMutation } from '@tanstack/react-query'; +import { useAuth } from '../../store/auth'; +import { useNostrContext } from '../../context/NostrContext'; +export const useCreateChannel = () => { + const { ndk } = useNostrContext(); + const { publicKey } = useAuth(); + return useMutation({ + mutationKey: ['createChannel', ndk], + mutationFn: (data) => __awaiter(void 0, void 0, void 0, function* () { + var _a; + try { + const user = ndk.getUser({ pubkey: publicKey }); + // if (!user.profile) { + // throw new Error('Profile not found'); + // } + const event = new NDKEvent(ndk); + event.kind = NDKKind.ChannelCreation; + event.content = data.content; + event.author = user; + event.tags = (_a = data.tags) !== null && _a !== void 0 ? _a : []; + yield event.publish(); + return event; + } + catch (error) { + console.error('Error create channel', error); + throw error; + } + }), + }); +}; diff --git a/packages/afk_nostr_sdk/hooks/channel/useCreateChannel.ts b/packages/afk_nostr_sdk/src/hooks/channel/useCreateChannel.ts similarity index 100% rename from packages/afk_nostr_sdk/hooks/channel/useCreateChannel.ts rename to packages/afk_nostr_sdk/src/hooks/channel/useCreateChannel.ts diff --git a/packages/afk_nostr_sdk/src/hooks/channel/useMessagesChannel.js b/packages/afk_nostr_sdk/src/hooks/channel/useMessagesChannel.js new file mode 100644 index 00000000..5d79d79a --- /dev/null +++ b/packages/afk_nostr_sdk/src/hooks/channel/useMessagesChannel.js @@ -0,0 +1,39 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { NDKKind } from '@nostr-dev-kit/ndk'; +import { useInfiniteQuery } from '@tanstack/react-query'; +import { useNostrContext } from '../../context/NostrContext'; +export const useMessagesChannels = (options) => { + const { ndk } = useNostrContext(); + return useInfiniteQuery({ + initialPageParam: 0, + queryKey: ['messagesChannels', options === null || options === void 0 ? void 0 : options.noteId, options === null || options === void 0 ? void 0 : options.authors, options === null || options === void 0 ? void 0 : options.search, ndk], + getNextPageParam: (lastPage, allPages, lastPageParam) => { + if (!(lastPage === null || lastPage === void 0 ? void 0 : lastPage.length)) + return undefined; + const pageParam = lastPage[lastPage.length - 1].created_at - 1; + if (!pageParam || pageParam === lastPageParam) + return undefined; + return pageParam; + }, + queryFn: ({ pageParam }) => __awaiter(void 0, void 0, void 0, function* () { + const notes = yield ndk.fetchEvents({ + kinds: [NDKKind.ChannelMessage], + authors: options === null || options === void 0 ? void 0 : options.authors, + search: options === null || options === void 0 ? void 0 : options.search, + until: pageParam || Math.round(Date.now() / 1000), + limit: 20, + '#e': (options === null || options === void 0 ? void 0 : options.noteId) ? [options.noteId] : undefined, + }); + return [...notes].filter((note) => note.tags.every((tag) => tag[0] === 'e')); + }), + placeholderData: { pages: [], pageParams: [] }, + }); +}; diff --git a/packages/afk_nostr_sdk/hooks/channel/useMessagesChannel.ts b/packages/afk_nostr_sdk/src/hooks/channel/useMessagesChannel.ts similarity index 100% rename from packages/afk_nostr_sdk/hooks/channel/useMessagesChannel.ts rename to packages/afk_nostr_sdk/src/hooks/channel/useMessagesChannel.ts diff --git a/packages/afk_nostr_sdk/src/hooks/channel/useSendMessage.js b/packages/afk_nostr_sdk/src/hooks/channel/useSendMessage.js new file mode 100644 index 00000000..a28cdac5 --- /dev/null +++ b/packages/afk_nostr_sdk/src/hooks/channel/useSendMessage.js @@ -0,0 +1,26 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk'; +import { useMutation } from '@tanstack/react-query'; +import { useNostrContext } from '../../context/NostrContext'; +export const useSendMessageChannel = () => { + const { ndk } = useNostrContext(); + return useMutation({ + mutationKey: ['sendNoteChannel', ndk], + mutationFn: (data) => __awaiter(void 0, void 0, void 0, function* () { + var _a; + const event = new NDKEvent(ndk); + event.kind = NDKKind.ChannelMessage; + event.content = data.content; + event.tags = (_a = data.tags) !== null && _a !== void 0 ? _a : []; + return event.publish(); + }), + }); +}; diff --git a/packages/afk_nostr_sdk/hooks/channel/useSendMessage.ts b/packages/afk_nostr_sdk/src/hooks/channel/useSendMessage.ts similarity index 100% rename from packages/afk_nostr_sdk/hooks/channel/useSendMessage.ts rename to packages/afk_nostr_sdk/src/hooks/channel/useSendMessage.ts diff --git a/packages/afk_nostr_sdk/src/hooks/index.js b/packages/afk_nostr_sdk/src/hooks/index.js new file mode 100644 index 00000000..3baa0f83 --- /dev/null +++ b/packages/afk_nostr_sdk/src/hooks/index.js @@ -0,0 +1,14 @@ +export { useContacts } from './useContacts'; +export { useEditContacts } from './useEditContacts'; +export { useEditProfile } from './useEditProfile'; +export { useNote } from './useNote'; +export { useProfile } from './useProfile'; +export { useReact } from './useReact'; +export { useReactions } from './useReactions'; +export { useReplyNotes } from './useReplyNotes'; +export { useReposts } from './useReposts'; +export { useRootNotes } from './useRootNotes'; +export { useSendNote } from './useSendNote'; +export { useSearchUsers } from './search/useSearchUsers'; +export { useSearch } from './search/useSearch'; +export { useSearchNotes } from './useSearchNotes'; diff --git a/packages/afk_nostr_sdk/hooks/index.ts b/packages/afk_nostr_sdk/src/hooks/index.ts similarity index 100% rename from packages/afk_nostr_sdk/hooks/index.ts rename to packages/afk_nostr_sdk/src/hooks/index.ts diff --git a/packages/afk_nostr_sdk/src/hooks/messages/useSendPrivateMessage.js b/packages/afk_nostr_sdk/src/hooks/messages/useSendPrivateMessage.js new file mode 100644 index 00000000..c5f92ceb --- /dev/null +++ b/packages/afk_nostr_sdk/src/hooks/messages/useSendPrivateMessage.js @@ -0,0 +1,27 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { NDKEvent } from '@nostr-dev-kit/ndk'; +import { useMutation } from '@tanstack/react-query'; +import { useNostrContext } from '../../context/NostrContext'; +export const useSendPrivateMessage = () => { + const { ndk } = useNostrContext(); + return useMutation({ + mutationKey: ['sendPrivateMessage', ndk], + mutationFn: (data) => __awaiter(void 0, void 0, void 0, function* () { + var _a; + const event = new NDKEvent(ndk); + event.kind = 14; + // const encryptedContent = nip44 + event.content = data.content; + event.tags = (_a = data.tags) !== null && _a !== void 0 ? _a : []; + return event.publish(); + }), + }); +}; diff --git a/packages/afk_nostr_sdk/hooks/messages/useSendPrivateMessage.ts b/packages/afk_nostr_sdk/src/hooks/messages/useSendPrivateMessage.ts similarity index 99% rename from packages/afk_nostr_sdk/hooks/messages/useSendPrivateMessage.ts rename to packages/afk_nostr_sdk/src/hooks/messages/useSendPrivateMessage.ts index f241e3cf..88a6889d 100644 --- a/packages/afk_nostr_sdk/hooks/messages/useSendPrivateMessage.ts +++ b/packages/afk_nostr_sdk/src/hooks/messages/useSendPrivateMessage.ts @@ -2,6 +2,7 @@ import {NDKEvent} from '@nostr-dev-kit/ndk'; import {useMutation} from '@tanstack/react-query'; import {useNostrContext} from '../../context/NostrContext'; + export const useSendPrivateMessage = () => { const {ndk} = useNostrContext(); diff --git a/packages/afk_nostr_sdk/src/hooks/search/useSearch.js b/packages/afk_nostr_sdk/src/hooks/search/useSearch.js new file mode 100644 index 00000000..84095591 --- /dev/null +++ b/packages/afk_nostr_sdk/src/hooks/search/useSearch.js @@ -0,0 +1,44 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +// useSearchUsers.ts +import { NDKKind } from '@nostr-dev-kit/ndk'; +import { useInfiniteQuery } from '@tanstack/react-query'; +import { useNostrContext } from '../../context/NostrContext'; +export const useSearch = (options) => { + const { ndk } = useNostrContext(); + return useInfiniteQuery({ + initialPageParam: 0, + queryKey: ['search', options === null || options === void 0 ? void 0 : options.authors, options === null || options === void 0 ? void 0 : options.search, options === null || options === void 0 ? void 0 : options.kind, options === null || options === void 0 ? void 0 : options.kinds, ndk], + getNextPageParam: (lastPage, allPages, lastPageParam) => { + if (!(lastPage === null || lastPage === void 0 ? void 0 : lastPage.length)) + return undefined; + const pageParam = lastPage[lastPage.length - 1].created_at - 1; + if (!pageParam || pageParam === lastPageParam) + return undefined; + return pageParam; + }, + queryFn: ({ pageParam }) => __awaiter(void 0, void 0, void 0, function* () { + var _a, _b; + console.log('search query', options === null || options === void 0 ? void 0 : options.search); + const notes = yield ndk.fetchEvents({ + kinds: (_a = options === null || options === void 0 ? void 0 : options.kinds) !== null && _a !== void 0 ? _a : [(_b = options === null || options === void 0 ? void 0 : options.kind) !== null && _b !== void 0 ? _b : NDKKind.Text], + authors: options === null || options === void 0 ? void 0 : options.authors, + search: options === null || options === void 0 ? void 0 : options.search, + // content: options?.search, + until: pageParam || Math.round(Date.now() / 1000), + limit: 20, + }); + return [notes]; + // return [...notes].filter((note) => note.tags.every((tag) => tag[0] !== 'e')); + }), + placeholderData: { pages: [], pageParams: [] }, + }); +}; +export default useSearch; diff --git a/packages/afk_nostr_sdk/hooks/search/useSearch.tsx b/packages/afk_nostr_sdk/src/hooks/search/useSearch.tsx similarity index 100% rename from packages/afk_nostr_sdk/hooks/search/useSearch.tsx rename to packages/afk_nostr_sdk/src/hooks/search/useSearch.tsx diff --git a/packages/afk_nostr_sdk/src/hooks/search/useSearchUsers.js b/packages/afk_nostr_sdk/src/hooks/search/useSearchUsers.js new file mode 100644 index 00000000..e8799dad --- /dev/null +++ b/packages/afk_nostr_sdk/src/hooks/search/useSearchUsers.js @@ -0,0 +1,42 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +// useSearchUsers.ts +import { NDKKind } from '@nostr-dev-kit/ndk'; +import { useInfiniteQuery } from '@tanstack/react-query'; +import { useNostrContext } from '../../context/NostrContext'; +export const useSearchUsers = (options) => { + const { ndk } = useNostrContext(); + return useInfiniteQuery({ + initialPageParam: 0, + queryKey: ['search_user', options === null || options === void 0 ? void 0 : options.authors, options === null || options === void 0 ? void 0 : options.search, ndk], + getNextPageParam: (lastPage, allPages, lastPageParam) => { + if (!(lastPage === null || lastPage === void 0 ? void 0 : lastPage.length)) + return undefined; + const pageParam = lastPage[lastPage.length - 1].created_at - 1; + if (!pageParam || pageParam === lastPageParam) + return undefined; + return pageParam; + }, + queryFn: ({ pageParam }) => __awaiter(void 0, void 0, void 0, function* () { + var _a; + const notes = yield ndk.fetchEvents({ + kinds: [(_a = options === null || options === void 0 ? void 0 : options.kind) !== null && _a !== void 0 ? _a : NDKKind.Text], + authors: options === null || options === void 0 ? void 0 : options.authors, + search: options === null || options === void 0 ? void 0 : options.search, + until: pageParam || Math.round(Date.now() / 1000), + limit: 20, + }); + // return [...notes].filter((note) => note.tags.every((tag) => tag[0] !== 'e')); + return [...notes]; + }), + placeholderData: { pages: [], pageParams: [] }, + }); +}; +export default useSearchUsers; diff --git a/packages/afk_nostr_sdk/hooks/search/useSearchUsers.tsx b/packages/afk_nostr_sdk/src/hooks/search/useSearchUsers.tsx similarity index 99% rename from packages/afk_nostr_sdk/hooks/search/useSearchUsers.tsx rename to packages/afk_nostr_sdk/src/hooks/search/useSearchUsers.tsx index c1b7ac12..1fc9732c 100644 --- a/packages/afk_nostr_sdk/hooks/search/useSearchUsers.tsx +++ b/packages/afk_nostr_sdk/src/hooks/search/useSearchUsers.tsx @@ -1,7 +1,6 @@ // useSearchUsers.ts import {NDKKind} from '@nostr-dev-kit/ndk'; import {useInfiniteQuery} from '@tanstack/react-query'; - import {useNostrContext} from '../../context/NostrContext'; export type UseSearchUsers = { diff --git a/packages/afk_nostr_sdk/src/hooks/useContacts.js b/packages/afk_nostr_sdk/src/hooks/useContacts.js new file mode 100644 index 00000000..5f5535ae --- /dev/null +++ b/packages/afk_nostr_sdk/src/hooks/useContacts.js @@ -0,0 +1,28 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { NDKKind } from '@nostr-dev-kit/ndk'; +import { useQuery } from '@tanstack/react-query'; +import { useNostrContext } from '../context/NostrContext'; +export const useContacts = (options) => { + const { ndk } = useNostrContext(); + return useQuery({ + queryKey: ['contacts', options === null || options === void 0 ? void 0 : options.authors, options === null || options === void 0 ? void 0 : options.search, ndk], + queryFn: () => __awaiter(void 0, void 0, void 0, function* () { + var _a; + const contacts = yield ndk.fetchEvent({ + kinds: [NDKKind.Contacts], + authors: options === null || options === void 0 ? void 0 : options.authors, + search: options === null || options === void 0 ? void 0 : options.search, + }); + return (_a = contacts === null || contacts === void 0 ? void 0 : contacts.tags.filter((tag) => tag[0] === 'p').map((tag) => tag[1])) !== null && _a !== void 0 ? _a : []; + }), + placeholderData: [], + }); +}; diff --git a/packages/afk_nostr_sdk/hooks/useContacts.ts b/packages/afk_nostr_sdk/src/hooks/useContacts.ts similarity index 100% rename from packages/afk_nostr_sdk/hooks/useContacts.ts rename to packages/afk_nostr_sdk/src/hooks/useContacts.ts diff --git a/packages/afk_nostr_sdk/src/hooks/useEditContacts.js b/packages/afk_nostr_sdk/src/hooks/useEditContacts.js new file mode 100644 index 00000000..ec87422f --- /dev/null +++ b/packages/afk_nostr_sdk/src/hooks/useEditContacts.js @@ -0,0 +1,43 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk'; +import { useMutation } from '@tanstack/react-query'; +import { useNostrContext } from '../context/NostrContext'; +import { useAuth } from '../store/auth'; +export const useEditContacts = () => { + const { ndk } = useNostrContext(); + const { publicKey } = useAuth(); + return useMutation({ + mutationKey: ['editContacts', ndk], + mutationFn: (data) => __awaiter(void 0, void 0, void 0, function* () { + let contacts = yield ndk.fetchEvent({ + kinds: [NDKKind.Contacts], + authors: [publicKey], + }); + if (!contacts) { + contacts = new NDKEvent(ndk); + contacts.kind = NDKKind.Contacts; + contacts.content = ''; + contacts.tags = []; + } + // Resetting the id and created_at to avoid conflicts + contacts.id = undefined; + contacts.created_at = undefined; + if (data.type === 'add') { + contacts.tags.push(['p', data.pubkey, '', '']); + } + else { + contacts.tags = contacts.tags.filter((tag) => tag[1] !== data.pubkey); + } + yield contacts.sign(); + return contacts.publish(); + }), + }); +}; diff --git a/packages/afk_nostr_sdk/hooks/useEditContacts.ts b/packages/afk_nostr_sdk/src/hooks/useEditContacts.ts similarity index 99% rename from packages/afk_nostr_sdk/hooks/useEditContacts.ts rename to packages/afk_nostr_sdk/src/hooks/useEditContacts.ts index ffdda5f2..ac13b65b 100644 --- a/packages/afk_nostr_sdk/hooks/useEditContacts.ts +++ b/packages/afk_nostr_sdk/src/hooks/useEditContacts.ts @@ -1,6 +1,5 @@ import {NDKEvent, NDKKind} from '@nostr-dev-kit/ndk'; import {useMutation} from '@tanstack/react-query'; - import {useNostrContext} from '../context/NostrContext'; import {useAuth} from '../store/auth'; diff --git a/packages/afk_nostr_sdk/src/hooks/useEditProfile.js b/packages/afk_nostr_sdk/src/hooks/useEditProfile.js new file mode 100644 index 00000000..58015def --- /dev/null +++ b/packages/afk_nostr_sdk/src/hooks/useEditProfile.js @@ -0,0 +1,37 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { useMutation } from '@tanstack/react-query'; +// import {useNostrContext} from '../../context/NostrContext'; +// import {useAuth} from '../../store/auth'; +// import {useNostrContext} from '../context/NostrContext'; +import { useNostrContext } from '../context/NostrContext'; +import { useAuth } from '../store/auth'; +export const useEditProfile = () => { + const { ndk } = useNostrContext(); + const { publicKey } = useAuth(); + return useMutation({ + mutationKey: ['editProfile', ndk], + mutationFn: (data) => __awaiter(void 0, void 0, void 0, function* () { + try { + const user = ndk.getUser({ pubkey: publicKey }); + yield user.fetchProfile(); + if (!user.profile) { + throw new Error('Profile not found'); + } + user.profile = Object.assign(Object.assign({}, user.profile), data); + return user.publish(); + } + catch (error) { + console.error('Error editing profile', error); + throw error; + } + }), + }); +}; diff --git a/packages/afk_nostr_sdk/hooks/useEditProfile.ts b/packages/afk_nostr_sdk/src/hooks/useEditProfile.ts similarity index 100% rename from packages/afk_nostr_sdk/hooks/useEditProfile.ts rename to packages/afk_nostr_sdk/src/hooks/useEditProfile.ts index a9bece6d..d165e857 100644 --- a/packages/afk_nostr_sdk/hooks/useEditProfile.ts +++ b/packages/afk_nostr_sdk/src/hooks/useEditProfile.ts @@ -4,9 +4,9 @@ import {useMutation} from '@tanstack/react-query'; // import {useNostrContext} from '../../context/NostrContext'; // import {useAuth} from '../../store/auth'; // import {useNostrContext} from '../context/NostrContext'; - import {useNostrContext} from '../context/NostrContext'; + import {useAuth} from '../store/auth'; export const useEditProfile = () => { const {ndk} = useNostrContext(); diff --git a/packages/afk_nostr_sdk/src/hooks/useNote.js b/packages/afk_nostr_sdk/src/hooks/useNote.js new file mode 100644 index 00000000..8a2d1fce --- /dev/null +++ b/packages/afk_nostr_sdk/src/hooks/useNote.js @@ -0,0 +1,25 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { NDKKind } from '@nostr-dev-kit/ndk'; +import { useQuery } from '@tanstack/react-query'; +import { useNostrContext } from '../context/NostrContext'; +export const useNote = (options) => { + const { ndk } = useNostrContext(); + return useQuery({ + queryKey: ['note', options.noteId, ndk], + queryFn: () => __awaiter(void 0, void 0, void 0, function* () { + const note = yield ndk.fetchEvent({ + kinds: [NDKKind.Text], + ids: [options.noteId], + }); + return note !== null && note !== void 0 ? note : undefined; + }), + }); +}; diff --git a/packages/afk_nostr_sdk/hooks/useNote.ts b/packages/afk_nostr_sdk/src/hooks/useNote.ts similarity index 90% rename from packages/afk_nostr_sdk/hooks/useNote.ts rename to packages/afk_nostr_sdk/src/hooks/useNote.ts index 87609fd3..5a902d85 100644 --- a/packages/afk_nostr_sdk/hooks/useNote.ts +++ b/packages/afk_nostr_sdk/src/hooks/useNote.ts @@ -1,7 +1,6 @@ import {NDKKind} from '@nostr-dev-kit/ndk'; import {useQuery} from '@tanstack/react-query'; -// import {useNostrContext} from '../../context/NostrContext'; import {useNostrContext} from '../context/NostrContext'; import {useAuth} from '../store/auth'; diff --git a/packages/afk_nostr_sdk/src/hooks/useProfile.js b/packages/afk_nostr_sdk/src/hooks/useProfile.js new file mode 100644 index 00000000..709c701e --- /dev/null +++ b/packages/afk_nostr_sdk/src/hooks/useProfile.js @@ -0,0 +1,22 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { useQuery } from '@tanstack/react-query'; +import { useNostrContext } from '../context/NostrContext'; +export const useProfile = (options) => { + const { ndk } = useNostrContext(); + return useQuery({ + queryKey: ['profile', options.publicKey, ndk], + queryFn: () => __awaiter(void 0, void 0, void 0, function* () { + const user = ndk.getUser({ pubkey: options.publicKey }); + return user.fetchProfile(); + }), + placeholderData: {}, + }); +}; diff --git a/packages/afk_nostr_sdk/hooks/useProfile.ts b/packages/afk_nostr_sdk/src/hooks/useProfile.ts similarity index 82% rename from packages/afk_nostr_sdk/hooks/useProfile.ts rename to packages/afk_nostr_sdk/src/hooks/useProfile.ts index 9b0da55b..c28f99dd 100644 --- a/packages/afk_nostr_sdk/hooks/useProfile.ts +++ b/packages/afk_nostr_sdk/src/hooks/useProfile.ts @@ -1,10 +1,5 @@ import {useQuery} from '@tanstack/react-query'; - -// import {useNostrContext} from '../../context/NostrContext'; - import {useNostrContext} from '../context/NostrContext'; - -import {useAuth} from '../store/auth'; export type UseProfileOptions = { publicKey?: string; }; diff --git a/packages/afk_nostr_sdk/src/hooks/useReact.js b/packages/afk_nostr_sdk/src/hooks/useReact.js new file mode 100644 index 00000000..e8ba3347 --- /dev/null +++ b/packages/afk_nostr_sdk/src/hooks/useReact.js @@ -0,0 +1,30 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk'; +import { useMutation } from '@tanstack/react-query'; +import { useNostrContext } from '../context/NostrContext'; +export const useReact = () => { + const { ndk } = useNostrContext(); + return useMutation({ + mutationKey: ['react', ndk], + mutationFn: (data) => __awaiter(void 0, void 0, void 0, function* () { + var _a; + const event = new NDKEvent(ndk); + event.kind = NDKKind.Reaction; + event.content = data.type === 'like' ? '+' : '-'; + event.tags = [ + ['e', data.event.id], + ['p', data.event.pubkey], + ['k', ((_a = data.event.kind) !== null && _a !== void 0 ? _a : 1).toString()], + ]; + return event.publish(); + }), + }); +}; diff --git a/packages/afk_nostr_sdk/hooks/useReact.ts b/packages/afk_nostr_sdk/src/hooks/useReact.ts similarity index 99% rename from packages/afk_nostr_sdk/hooks/useReact.ts rename to packages/afk_nostr_sdk/src/hooks/useReact.ts index 88db5608..f0f2b34f 100644 --- a/packages/afk_nostr_sdk/hooks/useReact.ts +++ b/packages/afk_nostr_sdk/src/hooks/useReact.ts @@ -1,6 +1,5 @@ import {NDKEvent, NDKKind} from '@nostr-dev-kit/ndk'; import {useMutation} from '@tanstack/react-query'; - import {useNostrContext} from '../context/NostrContext'; export const useReact = () => { diff --git a/packages/afk_nostr_sdk/src/hooks/useReactions.js b/packages/afk_nostr_sdk/src/hooks/useReactions.js new file mode 100644 index 00000000..1e162918 --- /dev/null +++ b/packages/afk_nostr_sdk/src/hooks/useReactions.js @@ -0,0 +1,28 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { NDKKind } from '@nostr-dev-kit/ndk'; +import { useQuery } from '@tanstack/react-query'; +import { useNostrContext } from '../context/NostrContext'; +export const useReactions = (options) => { + const { ndk } = useNostrContext(); + return useQuery({ + queryKey: ['reactions', options === null || options === void 0 ? void 0 : options.noteId, options === null || options === void 0 ? void 0 : options.authors, options === null || options === void 0 ? void 0 : options.search, ndk], + queryFn: () => __awaiter(void 0, void 0, void 0, function* () { + const notes = yield ndk.fetchEvents({ + kinds: [NDKKind.Reaction], + authors: options === null || options === void 0 ? void 0 : options.authors, + search: options === null || options === void 0 ? void 0 : options.search, + '#e': (options === null || options === void 0 ? void 0 : options.noteId) ? [options.noteId] : undefined, + }); + return [...notes]; + }), + placeholderData: [], + }); +}; diff --git a/packages/afk_nostr_sdk/hooks/useReactions.ts b/packages/afk_nostr_sdk/src/hooks/useReactions.ts similarity index 99% rename from packages/afk_nostr_sdk/hooks/useReactions.ts rename to packages/afk_nostr_sdk/src/hooks/useReactions.ts index 78f12c3a..05b0c9d3 100644 --- a/packages/afk_nostr_sdk/hooks/useReactions.ts +++ b/packages/afk_nostr_sdk/src/hooks/useReactions.ts @@ -1,6 +1,5 @@ import {NDKKind} from '@nostr-dev-kit/ndk'; import {useQuery} from '@tanstack/react-query'; - import {useNostrContext} from '../context/NostrContext'; export type UseReactionsOptions = { diff --git a/packages/afk_nostr_sdk/src/hooks/useReplyNotes.js b/packages/afk_nostr_sdk/src/hooks/useReplyNotes.js new file mode 100644 index 00000000..80a7a149 --- /dev/null +++ b/packages/afk_nostr_sdk/src/hooks/useReplyNotes.js @@ -0,0 +1,39 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { NDKKind } from '@nostr-dev-kit/ndk'; +import { useInfiniteQuery } from '@tanstack/react-query'; +import { useNostrContext } from '../context/NostrContext'; +export const useReplyNotes = (options) => { + const { ndk } = useNostrContext(); + return useInfiniteQuery({ + initialPageParam: 0, + queryKey: ['replyNotes', options === null || options === void 0 ? void 0 : options.noteId, options === null || options === void 0 ? void 0 : options.authors, options === null || options === void 0 ? void 0 : options.search, ndk], + getNextPageParam: (lastPage, allPages, lastPageParam) => { + if (!(lastPage === null || lastPage === void 0 ? void 0 : lastPage.length)) + return undefined; + const pageParam = lastPage[lastPage.length - 1].created_at - 1; + if (!pageParam || pageParam === lastPageParam) + return undefined; + return pageParam; + }, + queryFn: ({ pageParam }) => __awaiter(void 0, void 0, void 0, function* () { + const notes = yield ndk.fetchEvents({ + kinds: [NDKKind.Text], + authors: options === null || options === void 0 ? void 0 : options.authors, + search: options === null || options === void 0 ? void 0 : options.search, + until: pageParam || Math.round(Date.now() / 1000), + limit: 20, + '#e': (options === null || options === void 0 ? void 0 : options.noteId) ? [options.noteId] : undefined, + }); + return [...notes].filter((note) => note.tags.every((tag) => tag[0] === 'e')); + }), + placeholderData: { pages: [], pageParams: [] }, + }); +}; diff --git a/packages/afk_nostr_sdk/hooks/useReplyNotes.ts b/packages/afk_nostr_sdk/src/hooks/useReplyNotes.ts similarity index 100% rename from packages/afk_nostr_sdk/hooks/useReplyNotes.ts rename to packages/afk_nostr_sdk/src/hooks/useReplyNotes.ts diff --git a/packages/afk_nostr_sdk/src/hooks/useReposts.js b/packages/afk_nostr_sdk/src/hooks/useReposts.js new file mode 100644 index 00000000..685538a2 --- /dev/null +++ b/packages/afk_nostr_sdk/src/hooks/useReposts.js @@ -0,0 +1,38 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { NDKKind } from '@nostr-dev-kit/ndk'; +import { useInfiniteQuery } from '@tanstack/react-query'; +import { useNostrContext } from '../context/NostrContext'; +export const useReposts = (options) => { + const { ndk } = useNostrContext(); + return useInfiniteQuery({ + initialPageParam: 0, + queryKey: ['reposts', options === null || options === void 0 ? void 0 : options.authors, options === null || options === void 0 ? void 0 : options.search, ndk], + getNextPageParam: (lastPage, allPages, lastPageParam) => { + if (!(lastPage === null || lastPage === void 0 ? void 0 : lastPage.length)) + return undefined; + const pageParam = lastPage[lastPage.length - 1].created_at - 1; + if (!pageParam || pageParam === lastPageParam) + return undefined; + return pageParam; + }, + queryFn: ({ pageParam }) => __awaiter(void 0, void 0, void 0, function* () { + const reposts = yield ndk.fetchEvents({ + kinds: [NDKKind.Repost], + authors: options === null || options === void 0 ? void 0 : options.authors, + search: options === null || options === void 0 ? void 0 : options.search, + until: pageParam || Math.round(Date.now() / 1000), + limit: 20, + }); + return [...reposts]; + }), + placeholderData: { pages: [], pageParams: [] }, + }); +}; diff --git a/packages/afk_nostr_sdk/hooks/useReposts.ts b/packages/afk_nostr_sdk/src/hooks/useReposts.ts similarity index 99% rename from packages/afk_nostr_sdk/hooks/useReposts.ts rename to packages/afk_nostr_sdk/src/hooks/useReposts.ts index c6a4c4f4..1e5afee9 100644 --- a/packages/afk_nostr_sdk/hooks/useReposts.ts +++ b/packages/afk_nostr_sdk/src/hooks/useReposts.ts @@ -1,6 +1,5 @@ import {NDKKind} from '@nostr-dev-kit/ndk'; import {useInfiniteQuery} from '@tanstack/react-query'; - import {useNostrContext} from '../context/NostrContext'; export type UseRepostsOptions = { diff --git a/packages/afk_nostr_sdk/src/hooks/useRootNotes.js b/packages/afk_nostr_sdk/src/hooks/useRootNotes.js new file mode 100644 index 00000000..1462b603 --- /dev/null +++ b/packages/afk_nostr_sdk/src/hooks/useRootNotes.js @@ -0,0 +1,38 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { NDKKind } from '@nostr-dev-kit/ndk'; +import { useInfiniteQuery } from '@tanstack/react-query'; +import { useNostrContext } from '../context/NostrContext'; +export const useRootNotes = (options) => { + const { ndk } = useNostrContext(); + return useInfiniteQuery({ + initialPageParam: 0, + queryKey: ['rootNotes', options === null || options === void 0 ? void 0 : options.authors, options === null || options === void 0 ? void 0 : options.search, ndk], + getNextPageParam: (lastPage, allPages, lastPageParam) => { + if (!(lastPage === null || lastPage === void 0 ? void 0 : lastPage.length)) + return undefined; + const pageParam = lastPage[lastPage.length - 1].created_at - 1; + if (!pageParam || pageParam === lastPageParam) + return undefined; + return pageParam; + }, + queryFn: ({ pageParam }) => __awaiter(void 0, void 0, void 0, function* () { + const notes = yield ndk.fetchEvents({ + kinds: [NDKKind.Text, NDKKind.ChannelMetadata], + authors: options === null || options === void 0 ? void 0 : options.authors, + search: options === null || options === void 0 ? void 0 : options.search, + until: pageParam || Math.round(Date.now() / 1000), + limit: 20, + }); + return [...notes].filter((note) => note.tags.every((tag) => tag[0] !== 'e')); + }), + placeholderData: { pages: [], pageParams: [] }, + }); +}; diff --git a/packages/afk_nostr_sdk/hooks/useRootNotes.ts b/packages/afk_nostr_sdk/src/hooks/useRootNotes.ts similarity index 100% rename from packages/afk_nostr_sdk/hooks/useRootNotes.ts rename to packages/afk_nostr_sdk/src/hooks/useRootNotes.ts diff --git a/packages/afk_nostr_sdk/src/hooks/useSearchNotes.js b/packages/afk_nostr_sdk/src/hooks/useSearchNotes.js new file mode 100644 index 00000000..eb75e83f --- /dev/null +++ b/packages/afk_nostr_sdk/src/hooks/useSearchNotes.js @@ -0,0 +1,39 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { NDKKind } from '@nostr-dev-kit/ndk'; +import { useInfiniteQuery } from '@tanstack/react-query'; +import { useNostrContext } from '../context/NostrContext'; +export const useSearchNotes = (options) => { + const { ndk } = useNostrContext(); + return useInfiniteQuery({ + initialPageParam: 0, + queryKey: ['searchNotes', options === null || options === void 0 ? void 0 : options.authors, options === null || options === void 0 ? void 0 : options.search, options === null || options === void 0 ? void 0 : options.kinds, ndk], + getNextPageParam: (lastPage, allPages, lastPageParam) => { + if (!(lastPage === null || lastPage === void 0 ? void 0 : lastPage.length)) + return undefined; + const pageParam = lastPage[lastPage.length - 1].created_at - 1; + if (!pageParam || pageParam === lastPageParam) + return undefined; + return pageParam; + }, + queryFn: ({ pageParam }) => __awaiter(void 0, void 0, void 0, function* () { + var _a; + const notes = yield ndk.fetchEvents({ + kinds: (_a = options === null || options === void 0 ? void 0 : options.kinds) !== null && _a !== void 0 ? _a : [NDKKind.Text], + authors: options === null || options === void 0 ? void 0 : options.authors, + search: options === null || options === void 0 ? void 0 : options.search, + until: pageParam || Math.round(Date.now() / 1000), + limit: 20, + }); + return [...notes].filter((note) => note.tags.every((tag) => tag[0] !== 'e')); + }), + placeholderData: { pages: [], pageParams: [] }, + }); +}; diff --git a/packages/afk_nostr_sdk/hooks/useSearchNotes.ts b/packages/afk_nostr_sdk/src/hooks/useSearchNotes.ts similarity index 99% rename from packages/afk_nostr_sdk/hooks/useSearchNotes.ts rename to packages/afk_nostr_sdk/src/hooks/useSearchNotes.ts index acc7751a..b1d40536 100644 --- a/packages/afk_nostr_sdk/hooks/useSearchNotes.ts +++ b/packages/afk_nostr_sdk/src/hooks/useSearchNotes.ts @@ -1,6 +1,5 @@ import {NDKKind} from '@nostr-dev-kit/ndk'; import {useInfiniteQuery} from '@tanstack/react-query'; - import {useNostrContext} from '../context/NostrContext'; export type UseRootNotesOptions = { diff --git a/packages/afk_nostr_sdk/src/hooks/useSendNote.js b/packages/afk_nostr_sdk/src/hooks/useSendNote.js new file mode 100644 index 00000000..7cb1d176 --- /dev/null +++ b/packages/afk_nostr_sdk/src/hooks/useSendNote.js @@ -0,0 +1,26 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk'; +import { useMutation } from '@tanstack/react-query'; +import { useNostrContext } from '../context/NostrContext'; +export const useSendNote = () => { + const { ndk } = useNostrContext(); + return useMutation({ + mutationKey: ['sendNote', ndk], + mutationFn: (data) => __awaiter(void 0, void 0, void 0, function* () { + var _a; + const event = new NDKEvent(ndk); + event.kind = NDKKind.Text; + event.content = data.content; + event.tags = (_a = data.tags) !== null && _a !== void 0 ? _a : []; + return event.publish(); + }), + }); +}; diff --git a/packages/afk_nostr_sdk/hooks/useSendNote.ts b/packages/afk_nostr_sdk/src/hooks/useSendNote.ts similarity index 80% rename from packages/afk_nostr_sdk/hooks/useSendNote.ts rename to packages/afk_nostr_sdk/src/hooks/useSendNote.ts index f674c94f..a9e73eb5 100644 --- a/packages/afk_nostr_sdk/hooks/useSendNote.ts +++ b/packages/afk_nostr_sdk/src/hooks/useSendNote.ts @@ -1,8 +1,6 @@ import {NDKEvent, NDKKind} from '@nostr-dev-kit/ndk'; import {useMutation} from '@tanstack/react-query'; -import { useNostrContext } from '../context/NostrContext'; - -// import {useNostrContext} from '../context/NostrContext'; +import {useNostrContext} from '../context/NostrContext'; export const useSendNote = () => { const {ndk} = useNostrContext(); diff --git a/packages/afk_nostr_sdk/src/store/auth.js b/packages/afk_nostr_sdk/src/store/auth.js new file mode 100644 index 00000000..8c25920b --- /dev/null +++ b/packages/afk_nostr_sdk/src/store/auth.js @@ -0,0 +1,12 @@ +import { createStore } from 'zustand'; +import createBoundedUseStore from './createBoundedUseStore'; +export const authStore = createStore((set, get) => ({ + // publicKey and privateKey are set to undefined but we know they are strings + // so we can cast them as strings without hassle in the app + publicKey: undefined, + privateKey: undefined, + setAuth: (publicKey, privateKey) => { + set({ publicKey, privateKey }); + }, +})); +export const useAuth = createBoundedUseStore(authStore); diff --git a/packages/afk_nostr_sdk/store/auth.ts b/packages/afk_nostr_sdk/src/store/auth.ts similarity index 100% rename from packages/afk_nostr_sdk/store/auth.ts rename to packages/afk_nostr_sdk/src/store/auth.ts diff --git a/packages/afk_nostr_sdk/src/store/createBoundedUseStore.js b/packages/afk_nostr_sdk/src/store/createBoundedUseStore.js new file mode 100644 index 00000000..7bff1d23 --- /dev/null +++ b/packages/afk_nostr_sdk/src/store/createBoundedUseStore.js @@ -0,0 +1,6 @@ +import { useStore } from 'zustand'; +/* This code defines a function called `createBoundedUseStore` that takes a `store` object of type +`StoreApi` as its argument. The function returns a function that can be used to access the +state of the `store` object from inside a React component. */ +const createBoundedUseStore = ((store) => (selector, equals) => useStore(store, selector, equals)); +export default createBoundedUseStore; diff --git a/packages/afk_nostr_sdk/store/createBoundedUseStore.ts b/packages/afk_nostr_sdk/src/store/createBoundedUseStore.ts similarity index 100% rename from packages/afk_nostr_sdk/store/createBoundedUseStore.ts rename to packages/afk_nostr_sdk/src/store/createBoundedUseStore.ts diff --git a/packages/afk_nostr_sdk/src/utils/relay.js b/packages/afk_nostr_sdk/src/utils/relay.js new file mode 100644 index 00000000..3478132f --- /dev/null +++ b/packages/afk_nostr_sdk/src/utils/relay.js @@ -0,0 +1,17 @@ +export const RELAYS_PROD = ['wss://relay.n057r.club', 'wss://relay.nostr.net']; +export const AFK_RELAYS = process.env.EXPO_NODE_ENV == 'production' || process.env.NODE_ENV == 'production' + ? [ + // 'wss://nostr.joyboy.community', + 'wss://nostr-relay-nestjs-production.up.railway.app', + // 'ws://localhost:3000', // comment if you don't run a relayer in localhost + ] + : [ + // 'wss://nostr.joyboy.community', + // 'ws://nostr-relay-nestjs-production.up.railway.app', + 'wss://nostr-relay-nestjs-production.up.railway.app', + // 'ws://localhost:8080', // comment if you don't run a relayer in localhost + ]; +// export const AFK_RELAYS = [ +// 'wss://nostr.joyboy.community', +// // 'ws://localhost:3000', // comment if you don't run a relayer in localhost +// ]; diff --git a/packages/afk_nostr_sdk/utils/relay.ts b/packages/afk_nostr_sdk/src/utils/relay.ts similarity index 100% rename from packages/afk_nostr_sdk/utils/relay.ts rename to packages/afk_nostr_sdk/src/utils/relay.ts diff --git a/packages/afk_nostr_sdk/tsconfig copy.json b/packages/afk_nostr_sdk/tsconfig copy.json new file mode 100644 index 00000000..fb1fcf14 --- /dev/null +++ b/packages/afk_nostr_sdk/tsconfig copy.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "target": "ESNext", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "noEmit": true, + "esModuleInterop": true, + "resolveJsonModule": true, + "isolatedModules": true, + "downlevelIteration": true, + "allowSyntheticDefaultImports": true, + "module": "ES6", + "moduleResolution": "node", + "outDir": "./dist", + "jsx": "react", // Add this line for React projects + }, + "exclude": ["node_modules", "dist", "babel.config.js", "metro.config.js", "jest.config.js"], + "include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "next-env.d.ts",] +} diff --git a/packages/afk_nostr_sdk/tsconfig.json b/packages/afk_nostr_sdk/tsconfig.json index fb1fcf14..6400b0c2 100644 --- a/packages/afk_nostr_sdk/tsconfig.json +++ b/packages/afk_nostr_sdk/tsconfig.json @@ -1,20 +1,23 @@ { "compilerOptions": { - "target": "ESNext", + "target": "ES6", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, - "noEmit": true, "esModuleInterop": true, - "resolveJsonModule": true, - "isolatedModules": true, - "downlevelIteration": true, "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "noFallthroughCasesInSwitch": true, "module": "ES6", "moduleResolution": "node", - "outDir": "./dist", - "jsx": "react", // Add this line for React projects + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "react-jsx", // Use the new JSX transform + "baseUrl": ".", + "paths": { + "@/*": ["src/*"] + } }, - "exclude": ["node_modules", "dist", "babel.config.js", "metro.config.js", "jest.config.js"], - "include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "next-env.d.ts",] + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], + "exclude": ["node_modules"] } From c7b6145145f19b2c0fb5068ee5fa86a0960829e0 Mon Sep 17 00:00:00 2001 From: MSGhais Date: Thu, 8 Aug 2024 16:59:27 +0200 Subject: [PATCH 10/16] fix dist build --- packages/afk_nostr_sdk/.gitignore | 2 + .../src/hooks/channel/useChannels.js | 39 ---------------- .../src/hooks/channel/useCreateChannel.js | 40 ----------------- .../src/hooks/channel/useMessagesChannel.js | 39 ---------------- .../src/hooks/channel/useSendMessage.js | 26 ----------- packages/afk_nostr_sdk/src/hooks/index.js | 14 ------ .../hooks/messages/useSendPrivateMessage.js | 27 ------------ .../src/hooks/search/useSearch.js | 44 ------------------- .../src/hooks/search/useSearchUsers.js | 42 ------------------ .../afk_nostr_sdk/src/hooks/useContacts.js | 28 ------------ .../src/hooks/useEditContacts.js | 43 ------------------ .../afk_nostr_sdk/src/hooks/useEditProfile.js | 37 ---------------- packages/afk_nostr_sdk/src/hooks/useNote.js | 25 ----------- .../afk_nostr_sdk/src/hooks/useProfile.js | 22 ---------- packages/afk_nostr_sdk/src/hooks/useReact.js | 30 ------------- .../afk_nostr_sdk/src/hooks/useReactions.js | 28 ------------ .../afk_nostr_sdk/src/hooks/useReplyNotes.js | 39 ---------------- .../afk_nostr_sdk/src/hooks/useReposts.js | 38 ---------------- .../afk_nostr_sdk/src/hooks/useRootNotes.js | 38 ---------------- .../afk_nostr_sdk/src/hooks/useSearchNotes.js | 39 ---------------- .../afk_nostr_sdk/src/hooks/useSendNote.js | 26 ----------- packages/afk_nostr_sdk/src/store/auth.js | 12 ----- .../src/store/createBoundedUseStore.js | 6 --- packages/afk_nostr_sdk/tsconfig.json | 3 +- 24 files changed, 4 insertions(+), 683 deletions(-) delete mode 100644 packages/afk_nostr_sdk/src/hooks/channel/useChannels.js delete mode 100644 packages/afk_nostr_sdk/src/hooks/channel/useCreateChannel.js delete mode 100644 packages/afk_nostr_sdk/src/hooks/channel/useMessagesChannel.js delete mode 100644 packages/afk_nostr_sdk/src/hooks/channel/useSendMessage.js delete mode 100644 packages/afk_nostr_sdk/src/hooks/index.js delete mode 100644 packages/afk_nostr_sdk/src/hooks/messages/useSendPrivateMessage.js delete mode 100644 packages/afk_nostr_sdk/src/hooks/search/useSearch.js delete mode 100644 packages/afk_nostr_sdk/src/hooks/search/useSearchUsers.js delete mode 100644 packages/afk_nostr_sdk/src/hooks/useContacts.js delete mode 100644 packages/afk_nostr_sdk/src/hooks/useEditContacts.js delete mode 100644 packages/afk_nostr_sdk/src/hooks/useEditProfile.js delete mode 100644 packages/afk_nostr_sdk/src/hooks/useNote.js delete mode 100644 packages/afk_nostr_sdk/src/hooks/useProfile.js delete mode 100644 packages/afk_nostr_sdk/src/hooks/useReact.js delete mode 100644 packages/afk_nostr_sdk/src/hooks/useReactions.js delete mode 100644 packages/afk_nostr_sdk/src/hooks/useReplyNotes.js delete mode 100644 packages/afk_nostr_sdk/src/hooks/useReposts.js delete mode 100644 packages/afk_nostr_sdk/src/hooks/useRootNotes.js delete mode 100644 packages/afk_nostr_sdk/src/hooks/useSearchNotes.js delete mode 100644 packages/afk_nostr_sdk/src/hooks/useSendNote.js delete mode 100644 packages/afk_nostr_sdk/src/store/auth.js delete mode 100644 packages/afk_nostr_sdk/src/store/createBoundedUseStore.js diff --git a/packages/afk_nostr_sdk/.gitignore b/packages/afk_nostr_sdk/.gitignore index c3cdd2dc..b5660b44 100644 --- a/packages/afk_nostr_sdk/.gitignore +++ b/packages/afk_nostr_sdk/.gitignore @@ -18,3 +18,5 @@ Cargo.lock /node_modules node_modules/ + +/dist diff --git a/packages/afk_nostr_sdk/src/hooks/channel/useChannels.js b/packages/afk_nostr_sdk/src/hooks/channel/useChannels.js deleted file mode 100644 index 1ad8ed8b..00000000 --- a/packages/afk_nostr_sdk/src/hooks/channel/useChannels.js +++ /dev/null @@ -1,39 +0,0 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -import { NDKKind } from '@nostr-dev-kit/ndk'; -import { useInfiniteQuery } from '@tanstack/react-query'; -import { useNostrContext } from '../../context/NostrContext'; -export const useChannels = (options) => { - const { ndk } = useNostrContext(); - return useInfiniteQuery({ - initialPageParam: 0, - queryKey: ['channels', options === null || options === void 0 ? void 0 : options.authors, options === null || options === void 0 ? void 0 : options.search, ndk], - getNextPageParam: (lastPage, allPages, lastPageParam) => { - if (!(lastPage === null || lastPage === void 0 ? void 0 : lastPage.length)) - return undefined; - const pageParam = lastPage[lastPage.length - 1].created_at - 1; - if (!pageParam || pageParam === lastPageParam) - return undefined; - return pageParam; - }, - queryFn: ({ pageParam }) => __awaiter(void 0, void 0, void 0, function* () { - const notes = yield ndk.fetchEvents({ - kinds: [NDKKind.ChannelCreation], - authors: options === null || options === void 0 ? void 0 : options.authors, - search: options === null || options === void 0 ? void 0 : options.search, - until: pageParam || Math.round(Date.now() / 1000), - limit: 20, - }); - console.log('notes', notes); - return [...notes].filter((note) => note.tags.every((tag) => tag[0] !== 'e')); - }), - placeholderData: { pages: [], pageParams: [] }, - }); -}; diff --git a/packages/afk_nostr_sdk/src/hooks/channel/useCreateChannel.js b/packages/afk_nostr_sdk/src/hooks/channel/useCreateChannel.js deleted file mode 100644 index f9c21d9e..00000000 --- a/packages/afk_nostr_sdk/src/hooks/channel/useCreateChannel.js +++ /dev/null @@ -1,40 +0,0 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk'; -import { useMutation } from '@tanstack/react-query'; -import { useAuth } from '../../store/auth'; -import { useNostrContext } from '../../context/NostrContext'; -export const useCreateChannel = () => { - const { ndk } = useNostrContext(); - const { publicKey } = useAuth(); - return useMutation({ - mutationKey: ['createChannel', ndk], - mutationFn: (data) => __awaiter(void 0, void 0, void 0, function* () { - var _a; - try { - const user = ndk.getUser({ pubkey: publicKey }); - // if (!user.profile) { - // throw new Error('Profile not found'); - // } - const event = new NDKEvent(ndk); - event.kind = NDKKind.ChannelCreation; - event.content = data.content; - event.author = user; - event.tags = (_a = data.tags) !== null && _a !== void 0 ? _a : []; - yield event.publish(); - return event; - } - catch (error) { - console.error('Error create channel', error); - throw error; - } - }), - }); -}; diff --git a/packages/afk_nostr_sdk/src/hooks/channel/useMessagesChannel.js b/packages/afk_nostr_sdk/src/hooks/channel/useMessagesChannel.js deleted file mode 100644 index 5d79d79a..00000000 --- a/packages/afk_nostr_sdk/src/hooks/channel/useMessagesChannel.js +++ /dev/null @@ -1,39 +0,0 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -import { NDKKind } from '@nostr-dev-kit/ndk'; -import { useInfiniteQuery } from '@tanstack/react-query'; -import { useNostrContext } from '../../context/NostrContext'; -export const useMessagesChannels = (options) => { - const { ndk } = useNostrContext(); - return useInfiniteQuery({ - initialPageParam: 0, - queryKey: ['messagesChannels', options === null || options === void 0 ? void 0 : options.noteId, options === null || options === void 0 ? void 0 : options.authors, options === null || options === void 0 ? void 0 : options.search, ndk], - getNextPageParam: (lastPage, allPages, lastPageParam) => { - if (!(lastPage === null || lastPage === void 0 ? void 0 : lastPage.length)) - return undefined; - const pageParam = lastPage[lastPage.length - 1].created_at - 1; - if (!pageParam || pageParam === lastPageParam) - return undefined; - return pageParam; - }, - queryFn: ({ pageParam }) => __awaiter(void 0, void 0, void 0, function* () { - const notes = yield ndk.fetchEvents({ - kinds: [NDKKind.ChannelMessage], - authors: options === null || options === void 0 ? void 0 : options.authors, - search: options === null || options === void 0 ? void 0 : options.search, - until: pageParam || Math.round(Date.now() / 1000), - limit: 20, - '#e': (options === null || options === void 0 ? void 0 : options.noteId) ? [options.noteId] : undefined, - }); - return [...notes].filter((note) => note.tags.every((tag) => tag[0] === 'e')); - }), - placeholderData: { pages: [], pageParams: [] }, - }); -}; diff --git a/packages/afk_nostr_sdk/src/hooks/channel/useSendMessage.js b/packages/afk_nostr_sdk/src/hooks/channel/useSendMessage.js deleted file mode 100644 index a28cdac5..00000000 --- a/packages/afk_nostr_sdk/src/hooks/channel/useSendMessage.js +++ /dev/null @@ -1,26 +0,0 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk'; -import { useMutation } from '@tanstack/react-query'; -import { useNostrContext } from '../../context/NostrContext'; -export const useSendMessageChannel = () => { - const { ndk } = useNostrContext(); - return useMutation({ - mutationKey: ['sendNoteChannel', ndk], - mutationFn: (data) => __awaiter(void 0, void 0, void 0, function* () { - var _a; - const event = new NDKEvent(ndk); - event.kind = NDKKind.ChannelMessage; - event.content = data.content; - event.tags = (_a = data.tags) !== null && _a !== void 0 ? _a : []; - return event.publish(); - }), - }); -}; diff --git a/packages/afk_nostr_sdk/src/hooks/index.js b/packages/afk_nostr_sdk/src/hooks/index.js deleted file mode 100644 index 3baa0f83..00000000 --- a/packages/afk_nostr_sdk/src/hooks/index.js +++ /dev/null @@ -1,14 +0,0 @@ -export { useContacts } from './useContacts'; -export { useEditContacts } from './useEditContacts'; -export { useEditProfile } from './useEditProfile'; -export { useNote } from './useNote'; -export { useProfile } from './useProfile'; -export { useReact } from './useReact'; -export { useReactions } from './useReactions'; -export { useReplyNotes } from './useReplyNotes'; -export { useReposts } from './useReposts'; -export { useRootNotes } from './useRootNotes'; -export { useSendNote } from './useSendNote'; -export { useSearchUsers } from './search/useSearchUsers'; -export { useSearch } from './search/useSearch'; -export { useSearchNotes } from './useSearchNotes'; diff --git a/packages/afk_nostr_sdk/src/hooks/messages/useSendPrivateMessage.js b/packages/afk_nostr_sdk/src/hooks/messages/useSendPrivateMessage.js deleted file mode 100644 index c5f92ceb..00000000 --- a/packages/afk_nostr_sdk/src/hooks/messages/useSendPrivateMessage.js +++ /dev/null @@ -1,27 +0,0 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -import { NDKEvent } from '@nostr-dev-kit/ndk'; -import { useMutation } from '@tanstack/react-query'; -import { useNostrContext } from '../../context/NostrContext'; -export const useSendPrivateMessage = () => { - const { ndk } = useNostrContext(); - return useMutation({ - mutationKey: ['sendPrivateMessage', ndk], - mutationFn: (data) => __awaiter(void 0, void 0, void 0, function* () { - var _a; - const event = new NDKEvent(ndk); - event.kind = 14; - // const encryptedContent = nip44 - event.content = data.content; - event.tags = (_a = data.tags) !== null && _a !== void 0 ? _a : []; - return event.publish(); - }), - }); -}; diff --git a/packages/afk_nostr_sdk/src/hooks/search/useSearch.js b/packages/afk_nostr_sdk/src/hooks/search/useSearch.js deleted file mode 100644 index 84095591..00000000 --- a/packages/afk_nostr_sdk/src/hooks/search/useSearch.js +++ /dev/null @@ -1,44 +0,0 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -// useSearchUsers.ts -import { NDKKind } from '@nostr-dev-kit/ndk'; -import { useInfiniteQuery } from '@tanstack/react-query'; -import { useNostrContext } from '../../context/NostrContext'; -export const useSearch = (options) => { - const { ndk } = useNostrContext(); - return useInfiniteQuery({ - initialPageParam: 0, - queryKey: ['search', options === null || options === void 0 ? void 0 : options.authors, options === null || options === void 0 ? void 0 : options.search, options === null || options === void 0 ? void 0 : options.kind, options === null || options === void 0 ? void 0 : options.kinds, ndk], - getNextPageParam: (lastPage, allPages, lastPageParam) => { - if (!(lastPage === null || lastPage === void 0 ? void 0 : lastPage.length)) - return undefined; - const pageParam = lastPage[lastPage.length - 1].created_at - 1; - if (!pageParam || pageParam === lastPageParam) - return undefined; - return pageParam; - }, - queryFn: ({ pageParam }) => __awaiter(void 0, void 0, void 0, function* () { - var _a, _b; - console.log('search query', options === null || options === void 0 ? void 0 : options.search); - const notes = yield ndk.fetchEvents({ - kinds: (_a = options === null || options === void 0 ? void 0 : options.kinds) !== null && _a !== void 0 ? _a : [(_b = options === null || options === void 0 ? void 0 : options.kind) !== null && _b !== void 0 ? _b : NDKKind.Text], - authors: options === null || options === void 0 ? void 0 : options.authors, - search: options === null || options === void 0 ? void 0 : options.search, - // content: options?.search, - until: pageParam || Math.round(Date.now() / 1000), - limit: 20, - }); - return [notes]; - // return [...notes].filter((note) => note.tags.every((tag) => tag[0] !== 'e')); - }), - placeholderData: { pages: [], pageParams: [] }, - }); -}; -export default useSearch; diff --git a/packages/afk_nostr_sdk/src/hooks/search/useSearchUsers.js b/packages/afk_nostr_sdk/src/hooks/search/useSearchUsers.js deleted file mode 100644 index e8799dad..00000000 --- a/packages/afk_nostr_sdk/src/hooks/search/useSearchUsers.js +++ /dev/null @@ -1,42 +0,0 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -// useSearchUsers.ts -import { NDKKind } from '@nostr-dev-kit/ndk'; -import { useInfiniteQuery } from '@tanstack/react-query'; -import { useNostrContext } from '../../context/NostrContext'; -export const useSearchUsers = (options) => { - const { ndk } = useNostrContext(); - return useInfiniteQuery({ - initialPageParam: 0, - queryKey: ['search_user', options === null || options === void 0 ? void 0 : options.authors, options === null || options === void 0 ? void 0 : options.search, ndk], - getNextPageParam: (lastPage, allPages, lastPageParam) => { - if (!(lastPage === null || lastPage === void 0 ? void 0 : lastPage.length)) - return undefined; - const pageParam = lastPage[lastPage.length - 1].created_at - 1; - if (!pageParam || pageParam === lastPageParam) - return undefined; - return pageParam; - }, - queryFn: ({ pageParam }) => __awaiter(void 0, void 0, void 0, function* () { - var _a; - const notes = yield ndk.fetchEvents({ - kinds: [(_a = options === null || options === void 0 ? void 0 : options.kind) !== null && _a !== void 0 ? _a : NDKKind.Text], - authors: options === null || options === void 0 ? void 0 : options.authors, - search: options === null || options === void 0 ? void 0 : options.search, - until: pageParam || Math.round(Date.now() / 1000), - limit: 20, - }); - // return [...notes].filter((note) => note.tags.every((tag) => tag[0] !== 'e')); - return [...notes]; - }), - placeholderData: { pages: [], pageParams: [] }, - }); -}; -export default useSearchUsers; diff --git a/packages/afk_nostr_sdk/src/hooks/useContacts.js b/packages/afk_nostr_sdk/src/hooks/useContacts.js deleted file mode 100644 index 5f5535ae..00000000 --- a/packages/afk_nostr_sdk/src/hooks/useContacts.js +++ /dev/null @@ -1,28 +0,0 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -import { NDKKind } from '@nostr-dev-kit/ndk'; -import { useQuery } from '@tanstack/react-query'; -import { useNostrContext } from '../context/NostrContext'; -export const useContacts = (options) => { - const { ndk } = useNostrContext(); - return useQuery({ - queryKey: ['contacts', options === null || options === void 0 ? void 0 : options.authors, options === null || options === void 0 ? void 0 : options.search, ndk], - queryFn: () => __awaiter(void 0, void 0, void 0, function* () { - var _a; - const contacts = yield ndk.fetchEvent({ - kinds: [NDKKind.Contacts], - authors: options === null || options === void 0 ? void 0 : options.authors, - search: options === null || options === void 0 ? void 0 : options.search, - }); - return (_a = contacts === null || contacts === void 0 ? void 0 : contacts.tags.filter((tag) => tag[0] === 'p').map((tag) => tag[1])) !== null && _a !== void 0 ? _a : []; - }), - placeholderData: [], - }); -}; diff --git a/packages/afk_nostr_sdk/src/hooks/useEditContacts.js b/packages/afk_nostr_sdk/src/hooks/useEditContacts.js deleted file mode 100644 index ec87422f..00000000 --- a/packages/afk_nostr_sdk/src/hooks/useEditContacts.js +++ /dev/null @@ -1,43 +0,0 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk'; -import { useMutation } from '@tanstack/react-query'; -import { useNostrContext } from '../context/NostrContext'; -import { useAuth } from '../store/auth'; -export const useEditContacts = () => { - const { ndk } = useNostrContext(); - const { publicKey } = useAuth(); - return useMutation({ - mutationKey: ['editContacts', ndk], - mutationFn: (data) => __awaiter(void 0, void 0, void 0, function* () { - let contacts = yield ndk.fetchEvent({ - kinds: [NDKKind.Contacts], - authors: [publicKey], - }); - if (!contacts) { - contacts = new NDKEvent(ndk); - contacts.kind = NDKKind.Contacts; - contacts.content = ''; - contacts.tags = []; - } - // Resetting the id and created_at to avoid conflicts - contacts.id = undefined; - contacts.created_at = undefined; - if (data.type === 'add') { - contacts.tags.push(['p', data.pubkey, '', '']); - } - else { - contacts.tags = contacts.tags.filter((tag) => tag[1] !== data.pubkey); - } - yield contacts.sign(); - return contacts.publish(); - }), - }); -}; diff --git a/packages/afk_nostr_sdk/src/hooks/useEditProfile.js b/packages/afk_nostr_sdk/src/hooks/useEditProfile.js deleted file mode 100644 index 58015def..00000000 --- a/packages/afk_nostr_sdk/src/hooks/useEditProfile.js +++ /dev/null @@ -1,37 +0,0 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -import { useMutation } from '@tanstack/react-query'; -// import {useNostrContext} from '../../context/NostrContext'; -// import {useAuth} from '../../store/auth'; -// import {useNostrContext} from '../context/NostrContext'; -import { useNostrContext } from '../context/NostrContext'; -import { useAuth } from '../store/auth'; -export const useEditProfile = () => { - const { ndk } = useNostrContext(); - const { publicKey } = useAuth(); - return useMutation({ - mutationKey: ['editProfile', ndk], - mutationFn: (data) => __awaiter(void 0, void 0, void 0, function* () { - try { - const user = ndk.getUser({ pubkey: publicKey }); - yield user.fetchProfile(); - if (!user.profile) { - throw new Error('Profile not found'); - } - user.profile = Object.assign(Object.assign({}, user.profile), data); - return user.publish(); - } - catch (error) { - console.error('Error editing profile', error); - throw error; - } - }), - }); -}; diff --git a/packages/afk_nostr_sdk/src/hooks/useNote.js b/packages/afk_nostr_sdk/src/hooks/useNote.js deleted file mode 100644 index 8a2d1fce..00000000 --- a/packages/afk_nostr_sdk/src/hooks/useNote.js +++ /dev/null @@ -1,25 +0,0 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -import { NDKKind } from '@nostr-dev-kit/ndk'; -import { useQuery } from '@tanstack/react-query'; -import { useNostrContext } from '../context/NostrContext'; -export const useNote = (options) => { - const { ndk } = useNostrContext(); - return useQuery({ - queryKey: ['note', options.noteId, ndk], - queryFn: () => __awaiter(void 0, void 0, void 0, function* () { - const note = yield ndk.fetchEvent({ - kinds: [NDKKind.Text], - ids: [options.noteId], - }); - return note !== null && note !== void 0 ? note : undefined; - }), - }); -}; diff --git a/packages/afk_nostr_sdk/src/hooks/useProfile.js b/packages/afk_nostr_sdk/src/hooks/useProfile.js deleted file mode 100644 index 709c701e..00000000 --- a/packages/afk_nostr_sdk/src/hooks/useProfile.js +++ /dev/null @@ -1,22 +0,0 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -import { useQuery } from '@tanstack/react-query'; -import { useNostrContext } from '../context/NostrContext'; -export const useProfile = (options) => { - const { ndk } = useNostrContext(); - return useQuery({ - queryKey: ['profile', options.publicKey, ndk], - queryFn: () => __awaiter(void 0, void 0, void 0, function* () { - const user = ndk.getUser({ pubkey: options.publicKey }); - return user.fetchProfile(); - }), - placeholderData: {}, - }); -}; diff --git a/packages/afk_nostr_sdk/src/hooks/useReact.js b/packages/afk_nostr_sdk/src/hooks/useReact.js deleted file mode 100644 index e8ba3347..00000000 --- a/packages/afk_nostr_sdk/src/hooks/useReact.js +++ /dev/null @@ -1,30 +0,0 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk'; -import { useMutation } from '@tanstack/react-query'; -import { useNostrContext } from '../context/NostrContext'; -export const useReact = () => { - const { ndk } = useNostrContext(); - return useMutation({ - mutationKey: ['react', ndk], - mutationFn: (data) => __awaiter(void 0, void 0, void 0, function* () { - var _a; - const event = new NDKEvent(ndk); - event.kind = NDKKind.Reaction; - event.content = data.type === 'like' ? '+' : '-'; - event.tags = [ - ['e', data.event.id], - ['p', data.event.pubkey], - ['k', ((_a = data.event.kind) !== null && _a !== void 0 ? _a : 1).toString()], - ]; - return event.publish(); - }), - }); -}; diff --git a/packages/afk_nostr_sdk/src/hooks/useReactions.js b/packages/afk_nostr_sdk/src/hooks/useReactions.js deleted file mode 100644 index 1e162918..00000000 --- a/packages/afk_nostr_sdk/src/hooks/useReactions.js +++ /dev/null @@ -1,28 +0,0 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -import { NDKKind } from '@nostr-dev-kit/ndk'; -import { useQuery } from '@tanstack/react-query'; -import { useNostrContext } from '../context/NostrContext'; -export const useReactions = (options) => { - const { ndk } = useNostrContext(); - return useQuery({ - queryKey: ['reactions', options === null || options === void 0 ? void 0 : options.noteId, options === null || options === void 0 ? void 0 : options.authors, options === null || options === void 0 ? void 0 : options.search, ndk], - queryFn: () => __awaiter(void 0, void 0, void 0, function* () { - const notes = yield ndk.fetchEvents({ - kinds: [NDKKind.Reaction], - authors: options === null || options === void 0 ? void 0 : options.authors, - search: options === null || options === void 0 ? void 0 : options.search, - '#e': (options === null || options === void 0 ? void 0 : options.noteId) ? [options.noteId] : undefined, - }); - return [...notes]; - }), - placeholderData: [], - }); -}; diff --git a/packages/afk_nostr_sdk/src/hooks/useReplyNotes.js b/packages/afk_nostr_sdk/src/hooks/useReplyNotes.js deleted file mode 100644 index 80a7a149..00000000 --- a/packages/afk_nostr_sdk/src/hooks/useReplyNotes.js +++ /dev/null @@ -1,39 +0,0 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -import { NDKKind } from '@nostr-dev-kit/ndk'; -import { useInfiniteQuery } from '@tanstack/react-query'; -import { useNostrContext } from '../context/NostrContext'; -export const useReplyNotes = (options) => { - const { ndk } = useNostrContext(); - return useInfiniteQuery({ - initialPageParam: 0, - queryKey: ['replyNotes', options === null || options === void 0 ? void 0 : options.noteId, options === null || options === void 0 ? void 0 : options.authors, options === null || options === void 0 ? void 0 : options.search, ndk], - getNextPageParam: (lastPage, allPages, lastPageParam) => { - if (!(lastPage === null || lastPage === void 0 ? void 0 : lastPage.length)) - return undefined; - const pageParam = lastPage[lastPage.length - 1].created_at - 1; - if (!pageParam || pageParam === lastPageParam) - return undefined; - return pageParam; - }, - queryFn: ({ pageParam }) => __awaiter(void 0, void 0, void 0, function* () { - const notes = yield ndk.fetchEvents({ - kinds: [NDKKind.Text], - authors: options === null || options === void 0 ? void 0 : options.authors, - search: options === null || options === void 0 ? void 0 : options.search, - until: pageParam || Math.round(Date.now() / 1000), - limit: 20, - '#e': (options === null || options === void 0 ? void 0 : options.noteId) ? [options.noteId] : undefined, - }); - return [...notes].filter((note) => note.tags.every((tag) => tag[0] === 'e')); - }), - placeholderData: { pages: [], pageParams: [] }, - }); -}; diff --git a/packages/afk_nostr_sdk/src/hooks/useReposts.js b/packages/afk_nostr_sdk/src/hooks/useReposts.js deleted file mode 100644 index 685538a2..00000000 --- a/packages/afk_nostr_sdk/src/hooks/useReposts.js +++ /dev/null @@ -1,38 +0,0 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -import { NDKKind } from '@nostr-dev-kit/ndk'; -import { useInfiniteQuery } from '@tanstack/react-query'; -import { useNostrContext } from '../context/NostrContext'; -export const useReposts = (options) => { - const { ndk } = useNostrContext(); - return useInfiniteQuery({ - initialPageParam: 0, - queryKey: ['reposts', options === null || options === void 0 ? void 0 : options.authors, options === null || options === void 0 ? void 0 : options.search, ndk], - getNextPageParam: (lastPage, allPages, lastPageParam) => { - if (!(lastPage === null || lastPage === void 0 ? void 0 : lastPage.length)) - return undefined; - const pageParam = lastPage[lastPage.length - 1].created_at - 1; - if (!pageParam || pageParam === lastPageParam) - return undefined; - return pageParam; - }, - queryFn: ({ pageParam }) => __awaiter(void 0, void 0, void 0, function* () { - const reposts = yield ndk.fetchEvents({ - kinds: [NDKKind.Repost], - authors: options === null || options === void 0 ? void 0 : options.authors, - search: options === null || options === void 0 ? void 0 : options.search, - until: pageParam || Math.round(Date.now() / 1000), - limit: 20, - }); - return [...reposts]; - }), - placeholderData: { pages: [], pageParams: [] }, - }); -}; diff --git a/packages/afk_nostr_sdk/src/hooks/useRootNotes.js b/packages/afk_nostr_sdk/src/hooks/useRootNotes.js deleted file mode 100644 index 1462b603..00000000 --- a/packages/afk_nostr_sdk/src/hooks/useRootNotes.js +++ /dev/null @@ -1,38 +0,0 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -import { NDKKind } from '@nostr-dev-kit/ndk'; -import { useInfiniteQuery } from '@tanstack/react-query'; -import { useNostrContext } from '../context/NostrContext'; -export const useRootNotes = (options) => { - const { ndk } = useNostrContext(); - return useInfiniteQuery({ - initialPageParam: 0, - queryKey: ['rootNotes', options === null || options === void 0 ? void 0 : options.authors, options === null || options === void 0 ? void 0 : options.search, ndk], - getNextPageParam: (lastPage, allPages, lastPageParam) => { - if (!(lastPage === null || lastPage === void 0 ? void 0 : lastPage.length)) - return undefined; - const pageParam = lastPage[lastPage.length - 1].created_at - 1; - if (!pageParam || pageParam === lastPageParam) - return undefined; - return pageParam; - }, - queryFn: ({ pageParam }) => __awaiter(void 0, void 0, void 0, function* () { - const notes = yield ndk.fetchEvents({ - kinds: [NDKKind.Text, NDKKind.ChannelMetadata], - authors: options === null || options === void 0 ? void 0 : options.authors, - search: options === null || options === void 0 ? void 0 : options.search, - until: pageParam || Math.round(Date.now() / 1000), - limit: 20, - }); - return [...notes].filter((note) => note.tags.every((tag) => tag[0] !== 'e')); - }), - placeholderData: { pages: [], pageParams: [] }, - }); -}; diff --git a/packages/afk_nostr_sdk/src/hooks/useSearchNotes.js b/packages/afk_nostr_sdk/src/hooks/useSearchNotes.js deleted file mode 100644 index eb75e83f..00000000 --- a/packages/afk_nostr_sdk/src/hooks/useSearchNotes.js +++ /dev/null @@ -1,39 +0,0 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -import { NDKKind } from '@nostr-dev-kit/ndk'; -import { useInfiniteQuery } from '@tanstack/react-query'; -import { useNostrContext } from '../context/NostrContext'; -export const useSearchNotes = (options) => { - const { ndk } = useNostrContext(); - return useInfiniteQuery({ - initialPageParam: 0, - queryKey: ['searchNotes', options === null || options === void 0 ? void 0 : options.authors, options === null || options === void 0 ? void 0 : options.search, options === null || options === void 0 ? void 0 : options.kinds, ndk], - getNextPageParam: (lastPage, allPages, lastPageParam) => { - if (!(lastPage === null || lastPage === void 0 ? void 0 : lastPage.length)) - return undefined; - const pageParam = lastPage[lastPage.length - 1].created_at - 1; - if (!pageParam || pageParam === lastPageParam) - return undefined; - return pageParam; - }, - queryFn: ({ pageParam }) => __awaiter(void 0, void 0, void 0, function* () { - var _a; - const notes = yield ndk.fetchEvents({ - kinds: (_a = options === null || options === void 0 ? void 0 : options.kinds) !== null && _a !== void 0 ? _a : [NDKKind.Text], - authors: options === null || options === void 0 ? void 0 : options.authors, - search: options === null || options === void 0 ? void 0 : options.search, - until: pageParam || Math.round(Date.now() / 1000), - limit: 20, - }); - return [...notes].filter((note) => note.tags.every((tag) => tag[0] !== 'e')); - }), - placeholderData: { pages: [], pageParams: [] }, - }); -}; diff --git a/packages/afk_nostr_sdk/src/hooks/useSendNote.js b/packages/afk_nostr_sdk/src/hooks/useSendNote.js deleted file mode 100644 index 7cb1d176..00000000 --- a/packages/afk_nostr_sdk/src/hooks/useSendNote.js +++ /dev/null @@ -1,26 +0,0 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk'; -import { useMutation } from '@tanstack/react-query'; -import { useNostrContext } from '../context/NostrContext'; -export const useSendNote = () => { - const { ndk } = useNostrContext(); - return useMutation({ - mutationKey: ['sendNote', ndk], - mutationFn: (data) => __awaiter(void 0, void 0, void 0, function* () { - var _a; - const event = new NDKEvent(ndk); - event.kind = NDKKind.Text; - event.content = data.content; - event.tags = (_a = data.tags) !== null && _a !== void 0 ? _a : []; - return event.publish(); - }), - }); -}; diff --git a/packages/afk_nostr_sdk/src/store/auth.js b/packages/afk_nostr_sdk/src/store/auth.js deleted file mode 100644 index 8c25920b..00000000 --- a/packages/afk_nostr_sdk/src/store/auth.js +++ /dev/null @@ -1,12 +0,0 @@ -import { createStore } from 'zustand'; -import createBoundedUseStore from './createBoundedUseStore'; -export const authStore = createStore((set, get) => ({ - // publicKey and privateKey are set to undefined but we know they are strings - // so we can cast them as strings without hassle in the app - publicKey: undefined, - privateKey: undefined, - setAuth: (publicKey, privateKey) => { - set({ publicKey, privateKey }); - }, -})); -export const useAuth = createBoundedUseStore(authStore); diff --git a/packages/afk_nostr_sdk/src/store/createBoundedUseStore.js b/packages/afk_nostr_sdk/src/store/createBoundedUseStore.js deleted file mode 100644 index 7bff1d23..00000000 --- a/packages/afk_nostr_sdk/src/store/createBoundedUseStore.js +++ /dev/null @@ -1,6 +0,0 @@ -import { useStore } from 'zustand'; -/* This code defines a function called `createBoundedUseStore` that takes a `store` object of type -`StoreApi` as its argument. The function returns a function that can be used to access the -state of the `store` object from inside a React component. */ -const createBoundedUseStore = ((store) => (selector, equals) => useStore(store, selector, equals)); -export default createBoundedUseStore; diff --git a/packages/afk_nostr_sdk/tsconfig.json b/packages/afk_nostr_sdk/tsconfig.json index 6400b0c2..588c8cd5 100644 --- a/packages/afk_nostr_sdk/tsconfig.json +++ b/packages/afk_nostr_sdk/tsconfig.json @@ -14,10 +14,11 @@ "isolatedModules": true, "jsx": "react-jsx", // Use the new JSX transform "baseUrl": ".", + "outDir": "./dist", "paths": { "@/*": ["src/*"] } }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "src/**/*.ts", "src/**/*.tsx",], "exclude": ["node_modules"] } From e21d2e862c35243d20fa0a33ed539e8714be519b Mon Sep 17 00:00:00 2001 From: MSGhais Date: Thu, 8 Aug 2024 17:02:22 +0200 Subject: [PATCH 11/16] tsconfig + add zutsand in web --- packages/afk_nostr_sdk/package.json | 1 - packages/afk_nostr_sdk/tsconfig.json | 1 - 2 files changed, 2 deletions(-) diff --git a/packages/afk_nostr_sdk/package.json b/packages/afk_nostr_sdk/package.json index e629ea11..08e7458c 100644 --- a/packages/afk_nostr_sdk/package.json +++ b/packages/afk_nostr_sdk/package.json @@ -16,7 +16,6 @@ "dependencies": { "@nostr-dev-kit/ndk": "^2.8.2", "@tanstack/react-query": "^5.40.0", - "afk_nostr_sdk": "link:", "react": "^18.3.1", "react-dom": "^18.3.1", "zustand": "^4.5.2" diff --git a/packages/afk_nostr_sdk/tsconfig.json b/packages/afk_nostr_sdk/tsconfig.json index 588c8cd5..84b2e003 100644 --- a/packages/afk_nostr_sdk/tsconfig.json +++ b/packages/afk_nostr_sdk/tsconfig.json @@ -20,5 +20,4 @@ } }, "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "src/**/*.ts", "src/**/*.tsx",], - "exclude": ["node_modules"] } From 680b7b4ef5ed764d83488e8d2d7481bcd7ec23da Mon Sep 17 00:00:00 2001 From: MSGhais Date: Thu, 8 Aug 2024 17:04:15 +0200 Subject: [PATCH 12/16] tsconfig + add zutsand in web --- packages/afk_nostr_sdk/tsconfig copy.json | 2 +- packages/afk_nostr_sdk/tsconfig.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/afk_nostr_sdk/tsconfig copy.json b/packages/afk_nostr_sdk/tsconfig copy.json index fb1fcf14..2818a9b8 100644 --- a/packages/afk_nostr_sdk/tsconfig copy.json +++ b/packages/afk_nostr_sdk/tsconfig copy.json @@ -13,7 +13,7 @@ "module": "ES6", "moduleResolution": "node", "outDir": "./dist", - "jsx": "react", // Add this line for React projects + "jsx": "react" }, "exclude": ["node_modules", "dist", "babel.config.js", "metro.config.js", "jest.config.js"], "include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "next-env.d.ts",] diff --git a/packages/afk_nostr_sdk/tsconfig.json b/packages/afk_nostr_sdk/tsconfig.json index 84b2e003..7cc2b46c 100644 --- a/packages/afk_nostr_sdk/tsconfig.json +++ b/packages/afk_nostr_sdk/tsconfig.json @@ -12,7 +12,7 @@ "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, - "jsx": "react-jsx", // Use the new JSX transform + "jsx": "react", "baseUrl": ".", "outDir": "./dist", "paths": { From afb895e4edd00882dc1264ab0edb4a456d3c0d91 Mon Sep 17 00:00:00 2001 From: MSGhais Date: Thu, 8 Aug 2024 17:04:30 +0200 Subject: [PATCH 13/16] add zutsand --- apps/website/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/website/package.json b/apps/website/package.json index 675012d7..9762e178 100644 --- a/apps/website/package.json +++ b/apps/website/package.json @@ -26,6 +26,7 @@ "@tanstack/react-query": "^5.40.0", "react": "^18.3.1", "react-dom": "^18.3.1", + "zustand": "^4.5.2", "afk_nostr_sdk":"workspace:*", "@nostr-dev-kit/ndk": "^2.8.2" }, From a91c70391b7a2ed28647bd26b72308a232a4ba12 Mon Sep 17 00:00:00 2001 From: MSGhais Date: Thu, 8 Aug 2024 17:06:25 +0200 Subject: [PATCH 14/16] umd react --- packages/afk_nostr_sdk/src/context/NostrContext.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/afk_nostr_sdk/src/context/NostrContext.tsx b/packages/afk_nostr_sdk/src/context/NostrContext.tsx index 74508428..1043d692 100644 --- a/packages/afk_nostr_sdk/src/context/NostrContext.tsx +++ b/packages/afk_nostr_sdk/src/context/NostrContext.tsx @@ -1,13 +1,11 @@ +import React, {createContext, useContext, useEffect, useState} from 'react'; import NDK, {NDKPrivateKeySigner} from '@nostr-dev-kit/ndk'; -import {createContext, useContext, useEffect, useState} from 'react'; import { useAuth } from '../store/auth'; import {AFK_RELAYS} from "../utils/relay" export type NostrContextType = { ndk: NDK; }; - export const NostrContext = createContext(null); - export const NostrProvider: React.FC = ({children}) => { const privateKey = useAuth((state) => state.privateKey); From 0b402fc6d2bb565dbd5d2647c928066e38be3037 Mon Sep 17 00:00:00 2001 From: MSGhais Date: Thu, 8 Aug 2024 18:46:46 +0200 Subject: [PATCH 15/16] add package afk_nostr_sdk + fix config turbo & tsconfig --- apps/website/package.json | 8 +++-- apps/website/src/app/app/page.tsx | 7 +---- apps/website/src/app/providers.tsx | 6 ++-- apps/website/tsconfig.json | 3 +- packages/afk_nostr_sdk/index.js | 9 ------ packages/afk_nostr_sdk/index.ts | 9 ------ packages/afk_nostr_sdk/package.json | 27 +++++++++++++++-- .../afk_nostr_sdk/src/context/NostrContext.js | 29 ------------------ .../src/context/TanstackProvider.js | 8 ----- packages/afk_nostr_sdk/src/context/index.tsx | 3 ++ packages/afk_nostr_sdk/src/index copy.ts | 25 ++++++++++++++++ packages/afk_nostr_sdk/src/index.ts | 30 +++++++++++++++++++ packages/afk_nostr_sdk/src/store/index.tsx | 2 ++ packages/afk_nostr_sdk/src/utils/relay.js | 17 ----------- packages/afk_nostr_sdk/tsconfig copy.json | 20 ------------- packages/afk_nostr_sdk/tsconfig.json | 27 +++++++++-------- packages/afk_nostr_sdk/tsconfig.tsbuildinfo | 1 + tsconfig.json | 29 ++++++++++++++++++ 18 files changed, 139 insertions(+), 121 deletions(-) delete mode 100644 packages/afk_nostr_sdk/index.js delete mode 100644 packages/afk_nostr_sdk/index.ts delete mode 100644 packages/afk_nostr_sdk/src/context/NostrContext.js delete mode 100644 packages/afk_nostr_sdk/src/context/TanstackProvider.js create mode 100644 packages/afk_nostr_sdk/src/context/index.tsx create mode 100644 packages/afk_nostr_sdk/src/index copy.ts create mode 100644 packages/afk_nostr_sdk/src/index.ts create mode 100644 packages/afk_nostr_sdk/src/store/index.tsx delete mode 100644 packages/afk_nostr_sdk/src/utils/relay.js delete mode 100644 packages/afk_nostr_sdk/tsconfig copy.json create mode 100644 packages/afk_nostr_sdk/tsconfig.tsbuildinfo create mode 100644 tsconfig.json diff --git a/apps/website/package.json b/apps/website/package.json index 9762e178..d8a42102 100644 --- a/apps/website/package.json +++ b/apps/website/package.json @@ -2,6 +2,7 @@ "name": "website", "version": "0.1.0", "private": true, + "scripts": { "dev": "next dev", "start": "next start", @@ -11,7 +12,8 @@ "lint": "next lint", "lint:fix":"next lint --fix", "prettier:fix":"pnpm prettier --write 'src/**/*.tsx'", - "prettier:fix:ts":"pnpm prettier --write 'src/**/*.ts'" + "prettier:fix:ts":"pnpm prettier --write 'src/**/*.ts'", + "check-types": "tsc --noEmit" }, "dependencies": { "@avnu/avnu-sdk": "^2.0.0", @@ -27,8 +29,8 @@ "react": "^18.3.1", "react-dom": "^18.3.1", "zustand": "^4.5.2", - "afk_nostr_sdk":"workspace:*", - "@nostr-dev-kit/ndk": "^2.8.2" + "@nostr-dev-kit/ndk": "^2.8.2", + "afk_nostr_sdk":"workspace:*" }, "devDependencies": { "@types/node": "^20", diff --git a/apps/website/src/app/app/page.tsx b/apps/website/src/app/app/page.tsx index 7318a8af..f7741b9d 100644 --- a/apps/website/src/app/app/page.tsx +++ b/apps/website/src/app/app/page.tsx @@ -1,21 +1,16 @@ 'use client'; -// import { NDKEvent } from 'afk_nostr_sdk'; import {NDKEvent, NDKFilter, NDKKind} from '@nostr-dev-kit/ndk'; -import {useNostrContext} from 'afk_nostr_sdk/context/NostrContext'; -import {useSearchNotes} from 'afk_nostr_sdk/hooks'; +import {useNostrContext, useSearchNotes} from 'afk_nostr_sdk'; import {useEffect} from 'react'; import {useState} from 'react'; import {Footer} from '../components/Footer'; import {Navbar} from '../components/Navbar'; - export default function AppHomepage() { const nostr = useNostrContext(); - const [events, setEvents] = useState([]); const [isInitDone, setIsInitDone] = useState(false); - useEffect(() => { if (!isInitDone) { fetch(); diff --git a/apps/website/src/app/providers.tsx b/apps/website/src/app/providers.tsx index 0ea0da00..550cab12 100644 --- a/apps/website/src/app/providers.tsx +++ b/apps/website/src/app/providers.tsx @@ -1,8 +1,6 @@ 'use client'; - -import {NostrProvider} from 'afk_nostr_sdk/context/NostrContext'; -import {TanstackProvider} from 'afk_nostr_sdk/context/TanstackProvider'; - +import {TanstackProvider} from 'afk_nostr_sdk'; +import {NostrProvider} from 'afk_nostr_sdk'; export default function Providers({children}: {children: React.ReactNode}) { return ( diff --git a/apps/website/tsconfig.json b/apps/website/tsconfig.json index 2289e197..2964949a 100644 --- a/apps/website/tsconfig.json +++ b/apps/website/tsconfig.json @@ -27,7 +27,8 @@ "paths": { "@/*": [ "./src/*" - ] + ], + "afk_nostr_sdk": ["../../packages/afk_nostr_sdk/src"] }, "noEmit": true }, diff --git a/packages/afk_nostr_sdk/index.js b/packages/afk_nostr_sdk/index.js deleted file mode 100644 index a1755378..00000000 --- a/packages/afk_nostr_sdk/index.js +++ /dev/null @@ -1,9 +0,0 @@ -import { NostrContext } from "./src/context/NostrContext"; -import { TanstackProvider } from "./src/context/TanstackProvider"; -import * as hooks from "./src/hooks"; -import { NDKKind, NDKEvent, NDKUser } from "@nostr-dev-kit/ndk"; -import { AFK_RELAYS } from "./src/utils/relay"; -export default { hooks, NostrContext, TanstackProvider, - NDKEvent, NDKKind, NDKUser, - AFK_RELAYS -}; diff --git a/packages/afk_nostr_sdk/index.ts b/packages/afk_nostr_sdk/index.ts deleted file mode 100644 index af3431f0..00000000 --- a/packages/afk_nostr_sdk/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { NostrContext } from "./src/context/NostrContext"; -import { TanstackProvider } from "./src/context/TanstackProvider"; -import * as hooks from "./src/hooks" -import {NDKKind, NDKEvent, NDKUser} from "@nostr-dev-kit/ndk" -import { AFK_RELAYS } from "./src/utils/relay"; -export default {hooks, NostrContext, TanstackProvider , - NDKEvent, NDKKind, NDKUser, - AFK_RELAYS -}; \ No newline at end of file diff --git a/packages/afk_nostr_sdk/package.json b/packages/afk_nostr_sdk/package.json index 08e7458c..d5ee3e93 100644 --- a/packages/afk_nostr_sdk/package.json +++ b/packages/afk_nostr_sdk/package.json @@ -1,7 +1,8 @@ { "name": "afk_nostr_sdk", - "version": "1.0.0", - "main": "index.js", + "version": "0.0.1", + "main": "dist/index.js", + "types": "dist/index.d.ts", "scripts": { "build": "tsc", "format": "prettier --write \"src/**/*.{ts,tsx}\"", @@ -20,7 +21,28 @@ "react-dom": "^18.3.1", "zustand": "^4.5.2" }, + "peerDependencies": { + "@nostr-dev-kit/ndk": "^2.8.2", + "@tanstack/react-query": "^5.40.0", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "zustand": "^4.5.2" + }, + "module": "dist/index.mjs", + "exports": { + ".": { + "import": "./dist/index.mjs", + "require": "./dist/index.js", + "browser": "./dist/index.global.js", + "types": "./dist/index.d.ts" + } + }, "devDependencies": { + "@nostr-dev-kit/ndk": "^2.8.2", + "@tanstack/react-query": "^5.40.0", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "zustand": "^4.5.2", "@babel/core": "^7.20.0", "@babel/plugin-proposal-export-namespace-from": "^7.18.9", "@types/react": "^18.3.1", @@ -36,6 +58,7 @@ "patch-package": "^8.0.0", "postinstall-postinstall": "^2.1.0", "prettier": "^3.2.5", + "tsup": "^8.0.2", "typescript": "~5.3.3" }, "private": true diff --git a/packages/afk_nostr_sdk/src/context/NostrContext.js b/packages/afk_nostr_sdk/src/context/NostrContext.js deleted file mode 100644 index 515c610f..00000000 --- a/packages/afk_nostr_sdk/src/context/NostrContext.js +++ /dev/null @@ -1,29 +0,0 @@ -import { jsx as _jsx } from "react/jsx-runtime"; -import NDK, { NDKPrivateKeySigner } from '@nostr-dev-kit/ndk'; -import { createContext, useContext, useEffect, useState } from 'react'; -import { useAuth } from '../store/auth'; -import { AFK_RELAYS } from "../utils/relay"; -export const NostrContext = createContext(null); -export const NostrProvider = ({ children }) => { - const privateKey = useAuth((state) => state.privateKey); - const [ndk, setNdk] = useState(new NDK({ - explicitRelayUrls: AFK_RELAYS, - })); - useEffect(() => { - const newNdk = new NDK({ - explicitRelayUrls: AFK_RELAYS, - signer: privateKey ? new NDKPrivateKeySigner(privateKey) : undefined, - }); - newNdk.connect().then(() => { - setNdk(newNdk); - }); - }, [privateKey]); - return _jsx(NostrContext.Provider, { value: { ndk }, children: children }); -}; -export const useNostrContext = () => { - const nostr = useContext(NostrContext); - if (!nostr) { - throw new Error('NostrContext must be used within a NostrProvider'); - } - return nostr; -}; diff --git a/packages/afk_nostr_sdk/src/context/TanstackProvider.js b/packages/afk_nostr_sdk/src/context/TanstackProvider.js deleted file mode 100644 index a47b6b28..00000000 --- a/packages/afk_nostr_sdk/src/context/TanstackProvider.js +++ /dev/null @@ -1,8 +0,0 @@ -import { jsx as _jsx } from "react/jsx-runtime"; -import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; -const queryClient = new QueryClient({ - defaultOptions: { queries: { retry: 2 } }, -}); -export const TanstackProvider = ({ children }) => { - return (_jsx(QueryClientProvider, { client: queryClient, children: children })); -}; diff --git a/packages/afk_nostr_sdk/src/context/index.tsx b/packages/afk_nostr_sdk/src/context/index.tsx new file mode 100644 index 00000000..bcd5d376 --- /dev/null +++ b/packages/afk_nostr_sdk/src/context/index.tsx @@ -0,0 +1,3 @@ + +export * from "./NostrContext"; +export * from "./TanstackProvider" \ No newline at end of file diff --git a/packages/afk_nostr_sdk/src/index copy.ts b/packages/afk_nostr_sdk/src/index copy.ts new file mode 100644 index 00000000..87c942f0 --- /dev/null +++ b/packages/afk_nostr_sdk/src/index copy.ts @@ -0,0 +1,25 @@ +import { NostrContext, NostrProvider, useNostrContext } from "./context/NostrContext"; +import { TanstackProvider } from "./context/TanstackProvider"; +import * as hooks from "./hooks" +import { NDKKind, NDKEvent, NDKUser } from "@nostr-dev-kit/ndk" +import { AFK_RELAYS } from "./utils/relay"; + +export default { + hooks, NostrContext, + TanstackProvider, + context: { + NostrContext, NostrProvider, TanstackProvider, + useNostrContext, + }, + NDKEvent, NDKKind, NDKUser, + AFK_RELAYS +}; +// export default { +// hooks, NostrContext, TanstackProvider, +// context: { +// NostrContext, NostrProvider, TanstackProvider, +// useNostrContext, +// }, +// NDKEvent, NDKKind, NDKUser, +// AFK_RELAYS +// }; \ No newline at end of file diff --git a/packages/afk_nostr_sdk/src/index.ts b/packages/afk_nostr_sdk/src/index.ts new file mode 100644 index 00000000..b7c248f1 --- /dev/null +++ b/packages/afk_nostr_sdk/src/index.ts @@ -0,0 +1,30 @@ +export * from "./context" +export * from "./hooks" +export * from "./store" + + +// import { NostrContext, NostrProvider, useNostrContext } from "./context/NostrContext"; +// import { TanstackProvider } from "./context/TanstackProvider"; +// import * as hooks from "./hooks" +// import { NDKKind, NDKEvent, NDKUser } from "@nostr-dev-kit/ndk" +// import { AFK_RELAYS } from "./utils/relay"; + +// export default { +// hooks, NostrContext, +// TanstackProvider, +// context: { +// NostrContext, NostrProvider, TanstackProvider, +// useNostrContext, +// }, +// NDKEvent, NDKKind, NDKUser, +// AFK_RELAYS +// }; +// export default { +// hooks, NostrContext, TanstackProvider, +// context: { +// NostrContext, NostrProvider, TanstackProvider, +// useNostrContext, +// }, +// NDKEvent, NDKKind, NDKUser, +// AFK_RELAYS +// }; \ No newline at end of file diff --git a/packages/afk_nostr_sdk/src/store/index.tsx b/packages/afk_nostr_sdk/src/store/index.tsx new file mode 100644 index 00000000..efba1120 --- /dev/null +++ b/packages/afk_nostr_sdk/src/store/index.tsx @@ -0,0 +1,2 @@ +export * from "./auth" +export * from "./createBoundedUseStore" \ No newline at end of file diff --git a/packages/afk_nostr_sdk/src/utils/relay.js b/packages/afk_nostr_sdk/src/utils/relay.js deleted file mode 100644 index 3478132f..00000000 --- a/packages/afk_nostr_sdk/src/utils/relay.js +++ /dev/null @@ -1,17 +0,0 @@ -export const RELAYS_PROD = ['wss://relay.n057r.club', 'wss://relay.nostr.net']; -export const AFK_RELAYS = process.env.EXPO_NODE_ENV == 'production' || process.env.NODE_ENV == 'production' - ? [ - // 'wss://nostr.joyboy.community', - 'wss://nostr-relay-nestjs-production.up.railway.app', - // 'ws://localhost:3000', // comment if you don't run a relayer in localhost - ] - : [ - // 'wss://nostr.joyboy.community', - // 'ws://nostr-relay-nestjs-production.up.railway.app', - 'wss://nostr-relay-nestjs-production.up.railway.app', - // 'ws://localhost:8080', // comment if you don't run a relayer in localhost - ]; -// export const AFK_RELAYS = [ -// 'wss://nostr.joyboy.community', -// // 'ws://localhost:3000', // comment if you don't run a relayer in localhost -// ]; diff --git a/packages/afk_nostr_sdk/tsconfig copy.json b/packages/afk_nostr_sdk/tsconfig copy.json deleted file mode 100644 index 2818a9b8..00000000 --- a/packages/afk_nostr_sdk/tsconfig copy.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, - "skipLibCheck": true, - "noEmit": true, - "esModuleInterop": true, - "resolveJsonModule": true, - "isolatedModules": true, - "downlevelIteration": true, - "allowSyntheticDefaultImports": true, - "module": "ES6", - "moduleResolution": "node", - "outDir": "./dist", - "jsx": "react" - }, - "exclude": ["node_modules", "dist", "babel.config.js", "metro.config.js", "jest.config.js"], - "include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "next-env.d.ts",] -} diff --git a/packages/afk_nostr_sdk/tsconfig.json b/packages/afk_nostr_sdk/tsconfig.json index 7cc2b46c..a07ce5f6 100644 --- a/packages/afk_nostr_sdk/tsconfig.json +++ b/packages/afk_nostr_sdk/tsconfig.json @@ -1,23 +1,24 @@ { "compilerOptions": { + "outDir": "./dist", + "rootDir": "./src", + "composite": true, "target": "ES6", + "module": "ES6", "lib": ["dom", "dom.iterable", "esnext"], + "jsx": "react-jsx", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, "allowJs": true, - "skipLibCheck": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, "noFallthroughCasesInSwitch": true, - "module": "ES6", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "jsx": "react", - "baseUrl": ".", - "outDir": "./dist", - "paths": { - "@/*": ["src/*"] - } + "skipLibCheck": true, + "declaration": true, + "sourceMap": true }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "src/**/*.ts", "src/**/*.tsx",], + "include": ["src/**/*"], + "exclude": ["node_modules", "dist"], + } diff --git a/packages/afk_nostr_sdk/tsconfig.tsbuildinfo b/packages/afk_nostr_sdk/tsconfig.tsbuildinfo new file mode 100644 index 00000000..9561e01f --- /dev/null +++ b/packages/afk_nostr_sdk/tsconfig.tsbuildinfo @@ -0,0 +1 @@ +{"program":{"fileNames":["../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2022.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2023.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2023.array.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2023.collection.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.esnext.disposable.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.esnext.decorators.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.decorators.d.ts","../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/global.d.ts","../../node_modules/.pnpm/csstype@3.1.3/node_modules/csstype/index.d.ts","../../node_modules/.pnpm/@types+prop-types@15.7.12/node_modules/@types/prop-types/index.d.ts","../../node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts","../../node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/jsx-runtime.d.ts","../../node_modules/.pnpm/tseep@1.2.2/node_modules/tseep/lib/types.d.ts","../../node_modules/.pnpm/tseep@1.2.2/node_modules/tseep/lib/utils.d.ts","../../node_modules/.pnpm/tseep@1.2.2/node_modules/tseep/lib/task-collection/task-collection.d.ts","../../node_modules/.pnpm/tseep@1.2.2/node_modules/tseep/lib/task-collection/index.d.ts","../../node_modules/.pnpm/tseep@1.2.2/node_modules/tseep/lib/ee.d.ts","../../node_modules/.pnpm/tseep@1.2.2/node_modules/tseep/lib/index.d.ts","../../node_modules/.pnpm/typescript-lru-cache@2.0.0/node_modules/typescript-lru-cache/dist/LRUCache.d.ts","../../node_modules/.pnpm/typescript-lru-cache@2.0.0/node_modules/typescript-lru-cache/dist/index.d.ts","../../node_modules/.pnpm/@nostr-dev-kit+ndk@2.10.0_typescript@5.3.3/node_modules/@nostr-dev-kit/ndk/dist/index.d.ts","../../node_modules/.pnpm/zustand@4.5.4_@types+react@18.3.3_react@18.3.1/node_modules/zustand/vanilla.d.ts","../../node_modules/.pnpm/zustand@4.5.4_@types+react@18.3.3_react@18.3.1/node_modules/zustand/react.d.ts","../../node_modules/.pnpm/zustand@4.5.4_@types+react@18.3.3_react@18.3.1/node_modules/zustand/index.d.ts","./src/store/createBoundedUseStore.ts","./src/store/auth.ts","./src/utils/relay.ts","./src/context/NostrContext.tsx","../../node_modules/.pnpm/@tanstack+query-core@5.51.21/node_modules/@tanstack/query-core/build/legacy/removable.d.ts","../../node_modules/.pnpm/@tanstack+query-core@5.51.21/node_modules/@tanstack/query-core/build/legacy/subscribable.d.ts","../../node_modules/.pnpm/@tanstack+query-core@5.51.21/node_modules/@tanstack/query-core/build/legacy/hydration-zFr_7WN8.d.ts","../../node_modules/.pnpm/@tanstack+query-core@5.51.21/node_modules/@tanstack/query-core/build/legacy/queriesObserver.d.ts","../../node_modules/.pnpm/@tanstack+query-core@5.51.21/node_modules/@tanstack/query-core/build/legacy/infiniteQueryObserver.d.ts","../../node_modules/.pnpm/@tanstack+query-core@5.51.21/node_modules/@tanstack/query-core/build/legacy/notifyManager.d.ts","../../node_modules/.pnpm/@tanstack+query-core@5.51.21/node_modules/@tanstack/query-core/build/legacy/focusManager.d.ts","../../node_modules/.pnpm/@tanstack+query-core@5.51.21/node_modules/@tanstack/query-core/build/legacy/onlineManager.d.ts","../../node_modules/.pnpm/@tanstack+query-core@5.51.21/node_modules/@tanstack/query-core/build/legacy/index.d.ts","../../node_modules/.pnpm/@tanstack+react-query@5.51.21_react@18.3.1/node_modules/@tanstack/react-query/build/legacy/types.d.ts","../../node_modules/.pnpm/@tanstack+react-query@5.51.21_react@18.3.1/node_modules/@tanstack/react-query/build/legacy/useQueries.d.ts","../../node_modules/.pnpm/@tanstack+react-query@5.51.21_react@18.3.1/node_modules/@tanstack/react-query/build/legacy/queryOptions.d.ts","../../node_modules/.pnpm/@tanstack+react-query@5.51.21_react@18.3.1/node_modules/@tanstack/react-query/build/legacy/useQuery.d.ts","../../node_modules/.pnpm/@tanstack+react-query@5.51.21_react@18.3.1/node_modules/@tanstack/react-query/build/legacy/useSuspenseQuery.d.ts","../../node_modules/.pnpm/@tanstack+react-query@5.51.21_react@18.3.1/node_modules/@tanstack/react-query/build/legacy/useSuspenseInfiniteQuery.d.ts","../../node_modules/.pnpm/@tanstack+react-query@5.51.21_react@18.3.1/node_modules/@tanstack/react-query/build/legacy/useSuspenseQueries.d.ts","../../node_modules/.pnpm/@tanstack+react-query@5.51.21_react@18.3.1/node_modules/@tanstack/react-query/build/legacy/prefetch.d.ts","../../node_modules/.pnpm/@tanstack+react-query@5.51.21_react@18.3.1/node_modules/@tanstack/react-query/build/legacy/infiniteQueryOptions.d.ts","../../node_modules/.pnpm/@tanstack+react-query@5.51.21_react@18.3.1/node_modules/@tanstack/react-query/build/legacy/QueryClientProvider.d.ts","../../node_modules/.pnpm/@tanstack+react-query@5.51.21_react@18.3.1/node_modules/@tanstack/react-query/build/legacy/QueryErrorResetBoundary.d.ts","../../node_modules/.pnpm/@tanstack+react-query@5.51.21_react@18.3.1/node_modules/@tanstack/react-query/build/legacy/HydrationBoundary.d.ts","../../node_modules/.pnpm/@tanstack+react-query@5.51.21_react@18.3.1/node_modules/@tanstack/react-query/build/legacy/useIsFetching.d.ts","../../node_modules/.pnpm/@tanstack+react-query@5.51.21_react@18.3.1/node_modules/@tanstack/react-query/build/legacy/useMutationState.d.ts","../../node_modules/.pnpm/@tanstack+react-query@5.51.21_react@18.3.1/node_modules/@tanstack/react-query/build/legacy/useMutation.d.ts","../../node_modules/.pnpm/@tanstack+react-query@5.51.21_react@18.3.1/node_modules/@tanstack/react-query/build/legacy/useInfiniteQuery.d.ts","../../node_modules/.pnpm/@tanstack+react-query@5.51.21_react@18.3.1/node_modules/@tanstack/react-query/build/legacy/isRestoring.d.ts","../../node_modules/.pnpm/@tanstack+react-query@5.51.21_react@18.3.1/node_modules/@tanstack/react-query/build/legacy/index.d.ts","./src/context/TanstackProvider.tsx","./src/hooks/useContacts.ts","./src/hooks/useEditContacts.ts","./src/hooks/useEditProfile.ts","./src/hooks/useNote.ts","./src/hooks/useProfile.ts","./src/hooks/useReact.ts","./src/hooks/useReactions.ts","./src/hooks/useReplyNotes.ts","./src/hooks/useReposts.ts","./src/hooks/useRootNotes.ts","./src/hooks/useSendNote.ts","./src/hooks/search/useSearchUsers.tsx","./src/hooks/search/useSearch.tsx","./src/hooks/useSearchNotes.ts","./src/hooks/index.ts","./src/index copy.ts","./src/context/index.tsx","./src/store/index.tsx","./src/index.ts","./src/hooks/channel/useChannels.ts","./src/hooks/channel/useCreateChannel.ts","./src/hooks/channel/useMessagesChannel.ts","./src/hooks/channel/useSendMessage.ts","./src/hooks/messages/useSendPrivateMessage.ts","../../node_modules/.pnpm/@types+react-dom@18.3.0/node_modules/@types/react-dom/index.d.ts","../../node_modules/.pnpm/@types+estree@1.0.5/node_modules/@types/estree/index.d.ts","../../node_modules/.pnpm/@types+hammerjs@2.0.45/node_modules/@types/hammerjs/index.d.ts","../../node_modules/.pnpm/@types+hoist-non-react-statics@3.3.5/node_modules/@types/hoist-non-react-statics/index.d.ts","../../node_modules/.pnpm/@types+istanbul-lib-coverage@2.0.6/node_modules/@types/istanbul-lib-coverage/index.d.ts","../../node_modules/.pnpm/@types+istanbul-lib-report@3.0.3/node_modules/@types/istanbul-lib-report/index.d.ts","../../node_modules/.pnpm/@types+istanbul-reports@3.0.4/node_modules/@types/istanbul-reports/index.d.ts","../../node_modules/.pnpm/@types+json-schema@7.0.15/node_modules/@types/json-schema/index.d.ts","../../node_modules/.pnpm/@types+json5@0.0.29/node_modules/@types/json5/index.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/assert.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/assert/strict.d.ts","../../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/header.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/readable.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/file.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/fetch.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/formdata.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/connector.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/client.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/errors.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/dispatcher.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/global-dispatcher.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/global-origin.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/pool-stats.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/pool.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/handlers.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/balanced-pool.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/agent.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/mock-interceptor.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/mock-agent.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/mock-client.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/mock-pool.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/mock-errors.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/proxy-agent.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/api.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/cookies.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/patch.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/filereader.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/diagnostics-channel.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/websocket.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/content-type.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/cache.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/interceptors.d.ts","../../node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types/index.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/globals.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/async_hooks.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/buffer.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/child_process.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/cluster.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/console.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/constants.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/crypto.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/dgram.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/diagnostics_channel.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/dns.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/dns/promises.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/domain.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/dom-events.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/events.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/fs.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/fs/promises.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/http.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/http2.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/https.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/inspector.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/module.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/net.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/os.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/path.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/perf_hooks.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/process.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/punycode.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/querystring.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/readline.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/readline/promises.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/repl.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/sea.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/stream.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/stream/promises.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/stream/consumers.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/stream/web.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/string_decoder.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/test.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/timers.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/timers/promises.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/tls.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/trace_events.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/tty.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/url.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/util.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/v8.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/vm.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/wasi.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/worker_threads.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/zlib.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/globals.global.d.ts","../../node_modules/.pnpm/@types+node@20.14.14/node_modules/@types/node/index.d.ts","../../node_modules/.pnpm/@types+node-forge@1.3.11/node_modules/@types/node-forge/index.d.ts","../../node_modules/.pnpm/@types+pbkdf2@3.1.2/node_modules/@types/pbkdf2/index.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/classes/semver.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/functions/parse.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/functions/valid.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/functions/clean.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/functions/inc.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/functions/diff.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/functions/major.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/functions/minor.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/functions/patch.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/functions/prerelease.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/functions/compare.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/functions/rcompare.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/functions/compare-loose.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/functions/compare-build.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/functions/sort.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/functions/rsort.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/functions/gt.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/functions/lt.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/functions/eq.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/functions/neq.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/functions/gte.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/functions/lte.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/functions/cmp.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/functions/coerce.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/classes/comparator.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/classes/range.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/functions/satisfies.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/ranges/max-satisfying.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/ranges/min-satisfying.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/ranges/to-comparators.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/ranges/min-version.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/ranges/valid.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/ranges/outside.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/ranges/gtr.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/ranges/ltr.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/ranges/intersects.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/ranges/simplify.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/ranges/subset.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/internals/identifiers.d.ts","../../node_modules/.pnpm/@types+semver@7.5.8/node_modules/@types/semver/index.d.ts","../../node_modules/.pnpm/@types+stack-utils@2.0.3/node_modules/@types/stack-utils/index.d.ts","../../node_modules/.pnpm/@types+yargs-parser@21.0.3/node_modules/@types/yargs-parser/index.d.ts","../../node_modules/.pnpm/@types+yargs@15.0.19/node_modules/@types/yargs/index.d.ts"],"fileInfos":[{"version":"f33e5332b24c3773e930e212cbb8b6867c8ba3ec4492064ea78e55a524d57450","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","26f2f787e82c4222710f3b676b4d83eb5ad0a72fa7b746f03449e7a026ce5073","9a68c0c07ae2fa71b44384a839b7b8d81662a236d4b9ac30916718f7510b1b2d","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","5514e54f17d6d74ecefedc73c504eadffdeda79c7ea205cf9febead32d45c4bc","1c0cdb8dc619bc549c3e5020643e7cf7ae7940058e8c7e5aefa5871b6d86f44b","bed7b7ba0eb5a160b69af72814b4dde371968e40b6c5e73d3a9f7bee407d158c",{"version":"21e41a76098aa7a191028256e52a726baafd45a925ea5cf0222eb430c96c1d83","affectsGlobalScope":true},{"version":"35299ae4a62086698444a5aaee27fc7aa377c68cbb90b441c9ace246ffd05c97","affectsGlobalScope":true},{"version":"138fb588d26538783b78d1e3b2c2cc12d55840b97bf5e08bca7f7a174fbe2f17","affectsGlobalScope":true},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"bc47685641087c015972a3f072480889f0d6c65515f12bd85222f49a98952ed7","affectsGlobalScope":true},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true},{"version":"93495ff27b8746f55d19fcbcdbaccc99fd95f19d057aed1bd2c0cafe1335fbf0","affectsGlobalScope":true},{"version":"6fc23bb8c3965964be8c597310a2878b53a0306edb71d4b5a4dfe760186bcc01","affectsGlobalScope":true},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true},{"version":"bb42a7797d996412ecdc5b2787720de477103a0b2e53058569069a0e2bae6c7e","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"b541a838a13f9234aba650a825393ffc2292dc0fc87681a5d81ef0c96d281e7a","affectsGlobalScope":true},{"version":"e0275cd0e42990dc3a16f0b7c8bca3efe87f1c8ad404f80c6db1c7c0b828c59f","affectsGlobalScope":true},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"49ed889be54031e1044af0ad2c603d627b8bda8b50c1a68435fe85583901d072","affectsGlobalScope":true},{"version":"e93d098658ce4f0c8a0779e6cab91d0259efb88a318137f686ad76f8410ca270","affectsGlobalScope":true},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"ec0104fee478075cb5171e5f4e3f23add8e02d845ae0165bfa3f1099241fa2aa","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"acae90d417bee324b1372813b5a00829d31c7eb670d299cd7f8f9a648ac05688","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true},{"version":"51e547984877a62227042850456de71a5c45e7fe86b7c975c6e68896c86fa23b","affectsGlobalScope":true},{"version":"62a4966981264d1f04c44eb0f4b5bdc3d81c1a54725608861e44755aa24ad6a5","affectsGlobalScope":true},{"version":"4fa6ed14e98aa80b91f61b9805c653ee82af3502dc21c9da5268d3857772ca05","affectsGlobalScope":true},{"version":"e6633e05da3ff36e6da2ec170d0d03ccf33de50ca4dc6f5aeecb572cedd162fb","affectsGlobalScope":true},{"version":"86a34c7a13de9cabc43161348f663624b56871ed80986e41d214932ddd8d6719","affectsGlobalScope":true},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true},{"version":"caccc56c72713969e1cfe5c3d44e5bab151544d9d2b373d7dbe5a1e4166652be","affectsGlobalScope":true},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true},{"version":"50d53ccd31f6667aff66e3d62adf948879a3a16f05d89882d1188084ee415bbc","affectsGlobalScope":true},{"version":"08a58483392df5fcc1db57d782e87734f77ae9eab42516028acbfe46f29a3ef7","affectsGlobalScope":true},{"version":"436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a","affectsGlobalScope":true},{"version":"13f6e6380c78e15e140243dc4be2fa546c287c6d61f4729bc2dd7cf449605471","affectsGlobalScope":true},{"version":"4350e5922fecd4bedda2964d69c213a1436349d0b8d260dd902795f5b94dc74b","affectsGlobalScope":true},{"version":"d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f","affectsGlobalScope":true},{"version":"33358442698bb565130f52ba79bfd3d4d484ac85fe33f3cb1759c54d18201393","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},{"version":"36a2e4c9a67439aca5f91bb304611d5ae6e20d420503e96c230cf8fcdc948d94","affectsGlobalScope":true},"8a8eb4ebffd85e589a1cc7c178e291626c359543403d58c9cd22b81fab5b1fb9","247a952efd811d780e5630f8cfd76f495196f5fa74f6f0fee39ac8ba4a3c9800",{"version":"8ca4709dbd22a34bcc1ebf93e1877645bdb02ebd3f3d9a211a299a8db2ee4ba1","affectsGlobalScope":true},"42c169fb8c2d42f4f668c624a9a11e719d5d07dacbebb63cbcf7ef365b0a75b3","f112b3d7b341981ddeb00bb136ff32844be0ae275dd5762b42e11a918f94d32c","d69640fa4e73ba6d42c009b615eda773830f6cba204345d06309ba8ca8b4dbe0","4aa1188ffde3897843928288e6e0eba3fd7d3d6cbf82d1db9da48914c5c58f00","533232ca3b8450f589aabccdc4ed74761b77bfd281f6350234ea92c68d909f29","c8b9be80333b9d30ba5b3ff5ee35d44650627d95fc1e472b5a3cfc7d5d136c4d","046e29d267d600545c9b8a1d9e6eef65a0fac72f38a33131c9443d2c6fed2a39","c7049a2bcd0c7a04f66bf3936cf02330281228d4b5303e136fc1c14b0fddc6a6","87880a6244c28fcceaad1d03cb09ff35fe218a7ed55aa553e2b1660ea1305e1c",{"version":"8863fd7fdb320b31f6bea05647789cb7895d4e791c82615d448e5a3378c5264f","affectsGlobalScope":true},"41f45ed6b4cd7b8aec2e4888a47d5061ee1020f89375b57d388cfe1f05313991","95e6580d60d580c8cd6a42d3853eda0da840d64139a58ecb56ed9a2f8ff42d6e","bec45e0777e88662fdbb5e8ef48f3fd1a474768075abe838b184973025c94244",{"version":"2f5af51c7e49488b655ee06acbd3dcc213eafec3d173aea1c575a4d81943beba","signature":"b5935e14b35a9b92d07d0423e9f9f03c6bf702b7328c22bc200bb9c715d68252"},{"version":"75f6340fe4bf433c25463fffd76482589233b5a7a5b2dcdb66c0f95d8c5418a9","signature":"eb7a69b114ca442c553402f3de61e8db9b7e7af277f9ecac50dc43587b8436e7"},{"version":"ce65cdd9602fb777ff102022d5c9f955dec58568071a2bd56ac86b726a9f63e3","signature":"fcf0cb6f99bfe1fa672e0cf6a2b7b18a94a08c02654a50384044979d1f585bd9"},{"version":"e4317dc2e67924da0b0918c317efe5b8ffaf2f54236456d09b5938e805dd2797","signature":"8933119345d095add124a88affc8795ab3226f68c7c013912f688214f1a2c3e6"},"9971931daaf18158fc38266e838d56eb5d9d1f13360b1181bb4735a05f534c03","408ae1a99c21dd9f62fa113df3909ca9f84114110449adf967cd9ae9b809f7c6","1c6b435ada46ccb1391845689ad728302b7a2a8ba4368809eba7cf9a36bb8bac","3d8a5442086d2de0150bd23fee908fd0114489659ba432a9bb104b29ffe4b2e9","416abc7c960fa169e2f17961ca1223c3c6fa8f1185a5d9b1917b2509303e50a1","ba3910bc59a961a41e472b03a41619b52af09da77aa3ce374aaa3fa52e8878e6","352031ac2e53031b69a09355e09ad7d95361edf32cc827cfe2417d80247a5a50","853b8bdb5da8c8e5d31e4d715a8057d8e96059d6774b13545c3616ed216b890c","45a2e5dd34fb6f09d5f470754feed94cdef48891a08b7999fd2033a0653f038e","61ca9d453735a9980fbef4994e8a803c10f48669c5be2ea04a9083c2ba543651","71ed8ea79e33c1529e89780e6ce491acdd4480ae24c380c60ba2fb694bd53dc3","86f36b51ce6a836610db6a3b6276e8ea42f262441c8bc5e6ae039f6b86a5094d","54fdb2ae0c92a76a7ba795889c793fff1e845fab042163f98bc17e5141bbe5f3","4b3049a2c849f0217ff4def308637931661461c329e4cf36aeb31db34c4c0c64","174b64363af0d3d9788584094f0f5a4fac30c869b536bb6bad9e7c3c9dce4c1d","e6406269bac7149e56ac2dff81d48f5b8c02ce06b5ee0f4f6a43202f2043e439","272fb339da934546c1e0d6c55165f309c2fe965ba7ce03bfda13f0cdcba9e8f9","b8371b67b64727bb527b6605fa88846dd2ca705434839504fd1a025d7b6badf5","d4f7a7a5f66b9bc6fbfd53fa08dcf8007ff752064df816da05edfa35abd2c97c","6f728f0b2b0d9a9bf29c2a403431fcc39b0f6c8073b5b387dafc92d41cacbd5d","89316bf786d1fb2d9ef999e2b4ffb7a9d66491d55a362e8f457b67a97f8b60f1","facde2bec0f59cf92f4635ece51b2c3fa2d0a3bbb67458d24af61e7e6b8f003c","4669194e4ca5f7c160833bbb198f25681e629418a6326aba08cf0891821bfe8f","f919471289119d2e8f71aba81869b01f30f790e8322cf5aa7e7dee8c8dadd00a","3b9f5af0e636b312ec712d24f611225188627838967191bf434c547b87bde906","e9bc0db0144701fab1e98c4d595a293c7c840d209b389144142f0adbc36b5ec2","27907f228d9dc12a029cc2fd3093f7a69b14943687e5cce68325be02eba8b648",{"version":"7252ed9cc0cb7d1b231750ab5039a92b1f59c33983d274cb2b0004fe8bd4dc13","signature":"8126e383bbd58456c2a80da6870fb088ca1391f025dd3c08d571dd44203326db"},{"version":"8ff80360d403e600fb5bac90184050bc5da327c9a7f341fb5df7234226fbb542","signature":"a28959621efdf8c9996dc0c360eab964ca698cac0b81d66c8bf12c8cc2f086f1"},{"version":"24b2c00699b5a31ccd8de5fe939e0b7ee0089582c67f3421899f043bd45c1c90","signature":"360c5289d0926d5e5742ae89bc5cb2ad30e5ae2fe607e4c142edca8f9916c825"},{"version":"8252cc516d6a6140242806a96aaad2dfa820f7fa6a2e35653cb938bf3e4bf1a7","signature":"5132a098ef041b8deae9e59087de680082bfb856ea408c9184a4397f1b434efc"},{"version":"d53969d74f4a60253d03d40561153d3d6888a12d09d0a6e90b292ed9d60f5fb1","signature":"4f3d9e60d5d8029f2a3695fba3119cbefd36c12cdfb8dda7a866b63c9fcbe512"},{"version":"9b9fffd6b6b8d0b2934cddbcad0c7ab07a94a6252ac912a34e8e557a5d4d7cf8","signature":"9a8ef88d18826badd768c762995eb9b085836ff25de2a67d05b1ac925b1f1afd"},{"version":"4a488f75c008913229037d93097147b090d0856005afcf268924fd2695584f93","signature":"7b8665df4b6742f13055d6112741f1806d88715693a6dfdfbe508190137212c9"},{"version":"a61fc1462fb90ee994df97e733e7ffbd2c497831a68ad2e52e4f565e038c1bb4","signature":"f3bb8b8fd58d36dd5484c8f9c4809adb2e1b9c48a3045eeb48d07a80a302f311"},"006af5d98fcac4f0ec36fc56d2d313696729b5bc8b1ee07f7904f464a8ad6688","0b0a578222f62a2daa0da4b6578d1f0f9b723c2919eff85c8316e1de63ac2e79","41ffe2ecfe6c0674e5cb1cb132133dd3067cb5e15ee333d8e4106d87169e2b16",{"version":"b21051ad1117b71f9259266421e8b6b05c47da859cad4cfabbbeb7a37e7b110e","signature":"c57271963c4a06e96da9b69b3dc15472d9419af8e4bb31564b499713db5a9896"},"1023f27f1c7fac418a32cc7baecfa8751d4339dec44384446f3e64cf638e4999","81590b9ee626adf5f0e2da891a1201cdefcef89cb1b69b321b99b20b066573ad","f07fdd1902d5c1dcb5315740302d7dc99afee2ddebd25bfcd0042a0aebe0c49a",{"version":"6fcaaefd1bbe27b131f26a11a59d3fed5c7df6b94de8e7fb1f882a1e43eb4111","signature":"b37a4728b494c1fc048aa4de2d59356301c94fc8d8810f86d074d8f01e73f945"},{"version":"c0b65bf533e29df509d38cff81ab869754104a9a7d9c927ce6d9d8be2599236c","signature":"2b05a20c72e7ec11a1bfd1b5f50e54223ff810efd87d3bcfb480f8d482d90647"},{"version":"0e2f649dcbf6e5c8ae85eb085b168392770ac5ba4d68d12c7000444c762dc022","signature":"64ce2b40f82ad7e274c300d8e5a7fc72078729597ea4971946d59d3e856c200c"},{"version":"75ee85d8328c9827a66ee542993554f3a99d2fdf006b1fc6795e3b72344fbdb6","signature":"1f47cef8db1f0099d1ec5b82ef85af24f08532521f9b6a03fb002d55e5fdec5a"},{"version":"7f6a11af4c1df62c7523590021764986930fc96204279bb241e13c7fac6945fd","signature":"eaae537a53cd7299868420d602d1a153b749eeba22dccfb96743a308b6811308"},"85025d06b8bca5aa1a3cc9c8023f1c76e577a4b6f7a62992f7c7b0a6fafff7d3",{"version":"d88401dd5b8b535f6ce9abd31ff071979169679b9e19514dbc31afc0308140da","signature":"cc821186b2152071de93da762877bdc722e1dd860f3721a19bd6a59cd3f21d6f"},"62194fa792cafcf41fcb37c760045fa599cbfd77945c726f908f889dc329a60f",{"version":"52114938f4064e6756516d152ccbc649bf0727f726c67e10877ca4e259e4a4f3","signature":"9c20e53a0e7901cd8ce47001e2a15a5519e181fc12217b2b7baa9a64d97e9995"},{"version":"6420f8088972961c6455402e06b58d376a67dd47b751eac0cb91fd940195fbbd","signature":"db025dc8780ee47e3165af64d41494f13a64abb6b6441d6fe18fe26f0820f0e3"},"adb17fea4d847e1267ae1241fa1ac3917c7e332999ebdab388a24d82d4f58240","ee7d8894904b465b072be0d2e4b45cf6b887cdba16a467645c4e200982ece7ea",{"version":"9cd8a69c38b48159fc18e44b73a23c234a951bd7a50098230205e6982fd345c1","affectsGlobalScope":true},"a7ca2a9e61286d74bc37fe64e5dcd7da04607f7f5432f7c651b47b573fc76cef","035a5df183489c2e22f3cf59fc1ed2b043d27f357eecc0eb8d8e840059d44245","a4809f4d92317535e6b22b01019437030077a76fec1d93b9881c9ed4738fcc54","5f53fa0bd22096d2a78533f94e02c899143b8f0f9891a46965294ee8b91a9434","f3d8c757e148ad968f0d98697987db363070abada5f503da3c06aefd9d4248c1","96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538","2db0dd3aaa2ed285950273ce96ae8a450b45423aa9da2d10e194570f1233fa6b","7394959e5a741b185456e1ef5d64599c36c60a323207450991e7a42e08911419","4967529644e391115ca5592184d4b63980569adf60ee685f968fd59ab1557188","5929864ce17fba74232584d90cb721a89b7ad277220627cc97054ba15a98ea8f","7180c03fd3cb6e22f911ce9ba0f8a7008b1a6ddbe88ccf16a9c8140ef9ac1686","25c8056edf4314820382a5fdb4bb7816999acdcb929c8f75e3f39473b87e85bc","54cb85a47d760da1c13c00add10d26b5118280d44d58e6908d8e89abbd9d7725","3e4825171442666d31c845aeb47fcd34b62e14041bb353ae2b874285d78482aa","c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","a967bfe3ad4e62243eb604bf956101e4c740f5921277c60debaf325c1320bf88","e9775e97ac4877aebf963a0289c81abe76d1ec9a2a7778dbe637e5151f25c5f3","471e1da5a78350bc55ef8cef24eb3aca6174143c281b8b214ca2beda51f5e04a","cadc8aced301244057c4e7e73fbcae534b0f5b12a37b150d80e5a45aa4bebcbd","385aab901643aa54e1c36f5ef3107913b10d1b5bb8cbcd933d4263b80a0d7f20","9670d44354bab9d9982eca21945686b5c24a3f893db73c0dae0fd74217a4c219","db3435f3525cd785bf21ec6769bf8da7e8a776be1a99e2e7efb5f244a2ef5fee","c3b170c45fc031db31f782e612adf7314b167e60439d304b49e704010e7bafe5","40383ebef22b943d503c6ce2cb2e060282936b952a01bea5f9f493d5fb487cc7","4893a895ea92c85345017a04ed427cbd6a1710453338df26881a6019432febdd","3a84b7cb891141824bd00ef8a50b6a44596aded4075da937f180c90e362fe5f6","13f6f39e12b1518c6650bbb220c8985999020fe0f21d818e28f512b7771d00f9","9b5369969f6e7175740bf51223112ff209f94ba43ecd3bb09eefff9fd675624a","4fe9e626e7164748e8769bbf74b538e09607f07ed17c2f20af8d680ee49fc1da","24515859bc0b836719105bb6cc3d68255042a9f02a6022b3187948b204946bd2","33203609eba548914dc83ddf6cadbc0bcb6e8ef89f6d648ca0908ae887f9fcc5","0db18c6e78ea846316c012478888f33c11ffadab9efd1cc8bcc12daded7a60b6","89167d696a849fce5ca508032aabfe901c0868f833a8625d5a9c6e861ef935d2","e53a3c2a9f624d90f24bf4588aacd223e7bec1b9d0d479b68d2f4a9e6011147f","339dc5265ee5ed92e536a93a04c4ebbc2128f45eeec6ed29f379e0085283542c","9f0a92164925aa37d4a5d9dd3e0134cff8177208dba55fd2310cd74beea40ee2","8bfdb79bf1a9d435ec48d9372dc93291161f152c0865b81fc0b2694aedb4578d","2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","d32275be3546f252e3ad33976caf8c5e842c09cb87d468cb40d5f4cf092d1acc","4a0c3504813a3289f7fb1115db13967c8e004aa8e4f8a9021b95285502221bd1",{"version":"e7be367719c613d580d4b27fdf8fe64c9736f48217f4b322c0d63b2971460918","affectsGlobalScope":true},"3d77c73be94570813f8cadd1f05ebc3dc5e2e4fdefe4d340ca20cd018724ee36",{"version":"dd78bfe9dfcadb2c4cd3a3a36df38fb3ef8ed2c601b57f6ad9a29e38a17ff39c","affectsGlobalScope":true},"62f1c00d3d246e0e3cf0224f91e122d560428ec1ccc36bb51d4574a84f1dbad0","53f0960fdcc53d097918adfd8861ffbe0db989c56ffc16c052197bf115da5ed6",{"version":"662163e5327f260b23ca0a1a1ad8a74078aabb587c904fcb5ef518986987eaff","affectsGlobalScope":true},"a40826e8476694e90da94aa008283a7de50d1dafd37beada623863f1901cb7fb",{"version":"f85c06e750743acf31f0cfd3be284a364d469761649e29547d0dd6be48875150","affectsGlobalScope":true},"b0c0d1d13be149f790a75b381b413490f98558649428bb916fd2d71a3f47a134","3c884d9d9ec454bdf0d5a0b8465bf8297d2caa4d853851d92cc417ac6f30b969","0364f8bb461d6e84252412d4e5590feda4eb582f77d47f7a024a7a9ff105dfdc","5433f7f77cd1fd53f45bd82445a4e437b2f6a72a32070e907530a4fea56c30c8","d0ca5d7df114035258a9d01165be309371fcccf0cccd9d57b1453204686d1ed0",{"version":"ee1ee365d88c4c6c0c0a5a5701d66ebc27ccd0bcfcfaa482c6e2e7fe7b98edf7","affectsGlobalScope":true},{"version":"9a30b7fefd7f8abbca4828d481c61c18e40fe5ff107e113b1c1fcd2c8dcf2743","affectsGlobalScope":true},"173b6275a81ebdb283b180654890f46516c21199734fed01a773b1c168b8c45c","304f66274aa8119e8d65a49b1cff84cbf803def6afe1b2cc987386e9a9890e22","1b9adafe8a7fefaeaf9099a0e06f602903f6268438147b843a33a5233ac71745","98273274f2dbb79b0b2009b20f74eca4a7146a3447c912d580cd5d2d94a7ae30","c933f7ba4b201c98b14275fd11a14abb950178afd2074703250fe3654fc10cd2","2eaa31492906bc8525aff3c3ec2236e22d90b0dfeee77089f196cd0adf0b3e3b",{"version":"ea455cc68871b049bcecd9f56d4cf27b852d6dafd5e3b54468ca87cc11604e4d","affectsGlobalScope":true},"8f5814f29dbaf8bacd1764aebdf1c8a6eb86381f6a188ddbac0fcbaab855ce52","a63d03de72adfb91777784015bd3b4125abd2f5ef867fc5a13920b5649e8f52b","d20e003f3d518a7c1f749dbe27c6ab5e3be7b3c905a48361b04a9557de4a6900",{"version":"1d4d78c8b23c9ddaaaa49485e6adc2ec01086dfe5d8d4d36ca4cdc98d2f7e74a","affectsGlobalScope":true},{"version":"44fc16356b81c0463cc7d7b2b35dcf324d8144136f5bc5ce73ced86f2b3475b5","affectsGlobalScope":true},"575fb200043b11b464db8e42cc64379c5fd322b6d787638e005b5ee98a64486d","6de2f225d942562733e231a695534b30039bdf1875b377bb7255881f0df8ede8","56249fd3ef1f6b90888e606f4ea648c43978ef43a7263aafad64f8d83cd3b8aa","139ad1dc93a503da85b7a0d5f615bddbae61ad796bc68fedd049150db67a1e26","7b166975fdbd3b37afb64707b98bca88e46577bbc6c59871f9383a7df2daacd1","9eece5e586312581ccd106d4853e861aaaa1a39f8e3ea672b8c3847eedd12f6e","81505c54d7cad0009352eaa21bd923ab7cdee7ec3405357a54d9a5da033a2084","269929a24b2816343a178008ac9ae9248304d92a8ba8e233055e0ed6dbe6ef71","93452d394fdd1dc551ec62f5042366f011a00d342d36d50793b3529bfc9bd633","3c1f19c7abcda6b3a4cf9438a15c7307a080bd3b51dfd56b198d9f86baf19447","2ee1645e0df9d84467cfe1d67b0ad3003c2f387de55874d565094464ee6f2927",{"version":"257ff9424de2bf36ba29f928e268cf6075fb7a0c2acd339c9ad7ac64653081d2","affectsGlobalScope":true},{"version":"9cf780e96b687e4bdfd1907ed26a688c18b89797490a00598fa8b8ab683335dd","affectsGlobalScope":true},"98e00f3613402504bc2a2c9a621800ab48e0a463d1eed062208a4ae98ad8f84c","9ae88ce9f73446c24b2d2452e993b676da1b31fca5ceb7276e7f36279f693ed1","e49d7625faff2a7842e4e7b9b197f972633fca685afcf6b4403400c97d087c36","b82c38abc53922b1b3670c3af6f333c21b735722a8f156e7d357a2da7c53a0a0",{"version":"b423f53647708043299ded4daa68d95c967a2ac30aa1437adc4442129d7d0a6c","affectsGlobalScope":true},{"version":"7245af181218216bacb01fbdf51095617a51661f20d77178c69a377e16fb69ed","affectsGlobalScope":true},"4f0fc7b7f54422bd97cfaf558ddb4bca86893839367b746a8f86b60ac7619673","4cdd8b6b51599180a387cc7c1c50f49eca5ce06595d781638fd0216520d98246","d91a7d8b5655c42986f1bdfe2105c4408f472831c8f20cf11a8c3345b6b56c8c",{"version":"8704423bf338bff381ebc951ed819935d0252d90cd6de7dffe5b0a5debb65d07","affectsGlobalScope":true},"7c6929fd7cbf38499b6a600b91c3b603d1d78395046dc3499b2b92d01418b94b",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"a42be67ed1ddaec743582f41fc219db96a1b69719fccac6d1464321178d610fc","8b5402ae709d042c3530ed3506c135a967159f42aed3221267e70c5b7240b577","254d9fb8c872d73d34594be8a200fd7311dbfa10a4116bfc465fba408052f2b3","cf3d384d082b933d987c4e2fe7bfb8710adfd9dc8155190056ed6695a25a559e","9871b7ee672bc16c78833bdab3052615834b08375cb144e4d2cba74473f4a589","c863198dae89420f3c552b5a03da6ed6d0acfa3807a64772b895db624b0de707","8b03a5e327d7db67112ebbc93b4f744133eda2c1743dbb0a990c61a8007823ef","86c73f2ee1752bac8eeeece234fd05dfcf0637a4fbd8032e4f5f43102faa8eec","42fad1f540271e35ca37cecda12c4ce2eef27f0f5cf0f8dd761d723c744d3159","ff3743a5de32bee10906aff63d1de726f6a7fd6ee2da4b8229054dfa69de2c34","83acd370f7f84f203e71ebba33ba61b7f1291ca027d7f9a662c6307d74e4ac22","1445cec898f90bdd18b2949b9590b3c012f5b7e1804e6e329fb0fe053946d5ec","0e5318ec2275d8da858b541920d9306650ae6ac8012f0e872fe66eb50321a669","cf530297c3fb3a92ec9591dd4fa229d58b5981e45fe6702a0bd2bea53a5e59be","c1f6f7d08d42148ddfe164d36d7aba91f467dbcb3caa715966ff95f55048b3a4","f4e9bf9103191ef3b3612d3ec0044ca4044ca5be27711fe648ada06fad4bcc85","0c1ee27b8f6a00097c2d6d91a21ee4d096ab52c1e28350f6362542b55380059a","7677d5b0db9e020d3017720f853ba18f415219fb3a9597343b1b1012cfd699f7","bc1c6bc119c1784b1a2be6d9c47addec0d83ef0d52c8fbe1f14a51b4dfffc675","52cf2ce99c2a23de70225e252e9822a22b4e0adb82643ab0b710858810e00bf1","770625067bb27a20b9826255a8d47b6b5b0a2d3dfcbd21f89904c731f671ba77","d1ed6765f4d7906a05968fb5cd6d1db8afa14dbe512a4884e8ea5c0f5e142c80","799c0f1b07c092626cf1efd71d459997635911bb5f7fc1196efe449bba87e965","2a184e4462b9914a30b1b5c41cf80c6d3428f17b20d3afb711fff3f0644001fd","9eabde32a3aa5d80de34af2c2206cdc3ee094c6504a8d0c2d6d20c7c179503cc","397c8051b6cfcb48aa22656f0faca2553c5f56187262135162ee79d2b2f6c966","a8ead142e0c87dcd5dc130eba1f8eeed506b08952d905c47621dc2f583b1bff9","a02f10ea5f73130efca046429254a4e3c06b5475baecc8f7b99a0014731be8b3","c2576a4083232b0e2d9bd06875dd43d371dee2e090325a9eac0133fd5650c1cb","4c9a0564bb317349de6a24eb4efea8bb79898fa72ad63a1809165f5bd42970dd","f40ac11d8859092d20f953aae14ba967282c3bb056431a37fced1866ec7a2681","cc11e9e79d4746cc59e0e17473a59d6f104692fd0eeea1bdb2e206eabed83b03","b444a410d34fb5e98aa5ee2b381362044f4884652e8bc8a11c8fe14bbd85518e","c35808c1f5e16d2c571aa65067e3cb95afeff843b259ecfa2fc107a9519b5392","14d5dc055143e941c8743c6a21fa459f961cbc3deedf1bfe47b11587ca4b3ef5","a3ad4e1fc542751005267d50a6298e6765928c0c3a8dce1572f2ba6ca518661c","f237e7c97a3a89f4591afd49ecb3bd8d14f51a1c4adc8fcae3430febedff5eb6","3ffdfbec93b7aed71082af62b8c3e0cc71261cc68d796665faa1e91604fbae8f","662201f943ed45b1ad600d03a90dffe20841e725203ced8b708c91fcd7f9379a","c9ef74c64ed051ea5b958621e7fb853fe3b56e8787c1587aefc6ea988b3c7e79","2462ccfac5f3375794b861abaa81da380f1bbd9401de59ffa43119a0b644253d","34baf65cfee92f110d6653322e2120c2d368ee64b3c7981dff08ed105c4f19b0","7d8ddf0f021c53099e34ee831a06c394d50371816caa98684812f089b4c6b3d4","ab82804a14454734010dcdcd43f564ff7b0389bee4c5692eec76ff5b30d4cf66","bae8d023ef6b23df7da26f51cea44321f95817c190342a36882e93b80d07a960","ae271d475b632ce7b03fea6d9cf6da72439e57a109672671cbc79f54e1386938"],"root":[[83,86],[114,138]],"options":{"allowJs":true,"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"esModuleInterop":true,"jsx":4,"module":5,"noFallthroughCasesInSwitch":true,"outDir":"./dist","rootDir":"./src","skipLibCheck":true,"sourceMap":true,"target":2},"fileIdsList":[[76,78],[88],[87,88],[87,88,89,90,91,92,93,94],[87,88,89],[69,95],[69,70],[69,70,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112],[95,96],[69],[95],[95,96,104],[95,96,98],[143],[144],[235],[148],[184],[185,190,219],[186,191,197,198,205,216,227],[186,187,197,205],[188,228],[189,190,198,206],[190,216,224],[191,193,197,205],[184,192],[193,194],[197],[195,197],[184,197],[197,198,199,216,227],[197,198,199,212,216,219],[182,185,232],[193,197,200,205,216,227],[197,198,200,201,205,216,224,227],[200,202,216,224,227],[148,149,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234],[197,203],[204,227,232],[193,197,205,216],[206],[207],[184,208],[205,206,209,226,232],[210],[211],[197,212,213],[212,214,228,230],[185,197,216,217,218,219],[185,216,218],[216,217],[219],[220],[216],[197,222,223],[222,223],[190,205,216,224],[225],[205,226],[185,200,211,227],[190,228],[216,229],[204,230],[231],[185,190,197,199,208,216,227,230,232],[216,233],[66,67,68],[238,277],[238,262,277],[277],[238],[238,263,277],[238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276],[263,277],[279],[72,74,76],[71,75],[73],[72],[77],[159,163,227],[159,216,227],[154],[156,159,224,227],[205,224],[154,235],[156,159,205,227],[151,152,155,158,185,197,216,227],[151,157],[155,159,185,219,227,235],[185,235],[175,185,235],[153,154,235],[159],[153,154,155,156,157,158,159,160,161,163,164,165,166,167,168,169,170,171,172,173,174,176,177,178,179,180,181],[159,166,167],[157,159,167,168],[158],[151,154,159],[159,163,167,168],[163],[157,159,162,227],[151,156,157,159,163,166],[185,216],[154,159,175,185,232,235],[80,81],[80],[69,70,79,84,85],[69,70,113],[70,86,114],[70,79,86,113],[70,79,84,86,113],[70,115,116,117,118,119,120,121,122,123,124,125,126,127,128],[70,86,113],[70,79,85,86,114,129],[70,129,131,132],[70,82,83],[70,82],[70,83,84],[70],[69,79],[86,114],[79,96],[115,116,117,118,119,120,121,122,123,124,125,126,127,128],[96],[69,79,86,129],[129,131,132],[82],[83,84]],"referencedMap":[[79,1],[93,2],[89,3],[95,4],[91,5],[94,2],[90,5],[107,6],[105,6],[106,7],[113,8],[104,9],[112,10],[103,11],[98,9],[96,11],[111,12],[108,11],[110,9],[109,11],[97,9],[99,13],[101,9],[102,9],[100,9],[142,10],[144,14],[145,15],[236,16],[148,17],[149,17],[184,18],[185,19],[186,20],[187,21],[188,22],[189,23],[190,24],[191,25],[192,26],[193,27],[194,27],[196,28],[195,29],[197,30],[198,31],[199,32],[183,33],[200,34],[201,35],[202,36],[235,37],[203,38],[204,39],[205,40],[206,41],[207,42],[208,43],[209,44],[210,45],[211,46],[212,47],[213,47],[214,48],[216,49],[218,50],[217,51],[219,52],[220,53],[221,54],[222,55],[223,56],[224,57],[225,58],[226,59],[227,60],[228,61],[229,62],[230,63],[231,64],[232,65],[233,66],[237,16],[139,10],[69,67],[70,10],[262,68],[263,69],[238,70],[241,70],[260,68],[261,68],[251,68],[250,71],[248,68],[243,68],[256,68],[254,68],[258,68],[242,68],[255,68],[259,68],[244,68],[245,68],[257,68],[239,68],[246,68],[247,68],[249,68],[253,68],[264,72],[252,68],[240,68],[277,73],[271,72],[273,74],[272,72],[265,72],[266,72],[268,72],[270,72],[274,74],[275,74],[267,74],[269,74],[280,75],[75,76],[76,77],[74,78],[73,79],[78,80],[166,81],[173,82],[165,81],[180,83],[157,84],[156,85],[179,16],[174,86],[177,87],[159,88],[158,89],[154,90],[153,91],[176,92],[155,93],[160,94],[164,94],[182,95],[181,94],[168,96],[169,97],[171,98],[167,99],[170,100],[175,16],[162,101],[163,102],[172,103],[152,104],[178,105],[82,106],[81,107],[86,108],[114,109],[131,110],[134,111],[135,112],[136,111],[137,111],[129,113],[138,111],[127,111],[126,111],[115,111],[116,112],[117,112],[118,112],[119,114],[120,111],[121,111],[122,111],[123,111],[124,111],[128,111],[125,111],[130,115],[133,116],[84,117],[83,118],[132,119],[85,120]],"exportedModulesMap":[[79,1],[93,2],[89,3],[95,4],[91,5],[94,2],[90,5],[107,6],[105,6],[106,7],[113,8],[104,9],[112,10],[103,11],[98,9],[96,11],[111,12],[108,11],[110,9],[109,11],[97,9],[99,13],[101,9],[102,9],[100,9],[142,10],[144,14],[145,15],[236,16],[148,17],[149,17],[184,18],[185,19],[186,20],[187,21],[188,22],[189,23],[190,24],[191,25],[192,26],[193,27],[194,27],[196,28],[195,29],[197,30],[198,31],[199,32],[183,33],[200,34],[201,35],[202,36],[235,37],[203,38],[204,39],[205,40],[206,41],[207,42],[208,43],[209,44],[210,45],[211,46],[212,47],[213,47],[214,48],[216,49],[218,50],[217,51],[219,52],[220,53],[221,54],[222,55],[223,56],[224,57],[225,58],[226,59],[227,60],[228,61],[229,62],[230,63],[231,64],[232,65],[233,66],[237,16],[139,10],[69,67],[70,10],[262,68],[263,69],[238,70],[241,70],[260,68],[261,68],[251,68],[250,71],[248,68],[243,68],[256,68],[254,68],[258,68],[242,68],[255,68],[259,68],[244,68],[245,68],[257,68],[239,68],[246,68],[247,68],[249,68],[253,68],[264,72],[252,68],[240,68],[277,73],[271,72],[273,74],[272,72],[265,72],[266,72],[268,72],[270,72],[274,74],[275,74],[267,74],[269,74],[280,75],[75,76],[76,77],[74,78],[73,79],[78,80],[166,81],[173,82],[165,81],[180,83],[157,84],[156,85],[179,16],[174,86],[177,87],[159,88],[158,89],[154,90],[153,91],[176,92],[155,93],[160,94],[164,94],[182,95],[181,94],[168,96],[169,97],[171,98],[167,99],[170,100],[175,16],[162,101],[163,102],[172,103],[152,104],[178,105],[82,106],[81,107],[86,121],[114,10],[131,122],[134,111],[135,123],[136,111],[137,123],[129,124],[138,123],[127,111],[126,111],[115,125],[116,123],[117,123],[118,123],[119,123],[120,123],[121,123],[122,111],[123,111],[124,111],[128,111],[125,123],[130,126],[133,127],[84,128],[83,128],[132,129]],"semanticDiagnosticsPerFile":[79,93,89,95,91,92,94,90,87,88,107,105,106,113,104,112,103,98,96,111,108,110,109,97,99,101,102,100,140,141,142,143,144,145,146,147,236,148,149,184,185,186,187,188,189,190,191,192,193,194,196,195,197,198,199,183,234,200,201,202,235,203,204,205,206,207,208,209,210,211,212,213,214,215,216,218,217,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,237,68,139,66,69,70,262,263,238,241,260,261,251,250,248,243,256,254,258,242,255,259,244,245,257,239,246,247,249,253,264,252,240,277,276,271,273,272,265,266,268,270,274,275,267,269,278,279,280,150,67,75,76,74,73,71,72,77,78,64,65,12,13,15,14,2,16,17,18,19,20,21,22,23,3,4,24,28,25,26,27,29,30,31,5,32,33,34,35,6,39,36,37,38,40,7,41,46,47,42,43,44,45,8,51,48,49,50,52,9,53,54,55,58,56,57,59,60,10,1,11,63,62,61,166,173,165,180,157,156,179,174,177,159,158,154,153,176,155,160,161,164,151,182,181,168,169,171,167,170,175,162,163,172,152,178,82,81,80,86,114,131,134,135,136,137,129,138,127,126,115,116,117,118,119,120,121,122,123,124,128,125,130,133,84,83,132,85],"emitSignatures":[122,123,124,126,127,128,134,136],"latestChangedDtsFile":"./dist/hooks/messages/useSendPrivateMessage.d.ts"},"version":"5.3.3"} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..d077d69c --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "rootDir": ".", + "target": "ESNext", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true, + "esModuleInterop": true, + "noUnusedLocals": false, + "noFallthroughCasesInSwitch": true, + "useUnknownInCatchVariables": false, + "moduleResolution": "Bundler", + "resolveJsonModule": true, + "isolatedModules": true, + "downlevelIteration": true, + "allowSyntheticDefaultImports": true, + "jsx": "preserve", + "module": "ES2015", + "declaration": true, + "sourceMap": true, + "baseUrl": "./", + + }, + "include": ["./packages/**/*", "./apps/**/*"], + "exclude": ["node_modules"] + } + \ No newline at end of file From 1ab10e94a9f5ffbaf2a1cf1ef6bb3fda64cb2b4a Mon Sep 17 00:00:00 2001 From: MSGhais Date: Thu, 8 Aug 2024 19:04:14 +0200 Subject: [PATCH 16/16] lint fix --- apps/website/src/app/layout.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/website/src/app/layout.tsx b/apps/website/src/app/layout.tsx index 8d2f3ae9..b31911a8 100644 --- a/apps/website/src/app/layout.tsx +++ b/apps/website/src/app/layout.tsx @@ -1,13 +1,14 @@ import './index.css'; -import type { Metadata } from 'next'; +import type {Metadata} from 'next'; + import Providers from './providers'; export const metadata: Metadata = { title: 'afk community portal', description: 'afk community portal', }; -export default function RootLayout({ children }: { children: React.ReactNode }) { +export default function RootLayout({children}: {children: React.ReactNode}) { return (