sqLiteDatabasemain.tsx27 matches
23/**
4* Initialize database tables for authentication system
5* Includes users, login attempts, and verification tokens
6*/
7export async function initializeDatabase() {
8// Use the val's unique identifier as a prefix for tables
9const KEY = "sqLiteDatabase";
10const SCHEMA_VERSION = 3; // Increment when schema changes
1154`);
5556console.log(`Database tables initialized for authentication system (Schema v${SCHEMA_VERSION})`);
57return { success: true, message: 'Database setup complete' };
58} catch (error) {
59console.error('Database initialization error:', error);
60return {
61success: false,
62message: 'Failed to initialize database',
63error: error.message
64};
6768/**
69* Utility function to reset or clean up database
70* Use with caution in production
71*/
72export async function resetDatabase() {
73const KEY = "sqLiteDatabase";
74const SCHEMA_VERSION = 3;
7579await sqlite.execute(`DROP TABLE IF EXISTS ${KEY}_verification_tokens_${SCHEMA_VERSION}`);
80
81await initializeDatabase();
82
83console.log('Database reset completed successfully');
84return { success: true, message: 'Database reset complete' };
85} catch (error) {
86console.error('Database reset error:', error);
87return {
88success: false,
89message: 'Failed to reset database',
90error: error.message
91};
9495/**
96* Utility function to perform database migrations
97* Call this when schema changes are needed
98*/
99export async function migrateDatabase() {
100const KEY = "sqLiteDatabase";
101const SCHEMA_VERSION = 3;
102108`);
109110console.log('Database migration completed successfully');
111return { success: true, message: 'Database migration complete' };
112} catch (error) {
113console.error('Database migration error:', error);
114return {
115success: false,
116message: 'Failed to migrate database',
117error: error.message
118};
120}
121122// Initialize database on module import
123initializeDatabase();
124125export default {
126initializeDatabase,
127resetDatabase,
128migrateDatabase
129};
plantIdentifierAppmain.tsx3 matches
4import OpenAI from "https://esm.sh/openai";
56// Plant Database
7const PLANT_DATABASE = {
8'Rosa damascena': {
9scientificName: 'Rosa damascena',
166: plantDescription;
167168const matchedPlant = Object.values(PLANT_DATABASE).find(
169plant =>
170plant.scientificName.toLowerCase() === scientificName.toLowerCase() ||
captivatingLimeGuanmain.tsx3 matches
3import { createRoot } from "https://esm.sh/react-dom/client";
45// Expanded plant database with more comprehensive entries
6const PLANT_DATABASE = {
7'Rosa damascena': {
8scientificName: 'Rosa damascena',
94if (bestMatch[1] > 0.6) { // Confidence threshold
95resolve({
96plant: PLANT_DATABASE[bestMatch[0]],
97confidence: Math.round(bestMatch[1] * 100)
98});
40<li>We extract email domains from your user list</li>
41<li>
42We match these domains against our database of YC companies (sourced{" "}
43<a href="https://docs.google.com/spreadsheets/d/181GQmXflgMCCI9awLbzK4Zf0uneQBKoh51wBjNTc8Us/edit?gid=0#gid=0">
44here
45</a>
46, cached <a href="https://www.val.town/v/stevekrouse/yc_database">here</a>)
47</li>
48<li>You get a detailed report of matches, enriched with YC company data</li>
226227export default async function server(request: Request): Promise<Response> {
228const companies = await fetch("https://stevekrouse-yc_database.web.val.run").then(res => res.json());
229const url = new URL(request.url);
230if (url.pathname === "/companies.json") {
sqliteExplorerAppREADME.md1 match
30- [ ] add triggers to sidebar
31- [ ] add upload from SQL, CSV and JSON
32- [ ] add ability to connect to a non-val town Turso database
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
sqliteExplorerAppREADME.md1 match
30- [ ] add triggers to sidebar
31- [ ] add upload from SQL, CSV and JSON
32- [ ] add ability to connect to a non-val town Turso database
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
sqliteExplorerAppREADME.md1 match
30- [ ] add triggers to sidebar
31- [ ] add upload from SQL, CSV and JSON
32- [ ] add ability to connect to a non-val town Turso database
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
Send_Errors_to_Emailmain.tsx4 matches
70-d '{
71"subject": "Critical Java Error",
72"userDescription": "Database connection failed unexpectedly",
73"errorStacktrace": "java.sql.SQLException: Connection refused\\n\\tat com.example.DatabaseManager.connect(DatabaseManager.java:42)",
74"secretKey": "your-secret-key-here"
75}'</pre>
77<h3>Example JSON Structure:</h3>
78<pre>{
79"subject": "Database Connection Error",
80"userDescription": "Failed to connect to production database during user login",
81"errorStacktrace": "Full Java/language-specific error stacktrace goes here",
82"secretKey": "your-secret-key-here"
1# VALL-E
23LLM code generation for vals! Make apps with a frontend, backend, and database.
45It's a bit of work to get this running, but it's worth it.
5/**
6* Every Val Town account comes with its own private
7* [SQLite database](https://www.sqlite.org/) that
8* is accessible from any of your vals.
9* ([Docs ↗](https://docs.val.town/std/sqlite))
115116// adapted from
117// https://github.com/tursodatabase/libsql-client-ts/blob/17dd996b840c950dd22b871adfe4ba0eb4a5ead3/packages/libsql-client/src/sqlite3.ts#L314C1-L337C2
118function rowFromSql(
119sqlRow: Array<unknown>,