fix(mcp): add untracked rchats + rsheet schema files
These schemas are imported by the MCP tool files and module mod.ts but were never committed, causing a crash on deploy. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
2e8e702d75
commit
f0039bcb7c
|
|
@ -0,0 +1,108 @@
|
|||
/**
|
||||
* rChats Automerge document schemas.
|
||||
*
|
||||
* Granularity: one directory doc per space + one doc per channel.
|
||||
* DocId format: {space}:chats:channels (directory)
|
||||
* {space}:chats:channel:{channelId} (messages)
|
||||
*/
|
||||
|
||||
import type { DocSchema } from '../../shared/local-first/document';
|
||||
|
||||
// ── Document types ──
|
||||
|
||||
export interface ChannelInfo {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
isPrivate: boolean;
|
||||
createdBy: string | null;
|
||||
createdAt: number;
|
||||
updatedAt: number;
|
||||
}
|
||||
|
||||
export interface ChatsDirectoryDoc {
|
||||
meta: {
|
||||
module: string;
|
||||
collection: string;
|
||||
version: number;
|
||||
spaceSlug: string;
|
||||
createdAt: number;
|
||||
};
|
||||
channels: Record<string, ChannelInfo>;
|
||||
}
|
||||
|
||||
export interface Member {
|
||||
userId: string;
|
||||
displayName: string;
|
||||
joinedAt: number;
|
||||
}
|
||||
|
||||
export interface ChatMessage {
|
||||
id: string;
|
||||
channelId: string;
|
||||
authorId: string;
|
||||
authorName: string;
|
||||
content: string;
|
||||
replyTo: string | null;
|
||||
editedAt: number | null;
|
||||
createdAt: number;
|
||||
}
|
||||
|
||||
export interface ChatChannelDoc {
|
||||
meta: {
|
||||
module: string;
|
||||
collection: string;
|
||||
version: number;
|
||||
spaceSlug: string;
|
||||
createdAt: number;
|
||||
};
|
||||
channelId: string;
|
||||
messages: Record<string, ChatMessage>;
|
||||
members: Record<string, Member>;
|
||||
}
|
||||
|
||||
// ── Schema registration ──
|
||||
|
||||
export const chatsDirectorySchema: DocSchema<ChatsDirectoryDoc> = {
|
||||
module: 'chats',
|
||||
collection: 'channels',
|
||||
version: 1,
|
||||
init: (): ChatsDirectoryDoc => ({
|
||||
meta: {
|
||||
module: 'chats',
|
||||
collection: 'channels',
|
||||
version: 1,
|
||||
spaceSlug: '',
|
||||
createdAt: Date.now(),
|
||||
},
|
||||
channels: {},
|
||||
}),
|
||||
};
|
||||
|
||||
export const chatChannelSchema: DocSchema<ChatChannelDoc> = {
|
||||
module: 'chats',
|
||||
collection: 'channel',
|
||||
version: 1,
|
||||
init: (): ChatChannelDoc => ({
|
||||
meta: {
|
||||
module: 'chats',
|
||||
collection: 'channel',
|
||||
version: 1,
|
||||
spaceSlug: '',
|
||||
createdAt: Date.now(),
|
||||
},
|
||||
channelId: '',
|
||||
messages: {},
|
||||
members: {},
|
||||
}),
|
||||
};
|
||||
|
||||
// ── Helpers ──
|
||||
|
||||
export function chatsDirectoryDocId(space: string) {
|
||||
return `${space}:chats:channels` as const;
|
||||
}
|
||||
|
||||
export function chatChannelDocId(space: string, channelId: string) {
|
||||
return `${space}:chats:channel:${channelId}` as const;
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
/**
|
||||
* rSheet Automerge document schemas.
|
||||
*
|
||||
* Granularity: one Automerge document per sheet.
|
||||
* DocId format: {space}:sheet:sheets:{sheetId}
|
||||
*/
|
||||
|
||||
import type { DocSchema } from '../../shared/local-first/document';
|
||||
|
||||
// ── Document types ──
|
||||
|
||||
export interface Cell {
|
||||
value: string;
|
||||
formula: string | null;
|
||||
format: string | null;
|
||||
updatedAt: number;
|
||||
}
|
||||
|
||||
export interface ColConfig {
|
||||
label: string;
|
||||
width: number;
|
||||
type: string | null;
|
||||
}
|
||||
|
||||
export interface RowConfig {
|
||||
height: number;
|
||||
hidden: boolean;
|
||||
}
|
||||
|
||||
export interface SheetMeta {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
createdBy: string | null;
|
||||
createdAt: number;
|
||||
updatedAt: number;
|
||||
}
|
||||
|
||||
export interface SheetDoc {
|
||||
meta: {
|
||||
module: string;
|
||||
collection: string;
|
||||
version: number;
|
||||
spaceSlug: string;
|
||||
createdAt: number;
|
||||
};
|
||||
sheet: SheetMeta;
|
||||
cells: Record<string, Cell>;
|
||||
columns: Record<string, ColConfig>;
|
||||
rows: Record<string, RowConfig>;
|
||||
}
|
||||
|
||||
// ── Schema registration ──
|
||||
|
||||
export const sheetSchema: DocSchema<SheetDoc> = {
|
||||
module: 'sheet',
|
||||
collection: 'sheets',
|
||||
version: 1,
|
||||
init: (): SheetDoc => ({
|
||||
meta: {
|
||||
module: 'sheet',
|
||||
collection: 'sheets',
|
||||
version: 1,
|
||||
spaceSlug: '',
|
||||
createdAt: Date.now(),
|
||||
},
|
||||
sheet: {
|
||||
id: '',
|
||||
name: 'Untitled Sheet',
|
||||
description: '',
|
||||
createdBy: null,
|
||||
createdAt: Date.now(),
|
||||
updatedAt: Date.now(),
|
||||
},
|
||||
cells: {},
|
||||
columns: {},
|
||||
rows: {},
|
||||
}),
|
||||
};
|
||||
|
||||
// ── Helpers ──
|
||||
|
||||
export function sheetDocId(space: string, sheetId: string) {
|
||||
return `${space}:sheet:sheets:${sheetId}` as const;
|
||||
}
|
||||
Loading…
Reference in New Issue