@listen1954/board 0.1.0

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.
@@ -0,0 +1,213 @@
1
+ export declare const SCHEMA_VERSION: 1;
2
+ export type BoardScope = 'global' | 'session';
3
+ export type ReminderStatus = 'scheduled' | 'fired' | 'cancelled';
4
+ export interface Reminder {
5
+ at: string;
6
+ text: string;
7
+ status: ReminderStatus;
8
+ firedAt?: string;
9
+ }
10
+ export interface Column {
11
+ id: string;
12
+ title: string;
13
+ order: number;
14
+ /** Present when this column is the canonical task list for one conversation. */
15
+ sessionId?: string;
16
+ }
17
+ export interface TimeReminder {
18
+ enabled: boolean;
19
+ startFiredAt?: string;
20
+ endFiredAt?: string;
21
+ }
22
+ export interface LogAttachment {
23
+ id: string;
24
+ name: string;
25
+ type: string;
26
+ size: number;
27
+ preview?: string;
28
+ }
29
+ export interface AttachmentUpload {
30
+ name: string;
31
+ type: string;
32
+ data: string;
33
+ preview?: string;
34
+ }
35
+ export interface AttachmentDownload {
36
+ name: string;
37
+ type: string;
38
+ data: string;
39
+ }
40
+ export interface CardLog {
41
+ id: string;
42
+ text: string;
43
+ createdAt: string;
44
+ attachments: LogAttachment[];
45
+ }
46
+ export interface ArchivedColumn {
47
+ id: string;
48
+ title: string;
49
+ sessionId?: string;
50
+ }
51
+ export interface Card {
52
+ id: string;
53
+ columnId: string;
54
+ title: string;
55
+ body: string;
56
+ order: number;
57
+ startAt: string | null;
58
+ endAt: string | null;
59
+ reminder: Reminder | null;
60
+ timeReminder: TimeReminder;
61
+ logs: CardLog[];
62
+ archivedAt: string | null;
63
+ archivedColumn: ArchivedColumn | null;
64
+ createdAt: string;
65
+ updatedAt: string;
66
+ }
67
+ export interface Board {
68
+ schemaVersion: 1;
69
+ id: string;
70
+ scope: BoardScope;
71
+ sessionId?: string;
72
+ title: string;
73
+ columns: Column[];
74
+ cards: Card[];
75
+ revision: number;
76
+ updatedAt: string;
77
+ /** Durable guard preventing legacy per-session files from being imported twice. */
78
+ sessionColumnsMigrated?: boolean;
79
+ }
80
+ export type MutateOp = {
81
+ type: 'addColumn';
82
+ title: string;
83
+ } | {
84
+ type: 'renameColumn';
85
+ columnId: string;
86
+ title: string;
87
+ } | {
88
+ type: 'reorderColumns';
89
+ columnIds: string[];
90
+ } | {
91
+ type: 'deleteColumn';
92
+ columnId: string;
93
+ confirm: true;
94
+ } | {
95
+ type: 'addCard';
96
+ columnId: string;
97
+ title: string;
98
+ body?: string;
99
+ startAt?: string;
100
+ endAt?: string;
101
+ timeReminder?: boolean;
102
+ reminder?: {
103
+ at: string;
104
+ text?: string;
105
+ };
106
+ } | {
107
+ type: 'updateCard';
108
+ cardId: string;
109
+ title?: string;
110
+ body?: string;
111
+ startAt?: string | null;
112
+ endAt?: string | null;
113
+ timeReminder?: boolean;
114
+ reminder?: {
115
+ at: string;
116
+ text?: string;
117
+ } | null;
118
+ } | {
119
+ type: 'addLog';
120
+ cardId: string;
121
+ text: string;
122
+ attachments?: LogAttachment[];
123
+ } | {
124
+ type: 'moveCard';
125
+ cardId: string;
126
+ columnId: string;
127
+ index: number;
128
+ } | {
129
+ type: 'archiveCard';
130
+ cardId: string;
131
+ } | {
132
+ type: 'restoreCard';
133
+ cardId: string;
134
+ columnId: string;
135
+ } | {
136
+ type: 'restoreCards';
137
+ cards: Array<{
138
+ cardId: string;
139
+ columnId: string;
140
+ }>;
141
+ } | {
142
+ type: 'deleteCard';
143
+ cardId: string;
144
+ } | {
145
+ type: 'deleteCards';
146
+ cardIds: string[];
147
+ } | {
148
+ type: 'setReminder';
149
+ cardId: string;
150
+ at: string;
151
+ text?: string;
152
+ } | {
153
+ type: 'clearReminder';
154
+ cardId: string;
155
+ };
156
+ export interface CardSummary {
157
+ id: string;
158
+ title: string;
159
+ reminderStatus: ReminderStatus | null;
160
+ }
161
+ export interface ColumnSummary {
162
+ id: string;
163
+ title: string;
164
+ sessionId?: string;
165
+ cards: CardSummary[];
166
+ }
167
+ export interface BoardSummary {
168
+ scope: BoardScope;
169
+ id: string;
170
+ title: string;
171
+ revision: number;
172
+ updatedAt: string;
173
+ empty: boolean;
174
+ reminderFiredCount: number;
175
+ archivedCount: number;
176
+ columns: ColumnSummary[];
177
+ }
178
+ export interface FiredReminder {
179
+ cardId: string;
180
+ title: string;
181
+ kind: 'start' | 'end';
182
+ at: string;
183
+ firedAt: string;
184
+ }
185
+ export type IdKind = 'col' | 'card' | 'log' | 'attachment';
186
+ export type IdFactory = (kind: IdKind) => string;
187
+ export type Clock = () => Date;
188
+ export declare class BoardNotFoundError extends Error {
189
+ readonly code = "BOARD_NOT_FOUND";
190
+ constructor();
191
+ }
192
+ export declare class BoardOpError extends Error {
193
+ readonly code = "BOARD_OP";
194
+ constructor(message: string);
195
+ }
196
+ export declare class BoardRevisionError extends Error {
197
+ readonly code = "BOARD_REVISION";
198
+ constructor(expected: number, actual: number);
199
+ }
200
+ export declare function isSessionId(value: string): boolean;
201
+ export declare function assertSessionId(sessionId: string): void;
202
+ export declare function newId(kind: IdKind): string;
203
+ export declare function emptyBoard(scope: BoardScope, sessionId?: string, now?: Date): Board;
204
+ export declare function isEmptyBoard(board: Board): boolean;
205
+ export declare function assertReadable(callerSessionId: string, board: Board): void;
206
+ export declare function summarizeBoard(board: Board): BoardSummary;
207
+ export declare function parseBoard(raw: unknown): Board;
208
+ export declare function applyMutate(board: Board, op: MutateOp, now?: Date, createId?: IdFactory): Board;
209
+ export declare function fireDueReminders(board: Board, now?: Date): {
210
+ board: Board;
211
+ fired: FiredReminder[];
212
+ };
213
+ export declare function defaultGlobalBoard(now?: Date, createId?: IdFactory, titles?: string[]): Board;