Files
claudemesh/packages/db/src/schema/index.ts
Alejandro Gutiérrez d3163a5bff feat(db): mesh data model — meshes, members, invites, audit log
- pgSchema "mesh" with 4 tables isolating the peer mesh domain
- Enums: visibility, transport, tier, role
- audit_log is metadata-only (E2E encryption enforced at broker/client)
- Cascade on mesh delete, soft-delete via archivedAt/revokedAt

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 21:19:32 +01:00

47 lines
1.1 KiB
TypeScript

import * as auth from "./auth";
import * as chat from "./chat";
import * as creditTransactions from "./credit-transaction";
import * as customers from "./customer";
import * as image from "./image";
import * as mesh from "./mesh";
import * as pdf from "./pdf";
type Prefix<
T extends Record<string, unknown>,
K extends keyof T,
P extends string,
> = {
[Key in K as `${P}.${Key & string}`]: T[Key];
};
export const prefix = <T extends Record<string, unknown>, P extends string>(
obj: T,
prefix: P,
) => {
return Object.entries(obj).reduce(
(acc, [key, value]) => ({ ...acc, [`${prefix}.${key}`]: value }),
{} as Prefix<T, keyof T, P>,
);
};
export const schema = {
...auth,
...creditTransactions,
...customers,
...prefix(chat, "chat"),
...prefix(pdf, "pdf"),
...prefix(image, "image"),
...prefix(mesh, "mesh"),
};
// Direct exports for backward compatibility
export * from "./auth";
export * from "./credit-transaction";
export * from "./customer";
// pgSchema-based modules (need explicit exports for drizzle-kit)
export * from "./chat";
export * from "./pdf";
export * from "./image";
export * from "./mesh";