22});
23
24// Function to handle GraphQL requests
25async function handleGraphQLRequest(request: Request): Promise<Response> {
26 const { query, variables } = await request.json();
27
39}
40
41// HTTP handler function
42export default altairClient(async function(req: Request): Promise<Response> {
43 if (req.method === "POST") {
44 return handleGraphQLRequest(req);
40});
41
42async function getProfile(username: string): Promise<Profile | null> {
43 const response = await social.get({
44 keys: [`${username}/profile/**`],
54}
55
56function SkeletonLoader() {
57 return (
58 <div className="w-full flex flex-col items-center justify-center space-y-4">
70}
71
72function BirthdayBanner({ name }: { name: string }) {
73 return (
74 <div className="birthday-banner">
78}
79
80function launchConfetti() {
81 const defaults = { startVelocity: 45, spread: 90, ticks: 100, zIndex: 1000 };
82
96}
97
98function App({ initialAccountId }: { initialAccountId: string }) {
99 const [profile, setProfile] = useState<Profile | null>(null);
100 const [loading, setLoading] = useState(true);
168}
169
170function getSocialLink(platform: string, username: string) {
171 const links: Record<string, string> = {
172 github: `https://github.com/${username}`,
179}
180
181function getSocialIcon(platform: string) {
182 const icons: Record<string, string> = {
183 github: "📂",
190}
191
192export function client(accountId: string) {
193 createRoot(document.getElementById("root")).render(<App initialAccountId={accountId} />);
194}
195
196export default async function server(request: Request): Promise<Response> {
197 const url = new URL(request.url);
198 const accountId = url.pathname.split("/").pop() || "efiz.near"; // Default to 'efiz.near' if no accountId is provided
5import { falProxyRequest } from "https://esm.town/v/stevekrouse/falProxyRequest";
6
7function App() {
8 const [prompt, setPrompt] = useState("");
9 const [imageUrl, setImageUrl] = useState("");
103}
104
105function client() {
106 createRoot(document.getElementById("root")).render(<App />);
107}
108if (typeof document !== "undefined") { client(); }
109
110export default async function server(req: Request): Promise<Response> {
111 const url = new URL(req.url);
112 if (url.pathname === "/") {
11import { load } from "npm:cheerio";
12
13async function archive(url: string) {
14 const response = await fetch(url);
15 const body = await response.text();
7import About from "https://esm.town/v/vawogbemi/whoIsHiringAbout";
8
9function App() {
10 const tabs = { "/": "Home", "/about": "About" };
11 const [activeTab, setActiveTab] = useState("/");
352}
353
354function ServerApp() {
355 return (
356 <html>
375}
376
377export default async function(req: Request): Promise<Response> {
378 const url = new URL(req.url);
379 if (url.pathname === "/api/stories") {
31
32// ------------
33// Functions
34// ------------
35
36async function execute(statement: InStatement, args?: InArgs): Promise<ResultSet> {
37 const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38 method: "POST",
49}
50
51async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
52 const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
53 method: "POST",
64}
65
66function createResError(body: string) {
67 try {
68 const e = zLibsqlError.parse(JSON.parse(body));
85}
86
87function normalizeStatement(statement: InStatement, args?: InArgs) {
88 if (Array.isArray(statement)) {
89 // for the case of an array of arrays
107}
108
109function upgradeResultSet(results: ImpoverishedResultSet): ResultSet {
110 return {
111 ...results,
116// adapted from
117// https://github.com/tursodatabase/libsql-client-ts/blob/17dd996b840c950dd22b871adfe4ba0eb4a5ead3/packages/libsql-client/src/sqlite3.ts#L314C1-L337C2
118function rowFromSql(
119 sqlRow: Array<unknown>,
120 columns: Array<string>,
31
32// ------------
33// Functions
34// ------------
35
36async function execute(statement: InStatement, args?: InArgs): Promise<ResultSet> {
37 const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38 method: "POST",
49}
50
51async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
52 const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
53 method: "POST",
64}
65
66function createResError(body: string) {
67 try {
68 const e = zLibsqlError.parse(JSON.parse(body));
85}
86
87function normalizeStatement(statement: InStatement, args?: InArgs) {
88 if (Array.isArray(statement)) {
89 // for the case of an array of arrays
107}
108
109function upgradeResultSet(results: ImpoverishedResultSet): ResultSet {
110 return {
111 ...results,
116// adapted from
117// https://github.com/tursodatabase/libsql-client-ts/blob/17dd996b840c950dd22b871adfe4ba0eb4a5ead3/packages/libsql-client/src/sqlite3.ts#L314C1-L337C2
118function rowFromSql(
119 sqlRow: Array<unknown>,
120 columns: Array<string>,
5import { falProxyRequest } from "https://esm.town/v/stevekrouse/falProxyRequest";
6
7function App() {
8 const [prompt, setPrompt] = useState("");
9 const [imageUrl, setImageUrl] = useState("");
103}
104
105function client() {
106 createRoot(document.getElementById("root")).render(<App />);
107}
108if (typeof document !== "undefined") { client(); }
109
110export default async function server(req: Request): Promise<Response> {
111 const url = new URL(req.url);
112 if (url.pathname === "/") {
160 });
161
162export default async function (req: Request): Promise<Response> {
163 const url = new URL(req.url);
164 if (url.pathname === "/") {
8};
9
10async function handleRequest(request) {
11 const url = new URL(request.url);
12