5const schemaVersion = 3;
67function _client() {
8return createClient({
9url: Deno.env.get("WIDE_CLICKHOUSE_URL"),
13}
1415export async function runMigrations() {
16for (
17const migration of [
53}
54}
55export function parseRows(rows: any[]) {
56const processedRows = rows.map(row => {
57const paths: {
65};
6667function processObject(obj: any, currentPath = "") {
68for (const [key, value] of Object.entries(obj)) {
69const newPath = currentPath ? `${currentPath}.${key}` : key;
166* write!
167*/
168export async function write(userId: string, data: any[]) {
169return await writeRowsToClickhouse(userId, parseRows(data));
170}
182* values!
183*/
184export async function values(
185userId: string,
186{ field_name, field_type }: { field_name: string; field_type: FieldType },
218* fields!
219*/
220export async function fields(userId: string, search: string = "") {
221return (await (await _client().query({
222query: `
296* Get the ClickHouse comparison expression for the given operator
297*/
298function getComparisonExpression(
299operator: TStringOperator | TNumberOperator | TBooleanOperator,
300valueRef: string,
325326/**
327* Enhanced search function supporting multiple conditions with different operators
328*/
329export async function search(userId: string, {
330filters,
331start,
412413414function formatDate(date: Date) {
415return String(getUnixTime(date) + (date.getMilliseconds() / 1000))
416}
425}
426427function reconstructObjects(
428results: LogRow[],
429) {
23// Fetches a random joke.
4async function fetchRandomJoke() {
5const response = await fetch(
6"https://official-joke-api.appspot.com/random_joke",
5};
67export default async function(req: Request): Promise<Response> {
8const url =
9"https://public.api.bsky.app/xrpc/app.bsky.feed.getAuthorFeed?actor=stevekrouse.com&filter=posts_no_replies";
funnyAmaranthCrabmain.tsx1 match
56// Fetches a random joke.
7function fetchRandomJoke() {
8const SAMPLE_JOKE = {
9"setup": "What do you call a group of disorganized cats?",
valSessionmain.tsx2 matches
20`;
2122async function newSession(valTownToken: string) {
23const privateKeyPem = `
24-----BEGIN PRIVATE KEY-----
38}
3940function validate(token: string) {
41const decoded = jwt.verify(token, publicKeyPem, { algorithms: ["RS256"] }) as
42& Awaited<
getSubscribersmain.tsx3 matches
1import { sqlite } from "https://esm.town/v/std/sqlite?v=4";
23export async function getSubscribers() {
4const subs = await sqlite.execute(`
5SELECT *
11await getSubscribers();
1213export async function getNewsletters() {
14const newsletters = await sqlite.execute(`
15SELECT id, subject, web_url, target_send_date
20}
2122export async function getEmailLogs() {
23const logs = await sqlite.execute(`
24SELECT id, newsletter_id, subscriber_id, sent_at
5};
67export default async function(req: Request): Promise<Response> {
8const url = "https://public.api.bsky.app/xrpc/app.bsky.feed.getAuthorFeed?actor=wilb.me&filter=posts_no_replies";
9
1export default async function () {
2const handles = [
3"aaronfrancis.com",
peacefulYellowBoamain.tsx1 match
23// Fetches a random joke.
4async function fetchRandomJoke() {
5const response = await fetch(
6"https://official-joke-api.appspot.com/random_joke",
polishedCoffeeSlothmain.tsx1 match
5import { email } from "https://esm.town/v/std/email?v=9";
6// Fetches a random joke.
7function fetchRandomJoke() {
8const SAMPLE_JOKE = {
9"setup": "What do you call a group of disorganized cats?",