@hamzasaleemorg/convex-comments 1.0.0 → 1.0.1
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 +10 -0
- package/README.md +4 -0
- package/dist/client/index.d.ts +153 -37
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +153 -42
- package/dist/client/index.js.map +1 -1
- package/package.json +4 -1
- package/src/client/index.ts +153 -42
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.0.1] - 2026-01-31
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- Replaced `@your-org/comments` placeholders in JSDoc examples with the correct package name `@hamzasaleemorg/convex-comments`.
|
|
9
|
+
|
|
10
|
+
### Documentation
|
|
11
|
+
- Significant enrichment of JSDoc comments for the entire client library.
|
|
12
|
+
- Added detailed usage context, best practices, and permission reminders to all public methods.
|
|
13
|
+
- Expanded code examples for `Comments` class, `exposeApi`, and `registerRoutes`.
|
|
14
|
+
|
|
5
15
|
## [1.0.0] - 2026-01-31
|
|
6
16
|
|
|
7
17
|
### Added
|
package/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Convex Comments Component
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@hamzasaleemorg/convex-comments)
|
|
4
|
+
[](https://www.npmjs.com/package/@hamzasaleemorg/convex-comments)
|
|
5
|
+
[](https://www.npmjs.com/package/@hamzasaleemorg/convex-comments)
|
|
6
|
+
|
|
3
7
|
A comments system for Convex with threads, mentions, reactions, and typing indicators. Includes backend functions and optional React UI components.
|
|
4
8
|
|
|
5
9
|
## Installation
|
package/dist/client/index.d.ts
CHANGED
|
@@ -69,10 +69,15 @@ interface MentionCallbacks {
|
|
|
69
69
|
*
|
|
70
70
|
* Usage:
|
|
71
71
|
* ```ts
|
|
72
|
-
* import { Comments } from "@
|
|
72
|
+
* import { Comments } from "@hamzasaleemorg/convex-comments";
|
|
73
73
|
* import { components } from "./_generated/api";
|
|
74
74
|
*
|
|
75
|
-
* const comments = new Comments(components.comments
|
|
75
|
+
* const comments = new Comments(components.comments, {
|
|
76
|
+
* onMention: async ({ mentionedUserId, authorId, body }) => {
|
|
77
|
+
* // Send email or push notification to the mentioned user
|
|
78
|
+
* console.log(`${authorId} mentioned ${mentionedUserId}: ${body}`);
|
|
79
|
+
* }
|
|
80
|
+
* });
|
|
76
81
|
*
|
|
77
82
|
* // In a mutation/query handler:
|
|
78
83
|
* const zoneId = await comments.getOrCreateZone(ctx, { entityId: "doc_123" });
|
|
@@ -84,14 +89,31 @@ export declare class Comments {
|
|
|
84
89
|
private readonly callbacks?;
|
|
85
90
|
constructor(component: ComponentApi, callbacks?: MentionCallbacks | undefined);
|
|
86
91
|
/**
|
|
87
|
-
* Get or create a
|
|
92
|
+
* Get or create a "Zone" for a specific entity.
|
|
93
|
+
*
|
|
94
|
+
* A Zone is the top-level container for all threads and messages related to a specific
|
|
95
|
+
* resource in your app (e.g., a specific document ID, a task ID, or a project page).
|
|
96
|
+
*
|
|
97
|
+
* This method uses a "get or create" pattern, making it ideal for lazy-initializing
|
|
98
|
+
* the comment system for an entity the first time a user interacts with it.
|
|
99
|
+
*
|
|
100
|
+
* @param ctx - The mutation context (requires runMutation)
|
|
101
|
+
* @param args.entityId - A unique string identifying your resource (e.g., "doc_123")
|
|
102
|
+
* @param args.metadata - Optional arbitrary data to store with the zone
|
|
103
|
+
* @returns The unique ID of the zone
|
|
88
104
|
*/
|
|
89
105
|
getOrCreateZone(ctx: MutationCtx, args: {
|
|
90
106
|
entityId: string;
|
|
91
107
|
metadata?: unknown;
|
|
92
108
|
}): Promise<string>;
|
|
93
109
|
/**
|
|
94
|
-
*
|
|
110
|
+
* Retrieves an existing zone by its entity ID.
|
|
111
|
+
*
|
|
112
|
+
* Unlike `getOrCreateZone`, this will return `null` if the zone doesn't exist yet.
|
|
113
|
+
* Use this when you want to check if an entity has any comments without creating a container.
|
|
114
|
+
*
|
|
115
|
+
* @param ctx - The query context
|
|
116
|
+
* @param args.entityId - The unique resource identifier
|
|
95
117
|
*/
|
|
96
118
|
getZone(ctx: QueryCtx, args: {
|
|
97
119
|
entityId: string;
|
|
@@ -103,7 +125,10 @@ export declare class Comments {
|
|
|
103
125
|
metadata?: any;
|
|
104
126
|
} | null>;
|
|
105
127
|
/**
|
|
106
|
-
*
|
|
128
|
+
* Retrieves a zone by its internal Convex ID.
|
|
129
|
+
*
|
|
130
|
+
* Useful when you already have a `zoneId` (e.g., from a thread reference) and
|
|
131
|
+
* need to fetch its associated metadata or entity identifier.
|
|
107
132
|
*/
|
|
108
133
|
getZoneById(ctx: QueryCtx, args: {
|
|
109
134
|
zoneId: string;
|
|
@@ -115,7 +140,10 @@ export declare class Comments {
|
|
|
115
140
|
metadata?: any;
|
|
116
141
|
} | null>;
|
|
117
142
|
/**
|
|
118
|
-
*
|
|
143
|
+
* Permanently deletes a zone and every thread, message, and reaction within it.
|
|
144
|
+
*
|
|
145
|
+
* This is a destructive operation often used when the parent resource
|
|
146
|
+
* (e.g., a document) is being deleted from your system.
|
|
119
147
|
*/
|
|
120
148
|
deleteZone(ctx: MutationCtx, args: {
|
|
121
149
|
zoneId: string;
|
|
@@ -125,7 +153,14 @@ export declare class Comments {
|
|
|
125
153
|
deletedThreads: number;
|
|
126
154
|
}>;
|
|
127
155
|
/**
|
|
128
|
-
*
|
|
156
|
+
* Creates a new conversation thread within a specific zone.
|
|
157
|
+
*
|
|
158
|
+
* Threads act as a grouping for related messages. They support "positioned"
|
|
159
|
+
* comments (e.g., pins on a PDF or coordinates on a canvas) via the `position` argument.
|
|
160
|
+
*
|
|
161
|
+
* @param args.zoneId - The ID of the zone to contain this thread
|
|
162
|
+
* @param args.position - Optional coordinates {x, y} and an anchor point for UI placement
|
|
163
|
+
* @param args.metadata - Optional data (e.g., the specific version of a document)
|
|
129
164
|
*/
|
|
130
165
|
addThread(ctx: MutationCtx, args: {
|
|
131
166
|
zoneId: string;
|
|
@@ -137,7 +172,7 @@ export declare class Comments {
|
|
|
137
172
|
metadata?: unknown;
|
|
138
173
|
}): Promise<string>;
|
|
139
174
|
/**
|
|
140
|
-
*
|
|
175
|
+
* Retrieves full details for a specific thread, including its position and resolution status.
|
|
141
176
|
*/
|
|
142
177
|
getThread(ctx: QueryCtx, args: {
|
|
143
178
|
threadId: string;
|
|
@@ -158,7 +193,12 @@ export declare class Comments {
|
|
|
158
193
|
zoneId: string;
|
|
159
194
|
} | null>;
|
|
160
195
|
/**
|
|
161
|
-
*
|
|
196
|
+
* Lists threads within a zone, typically used for a "Sidebar" or "Activity" view.
|
|
197
|
+
*
|
|
198
|
+
* Supports pagination and filtering by resolution status.
|
|
199
|
+
*
|
|
200
|
+
* @param args.includeResolved - If true, returns both open and resolved threads. Defaults to false.
|
|
201
|
+
* @param args.limit - Maximum number of threads to return in one page.
|
|
162
202
|
*/
|
|
163
203
|
getThreads(ctx: QueryCtx, args: {
|
|
164
204
|
zoneId: string;
|
|
@@ -195,20 +235,26 @@ export declare class Comments {
|
|
|
195
235
|
}>;
|
|
196
236
|
}>;
|
|
197
237
|
/**
|
|
198
|
-
*
|
|
238
|
+
* Marks a thread as resolved.
|
|
239
|
+
*
|
|
240
|
+
* Resolved threads are effectively "closed" and are hidden from the default `getThreads` view.
|
|
241
|
+
*
|
|
242
|
+
* @param args.userId - The ID of the user who resolved the thread.
|
|
199
243
|
*/
|
|
200
244
|
resolveThread(ctx: MutationCtx, args: {
|
|
201
245
|
threadId: string;
|
|
202
246
|
userId: string;
|
|
203
247
|
}): Promise<null>;
|
|
204
248
|
/**
|
|
205
|
-
*
|
|
249
|
+
* Re-opens a previously resolved thread.
|
|
206
250
|
*/
|
|
207
251
|
unresolveThread(ctx: MutationCtx, args: {
|
|
208
252
|
threadId: string;
|
|
209
253
|
}): Promise<null>;
|
|
210
254
|
/**
|
|
211
|
-
*
|
|
255
|
+
* Updates the visual position of a thread.
|
|
256
|
+
*
|
|
257
|
+
* Useful for "draggable" comment pins or when the underlying content changes layout.
|
|
212
258
|
*/
|
|
213
259
|
updateThreadPosition(ctx: MutationCtx, args: {
|
|
214
260
|
threadId: string;
|
|
@@ -219,7 +265,7 @@ export declare class Comments {
|
|
|
219
265
|
};
|
|
220
266
|
}): Promise<null>;
|
|
221
267
|
/**
|
|
222
|
-
*
|
|
268
|
+
* Permanently deletes a thread and all its messages.
|
|
223
269
|
*/
|
|
224
270
|
deleteThread(ctx: MutationCtx, args: {
|
|
225
271
|
threadId: string;
|
|
@@ -228,8 +274,16 @@ export declare class Comments {
|
|
|
228
274
|
deletedReactions: number;
|
|
229
275
|
}>;
|
|
230
276
|
/**
|
|
231
|
-
*
|
|
232
|
-
*
|
|
277
|
+
* Adds a new comment (message) to a thread.
|
|
278
|
+
*
|
|
279
|
+
* This method automatically parses the body for `@user` mentions and URLs.
|
|
280
|
+
* If the `Comments` client was initialized with callbacks, `onNewMessage` and
|
|
281
|
+
* `onMention` will be triggered automatically.
|
|
282
|
+
*
|
|
283
|
+
* @param args.authorId - The ID of the user sending the comment
|
|
284
|
+
* @param args.body - The text content (supports markdown)
|
|
285
|
+
* @param args.attachments - Optional array of file/url attachments
|
|
286
|
+
* @returns The generated message ID and the list of detected mentions/links
|
|
233
287
|
*/
|
|
234
288
|
addComment(ctx: MutationCtx, args: {
|
|
235
289
|
threadId: string;
|
|
@@ -250,7 +304,10 @@ export declare class Comments {
|
|
|
250
304
|
messageId: string;
|
|
251
305
|
}>;
|
|
252
306
|
/**
|
|
253
|
-
*
|
|
307
|
+
* Fetches a specific message, including its reaction and resolution status.
|
|
308
|
+
*
|
|
309
|
+
* @param args.currentUserId - Optional. If provided, the response will include
|
|
310
|
+
* `includesMe` flags for reactions.
|
|
254
311
|
*/
|
|
255
312
|
getMessage(ctx: QueryCtx, args: {
|
|
256
313
|
messageId: string;
|
|
@@ -295,7 +352,12 @@ export declare class Comments {
|
|
|
295
352
|
}>;
|
|
296
353
|
} | null>;
|
|
297
354
|
/**
|
|
298
|
-
*
|
|
355
|
+
* Retrieves a paginated list of messages for a thread.
|
|
356
|
+
*
|
|
357
|
+
* Typically used to populate the main comment list for a conversation.
|
|
358
|
+
*
|
|
359
|
+
* @param args.order - "asc" for chronological (chat style) or "desc" for newest first.
|
|
360
|
+
* @param args.includeDeleted - If true, includes placeholders for deleted messages.
|
|
299
361
|
*/
|
|
300
362
|
getMessages(ctx: QueryCtx, args: {
|
|
301
363
|
threadId: string;
|
|
@@ -348,7 +410,9 @@ export declare class Comments {
|
|
|
348
410
|
nextCursor?: string;
|
|
349
411
|
}>;
|
|
350
412
|
/**
|
|
351
|
-
*
|
|
413
|
+
* Edits the content of an existing message.
|
|
414
|
+
*
|
|
415
|
+
* The message will be marked as `isEdited: true`.
|
|
352
416
|
*/
|
|
353
417
|
editMessage(ctx: MutationCtx, args: {
|
|
354
418
|
messageId: string;
|
|
@@ -367,14 +431,16 @@ export declare class Comments {
|
|
|
367
431
|
}>;
|
|
368
432
|
}>;
|
|
369
433
|
/**
|
|
370
|
-
* Soft
|
|
434
|
+
* Soft-deletes a message.
|
|
435
|
+
*
|
|
436
|
+
* The message record remains but its `body` is cleared and `isDeleted` is set to true.
|
|
371
437
|
*/
|
|
372
438
|
deleteMessage(ctx: MutationCtx, args: {
|
|
373
439
|
messageId: string;
|
|
374
440
|
authorId?: string;
|
|
375
441
|
}): Promise<null>;
|
|
376
442
|
/**
|
|
377
|
-
*
|
|
443
|
+
* Adds an emoji reaction to a message for a specific user.
|
|
378
444
|
*/
|
|
379
445
|
addReaction(ctx: MutationCtx, args: {
|
|
380
446
|
messageId: string;
|
|
@@ -382,7 +448,7 @@ export declare class Comments {
|
|
|
382
448
|
emoji: string;
|
|
383
449
|
}): Promise<string | null>;
|
|
384
450
|
/**
|
|
385
|
-
*
|
|
451
|
+
* Removes an emoji reaction from a message.
|
|
386
452
|
*/
|
|
387
453
|
removeReaction(ctx: MutationCtx, args: {
|
|
388
454
|
messageId: string;
|
|
@@ -390,7 +456,8 @@ export declare class Comments {
|
|
|
390
456
|
emoji: string;
|
|
391
457
|
}): Promise<boolean>;
|
|
392
458
|
/**
|
|
393
|
-
*
|
|
459
|
+
* Toggles a reaction. If the user already reacted with this emoji,
|
|
460
|
+
* it removes it; otherwise, it adds it.
|
|
394
461
|
*/
|
|
395
462
|
toggleReaction(ctx: MutationCtx, args: {
|
|
396
463
|
messageId: string;
|
|
@@ -401,7 +468,7 @@ export declare class Comments {
|
|
|
401
468
|
reactionId?: string;
|
|
402
469
|
}>;
|
|
403
470
|
/**
|
|
404
|
-
*
|
|
471
|
+
* Retrieves a summary of all reactions for a message.
|
|
405
472
|
*/
|
|
406
473
|
getReactions(ctx: QueryCtx, args: {
|
|
407
474
|
messageId: string;
|
|
@@ -413,7 +480,17 @@ export declare class Comments {
|
|
|
413
480
|
users: Array<string>;
|
|
414
481
|
}[]>;
|
|
415
482
|
/**
|
|
416
|
-
*
|
|
483
|
+
* Updates the "isTyping" status for a user in a specific thread.
|
|
484
|
+
*
|
|
485
|
+
* This is used to drive real-time typing indicators in your UI. The typing status
|
|
486
|
+
* automatically expires after a short period (typically 5-10 seconds of inactivity).
|
|
487
|
+
*
|
|
488
|
+
* For the best user experience, call this whenever the user types a character
|
|
489
|
+
* (debounced) or when the input field loses focus.
|
|
490
|
+
*
|
|
491
|
+
* @param args.threadId - Internal ID of the thread
|
|
492
|
+
* @param args.userId - The ID of the user who is typing
|
|
493
|
+
* @param args.isTyping - true to show as typing, false to immediately clear
|
|
417
494
|
*/
|
|
418
495
|
setIsTyping(ctx: MutationCtx, args: {
|
|
419
496
|
threadId: string;
|
|
@@ -421,7 +498,12 @@ export declare class Comments {
|
|
|
421
498
|
isTyping: boolean;
|
|
422
499
|
}): Promise<null>;
|
|
423
500
|
/**
|
|
424
|
-
*
|
|
501
|
+
* Returns a list of user IDs currently typing in a thread.
|
|
502
|
+
*
|
|
503
|
+
* Use this in a reactive query to show "User A, User B are typing..." in your UI.
|
|
504
|
+
*
|
|
505
|
+
* @param args.excludeUserId - Optional. Exclude the current user from the list to avoid
|
|
506
|
+
* showing an "I am typing" indicator to yourself.
|
|
425
507
|
*/
|
|
426
508
|
getTypingUsers(ctx: QueryCtx, args: {
|
|
427
509
|
threadId: string;
|
|
@@ -431,20 +513,29 @@ export declare class Comments {
|
|
|
431
513
|
userId: string;
|
|
432
514
|
}[]>;
|
|
433
515
|
/**
|
|
434
|
-
*
|
|
516
|
+
* Immediately clears all typing indicators for a specific user across all threads.
|
|
517
|
+
*
|
|
518
|
+
* Useful to call when a user logs out or closes their browser tab to ensure
|
|
519
|
+
* typing indicators don't linger for the timeout duration.
|
|
435
520
|
*/
|
|
436
521
|
clearUserTyping(ctx: MutationCtx, args: {
|
|
437
522
|
userId: string;
|
|
438
523
|
}): Promise<number>;
|
|
439
524
|
/**
|
|
440
|
-
*
|
|
525
|
+
* Resolves an individual message.
|
|
526
|
+
*
|
|
527
|
+
* While `resolveThread` marks an entire conversation as closed, `resolveMessage`
|
|
528
|
+
* is useful for "task-style" comments where each message might represent a
|
|
529
|
+
* specific action item that can be checked off.
|
|
530
|
+
*
|
|
531
|
+
* @param args.userId - The ID of the user who resolved the message.
|
|
441
532
|
*/
|
|
442
533
|
resolveMessage(ctx: MutationCtx, args: {
|
|
443
534
|
messageId: string;
|
|
444
535
|
userId: string;
|
|
445
536
|
}): Promise<null>;
|
|
446
537
|
/**
|
|
447
|
-
*
|
|
538
|
+
* Re-opens a previously resolved message.
|
|
448
539
|
*/
|
|
449
540
|
unresolveMessage(ctx: MutationCtx, args: {
|
|
450
541
|
messageId: string;
|
|
@@ -459,19 +550,24 @@ export declare class Comments {
|
|
|
459
550
|
* Usage:
|
|
460
551
|
* ```ts
|
|
461
552
|
* // In convex/comments.ts
|
|
462
|
-
* import { exposeApi } from "@
|
|
553
|
+
* import { exposeApi } from "@hamzasaleemorg/convex-comments";
|
|
463
554
|
* import { components } from "./_generated/api";
|
|
464
555
|
*
|
|
465
|
-
* export const { getThreads, addComment, toggleReaction } = exposeApi(
|
|
556
|
+
* export const { getThreads, addComment, toggleReaction, setIsTyping } = exposeApi(
|
|
466
557
|
* components.comments,
|
|
467
558
|
* {
|
|
468
559
|
* auth: async (ctx, operation) => {
|
|
469
|
-
* const
|
|
470
|
-
* if (!
|
|
560
|
+
* const identity = await ctx.auth.getUserIdentity();
|
|
561
|
+
* if (!identity && operation.type !== "read") {
|
|
471
562
|
* throw new Error("Authentication required");
|
|
472
563
|
* }
|
|
473
|
-
* return
|
|
564
|
+
* return identity?.subject ?? "anonymous";
|
|
474
565
|
* },
|
|
566
|
+
* callbacks: {
|
|
567
|
+
* onMention: async ({ mentionedUserId }) => {
|
|
568
|
+
* // Handle notification logic here
|
|
569
|
+
* }
|
|
570
|
+
* }
|
|
475
571
|
* }
|
|
476
572
|
* );
|
|
477
573
|
* ```
|
|
@@ -482,10 +578,12 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
482
578
|
/** Optional notification callbacks */
|
|
483
579
|
callbacks?: MentionCallbacks;
|
|
484
580
|
}): {
|
|
581
|
+
/** Initialize or fetch a zone for an entity. Access: create/admin. */
|
|
485
582
|
getOrCreateZone: import("convex/server").RegisteredMutation<"public", {
|
|
486
583
|
metadata?: any;
|
|
487
584
|
entityId: string;
|
|
488
585
|
}, Promise<string>>;
|
|
586
|
+
/** Get zone by entity ID. Access: read. */
|
|
489
587
|
getZone: import("convex/server").RegisteredQuery<"public", {
|
|
490
588
|
entityId: string;
|
|
491
589
|
}, Promise<{
|
|
@@ -495,6 +593,7 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
495
593
|
entityId: string;
|
|
496
594
|
metadata?: any;
|
|
497
595
|
} | null>>;
|
|
596
|
+
/** Start a new thread. Access: create/write. */
|
|
498
597
|
addThread: import("convex/server").RegisteredMutation<"public", {
|
|
499
598
|
metadata?: any;
|
|
500
599
|
position?: {
|
|
@@ -504,6 +603,7 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
504
603
|
} | undefined;
|
|
505
604
|
zoneId: string;
|
|
506
605
|
}, Promise<string>>;
|
|
606
|
+
/** Fetch single thread details. Access: read. */
|
|
507
607
|
getThread: import("convex/server").RegisteredQuery<"public", {
|
|
508
608
|
threadId: string;
|
|
509
609
|
}, Promise<{
|
|
@@ -522,6 +622,7 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
522
622
|
resolvedBy?: string;
|
|
523
623
|
zoneId: string;
|
|
524
624
|
} | null>>;
|
|
625
|
+
/** List threads in a zone. Access: read. */
|
|
525
626
|
getThreads: import("convex/server").RegisteredQuery<"public", {
|
|
526
627
|
cursor?: string | undefined;
|
|
527
628
|
limit?: number | undefined;
|
|
@@ -556,12 +657,15 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
556
657
|
};
|
|
557
658
|
}>;
|
|
558
659
|
}>>;
|
|
660
|
+
/** Close a thread. Access: update/owner. */
|
|
559
661
|
resolveThread: import("convex/server").RegisteredMutation<"public", {
|
|
560
662
|
threadId: string;
|
|
561
663
|
}, Promise<null>>;
|
|
664
|
+
/** Re-open a thread. Access: update/owner. */
|
|
562
665
|
unresolveThread: import("convex/server").RegisteredMutation<"public", {
|
|
563
666
|
threadId: string;
|
|
564
667
|
}, Promise<null>>;
|
|
668
|
+
/** Post a new comment. Access: write. Mentions are parsed automatically. */
|
|
565
669
|
addComment: import("convex/server").RegisteredMutation<"public", {
|
|
566
670
|
attachments?: {
|
|
567
671
|
name?: string | undefined;
|
|
@@ -585,6 +689,7 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
585
689
|
}>;
|
|
586
690
|
messageId: string;
|
|
587
691
|
}>>;
|
|
692
|
+
/** Fetch single message. Access: read. */
|
|
588
693
|
getMessage: import("convex/server").RegisteredQuery<"public", {
|
|
589
694
|
messageId: string;
|
|
590
695
|
}, Promise<{
|
|
@@ -626,6 +731,7 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
626
731
|
users: Array<string>;
|
|
627
732
|
}>;
|
|
628
733
|
} | null>>;
|
|
734
|
+
/** Fetch conversation history. Access: read. */
|
|
629
735
|
getMessages: import("convex/server").RegisteredQuery<"public", {
|
|
630
736
|
cursor?: string | undefined;
|
|
631
737
|
includeDeleted?: boolean | undefined;
|
|
@@ -675,6 +781,7 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
675
781
|
}>;
|
|
676
782
|
nextCursor?: string;
|
|
677
783
|
}>>;
|
|
784
|
+
/** Update message content. Access: update/owner. */
|
|
678
785
|
editMessage: import("convex/server").RegisteredMutation<"public", {
|
|
679
786
|
body: string;
|
|
680
787
|
messageId: string;
|
|
@@ -690,9 +797,11 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
690
797
|
userId: string;
|
|
691
798
|
}>;
|
|
692
799
|
}>>;
|
|
800
|
+
/** Soft-delete message. Access: delete/owner. */
|
|
693
801
|
deleteMessage: import("convex/server").RegisteredMutation<"public", {
|
|
694
802
|
messageId: string;
|
|
695
803
|
}, Promise<null>>;
|
|
804
|
+
/** Add/remove reaction. Access: react. */
|
|
696
805
|
toggleReaction: import("convex/server").RegisteredMutation<"public", {
|
|
697
806
|
emoji: string;
|
|
698
807
|
messageId: string;
|
|
@@ -700,6 +809,7 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
700
809
|
added: boolean;
|
|
701
810
|
reactionId?: string;
|
|
702
811
|
}>>;
|
|
812
|
+
/** List reactions for message. Access: read. */
|
|
703
813
|
getReactions: import("convex/server").RegisteredQuery<"public", {
|
|
704
814
|
messageId: string;
|
|
705
815
|
}, Promise<{
|
|
@@ -708,10 +818,12 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
708
818
|
includesMe: boolean;
|
|
709
819
|
users: Array<string>;
|
|
710
820
|
}[]>>;
|
|
821
|
+
/** Signal typing intent. Access: write. Indicators expire automatically. */
|
|
711
822
|
setIsTyping: import("convex/server").RegisteredMutation<"public", {
|
|
712
823
|
threadId: string;
|
|
713
824
|
isTyping: boolean;
|
|
714
825
|
}, Promise<null>>;
|
|
826
|
+
/** List current typists. Access: read. */
|
|
715
827
|
getTypingUsers: import("convex/server").RegisteredQuery<"public", {
|
|
716
828
|
threadId: string;
|
|
717
829
|
}, Promise<{
|
|
@@ -723,18 +835,22 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
723
835
|
* Register HTTP routes for the Comments component.
|
|
724
836
|
*
|
|
725
837
|
* Provides REST-like endpoints for the comments API:
|
|
726
|
-
* - GET /comments/zones
|
|
727
|
-
* - GET /comments/threads
|
|
728
|
-
* - GET /comments/messages
|
|
838
|
+
* - GET /comments/zones?entityId=...
|
|
839
|
+
* - GET /comments/threads?zoneId=...
|
|
840
|
+
* - GET /comments/messages?threadId=...
|
|
729
841
|
*
|
|
730
842
|
* Usage:
|
|
731
843
|
* ```ts
|
|
732
844
|
* // In convex/http.ts
|
|
733
|
-
* import {
|
|
845
|
+
* import { httpRouter } from "convex/server";
|
|
846
|
+
* import { registerRoutes } from "@hamzasaleemorg/convex-comments";
|
|
734
847
|
* import { components } from "./_generated/api";
|
|
735
848
|
*
|
|
736
849
|
* const http = httpRouter();
|
|
850
|
+
*
|
|
851
|
+
* // Mount the comments API at /api/comments/*
|
|
737
852
|
* registerRoutes(http, components.comments, { pathPrefix: "/api/comments" });
|
|
853
|
+
*
|
|
738
854
|
* export default http;
|
|
739
855
|
* ```
|
|
740
856
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,OAAO,KAAK,EACV,IAAI,EAEJ,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,UAAU,EACX,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAMzE,4CAA4C;AAC5C,KAAK,QAAQ,GAAG,IAAI,CA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