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
checkHackerNewsForPatreonmain.tsx3 matches
1// This val checks Hacker News for news about Patreon, Buy Me A Coffee, and Ko-fi,
2// sends an email alert if any are found, and keeps track of notified stories in a database.
3// It runs automatically every hour.
49const TABLE_NAME = `${KEY}_notified_stories`;
1011async function initializeDatabase() {
12await sqlite.execute(`
13CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (
2021async function checkHackerNewsForPatreon() {
22await initializeDatabase();
2324const response = await fetch("https://hacker-news.firebaseio.com/v0/newstories.json");
notionGetDatabaseREADME.md3 matches
1# Get all the pages in a notion database
23## Usage
451. Find your `databaseId`: https://developers.notion.com/reference/retrieve-a-database
62. Get `auth` by setting up an internal integration: https://developers.notion.com/docs/authorization#internal-integration-auth-flow-set-up
78Example usage: @stevekrouse.dateMeNotionDatabase
910deno-notion-sdk docs: https://github.com/cloudydeno/deno-notion_sdk
notionGetDatabasemain.tsx4 matches
1export const notionGetDatabase = async ({ databaseId, auth, filter }: {
2databaseId: string;
3auth: string;
4filter?: any;
8);
9const notion = new Client({ auth });
10return collectPaginatedAPI(notion.databases.query, {
11database_id: databaseId,
12filter,
13});
add_to_notion_w_aiREADME.md4 matches
1Uses instructor and open ai (with gpt-4-turbo) to process any content into a notion database entry.
23Use `addToNotion` with any database id and content.
45```
10```
1112Prompts are created based on your database name, database description, property name, property type, property description, and if applicable, property options (and their descriptions).
1314Supports: checkbox, date, multi_select, number, rich_text, select, status, title, url, email
1516- Uses `NOTION_API_KEY`, `OPENAI_API_KEY` stored in env variables and uses [Valtown blob storage](https://esm.town/v/std/blob) to store information about the database.
17- Use `get_notion_db_info` to use the stored blob if exists or create one, use `get_and_save_notion_db_info` to create a new blob (and replace an existing one if exists).
add_to_notion_w_aimain.tsx17 matches
37function createPrompt(title, description, properties) {
38let prompt =
39"You are processing content into a database. Based on the title of the database, its properties, their types and options, and any existing descriptions, infer appropriate values for the fields:\n";
40prompt += `Database Title: ${title}\n`;
4142if (description) {
43prompt += `Database Description: ${description}\n\n`;
44} else {
45prompt += "\n";
111}
112113async function get_and_save_notion_db_processed_properties(databaseId)
114{
115const response = await notion.databases.retrieve({ database_id: databaseId });
116const db_id = response.id.replaceAll("-", "");
117const processed_properties = processProperties(response);
122}
123124async function get_notion_db_info(databaseId) {
125databaseId = databaseId.replaceAll("-", "");
126let db_info = null;
127try {
128db_info = await blob.getJSON(databaseId);
129if (!db_info) {
130throw new Error("db_info is null or undefined");
131}
132} catch (error) {
133db_info = await get_and_save_notion_db_processed_properties(databaseId);
134}
135db_info["zod_schema"] = createZodSchema(db_info["filteredProps"]);
137}
138139async function get_and_save_notion_db_info(databaseId) {
140databaseId = databaseId.replaceAll("-", "");
141let db_info = await get_and_save_notion_db_processed_properties(databaseId);
142db_info["zod_schema"] = createZodSchema(db_info["filteredProps"]);
143return db_info;
283}
284285async function addToNotion(databaseId, text) {
286databaseId = databaseId.replaceAll("-", "");
287const properties = await process_text(databaseId, text);
288console.log(properties);
289const response = await notion.pages.create({
290"parent": {
291"type": "database_id",
292"database_id": databaseId,
293},
294"properties": properties,
luciaValtownSqlitemain.tsx22 matches
6import type {
7Adapter,
8DatabaseSession,
9DatabaseUser,
10RegisteredDatabaseSessionAttributes,
11RegisteredDatabaseUserAttributes,
12} from "npm:lucia";
1323}
2425interface SessionSchema extends RegisteredDatabaseSessionAttributes {
26id: string;
27user_id: string;
29}
3031interface UserSchema extends RegisteredDatabaseUserAttributes {
32id: string;
33}
59public async getSessionAndUser(
60sessionId: string,
61): Promise<[session: DatabaseSession | null, user: DatabaseUser | null]> {
62const [databaseSession, databaseUser] = await Promise.all([
63this.getSession(sessionId),
64this.getUserFromSessionId(sessionId),
65]);
66return [databaseSession, databaseUser];
67}
6869public async getUserSessions(userId: string): Promise<DatabaseSession[]> {
70const result = await this.controller.getAll<SessionSchema>(
71`SELECT * FROM ${this.escapedSessionTableName} WHERE user_id = ?`,
72[userId],
73);
74return result.map((val) => transformIntoDatabaseSession(val));
75}
7677public async setSession(databaseSession: DatabaseSession): Promise<void> {
78const value: SessionSchema = {
79id: databaseSession.id,
80user_id: databaseSession.userId,
81expires_at: Math.floor(databaseSession.expiresAt.getTime() / 1000),
82...databaseSession.attributes,
83};
84const entries = Object.entries(value).filter(([_, v]) => v !== undefined);
108}
109110private async getSession(sessionId: string): Promise<DatabaseSession | null> {
111const result = await this.controller.get<SessionSchema>(
112`SELECT * FROM ${this.escapedSessionTableName} WHERE id = ?`,
114);
115if (!result) return null;
116return transformIntoDatabaseSession(result);
117}
118119private async getUserFromSessionId(sessionId: string): Promise<DatabaseUser | null> {
120const result = await this.controller.get<UserSchema>(
121`SELECT ${this.escapedUserTableName}.* FROM ${this.escapedSessionTableName} INNER JOIN ${this.escapedUserTableName} ON ${this.escapedUserTableName}.id = ${this.escapedSessionTableName}.user_id WHERE ${this.escapedSessionTableName}.id = ?`,
123);
124if (!result) return null;
125return transformIntoDatabaseUser(result);
126}
127}
236}
237238function transformIntoDatabaseSession(raw: SessionSchema): DatabaseSession {
239const { id, user_id: userId, expires_at: expiresAtUnix, ...attributes } = raw;
240return {
246}
247248function transformIntoDatabaseUser(raw: UserSchema): DatabaseUser {
249const { id, ...attributes } = raw;
250return {
lucia_middlewaremain.tsx2 matches
49interface Register {
50Lucia: typeof lucia;
51DatabaseUserAttributes: DatabaseUserAttributes;
52}
53}
5455interface DatabaseUserAttributes {
56github_id: number;
57username: string;
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