@vite-hub/comments 0.0.0 → 0.3.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 (77) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +291 -0
  3. package/dist/anchor.d.ts +43 -0
  4. package/dist/anchor.js +133 -0
  5. package/dist/client-diagnostics-CcFpkbAk.js +40 -0
  6. package/dist/client.d.ts +176 -0
  7. package/dist/client.js +738 -0
  8. package/dist/console-h4KlhIik.d.ts +332 -0
  9. package/dist/context-BqIsmYP1.js +61 -0
  10. package/dist/database/postgres.d.ts +1402 -0
  11. package/dist/database/postgres.js +81 -0
  12. package/dist/database-CA1aHKN7.d.ts +1495 -0
  13. package/dist/database.d.ts +12 -0
  14. package/dist/database.js +2 -0
  15. package/dist/define-43mMR39K.js +89 -0
  16. package/dist/define-B3TF9zzn.d.ts +204 -0
  17. package/dist/errors-4gelGVmK.js +57 -0
  18. package/dist/errors-C6qptPoG.js +135 -0
  19. package/dist/errors-CyQyKAvy.d.ts +185 -0
  20. package/dist/fold-name-B7Zb3-MF.js +7 -0
  21. package/dist/identity-CBOzgxSf.js +39 -0
  22. package/dist/index-DNhy69Wt.d.ts +83 -0
  23. package/dist/index.d.ts +7 -0
  24. package/dist/index.js +196 -0
  25. package/dist/install-BcMPgPk_.js +1154 -0
  26. package/dist/install-W9ghhGoh.d.ts +36 -0
  27. package/dist/installed-B-PfERBU.js +30 -0
  28. package/dist/invariant-D8_xBqmZ.js +22 -0
  29. package/dist/migrate-B0k_0swk.d.ts +54 -0
  30. package/dist/migrate-BDQ8xqUs.js +289 -0
  31. package/dist/object-Da1zyPCR.js +11 -0
  32. package/dist/operations-D4A1Fcgf.d.ts +160 -0
  33. package/dist/operations-DMMIfYPW.js +1159 -0
  34. package/dist/operations-GLeOqgMt.d.ts +257 -0
  35. package/dist/operations.d.ts +3 -0
  36. package/dist/operations.js +3 -0
  37. package/dist/overlay/client-DmsSMOzi.js +4 -0
  38. package/dist/overlay/dist-BoHMOFax.js +14 -0
  39. package/dist/overlay/dist-yIZmvSaU.js +1 -0
  40. package/dist/overlay/overlay.js +201 -0
  41. package/dist/page/loader.js +142 -0
  42. package/dist/page-B41ozN63.js +40 -0
  43. package/dist/page-DtbMOEMd.d.ts +22 -0
  44. package/dist/page-tools-shared-NHUjKI8E.js +117 -0
  45. package/dist/path--zk6PEMz.js +18 -0
  46. package/dist/plugin-PS8PMYus.js +74 -0
  47. package/dist/realtime.d.ts +12 -0
  48. package/dist/realtime.js +47 -0
  49. package/dist/rpc-HBcWtg0T.d.ts +17 -0
  50. package/dist/rpc-RKPAusHp.js +153 -0
  51. package/dist/rpc.d.ts +2 -0
  52. package/dist/rpc.js +2 -0
  53. package/dist/runtime/auth.d.ts +8 -0
  54. package/dist/runtime/auth.js +18 -0
  55. package/dist/runtime/connect/node.d.ts +1 -0
  56. package/dist/runtime/connect/node.js +2 -0
  57. package/dist/runtime/connect.d.ts +1 -0
  58. package/dist/runtime/connect.js +2 -0
  59. package/dist/runtime/console.d.ts +5 -0
  60. package/dist/runtime/console.js +64 -0
  61. package/dist/runtime/index.d.ts +270 -0
  62. package/dist/runtime/index.js +1113 -0
  63. package/dist/server-D8k-0GXe.js +72 -0
  64. package/dist/server.d.ts +20 -0
  65. package/dist/server.js +7 -0
  66. package/dist/service-CFVm23k7.d.ts +158 -0
  67. package/dist/service-GHhhyQj4.js +609 -0
  68. package/dist/session-DVx-1Tym.d.ts +14 -0
  69. package/dist/session-EkudzUmm.js +503 -0
  70. package/dist/testing.d.ts +30 -0
  71. package/dist/testing.js +187 -0
  72. package/dist/tokens-DSbwkVSy.js +58 -0
  73. package/dist/types-BIS0hCEl.d.ts +124 -0
  74. package/dist/types-CZujrMFd.d.ts +322 -0
  75. package/dist/vite.d.ts +308 -0
  76. package/dist/vite.js +1660 -0
  77. package/package.json +153 -4
@@ -0,0 +1,81 @@
1
+ import { bigint, boolean, index, pgTable, text, uniqueIndex } from "drizzle-orm/pg-core";
2
+ //#region src/operations-core/database/postgres.ts
3
+ /**
4
+ * Threads of comments. `n` is unique inside `scope`, which is what `?comment=<n>` names. `anchor`, `actor`, and
5
+ * `resolvedBy` hold JSON. Times are milliseconds since the epoch.
6
+ */
7
+ const commentThreads = pgTable("vitehub_comment_threads", {
8
+ id: text("id").primaryKey(),
9
+ scope: text("scope").notNull(),
10
+ n: bigint("n", { mode: "number" }).notNull(),
11
+ subjectKind: text("subject_kind").notNull(),
12
+ subjectId: text("subject_id").notNull(),
13
+ anchor: text("anchor").notNull(),
14
+ status: text("status", { enum: ["open", "resolved"] }).notNull(),
15
+ resolvedBy: text("resolved_by"),
16
+ resolvedAt: bigint("resolved_at", { mode: "number" }),
17
+ authorId: text("author_id").notNull(),
18
+ authorName: text("author_name"),
19
+ authorImage: text("author_image"),
20
+ actor: text("actor"),
21
+ metadata: text("metadata"),
22
+ context: text("context"),
23
+ revision: bigint("revision", { mode: "number" }),
24
+ requestId: text("request_id"),
25
+ createdAt: bigint("created_at", { mode: "number" }).notNull(),
26
+ updatedAt: bigint("updated_at", { mode: "number" }).notNull()
27
+ }, (table) => [
28
+ uniqueIndex("vitehub_comment_threads_scope_n").on(table.scope, table.n),
29
+ uniqueIndex("vitehub_comment_threads_scope_request").on(table.scope, table.requestId),
30
+ index("vitehub_comment_threads_subject").on(table.subjectKind, table.subjectId),
31
+ index("vitehub_comment_threads_status").on(table.status, table.updatedAt)
32
+ ]);
33
+ /** One Markdown message. The first message of a thread is the comment. `mentions` and `attachments` hold JSON lists. */
34
+ const commentMessages = pgTable("vitehub_comment_messages", {
35
+ id: text("id").primaryKey(),
36
+ threadId: text("thread_id").notNull(),
37
+ body: text("body").notNull(),
38
+ authorId: text("author_id").notNull(),
39
+ authorName: text("author_name"),
40
+ authorImage: text("author_image"),
41
+ actor: text("actor"),
42
+ mentions: text("mentions").notNull(),
43
+ attachments: text("attachments").notNull(),
44
+ createdAt: bigint("created_at", { mode: "number" }).notNull(),
45
+ editedAt: bigint("edited_at", { mode: "number" })
46
+ }, (table) => [index("vitehub_comment_messages_thread").on(table.threadId, table.createdAt)]);
47
+ /**
48
+ * The next thread number of each scope. A number is handed out once, so a deleted thread never gives its number to a
49
+ * new one, and a link such as `?comment=3` keeps naming the same thread.
50
+ */
51
+ const commentCounters = pgTable("vitehub_comment_counters", {
52
+ scope: text("scope").primaryKey(),
53
+ next: bigint("next", { mode: "number" }).notNull()
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)]);
70
+ /**
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`.
73
+ */
74
+ const commentsPostgresSchema = {
75
+ vitehubCommentThreads: commentThreads,
76
+ vitehubCommentMessages: commentMessages,
77
+ vitehubCommentCounters: commentCounters,
78
+ vitehubCommentForge: commentForge
79
+ };
80
+ //#endregion
81
+ export { commentCounters, commentForge, commentMessages, commentThreads, commentsPostgresSchema };