@vite-hub/comments 0.1.0 → 0.3.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.
Files changed (87) hide show
  1. package/README.md +79 -31
  2. package/dist/anchor.d.ts +7 -4
  3. package/dist/anchor.js +10 -5
  4. package/dist/client-diagnostics-CcFpkbAk.js +40 -0
  5. package/dist/client.d.ts +78 -3
  6. package/dist/client.js +198 -13
  7. package/dist/{console-BIz9t2cO.d.ts → console-h4KlhIik.d.ts} +97 -8
  8. package/dist/context-BqIsmYP1.js +61 -0
  9. package/dist/database/postgres.d.ts +738 -347
  10. package/dist/database/postgres.js +28 -7
  11. package/dist/{database-Cb2xjC1V.d.ts → database-CA1aHKN7.d.ts} +675 -276
  12. package/dist/database.d.ts +6 -98
  13. package/dist/database.js +2 -3
  14. package/dist/define-43mMR39K.js +89 -0
  15. package/dist/define-B3TF9zzn.d.ts +204 -0
  16. package/dist/errors-4gelGVmK.js +57 -0
  17. package/dist/errors-C6qptPoG.js +135 -0
  18. package/dist/errors-CyQyKAvy.d.ts +185 -0
  19. package/dist/fold-name-B7Zb3-MF.js +7 -0
  20. package/dist/{identity-3qtVC4rF.js → identity-CBOzgxSf.js} +7 -2
  21. package/dist/index-DNhy69Wt.d.ts +83 -0
  22. package/dist/index.d.ts +7 -7
  23. package/dist/index.js +196 -5
  24. package/dist/install-BcMPgPk_.js +1154 -0
  25. package/dist/install-W9ghhGoh.d.ts +36 -0
  26. package/dist/installed-B-PfERBU.js +30 -0
  27. package/dist/invariant-D8_xBqmZ.js +22 -0
  28. package/dist/migrate-B0k_0swk.d.ts +54 -0
  29. package/dist/migrate-BDQ8xqUs.js +289 -0
  30. package/dist/object-Da1zyPCR.js +11 -0
  31. package/dist/{operations-0B0QTVWX.d.ts → operations-D4A1Fcgf.d.ts} +37 -15
  32. package/dist/operations-DMMIfYPW.js +1159 -0
  33. package/dist/operations-GLeOqgMt.d.ts +257 -0
  34. package/dist/operations.d.ts +3 -7
  35. package/dist/operations.js +3 -2
  36. package/dist/overlay/client-DmsSMOzi.js +4 -0
  37. package/dist/overlay/dist-BoHMOFax.js +14 -0
  38. package/dist/overlay/dist-yIZmvSaU.js +1 -0
  39. package/dist/overlay/overlay.js +183 -177
  40. package/dist/page/loader.js +138 -18
  41. package/dist/{page-BuroSMXO.js → page-B41ozN63.js} +8 -6
  42. package/dist/{page-BtXADR6d.d.ts → page-DtbMOEMd.d.ts} +6 -5
  43. package/dist/page-tools-shared-NHUjKI8E.js +117 -0
  44. package/dist/path--zk6PEMz.js +18 -0
  45. package/dist/plugin-PS8PMYus.js +74 -0
  46. package/dist/realtime.d.ts +6 -12
  47. package/dist/realtime.js +23 -24
  48. package/dist/rpc-HBcWtg0T.d.ts +17 -0
  49. package/dist/rpc-RKPAusHp.js +153 -0
  50. package/dist/rpc.d.ts +2 -29
  51. package/dist/rpc.js +2 -75
  52. package/dist/runtime/auth.d.ts +5 -3
  53. package/dist/runtime/auth.js +8 -5
  54. package/dist/runtime/console.d.ts +1 -1
  55. package/dist/runtime/console.js +26 -21
  56. package/dist/runtime/index.d.ts +108 -60
  57. package/dist/runtime/index.js +684 -236
  58. package/dist/{server-BomGg3Gb.js → server-D8k-0GXe.js} +16 -7
  59. package/dist/server.d.ts +14 -88
  60. package/dist/server.js +7 -326
  61. package/dist/service-CFVm23k7.d.ts +158 -0
  62. package/dist/service-GHhhyQj4.js +609 -0
  63. package/dist/session-DVx-1Tym.d.ts +14 -0
  64. package/dist/session-EkudzUmm.js +503 -0
  65. package/dist/testing.d.ts +1 -1
  66. package/dist/testing.js +14 -2
  67. package/dist/tokens-DSbwkVSy.js +58 -0
  68. package/dist/types-BIS0hCEl.d.ts +124 -0
  69. package/dist/types-CZujrMFd.d.ts +322 -0
  70. package/dist/vite.d.ts +91 -87
  71. package/dist/vite.js +535 -796
  72. package/package.json +24 -27
  73. package/dist/database-BSnVrwHn.js +0 -60
  74. package/dist/database-C-ktS9Do.js +0 -95
  75. package/dist/define-BzW2Ychn.d.ts +0 -46
  76. package/dist/define-Cbhl6QVJ.js +0 -32
  77. package/dist/errors-BAQYcy3_.d.ts +0 -89
  78. package/dist/errors-DeD6wTCl.js +0 -77
  79. package/dist/h3-v1-request-DDGXJ9E7.js +0 -166
  80. package/dist/index-DklG2Etf.d.ts +0 -111
  81. package/dist/operations-NZG5dB8y.js +0 -732
  82. package/dist/page-tools-shared-D-amu6sx.js +0 -53
  83. package/dist/plugin-QElKQYkA.js +0 -725
  84. package/dist/request-DVc3M_AG.js +0 -14
  85. package/dist/src-CRTwnaEG.js +0 -1362
  86. package/dist/types-Cj8K7Vx7.d.ts +0 -176
  87. package/dist/types-Un2dcJWD.d.ts +0 -288
@@ -1,4 +1,4 @@
1
- import { bigint, index, pgTable, text, uniqueIndex } from "drizzle-orm/pg-core";
1
+ import { bigint, boolean, index, pgTable, text, uniqueIndex } from "drizzle-orm/pg-core";
2
2
  //#region src/operations-core/database/postgres.ts
3
3
  /**
4
4
  * Threads of comments. `n` is unique inside `scope`, which is what `?comment=<n>` names. `anchor`, `actor`, and
@@ -18,10 +18,15 @@ const commentThreads = pgTable("vitehub_comment_threads", {
18
18
  authorName: text("author_name"),
19
19
  authorImage: text("author_image"),
20
20
  actor: text("actor"),
21
+ metadata: text("metadata"),
22
+ context: text("context"),
23
+ revision: bigint("revision", { mode: "number" }),
24
+ requestId: text("request_id"),
21
25
  createdAt: bigint("created_at", { mode: "number" }).notNull(),
22
26
  updatedAt: bigint("updated_at", { mode: "number" }).notNull()
23
27
  }, (table) => [
24
28
  uniqueIndex("vitehub_comment_threads_scope_n").on(table.scope, table.n),
29
+ uniqueIndex("vitehub_comment_threads_scope_request").on(table.scope, table.requestId),
25
30
  index("vitehub_comment_threads_subject").on(table.subjectKind, table.subjectId),
26
31
  index("vitehub_comment_threads_status").on(table.status, table.updatedAt)
27
32
  ]);
@@ -47,14 +52,30 @@ const commentCounters = pgTable("vitehub_comment_counters", {
47
52
  scope: text("scope").primaryKey(),
48
53
  next: bigint("next", { mode: "number" }).notNull()
49
54
  });
55
+ /** The pull request comment of each message, when `defineComments({ forge })` posts threads. */
56
+ const commentForge = pgTable("vitehub_comment_forge", {
57
+ id: text("id").primaryKey(),
58
+ threadId: text("thread_id"),
59
+ repository: text("repository").notNull(),
60
+ pullRequest: bigint("pull_request", { mode: "number" }).notNull(),
61
+ remoteId: text("remote_id"),
62
+ nodeId: text("node_id"),
63
+ url: text("url"),
64
+ digest: text("digest"),
65
+ postedAs: text("posted_as", { enum: ["author", "app"] }),
66
+ minimized: boolean("minimized").notNull().default(false),
67
+ error: text("error"),
68
+ updatedAt: bigint("updated_at", { mode: "number" }).notNull()
69
+ }, (table) => [index("vitehub_comment_forge_thread").on(table.threadId), index("vitehub_comment_forge_pull_request").on(table.repository, table.pullRequest)]);
50
70
  /**
51
- * The tables behind the comment operations, for Postgres. Add them to a Database Definition yourself
52
- * and apply their migration, or let `hubComments()` contribute them. For SQLite, libSQL, and D1 use `@vite-hub/comments/database`.
71
+ * The tables of Comments, for Postgres. ViteHub adds them to the Database for you; add them to a Database Definition
72
+ * yourself only without ViteHub. For SQLite, libSQL, and D1 use `@vite-hub/comments/database`.
53
73
  */
54
74
  const commentsPostgresSchema = {
55
- commentThreads,
56
- commentMessages,
57
- commentCounters
75
+ vitehubCommentThreads: commentThreads,
76
+ vitehubCommentMessages: commentMessages,
77
+ vitehubCommentCounters: commentCounters,
78
+ vitehubCommentForge: commentForge
58
79
  };
59
80
  //#endregion
60
- export { commentCounters, commentMessages, commentThreads, commentsPostgresSchema };
81
+ export { commentCounters, commentForge, commentMessages, commentThreads, commentsPostgresSchema };