sitepaige-mcp-server 1.2.0 → 1.2.1
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/components/slideshow.tsx +1 -9
- package/defaultapp/api/Auth/resend-verification/route.ts +2 -2
- package/defaultapp/api/Auth/route.ts +2 -2
- package/defaultapp/api/Auth/signup/route.ts +2 -2
- package/defaultapp/api/Auth/verify-email/route.ts +3 -3
- package/defaultapp/api/admin/users/route.ts +3 -3
- package/dist/components/slideshow.tsx +1 -9
- package/dist/defaultapp/api/Auth/resend-verification/route.ts +2 -2
- package/dist/defaultapp/api/Auth/route.ts +2 -2
- package/dist/defaultapp/api/Auth/signup/route.ts +2 -2
- package/dist/defaultapp/api/Auth/verify-email/route.ts +3 -3
- package/dist/defaultapp/api/admin/users/route.ts +3 -3
- package/dist/defaultapp/api/csrf.ts +111 -0
- package/dist/defaultapp/api/db-mysql.ts +183 -0
- package/dist/defaultapp/api/db-password-auth.ts +362 -0
- package/dist/defaultapp/api/db-postgres.ts +189 -0
- package/dist/defaultapp/api/db-sqlite.ts +335 -0
- package/dist/defaultapp/api/db-users.ts +520 -0
- package/dist/defaultapp/api/db.ts +149 -0
- package/dist/defaultapp/api/storage/email.ts +162 -0
- package/dist/defaultapp/api/storage/files.ts +160 -0
- package/dist/generators/skeleton.js +3 -5
- package/dist/generators/skeleton.js.map +1 -1
- package/dist/generators/sql.js +60 -0
- package/dist/generators/sql.js.map +1 -1
- package/package.json +1 -1
- package/defaultapp/api/example-secure/route.ts +0 -100
- package/defaultapp/migrate.ts +0 -142
- /package/defaultapp/{csrf.ts → api/csrf.ts} +0 -0
- /package/defaultapp/{db-mysql.ts → api/db-mysql.ts} +0 -0
- /package/defaultapp/{db-password-auth.ts → api/db-password-auth.ts} +0 -0
- /package/defaultapp/{db-postgres.ts → api/db-postgres.ts} +0 -0
- /package/defaultapp/{db-sqlite.ts → api/db-sqlite.ts} +0 -0
- /package/defaultapp/{db-users.ts → api/db-users.ts} +0 -0
- /package/defaultapp/{db.ts → api/db.ts} +0 -0
- /package/defaultapp/{storage → api/storage}/email.ts +0 -0
- /package/defaultapp/{storage → api/storage}/files.ts +0 -0
package/defaultapp/migrate.ts
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/*
|
|
3
|
-
Sitepaige v1.0.0
|
|
4
|
-
Database migration runner
|
|
5
|
-
This script initializes the database and runs all migrations
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import fs from 'fs';
|
|
9
|
-
import path from 'path';
|
|
10
|
-
import { db_init, db_query } from './db';
|
|
11
|
-
|
|
12
|
-
async function runMigrations() {
|
|
13
|
-
console.log('🚀 Starting database migration...');
|
|
14
|
-
|
|
15
|
-
try {
|
|
16
|
-
// Get database type from environment
|
|
17
|
-
const dbType = (process.env.DATABASE_TYPE || process.env.DB_TYPE || 'postgres').toLowerCase();
|
|
18
|
-
|
|
19
|
-
if (dbType !== 'sqlite') {
|
|
20
|
-
console.log(`⚠️ Migration runner currently only supports SQLite. Detected: ${dbType}`);
|
|
21
|
-
console.log('Please run your database migrations manually.');
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Display database path for SQLite
|
|
26
|
-
let dbPath: string;
|
|
27
|
-
const databaseUrl = process.env.DATABASE_URL;
|
|
28
|
-
const efsMountPath = process.env.EFS_MOUNT_PATH;
|
|
29
|
-
const sqliteDir = process.env.SQLITE_DIR || '.';
|
|
30
|
-
|
|
31
|
-
if (databaseUrl) {
|
|
32
|
-
dbPath = databaseUrl.startsWith('sqlite://')
|
|
33
|
-
? databaseUrl.slice(9)
|
|
34
|
-
: databaseUrl;
|
|
35
|
-
console.log(`📁 Database location: ${dbPath} (from DATABASE_URL)`);
|
|
36
|
-
} else if (efsMountPath) {
|
|
37
|
-
dbPath = path.join(efsMountPath, 'data', 'app.db');
|
|
38
|
-
console.log(`📁 Database location: ${dbPath} (from EFS_MOUNT_PATH)`);
|
|
39
|
-
} else {
|
|
40
|
-
dbPath = path.join(sqliteDir, 'app.db');
|
|
41
|
-
console.log(`📁 Database location: ${dbPath} (default: ${sqliteDir !== '.' ? 'SQLITE_DIR' : 'current directory'})`);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Initialize database connection
|
|
45
|
-
const client = await db_init();
|
|
46
|
-
|
|
47
|
-
// Create migrations tracking table if it doesn't exist
|
|
48
|
-
await db_query(client, `
|
|
49
|
-
CREATE TABLE IF NOT EXISTS migrations (
|
|
50
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
51
|
-
filename TEXT NOT NULL UNIQUE,
|
|
52
|
-
applied_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
|
53
|
-
)
|
|
54
|
-
`);
|
|
55
|
-
|
|
56
|
-
// Get list of applied migrations
|
|
57
|
-
const appliedMigrations = await db_query(client, 'SELECT filename FROM migrations');
|
|
58
|
-
const appliedSet = new Set(appliedMigrations.map(m => m.filename));
|
|
59
|
-
|
|
60
|
-
// Read migrations directory
|
|
61
|
-
const migrationsDir = path.join(process.cwd(), 'migrations');
|
|
62
|
-
|
|
63
|
-
if (!fs.existsSync(migrationsDir)) {
|
|
64
|
-
console.log('📂 No migrations directory found. Creating it...');
|
|
65
|
-
fs.mkdirSync(migrationsDir, { recursive: true });
|
|
66
|
-
console.log('✅ Migrations directory created at:', migrationsDir);
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Get all SQL files from migrations directory
|
|
71
|
-
const migrationFiles = fs.readdirSync(migrationsDir)
|
|
72
|
-
.filter(file => file.endsWith('.sql'))
|
|
73
|
-
.sort(); // Ensure migrations run in order
|
|
74
|
-
|
|
75
|
-
if (migrationFiles.length === 0) {
|
|
76
|
-
console.log('📭 No migration files found in migrations directory.');
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// Run each migration that hasn't been applied yet
|
|
81
|
-
let migrationsRun = 0;
|
|
82
|
-
|
|
83
|
-
for (const file of migrationFiles) {
|
|
84
|
-
if (appliedSet.has(file)) {
|
|
85
|
-
console.log(`⏭️ Skipping already applied migration: ${file}`);
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
console.log(`🔄 Running migration: ${file}`);
|
|
90
|
-
|
|
91
|
-
try {
|
|
92
|
-
// Read migration file
|
|
93
|
-
const migrationPath = path.join(migrationsDir, file);
|
|
94
|
-
const sql = fs.readFileSync(migrationPath, 'utf8');
|
|
95
|
-
|
|
96
|
-
// Split by semicolons but handle them properly
|
|
97
|
-
const statements = sql
|
|
98
|
-
.split(';')
|
|
99
|
-
.map(s => s.trim())
|
|
100
|
-
.filter(s => s.length > 0)
|
|
101
|
-
.map(s => s + ';'); // Add semicolon back
|
|
102
|
-
|
|
103
|
-
// Execute each statement
|
|
104
|
-
for (const statement of statements) {
|
|
105
|
-
if (statement.trim()) {
|
|
106
|
-
await db_query(client, statement);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// Record that this migration has been applied
|
|
111
|
-
await db_query(client, 'INSERT INTO migrations (filename) VALUES (?)', [file]);
|
|
112
|
-
|
|
113
|
-
console.log(`✅ Applied migration: ${file}`);
|
|
114
|
-
migrationsRun++;
|
|
115
|
-
|
|
116
|
-
} catch (error) {
|
|
117
|
-
console.error(`❌ Error applying migration ${file}:`, error);
|
|
118
|
-
throw error;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (migrationsRun === 0) {
|
|
123
|
-
console.log('✨ All migrations are already up to date!');
|
|
124
|
-
} else {
|
|
125
|
-
console.log(`✅ Successfully applied ${migrationsRun} migration(s)`);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
} catch (error) {
|
|
129
|
-
console.error('❌ Migration failed:', error);
|
|
130
|
-
process.exit(1);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// Run migrations if this file is executed directly
|
|
135
|
-
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
136
|
-
runMigrations().catch(error => {
|
|
137
|
-
console.error('Unhandled error:', error);
|
|
138
|
-
process.exit(1);
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export { runMigrations };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|