5import process from "node:process";
6
7export async function mgsrBotEndpoint(request) {
8 const signatureTimestamp = request.headers.get("X-Signature-Timestamp");
9 const signatureEd25519 = request.headers.get("X-Signature-Ed25519");
54}
55
56async function handleApplicationCommands(body) {
57 let response;
58 switch (body.data.name) {
4// File: testUrlConstructionVal.js in Val Town (Named: @username.testUrlConstructionVal)
5export const testUrlConstructionVal = (async () => {
6 // Reference the function from the other Val
7 // Example input
8 const order = ["created_at DESC", "id DESC"]; // Sorting order for comments
9 const timestamp = "2024-01-19T17:00:00.000Z"; // Filtering criteria
10 const page = 1; // Page number to fetch
11 // Invoke the function from the other Val
12 const constructedUrl = ConstructReadTangleUrl2(timestamp);
13 logMessage("debug", `Constructed URL: ${constructedUrl}`);
1import ky from "npm:ky@1.2.0";
2
3function resolveDidKey(did) {
4 return ky.get(`https://dev.uniresolver.io/1.0/identifiers/${did}`, {
5 headers: {
9}
10
11export function getResolver() {
12 return { key: resolveDidKey };
13}
1# SQLite Dump Util
2
3A utility function that generates SQL statements to dump the data and schema of tables in a SQLite database.
4
5## Usage
25```
26
27## Function Signature
28
29```typescript
30function sqliteDump(tables?: string[], callback?: ((result: string) => string | void | Promise<void>) | undefined): Promise<string | void>
31```
32
34
35- `tables`: (Optional) Array of table names to include in the dump. If not provided, all tables will be included.
36- `callback`: (Optional) An (potentially async) callback function to process the dump result. The callback receives the dump string as its argument.
37
3import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
4
5export default async function(req: Request): Promise<Response> {
6 console.log(req.headers, req.headers.get("Authorization"));
7
29};
30
31export default async function(email: Email) {
32 console.log(email);
33 await sendPDF(email.subject, email.html);
2import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
3
4export default function(ctx: BrowserContext) {
5 const { author, name } = extractValInfo(ctx.tab.url);
6 ctx.open(`https://rlesser-dependency_graph.web.val.run/${author}/${name}`);
2import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
3
4export default function(ctx: BrowserContext) {
5 const { author, name } = extractValInfo(ctx.tab.url);
6 ctx.copy(`[@${author}/${name}](${ctx.tab.url})`);
28};
29
30export default async function(interval: Interval) {
31 try {
32 await Sentry.withMonitor(
1# Sentry Crons monitoring for scheduled functions in val.town
2
3Use this val to monitor your schedule jobs for any issues and report them directly to [Sentry Crons](https://sentry.io/for/cron-monitoring/).
82. Add your DSN to as a `SENTRY_DSN` in your [val.town environment variables](https://www.val.town/settings/environment-variables).
93. Change the `monitorConfig.schedule.value` Crontab expression to match your job run.
103. Replace the `run()` function with your scheduled function.
114. Alter any other monitor config properties to better fit your scheduled function. [Learn more](https://docs.sentry.io/platforms/javascript/guides/deno/crons/#monitor-configuration-properties).
12
13## Benefits
19
20
21Any errors that occur in your scheduled function will be reported directly into Sentry:
22
23
A helper function to build a file's email
Simple functional CSS library for Val Town
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": "*",
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.