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;
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.
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
lucia_middleware_vanillamain.tsx2 matches
26interface Register {
27Lucia: typeof lucia;
28DatabaseUserAttributes: DatabaseUserAttributes;
29}
30}
3132interface DatabaseUserAttributes {
33username: string;
34}
lucia_demomain.tsx2 matches
26interface Register {
27Lucia: typeof lucia;
28DatabaseUserAttributes: DatabaseUserAttributes;
29}
30}
3132interface DatabaseUserAttributes {
33username: string;
34}
lucia_adapter_basemain.tsx22 matches
1import type {
2Adapter,
3DatabaseSession,
4DatabaseUser,
5RegisteredDatabaseSessionAttributes,
6RegisteredDatabaseUserAttributes,
7} from "npm:lucia";
834public async getSessionAndUser(
35sessionId: string,
36): Promise<[session: DatabaseSession | null, user: DatabaseUser | null]> {
37const [databaseSession, databaseUser] = await Promise.all([
38this.getSession(sessionId),
39this.getUserFromSessionId(sessionId),
40]);
41return [databaseSession, databaseUser];
42}
4344public async getUserSessions(userId: string): Promise<DatabaseSession[]> {
45const result = await this.controller.getAll<SessionSchema>(
46`SELECT * FROM ${this.escapedSessionTableName} WHERE user_id = ?`,
48);
49return result.map((val) => {
50return transformIntoDatabaseSession(val);
51});
52}
5354public async setSession(databaseSession: DatabaseSession): Promise<void> {
55const value: SessionSchema = {
56id: databaseSession.id,
57user_id: databaseSession.userId,
58expires_at: Math.floor(databaseSession.expiresAt.getTime() / 1000),
59...databaseSession.attributes,
60};
61const entries = Object.entries(value).filter(([_, v]) => v !== undefined);
87}
8889private async getSession(sessionId: string): Promise<DatabaseSession | null> {
90const result = await this.controller.get<SessionSchema>(
91`SELECT * FROM ${this.escapedSessionTableName} WHERE id = ?`,
93);
94if (!result) return null;
95return transformIntoDatabaseSession(result);
96}
9798private async getUserFromSessionId(sessionId: string): Promise<DatabaseUser | null> {
99const result = await this.controller.get<UserSchema>(
100`SELECT ${this.escapedUserTableName}.* FROM ${this.escapedSessionTableName} INNER JOIN ${this.escapedUserTableName} ON ${this.escapedUserTableName}.id = ${this.escapedSessionTableName}.user_id WHERE ${this.escapedSessionTableName}.id = ?`,
102);
103if (!result) return null;
104return transformIntoDatabaseUser(result);
105}
106}
117}
118119interface SessionSchema extends RegisteredDatabaseSessionAttributes {
120id: string;
121user_id: string;
123}
124125interface UserSchema extends RegisteredDatabaseUserAttributes {
126id: string;
127}
128129function transformIntoDatabaseSession(raw: SessionSchema): DatabaseSession {
130const { id, user_id: userId, expires_at: expiresAtUnix, ...attributes } = raw;
131return {
137}
138139function transformIntoDatabaseUser(raw: UserSchema): DatabaseUser {
140const { id, ...attributes } = raw;
141return {
5```javascript
6// Example usage:
7const dobby = new Dobby("myDatabase", [
8{ name: "id", type: "INTEGER", primaryKey: true },
9{ name: "name", type: "TEXT", notNull: true },
12]);
1314await dobby.createDatabase();
1516// Insert some sample data
474849// Example of using the new dropDatabase function
50await dropDatabase("myDatabase");
5152```
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
106"Changing the license was a mistake, and Elastic now backtracks from it". We removed a lot of market confusion when we changed our license 3 years ago. And because of our actions, a lot has changed. It's an entirely different landscape now. We aren't living in the past. We want to build a better future for our users. It's because we took action then, that we are in a position to take action now.
107"AGPL is not true open source, license X is": AGPL is an OSI approved license, and it's a widely adopted one. For example, MongoDB used to be AGPL and Grafana is AGPL. It shows that AGPL doesn't affect usage or popularity. We chose AGPL because we believe it's the best way to start to pave a path, with OSI, towards more Open Source in the world, not less.
108"Elastic changes the license because they are not doing well" - I will start by saying that I am as excited today as ever about the future of Elastic. I am tremendously proud of our products and our team's execution. We shipped Stateless Elasticsearch, ES|QL, and tons of vector database/hybrid search improvements for GenAI use cases. We are leaning heavily into OTel in logging and Observability. And our SIEM product in Security keeps adding amazing features and it's one of the fastest growing in the market. Users' response has been humbling. The stock market will have its ups and downs. What I can assure you, is that we are always thinking long term, and this change is part of it.
109If we see more, we will add them above to hopefully reduce confusion.
110