@vite-hub/comments 0.5.0 → 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 +4 -0
- 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 +15 -22
- package/dist/client.js +14 -21
- package/dist/{console-D1lwNMZn.d.ts → console-CK2F53QP.d.ts} +0 -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/{database-6hXRnqDE.js → database-BkPoOdZr.js} +73 -61
- package/dist/{database-CTo7mx6t.d.ts → database-CPua6Q6_.d.ts} +0 -2
- package/dist/{database-CA1aHKN7.d.ts → database-DUs3c2al.d.ts} +625 -73
- package/dist/database.d.ts +4 -6
- package/dist/database.js +1 -2
- package/dist/{define-BMBSVbD9.js → define-9uMM3Ewc.js} +2 -3
- package/dist/{define-CmIFU96x.d.ts → define-B1jLSPe9.d.ts} +1 -3
- package/dist/{errors-BJTZ9iyv.js → errors-C0VwRHiy.js} +1 -2
- package/dist/{errors-Dq4AHjza.js → errors-DFNiJg67.js} +10 -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-RiHzmV16.d.ts → index-BEnHTj2Z.d.ts} +5 -13
- package/dist/index.d.ts +5 -5
- package/dist/index.js +8 -9
- package/dist/{install-BGGQKbQ4.d.ts → install-B-FQpi47.d.ts} +19 -8
- package/dist/{install-DrAse1Fa.js → install-BUXxryut.js} +119 -30
- package/dist/{installed-C3EoqJEY.js → installed-C9SkldMi.js} +2 -3
- 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-VyyNZusz.d.ts → operations-8hqTi0DH.d.ts} +0 -2
- package/dist/{operations-lsVKE0GH.js → operations-CKC_lMG_.js} +18 -20
- package/dist/{operations-BKhUWYkb.d.ts → operations-Cic9A9e_.d.ts} +4 -6
- package/dist/operations.d.ts +2 -2
- package/dist/operations.js +2 -2
- package/dist/overlay/{client-DBmJ4C1M.js → client-CerbVjTz.js} +3 -3
- package/dist/overlay/dist-DyVmH21U.js +14 -0
- package/dist/overlay/overlay.js +15 -15
- package/dist/page/loader.js +22 -21
- package/dist/{page-Bzj0CszG.d.ts → page-DE71P_gQ.d.ts} +0 -2
- package/dist/{page-tools-shared-BNnuPK93.js → page-tools-shared-fvmJQCrP.js} +2 -2
- package/dist/{page-DRz_sDY4.js → page-xzgZ6DGm.js} +2 -3
- package/dist/{path--zk6PEMz.js → path-8yqMd8zR.js} +0 -1
- package/dist/{plugin-DRsNaJaK.js → plugin-B2hETRii.js} +9 -11
- 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-Dj9Vw7qG.js → request-log-DllKQXj7.js} +1 -2
- package/dist/{request-origin-CFU0TQ7E.js → request-origin-YPzfE2eh.js} +1 -2
- package/dist/{rpc-BQqYx8kb.js → rpc-BKY7XRlR.js} +5 -7
- package/dist/{rpc-CuJ5GLIz.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 +8 -25
- package/dist/runtime/index.js +21 -26
- package/dist/{server-Yk610niJ.js → server-BGbD7H5s.js} +2 -3
- package/dist/server.d.ts +6 -8
- package/dist/server.js +6 -6
- package/dist/{service-Bj-Mg63c.d.ts → service-CPiWPoiY.d.ts} +3 -7
- package/dist/{service-DA5BwfPQ.js → service-DDD4Ubxd.js} +9 -11
- package/dist/{session-X_g9dnU5.js → session-BGN6Vlm6.js} +7 -10
- package/dist/{session-DUcEor2W.d.ts → session-CTh9nisq.d.ts} +3 -5
- package/dist/{store-CsUNfC1w.d.ts → store-DvNTDNgn.d.ts} +2 -4
- package/dist/{table-names-B9LlRC0B.js → table-names-BIHjuEFK.js} +1 -2
- package/dist/testing.d.ts +2 -4
- package/dist/testing.js +3 -4
- package/dist/{tokens-DSbwkVSy.js → tokens-Bx4lZ0yt.js} +3 -6
- package/dist/{types-BLaYh0_f.d.ts → types-BX3vH18p.d.ts} +0 -2
- package/dist/{types-C35INXIs.d.ts → types-l6GOb_yc.d.ts} +2 -4
- package/dist/vite.d.ts +5 -21
- package/dist/vite.js +25 -43
- package/package.json +19 -19
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as
|
|
3
|
-
import { n as
|
|
1
|
+
import { n as isRecordOrFunction, t as isRecord } from "./object-CAK6UYR5.js";
|
|
2
|
+
import { i as commentsUnansweredError, t as commentsAnswerError } from "./client-diagnostics-CvfTW5d4.js";
|
|
3
|
+
import { i as withCommentFiles, n as outboxAccountHeader, r as retryAfterOf } from "./client-files-lC6X7XyS.js";
|
|
4
4
|
import { createBirpc } from "birpc";
|
|
5
|
-
|
|
5
|
+
// ../internal/src/operation-rpc.ts
|
|
6
6
|
/** Path of the operation RPC under the app. Dev servers and deployed apps serve it the same way, one birpc call per POST. */
|
|
7
7
|
const operationRpcPath = "/_vitehub/rpc";
|
|
8
8
|
function text(value) {
|
|
@@ -87,8 +87,7 @@ async function callOperationRpc(name, input, send) {
|
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
|
|
91
|
-
//#region src/operations-core/rpc.ts
|
|
90
|
+
// src/operations-core/rpc.ts
|
|
92
91
|
/**
|
|
93
92
|
* A transport over the operations RPC at `POST /_vitehub/rpc`, one birpc call for each request, for development only.
|
|
94
93
|
* A browser cannot sign Console calls, so it works on a development server with `console: { auth: false }` or without
|
|
@@ -165,5 +164,4 @@ function createRpcTransport(options = {}) {
|
|
|
165
164
|
users: (input) => call("comments.users", input)
|
|
166
165
|
};
|
|
167
166
|
}
|
|
168
|
-
//#endregion
|
|
169
167
|
export { createRpcTransport as t };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { k as CommentsTransport } from "./types-
|
|
2
|
-
//#region src/operations-core/rpc.d.ts
|
|
1
|
+
import { k as CommentsTransport } from "./types-BX3vH18p.js";
|
|
3
2
|
interface RpcTransportOptions {
|
|
4
3
|
/** The app origin and mount, such as `https://app.example.com` or `/portal`. Defaults to the page origin. */
|
|
5
4
|
base?: string;
|
|
@@ -13,5 +12,4 @@ interface RpcTransportOptions {
|
|
|
13
12
|
* no `subscribe`: the client refreshes when the window gets focus.
|
|
14
13
|
*/
|
|
15
14
|
declare function createRpcTransport(options?: RpcTransportOptions): CommentsTransport;
|
|
16
|
-
//#endregion
|
|
17
15
|
export { createRpcTransport as n, RpcTransportOptions as t };
|
package/dist/rpc.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as createRpcTransport, t as RpcTransportOptions } from "./rpc-
|
|
1
|
+
import { n as createRpcTransport, t as RpcTransportOptions } from "./rpc-D-eqtyfh.js";
|
|
2
2
|
export { RpcTransportOptions, createRpcTransport };
|
package/dist/rpc.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { createRpcTransport };
|
|
1
|
+
export { t as createRpcTransport } from "./rpc-BKY7XRlR.js";
|
package/dist/runtime/auth.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { d as CommentsPeople, g as CommentsUser } from "../define-
|
|
2
|
-
import { f as CommentsRequestEvent } from "../types-
|
|
3
|
-
//#region src/runtime/auth.d.ts
|
|
1
|
+
import { d as CommentsPeople, g as CommentsUser } from "../define-B1jLSPe9.js";
|
|
2
|
+
import { f as CommentsRequestEvent } from "../types-l6GOb_yc.js";
|
|
4
3
|
/** The ViteHub Auth user of a request, or null. Generated Comments files pass it as `session` when the app has Auth. */
|
|
5
4
|
export declare function commentsAuthSession(event: CommentsRequestEvent): Promise<CommentsUser | null>;
|
|
6
5
|
/** The users of ViteHub Auth, for `@` suggestions. Generated Comments files pass it as `users` when the app has Auth. */
|
|
7
|
-
export declare const commentsAuthUsers: CommentsPeople;
|
|
8
|
-
//#endregion
|
|
6
|
+
export declare const commentsAuthUsers: CommentsPeople;
|
package/dist/runtime/auth.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as createAuthUsers } from "../server-
|
|
1
|
+
import { n as createAuthUsers } from "../server-BGbD7H5s.js";
|
|
2
2
|
import { getStandardContext } from "@vite-hub/runtime/internal/h3";
|
|
3
|
-
|
|
3
|
+
// src/runtime/auth.ts
|
|
4
4
|
const authServer = () => import("@vite-hub/auth/internal/server");
|
|
5
5
|
/** The ViteHub Auth user of a request, or null. Generated Comments files pass it as `session` when the app has Auth. */
|
|
6
6
|
async function commentsAuthSession(event) {
|
|
@@ -14,5 +14,4 @@ async function commentsAuthSession(event) {
|
|
|
14
14
|
}
|
|
15
15
|
/** The users of ViteHub Auth, for `@` suggestions. Generated Comments files pass it as `users` when the app has Auth. */
|
|
16
16
|
const commentsAuthUsers = createAuthUsers(async () => (await authServer()).getAuth());
|
|
17
|
-
//#endregion
|
|
18
17
|
export { commentsAuthSession, commentsAuthUsers };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { n as ViteHubConsoleRecord } from "../console-
|
|
2
|
-
//#region src/runtime/console.d.ts
|
|
1
|
+
import { n as ViteHubConsoleRecord } from "../console-CK2F53QP.js";
|
|
3
2
|
/** The threads of the app as Console records: open threads first, each group newest activity first. It runs on each Console request. */
|
|
4
|
-
export declare function readCommentsConsoleRecords(): Promise<ViteHubConsoleRecord[]>;
|
|
5
|
-
//#endregion
|
|
3
|
+
export declare function readCommentsConsoleRecords(): Promise<ViteHubConsoleRecord[]>;
|
package/dist/runtime/console.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { n as installedComments } from "../plugin-
|
|
4
|
-
|
|
1
|
+
import { t as describeCommentContext } from "../context-DbkBjITZ.js";
|
|
2
|
+
import { n as commentsPageScope } from "../page-xzgZ6DGm.js";
|
|
3
|
+
import { n as installedComments } from "../plugin-B2hETRii.js";
|
|
4
|
+
// src/runtime/console.ts
|
|
5
5
|
function excerpt(text) {
|
|
6
6
|
const line = text.replace(/\s+/g, " ").trim();
|
|
7
7
|
return line.length > 80 ? `${line.slice(0, 79)}…` : line;
|
|
@@ -60,5 +60,4 @@ async function readCommentsConsoleRecords() {
|
|
|
60
60
|
};
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
//#endregion
|
|
64
63
|
export { readCommentsConsoleRecords };
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { s as CommentContext } from "../types-
|
|
2
|
-
import { g as CommentsUser } from "../define-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
6
|
-
import { t as
|
|
7
|
-
import { t as
|
|
8
|
-
//#region src/runtime/github-login.d.ts
|
|
1
|
+
import { s as CommentContext } from "../types-BX3vH18p.js";
|
|
2
|
+
import { g as CommentsUser } from "../define-B1jLSPe9.js";
|
|
3
|
+
import { t as Comments } from "../index-BEnHTj2Z.js";
|
|
4
|
+
import { f as CommentsRequestEvent } from "../types-l6GOb_yc.js";
|
|
5
|
+
import { t as CommentsSessionOptions } from "../session-CTh9nisq.js";
|
|
6
|
+
import { t as InstallCommentsOptions } from "../install-B-FQpi47.js";
|
|
7
|
+
import { t as CommentsDatabase } from "../store-DvNTDNgn.js";
|
|
9
8
|
/** The Server Env names of the OAuth client that people sign in to Comments with: a GitHub App's, or an OAuth App's. */
|
|
10
9
|
export declare const githubLoginEnv: {
|
|
11
10
|
readonly clientId: "VITEHUB_GITHUB_CLIENT_ID";
|
|
@@ -30,8 +29,6 @@ export declare function createCommentsGitHubLogin(options?: {
|
|
|
30
29
|
fetch?: typeof fetch;
|
|
31
30
|
basePath?: string;
|
|
32
31
|
}): CommentsGitHubLogin;
|
|
33
|
-
//#endregion
|
|
34
|
-
//#region src/runtime/handler.d.ts
|
|
35
32
|
/** One field address, as `parseContentField()` from `@vite-hub/content/client` reads it. */
|
|
36
33
|
interface CommentsContentField {
|
|
37
34
|
collection: string;
|
|
@@ -85,6 +82,7 @@ interface CommentsHandlerOptions extends CommentsSessionOptions {
|
|
|
85
82
|
};
|
|
86
83
|
/** Whether the page presence rooms run, because the host has a Realtime authority. */
|
|
87
84
|
realtime: boolean;
|
|
85
|
+
attachments?: false;
|
|
88
86
|
/** `false` hides the overlay's faces and cursors, for an app that shows its own presence. Threads still update live. */
|
|
89
87
|
presence?: false;
|
|
90
88
|
/** The commit and branch of this build. New threads keep them in `context.build`. */
|
|
@@ -103,8 +101,6 @@ interface CommentsHandlerOptions extends CommentsSessionOptions {
|
|
|
103
101
|
export declare function createCommentsHandler(options: CommentsHandlerOptions): {
|
|
104
102
|
fetch(request: Request): Promise<Response>;
|
|
105
103
|
};
|
|
106
|
-
//#endregion
|
|
107
|
-
//#region src/runtime/plugin.d.ts
|
|
108
104
|
interface CommentsPluginOptions extends CommentsSessionOptions {
|
|
109
105
|
comments: Comments;
|
|
110
106
|
/** Offers GitHub sign-in or account switching through the overlay, even before read access is granted. */
|
|
@@ -143,8 +139,6 @@ export declare function installedComments(): Comments | undefined;
|
|
|
143
139
|
* `comments` page tool: a visitor may load it when `authorize` allows `read` or GitHub sign-in is available.
|
|
144
140
|
*/
|
|
145
141
|
export declare function defineCommentsPlugin(options: CommentsPluginOptions): (nitroApp: unknown) => void;
|
|
146
|
-
//#endregion
|
|
147
|
-
//#region src/runtime/database.d.ts
|
|
148
142
|
/** The runtime Database registry of `@vite-hub/database/runtime/registry`, as the generated Nitro plugin passes it. */
|
|
149
143
|
type CommentsDatabaseRegistry = Record<string, {
|
|
150
144
|
db: CommentsDatabase;
|
|
@@ -156,8 +150,6 @@ type CommentsDatabaseRegistry = Record<string, {
|
|
|
156
150
|
* `DATABASE_DISABLED` or `DATABASE_NOT_FOUND`. The store reads the db per query, by which time the binding is there.
|
|
157
151
|
*/
|
|
158
152
|
export declare function selectCommentsDatabase(databases: CommentsDatabaseRegistry, name?: string): CommentsDatabase | undefined;
|
|
159
|
-
//#endregion
|
|
160
|
-
//#region src/runtime/definition.d.ts
|
|
161
153
|
/**
|
|
162
154
|
* The Comments definition of `server/comments.ts`: its `comments` export, else its default export. Both forms run the
|
|
163
155
|
* same surfaces. The generated files call it, so a file without `defineComments()` fails with `COMMENTS_B0002`.
|
|
@@ -166,8 +158,6 @@ export declare function commentsDefinitionOf(module: {
|
|
|
166
158
|
comments?: unknown;
|
|
167
159
|
default?: unknown;
|
|
168
160
|
}, file: string): Comments;
|
|
169
|
-
//#endregion
|
|
170
|
-
//#region ../internal/src/runtime/mcp-tools.d.ts
|
|
171
161
|
/**
|
|
172
162
|
* The JSON Schema of one argument. A tool lists only these keywords, plus
|
|
173
163
|
* `description` and `title` for the Agent.
|
|
@@ -253,8 +243,6 @@ interface ViteHubMcpTool {
|
|
|
253
243
|
section: string;
|
|
254
244
|
call(input: Record<string, unknown>, context: ViteHubMcpToolContext): Promise<ViteHubMcpToolResult>;
|
|
255
245
|
}
|
|
256
|
-
//#endregion
|
|
257
|
-
//#region src/runtime/mcp.d.ts
|
|
258
246
|
interface CommentsMcpToolsOptions {
|
|
259
247
|
/**
|
|
260
248
|
* The caller passed the Console access check of the `comments` section, as the comment operations do. `authorize`
|
|
@@ -270,8 +258,6 @@ interface CommentsMcpToolsOptions {
|
|
|
270
258
|
* checked `context.user`. Replies and resolves show that user as the author.
|
|
271
259
|
*/
|
|
272
260
|
export declare function commentsMcpTools(comments: Comments, options?: CommentsMcpToolsOptions): ViteHubMcpTool[];
|
|
273
|
-
//#endregion
|
|
274
|
-
//#region ../internal/src/runtime/mcp-server.d.ts
|
|
275
261
|
type ToolResultContent = ({
|
|
276
262
|
type: "text";
|
|
277
263
|
text: string;
|
|
@@ -286,8 +272,6 @@ export declare function mcpToolResult(result: ViteHubMcpToolResult): {
|
|
|
286
272
|
structuredContent?: Record<string, unknown>;
|
|
287
273
|
isError: boolean;
|
|
288
274
|
};
|
|
289
|
-
//#endregion
|
|
290
|
-
//#region ../internal/src/runtime/page-tools.d.ts
|
|
291
275
|
/**
|
|
292
276
|
* The route of `GET /_vitehub/page/tools`: a Fetchable (https://fetchable.org). `installViteHubPageTools()` binds
|
|
293
277
|
* each Request to its app in Nitro's `request` hook, so the route finds the tools of that app.
|
|
@@ -295,5 +279,4 @@ export declare function mcpToolResult(result: ViteHubMcpToolResult): {
|
|
|
295
279
|
export declare const viteHubPageSessionHandler: {
|
|
296
280
|
fetch(request: Request): Promise<Response>;
|
|
297
281
|
};
|
|
298
|
-
//#endregion
|
|
299
282
|
export type { CommentsContent, CommentsContentField, CommentsDatabaseRegistry, CommentsGitHubLogin, CommentsHandlerOptions, CommentsMcpToolsOptions, CommentsPluginOptions };
|
package/dist/runtime/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import { t as
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { c as validateCommentsDefinition, o as deniedForMissingPolicy } from "../define-
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { t as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
1
|
+
import { a as runWithActiveCloudflareEnv, i as getActiveCloudflareBinding, r as rememberGitHubToken, t as forgetGitHubToken } from "../tokens-Bx4lZ0yt.js";
|
|
2
|
+
import { t as forwardedRequestOrigin } from "../request-origin-YPzfE2eh.js";
|
|
3
|
+
import "../client-files-lC6X7XyS.js";
|
|
4
|
+
import { t as commentsErrors } from "../errors-C0VwRHiy.js";
|
|
5
|
+
import { i as text, n as guestFromHeaders, t as authorOf } from "../identity-CT7-UGmS.js";
|
|
6
|
+
import { a as runtimeOf, r as resolveCommentsRuntime, t as commentSendOf } from "../installed-C9SkldMi.js";
|
|
7
|
+
import { a as commentThreadSummary, c as hiddenThreadsNote, n as commentAnchorSchema, o as commentThreadsText, r as commentInputSchemas, s as describeCommentThread, t as commentActions } from "../operations-CKC_lMG_.js";
|
|
8
|
+
import { c as validateCommentsDefinition, o as deniedForMissingPolicy } from "../define-9uMM3Ewc.js";
|
|
9
|
+
import { h as readAttachment, i as contextSchema, n as base64, o as deniedError, p as mentionedPeople, r as can } from "../service-DDD4Ubxd.js";
|
|
10
|
+
import { i as commentsRoute, n as commentsPageScope, o as normalizeCommentPage } from "../page-xzgZ6DGm.js";
|
|
11
|
+
import { a as viteHubPageSessionHandler, n as resolveCommentsPage, t as resolveCommentsIdentity } from "../session-BGN6Vlm6.js";
|
|
12
|
+
import { n as installedComments, t as defineCommentsPlugin } from "../plugin-B2hETRii.js";
|
|
13
|
+
import { t as invariant } from "../invariant-CmdvZ3vp.js";
|
|
14
|
+
import { t as commentsErrorDiagnostics } from "../errors-DFNiJg67.js";
|
|
15
15
|
import { getStandardContext, installRequestStandardContext } from "@vite-hub/runtime/internal/h3";
|
|
16
16
|
import * as v from "valibot";
|
|
17
17
|
import { defineGrant } from "@vite-hub/runtime/internal/grant";
|
|
18
18
|
import { hkdfSync } from "node:crypto";
|
|
19
19
|
import { defineAuth } from "@vite-hub/auth";
|
|
20
20
|
import { stateless } from "@vite-hub/auth/presets";
|
|
21
|
-
|
|
21
|
+
// src/runtime/handler.ts
|
|
22
22
|
const fieldEditGrant = defineGrant("vitehub.comments.field-edit", (input) => input);
|
|
23
23
|
const pageSchema = v.pipe(v.string(), v.startsWith("/", "A page starts with `/`."), v.maxLength(1024));
|
|
24
24
|
/** `POST /threads`: the input of `comments.create`, or a `page` instead of the subject, and the page context of the overlay. */
|
|
@@ -294,6 +294,7 @@ function createCommentsHandler(options) {
|
|
|
294
294
|
...signIn ? { signIn } : {},
|
|
295
295
|
...signOut ? { signOut } : {},
|
|
296
296
|
realtime: options.realtime,
|
|
297
|
+
...options.attachments === false ? { attachments: false } : {},
|
|
297
298
|
...options.presence === false ? { presence: false } : {},
|
|
298
299
|
content: Boolean(options.content),
|
|
299
300
|
...send ? { send: true } : {},
|
|
@@ -697,8 +698,7 @@ function createCommentsHandler(options) {
|
|
|
697
698
|
} }, { status: 404 });
|
|
698
699
|
}
|
|
699
700
|
}
|
|
700
|
-
|
|
701
|
-
//#region src/runtime/database.ts
|
|
701
|
+
// src/runtime/database.ts
|
|
702
702
|
/**
|
|
703
703
|
* The Database that `defineComments({ database })` names, else `default`, else the only one. The plugin calls it when
|
|
704
704
|
* the server starts. On Cloudflare that is before any request, so a D1 Database can't connect yet: its db throws until
|
|
@@ -721,8 +721,7 @@ function isPlaceholder(db) {
|
|
|
721
721
|
return code === "DATABASE_DISABLED" || code === "DATABASE_NOT_FOUND";
|
|
722
722
|
}
|
|
723
723
|
}
|
|
724
|
-
|
|
725
|
-
//#region src/runtime/definition.ts
|
|
724
|
+
// src/runtime/definition.ts
|
|
726
725
|
/**
|
|
727
726
|
* The Comments definition of `server/comments.ts`: its `comments` export, else its default export. Both forms run the
|
|
728
727
|
* same surfaces. The generated files call it, so a file without `defineComments()` fails with `COMMENTS_B0002`.
|
|
@@ -730,8 +729,7 @@ function isPlaceholder(db) {
|
|
|
730
729
|
function commentsDefinitionOf(module, file) {
|
|
731
730
|
return validateCommentsDefinition(module.comments ?? module.default, file);
|
|
732
731
|
}
|
|
733
|
-
|
|
734
|
-
//#region src/runtime/mcp.ts
|
|
732
|
+
// src/runtime/mcp.ts
|
|
735
733
|
/** A user supplied by an app's own MCP server. Missing identities remain anonymous. */
|
|
736
734
|
function commentsUser(user) {
|
|
737
735
|
const id = text(user?.id) ?? text(user?.email);
|
|
@@ -1103,8 +1101,7 @@ function commentsMcpTools(comments, options = {}) {
|
|
|
1103
1101
|
});
|
|
1104
1102
|
return tools;
|
|
1105
1103
|
}
|
|
1106
|
-
|
|
1107
|
-
//#region ../internal/src/runtime/mcp-server.ts
|
|
1104
|
+
// ../internal/src/runtime/mcp-server.ts
|
|
1108
1105
|
/** The MCP result of a `ViteHubMcpTool` call: a text block, then one image block for each image. */
|
|
1109
1106
|
function mcpToolResult(result) {
|
|
1110
1107
|
const content = [{
|
|
@@ -1131,8 +1128,7 @@ function readViteHubSecret(env) {
|
|
|
1131
1128
|
return typeof value === "string" && value ? value : void 0;
|
|
1132
1129
|
}
|
|
1133
1130
|
Object.freeze({ prefix: "sha256=" });
|
|
1134
|
-
|
|
1135
|
-
//#region src/runtime/github-login.ts
|
|
1131
|
+
// src/runtime/github-login.ts
|
|
1136
1132
|
/** The Server Env names of the OAuth client that people sign in to Comments with: a GitHub App's, or an OAuth App's. */
|
|
1137
1133
|
const githubLoginEnv = {
|
|
1138
1134
|
clientId: "VITEHUB_GITHUB_CLIENT_ID",
|
|
@@ -1311,5 +1307,4 @@ function createCommentsGitHubLogin(options = {}) {
|
|
|
1311
1307
|
}
|
|
1312
1308
|
};
|
|
1313
1309
|
}
|
|
1314
|
-
//#endregion
|
|
1315
1310
|
export { commentsDefinitionOf, commentsMcpTools, createCommentsGitHubLogin, createCommentsHandler, defineCommentsPlugin, githubLoginEnv, installedComments, mcpToolResult, selectCommentsDatabase, viteHubPageSessionHandler };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as commentsErrorDiagnostics } from "./errors-
|
|
2
|
-
|
|
1
|
+
import { t as commentsErrorDiagnostics } from "./errors-DFNiJg67.js";
|
|
2
|
+
// src/operations-core/server.ts
|
|
3
3
|
const key = Symbol.for("vitehub.comments.runtime");
|
|
4
4
|
const scope = globalThis;
|
|
5
5
|
/**
|
|
@@ -68,5 +68,4 @@ function createAuthUsers(getAuth) {
|
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
-
//#endregion
|
|
72
71
|
export { installCommentsRuntime as i, createAuthUsers as n, hasCommentsRuntime as r, commentsRuntime as t };
|
package/dist/server.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { b as validateCommentsDefinition, d as CommentsPeople } from "./define-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { a as commentsOperations, i as commentInputSchemas, n as commentActions, r as commentAnchorSchema, t as CommentsCaller } from "./operations-
|
|
5
|
-
import { n as createRpcTransport, t as RpcTransportOptions } from "./rpc-
|
|
6
|
-
import { n as installComments, t as InstallCommentsOptions } from "./install-
|
|
7
|
-
//#region src/operations-core/server.d.ts
|
|
1
|
+
import { b as validateCommentsDefinition, d as CommentsPeople } from "./define-B1jLSPe9.js";
|
|
2
|
+
import { a as maximumCommentBodyLength, i as CommentsRuntime, n as CommentsAttachmentStore, r as CommentsForgeHooks } from "./service-CPiWPoiY.js";
|
|
3
|
+
import { i as createCommentsStore, n as CommentsStore, r as CommentsTables, t as CommentsDatabase } from "./store-DvNTDNgn.js";
|
|
4
|
+
import { a as commentsOperations, i as commentInputSchemas, n as commentActions, r as commentAnchorSchema, t as CommentsCaller } from "./operations-Cic9A9e_.js";
|
|
5
|
+
import { n as createRpcTransport, t as RpcTransportOptions } from "./rpc-D-eqtyfh.js";
|
|
6
|
+
import { n as installComments, t as InstallCommentsOptions } from "./install-B-FQpi47.js";
|
|
8
7
|
/** Where mentions find people. The same shape as `defineComments({ people })`. */
|
|
9
8
|
export type CommentsUsers = CommentsPeople;
|
|
10
9
|
/**
|
|
@@ -17,5 +16,4 @@ export declare function commentsRuntime(): Promise<CommentsRuntime>;
|
|
|
17
16
|
export declare function hasCommentsRuntime(): boolean;
|
|
18
17
|
/** People from a Better Auth instance, through its internal adapter. The generated Nitro plugin passes it when the app has Auth. */
|
|
19
18
|
export declare function createAuthUsers(getAuth: () => object | Promise<object>): CommentsPeople;
|
|
20
|
-
//#endregion
|
|
21
19
|
export { type CommentsAttachmentStore, CommentsCaller, type CommentsDatabase, type CommentsForgeHooks, type CommentsRuntime, type CommentsStore, type CommentsTables, type InstallCommentsOptions, RpcTransportOptions, commentActions, commentAnchorSchema, commentInputSchemas, commentsOperations, createCommentsStore, createRpcTransport, installComments, maximumCommentBodyLength, validateCommentsDefinition };
|
package/dist/server.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { r as
|
|
2
|
-
import { i as commentsOperations, n as commentAnchorSchema, r as commentInputSchemas, t as commentActions } from "./operations-
|
|
3
|
-
import { t as createRpcTransport } from "./rpc-
|
|
4
|
-
import { f as maximumCommentBodyLength } from "./service-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { i as installCommentsRuntime, n as createAuthUsers, r as hasCommentsRuntime, t as commentsRuntime } from "./server-BGbD7H5s.js";
|
|
2
|
+
import { i as commentsOperations, n as commentAnchorSchema, r as commentInputSchemas, t as commentActions } from "./operations-CKC_lMG_.js";
|
|
3
|
+
import { t as createRpcTransport } from "./rpc-BKY7XRlR.js";
|
|
4
|
+
import { f as maximumCommentBodyLength } from "./service-DDD4Ubxd.js";
|
|
5
|
+
import { r as createCommentsStore, t as installComments } from "./install-BUXxryut.js";
|
|
6
|
+
import { c as validateCommentsDefinition } from "./define-9uMM3Ewc.js";
|
|
7
7
|
export { commentActions, commentAnchorSchema, commentInputSchemas, commentsOperations, commentsRuntime, createAuthUsers, createCommentsStore, createRpcTransport, hasCommentsRuntime, installComments, installCommentsRuntime, maximumCommentBodyLength, validateCommentsDefinition };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { d as CommentsPeople, g as CommentsUser, l as CommentsDefinition } from "./define-B1jLSPe9.js";
|
|
2
|
+
import { n as CommentsStore } from "./store-DvNTDNgn.js";
|
|
3
|
+
import { T as CommentThread } from "./types-BX3vH18p.js";
|
|
4
4
|
import "valibot";
|
|
5
|
-
//#region ../internal/src/runtime/client-rate-limit.d.ts
|
|
6
5
|
/** The part of `checkRateLimit()` from `vite-hub/rate-limit` that a public write calls. */
|
|
7
6
|
type SharedRateLimit = (request: Request, name: string, options: {
|
|
8
7
|
key: string;
|
|
@@ -14,8 +13,6 @@ type SharedRateLimit = (request: Request, name: string, options: {
|
|
|
14
13
|
retryAfter?: number;
|
|
15
14
|
cause?: unknown;
|
|
16
15
|
} | undefined]>;
|
|
17
|
-
//#endregion
|
|
18
|
-
//#region src/operations-core/service.d.ts
|
|
19
16
|
/** Longest message, in characters. */
|
|
20
17
|
declare const maximumCommentBodyLength = 10000;
|
|
21
18
|
/** The parts of a Blob store that attachments use: `blob` of `@vite-hub/blob`. */
|
|
@@ -69,5 +66,4 @@ interface CommentsRuntime {
|
|
|
69
66
|
/** Runs after someone opens a thread again. With Send, it puts back the sends that carried the thread. */
|
|
70
67
|
reopened?: (thread: CommentThread) => Promise<unknown>;
|
|
71
68
|
}
|
|
72
|
-
//#endregion
|
|
73
69
|
export { maximumCommentBodyLength as a, CommentsRuntime as i, CommentsAttachmentStore as n, SharedRateLimit as o, CommentsForgeHooks as r, CommentsAttachmentBody as t };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { t as replyMessageId } from "./reply-id-
|
|
2
|
-
import { t as commentsErrorDiagnostics } from "./errors-
|
|
3
|
-
import { t as isPagePath } from "./path
|
|
4
|
-
import { t as foldName } from "./fold-name-
|
|
5
|
-
import { r as guestIdPrefix } from "./identity-
|
|
6
|
-
import { i as defaultPolicy, o as deniedForMissingPolicy, t as builtinCommentSubjects } from "./define-
|
|
7
|
-
import { t as logFailure } from "./request-log-
|
|
1
|
+
import { t as replyMessageId } from "./reply-id-Cm9FGOBs.js";
|
|
2
|
+
import { t as commentsErrorDiagnostics } from "./errors-DFNiJg67.js";
|
|
3
|
+
import { t as isPagePath } from "./path-8yqMd8zR.js";
|
|
4
|
+
import { t as foldName } from "./fold-name-g-xg0mQk.js";
|
|
5
|
+
import { r as guestIdPrefix } from "./identity-CT7-UGmS.js";
|
|
6
|
+
import { i as defaultPolicy, o as deniedForMissingPolicy, t as builtinCommentSubjects } from "./define-9uMM3Ewc.js";
|
|
7
|
+
import { t as logFailure } from "./request-log-DllKQXj7.js";
|
|
8
8
|
import * as v from "valibot";
|
|
9
|
-
|
|
9
|
+
// ../internal/src/runtime/client-rate-limit.ts
|
|
10
10
|
const windowPattern = /^(\d+)(ms|s|m|h|d)$/;
|
|
11
11
|
const units = {
|
|
12
12
|
ms: 1,
|
|
@@ -90,8 +90,7 @@ function createClientRateLimit(options) {
|
|
|
90
90
|
return memory(key, policy);
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
|
-
|
|
94
|
-
//#region src/operations-core/service.ts
|
|
93
|
+
// src/operations-core/service.ts
|
|
95
94
|
/** Longest message, in characters. */
|
|
96
95
|
const maximumCommentBodyLength = 1e4;
|
|
97
96
|
/** Largest attachment, in bytes. */
|
|
@@ -662,5 +661,4 @@ async function readAttachment(runtime, key, context) {
|
|
|
662
661
|
type
|
|
663
662
|
};
|
|
664
663
|
}
|
|
665
|
-
//#endregion
|
|
666
664
|
export { clientAddressKey as C, suggest as S, createClientRateLimit as T, requestIdSchema as _, createThread as a, scopeOf as b, earlierThread as c, maximumAttachmentBytes as d, maximumCommentBodyLength as f, replyToThread as g, readAttachment as h, contextSchema as i, editMessage as l, personOf as m, base64 as n, deniedError as o, mentionedPeople as p, can as r, earlierReply as s, attachmentThread as t, fail as u, retried as v, clientRateLimitIssue as w, storeAttachment as x, retriedReply as y };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { o as
|
|
2
|
-
import { r as matchesPublicOrigin, t as forwardedRequestOrigin } from "./request-origin-
|
|
3
|
-
import {
|
|
1
|
+
import { f as viteHubPageToolsWanted, l as viteHubPageToolsLoader, n as viteHubBasePath, o as viteHubPageToolsHintCookie, p as withViteHubBase, r as viteHubPageSessionPath, s as viteHubPageToolsInlineScript, t as readViteHubPageAccount, u as viteHubPageToolsMarker } from "./page-tools-shared-fvmJQCrP.js";
|
|
2
|
+
import { r as matchesPublicOrigin, t as forwardedRequestOrigin } from "./request-origin-YPzfE2eh.js";
|
|
3
|
+
import { o as normalizeCommentPage } from "./page-xzgZ6DGm.js";
|
|
4
4
|
import { getStandardContext } from "@vite-hub/runtime/internal/h3";
|
|
5
|
-
|
|
5
|
+
// ../internal/src/runtime/page-tools-html.ts
|
|
6
6
|
/** The effective script-element directive is shared by HTTP and HTML meta policies. */
|
|
7
7
|
function scriptPolicyNonce(policy) {
|
|
8
8
|
const directives = policy.split(";").map((part) => part.trim());
|
|
@@ -144,7 +144,7 @@ function pageToolsHtmlTransform(loader) {
|
|
|
144
144
|
}
|
|
145
145
|
if (!closing && name && /^(script|style|textarea|title|xmp|iframe|noembed|noframes|noscript|plaintext)$/.test(name)) {
|
|
146
146
|
rawText = name;
|
|
147
|
-
if (!templates && token.replace(/ nonce="[\w+/=-]+"/, "") ===
|
|
147
|
+
if (!templates && token.replace(/ nonce="[\w+/=-]+"/, "") === "<script type=\"module\" data-vitehub-page-tools>") {
|
|
148
148
|
inline = token;
|
|
149
149
|
present = true;
|
|
150
150
|
continue;
|
|
@@ -163,8 +163,7 @@ function pageToolsHtmlTransform(loader) {
|
|
|
163
163
|
}
|
|
164
164
|
});
|
|
165
165
|
}
|
|
166
|
-
|
|
167
|
-
//#region ../internal/src/runtime/page-tools.ts
|
|
166
|
+
// ../internal/src/runtime/page-tools.ts
|
|
168
167
|
const stateKey = Symbol.for("vitehub.page-tools");
|
|
169
168
|
const scope = globalThis;
|
|
170
169
|
function state() {
|
|
@@ -433,8 +432,7 @@ function installViteHubPageTools(nitroApp, options = {}) {
|
|
|
433
432
|
return;
|
|
434
433
|
}
|
|
435
434
|
}
|
|
436
|
-
|
|
437
|
-
//#region src/runtime/session.ts
|
|
435
|
+
// src/runtime/session.ts
|
|
438
436
|
/**
|
|
439
437
|
* The person that Site access in the Console signed in to an app without Auth, with their roles in `role`, as
|
|
440
438
|
* `commentsRoleAllows()` reads them. A Console member has `comments-*` roles, a guest the roles of the invite.
|
|
@@ -496,5 +494,4 @@ async function resolveCommentsPage(comments, event, request, path) {
|
|
|
496
494
|
...mapped.revision === void 0 ? {} : { revision: mapped.revision }
|
|
497
495
|
};
|
|
498
496
|
}
|
|
499
|
-
//#endregion
|
|
500
497
|
export { viteHubPageSessionHandler as a, registerViteHubPageTool as i, resolveCommentsPage as n, installViteHubPageTools as r, resolveCommentsIdentity as t };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import "./
|
|
4
|
-
//#region src/runtime/session.d.ts
|
|
1
|
+
import "./index-BEnHTj2Z.js";
|
|
2
|
+
import { g as CommentsUser } from "./define-B1jLSPe9.js";
|
|
3
|
+
import { f as CommentsRequestEvent } from "./types-l6GOb_yc.js";
|
|
5
4
|
interface CommentsSessionOptions {
|
|
6
5
|
/** Reads the ViteHub Auth user only when no custom `identify` is configured. */
|
|
7
6
|
session?: (event: CommentsRequestEvent) => Promise<CommentsUser | null | undefined>;
|
|
@@ -10,5 +9,4 @@ interface CommentsSessionOptions {
|
|
|
10
9
|
user: (event: CommentsRequestEvent) => Promise<CommentsUser | null>;
|
|
11
10
|
};
|
|
12
11
|
}
|
|
13
|
-
//#endregion
|
|
14
12
|
export { CommentsSessionOptions as t };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { a as commentThreads, i as commentMessages, n as commentCounters } from "./database-DUs3c2al.js";
|
|
2
|
+
import { D as CommentUser, S as CommentStatus, T as CommentThread, b as CommentMetadata, n as CommentActor, r as CommentAnchor, s as CommentContext, v as CommentListQuery, w as CommentSubject } from "./types-BX3vH18p.js";
|
|
3
3
|
import { LibSQLDatabase } from "drizzle-orm/libsql";
|
|
4
|
-
//#region src/operations-core/store.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* The Drizzle database that the store uses. The store calls `select`, `insert`, `update`, and `delete` (with
|
|
7
6
|
* `onConflictDoNothing()` and `returning()`), which SQLite, libSQL, D1, and Postgres Drizzle databases all offer, and
|
|
@@ -93,5 +92,4 @@ interface CommentsStore {
|
|
|
93
92
|
knownUsersByIds: (ids: readonly string[], canRead: (thread: CommentThread) => Promise<boolean>) => Promise<CommentUser[]>;
|
|
94
93
|
}
|
|
95
94
|
declare function createCommentsStore(database: CommentsDatabase, tables?: CommentsTables): CommentsStore;
|
|
96
|
-
//#endregion
|
|
97
95
|
export { createCommentsStore as i, CommentsStore as n, CommentsTables as r, CommentsDatabase as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/table-names.ts
|
|
2
2
|
/**
|
|
3
3
|
* The tables of `commentsSchema` and `commentsPostgresSchema`: each schema key and its SQL name. The Comments
|
|
4
4
|
* contribution gives them to the Database, so resolving the Vite config loads neither the schema nor drizzle-orm. A
|
|
@@ -12,5 +12,4 @@ const commentsTableNames = {
|
|
|
12
12
|
};
|
|
13
13
|
/** The tables of `commentSendsSchema`: each schema key and its SQL name. Comments adds them when `send` is on. */
|
|
14
14
|
const commentSendsTableNames = { commentSends: "vitehub_comment_sends" };
|
|
15
|
-
//#endregion
|
|
16
15
|
export { commentsTableNames as n, commentSendsTableNames as t };
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { D as CommentUser, T as CommentThread, k as CommentsTransport, w as CommentSubject } from "./types-
|
|
2
|
-
//#region src/operations-core/testing.d.ts
|
|
1
|
+
import { D as CommentUser, T as CommentThread, k as CommentsTransport, w as CommentSubject } from "./types-BX3vH18p.js";
|
|
3
2
|
export interface MemoryTransportOptions {
|
|
4
3
|
/** The signed-in user. Every call acts as this user. */
|
|
5
4
|
user: CommentUser;
|
|
@@ -26,5 +25,4 @@ export interface MemoryTransport extends CommentsTransport {
|
|
|
26
25
|
* before the server half exists. It follows the access rules of the real operations: authors edit
|
|
27
26
|
* and delete their own messages, and everyone can resolve.
|
|
28
27
|
*/
|
|
29
|
-
export declare function createMemoryTransport(options: MemoryTransportOptions): MemoryTransport;
|
|
30
|
-
//#endregion
|
|
28
|
+
export declare function createMemoryTransport(options: MemoryTransportOptions): MemoryTransport;
|
package/dist/testing.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as replyMessageId } from "./reply-id-
|
|
2
|
-
import { t as commentsErrorDiagnostics } from "./errors-
|
|
3
|
-
|
|
1
|
+
import { t as replyMessageId } from "./reply-id-Cm9FGOBs.js";
|
|
2
|
+
import { t as commentsErrorDiagnostics } from "./errors-DFNiJg67.js";
|
|
3
|
+
// src/operations-core/testing.ts
|
|
4
4
|
function checkOutboxAccount(input, user) {
|
|
5
5
|
if (input.outbox && input.outbox.account !== user.id) throw Object.assign(commentsErrorDiagnostics.COMMENTS_OUTBOX_ACCOUNT_CHANGED(), { status: 401 });
|
|
6
6
|
}
|
|
@@ -216,5 +216,4 @@ function view(store, user) {
|
|
|
216
216
|
}
|
|
217
217
|
};
|
|
218
218
|
}
|
|
219
|
-
//#endregion
|
|
220
219
|
export { createMemoryTransport };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
-
|
|
2
|
+
// ../internal/src/runtime/cloudflare-env-lookup.ts
|
|
3
3
|
/** The key of the AsyncLocalStorage store on `globalThis`. Every bundled copy of this module shares the store. */
|
|
4
4
|
const activeEnvStorageKey = Symbol.for("vitehub.cloudflare.env-storage");
|
|
5
5
|
let activeEnv;
|
|
@@ -13,8 +13,7 @@ function getActiveCloudflareEnv() {
|
|
|
13
13
|
const host = globalThis;
|
|
14
14
|
return Object.hasOwn(host, "__env__") && host.__env__ !== void 0 ? host.__env__ : activeEnv;
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
//#region ../internal/src/runtime/cloudflare-env.ts
|
|
16
|
+
// ../internal/src/runtime/cloudflare-env.ts
|
|
18
17
|
const runtimeGlobal = globalThis;
|
|
19
18
|
const activeEnvStorage = runtimeGlobal[activeEnvStorageKey] ||= new AsyncLocalStorage();
|
|
20
19
|
function runWithActiveCloudflareEnv(env, callback) {
|
|
@@ -24,8 +23,7 @@ function getActiveCloudflareBinding(name) {
|
|
|
24
23
|
const env = getActiveCloudflareEnv();
|
|
25
24
|
return env && Object.hasOwn(env, name) ? env[name] : void 0;
|
|
26
25
|
}
|
|
27
|
-
|
|
28
|
-
//#region src/forge/tokens.ts
|
|
26
|
+
// src/forge/tokens.ts
|
|
29
27
|
/** How long the GitHub token of a person's last request stays usable for the pull request sync that it started. */
|
|
30
28
|
const tokenLifetime = 6e5;
|
|
31
29
|
const tokens = /* @__PURE__ */ new Map();
|
|
@@ -54,5 +52,4 @@ function recentGitHubToken(authorId) {
|
|
|
54
52
|
function forgetGitHubToken(authorId) {
|
|
55
53
|
tokens.delete(authorId);
|
|
56
54
|
}
|
|
57
|
-
//#endregion
|
|
58
55
|
export { runWithActiveCloudflareEnv as a, getActiveCloudflareBinding as i, recentGitHubToken as n, rememberGitHubToken as r, forgetGitHubToken as t };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/operations-core/types.d.ts
|
|
2
1
|
/** A person. The signed-in user and every author have this shape. */
|
|
3
2
|
interface CommentUser {
|
|
4
3
|
id: string;
|
|
@@ -362,5 +361,4 @@ interface CommentsTransport {
|
|
|
362
361
|
/** Live updates, such as Realtime. Without it the client refreshes when the window gets focus. */
|
|
363
362
|
subscribe?: (listener: (event: CommentEvent) => void) => () => void;
|
|
364
363
|
}
|
|
365
|
-
//#endregion
|
|
366
364
|
export { ElementAnchor as A, CommentStatusInput as C, CommentUser as D, CommentUploadInput as E, PageAnchor as M, TextAnchor as N, CommentUsersInput as O, CommentStatus as S, CommentThread as T, CommentListCursor as _, CommentBuild as a, CommentMetadata as b, CommentCreateInput as c, CommentDeliveryError as d, CommentEditInput as f, CommentGetInput as g, CommentForgeLink as h, CommentAttachment as i, ImageAnchor as j, CommentsTransport as k, CommentDeleteInput as l, CommentFiles as m, CommentActor as n, CommentComponent as o, CommentEvent as p, CommentAnchor as r, CommentContext as s, AreaAnchor as t, CommentDelivery as u, CommentListQuery as v, CommentSubject as w, CommentReplyInput as x, CommentMessage as y };
|