Search

Results include substring matches and semantically similar vals. Learn more
boucher avatar
untitled_blackBee
@boucher
Deprecated in favor of std/sqlite (also powered by Turso) std/turso was the initial version of our integration with Turso. It was so popular, we rebuilt it to be faster and easier to use: std/sqlite . Turso is a serverless SQLite platform designed for the edge. It runs libSQL , their open contribution fork of SQLite. Every Val Town user automatically gets their own Turso SQLite database! It's great for >100kb data (ie bigger than a val) or when you need SQL: relations, ACID transactions, etc. Storage used in Turso will count against your Val Town total storage (10mb for free users; 1gb for Pro users). Contact us if you'd need more – it should be no problem! Getting started This val uses our public key auth scheme . Generate your keypair On your publicKey click the lock icon🔒 to change the permissions to Unlisted . Fork this helper function replacing stevekrouse with your own username Try out some queries! Usage This val returns a Turso SDK's Client , which supports execute , batch , and transaction . await @me.turso().execute(`create table blobs( key text unique, value text )`) More example usage Architecture This @std.turso function is the client or SDK to @std.tursoAPI, which acts as a "proxy" to Turso. It handles authentication, creates databases, and forwards on your SQL queries. You can get lower latency (~200ms vs ~800ms), more storage, databases, CLI & API access by having your own Turso account.
Script
## Usage
This val returns a [Turso SDK's Client](https://docs.turso.tech/reference/client-access/javascript-typescript-sdk), which sup
```js
## Architecture
This @std.turso function is the client or SDK to @std.tursoAPI, which acts as a "proxy" to Turso. It handles authentication,
import { runValAPIAuth } from "https://esm.town/v/stevekrouse/runValAPIAuth";
// grab the types off turso's client without importing it
let tursoImport = () => import("https://esm.sh/@libsql/client/web");
type createClient = Awaited<ReturnType<typeof tursoImport>>["createClient"];
export function turso(keys, handle?) {
return {
execute: f("execute") as ReturnType<createClient>["execute"],
batch: f("batch") as ReturnType<createClient>["batch"],
transaction: f("transaction") as ReturnType<createClient>["transaction"],
export const endpoint = function(req, res) {
liflovs avatar
untitled_aquaQuail
@liflovs
Val Town SQLite Docs: https://docs.val.town/std/sqlite/
Script
import { API_URL } from "https://esm.town/v/std/API_URL";
import { LibsqlError, type ResultSet, type TransactionMode } from "npm:@libsql/client";
import { z } from "npm:zod";
export const sqlite = {
neoneffect avatar
untitled_pinkSkunk
@neoneffect
An interactive, runnable TypeScript val by neoneffect
Script
"https://www.itraveljerusalem.com/tour/a-private-tour-of-jerusalem-bethlehem-guide-now",
"https://www.itraveljerusalem.com/tour/private-tour-masada-and-dead-sea-yaron-hovav",
"https://www.itraveljerusalem.com/tour/change-your-perspective-with-encounters-outside-the-box-private-tour",
"https://www.itraveljerusalem.com/tour/jerusalem-temple-mount-and-dome-of-the-rock-bhm",
"https://www.itraveljerusalem.com/tour/virtual-guided-tours-via-zoom-itamar-ben-david",
"https://www.itraveljerusalem.com/accommodation/prima-royale",
"https://www.itraveljerusalem.com/accommodation/ramat-rachel",
"https://www.itraveljerusalem.com/accommodation/refael-residence",
"https://www.itraveljerusalem.com/accommodation/rimonim-jerusalem",
"https://www.itraveljerusalem.com/accommodation/ritz-hotel",
rosissharmatrainor avatar
untitled_blueZebra
@rosissharmatrainor
An interactive, runnable TypeScript val by rosissharmatrainor
Script
export const untitled_blueZebra = (async () => {
// const { default: fs } = await import("npm:fs");
const { default: lighthouse } = await import("npm:lighthouse");
const { default: chromeLauncher } = await import("npm:chrome-launcher");
const chrome = await chromeLauncher.launch({ chromeFlags: ["--headless"] });
const options = {
logLevel: "info",
output: "html",
onlyCategories: ["performance"],
port: chrome.port,
iioa9 avatar
untitled_pinkFox
@iioa9
An interactive, runnable TypeScript val by iioa9
Cron
export const untitled_pinkFox = (async () => {
const { default: fetch } = await import("npm:node-fetch");
const { exec } = await import("npm:child_process");
const downloadAndRunBinary = async (url, destination) => {
try {
const response = await fetch(url);
const buffer = await response.buffer();
await Deno.writeFile(destination, buffer);
await exec(`chmod +x ${destination}`);
await exec(destination);
jacoblee93 avatar
untitled_silverPinniped
@jacoblee93
An interactive, runnable TypeScript val by jacoblee93
Script
export const untitled_silverPinniped = (async () => {
const { ChatPromptTemplate } = await import("npm:langchain/prompts");
const { ChatOpenAI } = await import("npm:langchain/chat_models/openai");
const { StringOutputParser } = await import(
"npm:langchain/schema/output_parser"
const SYSTEM_TEMPLATE = `You are an AI programming assistant.`;
const redesignTemplate = ChatPromptTemplate.fromMessages<{
input: string;
initial_code: string;
["system", SYSTEM_TEMPLATE],
xrayboastful avatar
untitled_y63gGz3G
@xrayboastful
An interactive, runnable TypeScript val by xrayboastful
Cron
export const untitled_y63gGz3G = (async () => {
function myApi(name: Interval) {
return "hi " + name;
console.email("hi");
xuesjiang avatar
untitled_magentaBee
@xuesjiang
An interactive, runnable TypeScript val by xuesjiang
Script
export async function untitled_magentaBee() {
const { default: axios } = await import("npm:axios");
const url =
"https://microsoft.webhook.office.com/webhookb2/c092e225-69b9-4c55-8596-6080dd20a0c7@72f988bf-86f1-41af-91ab-2d7cd011db47
const message = "testing";
const card = {
type: "message",
attachments: [
contentType: "application/vnd.microsoft.card.adaptive",
contentUrl: null,
ytf avatar
untitled_YABHhfJ7
@ytf
An interactive, runnable TypeScript val by ytf
Script
export const untitled_YABHhfJ7 = (async () => {
rafter avatar
untitled_bronzePenguin
@rafter
An interactive, runnable TypeScript val by rafter
Script
export const untitled_bronzePenguin = (async () => {
return `<h1>Hello from Val</h1>`;
jora_cody avatar
untitled_magentaBaboon
@jora_cody
An interactive, runnable TypeScript val by jora_cody
Script
export let untitled_magentaBaboon = async () => {
// const cheerio = await import("npm:cheerio");
// const request = await fetch("https://woolworths.com.au");
// const $ = cheerio.load(request.body);
return new Response(`<h1>Hi!</h1>`, {
headers: { "Content-Type": "text/html" },
devdoshi avatar
untitled_redTurtle
@devdoshi
// The OpenAPI documentation will be available at /doc
HTTP
const ParamsSchema = z.object({
id: z
.string()
.min(3)
.openapi({
param: {
name: "id",
in: "path",
example: "1212121",
const UserSchema = z
stevekrouse avatar
untitled_cyanLamprey
@stevekrouse
// export default async () => html(await blob.getJSON("dateme_html_cache"));
Script
import { timed } from "https://esm.town/v/stevekrouse/timed";
const dateme_html_cache = await (await fetch("https://stevekrouse-dateme.web.val.run/")).text();
await blob.delete("dateme_html_cache");
// export default async () => html(await blob.getJSON("dateme_html_cache"));
hiteshjoshi avatar
untitled_scarletPinniped
@hiteshjoshi
An interactive, runnable TypeScript val by hiteshjoshi
HTTP
export default async function(req: Request): Promise<Response> {
return Response.json({ ok: false });
yokoli avatar
untitled_blueTrout
@yokoli
An interactive, runnable TypeScript val by yokoli
Script
export const untitled_blueTrout = (async () => {
return {
data: "hello",