@vite-hub/comments 0.4.1 → 0.5.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/README.md +19 -7
- package/dist/anchor.d.ts +2 -2
- package/dist/client.d.ts +424 -11
- package/dist/client.js +405 -5
- package/dist/{console-h4KlhIik.d.ts → console-D1lwNMZn.d.ts} +2 -0
- package/dist/{migrate-Bpw3xL5e.js → database-6hXRnqDE.js} +47 -2
- package/dist/database-CTo7mx6t.d.ts +575 -0
- package/dist/database.d.ts +2 -1
- package/dist/database.js +2 -2
- package/dist/{define-CX_Yr_hz.js → define-BMBSVbD9.js} +1 -1
- package/dist/{define-CHTWfHPo.d.ts → define-CmIFU96x.d.ts} +8 -4
- package/dist/{errors-4gelGVmK.js → errors-BJTZ9iyv.js} +24 -0
- package/dist/{errors-BHsVXlpd.js → errors-Dq4AHjza.js} +16 -0
- package/dist/{index-iPGlSAgj.d.ts → index-RiHzmV16.d.ts} +113 -11
- package/dist/index.d.ts +6 -7
- package/dist/index.js +21 -7
- package/dist/{install-96NXWnrw.d.ts → install-BGGQKbQ4.d.ts} +9 -3
- package/dist/{install-jRKmuLHK.js → install-DrAse1Fa.js} +844 -38
- package/dist/{installed-g6nDr5ac.js → installed-C3EoqJEY.js} +7 -6
- package/dist/{operations-D93EV10O.d.ts → operations-BKhUWYkb.d.ts} +9 -5
- package/dist/{operations-7ycAhDCw.d.ts → operations-VyyNZusz.d.ts} +8 -2
- package/dist/{operations-9tskoLsk.js → operations-lsVKE0GH.js} +294 -212
- package/dist/operations.d.ts +2 -2
- package/dist/operations.js +2 -2
- package/dist/overlay/{client-lZesR40x.js → client-DBmJ4C1M.js} +1 -1
- package/dist/overlay/overlay.js +36 -40
- package/dist/page/loader.js +39 -47
- package/dist/{page-CWwnmF3K.d.ts → page-Bzj0CszG.d.ts} +1 -10
- package/dist/{page-tools-shared-NHUjKI8E.js → page-tools-shared-BNnuPK93.js} +6 -3
- package/dist/{plugin-BNFd1zGz.js → plugin-DRsNaJaK.js} +14 -9
- package/dist/realtime.d.ts +2 -2
- package/dist/realtime.js +1 -1
- package/dist/request-log-Dj9Vw7qG.js +105 -0
- package/dist/request-origin-CFU0TQ7E.js +49 -0
- package/dist/{rpc-BZ1QNkCC.d.ts → rpc-CuJ5GLIz.d.ts} +1 -1
- package/dist/rpc.d.ts +1 -1
- package/dist/runtime/auth.d.ts +2 -2
- package/dist/runtime/auth.js +1 -1
- package/dist/runtime/console.d.ts +1 -1
- package/dist/runtime/console.js +1 -1
- package/dist/runtime/index.d.ts +11 -9
- package/dist/runtime/index.js +148 -14
- package/dist/{server-CqyzrqTI.js → server-Yk610niJ.js} +1 -1
- package/dist/server.d.ts +6 -5
- package/dist/server.js +5 -5
- package/dist/service-Bj-Mg63c.d.ts +73 -0
- package/dist/{service-C8ZgFWvy.js → service-DA5BwfPQ.js} +39 -11
- package/dist/{session-CKfW6DGE.d.ts → session-DUcEor2W.d.ts} +3 -3
- package/dist/{session-ByjMyTak.js → session-X_g9dnU5.js} +26 -29
- package/dist/{service-wC9kx9EX.d.ts → store-CsUNfC1w.d.ts} +2 -70
- package/dist/{table-names-DfiKUlOV.js → table-names-B9LlRC0B.js} +3 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +2 -2
- package/dist/{types-C7LzhgRb.d.ts → types-BLaYh0_f.d.ts} +1 -1
- package/dist/{types-C1qzObs2.d.ts → types-C35INXIs.d.ts} +79 -4
- package/dist/vite.d.ts +22 -5
- package/dist/vite.js +140 -65
- package/package.json +8 -8
- package/dist/errors-BEChnUo7.d.ts +0 -197
|
@@ -1,8 +1,105 @@
|
|
|
1
|
-
import { D as CommentUser, T as CommentThread, n as CommentActor, s as CommentContext, w as CommentSubject, y as CommentMessage } from "./types-
|
|
2
|
-
import { f as CommentsPolicyGate, g as CommentsUser, t as CommentAction } from "./define-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { D as CommentUser, T as CommentThread, n as CommentActor, s as CommentContext, w as CommentSubject, y as CommentMessage } from "./types-BLaYh0_f.js";
|
|
2
|
+
import { f as CommentsPolicyGate, g as CommentsUser, t as CommentAction } from "./define-CmIFU96x.js";
|
|
3
|
+
import { _ as ListCommentThreadsOptions, g as FindCommentThreadInput, h as EditCommentInput, m as DefineCommentsOptions, o as CommentsErrorCode, p as CreateCommentThreadInput, v as ReplyInput, y as ReplyOptions } from "./types-C35INXIs.js";
|
|
4
|
+
import { n as commentSends, t as CommentSendState } from "./database-CTo7mx6t.js";
|
|
5
|
+
import "./store-CsUNfC1w.js";
|
|
5
6
|
import { Result } from "@vite-hub/runtime";
|
|
7
|
+
//#region src/send/store.d.ts
|
|
8
|
+
type SendRow = typeof commentSends.$inferSelect;
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/send/service.d.ts
|
|
11
|
+
interface EndpointLike {
|
|
12
|
+
id: string;
|
|
13
|
+
kind: "url" | "inbox";
|
|
14
|
+
agent: string | null;
|
|
15
|
+
host: string | null;
|
|
16
|
+
disabledAt: number | null;
|
|
17
|
+
}
|
|
18
|
+
interface PairingLike {
|
|
19
|
+
state: "waiting" | "paired" | "used" | "refused";
|
|
20
|
+
agent: string | null;
|
|
21
|
+
host: string | null;
|
|
22
|
+
address: string | null;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The parts of `@vite-hub/webhooks` that Send uses: member pairing and member endpoints. The generated plugin imports the
|
|
26
|
+
* package only when `send` is on.
|
|
27
|
+
*/
|
|
28
|
+
interface CommentSendWebhooks {
|
|
29
|
+
startMemberPairing: (owner: string) => Promise<Result<{
|
|
30
|
+
code: string;
|
|
31
|
+
secret: string;
|
|
32
|
+
expiresAt: number;
|
|
33
|
+
}, string>>;
|
|
34
|
+
pairMemberEndpoint: (input: unknown, options?: {
|
|
35
|
+
hosts?: readonly string[];
|
|
36
|
+
}) => Promise<Result<{
|
|
37
|
+
status: "paired";
|
|
38
|
+
pairing: PairingLike;
|
|
39
|
+
} | {
|
|
40
|
+
status: "expired" | "used";
|
|
41
|
+
} | {
|
|
42
|
+
status: "refused";
|
|
43
|
+
reason: string;
|
|
44
|
+
}, string>>;
|
|
45
|
+
refuseMemberPairing: (code: string) => Promise<Result<boolean, string>>;
|
|
46
|
+
getMemberPairing: (owner: string, code: string) => Promise<Result<PairingLike | null, string>>;
|
|
47
|
+
cancelMemberPairing: (owner: string, code: string) => Promise<Result<void, string>>;
|
|
48
|
+
allowMemberPairing: (owner: string, code: string, options: {
|
|
49
|
+
name: string | ((pairing: PairingLike) => string);
|
|
50
|
+
ownerName?: string;
|
|
51
|
+
ownerEmail?: string;
|
|
52
|
+
hosts?: readonly string[];
|
|
53
|
+
}) => Promise<Result<{
|
|
54
|
+
status: "allowed";
|
|
55
|
+
endpoint: EndpointLike;
|
|
56
|
+
pairing: PairingLike;
|
|
57
|
+
} | {
|
|
58
|
+
status: "expired" | "not-owner";
|
|
59
|
+
}, string>>;
|
|
60
|
+
getMemberEndpoint: (owner: string, options?: {
|
|
61
|
+
address?: string;
|
|
62
|
+
endpointId?: string;
|
|
63
|
+
}) => Promise<Result<EndpointLike | null, string>>;
|
|
64
|
+
getMemberDeliveryState: (id: string) => Promise<"pending" | "sending" | "sent" | "dead" | "cancelled" | undefined>;
|
|
65
|
+
sendToMemberEndpoint: (owner: string, body: unknown, options: {
|
|
66
|
+
event: string;
|
|
67
|
+
key: string;
|
|
68
|
+
endpointId: string;
|
|
69
|
+
deliveryId: string;
|
|
70
|
+
sealBody: boolean;
|
|
71
|
+
hosts?: readonly string[];
|
|
72
|
+
}) => Promise<Result<{
|
|
73
|
+
id: string;
|
|
74
|
+
status: "sent" | "inbox" | "pending" | "failed";
|
|
75
|
+
}, string>>;
|
|
76
|
+
}
|
|
77
|
+
/** A thread of a send as its reader gets it: the thread, and whether it is the sender's ask or a quote. */
|
|
78
|
+
type CommentSendThread = CommentThread & {
|
|
79
|
+
role: "ask" | "quote";
|
|
80
|
+
};
|
|
81
|
+
/** What a read token, or `comments_get_send`, opens: the send and exactly its threads, as the sender may read them. */
|
|
82
|
+
interface CommentSendView {
|
|
83
|
+
send: {
|
|
84
|
+
id: string;
|
|
85
|
+
page: string;
|
|
86
|
+
subject: CommentSubject;
|
|
87
|
+
state: SendRow["state"];
|
|
88
|
+
createdAt: number;
|
|
89
|
+
};
|
|
90
|
+
threads: CommentSendThread[];
|
|
91
|
+
}
|
|
92
|
+
/** What the server checked before a read, as `comments.can()` takes it. */
|
|
93
|
+
interface CommentSendPolicy {
|
|
94
|
+
gate?: CommentsPolicyGate;
|
|
95
|
+
console?: boolean;
|
|
96
|
+
}
|
|
97
|
+
/** Which sends `listOwn` returns. Default: the sent and working ones, at most 20. */
|
|
98
|
+
interface CommentSendListOptions extends CommentSendPolicy {
|
|
99
|
+
states?: readonly Extract<CommentSendState, "sent" | "working" | "done">[];
|
|
100
|
+
limit?: number;
|
|
101
|
+
}
|
|
102
|
+
//#endregion
|
|
6
103
|
//#region src/context.d.ts
|
|
7
104
|
/**
|
|
8
105
|
* The context of a thread as label and value pairs, in the order a person reads them: page, element, components,
|
|
@@ -13,12 +110,6 @@ declare function describeCommentContext(context: CommentContext | null): Array<{
|
|
|
13
110
|
value: string;
|
|
14
111
|
}>;
|
|
15
112
|
//#endregion
|
|
16
|
-
//#region src/installed.d.ts
|
|
17
|
-
/** The runtime that `installComments()` connected, for the overlay API and the MCP tools. */
|
|
18
|
-
declare function commentsRuntimeOf(comments: Comments): CommentsRuntime | undefined;
|
|
19
|
-
/** The runtime of a definition, or the one that the generated Nitro plugin builds on first use, for the overlay API. */
|
|
20
|
-
declare function resolveCommentsRuntime(comments: Comments): Promise<CommentsRuntime | undefined>;
|
|
21
|
-
//#endregion
|
|
22
113
|
//#region src/index.d.ts
|
|
23
114
|
type Codes<T extends CommentsErrorCode> = T;
|
|
24
115
|
/** The Comments runtime of an app: the export of `server/comments.ts`. */
|
|
@@ -47,6 +138,7 @@ interface Comments {
|
|
|
47
138
|
by: CommentUser;
|
|
48
139
|
actor?: CommentActor;
|
|
49
140
|
}): Promise<Result<CommentThread, Codes<"COMMENTS_NOT_INSTALLED" | "COMMENTS_NOT_FOUND">>>;
|
|
141
|
+
/** With `send`, it can restore a done inbox send or make the thread available to send again to a webhook agent. */
|
|
50
142
|
reopen(threadId: string): Promise<Result<CommentThread, Codes<"COMMENTS_NOT_INSTALLED" | "COMMENTS_NOT_FOUND">>>;
|
|
51
143
|
/** Deletes a thread and all its messages. */
|
|
52
144
|
remove(threadId: string): Promise<Result<void, Codes<"COMMENTS_NOT_INSTALLED" | "COMMENTS_NOT_FOUND">>>;
|
|
@@ -78,6 +170,16 @@ interface Comments {
|
|
|
78
170
|
limit?: number;
|
|
79
171
|
gate?: CommentsPolicyGate;
|
|
80
172
|
}): Promise<Result<CommentUser[], Codes<"COMMENTS_NOT_INSTALLED">>>;
|
|
173
|
+
/**
|
|
174
|
+
* With `send`: the sends of `user`, newest first, with the threads that `user` may still read. Default: the ones that
|
|
175
|
+
* reached the agent and that it has not finished, at most 20. As it scans, it marks finished sends as done.
|
|
176
|
+
*/
|
|
177
|
+
listSends(user: CommentsUser, options?: CommentSendListOptions): Promise<Result<CommentSendView[], Codes<"COMMENTS_NOT_INSTALLED" | "COMMENTS_SEND_OFF">>>;
|
|
178
|
+
/**
|
|
179
|
+
* With `send`: a send of `user` with the threads that `user` may still read, as `comments_get_send` opens it. A send
|
|
180
|
+
* that reached the agent becomes `working`.
|
|
181
|
+
*/
|
|
182
|
+
readSend(user: CommentsUser, id: string, policy?: CommentSendPolicy): Promise<Result<CommentSendView, Codes<"COMMENTS_NOT_INSTALLED" | "COMMENTS_NOT_FOUND" | "COMMENTS_SEND_OFF">>>;
|
|
81
183
|
/**
|
|
82
184
|
* With `forge`: brings the thread's pull request comments in line with the thread now, and posts what failed
|
|
83
185
|
* before. Every change starts this on its own; `flush()` waits for it.
|
|
@@ -89,4 +191,4 @@ interface Comments {
|
|
|
89
191
|
/** Defines Comments for the app: the access policy, the people, the hooks, and the trusted server API. */
|
|
90
192
|
declare function defineComments(options?: DefineCommentsOptions): Comments;
|
|
91
193
|
//#endregion
|
|
92
|
-
export {
|
|
194
|
+
export { CommentSendPolicy as a, CommentSendWebhooks as c, CommentSendListOptions as i, defineComments as n, CommentSendThread as o, describeCommentContext as r, CommentSendView as s, Comments as t };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { A as ElementAnchor, C as CommentStatusInput, D as CommentUser, E as CommentUploadInput, M as PageAnchor, N as TextAnchor, O as CommentUsersInput, S as CommentStatus, T as CommentThread, _ as CommentListCursor, a as CommentBuild, b as CommentMetadata, c as CommentCreateInput, d as CommentDeliveryError, f as CommentEditInput, g as CommentGetInput, h as CommentForgeLink, i as CommentAttachment, j as ImageAnchor, k as CommentsTransport, l as CommentDeleteInput, m as CommentFiles, n as CommentActor, o as CommentComponent, p as CommentEvent, r as CommentAnchor, s as CommentContext, t as AreaAnchor, u as CommentDelivery, v as CommentListQuery, w as CommentSubject, x as CommentReplyInput, y as CommentMessage } from "./types-
|
|
2
|
-
import { _ as
|
|
3
|
-
import { a as
|
|
4
|
-
import { t as
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
export { type AreaAnchor, type CommentAction, type CommentActor, type CommentAnchor, type CommentAttachment, type CommentBuild, type CommentComponent, type CommentContext, type CommentCreateInput, type CommentDeleteInput, type CommentDelivery, type CommentDeliveryError, type CommentEditInput, type CommentEvent, type CommentFiles, type CommentForgeLink, type CommentGetInput, type CommentListCursor, type CommentListQuery, type CommentMentionEvent, type CommentMessage, type CommentMessageEvent, type CommentMetadata, type CommentReplyInput, type CommentStatus, type CommentStatusInput, type CommentSubject, type CommentSubjectDefinition, type CommentThread, type CommentUploadInput, type CommentUser, type CommentUsersInput, Comments, type CommentsAttachmentFile, type CommentsAuthorize, type CommentsAuthorizeContext, type CommentsCanMentionContext, type CommentsDefinition, type CommentsErrorCode, type CommentsForgeOptions, type CommentsForgeTarget, type CommentsGitHubAccess, type CommentsIdentifyContext, type CommentsPageContext, type CommentsPageSubject, type CommentsPeople, type CommentsPolicyGate, type CommentsRateLimit, type CommentsReadAttachmentContext, type CommentsRequestEvent, type CommentsStoreAttachmentContext, type CommentsTransport, type CommentsUser, type CreateCommentThreadInput, type DefineCommentsOptions, type EditCommentInput, type ElementAnchor, type FindCommentThreadInput, type ImageAnchor, type ListCommentThreadsOptions, type PageAnchor, type ReplyInput, type ReplyOptions, type TextAnchor, builtinCommentSubjects, commentRoom, commentsErrorDiagnostics, commentsPageScope, commentsRealtimeDefinition, commentsRoleAllows, commentsRoute, commentsRuntimeOf, defaultPolicy, defineCommentSubject, defineComments, describeCommentContext, normalizeCommentPage, resolveCommentsRuntime };
|
|
1
|
+
import { A as ElementAnchor, C as CommentStatusInput, D as CommentUser, E as CommentUploadInput, M as PageAnchor, N as TextAnchor, O as CommentUsersInput, S as CommentStatus, T as CommentThread, _ as CommentListCursor, a as CommentBuild, b as CommentMetadata, c as CommentCreateInput, d as CommentDeliveryError, f as CommentEditInput, g as CommentGetInput, h as CommentForgeLink, i as CommentAttachment, j as ImageAnchor, k as CommentsTransport, l as CommentDeleteInput, m as CommentFiles, n as CommentActor, o as CommentComponent, p as CommentEvent, r as CommentAnchor, s as CommentContext, t as AreaAnchor, u as CommentDelivery, v as CommentListQuery, w as CommentSubject, x as CommentReplyInput, y as CommentMessage } from "./types-BLaYh0_f.js";
|
|
2
|
+
import { _ as commentsRoleAllows, a as CommentsAttachmentFile, c as CommentsCanMentionContext, d as CommentsPeople, f as CommentsPolicyGate, g as CommentsUser, h as CommentsStoreAttachmentContext, i as CommentSubjectDefinition, l as CommentsDefinition, m as CommentsReadAttachmentContext, n as CommentMentionEvent, o as CommentsAuthorize, p as CommentsRateLimit, r as CommentMessageEvent, s as CommentsAuthorizeContext, t as CommentAction, u as CommentsGitHubAccess, v as defaultPolicy, y as defineCommentSubject } from "./define-CmIFU96x.js";
|
|
3
|
+
import { _ as ListCommentThreadsOptions, a as CommentSendPromptContext, c as CommentsForgeTarget, d as CommentsPageSubject, f as CommentsRequestEvent, g as FindCommentThreadInput, h as EditCommentInput, i as CommentSendPayloadContext, l as CommentsIdentifyContext, m as DefineCommentsOptions, n as CommentSendData, o as CommentsErrorCode, p as CreateCommentThreadInput, r as CommentSendOptions, s as CommentsForgeOptions, t as CommentSendAddressContext, u as CommentsPageContext, v as ReplyInput, y as ReplyOptions } from "./types-C35INXIs.js";
|
|
4
|
+
import { a as CommentSendPolicy, i as CommentSendListOptions, n as defineComments, o as CommentSendThread, r as describeCommentContext, s as CommentSendView, t as Comments } from "./index-RiHzmV16.js";
|
|
5
|
+
import { r as normalizeCommentPage, t as commentRoom } from "./page-Bzj0CszG.js";
|
|
6
|
+
export { type AreaAnchor, type CommentAction, type CommentActor, type CommentAnchor, type CommentAttachment, type CommentBuild, type CommentComponent, type CommentContext, type CommentCreateInput, type CommentDeleteInput, type CommentDelivery, type CommentDeliveryError, type CommentEditInput, type CommentEvent, type CommentFiles, type CommentForgeLink, type CommentGetInput, type CommentListCursor, type CommentListQuery, type CommentMentionEvent, type CommentMessage, type CommentMessageEvent, type CommentMetadata, type CommentReplyInput, type CommentSendAddressContext, type CommentSendData, type CommentSendListOptions, type CommentSendOptions, type CommentSendPayloadContext, type CommentSendPolicy, type CommentSendPromptContext, type CommentSendThread, type CommentSendView, type CommentStatus, type CommentStatusInput, type CommentSubject, type CommentSubjectDefinition, type CommentThread, type CommentUploadInput, type CommentUser, type CommentUsersInput, Comments, type CommentsAttachmentFile, type CommentsAuthorize, type CommentsAuthorizeContext, type CommentsCanMentionContext, type CommentsDefinition, type CommentsErrorCode, type CommentsForgeOptions, type CommentsForgeTarget, type CommentsGitHubAccess, type CommentsIdentifyContext, type CommentsPageContext, type CommentsPageSubject, type CommentsPeople, type CommentsPolicyGate, type CommentsRateLimit, type CommentsReadAttachmentContext, type CommentsRequestEvent, type CommentsStoreAttachmentContext, type CommentsTransport, type CommentsUser, type CreateCommentThreadInput, type DefineCommentsOptions, type EditCommentInput, type ElementAnchor, type FindCommentThreadInput, type ImageAnchor, type ListCommentThreadsOptions, type PageAnchor, type ReplyInput, type ReplyOptions, type TextAnchor, commentRoom, commentsRoleAllows, defaultPolicy, defineCommentSubject, defineComments, describeCommentContext, normalizeCommentPage };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { t as commentsErrorDiagnostics } from "./errors-
|
|
2
|
-
import {
|
|
3
|
-
import { S as suggest, a as createThread, b as scopeOf, c as earlierThread, g as replyToThread, l as editMessage, r as can, s as earlierReply, w as clientRateLimitIssue } from "./service-
|
|
1
|
+
import { t as commentsErrorDiagnostics } from "./errors-Dq4AHjza.js";
|
|
2
|
+
import { o as normalizeCommentPage, t as commentRoom } from "./page-DRz_sDY4.js";
|
|
3
|
+
import { S as suggest, a as createThread, b as scopeOf, c as earlierThread, g as replyToThread, l as editMessage, r as can, s as earlierReply, w as clientRateLimitIssue } from "./service-DA5BwfPQ.js";
|
|
4
4
|
import { t as describeCommentContext } from "./context-BqIsmYP1.js";
|
|
5
|
-
import { a as defineCommentSubject, i as defaultPolicy, n as commentsRoleAllows, s as markCommentsDefinition
|
|
6
|
-
import {
|
|
7
|
-
import { t as
|
|
5
|
+
import { a as defineCommentSubject, i as defaultPolicy, n as commentsRoleAllows, s as markCommentsDefinition } from "./define-BMBSVbD9.js";
|
|
6
|
+
import { t as commentsErrors } from "./errors-BJTZ9iyv.js";
|
|
7
|
+
import { a as runtimeOf, n as pendingKey, o as runtimes, t as commentSendOf } from "./installed-C3EoqJEY.js";
|
|
8
8
|
//#region src/index.ts
|
|
9
9
|
/** A thread that someone deleted during the change: the store reads it again and finds nothing. */
|
|
10
10
|
function gone(error) {
|
|
@@ -157,6 +157,7 @@ function defineComments(options = {}) {
|
|
|
157
157
|
const thread = await current.store.setStatus(threadId, "open", { id: "" }, Date.now()).catch(gone);
|
|
158
158
|
if (!thread) return notFound(threadId);
|
|
159
159
|
current.forge?.changed(threadId);
|
|
160
|
+
await current.reopened?.(thread);
|
|
160
161
|
return [void 0, thread];
|
|
161
162
|
},
|
|
162
163
|
async remove(threadId) {
|
|
@@ -215,6 +216,19 @@ function defineComments(options = {}) {
|
|
|
215
216
|
...subject ? { subject } : {}
|
|
216
217
|
})];
|
|
217
218
|
},
|
|
219
|
+
async listSends(user, listOptions) {
|
|
220
|
+
if (!await runtime()) return notInstalled();
|
|
221
|
+
const service = await commentSendOf(comments);
|
|
222
|
+
if (!service) return [commentsErrors.COMMENTS_SEND_OFF(), void 0];
|
|
223
|
+
return [void 0, await service.listOwn(user, listOptions)];
|
|
224
|
+
},
|
|
225
|
+
async readSend(user, id, policy) {
|
|
226
|
+
if (!await runtime()) return notInstalled();
|
|
227
|
+
const service = await commentSendOf(comments);
|
|
228
|
+
if (!service) return [commentsErrors.COMMENTS_SEND_OFF(), void 0];
|
|
229
|
+
const opened = await service.readOwn(user, id, policy);
|
|
230
|
+
return opened ? [void 0, opened] : notFound(id);
|
|
231
|
+
},
|
|
218
232
|
async sync(threadId) {
|
|
219
233
|
await runtime();
|
|
220
234
|
await runtimes.get(comments)?.sync?.(threadId);
|
|
@@ -227,4 +241,4 @@ function defineComments(options = {}) {
|
|
|
227
241
|
return Object.freeze(markCommentsDefinition(comments));
|
|
228
242
|
}
|
|
229
243
|
//#endregion
|
|
230
|
-
export {
|
|
244
|
+
export { commentRoom, commentsRoleAllows, defaultPolicy, defineCommentSubject, defineComments, describeCommentContext, normalizeCommentPage };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { d as CommentsPeople } from "./define-
|
|
1
|
+
import { d as CommentsPeople } from "./define-CmIFU96x.js";
|
|
2
2
|
import { a as commentsSchema } from "./database-CA1aHKN7.js";
|
|
3
3
|
import { r as CommentsSchemaOwner } from "./migrate-B0k_0swk.js";
|
|
4
|
-
import { t as
|
|
5
|
-
import { c as
|
|
4
|
+
import { r as CommentsTables, t as CommentsDatabase } from "./store-CsUNfC1w.js";
|
|
5
|
+
import { c as CommentSendWebhooks, t as Comments } from "./index-RiHzmV16.js";
|
|
6
|
+
import { i as CommentsRuntime, n as CommentsAttachmentStore, o as SharedRateLimit } from "./service-Bj-Mg63c.js";
|
|
6
7
|
//#region src/install.d.ts
|
|
7
8
|
interface InstallCommentsOptions {
|
|
8
9
|
database: CommentsDatabase;
|
|
@@ -26,6 +27,11 @@ interface InstallCommentsOptions {
|
|
|
26
27
|
schema?: CommentsSchemaOwner;
|
|
27
28
|
/** The SQL dialect of `database`. Default `sqlite`: SQLite, libSQL, and D1. */
|
|
28
29
|
dialect?: "sqlite" | "postgresql";
|
|
30
|
+
/**
|
|
31
|
+
* Loads `@vite-hub/webhooks`, for `defineComments({ send })`. The generated plugin passes it when `send` is on.
|
|
32
|
+
* Without it, the Send routes answer `COMMENTS_SEND_OFF`.
|
|
33
|
+
*/
|
|
34
|
+
webhooks?: () => Promise<CommentSendWebhooks>;
|
|
29
35
|
}
|
|
30
36
|
/**
|
|
31
37
|
* Connects a Comments definition to its Database, for the server API, the overlay API, and the comment operations.
|