Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/$%7BsvgDataUrl%7D?q=function&page=24&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=function

Returns an array of strings in format "username" or "username/projectName"

Found 30766 results for "function"(2030ms)

api_ianmenethil_comgoogleAuthService.ts5 matches

@ianmenethil•Updated 22 hours ago
21 * Get Google OAuth URL - implements getGoogleOAuthURL operation
22 */
23export function getGoogleOAuthURL(c: Context<{ Variables: Variables }>): Promise<Response> {
24 try {
25 // Generate CSRF state token
35 });
36
37 // Generate OAuth URL using existing function
38 const authUrl = generateOAuthUrl("google", state);
39
78 * Handle Google OAuth callback - implements handleGoogleCallback operation
79 */
80export async function handleGoogleCallback(
81 c: Context<{ Variables: Variables }>,
82): Promise<Response> {
231 * Exchange authorization code for access tokens
232 */
233async function exchangeCodeForTokens(code: string) {
234 try {
235 const googleConfig = AUTH_CONFIG.oauth.providers.GOOGLE;
279 * Fetch user information from Google
280 */
281async function fetchGoogleUserInfo(accessToken: string) {
282 try {
283 const googleConfig = AUTH_CONFIG.oauth.providers.GOOGLE;

api_ianmenethil_comgithubAuthService.ts6 matches

@ianmenethil•Updated 22 hours ago
21 * Get GitHub OAuth URL - implements getGitHubOAuthURL operation
22 */
23export function getGitHubOAuthURL(c: Context<{ Variables: Variables }>): Promise<Response> {
24 try {
25 // Generate CSRF state token
35 });
36
37 // Generate OAuth URL using existing function
38 const authUrl = generateOAuthUrl("github", state);
39
78 * Handle GitHub OAuth callback - implements handleGitHubCallback operation
79 */
80export async function handleGitHubCallback(
81 c: Context<{ Variables: Variables }>,
82): Promise<Response> {
231 * Exchange authorization code for access tokens
232 */
233async function exchangeCodeForTokens(code: string) {
234 try {
235 const githubConfig = AUTH_CONFIG.oauth.providers.GITHUB;
288 * Fetch user information from GitHub
289 */
290async function fetchGitHubUserInfo(accessToken: string) {
291 try {
292 const githubConfig = AUTH_CONFIG.oauth.providers.GITHUB;
346 * Fetch user email from GitHub emails endpoint (fallback)
347 */
348async function fetchGitHubUserEmail(accessToken: string) {
349 try {
350 const emailRequest = await fetch("https://api.github.com/user/emails", {

api_ianmenethil_cominfoService.ts4 matches

@ianmenethil•Updated 22 hours ago
85
86/**
87 * API info handler function for use in service router
88 * @param c - Hono context with Variables
89 * @returns Response with API information
90 */
91export function getApiInfo(c: Context<{ Variables: Variables }>): Response {
92 try {
93 const info = infoService.getApiInfo();
102
103/**
104 * Version handler function for use in service router
105 * @param c - Hono context with Variables
106 * @returns Response with version information
107 */
108export function getVersion(c: Context<{ Variables: Variables }>): Response {
109 try {
110 const versionInfo = infoService.getVersionInfo();

api_ianmenethil_comhashService.ts12 matches

@ianmenethil•Updated 22 hours ago
133 * when calling Zenith's /initiate-payment endpoint.
134 */
135export async function hashData(c: Context<{ Variables: Variables }>): Promise<Response> {
136 const requestId = crypto.randomUUID();
137
251 * Handle v1/v2 versions - Base64 encoding
252 */
253async function handleV1V2(
254 c: Context<{ Variables: Variables }>,
255 requestBody: any,
362 * Handle v3/v4/v5 versions - Hash generation for Zenith fingerprint
363 */
364async function handleV3V4V5(
365 c: Context<{ Variables: Variables }>,
366 requestBody: any,
527}
528
529// ==================== UTILITY FUNCTIONS ====================
530
531/**
532 * Generate hash using Web Crypto API
533 */
534async function generateHash(data: string, algorithm: string): Promise<string> {
535 const encoder = new TextEncoder();
536 const dataBuffer = encoder.encode(data);
575 * Check if timestamp is in valid ISO 8601 format
576 */
577function isValidISO8601(timestamp: string): boolean {
578 try {
579 const date = new Date(timestamp);
594 * Check if timestamp is within acceptable time window (5 minutes)
595 */
596function isTimestampRecent(timestamp: string): boolean {
597 try {
598 const providedTime = new Date(timestamp).getTime();
610 * Format Zod errors for user-friendly error response
611 */
612function formatZodErrors(error: z.ZodError): HashErrorResponse["details"] {
613 return error.errors.map((err) => {
614 const field = err.path.join(".");
643 * Create standardized error response
644 */
645function createHashErrorResponse(
646 code: string,
647 message: string,
666 * Optional info endpoint handler for documentation
667 */
668export async function hashInfo(c: Context): Promise<Response> {
669 const currentTime = new Date().toISOString();
670
825
826/**
827 * Hash handler function for use in service router
828 * @param c - Hono context with Variables
829 * @returns Response with hash result
830 */
831export async function getHash(c: Context<{ Variables: Variables }>): Promise<Response> {
832 return await hashData(c);
833}

api_ianmenethil_comhash.service.ts12 matches

@ianmenethil•Updated 22 hours ago
133 * when calling Zenith's /initiate-payment endpoint.
134 */
135export async function hashData(c: Context<{ Variables: Variables }>): Promise<Response> {
136 const requestId = crypto.randomUUID();
137
251 * Handle v1/v2 versions - Base64 encoding
252 */
253async function handleV1V2(
254 c: Context<{ Variables: Variables }>,
255 requestBody: any,
362 * Handle v3/v4/v5 versions - Hash generation for Zenith fingerprint
363 */
364async function handleV3V4V5(
365 c: Context<{ Variables: Variables }>,
366 requestBody: any,
527}
528
529// ==================== UTILITY FUNCTIONS ====================
530
531/**
532 * Generate hash using Web Crypto API
533 */
534async function generateHash(data: string, algorithm: string): Promise<string> {
535 const encoder = new TextEncoder();
536 const dataBuffer = encoder.encode(data);
575 * Check if timestamp is in valid ISO 8601 format
576 */
577function isValidISO8601(timestamp: string): boolean {
578 try {
579 const date = new Date(timestamp);
594 * Check if timestamp is within acceptable time window (5 minutes)
595 */
596function isTimestampRecent(timestamp: string): boolean {
597 try {
598 const providedTime = new Date(timestamp).getTime();
610 * Format Zod errors for user-friendly error response
611 */
612function formatZodErrors(error: z.ZodError): HashErrorResponse["details"] {
613 return error.errors.map((err) => {
614 const field = err.path.join(".");
643 * Create standardized error response
644 */
645function createHashErrorResponse(
646 code: string,
647 message: string,
666 * Optional info endpoint handler for documentation
667 */
668export async function hashInfo(c: Context): Promise<Response> {
669 const currentTime = new Date().toISOString();
670
825
826/**
827 * Hash handler function for use in service router
828 * @param c - Hono context with Variables
829 * @returns Response with hash result
830 */
831export async function getHash(c: Context<{ Variables: Variables }>): Promise<Response> {
832 return await hashData(c);
833}

api_ianmenethil_comfirecrawlApiService.ts6 matches

@ianmenethil•Updated 22 hours ago
10} from "../external-apis/firecrawlClient.ts";
11
12// Helper function to get error messages
13// In a real project, move this to a shared utility file (e.g., src/utils/error.utils.ts)
14function getLocalErrorMessage(error: unknown): string {
15 if (error instanceof Error) return error.message;
16 if (typeof error === "string") return error;
26 * Handles requests to the Firecrawl scrape API for a single URL.
27 */
28export async function firecrawlScrapeHandler(
29 c: Context<{ Variables: Variables }>,
30): Promise<Response> {
50 const scrapeInput: ScraperInput = validationResult.data;
51
52 // Call the Firecrawl API through the client function
53 const firecrawlResponse = await fetchFromFirecrawlAPI(scrapeInput);
54
89 * Handles requests to the Firecrawl map API for discovering URLs on a website.
90 */
91export async function firecrawlMapHandler(c: Context<{ Variables: Variables }>): Promise<Response> {
92 try {
93 const requestBody = await c.req.json();
108 const mapInput: FirecrawlMapInput = validationResult.data;
109
110 // Call the dedicated map function with validated input
111 const firecrawlResponse = await performFirecrawlMap(mapInput);
112

api_ianmenethil_comechoService.ts3 matches

@ianmenethil•Updated 22 hours ago
36
37/**
38 * Echo Service - Handles echo functionality
39 * Returns request data for testing and debugging purposes
40 */
112
113/**
114 * Echo handler function for use in service router
115 * @param c - Hono context with Variables
116 * @returns Response with echo data
117 */
118export async function echo(c: any): Promise<Response> {
119 try {
120 const method = c.req.method;

api_ianmenethil_comcallbackService.ts7 matches

@ianmenethil•Updated 22 hours ago
23 * @returns Sanitized string
24 */
25function sanitizeInput(input: string): string {
26 return input.replace(/[<>\"'&]/g, "").trim();
27}
33 * @returns Parsed timestamp filter object
34 */
35function parseTimestampFilters(from?: string, to?: string): { from?: Date; to?: Date } {
36 const result: { from?: Date; to?: Date } = {};
37
58 * @returns Headers as key-value object
59 */
60function extractHeaders(request: Request): Record<string, string> {
61 const headers: Record<string, string> = {};
62 request.headers.forEach((value, key) => {
71 * @returns Response with callback creation result
72 */
73export async function createCallback(c: Context<{ Variables: Variables }>): Promise<Response> {
74 const requestId = crypto.randomUUID();
75
159 * @returns Response with callback records list
160 */
161export async function listCallbacks(c: Context<{ Variables: Variables }>): Promise<Response> {
162 const requestId = crypto.randomUUID();
163
249 * @returns Response with callback record details
250 */
251export async function getCallback(c: Context<{ Variables: Variables }>): Promise<Response> {
252 const requestId = crypto.randomUUID();
253
316 * @returns Response with deletion confirmation
317 */
318export async function deleteCallback(c: Context<{ Variables: Variables }>): Promise<Response> {
319 const requestId = crypto.randomUUID();
320

api_ianmenethil_comauthService.ts4 matches

@ianmenethil•Updated 22 hours ago
18 * Generates and returns a new CSRF token for form protection
19 */
20export function getCsrfToken(c: Context<{ Variables: Variables }>): Response {
21 try {
22 // Generate a secure CSRF token
73 * Returns the current authenticated user from the OAuth session
74 */
75export function getCurrentUser(c: Context<{ Variables: Variables }>): Response {
76 try {
77 // Get session data from cookie
197 * Clears OAuth session cookies and ends the user session
198 */
199export function logout(c: Context<{ Variables: Variables }>): Response {
200 try {
201 // Get current session for logging
265 * Converts API keys to JWT tokens for secure service access
266 */
267export async function exchangeToken(c: Context<{ Variables: Variables }>): Promise<Response> {
268 try {
269 // Extract token key from header or query parameter

api_ianmenethil_comtavilyClient.ts5 matches

@ianmenethil•Updated 22 hours ago
104
105// API configuration
106function getTavilyApiKey(): string {
107 const key = Deno.env.get("TAVILY_API_KEY") || "";
108 if (!key) {
117 * Perform a search using the Tavily API.
118 */
119export async function performTavilySearch(input: TavilySearchInput): Promise<unknown> {
120 const apiKey = getTavilyApiKey();
121 const options = {
148 * Perform an extract using the Tavily API.
149 */
150export async function performTavilyExtract(input: TavilyExtractInput): Promise<unknown> {
151 const apiKey = getTavilyApiKey();
152
186 * Perform a crawl using the Tavily API (BETA).
187 */
188export async function performTavilyCrawl(input: TavilyCrawlInput): Promise<unknown> {
189 const apiKey = getTavilyApiKey();
190
228 * Perform a site map using the Tavily API (BETA).
229 */
230export async function performTavilyMap(input: TavilyMapInput): Promise<unknown> {
231 const apiKey = getTavilyApiKey();
232
tuna

tuna9 file matches

@jxnblk•Updated 1 week ago
Simple functional CSS library for Val Town

getFileEmail4 file matches

@shouser•Updated 1 month ago
A helper function to build a file's email
lost1991
import { OpenAI } from "https://esm.town/v/std/openai"; export default async function(req: Request): Promise<Response> { if (req.method === "OPTIONS") { return new Response(null, { headers: { "Access-Control-Allow-Origin": "*",
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.