bluetoothscannerindex.ts1 match
20});
2122export default app.fetch;
HTTP_exampleshonoExample1 match
4app.get("/", (c) => c.text("Hello from Hono!"));
5app.get("/yeah", (c) => c.text("Routing!"));
6export default app.fetch;
HTTP_examplesfetsExample1 match
21});
2223export default router.fetch;
socialDataSearchmain.tsx2 matches
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
23export async function socialDataSearch(query: string): Promise<SocialDataResponse> {
4const url = new URL("https://stevekrouse-socialdataproxy.web.val.run/twitter/search");
5url.searchParams.set("query", query);
6return await fetchJSON(url.toString(), {
7bearer: Deno.env.get("valtown"),
8});
MiniAppStarterApp.tsx5 matches
9import { Button, Section } from "./components/ui.tsx";
10import { CustomHaptics } from "./screens/CustomHaptics.tsx";
11import { fetchNeynarGet } from "./util/neynar.ts";
1213export function App() {
7071function Database() {
72const queryFn = () => fetch("/api/counter/get").then((r) => r.json());
73const { data, refetch } = useQuery({ queryKey: ["counter"], queryFn });
74return (
75<Section className="flex flex-col items-start gap-3 m-5">
76{/* <h2 className="font-semibold">Database Example</h2> */}
77<div className="">Counter value: {data}</div>
78<Button variant="outline" onClick={() => fetch("/api/counter/increment").then(refetch)}>
79Increment
80</Button>
85function Neynar() {
86useEffect(() => {
87fetchNeynarGet("user/by_username?username=moe").then(console.log).catch(console.error);
88}, []);
89
667// This now directly calls the main analysis endpoint (which uses the new prompt)
668try {
669const response = await fetch(window.location.pathname + '?format=json&action=loanAssumptionInfo', { method: 'POST', body: formData });
670const responseData = await response.json();
671954export default async function(req: Request) {
955const { OpenAI } = await import("https://esm.town/v/std/openai");
956const { fetch } = await import("https://esm.town/v/std/fetch");
957// PDFExtract is kept if you want to add document features later, but not primary for this use case.
958const { PDFExtract, PDFExtractOptions } = await import("npm:pdf.js-extract");
590formData.append('inputSourceDescription', clientInputSourceDescription);
591try {
592const response = await fetch(window.location.pathname + '?action=suggestTasks&format=json', { method: 'POST', body: formData });
593const responseData = await response.json();
594(responseData.log || []).forEach(logEntry => {
636formData.append('inputSourceDescription', ni_currentInputSourceDescription);
637try {
638const response = await fetch(window.location.pathname + '?format=json', { method: 'POST', body: formData });
639const responseData = await response.json();
640(responseData.log || []).forEach(logEntry => {
881export default async function(req: Request) {
882const { OpenAI } = await import("https://esm.town/v/std/openai");
883const { fetch } = await import("https://esm.town/v/std/fetch");
884const { PDFExtract, PDFExtractOptions } = await import("npm:pdf.js-extract");
885const CORS_HEADERS = {
1001derivedInputSourceDescription = "Pasted Text";
1002} else if (input.documentUrl) {
1003log.push({ agent: ingestionAgent, type: "step", message: `Fetching from URL: ${input.documentUrl}` });
1004derivedInputSourceDescription = `URL: ${input.documentUrl}`;
1005try {
1006const response = await fetch(input.documentUrl, {
1007headers: { "Accept": "text/plain, text/html, application/pdf" },
1008});
1010const contentType = response.headers.get("content-type") || "";
1011if (contentType.includes("application/pdf")) {
1012log.push({ agent: ingestionAgent, type: "info", message: "Fetched PDF from URL. Extracting text..." });
1013const pdfBuffer = await response.arrayBuffer();
1014documentText = await extractPdfTextNative(
1019} else {
1020const text = await response.text();
1021if (!text || text.trim().length === 0) throw new Error("Fetched content is empty or not text.");
1022log.push({ agent: ingestionAgent, type: "info", message: `Fetched ~${text.length} characters from URL.` });
1023documentText = text;
1024}
1027agent: ingestionAgent,
1028type: "error",
1029message: `Failed to fetch/process URL ${input.documentUrl}: ${error.message}`,
1030});
1031}
141const [hasInteracted, setHasInteracted] = useState(false);
142const [useFallbackData, setUseFallbackData] = useState(false);
143const fetchedRecords = useRef(new Set());
144145const loadFallbackData = useCallback(() => {
207}, []);
208209const fetchReleases = useCallback(async () => {
210setIsLoading(true);
211setError(null);
212try {
213const response = await fetch(
214"https://ashryanio-getallreleasesfromdiscogs.web.val.run"
215);
217throw new Error(`HTTP error! status: ${response.status}`);
218}
219const fetchedRecords = await response.json();
220if (!Array.isArray(fetchedRecords)) {
221throw new Error("Received data is not an array");
222}
223224const shuffledRecords = shuffleArray(fetchedRecords);
225setRecords(shuffledRecords);
226setIsLoading(false);
227setUseFallbackData(false);
228} catch (error) {
229console.error("Failed to fetch releases:", error);
230setError(
231`Failed to load records: ${error.message}. The API endpoint might be down.`
236237useEffect(() => {
238fetchReleases();
239}, [fetchReleases]);
240241// Fetch release year for the current record
242useEffect(() => {
243async function fetchReleaseYear() {
244if (records.length === 0) return;
245247if (
248!currentRecord ||
249fetchedRecords.current.has(currentRecord.basic_information.master_id)
250) {
251return; // Skip if already fetched
252}
253254try {
255console.log("Fetching release year for:", currentRecord);
256const response = await fetch(
257`https://ashryanio-getallreleasesfromdiscogs.web.val.run/masters?id=${currentRecord.basic_information.master_id}`
258);
259if (!response.ok) {
260throw new Error(`Failed to fetch release year: ${response.status}`);
261}
262const data = await response.json();
263console.log("Fetched data:", data);
264265// Mark as fetched
266fetchedRecords.current.add(currentRecord.basic_information.master_id);
267268// Update the record
275);
276} catch (error) {
277console.error("Error fetching release year:", error);
278}
279}
280281fetchReleaseYear();
282}, [currentRecordIndex, records.length]);
283357<ErrorMessage
358message={error}
359retry={fetchReleases}
360useFallback={loadFallbackData}
361/>
templateTwitterAlertmain.tsx1 match
19: Math.floor((Date.now() - 2 * 24 * 60 * 60 * 1000) / 1000);
2021// Fetch and log tweets
22const response = await socialDataSearch(`${query} since_time:${timeFrame}`);
23console.log("Response from socialDataSearch:", response);
MiniAppStarterHome.tsx1 match
78import { Button, Input, Section } from "../components/ui.tsx";
9import { fetchUsersById } from "../util/neynar.ts";
1011export function Home() {