Skip to content

Commit 068662a

Browse files
made
1 parent 3c0cc61 commit 068662a

65 files changed

Lines changed: 7948 additions & 1767 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// electron.vite.config.ts
2+
import { resolve } from "path";
3+
import { defineConfig, externalizeDepsPlugin } from "electron-vite";
4+
import react from "@vitejs/plugin-react";
5+
import tailwindcss from "@tailwindcss/vite";
6+
var electron_vite_config_default = defineConfig({
7+
main: {
8+
plugins: [externalizeDepsPlugin({ exclude: ["electron-store"] })]
9+
},
10+
preload: {
11+
plugins: [externalizeDepsPlugin()]
12+
},
13+
renderer: {
14+
resolve: {
15+
alias: {
16+
"@": resolve("src/renderer/src")
17+
}
18+
},
19+
plugins: [react(), tailwindcss()],
20+
// server: {
21+
// port: 4174
22+
// }
23+
}
24+
});
25+
export {
26+
electron_vite_config_default as default
27+
};

package-lock.json

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"@codemirror/language": "^6.12.3",
2121
"@electron-toolkit/preload": "^3.0.2",
2222
"@electron-toolkit/utils": "^4.0.0",
23+
"@monaco-editor/react": "^4.7.0",
2324
"@tanstack/react-query": "^5.62.0",
2425
"@tiptap/extension-link": "^3.22.2",
2526
"@tiptap/extension-placeholder": "^3.22.2",

scratch.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const simpleGit = require('simple-git');
2+
async function test() {
3+
const git = simpleGit(process.cwd());
4+
const res = await git.show(['HEAD:package.json']);
5+
console.log(res.substring(0, 50));
6+
}
7+
test();

scratch/diagnose_db.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { db } from './src/renderer/src/db/index.ts';
2+
3+
async function diagnose() {
4+
const apis = await db.apiCollections.toArray();
5+
const withProject = apis.filter(a => a.projectId).length;
6+
const withoutProject = apis.filter(a => !a.projectId).length;
7+
8+
console.log(`Total APIs: ${apis.length}`);
9+
console.log(`With projectId: ${withProject}`);
10+
console.log(`Without projectId: ${withoutProject}`);
11+
12+
if (withoutProject > 0) {
13+
console.log('Sample IDs without projectId:', apis.filter(a => !a.projectId).slice(0, 5).map(a => a.id));
14+
}
15+
}
16+
17+
diagnose();

scratch/diagnose_git.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { simpleGit } from 'simple-git';
2+
3+
async function test() {
4+
const git = simpleGit();
5+
const status = await git.status();
6+
console.log(JSON.stringify(status, null, 2));
7+
}
8+
9+
test();

scratch/test_git_add

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 53ffa6d9bb22d548ecd6e72aeb167c57392fa519

server/api/index.ts

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import healthHandler from '../routes/health.js';
2+
import syncHandler from '../routes/sync.js';
3+
import apisIndexHandler from '../routes/apis/index.js';
4+
import apisIdHandler from '../routes/apis/[id].js';
5+
import environmentsIndexHandler from '../routes/environments/index.js';
6+
import environmentsIdHandler from '../routes/environments/[id].js';
7+
import foldersIndexHandler from '../routes/folders/index.js';
8+
import foldersIdHandler from '../routes/folders/[id].js';
9+
import rbacDocsHandler from '../routes/rbac/docs.js';
10+
import rbacFoldersHandler from '../routes/rbac/folders.js';
11+
import rbacIndexHandler from '../routes/rbac/index.js';
12+
import syncQueueIndexHandler from '../routes/sync_queue/index.js';
13+
import usersIndexHandler from '../routes/users/index.js';
14+
15+
export default async function handler(req: any, res: any) {
16+
// Basic CORS for unhandled preflights
17+
if (req.method === 'OPTIONS') {
18+
res.setHeader('Access-Control-Allow-Origin', '*');
19+
res.setHeader('Access-Control-Allow-Methods', 'GET,POST,PUT,DELETE,OPTIONS');
20+
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization');
21+
return res.status(200).end();
22+
}
23+
24+
try {
25+
const url = new URL(req.url, `http://${req.headers.host || 'localhost'}`);
26+
let pathname = url.pathname;
27+
28+
// Remove trailing slash if present
29+
if (pathname.length > 1 && pathname.endsWith('/')) {
30+
pathname = pathname.slice(0, -1);
31+
}
32+
33+
// Exact matches
34+
if (pathname === '/api/health') return healthHandler(req, res);
35+
if (pathname === '/api/sync') return syncHandler(req, res);
36+
if (pathname === '/api/apis') return apisIndexHandler(req, res);
37+
if (pathname === '/api/environments') return environmentsIndexHandler(req, res);
38+
if (pathname === '/api/folders') return foldersIndexHandler(req, res);
39+
if (pathname === '/api/rbac') return rbacIndexHandler(req, res);
40+
if (pathname === '/api/rbac/docs') return rbacDocsHandler(req, res);
41+
if (pathname === '/api/rbac/folders') return rbacFoldersHandler(req, res);
42+
if (pathname === '/api/sync_queue') return syncQueueIndexHandler(req, res);
43+
if (pathname === '/api/users') return usersIndexHandler(req, res);
44+
45+
// Dynamic ID matches
46+
if (pathname.startsWith('/api/apis/')) {
47+
req.query = { ...req.query, id: pathname.split('/').pop() };
48+
return apisIdHandler(req, res);
49+
}
50+
if (pathname.startsWith('/api/environments/')) {
51+
req.query = { ...req.query, id: pathname.split('/').pop() };
52+
return environmentsIdHandler(req, res);
53+
}
54+
if (pathname.startsWith('/api/folders/')) {
55+
req.query = { ...req.query, id: pathname.split('/').pop() };
56+
return foldersIdHandler(req, res);
57+
}
58+
59+
// 404 Fallback
60+
res.status(404).json({ error: 'Route not found in consolidated API' });
61+
} catch (err: any) {
62+
console.error('Master Router Error:', err);
63+
res.status(500).json({ error: 'Internal Server Error', details: err.message });
64+
}
65+
}

0 commit comments

Comments
 (0)