@goscribe/server 1.0.10 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ANALYSIS_PROGRESS_SPEC.md +463 -0
- package/PROGRESS_QUICK_REFERENCE.md +239 -0
- package/dist/lib/ai-session.d.ts +20 -9
- package/dist/lib/ai-session.js +316 -80
- package/dist/lib/auth.d.ts +35 -2
- package/dist/lib/auth.js +88 -15
- package/dist/lib/env.d.ts +32 -0
- package/dist/lib/env.js +46 -0
- package/dist/lib/errors.d.ts +33 -0
- package/dist/lib/errors.js +78 -0
- package/dist/lib/inference.d.ts +4 -1
- package/dist/lib/inference.js +9 -11
- package/dist/lib/logger.d.ts +62 -0
- package/dist/lib/logger.js +342 -0
- package/dist/lib/podcast-prompts.d.ts +43 -0
- package/dist/lib/podcast-prompts.js +135 -0
- package/dist/lib/pusher.d.ts +1 -0
- package/dist/lib/pusher.js +14 -2
- package/dist/lib/storage.d.ts +3 -3
- package/dist/lib/storage.js +51 -47
- package/dist/lib/validation.d.ts +51 -0
- package/dist/lib/validation.js +64 -0
- package/dist/routers/_app.d.ts +697 -111
- package/dist/routers/_app.js +5 -0
- package/dist/routers/auth.d.ts +11 -1
- package/dist/routers/chat.d.ts +11 -1
- package/dist/routers/flashcards.d.ts +205 -6
- package/dist/routers/flashcards.js +144 -66
- package/dist/routers/members.d.ts +165 -0
- package/dist/routers/members.js +531 -0
- package/dist/routers/podcast.d.ts +78 -63
- package/dist/routers/podcast.js +330 -393
- package/dist/routers/studyguide.d.ts +11 -1
- package/dist/routers/worksheets.d.ts +124 -13
- package/dist/routers/worksheets.js +123 -50
- package/dist/routers/workspace.d.ts +213 -26
- package/dist/routers/workspace.js +303 -181
- package/dist/server.js +12 -4
- package/dist/services/flashcard-progress.service.d.ts +183 -0
- package/dist/services/flashcard-progress.service.js +383 -0
- package/dist/services/flashcard.service.d.ts +183 -0
- package/dist/services/flashcard.service.js +224 -0
- package/dist/services/podcast-segment-reorder.d.ts +0 -0
- package/dist/services/podcast-segment-reorder.js +107 -0
- package/dist/services/podcast.service.d.ts +0 -0
- package/dist/services/podcast.service.js +326 -0
- package/dist/services/worksheet.service.d.ts +0 -0
- package/dist/services/worksheet.service.js +295 -0
- package/dist/trpc.d.ts +13 -2
- package/dist/trpc.js +55 -6
- package/dist/types/index.d.ts +126 -0
- package/dist/types/index.js +1 -0
- package/package.json +3 -2
- package/prisma/schema.prisma +142 -4
- package/src/lib/ai-session.ts +356 -85
- package/src/lib/auth.ts +113 -19
- package/src/lib/env.ts +59 -0
- package/src/lib/errors.ts +92 -0
- package/src/lib/inference.ts +11 -11
- package/src/lib/logger.ts +405 -0
- package/src/lib/pusher.ts +15 -3
- package/src/lib/storage.ts +56 -51
- package/src/lib/validation.ts +75 -0
- package/src/routers/_app.ts +5 -0
- package/src/routers/chat.ts +2 -23
- package/src/routers/flashcards.ts +108 -24
- package/src/routers/members.ts +586 -0
- package/src/routers/podcast.ts +385 -420
- package/src/routers/worksheets.ts +117 -35
- package/src/routers/workspace.ts +328 -195
- package/src/server.ts +13 -4
- package/src/services/flashcard-progress.service.ts +541 -0
- package/src/trpc.ts +59 -6
- package/src/types/index.ts +165 -0
- package/AUTH_FRONTEND_SPEC.md +0 -21
- package/CHAT_FRONTEND_SPEC.md +0 -474
- package/DATABASE_SETUP.md +0 -165
- package/MEETINGSUMMARY_FRONTEND_SPEC.md +0 -28
- package/PODCAST_FRONTEND_SPEC.md +0 -595
- package/STUDYGUIDE_FRONTEND_SPEC.md +0 -18
- package/WORKSHEETS_FRONTEND_SPEC.md +0 -26
- package/WORKSPACE_FRONTEND_SPEC.md +0 -47
- package/test-ai-integration.js +0 -134
package/DATABASE_SETUP.md
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
# 🗄️ Database Setup Guide
|
|
2
|
-
|
|
3
|
-
## 📋 Overview
|
|
4
|
-
This guide covers the database configuration for the Scribe server, including Prisma setup, environment variables, and troubleshooting common connection issues.
|
|
5
|
-
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## 🔧 Environment Variables Required
|
|
9
|
-
|
|
10
|
-
### Core Database Configuration
|
|
11
|
-
```bash
|
|
12
|
-
# Pooled connection (for runtime queries)
|
|
13
|
-
DATABASE_URL="postgresql://<db_user>:<db_password>@aws-1-ap-southeast-1.pooler.supabase.com:5432/postgres?sslmode=require"
|
|
14
|
-
|
|
15
|
-
# Direct connection (for migrations and schema operations)
|
|
16
|
-
DIRECT_URL="postgresql://<db_user>:<db_password>@db.<project-ref>.supabase.co:5432/postgres?sslmode=require"
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
### 🔍 Where to Find These Values
|
|
20
|
-
1. Go to your Supabase project dashboard
|
|
21
|
-
2. Navigate to **Settings** → **Database**
|
|
22
|
-
3. Copy the connection strings from:
|
|
23
|
-
- **Connection pooling** → `DATABASE_URL`
|
|
24
|
-
- **Direct connection** → `DIRECT_URL`
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
## 🚀 Quick Setup Steps
|
|
29
|
-
|
|
30
|
-
### 1. Set Environment Variables
|
|
31
|
-
```bash
|
|
32
|
-
# Option A: Export for current session
|
|
33
|
-
export DATABASE_URL="your_pooled_connection_string"
|
|
34
|
-
export DIRECT_URL="your_direct_connection_string"
|
|
35
|
-
|
|
36
|
-
# Option B: Add to .env file
|
|
37
|
-
echo "DATABASE_URL=your_pooled_connection_string" >> .env
|
|
38
|
-
echo "DIRECT_URL=your_direct_connection_string" >> .env
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### 2. Generate Prisma Client
|
|
42
|
-
```bash
|
|
43
|
-
npm run build
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### 3. Run Migrations (if needed)
|
|
47
|
-
```bash
|
|
48
|
-
npx prisma migrate deploy
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### 4. Seed Database (optional)
|
|
52
|
-
```bash
|
|
53
|
-
npm run seed
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
## 🏗️ Database Schema Overview
|
|
59
|
-
|
|
60
|
-
### Core Models
|
|
61
|
-
- **User** - Authentication and user management
|
|
62
|
-
- **Workspace** - Project containers with folders
|
|
63
|
-
- **Channel** - Chat channels within workspaces
|
|
64
|
-
- **Chat** - Individual chat messages
|
|
65
|
-
- **Artifact** - AI-generated content (study guides, flashcards, etc.)
|
|
66
|
-
- **FileAsset** - User uploads and attachments
|
|
67
|
-
|
|
68
|
-
### Key Relationships
|
|
69
|
-
```
|
|
70
|
-
User → Workspaces → Channels → Chats
|
|
71
|
-
User → Artifacts → Versions/Questions/Flashcards
|
|
72
|
-
Workspace → FileAssets
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
---
|
|
76
|
-
|
|
77
|
-
## 🐛 Troubleshooting
|
|
78
|
-
|
|
79
|
-
### ❌ "Tenant or user not found" Error
|
|
80
|
-
|
|
81
|
-
**Cause:** Incorrect database credentials or connection string format
|
|
82
|
-
|
|
83
|
-
**Solutions:**
|
|
84
|
-
1. **Verify credentials** in Supabase dashboard
|
|
85
|
-
2. **Check connection string format:**
|
|
86
|
-
```bash
|
|
87
|
-
# ✅ Correct format
|
|
88
|
-
postgresql://user:password@host:port/database?sslmode=require
|
|
89
|
-
|
|
90
|
-
# ❌ Common mistakes
|
|
91
|
-
postgresql://user:password@host:port/database # Missing sslmode
|
|
92
|
-
postgresql://user:password@host:port # Missing database name
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
3. **Ensure proper URL encoding** for special characters in passwords
|
|
96
|
-
4. **Use direct connection** for migrations (not pooled)
|
|
97
|
-
|
|
98
|
-
### ❌ Migration Failures
|
|
99
|
-
|
|
100
|
-
**Cause:** Using pooled connection for schema operations
|
|
101
|
-
|
|
102
|
-
**Solution:** Always use `DIRECT_URL` for migrations
|
|
103
|
-
```bash
|
|
104
|
-
# ✅ Correct
|
|
105
|
-
DIRECT_URL="postgresql://user:pass@db.project.supabase.co:5432/postgres?sslmode=require"
|
|
106
|
-
|
|
107
|
-
# ❌ Wrong
|
|
108
|
-
DIRECT_URL="postgresql://user:pass@aws-1-ap-southeast-1.pooler.supabase.com:5432/postgres?sslmode=require"
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
### ❌ Connection Timeouts
|
|
112
|
-
|
|
113
|
-
**Solutions:**
|
|
114
|
-
1. Check Supabase project status
|
|
115
|
-
2. Verify network connectivity
|
|
116
|
-
3. Ensure SSL mode is set to `require`
|
|
117
|
-
4. Check if IP is whitelisted (if using IP restrictions)
|
|
118
|
-
|
|
119
|
-
---
|
|
120
|
-
|
|
121
|
-
## 📊 Database Operations
|
|
122
|
-
|
|
123
|
-
### Available Scripts
|
|
124
|
-
```bash
|
|
125
|
-
# Development
|
|
126
|
-
npm run dev # Start development server
|
|
127
|
-
|
|
128
|
-
# Database
|
|
129
|
-
npm run build # Generate Prisma client + build
|
|
130
|
-
npm run seed # Populate with sample data
|
|
131
|
-
npx prisma studio # Open database browser
|
|
132
|
-
npx prisma migrate dev # Create and apply migrations
|
|
133
|
-
npx prisma migrate deploy # Apply existing migrations
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
### Sample Data
|
|
137
|
-
The seed script creates:
|
|
138
|
-
- Demo user (`demo@example.com`)
|
|
139
|
-
- Sample workspace with artifacts
|
|
140
|
-
- Worksheet with mixed question types
|
|
141
|
-
- Flashcard set
|
|
142
|
-
- Study guide with versions
|
|
143
|
-
|
|
144
|
-
---
|
|
145
|
-
|
|
146
|
-
## 🔐 Security Notes
|
|
147
|
-
|
|
148
|
-
- **Never commit** `.env` files to version control
|
|
149
|
-
- **Use environment-specific** connection strings
|
|
150
|
-
- **Enable SSL** (`sslmode=require`) for all connections
|
|
151
|
-
- **Rotate credentials** regularly
|
|
152
|
-
- **Use connection pooling** for production workloads
|
|
153
|
-
|
|
154
|
-
---
|
|
155
|
-
|
|
156
|
-
## 📚 Additional Resources
|
|
157
|
-
|
|
158
|
-
- [Prisma Documentation](https://www.prisma.io/docs)
|
|
159
|
-
- [Supabase Database Guide](https://supabase.com/docs/guides/database)
|
|
160
|
-
- [PostgreSQL Connection Strings](https://www.postgresql.org/docs/current/libpq-connect.html)
|
|
161
|
-
|
|
162
|
-
---
|
|
163
|
-
|
|
164
|
-
*Last updated: $(date)*
|
|
165
|
-
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
## Meeting Summary Frontend Spec
|
|
2
|
-
|
|
3
|
-
Note: The `meetingsummary` router is currently commented out. This spec outlines the intended API based on the commented code and typical flows, so the frontend contract is ready when implementation resumes.
|
|
4
|
-
|
|
5
|
-
### Proposed Endpoints (tRPC)
|
|
6
|
-
- **meetingsummary.listSummaries**: `{ workspaceId: string }` → `Artifact[]` (type: `MEETING_SUMMARY`, latest version included)
|
|
7
|
-
- **meetingsummary.getSummary**: `{ summaryId: string }` → `Artifact & { versions: Version[] }`
|
|
8
|
-
- **meetingsummary.uploadFile**: `{ workspaceId: string; fileName: string; fileBuffer: string /* base64 */; mimeType: string; title?: string }` → `{ id: string; title: string; summary: SummaryData; transcript: string }`
|
|
9
|
-
- **meetingsummary.processSchema**: `{ workspaceId: string; meetingData: MeetingSchema }` → `{ id: string; title: string; summary: SummaryData; originalData: MeetingSchema }`
|
|
10
|
-
- **meetingsummary.updateSummary**: `{ summaryId: string; title?: string; content?: string }` → `Artifact`
|
|
11
|
-
- **meetingsummary.deleteSummary**: `{ summaryId: string }` → `true`
|
|
12
|
-
- **meetingsummary.getVersions**: `{ summaryId: string }` → `Version[]`
|
|
13
|
-
|
|
14
|
-
### Types (simplified)
|
|
15
|
-
- **Artifact**: `{ id; workspaceId; type: 'MEETING_SUMMARY'; title; content?; createdAt; updatedAt }`
|
|
16
|
-
- **Version**: `{ id; artifactId; version: number; content: string; createdAt }`
|
|
17
|
-
- **MeetingSchema**: `{ title: string; participants: string[]; date: string; duration?: string; agenda?: string[]; transcript?: string; notes?: string }`
|
|
18
|
-
- **SummaryData**: `{ keyPoints: string[]; actionItems: string[]; decisions: string[]; nextSteps: string[]; insights?: string[]; summary: string }`
|
|
19
|
-
|
|
20
|
-
### Upload Flow (when implemented)
|
|
21
|
-
1. Validate file type (mp3/mp4/wav/m4a).
|
|
22
|
-
2. Upload base64 file; backend transcribes (Whisper) then summarizes (GPT), stores artifact + version.
|
|
23
|
-
3. Return summary JSON and transcript.
|
|
24
|
-
|
|
25
|
-
### UX Notes
|
|
26
|
-
- Show parsing progress and handle large files.
|
|
27
|
-
- Provide manual schema entry as fallback (processSchema).
|
|
28
|
-
- Keep version history for edits; show latest version by default.
|