@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,5 +1,5 @@
|
|
|
1
|
-
import { r as hasCommentsRuntime, t as commentsRuntime } from "./server-
|
|
2
|
-
|
|
1
|
+
import { r as hasCommentsRuntime, t as commentsRuntime } from "./server-BGbD7H5s.js";
|
|
2
|
+
// src/installed.ts
|
|
3
3
|
/** The runtime that `installComments()` connected to each definition. */
|
|
4
4
|
const runtimes = /* @__PURE__ */ new WeakMap();
|
|
5
5
|
/** The runtime that the generated Nitro plugin builds on the first call, per definition. */
|
|
@@ -18,13 +18,13 @@ async function runtimeOf(comments) {
|
|
|
18
18
|
const built = await commentsRuntime().catch(() => void 0);
|
|
19
19
|
return built?.definition === comments.options ? built : void 0;
|
|
20
20
|
}
|
|
21
|
-
/** The runtime that `installComments()` connected, for the overlay API and the MCP tools. */
|
|
22
|
-
function commentsRuntimeOf(comments) {
|
|
23
|
-
return runtimes.get(comments)?.runtime;
|
|
24
|
-
}
|
|
25
21
|
/** The runtime of a definition, or the one that the generated Nitro plugin builds on first use, for the overlay API. */
|
|
26
22
|
async function resolveCommentsRuntime(comments) {
|
|
27
23
|
return runtimeOf(comments);
|
|
28
24
|
}
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
/** The Send service of a definition, after the runtime is built. Undefined while Send is off. */
|
|
26
|
+
async function commentSendOf(comments) {
|
|
27
|
+
await runtimeOf(comments);
|
|
28
|
+
return runtimes.get(comments)?.send;
|
|
29
|
+
}
|
|
30
|
+
export { runtimeOf as a, runtimeBuilds as i, pendingKey as n, runtimes as o, resolveCommentsRuntime as r, commentSendOf as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineDiagnostics } from "nostics";
|
|
2
|
-
|
|
2
|
+
// ../internal/src/invariant.ts
|
|
3
3
|
const invariantDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
4
4
|
docsBase: "https://vitehub.dev/docs/development/diagnostics",
|
|
5
5
|
codes: { INTERNAL_INVARIANT_FAILED: {
|
|
@@ -18,5 +18,4 @@ function invariantError(what) {
|
|
|
18
18
|
function invariant(condition, what) {
|
|
19
19
|
if (!condition) throw invariantError(what);
|
|
20
20
|
}
|
|
21
|
-
//#endregion
|
|
22
21
|
export { invariant as t };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/migrate.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* - `empty`: no `vitehub_comment_threads` table.
|
|
4
3
|
* - `live`: the tables of the live-site model: threads with `number`, `page`, and `created_by`, and `vitehub_comments`.
|
|
@@ -9,6 +8,8 @@ type CommentsSchemaState = "empty" | "live" | "outdated" | "current";
|
|
|
9
8
|
interface CommentsMigrationOptions {
|
|
10
9
|
/** `postgresql` for a Postgres Database. Default `sqlite`: SQLite, libSQL, and D1. */
|
|
11
10
|
dialect?: "sqlite" | "postgresql";
|
|
11
|
+
/** The SQL name of the threads table that tells the state. Default `vitehub_comment_threads`. */
|
|
12
|
+
table?: string;
|
|
12
13
|
}
|
|
13
14
|
interface CommentsMigration {
|
|
14
15
|
/** What the Database had before. */
|
|
@@ -50,5 +51,4 @@ declare function migrateComments(db: object, options?: CommentsMigrationOptions)
|
|
|
50
51
|
* the tables, and fails with `COMMENTS_R0019` until a migration brings them to this version.
|
|
51
52
|
*/
|
|
52
53
|
type CommentsSchemaOwner = "comments" | "app";
|
|
53
|
-
//#endregion
|
|
54
54
|
export { commentsMigrationSql as a, migrateComments as c, CommentsSchemaState as i, CommentsMigrationOptions as n, commentsSchemaState as o, CommentsSchemaOwner as r, liveThreadsBackup as s, CommentsMigration as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../internal/src/object.ts
|
|
2
2
|
/** A non-null object that is not an array. Functions do not pass. */
|
|
3
3
|
function isRecord(value) {
|
|
4
4
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -7,5 +7,4 @@ function isRecord(value) {
|
|
|
7
7
|
function isRecordOrFunction(value) {
|
|
8
8
|
return Object(value) === value && !Array.isArray(value);
|
|
9
9
|
}
|
|
10
|
-
//#endregion
|
|
11
10
|
export { isRecordOrFunction as n, isRecord as t };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
2
|
-
//#region ../internal/src/operation-definition.d.ts
|
|
3
2
|
/** `read` never changes state. `write` changes state. `destructive` deletes or publishes. */
|
|
4
3
|
type OperationKind = "read" | "write" | "destructive";
|
|
5
4
|
/** The signed-in user of a call. */
|
|
@@ -28,6 +27,11 @@ interface OperationAccess {
|
|
|
28
27
|
*/
|
|
29
28
|
readonly sections: "all" | readonly string[];
|
|
30
29
|
readonly user?: OperationUser;
|
|
30
|
+
/**
|
|
31
|
+
* Who signed the call: `"console"` when the ViteHub Console signed it for a person, whose `user` is then a Console
|
|
32
|
+
* account and not an app user, or `"cli"` for a key. Not set for other calls.
|
|
33
|
+
*/
|
|
34
|
+
readonly via?: "console" | "cli";
|
|
31
35
|
}
|
|
32
36
|
interface OperationContext {
|
|
33
37
|
/** The checked Console access of the call. */
|
|
@@ -90,7 +94,8 @@ interface OperationDefinition<Input, Output> {
|
|
|
90
94
|
/** Standard Schema (valibot in this repo). Its Standard JSON Schema builds CLI flags and the MCP input schema. */
|
|
91
95
|
input: StandardSchemaV1<unknown, Input>;
|
|
92
96
|
output?: StandardSchemaV1<unknown, Output>;
|
|
93
|
-
|
|
97
|
+
/** `false`: no `vitehub` command. The Console and MCP still call the operation. */
|
|
98
|
+
cli?: false | {
|
|
94
99
|
/** Defaults: namespace = section, command = verb. */
|
|
95
100
|
namespace?: string;
|
|
96
101
|
/** A space groups commands: `jobs list` and `jobs show` run as `vitehub <namespace> jobs list` and `jobs show`. */
|
|
@@ -131,7 +136,7 @@ interface OperationDefinition<Input, Output> {
|
|
|
131
136
|
/** An operation of any input and output, as a registry holds it. */
|
|
132
137
|
interface AnyOperation extends Omit<OperationDefinition<unknown, unknown>, "cli" | "input" | "mcp" | "output" | "readOnlyWhen" | "run" | "scope" | "section"> {
|
|
133
138
|
readOnlyWhen?: (input: never) => boolean;
|
|
134
|
-
cli?: {
|
|
139
|
+
cli?: false | {
|
|
135
140
|
namespace?: string;
|
|
136
141
|
command?: string;
|
|
137
142
|
default?: boolean;
|
|
@@ -161,5 +166,4 @@ interface OperationContributionEntry {
|
|
|
161
166
|
}
|
|
162
167
|
/** The contribution of a plugin: a list, or a function that returns it, for a plugin that reads the project first. */
|
|
163
168
|
type OperationContributions = readonly OperationContributionEntry[] | (() => readonly OperationContributionEntry[] | Promise<readonly OperationContributionEntry[]>);
|
|
164
|
-
//#endregion
|
|
165
169
|
export { OperationContributions as n, AnyOperation as t };
|