tuempresaValidationCatalogGemini.tsx17 matches
1import { blob } from "https://esm.town/v/std/blob";
2import { fetch } from "https://esm.town/v/std/fetch";
3import { sqlite } from "https://esm.town/v/std/sqlite";
424}
2526const fetchLinkedRecord = async (tableId: string, recordId: string) => {
27const res = await fetch(`https://api.airtable.com/v0/${AIRTABLE_BASE_ID}/${tableId}/${recordId}`, {
28headers: airtableHeaders,
29});
31const errorText = await res.text();
32// El error de Airtable será capturado aquĂ con el mensaje especĂfico
33throw new Error(`Airtable fetch failed for ${tableId}/${recordId}: ${res.status} - ${errorText}`);
34}
35return (await res.json()).fields;
36};
3738const fetchMultipleLinkedRecords = async (tableId: string, recordIds: string[]) => {
39if (!recordIds || recordIds.length === 0) return [];
40const records = await Promise.all(recordIds.map(id => fetchLinkedRecord(tableId, id)));
41return records;
42};
4344const updateAirtableFields = async (targetTable: string, targetRecordId: string, fields: Record<string, any>) => {
45const res = await fetch(`https://api.airtable.com/v0/${AIRTABLE_BASE_ID}/${targetTable}/${targetRecordId}`, {
46method: "PATCH",
47headers: airtableHeaders,
66console.log("Base de datos de catálogos SAT cargada.");
6768const viajeData = await fetchLinkedRecord(VIAJES_TABLE, recordId);
6970const emisorId = viajeData.Emisor?.[0];
81const [emisor, clienteOrigen, clienteDestino, origen, destino, unidad, operador, remolque, bienes] = await Promise
82.all([
83emisorId ? fetchLinkedRecord(CLIENTES_TABLE, emisorId) : Promise.resolve(null),
84clienteOrigenId ? fetchLinkedRecord(CLIENTES_TABLE, clienteOrigenId) : Promise.resolve(null),
85clienteDestinoId ? fetchLinkedRecord(CLIENTES_TABLE, clienteDestinoId) : Promise.resolve(null),
86origenId ? fetchLinkedRecord(UBICACIONES_TABLE, origenId) : Promise.resolve(null),
87destinoId ? fetchLinkedRecord(UBICACIONES_TABLE, destinoId) : Promise.resolve(null),
88unidadId ? fetchLinkedRecord(UNIDADES_TABLE, unidadId) : Promise.resolve(null),
89operadorId ? fetchLinkedRecord(OPERADORES_TABLE, operadorId) : Promise.resolve(null),
90remolqueId ? fetchLinkedRecord(REMOLQUES_TABLE, remolqueId) : Promise.resolve(null),
91fetchMultipleLinkedRecords(BIENES_TABLE, bienesIds),
92]);
93
CheckExamplemain.tsx2 matches
1let resp = await fetch("https://lsp-dev.val.town/auth", {
2method: "POST",
3headers: {
7});
8const cookie = resp.headers.get("set-cookie");
9resp = await fetch("https://lsp-dev.val.town/lsp/check", {
10method: "POST",
11headers: {
untitled-2430main.tsx1 match
123. In JavaScript:
13- Add an event listener to the “Get Quote” button.
14- Send an HTTP request to a Python back end to fetch a new random quote each time the button is clicked.
15- Update the quote box with the returned text.
16
221app.get("/main.js", serve(js, "text/javascript"));
222223export default app.fetch;
OptimismTrackerindex.ts1 match
34});
3536export default app.fetch;
FarcasterSpacesSpace.tsx7 matches
78import { Button, Input, Section, ShareButton, Sheet } from '../components/ui.tsx'
9import { fetchUsersById } from '../util/neynar.ts'
10import { supabase, fetchSpace } from '../util/supabase.ts'
1112import {
44const { id } = useParams()
4546const { data: space, isLoading } = useQuery({ queryKey: ['space', id], queryFn: () => fetchSpace(id) })
4748const [calling, setCalling] = useState(false)
139140const queryFn = () =>
141fetch(`/api/channels`)
142.then((r) => r.json())
143.then((r) => r?.data?.channels?.find((c) => c.channel_name == channel))
146147const join = async () => {
148const response = await fetch(`/api/token?channel=${channel}&uid=${uid}`).then((r) => r.json())
149console.log('response', response)
150setToken(response.token)
408if (!uid) return null
409if (uid > 2_000_000) return null
410return await fetchUsersById(`${uid}`).then((users) => users?.[0])
411}
412439440useEffect(() => {
441fetchSpace(id).then(setSpace)
442443const changes = supabase
FarcasterSpacesindex.tsx4 matches
7import { embedMetadata, handleFarcasterEndpoints, name } from './farcaster.ts'
8import { handleImageEndpoints } from './image.tsx'
9import { fetchNeynarGet } from './neynar.ts'
1011const app = new Hono()
28const url = new URL(c.req.url)
29const path = url.searchParams.get('path')
30const response = await fetchNeynarGet(path)
31return c.json(response)
32})
73})
7475// HTTP vals expect an exported "fetch handler"
76// This is how you "run the server" in Val Town with Hono
77export default app.fetch
78
FarcasterSpacesimage.tsx6 matches
5import satori from 'npm:satori'
67import { fetchSpace } from '../frontend/util/supabase.ts'
8import { fetchUsersById } from './neynar.ts'
910export function handleImageEndpoints(app: Hono) {
3839export async function spaceImage(channel: string) {
40const space = await fetchSpace(channel)
41if (!space) return await homeImage()
4243const users = await fetchUsersById([space.created_by, ...space.hosts, ...space.speakers].join(','))
4445const hostFids = [space.created_by, ...space.hosts]
126const fontPromises = fontsConfig.map(async (font) => {
127const fontUrl = 'https://cdn.jsdelivr.net/npm/@tamagui/font-inter@1.108.3/otf/' + font.fontFile
128const fontArrayBuf = await fetch(fontUrl).then((res) => res.arrayBuffer())
129return { name: font.name, data: fontArrayBuf, weight: font.weight }
130})
137// const api = `https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/svg/${code.toLowerCase()}.svg`
138const api = `https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/${code.toLowerCase()}_color.svg`
139return fetch(api).then((r) => r.text())
140}
141
FarcasterSpacesHome.tsx2 matches
78import { Button, Input, Section, ShareButton } from '../components/ui.tsx'
9import { fetchUsersById } from '../util/neynar.ts'
10import { supabase } from '../util/supabase.ts'
1139function Spaces() {
40const queryFn = async () => {
41const agoraChannels = await fetch(`/api/channels`)
42.then((r) => r.json())
43.then((r) => r?.data?.channels)
44const { data, error } = await supabase.from(table).select()
45if (error) {
46console.error('đź”” sendNotificationToAllUsers: error fetching users', error)
47return
48}
6061async function sendNotification(notificationDetails: any, payload: any) {
62return await fetch(notificationDetails.url, {
63method: 'POST',
64headers: { 'Content-Type': 'application/json' },