@vite-hub/comments 0.4.1 → 0.5.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/README.md +23 -7
- package/dist/anchor.d.ts +3 -5
- package/dist/anchor.js +1 -2
- package/dist/{client-diagnostics-Bubm7Shd.js → client-diagnostics-CvfTW5d4.js} +1 -2
- package/dist/{client-files-CJZl5Kc4.js → client-files-lC6X7XyS.js} +1 -2
- package/dist/client.d.ts +430 -24
- package/dist/client.js +413 -20
- package/dist/{console-h4KlhIik.d.ts → console-CK2F53QP.d.ts} +2 -4
- package/dist/{context-BqIsmYP1.js → context-DbkBjITZ.js} +1 -2
- package/dist/database/postgres.d.ts +1 -3
- package/dist/database/postgres.js +1 -2
- package/dist/{migrate-Bpw3xL5e.js → database-BkPoOdZr.js} +116 -59
- package/dist/database-CPua6Q6_.d.ts +573 -0
- package/dist/{database-CA1aHKN7.d.ts → database-DUs3c2al.d.ts} +625 -73
- package/dist/database.d.ts +4 -5
- package/dist/database.js +1 -2
- package/dist/{define-CX_Yr_hz.js → define-9uMM3Ewc.js} +2 -3
- package/dist/{define-CHTWfHPo.d.ts → define-B1jLSPe9.d.ts} +8 -6
- package/dist/{errors-4gelGVmK.js → errors-C0VwRHiy.js} +25 -2
- package/dist/{errors-BHsVXlpd.js → errors-DFNiJg67.js} +26 -3
- package/dist/{fold-name-B7Zb3-MF.js → fold-name-g-xg0mQk.js} +1 -2
- package/dist/hosted/hosted-comments/client-B3dlmmQd.js +4 -0
- package/dist/{overlay/dist-BoHMOFax.js → hosted/hosted-comments/dist-DyVmH21U.js} +1 -1
- package/dist/hosted/hosted-comments/frame.js +1 -0
- package/dist/hosted/hosted-comments/overlay-4-mWX4Uz.js +170 -0
- package/dist/hosted/hosted-comments/protocol-BHvtQKte.js +1 -0
- package/dist/hosted/hosted-comments/rest-transport-D-9_pNqZ.js +1 -0
- package/dist/hosted/hosted-comments/tools-CdwnUCOr.js +126 -0
- package/dist/hosted/hosted-comments.js +9 -0
- package/dist/{identity-CBOzgxSf.js → identity-CT7-UGmS.js} +1 -2
- package/dist/{index-iPGlSAgj.d.ts → index-BEnHTj2Z.d.ts} +109 -15
- package/dist/index.d.ts +6 -7
- package/dist/index.js +23 -10
- package/dist/{install-96NXWnrw.d.ts → install-B-FQpi47.d.ts} +24 -7
- package/dist/{install-jRKmuLHK.js → install-BUXxryut.js} +950 -55
- package/dist/{installed-g6nDr5ac.js → installed-C9SkldMi.js} +8 -8
- package/dist/{invariant-D8_xBqmZ.js → invariant-CmdvZ3vp.js} +1 -2
- package/dist/{migrate-B0k_0swk.d.ts → migrate-XjFeQppf.d.ts} +2 -2
- package/dist/{object-Da1zyPCR.js → object-CAK6UYR5.js} +1 -2
- package/dist/{operations-7ycAhDCw.d.ts → operations-8hqTi0DH.d.ts} +8 -4
- package/dist/{operations-9tskoLsk.js → operations-CKC_lMG_.js} +309 -229
- package/dist/{operations-D93EV10O.d.ts → operations-Cic9A9e_.d.ts} +9 -7
- package/dist/operations.d.ts +2 -2
- package/dist/operations.js +2 -2
- package/dist/overlay/{client-lZesR40x.js → client-CerbVjTz.js} +3 -3
- package/dist/overlay/dist-DyVmH21U.js +14 -0
- package/dist/overlay/overlay.js +36 -40
- package/dist/page/loader.js +45 -52
- package/dist/page-DE71P_gQ.d.ts +11 -0
- package/dist/{page-tools-shared-NHUjKI8E.js → page-tools-shared-fvmJQCrP.js} +8 -5
- package/dist/{page-DRz_sDY4.js → page-xzgZ6DGm.js} +2 -3
- package/dist/{path--zk6PEMz.js → path-8yqMd8zR.js} +0 -1
- package/dist/{plugin-BNFd1zGz.js → plugin-B2hETRii.js} +16 -13
- package/dist/realtime.d.ts +3 -5
- package/dist/realtime.js +4 -5
- package/dist/{reply-id-P_bSuEng.js → reply-id-Cm9FGOBs.js} +1 -2
- package/dist/request-log-DllKQXj7.js +104 -0
- package/dist/request-origin-YPzfE2eh.js +48 -0
- package/dist/{rpc-BQqYx8kb.js → rpc-BKY7XRlR.js} +5 -7
- package/dist/{rpc-BZ1QNkCC.d.ts → rpc-D-eqtyfh.d.ts} +1 -3
- package/dist/rpc.d.ts +1 -1
- package/dist/rpc.js +1 -2
- package/dist/runtime/auth.d.ts +3 -5
- package/dist/runtime/auth.js +2 -3
- package/dist/runtime/console.d.ts +2 -4
- package/dist/runtime/console.js +4 -5
- package/dist/runtime/index.d.ts +12 -27
- package/dist/runtime/index.js +160 -31
- package/dist/{server-CqyzrqTI.js → server-BGbD7H5s.js} +2 -3
- package/dist/server.d.ts +6 -7
- package/dist/server.js +6 -6
- package/dist/service-CPiWPoiY.d.ts +69 -0
- package/dist/{service-C8ZgFWvy.js → service-DDD4Ubxd.js} +44 -18
- package/dist/{session-ByjMyTak.js → session-BGN6Vlm6.js} +31 -37
- package/dist/{session-CKfW6DGE.d.ts → session-CTh9nisq.d.ts} +3 -5
- package/dist/{service-wC9kx9EX.d.ts → store-DvNTDNgn.d.ts} +3 -73
- package/dist/{table-names-DfiKUlOV.js → table-names-BIHjuEFK.js} +4 -3
- package/dist/testing.d.ts +2 -4
- package/dist/testing.js +4 -5
- package/dist/{tokens-DSbwkVSy.js → tokens-Bx4lZ0yt.js} +3 -6
- package/dist/{types-C7LzhgRb.d.ts → types-BX3vH18p.d.ts} +1 -3
- package/dist/{types-C1qzObs2.d.ts → types-l6GOb_yc.d.ts} +79 -6
- package/dist/vite.d.ts +22 -21
- package/dist/vite.js +161 -104
- package/package.json +19 -19
- package/dist/errors-BEChnUo7.d.ts +0 -197
- package/dist/page-CWwnmF3K.d.ts +0 -22
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
//#region src/operations-core/errors.d.ts
|
|
2
|
-
declare const commentsErrorDiagnostics: import("nostics").Diagnostics<{
|
|
3
|
-
readonly COMMENTS_R0002: {
|
|
4
|
-
readonly why: ({ id }: {
|
|
5
|
-
id: string;
|
|
6
|
-
}) => string;
|
|
7
|
-
readonly fix: "List the threads again, because someone may have deleted this one.";
|
|
8
|
-
};
|
|
9
|
-
readonly COMMENTS_R0003: {
|
|
10
|
-
readonly why: ({ messageId }: {
|
|
11
|
-
messageId: string;
|
|
12
|
-
}) => string;
|
|
13
|
-
readonly fix: "Read the thread again, because someone may have deleted the message.";
|
|
14
|
-
};
|
|
15
|
-
readonly COMMENTS_R0004: {
|
|
16
|
-
readonly why: "Only the author of a message can edit or delete it.";
|
|
17
|
-
readonly fix: "Sign in as the author, or ask them to change the message.";
|
|
18
|
-
};
|
|
19
|
-
readonly COMMENTS_R0005: {
|
|
20
|
-
readonly why: "A comment needs some text.";
|
|
21
|
-
readonly fix: "Write at least one character before you send.";
|
|
22
|
-
};
|
|
23
|
-
readonly COMMENTS_R0006: {
|
|
24
|
-
readonly why: "server/comments.ts defines no authorize policy, so a production build lets in only people signed in with GitHub who can push to the repository, and people that the Console admits to its Comments section. Other signed-in people, such as users of ViteHub Auth or identify, get nothing.";
|
|
25
|
-
readonly fix: "Pass authorize to defineComments({ authorize }) and return true for the people and Agents that may take the action. See https://vitehub.dev/docs/comments/configure#decide-who-can-comment";
|
|
26
|
-
};
|
|
27
|
-
readonly COMMENTS_R0007: {
|
|
28
|
-
readonly why: ({ message }: {
|
|
29
|
-
message: string;
|
|
30
|
-
}) => string;
|
|
31
|
-
readonly fix: "Mention only people that users() finds, and write @ and their name in the text.";
|
|
32
|
-
};
|
|
33
|
-
readonly COMMENTS_R0008: {
|
|
34
|
-
readonly why: ({ kind }: {
|
|
35
|
-
kind: string;
|
|
36
|
-
}) => string;
|
|
37
|
-
readonly fix: "Use page or content, or add defineCommentSubject({ kind, scope }) to defineComments({ subjects }).";
|
|
38
|
-
};
|
|
39
|
-
readonly COMMENTS_R0009: {
|
|
40
|
-
readonly why: ({ action }: {
|
|
41
|
-
action: string;
|
|
42
|
-
}) => string;
|
|
43
|
-
readonly fix: "Ask for access, or allow the action in defineComments({ authorize }).";
|
|
44
|
-
};
|
|
45
|
-
readonly COMMENTS_R0010: {
|
|
46
|
-
readonly why: "The comments runtime is not installed.";
|
|
47
|
-
readonly fix: "Add server/comments.ts and enable the Database with vitehub({ database: true }). `vite dev` and builds install the runtime for you.";
|
|
48
|
-
};
|
|
49
|
-
readonly COMMENTS_R0011: {
|
|
50
|
-
readonly why: "The comment numbers of this scope are busy.";
|
|
51
|
-
readonly fix: "Try again. Several people created a comment at the same moment.";
|
|
52
|
-
};
|
|
53
|
-
readonly COMMENTS_R0012: {
|
|
54
|
-
readonly why: "Writing a comment needs a signed-in user.";
|
|
55
|
-
readonly fix: "Sign in, then try again. Without ViteHub Auth or `identify`, sign in with GitHub so comments know who writes.";
|
|
56
|
-
};
|
|
57
|
-
readonly COMMENTS_R0014: {
|
|
58
|
-
readonly why: "Comments has no place to store attachments: the app has no Blob store and no storeAttachment hook.";
|
|
59
|
-
readonly fix: "Turn on Blob with vitehub({ blob: true }), or pass storeAttachment to defineComments().";
|
|
60
|
-
};
|
|
61
|
-
readonly COMMENTS_R0016: {
|
|
62
|
-
readonly why: "The thread is resolved, so it takes no new replies.";
|
|
63
|
-
readonly fix: "Reopen the thread first, or pass { allowResolved: true } to comments.reply() when your UI allows replies to resolved threads.";
|
|
64
|
-
};
|
|
65
|
-
readonly COMMENTS_R0017: {
|
|
66
|
-
readonly why: ({ message }: {
|
|
67
|
-
message: string;
|
|
68
|
-
}) => string;
|
|
69
|
-
readonly fix: "Attach an image, a PDF, or a text file of at most 5 MB.";
|
|
70
|
-
};
|
|
71
|
-
readonly COMMENTS_R0018: {
|
|
72
|
-
readonly why: ({ message }: {
|
|
73
|
-
message: string;
|
|
74
|
-
}) => string;
|
|
75
|
-
readonly fix: "Check the input against the limits of comments: https://vitehub.dev/docs/comments/limits-and-errors";
|
|
76
|
-
};
|
|
77
|
-
readonly COMMENTS_R0019: {
|
|
78
|
-
readonly why: ({ state, missing }: {
|
|
79
|
-
state: "empty" | "live" | "outdated";
|
|
80
|
-
missing: readonly string[];
|
|
81
|
-
}) => string;
|
|
82
|
-
readonly fix: ({ state }: {
|
|
83
|
-
state: "empty" | "live" | "outdated";
|
|
84
|
-
}) => "Move the tables once in a custom migration: run vitehub database generate --custom --schema-snapshot --name comments_one_model, put the SQL of commentsMigrationSql({ from: \"live\" }) from vite-hub/comments/database in it, then run vitehub database migrate. See https://vitehub.dev/docs/comments/configure#upgrade-to-one-model" | "Run vitehub database generate and vitehub database migrate, so the Database gets the comment tables of this version. See https://vitehub.dev/docs/comments/configure#upgrade-to-one-model";
|
|
85
|
-
};
|
|
86
|
-
readonly COMMENTS_R0020: {
|
|
87
|
-
readonly why: ({ key }: {
|
|
88
|
-
key: string;
|
|
89
|
-
}) => string;
|
|
90
|
-
readonly fix: "Read the attachment through a message that lists its key, as a person who may read that thread.";
|
|
91
|
-
};
|
|
92
|
-
readonly COMMENTS_R0021: {
|
|
93
|
-
readonly why: "Comments stores attachments with storeAttachment, but has no readAttachment to read them back.";
|
|
94
|
-
readonly fix: "Pass readAttachment to defineComments(), next to storeAttachment, and return the file of the key as a Blob.";
|
|
95
|
-
};
|
|
96
|
-
readonly COMMENTS_R0022: {
|
|
97
|
-
readonly why: "Another comment thread of this scope, or another reply in this thread, already uses this requestId: it has another author or another subject, or you may not read it.";
|
|
98
|
-
readonly fix: "Send a new requestId, such as crypto.randomUUID(), for each new comment or reply. Send the same requestId again only to retry the same one.";
|
|
99
|
-
};
|
|
100
|
-
readonly COMMENTS_B0001: {
|
|
101
|
-
readonly why: ({ file }: {
|
|
102
|
-
file: string;
|
|
103
|
-
}) => string;
|
|
104
|
-
readonly fix: "Remove `database: false` from vitehub(), or set `database: true`. vitehub() turns the Database on for comments when the option is unset.";
|
|
105
|
-
};
|
|
106
|
-
readonly COMMENTS_B0002: {
|
|
107
|
-
readonly why: ({ file }: {
|
|
108
|
-
file: string;
|
|
109
|
-
}) => string;
|
|
110
|
-
readonly fix: "Write `export default defineComments({ authorize })` in server/comments.ts.";
|
|
111
|
-
};
|
|
112
|
-
readonly COMMENTS_B0003: {
|
|
113
|
-
readonly why: "comments() from @vite-hub/comments/vite is for apps without vitehub(). In this app vitehub() owns the Comments configuration.";
|
|
114
|
-
readonly fix: "Remove comments() from the plugins and set vitehub({ comments: true }), or add server/comments.ts. See https://vitehub.dev/docs/comments/configure#turn-comments-on-in-a-vitehub-app";
|
|
115
|
-
};
|
|
116
|
-
readonly COMMENTS_B0004: {
|
|
117
|
-
readonly why: ({ file }: {
|
|
118
|
-
file: string;
|
|
119
|
-
}) => string;
|
|
120
|
-
readonly fix: "Write the Database name as a string literal, such as `defineComments({ database: \"content\" })`, and put no spread after it. Remove the option to use the default or only Database.";
|
|
121
|
-
};
|
|
122
|
-
readonly COMMENTS_DATABASE_TOKEN_IN_BUILD: {
|
|
123
|
-
readonly why: "The `database` option of `comments()` has an `authToken` in its URL, so the token ends up in the build output.";
|
|
124
|
-
readonly fix: "Put the URL with its token in a variable, and pass the variable: `comments({ database: \"env:COMMENTS_DATABASE_URL\" })`.";
|
|
125
|
-
};
|
|
126
|
-
readonly COMMENTS_GITHUB_CREDENTIALS_MISSING: {
|
|
127
|
-
readonly why: "Comments needs GitHub credentials to post to pull requests: VITEHUB_GITHUB_APP_ID with VITEHUB_GITHUB_PRIVATE_KEY, or VITEHUB_GITHUB_TOKEN.";
|
|
128
|
-
readonly fix: "Set `VITEHUB_GITHUB_APP_ID` and `VITEHUB_GITHUB_PRIVATE_KEY` of a GitHub App that is installed on the repository, or set `VITEHUB_GITHUB_TOKEN`.";
|
|
129
|
-
};
|
|
130
|
-
readonly COMMENTS_GITHUB_REQUEST_FAILED: {
|
|
131
|
-
readonly why: ({ path, status }: {
|
|
132
|
-
path: string;
|
|
133
|
-
status: number;
|
|
134
|
-
}) => string;
|
|
135
|
-
readonly fix: "Sign in with GitHub again, because a status of 401 means that the token expired. For other statuses, check that the GitHub OAuth app of the Comments login is active and that GitHub is reachable.";
|
|
136
|
-
};
|
|
137
|
-
readonly COMMENTS_GITHUB_SYNC_FAILED: {
|
|
138
|
-
readonly why: ({ reason, request, status }: {
|
|
139
|
-
reason: string;
|
|
140
|
-
request: string;
|
|
141
|
-
status: number;
|
|
142
|
-
}) => string;
|
|
143
|
-
readonly fix: "Check that the GitHub App or `VITEHUB_GITHUB_TOKEN` can write pull request comments in the repository. A retry helps for a 5xx status.";
|
|
144
|
-
};
|
|
145
|
-
readonly COMMENTS_GUEST_RATE_LIMITED: {
|
|
146
|
-
readonly why: ({ retryAfter }: {
|
|
147
|
-
retryAfter: number | undefined;
|
|
148
|
-
}) => string;
|
|
149
|
-
readonly fix: "Wait, then try again. Sign in to write without the guest limit of defineComments({ rateLimit }).";
|
|
150
|
-
};
|
|
151
|
-
readonly COMMENTS_MIGRATION_DATABASE_UNSUPPORTED: {
|
|
152
|
-
readonly why: ({ dialect }: {
|
|
153
|
-
dialect: "postgresql" | "sqlite";
|
|
154
|
-
}) => "[vitehub] migrateComments() needs a Postgres Drizzle database with transaction()." | "[vitehub] migrateComments() needs a Drizzle database with batch() or transaction(), so a failure changes nothing.";
|
|
155
|
-
readonly fix: "Pass `migrateComments()` the Drizzle database of `useDatabase()`, or of another driver with `transaction()` on Postgres, or `batch()` or `transaction()` on SQLite.";
|
|
156
|
-
};
|
|
157
|
-
readonly COMMENTS_MIGRATION_LIVE_POSTGRES: {
|
|
158
|
-
readonly why: "[vitehub] The live-site comments model had no Postgres tables, so there is nothing to move.";
|
|
159
|
-
readonly fix: "Use `from: \"outdated\"` for a Postgres Database. Only SQLite, libSQL, and D1 have tables of the live-site model.";
|
|
160
|
-
};
|
|
161
|
-
readonly COMMENTS_RATE_LIMIT_INVALID: {
|
|
162
|
-
readonly why: ({ issue }: {
|
|
163
|
-
issue: string;
|
|
164
|
-
}) => string;
|
|
165
|
-
readonly fix: "Pass rateLimit as { limit, window }, such as { limit: 5, window: \"1m\" }, or remove it to let guests write without a limit.";
|
|
166
|
-
};
|
|
167
|
-
readonly COMMENTS_SECRET_TOO_SHORT: {
|
|
168
|
-
readonly why: ({ minimum }: {
|
|
169
|
-
minimum: number;
|
|
170
|
-
}) => string;
|
|
171
|
-
readonly fix: "Set `VITEHUB_SECRET` to the output of `openssl rand -base64 32`, which has 44 characters.";
|
|
172
|
-
};
|
|
173
|
-
readonly COMMENTS_OUTBOX_ACCOUNT_CHANGED: {
|
|
174
|
-
why: string;
|
|
175
|
-
fix: string;
|
|
176
|
-
};
|
|
177
|
-
readonly COMMENTS_OUTBOX_SENDING: {
|
|
178
|
-
why: string;
|
|
179
|
-
fix: string;
|
|
180
|
-
};
|
|
181
|
-
readonly COMMENTS_R0001: {
|
|
182
|
-
why: ({ target }: {
|
|
183
|
-
target: string;
|
|
184
|
-
}) => string;
|
|
185
|
-
fix: string;
|
|
186
|
-
};
|
|
187
|
-
readonly COMMENTS_R0013: {
|
|
188
|
-
why: string;
|
|
189
|
-
fix: string;
|
|
190
|
-
};
|
|
191
|
-
readonly COMMENTS_R0015: {
|
|
192
|
-
why: string;
|
|
193
|
-
fix: string;
|
|
194
|
-
};
|
|
195
|
-
}, readonly import("nostics").AnyDiagnosticReporter[], import("nostics").InferCodesData>;
|
|
196
|
-
//#endregion
|
|
197
|
-
export { commentsErrorDiagnostics as t };
|
package/dist/page-CWwnmF3K.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
//#region src/page.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* The numbering scope of page threads: subjects of kind `page`, which the overlay pins on the app's pages. Threads on
|
|
4
|
-
* subjects of your own, such as `drop`, take the scope that their subject definition gives.
|
|
5
|
-
*/
|
|
6
|
-
declare const commentsPageScope = "site";
|
|
7
|
-
/** Name of the Realtime Definition that holds one presence room per page. */
|
|
8
|
-
declare const commentsRealtimeDefinition = "comments";
|
|
9
|
-
/** The route prefix of the Comments API, below the app base. */
|
|
10
|
-
declare const commentsRoute = "/_vitehub/comments";
|
|
11
|
-
/** Mount Comments under the application path, ignoring Vite asset URLs such as a CDN origin. */
|
|
12
|
-
declare function mountedCommentsRoute(base?: string): string;
|
|
13
|
-
/**
|
|
14
|
-
* The key of a page: its pathname without query or hash, and without a trailing slash except for `/`. Threads and
|
|
15
|
-
* presence rooms belong to a page key. A full URL of the page, such as `https://site.test/pricing/`, gives the key of
|
|
16
|
-
* its path, `/pricing`.
|
|
17
|
-
*/
|
|
18
|
-
declare function normalizeCommentPage(path: string): string;
|
|
19
|
-
/** The Realtime document id of the presence room of a page: `pages/<hash>`, a safe Workspace path for any page. */
|
|
20
|
-
declare function commentRoom(page: string): string;
|
|
21
|
-
//#endregion
|
|
22
|
-
export { mountedCommentsRoute as a, commentsRoute as i, commentsPageScope as n, normalizeCommentPage as o, commentsRealtimeDefinition as r, commentRoom as t };
|