@hamzasaleemorg/convex-comments 1.0.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.
- package/CHANGELOG.md +17 -0
- package/LICENSE +201 -0
- package/README.md +581 -0
- package/dist/client/_generated/_ignore.d.ts +1 -0
- package/dist/client/_generated/_ignore.d.ts.map +1 -0
- package/dist/client/_generated/_ignore.js +3 -0
- package/dist/client/_generated/_ignore.js.map +1 -0
- package/dist/client/index.d.ts +745 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +579 -0
- package/dist/client/index.js.map +1 -0
- package/dist/component/_generated/api.d.ts +44 -0
- package/dist/component/_generated/api.d.ts.map +1 -0
- package/dist/component/_generated/api.js +31 -0
- package/dist/component/_generated/api.js.map +1 -0
- package/dist/component/_generated/component.d.ts +673 -0
- package/dist/component/_generated/component.d.ts.map +1 -0
- package/dist/component/_generated/component.js +11 -0
- package/dist/component/_generated/component.js.map +1 -0
- package/dist/component/_generated/dataModel.d.ts +46 -0
- package/dist/component/_generated/dataModel.d.ts.map +1 -0
- package/dist/component/_generated/dataModel.js +11 -0
- package/dist/component/_generated/dataModel.js.map +1 -0
- package/dist/component/_generated/server.d.ts +121 -0
- package/dist/component/_generated/server.d.ts.map +1 -0
- package/dist/component/_generated/server.js +78 -0
- package/dist/component/_generated/server.js.map +1 -0
- package/dist/component/convex.config.d.ts +3 -0
- package/dist/component/convex.config.d.ts.map +1 -0
- package/dist/component/convex.config.js +3 -0
- package/dist/component/convex.config.js.map +1 -0
- package/dist/component/lib.d.ts +17 -0
- package/dist/component/lib.d.ts.map +1 -0
- package/dist/component/lib.js +18 -0
- package/dist/component/lib.js.map +1 -0
- package/dist/component/messages.d.ts +173 -0
- package/dist/component/messages.d.ts.map +1 -0
- package/dist/component/messages.js +410 -0
- package/dist/component/messages.js.map +1 -0
- package/dist/component/reactions.d.ts +51 -0
- package/dist/component/reactions.d.ts.map +1 -0
- package/dist/component/reactions.js +191 -0
- package/dist/component/reactions.js.map +1 -0
- package/dist/component/schema.d.ts +274 -0
- package/dist/component/schema.d.ts.map +1 -0
- package/dist/component/schema.js +159 -0
- package/dist/component/schema.js.map +1 -0
- package/dist/component/threads.d.ts +110 -0
- package/dist/component/threads.d.ts.map +1 -0
- package/dist/component/threads.js +276 -0
- package/dist/component/threads.js.map +1 -0
- package/dist/component/typing.d.ts +31 -0
- package/dist/component/typing.d.ts.map +1 -0
- package/dist/component/typing.js +147 -0
- package/dist/component/typing.js.map +1 -0
- package/dist/component/zones.d.ts +63 -0
- package/dist/component/zones.d.ts.map +1 -0
- package/dist/component/zones.js +159 -0
- package/dist/component/zones.js.map +1 -0
- package/dist/react/AddComment.d.ts +57 -0
- package/dist/react/AddComment.d.ts.map +1 -0
- package/dist/react/AddComment.js +285 -0
- package/dist/react/AddComment.js.map +1 -0
- package/dist/react/Comment.d.ts +70 -0
- package/dist/react/Comment.d.ts.map +1 -0
- package/dist/react/Comment.js +259 -0
- package/dist/react/Comment.js.map +1 -0
- package/dist/react/Comments.d.ts +74 -0
- package/dist/react/Comments.d.ts.map +1 -0
- package/dist/react/Comments.js +108 -0
- package/dist/react/Comments.js.map +1 -0
- package/dist/react/CommentsProvider.d.ts +104 -0
- package/dist/react/CommentsProvider.d.ts.map +1 -0
- package/dist/react/CommentsProvider.js +98 -0
- package/dist/react/CommentsProvider.js.map +1 -0
- package/dist/react/ReactionPicker.d.ts +28 -0
- package/dist/react/ReactionPicker.d.ts.map +1 -0
- package/dist/react/ReactionPicker.js +56 -0
- package/dist/react/ReactionPicker.js.map +1 -0
- package/dist/react/Thread.d.ts +84 -0
- package/dist/react/Thread.d.ts.map +1 -0
- package/dist/react/Thread.js +124 -0
- package/dist/react/Thread.js.map +1 -0
- package/dist/react/TypingIndicator.d.ts +25 -0
- package/dist/react/TypingIndicator.d.ts.map +1 -0
- package/dist/react/TypingIndicator.js +99 -0
- package/dist/react/TypingIndicator.js.map +1 -0
- package/dist/react/index.d.ts +15 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +15 -0
- package/dist/react/index.js.map +1 -0
- package/package.json +106 -0
- package/src/client/_generated/_ignore.ts +1 -0
- package/src/client/index.ts +813 -0
- package/src/component/_generated/api.ts +60 -0
- package/src/component/_generated/component.ts +784 -0
- package/src/component/_generated/dataModel.ts +60 -0
- package/src/component/_generated/server.ts +156 -0
- package/src/component/convex.config.ts +3 -0
- package/src/component/lib.ts +57 -0
- package/src/component/messages.ts +476 -0
- package/src/component/reactions.ts +222 -0
- package/src/component/schema.ts +169 -0
- package/src/component/threads.ts +319 -0
- package/src/component/typing.ts +168 -0
- package/src/component/zones.ts +180 -0
- package/src/react/AddComment.tsx +463 -0
- package/src/react/Comment.tsx +519 -0
- package/src/react/Comments.tsx +276 -0
- package/src/react/CommentsProvider.tsx +197 -0
- package/src/react/ReactionPicker.tsx +95 -0
- package/src/react/Thread.tsx +336 -0
- package/src/react/TypingIndicator.tsx +144 -0
- package/src/react/index.ts +45 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reactions.js","sourceRoot":"","sources":["../../src/component/reactions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAEzD,+EAA+E;AAC/E,qBAAqB;AACrB,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC;IAChC,IAAI,EAAE;QACF,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC;QAC3B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;QAClB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;KACpB;IACD,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC7C,OAAO,E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AAU,CAAC;QAC3B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;KACpB;IACD,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC5B,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QACzB,MAAM,SAAS,GAAG,MAAM,GAAG,CAAC,EAAE;aACzB,KAAK,CAAC,WAAW,CAAC;aAClB,SAAS,CAAC,iBAAiB,EAAE,CAAC,CAAC,EAAE,EAAE,CAChC,CAAC,CAAC,EAAE,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAC5D;aACA,OAAO,EAAE,CAAC;QAEf,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Comments Component Schema
|
|
3
|
+
*
|
|
4
|
+
* Data model:
|
|
5
|
+
* - Zones: Container for threads, tied to an external entity (e.g., a document)
|
|
6
|
+
* - Threads: Container for messages within a zone
|
|
7
|
+
* - Messages: Individual comments with body, mentions, attachments, resolved state
|
|
8
|
+
* - Reactions: Emoji reactions on messages
|
|
9
|
+
* - TypingIndicators: Real-time typing status with auto-expiry
|
|
10
|
+
*/
|
|
11
|
+
/** Attachment metadata - URLs, file references, etc. */
|
|
12
|
+
export declare const attachmentValidator: import("convex/values").VObject<{
|
|
13
|
+
name?: string | undefined;
|
|
14
|
+
mimeType?: string | undefined;
|
|
15
|
+
size?: number | undefined;
|
|
16
|
+
url: string;
|
|
17
|
+
type: "url" | "file" | "image";
|
|
18
|
+
}, {
|
|
19
|
+
type: import("convex/values").VUnion<"url" | "file" | "image", [import("convex/values").VLiteral<"url", "required">, import("convex/values").VLiteral<"file", "required">, import("convex/values").VLiteral<"image", "required">], "required", never>;
|
|
20
|
+
url: import("convex/values").VString<string, "required">;
|
|
21
|
+
name: import("convex/values").VString<string | undefined, "optional">;
|
|
22
|
+
mimeType: import("convex/values").VString<string | undefined, "optional">;
|
|
23
|
+
size: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
24
|
+
}, "required", "url" | "type" | "name" | "mimeType" | "size">;
|
|
25
|
+
/** Mention extracted from message body */
|
|
26
|
+
export declare const mentionValidator: import("convex/values").VObject<{
|
|
27
|
+
userId: string;
|
|
28
|
+
start: number;
|
|
29
|
+
end: number;
|
|
30
|
+
}, {
|
|
31
|
+
userId: import("convex/values").VString<string, "required">;
|
|
32
|
+
/** Start position in the body text */
|
|
33
|
+
start: import("convex/values").VFloat64<number, "required">;
|
|
34
|
+
/** End position in the body text */
|
|
35
|
+
end: import("convex/values").VFloat64<number, "required">;
|
|
36
|
+
}, "required", "userId" | "start" | "end">;
|
|
37
|
+
/** Link extracted from message body */
|
|
38
|
+
export declare const linkValidator: import("convex/values").VObject<{
|
|
39
|
+
url: string;
|
|
40
|
+
start: number;
|
|
41
|
+
end: number;
|
|
42
|
+
}, {
|
|
43
|
+
url: import("convex/values").VString<string, "required">;
|
|
44
|
+
start: import("convex/values").VFloat64<number, "required">;
|
|
45
|
+
end: import("convex/values").VFloat64<number, "required">;
|
|
46
|
+
}, "required", "url" | "start" | "end">;
|
|
47
|
+
declare const _default: import("convex/server").SchemaDefinition<{
|
|
48
|
+
/**
|
|
49
|
+
* Zones - Container for threads, tied to an external entity
|
|
50
|
+
*
|
|
51
|
+
* A zone represents a commentable area (e.g., a document, a task, a post).
|
|
52
|
+
* The `entityId` is a string representation of whatever the parent app uses
|
|
53
|
+
* to identify the entity (could be a Convex ID, UUID, slug, etc.)
|
|
54
|
+
*/
|
|
55
|
+
zones: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
56
|
+
metadata?: any;
|
|
57
|
+
entityId: string;
|
|
58
|
+
createdAt: number;
|
|
59
|
+
}, {
|
|
60
|
+
/** External entity ID this zone belongs to (stored as string for flexibility) */
|
|
61
|
+
entityId: import("convex/values").VString<string, "required">;
|
|
62
|
+
/** Optional metadata about the zone */
|
|
63
|
+
metadata: import("convex/values").VAny<any, "optional", string>;
|
|
64
|
+
/** Timestamp when zone was created */
|
|
65
|
+
createdAt: import("convex/values").VFloat64<number, "required">;
|
|
66
|
+
}, "required", "metadata" | "entityId" | "createdAt" | `metadata.${string}`>, {
|
|
67
|
+
entityId: ["entityId", "_creationTime"];
|
|
68
|
+
}, {}, {}>;
|
|
69
|
+
/**
|
|
70
|
+
* Threads - Container for messages within a zone
|
|
71
|
+
*
|
|
72
|
+
* Threads group related messages together. A zone can have multiple threads.
|
|
73
|
+
*/
|
|
74
|
+
threads: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
75
|
+
metadata?: any;
|
|
76
|
+
position?: {
|
|
77
|
+
anchor?: string | undefined;
|
|
78
|
+
x: number;
|
|
79
|
+
y: number;
|
|
80
|
+
} | undefined;
|
|
81
|
+
resolvedBy?: string | undefined;
|
|
82
|
+
resolvedAt?: number | undefined;
|
|
83
|
+
zoneId: import("convex/values").GenericId<"zones">;
|
|
84
|
+
createdAt: number;
|
|
85
|
+
resolved: boolean;
|
|
86
|
+
lastActivityAt: number;
|
|
87
|
+
}, {
|
|
88
|
+
/** Zone this thread belongs to */
|
|
89
|
+
zoneId: import("convex/values").VId<import("convex/values").GenericId<"zones">, "required">;
|
|
90
|
+
/** Whether the entire thread is resolved */
|
|
91
|
+
resolved: import("convex/values").VBoolean<boolean, "required">;
|
|
92
|
+
/** User who resolved the thread (if resolved) */
|
|
93
|
+
resolvedBy: import("convex/values").VString<string | undefined, "optional">;
|
|
94
|
+
/** When the thread was resolved */
|
|
95
|
+
resolvedAt: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
96
|
+
/** Timestamp when thread was created */
|
|
97
|
+
createdAt: import("convex/values").VFloat64<number, "required">;
|
|
98
|
+
/** Timestamp of last activity (new message, reaction, etc.) */
|
|
99
|
+
lastActivityAt: import("convex/values").VFloat64<number, "required">;
|
|
100
|
+
/** Optional position data for positioned comments (e.g., x, y coordinates) */
|
|
101
|
+
position: import("convex/values").VObject<{
|
|
102
|
+
anchor?: string | undefined;
|
|
103
|
+
x: number;
|
|
104
|
+
y: number;
|
|
105
|
+
} | undefined, {
|
|
106
|
+
x: import("convex/values").VFloat64<number, "required">;
|
|
107
|
+
y: import("convex/values").VFloat64<number, "required">;
|
|
108
|
+
/** Optional anchor data (e.g., element ID, text range) */
|
|
109
|
+
anchor: import("convex/values").VString<string | undefined, "optional">;
|
|
110
|
+
}, "optional", "x" | "y" | "anchor">;
|
|
111
|
+
/** Optional metadata */
|
|
112
|
+
metadata: import("convex/values").VAny<any, "optional", string>;
|
|
113
|
+
}, "required", "metadata" | "position" | "zoneId" | "createdAt" | `metadata.${string}` | "resolved" | "resolvedBy" | "resolvedAt" | "lastActivityAt" | "position.x" | "position.y" | "position.anchor">, {
|
|
114
|
+
zoneId: ["zoneId", "_creationTime"];
|
|
115
|
+
zoneId_lastActivity: ["zoneId", "lastActivityAt", "_creationTime"];
|
|
116
|
+
zoneId_resolved: ["zoneId", "resolved", "_creationTime"];
|
|
117
|
+
}, {}, {}>;
|
|
118
|
+
/**
|
|
119
|
+
* Messages - Individual comments within a thread
|
|
120
|
+
*/
|
|
121
|
+
messages: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
122
|
+
resolved?: boolean | undefined;
|
|
123
|
+
resolvedBy?: string | undefined;
|
|
124
|
+
resolvedAt?: number | undefined;
|
|
125
|
+
editedAt?: number | undefined;
|
|
126
|
+
attachments: {
|
|
127
|
+
name?: string | undefined;
|
|
128
|
+
mimeType?: string | undefined;
|
|
129
|
+
size?: number | undefined;
|
|
130
|
+
url: string;
|
|
131
|
+
type: "url" | "file" | "image";
|
|
132
|
+
}[];
|
|
133
|
+
authorId: string;
|
|
134
|
+
body: string;
|
|
135
|
+
threadId: import("convex/values").GenericId<"threads">;
|
|
136
|
+
createdAt: number;
|
|
137
|
+
mentions: {
|
|
138
|
+
userId: string;
|
|
139
|
+
start: number;
|
|
140
|
+
end: number;
|
|
141
|
+
}[];
|
|
142
|
+
links: {
|
|
143
|
+
url: string;
|
|
144
|
+
start: number;
|
|
145
|
+
end: number;
|
|
146
|
+
}[];
|
|
147
|
+
isEdited: boolean;
|
|
148
|
+
isDeleted: boolean;
|
|
149
|
+
}, {
|
|
150
|
+
/** Thread this message belongs to */
|
|
151
|
+
threadId: import("convex/values").VId<import("convex/values").GenericId<"threads">, "required">;
|
|
152
|
+
/** User who authored this message (stored as string for flexibility) */
|
|
153
|
+
authorId: import("convex/values").VString<string, "required">;
|
|
154
|
+
/** Message body (plain text or markdown) */
|
|
155
|
+
body: import("convex/values").VString<string, "required">;
|
|
156
|
+
/** Parsed mentions from the body */
|
|
157
|
+
mentions: import("convex/values").VArray<{
|
|
158
|
+
userId: string;
|
|
159
|
+
start: number;
|
|
160
|
+
end: number;
|
|
161
|
+
}[], import("convex/values").VObject<{
|
|
162
|
+
userId: string;
|
|
163
|
+
start: number;
|
|
164
|
+
end: number;
|
|
165
|
+
}, {
|
|
166
|
+
userId: import("convex/values").VString<string, "required">;
|
|
167
|
+
/** Start position in the body text */
|
|
168
|
+
start: import("convex/values").VFloat64<number, "required">;
|
|
169
|
+
/** End position in the body text */
|
|
170
|
+
end: import("convex/values").VFloat64<number, "required">;
|
|
171
|
+
}, "required", "userId" | "start" | "end">, "required">;
|
|
172
|
+
/** Parsed links from the body */
|
|
173
|
+
links: import("convex/values").VArray<{
|
|
174
|
+
url: string;
|
|
175
|
+
start: number;
|
|
176
|
+
end: number;
|
|
177
|
+
}[], import("convex/values").VObject<{
|
|
178
|
+
url: string;
|
|
179
|
+
start: number;
|
|
180
|
+
end: number;
|
|
181
|
+
}, {
|
|
182
|
+
url: import("convex/values").VString<string, "required">;
|
|
183
|
+
start: import("convex/values").VFloat64<number, "required">;
|
|
184
|
+
end: import("convex/values").VFloat64<number, "required">;
|
|
185
|
+
}, "required", "url" | "start" | "end">, "required">;
|
|
186
|
+
/** Attachments on this message */
|
|
187
|
+
attachments: import("convex/values").VArray<{
|
|
188
|
+
name?: string | undefined;
|
|
189
|
+
mimeType?: string | undefined;
|
|
190
|
+
size?: number | undefined;
|
|
191
|
+
url: string;
|
|
192
|
+
type: "url" | "file" | "image";
|
|
193
|
+
}[], import("convex/values").VObject<{
|
|
194
|
+
name?: string | undefined;
|
|
195
|
+
mimeType?: string | undefined;
|
|
196
|
+
size?: number | undefined;
|
|
197
|
+
url: string;
|
|
198
|
+
type: "url" | "file" | "image";
|
|
199
|
+
}, {
|
|
200
|
+
type: import("convex/values").VUnion<"url" | "file" | "image", [import("convex/values").VLiteral<"url", "required">, import("convex/values").VLiteral<"file", "required">, import("convex/values").VLiteral<"image", "required">], "required", never>;
|
|
201
|
+
url: import("convex/values").VString<string, "required">;
|
|
202
|
+
name: import("convex/values").VString<string | undefined, "optional">;
|
|
203
|
+
mimeType: import("convex/values").VString<string | undefined, "optional">;
|
|
204
|
+
size: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
205
|
+
}, "required", "url" | "type" | "name" | "mimeType" | "size">, "required">;
|
|
206
|
+
/** Whether this message has been edited */
|
|
207
|
+
isEdited: import("convex/values").VBoolean<boolean, "required">;
|
|
208
|
+
/** Whether this message is deleted (soft delete) */
|
|
209
|
+
isDeleted: import("convex/values").VBoolean<boolean, "required">;
|
|
210
|
+
/** Whether this message is resolved */
|
|
211
|
+
resolved: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
212
|
+
/** User who resolved the message */
|
|
213
|
+
resolvedBy: import("convex/values").VString<string | undefined, "optional">;
|
|
214
|
+
/** When the message was resolved */
|
|
215
|
+
resolvedAt: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
216
|
+
/** Timestamp when created */
|
|
217
|
+
createdAt: import("convex/values").VFloat64<number, "required">;
|
|
218
|
+
/** Timestamp when last edited */
|
|
219
|
+
editedAt: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
220
|
+
}, "required", "attachments" | "authorId" | "body" | "threadId" | "createdAt" | "resolved" | "resolvedBy" | "resolvedAt" | "mentions" | "links" | "isEdited" | "isDeleted" | "editedAt">, {
|
|
221
|
+
threadId: ["threadId", "_creationTime"];
|
|
222
|
+
threadId_createdAt: ["threadId", "createdAt", "_creationTime"];
|
|
223
|
+
authorId: ["authorId", "_creationTime"];
|
|
224
|
+
}, {}, {}>;
|
|
225
|
+
/**
|
|
226
|
+
* Reactions - Emoji reactions on messages
|
|
227
|
+
*/
|
|
228
|
+
reactions: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
229
|
+
emoji: string;
|
|
230
|
+
messageId: import("convex/values").GenericId<"messages">;
|
|
231
|
+
userId: string;
|
|
232
|
+
createdAt: number;
|
|
233
|
+
}, {
|
|
234
|
+
/** Message this reaction is on */
|
|
235
|
+
messageId: import("convex/values").VId<import("convex/values").GenericId<"messages">, "required">;
|
|
236
|
+
/** User who reacted */
|
|
237
|
+
userId: import("convex/values").VString<string, "required">;
|
|
238
|
+
/** Emoji used (e.g., "👍", "❤️", "🎉") */
|
|
239
|
+
emoji: import("convex/values").VString<string, "required">;
|
|
240
|
+
/** When the reaction was added */
|
|
241
|
+
createdAt: import("convex/values").VFloat64<number, "required">;
|
|
242
|
+
}, "required", "emoji" | "messageId" | "userId" | "createdAt">, {
|
|
243
|
+
messageId: ["messageId", "_creationTime"];
|
|
244
|
+
messageId_emoji: ["messageId", "emoji", "_creationTime"];
|
|
245
|
+
messageId_userId: ["messageId", "userId", "_creationTime"];
|
|
246
|
+
messageId_emoji_userId: ["messageId", "emoji", "userId", "_creationTime"];
|
|
247
|
+
}, {}, {}>;
|
|
248
|
+
/**
|
|
249
|
+
* TypingIndicators - Real-time typing status
|
|
250
|
+
*
|
|
251
|
+
* These records auto-expire after a timeout (handled by scheduled function)
|
|
252
|
+
*/
|
|
253
|
+
typingIndicators: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
254
|
+
threadId: import("convex/values").GenericId<"threads">;
|
|
255
|
+
userId: string;
|
|
256
|
+
updatedAt: number;
|
|
257
|
+
expiresAt: number;
|
|
258
|
+
}, {
|
|
259
|
+
/** Thread where user is typing */
|
|
260
|
+
threadId: import("convex/values").VId<import("convex/values").GenericId<"threads">, "required">;
|
|
261
|
+
/** User who is typing */
|
|
262
|
+
userId: import("convex/values").VString<string, "required">;
|
|
263
|
+
/** When the typing indicator was last updated */
|
|
264
|
+
updatedAt: import("convex/values").VFloat64<number, "required">;
|
|
265
|
+
/** When this indicator should expire (for cleanup) */
|
|
266
|
+
expiresAt: import("convex/values").VFloat64<number, "required">;
|
|
267
|
+
}, "required", "threadId" | "userId" | "updatedAt" | "expiresAt">, {
|
|
268
|
+
threadId: ["threadId", "_creationTime"];
|
|
269
|
+
threadId_userId: ["threadId", "userId", "_creationTime"];
|
|
270
|
+
expiresAt: ["expiresAt", "_creationTime"];
|
|
271
|
+
}, {}, {}>;
|
|
272
|
+
}, true>;
|
|
273
|
+
export default _default;
|
|
274
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/component/schema.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AAMH,wDAAwD;AACxD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;6DAM9B,CAAC;AAEH,0CAA0C;AAC1C,eAAO,MAAM,gBAAgB;;;;;;IAE3B,sCAAsC;;IAEtC,oCAAoC;;0CAEpC,CAAC;AAEH,uCAAuC;AACvC,eAAO,MAAM,aAAa;;;;;;;;uCAIxB,CAAC;;IAOD;;;;;;OAMG;;;;;;QAED,iFAAiF;;QAEjF,uCAAuC;;QAEvC,sCAAsC;;;;;IAKxC;;;;OAIG;;;;;;;;;;;;;;;QAED,kCAAkC;;QAElC,4CAA4C;;QAE5C,iDAAiD;;QAEjD,mCAAmC;;QAEnC,wCAAwC;;QAExC,+DAA+D;;QAE/D,8EAA8E;;;;;;;;YAI5E,0DAA0D;;;QAG5D,wBAAwB;;;;;;;IAO1B;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAED,qCAAqC;;QAErC,wEAAwE;;QAExE,4CAA4C;;QAE5C,oCAAoC;;;;;;;;;;;YA7EtC,sCAAsC;;YAEtC,oCAAoC;;;QA6ElC,iCAAiC;;;;;;;;;;;;;;QAEjC,kCAAkC;;;;;;;;;;;;;;;;;;;;QAElC,2CAA2C;;QAE3C,oDAAoD;;QAEpD,uCAAuC;;QAEvC,oCAAoC;;QAEpC,oCAAoC;;QAEpC,6BAA6B;;QAE7B,iCAAiC;;;;;;;IAOnC;;OAEG;;;;;;;QAED,kCAAkC;;QAElC,uBAAuB;;QAEvB,0CAA0C;;QAE1C,kCAAkC;;;;;;;;IAQpC;;;;OAIG;;;;;;;QAED,kCAAkC;;QAElC,yBAAyB;;QAEzB,iDAAiD;;QAEjD,sDAAsD;;;;;;;;AAnH1D,wBAyHG"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { defineSchema, defineTable } from "convex/server";
|
|
2
|
+
import { v } from "convex/values";
|
|
3
|
+
/**
|
|
4
|
+
* Comments Component Schema
|
|
5
|
+
*
|
|
6
|
+
* Data model:
|
|
7
|
+
* - Zones: Container for threads, tied to an external entity (e.g., a document)
|
|
8
|
+
* - Threads: Container for messages within a zone
|
|
9
|
+
* - Messages: Individual comments with body, mentions, attachments, resolved state
|
|
10
|
+
* - Reactions: Emoji reactions on messages
|
|
11
|
+
* - TypingIndicators: Real-time typing status with auto-expiry
|
|
12
|
+
*/
|
|
13
|
+
// ============================================================================
|
|
14
|
+
// Validators (exported for use in function args/returns)
|
|
15
|
+
// ============================================================================
|
|
16
|
+
/** Attachment metadata - URLs, file references, etc. */
|
|
17
|
+
export const attachmentValidator = v.object({
|
|
18
|
+
type: v.union(v.literal("url"), v.literal("file"), v.literal("image")),
|
|
19
|
+
url: v.string(),
|
|
20
|
+
name: v.optional(v.string()),
|
|
21
|
+
mimeType: v.optional(v.string()),
|
|
22
|
+
size: v.optional(v.number()),
|
|
23
|
+
});
|
|
24
|
+
/** Mention extracted from message body */
|
|
25
|
+
export const mentionValidator = v.object({
|
|
26
|
+
userId: v.string(),
|
|
27
|
+
/** Start position in the body text */
|
|
28
|
+
start: v.number(),
|
|
29
|
+
/** End position in the body text */
|
|
30
|
+
end: v.number(),
|
|
31
|
+
});
|
|
32
|
+
/** Link extracted from message body */
|
|
33
|
+
export const linkValidator = v.object({
|
|
34
|
+
url: v.string(),
|
|
35
|
+
start: v.number(),
|
|
36
|
+
end: v.number(),
|
|
37
|
+
});
|
|
38
|
+
// ============================================================================
|
|
39
|
+
// Schema Definition
|
|
40
|
+
// ============================================================================
|
|
41
|
+
export default defineSchema({
|
|
42
|
+
/**
|
|
43
|
+
* Zones - Container for threads, tied to an external entity
|
|
44
|
+
*
|
|
45
|
+
* A zone represents a commentable area (e.g., a document, a task, a post).
|
|
46
|
+
* The `entityId` is a string representation of whatever the parent app uses
|
|
47
|
+
* to identify the entity (could be a Convex ID, UUID, slug, etc.)
|
|
48
|
+
*/
|
|
49
|
+
zones: defineTable({
|
|
50
|
+
/** External entity ID this zone belongs to (stored as string for flexibility) */
|
|
51
|
+
entityId: v.string(),
|
|
52
|
+
/** Optional metadata about the zone */
|
|
53
|
+
metadata: v.optional(v.any()),
|
|
54
|
+
/** Timestamp when zone was created */
|
|
55
|
+
createdAt: v.number(),
|
|
56
|
+
})
|
|
57
|
+
.index("entityId", ["entityId"]),
|
|
58
|
+
/**
|
|
59
|
+
* Threads - Container for messages within a zone
|
|
60
|
+
*
|
|
61
|
+
* Threads group related messages together. A zone can have multiple threads.
|
|
62
|
+
*/
|
|
63
|
+
threads: defineTable({
|
|
64
|
+
/** Zone this thread belongs to */
|
|
65
|
+
zoneId: v.id("zones"),
|
|
66
|
+
/** Whether the entire thread is resolved */
|
|
67
|
+
resolved: v.boolean(),
|
|
68
|
+
/** User who resolved the thread (if resolved) */
|
|
69
|
+
resolvedBy: v.optional(v.string()),
|
|
70
|
+
/** When the thread was resolved */
|
|
71
|
+
resolvedAt: v.optional(v.number()),
|
|
72
|
+
/** Timestamp when thread was created */
|
|
73
|
+
createdAt: v.number(),
|
|
74
|
+
/** Timestamp of last activity (new message, reaction, etc.) */
|
|
75
|
+
lastActivityAt: v.number(),
|
|
76
|
+
/** Optional position data for positioned comments (e.g., x, y coordinates) */
|
|
77
|
+
position: v.optional(v.object({
|
|
78
|
+
x: v.number(),
|
|
79
|
+
y: v.number(),
|
|
80
|
+
/** Optional anchor data (e.g., element ID, text range) */
|
|
81
|
+
anchor: v.optional(v.string()),
|
|
82
|
+
})),
|
|
83
|
+
/** Optional metadata */
|
|
84
|
+
metadata: v.optional(v.any()),
|
|
85
|
+
})
|
|
86
|
+
.index("zoneId", ["zoneId"])
|
|
87
|
+
.index("zoneId_lastActivity", ["zoneId", "lastActivityAt"])
|
|
88
|
+
.index("zoneId_resolved", ["zoneId", "resolved"]),
|
|
89
|
+
/**
|
|
90
|
+
* Messages - Individual comments within a thread
|
|
91
|
+
*/
|
|
92
|
+
messages: defineTable({
|
|
93
|
+
/** Thread this message belongs to */
|
|
94
|
+
threadId: v.id("threads"),
|
|
95
|
+
/** User who authored this message (stored as string for flexibility) */
|
|
96
|
+
authorId: v.string(),
|
|
97
|
+
/** Message body (plain text or markdown) */
|
|
98
|
+
body: v.string(),
|
|
99
|
+
/** Parsed mentions from the body */
|
|
100
|
+
mentions: v.array(mentionValidator),
|
|
101
|
+
/** Parsed links from the body */
|
|
102
|
+
links: v.array(linkValidator),
|
|
103
|
+
/** Attachments on this message */
|
|
104
|
+
attachments: v.array(attachmentValidator),
|
|
105
|
+
/** Whether this message has been edited */
|
|
106
|
+
isEdited: v.boolean(),
|
|
107
|
+
/** Whether this message is deleted (soft delete) */
|
|
108
|
+
isDeleted: v.boolean(),
|
|
109
|
+
/** Whether this message is resolved */
|
|
110
|
+
resolved: v.optional(v.boolean()),
|
|
111
|
+
/** User who resolved the message */
|
|
112
|
+
resolvedBy: v.optional(v.string()),
|
|
113
|
+
/** When the message was resolved */
|
|
114
|
+
resolvedAt: v.optional(v.number()),
|
|
115
|
+
/** Timestamp when created */
|
|
116
|
+
createdAt: v.number(),
|
|
117
|
+
/** Timestamp when last edited */
|
|
118
|
+
editedAt: v.optional(v.number()),
|
|
119
|
+
})
|
|
120
|
+
.index("threadId", ["threadId"])
|
|
121
|
+
.index("threadId_createdAt", ["threadId", "createdAt"])
|
|
122
|
+
.index("authorId", ["authorId"]),
|
|
123
|
+
/**
|
|
124
|
+
* Reactions - Emoji reactions on messages
|
|
125
|
+
*/
|
|
126
|
+
reactions: defineTable({
|
|
127
|
+
/** Message this reaction is on */
|
|
128
|
+
messageId: v.id("messages"),
|
|
129
|
+
/** User who reacted */
|
|
130
|
+
userId: v.string(),
|
|
131
|
+
/** Emoji used (e.g., "👍", "❤️", "🎉") */
|
|
132
|
+
emoji: v.string(),
|
|
133
|
+
/** When the reaction was added */
|
|
134
|
+
createdAt: v.number(),
|
|
135
|
+
})
|
|
136
|
+
.index("messageId", ["messageId"])
|
|
137
|
+
.index("messageId_emoji", ["messageId", "emoji"])
|
|
138
|
+
.index("messageId_userId", ["messageId", "userId"])
|
|
139
|
+
.index("messageId_emoji_userId", ["messageId", "emoji", "userId"]),
|
|
140
|
+
/**
|
|
141
|
+
* TypingIndicators - Real-time typing status
|
|
142
|
+
*
|
|
143
|
+
* These records auto-expire after a timeout (handled by scheduled function)
|
|
144
|
+
*/
|
|
145
|
+
typingIndicators: defineTable({
|
|
146
|
+
/** Thread where user is typing */
|
|
147
|
+
threadId: v.id("threads"),
|
|
148
|
+
/** User who is typing */
|
|
149
|
+
userId: v.string(),
|
|
150
|
+
/** When the typing indicator was last updated */
|
|
151
|
+
updatedAt: v.number(),
|
|
152
|
+
/** When this indicator should expire (for cleanup) */
|
|
153
|
+
expiresAt: v.number(),
|
|
154
|
+
})
|
|
155
|
+
.index("threadId", ["threadId"])
|
|
156
|
+
.index("threadId_userId", ["threadId", "userId"])
|
|
157
|
+
.index("expiresAt", ["expiresAt"]),
|
|
158
|
+
});
|
|
159
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/component/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAElC;;;;;;;;;GASG;AAEH,+EAA+E;AAC/E,yDAAyD;AACzD,+EAA+E;AAE/E,wDAAwD;AACxD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACtE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC5B,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAChC,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAC7B,CAAC,CAAC;AAEH,0CAA0C;AAC1C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,sCAAsC;IACtC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,oCAAoC;IACpC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;CAChB,CAAC,CAAC;AAEH,uCAAuC;AACvC,MAAM,C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;SAC/B,KAAK,CAAC,iBAAiB,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;SAChD,KAAK,CAAC,WAAW,EAAE,CAAC,WAAW,CAAC,CAAC;CACrC,CAAC,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a new thread in a zone.
|
|
3
|
+
*/
|
|
4
|
+
export declare const addThread: import("convex/server").RegisteredMutation<"public", {
|
|
5
|
+
metadata?: any;
|
|
6
|
+
position?: {
|
|
7
|
+
anchor?: string | undefined;
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
} | undefined;
|
|
11
|
+
zoneId: import("convex/values").GenericId<"zones">;
|
|
12
|
+
}, Promise<import("convex/values").GenericId<"threads">>>;
|
|
13
|
+
/**
|
|
14
|
+
* Get a thread by ID.
|
|
15
|
+
*/
|
|
16
|
+
export declare const getThread: import("convex/server").RegisteredQuery<"public", {
|
|
17
|
+
threadId: import("convex/values").GenericId<"threads">;
|
|
18
|
+
}, Promise<{
|
|
19
|
+
_id: import("convex/values").GenericId<"threads">;
|
|
20
|
+
_creationTime: number;
|
|
21
|
+
metadata?: any;
|
|
22
|
+
position?: {
|
|
23
|
+
anchor?: string | undefined;
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
} | undefined;
|
|
27
|
+
resolvedBy?: string | undefined;
|
|
28
|
+
resolvedAt?: number | undefined;
|
|
29
|
+
zoneId: import("convex/values").GenericId<"zones">;
|
|
30
|
+
createdAt: number;
|
|
31
|
+
resolved: boolean;
|
|
32
|
+
lastActivityAt: number;
|
|
33
|
+
} | null>>;
|
|
34
|
+
/**
|
|
35
|
+
* Get all threads in a zone with optional pagination and filtering.
|
|
36
|
+
*/
|
|
37
|
+
export declare const getThreads: import("convex/server").RegisteredQuery<"public", {
|
|
38
|
+
cursor?: string | undefined;
|
|
39
|
+
limit?: number | undefined;
|
|
40
|
+
includeResolved?: boolean | undefined;
|
|
41
|
+
zoneId: import("convex/values").GenericId<"zones">;
|
|
42
|
+
}, Promise<{
|
|
43
|
+
threads: {
|
|
44
|
+
thread: {
|
|
45
|
+
_id: import("convex/values").GenericId<"threads">;
|
|
46
|
+
_creationTime: number;
|
|
47
|
+
metadata?: any;
|
|
48
|
+
position?: {
|
|
49
|
+
anchor?: string | undefined;
|
|
50
|
+
x: number;
|
|
51
|
+
y: number;
|
|
52
|
+
} | undefined;
|
|
53
|
+
resolvedBy?: string | undefined;
|
|
54
|
+
resolvedAt?: number | undefined;
|
|
55
|
+
zoneId: import("convex/values").GenericId<"zones">;
|
|
56
|
+
createdAt: number;
|
|
57
|
+
resolved: boolean;
|
|
58
|
+
lastActivityAt: number;
|
|
59
|
+
};
|
|
60
|
+
firstMessage: {
|
|
61
|
+
_id: import("convex/values").GenericId<"messages">;
|
|
62
|
+
body: string;
|
|
63
|
+
authorId: string;
|
|
64
|
+
createdAt: number;
|
|
65
|
+
} | null;
|
|
66
|
+
messageCount: number;
|
|
67
|
+
}[];
|
|
68
|
+
nextCursor: string | undefined;
|
|
69
|
+
hasMore: boolean;
|
|
70
|
+
}>>;
|
|
71
|
+
/**
|
|
72
|
+
* Resolve a thread.
|
|
73
|
+
*/
|
|
74
|
+
export declare const resolveThread: import("convex/server").RegisteredMutation<"public", {
|
|
75
|
+
threadId: import("convex/values").GenericId<"threads">;
|
|
76
|
+
userId: string;
|
|
77
|
+
}, Promise<null>>;
|
|
78
|
+
/**
|
|
79
|
+
* Unresolve a thread.
|
|
80
|
+
*/
|
|
81
|
+
export declare const unresolveThread: import("convex/server").RegisteredMutation<"public", {
|
|
82
|
+
threadId: import("convex/values").GenericId<"threads">;
|
|
83
|
+
}, Promise<null>>;
|
|
84
|
+
/**
|
|
85
|
+
* Update thread position (for positioned comments).
|
|
86
|
+
*/
|
|
87
|
+
export declare const updateThreadPosition: import("convex/server").RegisteredMutation<"public", {
|
|
88
|
+
position?: {
|
|
89
|
+
anchor?: string | undefined;
|
|
90
|
+
x: number;
|
|
91
|
+
y: number;
|
|
92
|
+
} | undefined;
|
|
93
|
+
threadId: import("convex/values").GenericId<"threads">;
|
|
94
|
+
}, Promise<null>>;
|
|
95
|
+
/**
|
|
96
|
+
* Delete a thread and all its messages.
|
|
97
|
+
*/
|
|
98
|
+
export declare const deleteThread: import("convex/server").RegisteredMutation<"public", {
|
|
99
|
+
threadId: import("convex/values").GenericId<"threads">;
|
|
100
|
+
}, Promise<{
|
|
101
|
+
deletedMessages: number;
|
|
102
|
+
deletedReactions: number;
|
|
103
|
+
}>>;
|
|
104
|
+
/**
|
|
105
|
+
* Internal function to update thread's lastActivityAt.
|
|
106
|
+
*/
|
|
107
|
+
export declare const updateThreadActivity: import("convex/server").RegisteredMutation<"public", {
|
|
108
|
+
threadId: import("convex/values").GenericId<"threads">;
|
|
109
|
+
}, Promise<null>>;
|
|
110
|
+
//# sourceMappingURL=threads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"threads.d.ts","sourceRoot":"","sources":["../../src/component/threads.ts"],"names":[],"mappings":"AA2CA;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;yDA0BpB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;UAQpB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2FrB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,aAAa;;;iBAoBxB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe;;iBAmB1B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;;iBAY/B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;GAkDvB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,oBAAoB;;iBAW/B,CAAC"}
|