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=api&page=22&format=json

For typeahead suggestions, use the /typeahead endpoint:

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

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

Found 19255 results for "api"(2599ms)

api_ianmenethil_commiddlewareMapper.ts3 matches

@ianmenethil•Updated 19 hours ago
43/**
44 * Extract security scheme names from operation security
45 * @param security - Security requirements from OpenAPI operation
46 * @returns Array of security scheme names
47 */
56/**
57 * Check if operation requires authentication
58 * @param security - Security requirements from OpenAPI operation
59 * @returns True if authentication is required
60 */
70/**
71 * Get security summary for an operation
72 * @param security - Security requirements from OpenAPI operation
73 * @returns Security summary object
74 */

api_ianmenethil_comjwtUtils.ts1 match

@ianmenethil•Updated 19 hours ago
1/**
2 * F:\zApps\valtown.servers\APIServer\src\utils\jwt.helpers.ts
3 * Shared utility functions for JWT generation and verification using 'jose'.
4 */

api_ianmenethil_comindex.ts1 match

@ianmenethil•Updated 19 hours ago
1// F:\zApps\valtown.servers\APIServer\src\types\index.ts
2/**
3 * Central export file for all types

api_ianmenethil_comworkflowService.ts1 match

@ianmenethil•Updated 19 hours ago
89
90 getDescription(): string {
91 return "Converts Swagger/OpenAPI specifications to Postman collections";
92 }
93

api_ianmenethil_cominternalJWTService.ts2 matches

@ianmenethil•Updated 19 hours ago
1// F:\zApps\valtown.servers\APIServer\src\services\internalJWT.service.ts
2import { Context } from "hono";
3import { joseErrors, signJwt, verifyJwt } from "@/utils/jwtUtils.ts";
15 *
16 * This service provides:
17 * - JWT token generation for internal API calls (using jose via jwt.helpers)
18 * - Token validation and verification (using jose via jwt.helpers)
19 * - Request correlation and audit trails

api_ianmenethil_comcacheService.ts2 matches

@ianmenethil•Updated 19 hours ago
1/**
2F:\zApps\valtown.servers\APIServer\src\services\cache.service.ts
3 * cache-service.ts — Enhanced caching service for the secure API server.
4 * Supports multiple storage backends: Val.town Blob, Val.town SQL, and in-memory.
5 */

api_ianmenethil_comrouteLogger.ts12 matches

@ianmenethil•Updated 19 hours ago
1/**
2 * F:\zApps\valtown.servers\APIServer\src\openapi\route.logger.ts
3 * Handles formatted console output of registered routes grouped by security type.
4 */
11} from "../utils/tableFormatter.ts";
12import { extractSecuritySchemes, getMiddlewareGroup } from "../utils/middlewareMapper.ts";
13import { convertOpenApiPathToHono } from "./pathUtils.ts";
14
15// Basic OpenAPI types for logging functionality
16interface OpenAPIOperation {
17 operationId?: string;
18 security?: Array<Record<string, string[]>>;
19}
20
21interface OpenAPIPath {
22 [method: string]: OpenAPIOperation;
23}
24
25interface OpenAPISpec {
26 paths: Record<string, OpenAPIPath>;
27}
28
29/**
30 * Logs all registered routes in a formatted table grouped by security type
31 * @param spec - The OpenAPI specification containing route definitions
32 * @param middlewareGroups - Registry of middleware groups for each security type
33 */
34export function logAllRoutes(
35 spec: OpenAPISpec,
36 middlewareGroups: Record<string, Array<unknown>>,
37): void {
56 // Categorize routes by security group
57 for (const [path, pathSpec] of Object.entries(spec.paths)) {
58 for (const [method, operation] of Object.entries(pathSpec as OpenAPIPath)) {
59 if (
60 !["get", "post", "put", "delete", "patch"].includes(
66
67 const middlewareGroup = getMiddlewareGroup(operation.security);
68 const honoPath = convertOpenApiPathToHono(path);
69 const securitySchemes = extractSecuritySchemes(operation.security);
70

api_ianmenethil_comrouteGenerator.ts15 matches

@ianmenethil•Updated 19 hours ago
1/**
2 * route-generator.ts — OpenAPI route generation and management.
3 * Generates Hono routes from OpenAPI specifications with full service integration.
4 */
5
6import { Context, Hono, MiddlewareHandler } from "hono";
7import { HTTPException } from "hono/http-exception";
8import { loadOpenAPISpec } from "./loader.ts";
9import { convertOpenApiPathToHono } from "./pathUtils.ts";
10import { createServiceRouter, getServiceHandler } from "../core/serviceRegistry.ts";
11import { HandlerResolver } from "../core/controllerRegistry.ts";
30type SecurityRequirement = Record<string, string[]>;
31
32export class OpenAPIRouteGenerator {
33 private spec: any;
34 private app: Hono<{ Variables: Variables }>;
41
42 async loadAndGenerateRoutes(specPath: string) {
43 this.spec = await loadOpenAPISpec(specPath);
44 this.serviceRouter = await createServiceRouter();
45 const routes = this.extractRoutes();
47 this.registerRoute(route);
48 }
49 console.log(`āœ… Generated ${routes.length} routes from OpenAPI spec`);
50 return routes;
51 }
54 const routes: RouteInfo[] = [];
55 if (!this.spec?.paths) {
56 console.warn("[OpenAPIRouteGenerator] No paths found in OpenAPI spec");
57 return routes;
58 }
69 const operationObj = operation as any;
70 routes.push({
71 path: convertOpenApiPathToHono(path),
72 method: method.toLowerCase(), // Ensure method is lowercase for Hono registration
73 operationId: operationObj.operationId ||
203 } else {
204 console.warn(
205 `[OpenAPIRouteGenerator] Invalid or unsupported HTTP method: ${route.method} for path ${route.path}`,
206 );
207 }
251
252 printRouteSummary(routes: RouteInfo[]) {
253 console.log("\nšŸ“‹ ===== OPENAPI ROUTE SUMMARY =====");
254 console.log(`šŸ›£ļø Generated Routes (${routes.length} total):`);
255 console.log(
350 const descriptions: Record<string, string> = {};
351 if (!this.spec?.components?.securitySchemes) {
352 console.warn("[OpenAPIRouteGenerator] No security schemes found in OpenAPI spec");
353 return descriptions;
354 }
358 const scheme = schemeDefinition as any;
359 let description = scheme.description || "No description available";
360 if (scheme.type === "apiKey") {
361 const location = scheme.in === "header"
362 ? `Header: ${scheme.name}`
385}
386
387export async function generateRoutesFromOpenAPI(
388 app: Hono<{ Variables: Variables }>,
389 specPath: string,
390) {
391 const generator = new OpenAPIRouteGenerator(app);
392 const routes = await generator.loadAndGenerateRoutes(specPath);
393 generator.printRouteSummary(routes);

api_ianmenethil_comloader.ts12 matches

@ianmenethil•Updated 19 hours ago
1// F:\zApps\valtown.servers\APIServer\src\openapi\openapi.loader.ts
2import { resolve } from "path";
3import { parse } from "yaml";
4
5interface OpenAPIDocument {
6 openapi: string;
7 info: any;
8 servers: any[];
11}
12
13export class OpenAPILoader {
14 private cache: Map<string, any> = new Map();
15 private rootPath: string;
19 }
20
21 async loadSpec(): Promise<OpenAPIDocument> {
22 const mainSpec = await this.loadYamlFile("openapi.yaml");
23 const resolvedSpec = await this.resolveReferences(mainSpec, "openapi.yaml");
24 console.log(
25 `OpenAPI specification loaded and references resolved. Total references: ${this.cache.size} -- Total paths: ${
26 Object.keys(resolvedSpec.paths || {}).length
27 }`,
28 );
29 return resolvedSpec as OpenAPIDocument;
30 }
31
107}
108
109// Export a function to load the OpenAPI spec
110export async function loadOpenAPISpec(rootPath: string): Promise<OpenAPIDocument> {
111 const loader = new OpenAPILoader(rootPath);
112 return await loader.loadSpec();
113}

api_ianmenethil_compathUtils.ts10 matches

@ianmenethil•Updated 19 hours ago
1/**
2 F:\zApps\valtown.servers\APIServer\src\openapi\openapi.path.helper.ts
3 * Handles conversion between OpenAPI and Hono path formats.
4 */
5
7
8/**
9 * Convert OpenAPI path format to Hono path format
10 * {id} -> :id
11 */
12export function convertOpenApiPathToHono(openApiPath: string): string {
13 return openApiPath.replace(/\{([^}]+)\}/g, ":$1");
14}
15
16/**
17 * Convert Hono path format to OpenAPI path format
18 * :id -> {id}
19 */
20export function convertHonoPathToOpenApi(honoPath: string): string {
21 return honoPath.replace(/:([^/]+)/g, "{$1}");
22}
23
24/**
25 * Extract parameters from OpenAPI path
26 */
27export function extractOpenApiParams(
28 pathTemplate: string,
29 actualPath: string,
30): Record<string, string> | null {
31 const honoPath = convertOpenApiPathToHono(pathTemplate);
32 const match = matchPath(honoPath, actualPath);
33 return match ? match.params : null;
Plantfo

Plantfo8 file matches

@Llad•Updated 2 hours ago
API for AI plant info

api_ianmenethil_com133 file matches

@ianmenethil•Updated 11 hours ago
apiry
snartapi