@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.
Files changed (59) hide show
  1. package/README.md +19 -7
  2. package/dist/anchor.d.ts +2 -2
  3. package/dist/client.d.ts +424 -11
  4. package/dist/client.js +405 -5
  5. package/dist/{console-h4KlhIik.d.ts → console-D1lwNMZn.d.ts} +2 -0
  6. package/dist/{migrate-Bpw3xL5e.js → database-6hXRnqDE.js} +47 -2
  7. package/dist/database-CTo7mx6t.d.ts +575 -0
  8. package/dist/database.d.ts +2 -1
  9. package/dist/database.js +2 -2
  10. package/dist/{define-CX_Yr_hz.js → define-BMBSVbD9.js} +1 -1
  11. package/dist/{define-CHTWfHPo.d.ts → define-CmIFU96x.d.ts} +8 -4
  12. package/dist/{errors-4gelGVmK.js → errors-BJTZ9iyv.js} +24 -0
  13. package/dist/{errors-BHsVXlpd.js → errors-Dq4AHjza.js} +16 -0
  14. package/dist/{index-iPGlSAgj.d.ts → index-RiHzmV16.d.ts} +113 -11
  15. package/dist/index.d.ts +6 -7
  16. package/dist/index.js +21 -7
  17. package/dist/{install-96NXWnrw.d.ts → install-BGGQKbQ4.d.ts} +9 -3
  18. package/dist/{install-jRKmuLHK.js → install-DrAse1Fa.js} +844 -38
  19. package/dist/{installed-g6nDr5ac.js → installed-C3EoqJEY.js} +7 -6
  20. package/dist/{operations-D93EV10O.d.ts → operations-BKhUWYkb.d.ts} +9 -5
  21. package/dist/{operations-7ycAhDCw.d.ts → operations-VyyNZusz.d.ts} +8 -2
  22. package/dist/{operations-9tskoLsk.js → operations-lsVKE0GH.js} +294 -212
  23. package/dist/operations.d.ts +2 -2
  24. package/dist/operations.js +2 -2
  25. package/dist/overlay/{client-lZesR40x.js → client-DBmJ4C1M.js} +1 -1
  26. package/dist/overlay/overlay.js +36 -40
  27. package/dist/page/loader.js +39 -47
  28. package/dist/{page-CWwnmF3K.d.ts → page-Bzj0CszG.d.ts} +1 -10
  29. package/dist/{page-tools-shared-NHUjKI8E.js → page-tools-shared-BNnuPK93.js} +6 -3
  30. package/dist/{plugin-BNFd1zGz.js → plugin-DRsNaJaK.js} +14 -9
  31. package/dist/realtime.d.ts +2 -2
  32. package/dist/realtime.js +1 -1
  33. package/dist/request-log-Dj9Vw7qG.js +105 -0
  34. package/dist/request-origin-CFU0TQ7E.js +49 -0
  35. package/dist/{rpc-BZ1QNkCC.d.ts → rpc-CuJ5GLIz.d.ts} +1 -1
  36. package/dist/rpc.d.ts +1 -1
  37. package/dist/runtime/auth.d.ts +2 -2
  38. package/dist/runtime/auth.js +1 -1
  39. package/dist/runtime/console.d.ts +1 -1
  40. package/dist/runtime/console.js +1 -1
  41. package/dist/runtime/index.d.ts +11 -9
  42. package/dist/runtime/index.js +148 -14
  43. package/dist/{server-CqyzrqTI.js → server-Yk610niJ.js} +1 -1
  44. package/dist/server.d.ts +6 -5
  45. package/dist/server.js +5 -5
  46. package/dist/service-Bj-Mg63c.d.ts +73 -0
  47. package/dist/{service-C8ZgFWvy.js → service-DA5BwfPQ.js} +39 -11
  48. package/dist/{session-CKfW6DGE.d.ts → session-DUcEor2W.d.ts} +3 -3
  49. package/dist/{session-ByjMyTak.js → session-X_g9dnU5.js} +26 -29
  50. package/dist/{service-wC9kx9EX.d.ts → store-CsUNfC1w.d.ts} +2 -70
  51. package/dist/{table-names-DfiKUlOV.js → table-names-B9LlRC0B.js} +3 -1
  52. package/dist/testing.d.ts +1 -1
  53. package/dist/testing.js +2 -2
  54. package/dist/{types-C7LzhgRb.d.ts → types-BLaYh0_f.d.ts} +1 -1
  55. package/dist/{types-C1qzObs2.d.ts → types-C35INXIs.d.ts} +79 -4
  56. package/dist/vite.d.ts +22 -5
  57. package/dist/vite.js +140 -65
  58. package/package.json +8 -8
  59. package/dist/errors-BEChnUo7.d.ts +0 -197
@@ -1,4 +1,4 @@
1
- import { r as hasCommentsRuntime, t as commentsRuntime } from "./server-CqyzrqTI.js";
1
+ import { r as hasCommentsRuntime, t as commentsRuntime } from "./server-Yk610niJ.js";
2
2
  //#region src/installed.ts
3
3
  /** The runtime that `installComments()` connected to each definition. */
4
4
  const runtimes = /* @__PURE__ */ new WeakMap();
@@ -18,13 +18,14 @@ 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
  }
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
+ }
29
30
  //#endregion
30
- export { runtimeOf as a, runtimeBuilds as i, pendingKey as n, runtimes as o, resolveCommentsRuntime as r, commentsRuntimeOf as t };
31
+ export { runtimeOf as a, runtimeBuilds as i, pendingKey as n, runtimes as o, resolveCommentsRuntime as r, commentSendOf as t };
@@ -1,7 +1,7 @@
1
- import { C as CommentStatusInput, D as CommentUser, E as CommentUploadInput, O as CommentUsersInput, T as CommentThread, c as CommentCreateInput, f as CommentEditInput, g as CommentGetInput, i as CommentAttachment, l as CommentDeleteInput, n as CommentActor, s as CommentContext, v as CommentListQuery, x as CommentReplyInput, y as CommentMessage } from "./types-C7LzhgRb.js";
2
- import { f as CommentsPolicyGate, g as CommentsUser } from "./define-CHTWfHPo.js";
3
- import { i as CommentsRuntime, t as CommentsAttachmentBody } from "./service-wC9kx9EX.js";
4
- import { t as AnyOperation } from "./operations-7ycAhDCw.js";
1
+ import { C as CommentStatusInput, D as CommentUser, E as CommentUploadInput, O as CommentUsersInput, T as CommentThread, c as CommentCreateInput, f as CommentEditInput, g as CommentGetInput, i as CommentAttachment, l as CommentDeleteInput, n as CommentActor, s as CommentContext, v as CommentListQuery, x as CommentReplyInput, y as CommentMessage } from "./types-BLaYh0_f.js";
2
+ import { f as CommentsPolicyGate, g as CommentsUser } from "./define-CmIFU96x.js";
3
+ import { i as CommentsRuntime, t as CommentsAttachmentBody } from "./service-Bj-Mg63c.js";
4
+ import { t as AnyOperation } from "./operations-VyyNZusz.js";
5
5
  import * as v from "valibot";
6
6
  //#region src/operations-core/operations.d.ts
7
7
  declare const anchor: v.UnionSchema<[v.StrictObjectSchema<{
@@ -167,7 +167,7 @@ declare const commentInputSchemas: {
167
167
  readonly threadId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 100, undefined>]>;
168
168
  }, undefined>;
169
169
  readonly get: v.UnionSchema<[v.StrictObjectSchema<{
170
- readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 100, undefined>]>;
170
+ readonly threadId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 100, undefined>]>;
171
171
  }, undefined>, v.StrictObjectSchema<{
172
172
  readonly n: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
173
173
  readonly scope: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>;
@@ -242,6 +242,10 @@ declare const commentActions: {
242
242
  edit(input: CommentEditInput, who: CommentsCaller): Promise<CommentThread>;
243
243
  delete(input: CommentDeleteInput, who: CommentsCaller): Promise<CommentThread | null>;
244
244
  setStatus(input: CommentStatusInput, who: CommentsCaller, status: "open" | "resolved"): Promise<CommentThread>;
245
+ resolveThreads(input: readonly {
246
+ threadId: string;
247
+ reply?: string;
248
+ }[], who: CommentsCaller): Promise<CommentThread[]>;
245
249
  /** `minimum`: the shortest query that gets suggestions. The operations ask for two characters. */
246
250
  users(input: CommentUsersInput, who: CommentsCaller, options?: {
247
251
  minimum?: number;
@@ -28,6 +28,11 @@ interface OperationAccess {
28
28
  */
29
29
  readonly sections: "all" | readonly string[];
30
30
  readonly user?: OperationUser;
31
+ /**
32
+ * Who signed the call: `"console"` when the ViteHub Console signed it for a person, whose `user` is then a Console
33
+ * account and not an app user, or `"cli"` for a key. Not set for other calls.
34
+ */
35
+ readonly via?: "console" | "cli";
31
36
  }
32
37
  interface OperationContext {
33
38
  /** The checked Console access of the call. */
@@ -90,7 +95,8 @@ interface OperationDefinition<Input, Output> {
90
95
  /** Standard Schema (valibot in this repo). Its Standard JSON Schema builds CLI flags and the MCP input schema. */
91
96
  input: StandardSchemaV1<unknown, Input>;
92
97
  output?: StandardSchemaV1<unknown, Output>;
93
- cli?: {
98
+ /** `false`: no `vitehub` command. The Console and MCP still call the operation. */
99
+ cli?: false | {
94
100
  /** Defaults: namespace = section, command = verb. */
95
101
  namespace?: string;
96
102
  /** A space groups commands: `jobs list` and `jobs show` run as `vitehub <namespace> jobs list` and `jobs show`. */
@@ -131,7 +137,7 @@ interface OperationDefinition<Input, Output> {
131
137
  /** An operation of any input and output, as a registry holds it. */
132
138
  interface AnyOperation extends Omit<OperationDefinition<unknown, unknown>, "cli" | "input" | "mcp" | "output" | "readOnlyWhen" | "run" | "scope" | "section"> {
133
139
  readOnlyWhen?: (input: never) => boolean;
134
- cli?: {
140
+ cli?: false | {
135
141
  namespace?: string;
136
142
  command?: string;
137
143
  default?: boolean;