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/image-url.jpg%20%22Optional%20title%22?q=database&page=60&format=json

For typeahead suggestions, use the /typeahead endpoint:

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

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

Found 8118 results for "database"(9305ms)

supabase-cronmain.tsx1 match

@palomakopโ€ขUpdated 2 weeks ago
175 await testDecksEndpoint();
176
177 // 3. Create multiple test pulls to exercise the database
178 const pullIds: string[] = [];
179

ChatNextSteps-Examples.md1 match

@c15rโ€ขUpdated 2 weeks ago
223 "action": {
224 "type": "send_message",
225 "content": "Execute emergency restart of critical services: database, web server, and cache"
226 }
227 }

ChatNextSteps-README.md1 match

@c15rโ€ขUpdated 2 weeks ago
206- **File Operations**: Suggest follow-up actions after file creation/modification
207- **API Calls**: Propose next API operations or data processing steps
208- **Database Operations**: Suggest queries, updates, or analysis steps
209
210### Client Implementation Notes

ai-promptedopenai-client.mdc1 match

@cricks_unmixed4uโ€ขUpdated 2 weeks ago
10GlobalRateLimitedChatOpenAI(model: string, requestsPerSecond: number): Decorator for ChatOpenAI that enforces a global rate limit (requests per second) using a persistent SQLite table.
11GlobalRateLimiter: Class that implements the rate limiting logic. It checks the number of requests in the current time window and throws an error if the limit is exceeded. It uses a table (global_rate_limit_1) in Val Town's SQLite.
12ensureGlobalRateLimitTableExists: Ensures the rate limit tracking table exists in the database at startup.
13Usage
14Use ChatOpenAI(model) for direct, unlimited access to OpenAI chat completions.

api_ianmenethil_comappTypes.ts2 matches

@ianmenethilโ€ขUpdated 2 weeks ago
154}
155
156export interface SqlDatabasePlatformConfig {
157 ENABLED: boolean;
158 CONNECTION_POOL_SIZE: number;
162export interface ValtownPlatformSubConfig {
163 BLOB_STORAGE: BlobStoragePlatformConfig;
164 SQL_DATABASE: SqlDatabasePlatformConfig;
165}
166

html-snippets-V2README.md2 matches

@arfanโ€ขUpdated 2 weeks ago
17โ”œโ”€โ”€ backend/
18โ”‚ โ”œโ”€โ”€ api.tsx # Main API server with CRUD endpoints
19โ”‚ โ””โ”€โ”€ database/
20โ”‚ โ””โ”€โ”€ queries.ts # Blob storage query functions
21โ”œโ”€โ”€ frontend/
67- **Frontend**: Vanilla JavaScript with DaisyUI/TailwindCSS
68- **Icons**: Iconify for beautiful icons
69- **Storage**: Val Town blob storage (no database required)
70
71## Development

html-snippets-V2api.tsx1 match

@arfanโ€ขUpdated 2 weeks ago
9 getSnippetsByCategory,
10 getAllCategories,
11} from "./database/queries.ts";
12import { CreateSnippetRequest, UpdateSnippetRequest } from "../shared/types.ts";
13

api_ianmenethil_comsqlService.ts11 matches

@ianmenethilโ€ขUpdated 2 weeks ago
1/**
2 * vt.sql.service.ts โ€” Val Town SQLite service with comprehensive database operations.
3 */
4
175
176/**
177 * Database schema column definition.
178 */
179interface ColumnDefinition {
216
217/**
218 * Database index definition.
219 */
220interface IndexDefinition {
225
226/**
227 * Database schema column definition.
228 */
229interface ColumnDefinition {
251
252/**
253 * Database index definition.
254 */
255interface IndexDefinition {
624
625/**
626 * Drops a table from the database.
627 *
628 * @param tableName - Name of table to drop
647}
648/**
649 * Checks if a table exists in the database.
650 *
651 * @param tableName - Name of table to check
681
682/**
683 * Lists all tables in the database.
684 *
685 * @param options - Authentication options
1122
1123/**
1124 * Drops an index from the database.
1125 *
1126 * @param indexName - Name of index to drop
2179 *
2180 * ## Index Management
2181 * - createIndex() - Create database index
2182 * - dropIndex() - Drop database index
2183 *
2184 * ## Utilities

api_ianmenethil_comoauthDBService.ts37 matches

@ianmenethilโ€ขUpdated 2 weeks ago
1/**
2 * vt.oauthDB.service.ts โ€” OAuth database service for user and account management.
3 */
4
47
48/**
49 * Database user record structure.
50 */
51interface DatabaseUser {
52 id: string;
53 username: string;
62
63/**
64 * Database OAuth account record structure.
65 */
66interface DatabaseOAuthAccount {
67 id: string;
68 user_id: string;
116
117/**
118 * Convert database user to SQL-compatible format.
119 */
120function userToSqlRecord(user: DatabaseUser): Record<string, string | number | null> {
121 return {
122 id: user.id,
136 */
137function oauthAccountToSqlRecord(
138 account: DatabaseOAuthAccount,
139): Record<string, string | number | null> {
140 return {
155
156// ============================================================================
157// OAUTH DATABASE SERVICE CLASS
158// ============================================================================
159
160/**
161 * OAuth Database Service for handling user and account operations.
162 *
163 * @example
172
173 /**
174 * Ensure OAuth database tables exist (lazy initialization).
175 * Checks both tables exist and creates them if missing.
176 * Only runs once per server session.
198 error instanceof Error ? error.stack : String(error),
199 );
200 throw new Error("OAuth database initialization failed");
201 }
202 } /**
203 * Initialize OAuth database tables.
204 * Creates users and oauth_accounts tables if they don't exist.
205 */
206
207 async initializeTables(): Promise<void> {
208 console.log("๐Ÿ—„๏ธ [OAuthDbService] Initializing OAuth database tables");
209
210 try {
249 await sqlService.createIndex("idx_Guardian_users_username", "Guardian_users", ["username"]);
250
251 console.log("โœ… [OAuthDbService] Guardian database tables initialized successfully");
252 } catch (error) {
253 console.error("โŒ [OAuthDbService] Failed to initialize Guardian tables:", error);
265 provider: string,
266 providerUserId: string,
267 ): Promise<DatabaseOAuthAccount | null> {
268 try {
269 const result = await sqlService.findOne("Guardian_oauth_accounts", {
272 });
273
274 return result as unknown as DatabaseOAuthAccount | null;
275 } catch (error) {
276 console.error(
288 * @returns User record or null if not found
289 */
290 async findUserById(userId: string): Promise<DatabaseUser | null> {
291 try {
292 const result = await sqlService.findOne("Guardian_users", { id: userId });
293 return result as unknown as DatabaseUser | null;
294 } catch (error) {
295 console.error(`[OAuthDbService] Error finding user ${userId}:`, error);
304 * @returns User record or null if not found
305 */
306 async findUserByEmail(email: string): Promise<DatabaseUser | null> {
307 try {
308 const result = await sqlService.findOne("Guardian_users", { email });
309 return result as unknown as DatabaseUser | null;
310 } catch (error) {
311 console.error(`[OAuthDbService] Error finding user by email ${email}:`, error);
342 * @returns Created user record
343 */
344 async createUser(profile: OAuthUserProfile): Promise<DatabaseUser> {
345 const now = getSydneyTimestampMillis();
346 const userId = crypto.randomUUID();
347 const userRole = this.determineUserRole(profile.email);
348
349 const userData: DatabaseUser = {
350 id: userId,
351 username: profile.username || `user_${userId.slice(0, 8)}`,
384 profile: OAuthUserProfile,
385 tokenResponse?: OAuthTokenResponse | string,
386 ): Promise<DatabaseOAuthAccount> {
387 const now = getSydneyTimestampMillis();
388 const accountId = crypto.randomUUID();
453 }
454
455 const accountData: DatabaseOAuthAccount = {
456 id: accountId,
457 user_id: userId,
554 * @returns Decrypted access token or null if not available
555 */
556 async getDecryptedAccessToken(account: DatabaseOAuthAccount): Promise<string | null> {
557 if (!account.access_token) {
558 return null;
579 * @returns Decrypted refresh token or null if not available
580 */
581 async getDecryptedRefreshToken(account: DatabaseOAuthAccount): Promise<string | null> {
582 if (!account.refresh_token) {
583 return null;
605 * @returns true if token is expired or will expire within buffer time
606 */
607 isAccessTokenExpired(account: DatabaseOAuthAccount, bufferSeconds = 300): boolean {
608 return isTokenExpired(account.token_expires_at, bufferSeconds);
609 } /**
610 * Convert DatabaseUser to SessionUser for authentication.
611 *
612 * @param dbUser Database user record
613 * @returns Session user object
614 */
615
616 convertToSessionUser(dbUser: DatabaseUser): SessionUser {
617 return {
618 id: dbUser.id,
645 console.error("๐Ÿšจ [OAuthDbService] VALTOWN_API_KEY not set - cannot process OAuth user");
646 console.error(`๐Ÿšจ [OAuthDbService] Provider: ${provider}, Profile ID: ${profile.id}`);
647 throw new Error("Database access unavailable - OAuth requires valid API key");
648 }
649
767 */
768
769 async getUserOAuthAccounts(userId: string): Promise<DatabaseOAuthAccount[]> {
770 try {
771 const results = await sqlService.findMany("Guardian_oauth_accounts", { user_id: userId });
772 return results as unknown as DatabaseOAuthAccount[];
773 } catch (error) {
774 console.error(
801
802export type {
803 DatabaseOAuthAccount,
804 DatabaseUser,
805 OAuthAccountUpdate,
806 OAuthTokenResponse,
812
813/**
814 * Default OAuth database service instance.
815 *
816 * @example
142 }
143
144 // Create or update user in database
145 const user = await oauthDb.findOrCreateOAuthUser(
146 "spotify",

customer-database-setup2 file matches

@stevenvapiโ€ขUpdated 5 hours ago

prDatabase

@pdwโ€ขUpdated 5 days ago