Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
VITE_TLDRAW_LICENSE_KEY: ${{ secrets.VITE_TLDRAW_LICENSE_KEY }}
with:
tagName: v__VERSION__
releaseName: "RelWave v__VERSION__"
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ node_modules
dist
dist-ssr
*.local
.env
.env.*
src-tauri/resources/


Expand Down
36 changes: 36 additions & 0 deletions bridge/src/handlers/projectHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,42 @@ export class ProjectHandlers {
}
}

async handleGetAnnotations(params: any, id: number | string) {
try {
const { projectId } = params || {};
if (!projectId) {
return this.rpc.sendError(id, {
code: "BAD_REQUEST",
message: "Missing projectId",
});
}

const annotations = await projectStoreInstance.getAnnotations(projectId);
this.rpc.sendResponse(id, { ok: true, data: annotations });
} catch (e: any) {
this.logger?.error({ e }, "project.getAnnotations failed");
this.rpc.sendError(id, { code: "IO_ERROR", message: String(e) });
}
}

async handleSaveAnnotations(params: any, id: number | string) {
try {
const { projectId, snapshot } = params || {};
if (!projectId || !snapshot) {
return this.rpc.sendError(id, {
code: "BAD_REQUEST",
message: "Missing projectId or snapshot",
});
}

const result = await projectStoreInstance.saveAnnotations(projectId, snapshot);
this.rpc.sendResponse(id, { ok: true, data: result });
} catch (e: any) {
this.logger?.error({ e }, "project.saveAnnotations failed");
this.rpc.sendError(id, { code: "IO_ERROR", message: String(e) });
}
}

async handleGetQueries(params: any, id: number | string) {
try {
const { projectId } = params || {};
Expand Down
6 changes: 6 additions & 0 deletions bridge/src/jsonRpcHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ export function registerDbHandlers(
rpcRegister("project.saveERDiagram", (p, id) =>
projectHandlers.handleSaveERDiagram(p, id)
);
rpcRegister("project.getAnnotations", (p, id) =>
projectHandlers.handleGetAnnotations(p, id)
);
rpcRegister("project.saveAnnotations", (p, id) =>
projectHandlers.handleSaveAnnotations(p, id)
);
rpcRegister("project.getQueries", (p, id) =>
projectHandlers.handleGetQueries(p, id)
);
Expand Down
43 changes: 40 additions & 3 deletions bridge/src/services/projectStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ export type ERDiagramFile = {
updatedAt: string;
};

export type AnnotationsFile = {
version: number;
projectId: string;
snapshot: Record<string, unknown>;
updatedAt: string;
};

export type SchemaFile = {
version: number;
projectId: string;
Expand Down Expand Up @@ -142,6 +149,7 @@ const PROJECT_FILES = {
readme: "README.md",
schema: path.join("schema", "schema.json"),
erDiagram: path.join("diagrams", "er.json"),
annotations: path.join("diagrams", "annotations.json"),
queries: path.join("queries", "queries.json"),
} as const;

Expand Down Expand Up @@ -650,6 +658,32 @@ export class ProjectStore {
return file;
}

async getAnnotations(projectId: string): Promise<AnnotationsFile | null> {
return this.readJSON<AnnotationsFile>(
this.projectFile(projectId, PROJECT_FILES.annotations)
);
}

async saveAnnotations(
projectId: string,
snapshot: Record<string, unknown>
): Promise<AnnotationsFile> {
const now = new Date().toISOString();
const file: AnnotationsFile = {
version: 1,
projectId,
snapshot,
updatedAt: now,
};

await this.writeJSON(
this.projectFile(projectId, PROJECT_FILES.annotations),
file
);

return file;
}

async getQueries(projectId: string): Promise<QueriesFile | null> {
return this.readJSON<QueriesFile>(
this.projectFile(projectId, PROJECT_FILES.queries)
Expand Down Expand Up @@ -731,18 +765,20 @@ export class ProjectStore {
metadata: ProjectMetadata;
schema: SchemaFile | null;
erDiagram: ERDiagramFile | null;
annotations: AnnotationsFile | null;
queries: QueriesFile | null;
} | null> {
const metadata = await this.getProject(projectId);
if (!metadata) return null;

const [schema, erDiagram, queries] = await Promise.all([
const [schema, erDiagram, annotations, queries] = await Promise.all([
this.getSchema(projectId),
this.getERDiagram(projectId),
this.getAnnotations(projectId),
this.getQueries(projectId),
]);

return { metadata, schema, erDiagram, queries };
return { metadata, schema, erDiagram, annotations, queries };
}

// ==========================================
Expand Down Expand Up @@ -898,7 +934,8 @@ export class ProjectStore {
"├── schema/",
"│ └── schema.json # Cached database schema snapshot",
"├── diagrams/",
"│ └── er.json # ER diagram layout",
"│ ├── er.json # ER diagram layout",
"│ └── annotations.json # ER diagram annotations (tldraw)",
"└── queries/",
" └── queries.json # Saved SQL queries",
"```",
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@
"sonner": "^2.0.7",
"styled-components": "^6.1.19",
"tailwind-merge": "^3.4.0",
"tailwindcss": "^4.1.17"
"tailwindcss": "^4.1.17",
"tldraw": "^4.4.1"
},
"devDependencies": {
"@tauri-apps/cli": "^2",
Expand Down
Loading
Loading