@vercel/board 0.32.0 → 0.33.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 (166) hide show
  1. package/README.md +25 -20
  2. package/dist/{access-CY5xVMIK.mjs → access-N3XmkKXg.mjs} +3 -3
  3. package/dist/access.d.mts +4 -5
  4. package/dist/access.mjs +5 -5
  5. package/dist/{actors-Bm-ojWWT.mjs → actors-ihyN47OV.mjs} +3 -3
  6. package/dist/{auth-K8dY1nBY.d.mts → auth-D6z3rMNj.d.mts} +7 -93
  7. package/dist/{auth-8pRZnF1M.mjs → auth-r-_PeZyw.mjs} +32 -148
  8. package/dist/{backend-DxE9wGKm.d.mts → backend-CWpyR1A7.d.mts} +81 -51
  9. package/dist/backend-local.d.mts +28 -0
  10. package/dist/backend-local.mjs +2 -0
  11. package/dist/{chat-provider-DkFp2hrh.mjs → chat-provider-9hCT654s.mjs} +2 -2
  12. package/dist/{chat-provider-BChYrrA7.d.mts → chat-provider-DJpFUaFv.d.mts} +2 -3
  13. package/dist/cli-commands.d.mts +1 -1
  14. package/dist/cli-commands.mjs +1 -1
  15. package/dist/cli-embedded.d.mts +2 -2
  16. package/dist/cli-embedded.mjs +1 -1
  17. package/dist/cli.mjs +6 -6
  18. package/dist/{commands-CpyPV_tk.d.mts → commands-BOBQHVqM.d.mts} +9 -0
  19. package/dist/{commands-DsnQKTdB.mjs → commands-CHoMl06v.mjs} +12 -1
  20. package/dist/{conformance-3RBKxwbp.mjs → conformance-qKmGLTAT.mjs} +5 -5
  21. package/dist/conformance.d.mts +1 -1
  22. package/dist/conformance.mjs +1 -1
  23. package/dist/{engine-DurYIRt8.mjs → engine-JxgZiikU.mjs} +6 -8
  24. package/dist/{errors-CJXhhzvT.mjs → errors-Pk0XV1hK.mjs} +56 -2
  25. package/dist/{events-lujPA3gQ.mjs → events-IQg0k281.mjs} +2 -2
  26. package/dist/exports-BuKjVq2t.d.mts +4 -0
  27. package/dist/exports-gHDHlg0i.mjs +3207 -0
  28. package/dist/{external-D3p5T57R.mjs → external-CYe424fO.mjs} +1 -1
  29. package/dist/{folds-DLUzfibJ.d.mts → folds-DjFTiqIM.d.mts} +38 -44
  30. package/dist/index-CXvvYNYj.d.mts +11 -0
  31. package/dist/index.d.mts +9 -8
  32. package/dist/index.mjs +21 -8
  33. package/dist/index.node.d.mts +5 -6
  34. package/dist/index.node.mjs +3 -3
  35. package/dist/inspect/app.js +95 -95
  36. package/dist/{internal-CvsrprnU-zZMpDiRY.mjs → internal-CvsrprnU-CEPOUpAv.mjs} +63 -43
  37. package/dist/local-BbLjA5vI.mjs +8818 -0
  38. package/dist/{main-CcYDo9Hb.mjs → main-CQpCZJFw.mjs} +91 -23
  39. package/dist/{backend-a2/store-memory.mjs → memory-7RRnLa4X.mjs} +3 -3
  40. package/dist/middleware-BU7rVi9F.mjs +103 -0
  41. package/dist/{client-COfYrgfV.d.mts → provider-BlzUvcM9.d.mts} +665 -5
  42. package/dist/{schemas-DBmUO6pr.mjs → schemas-BG205xds.mjs} +2 -5
  43. package/dist/{serve-Bplieh0C.mjs → serve-D8_W4UN6.mjs} +33 -24
  44. package/dist/{node-BgeGcwX0.mjs → server-BiIUXWbU.mjs} +419 -6
  45. package/dist/{serving-Y7s7VDjB.mjs → serving-D7rcUtSC.mjs} +1 -1
  46. package/dist/{sql-E1K5g_ih.mjs → sql-BQzKUqQt.mjs} +349 -114
  47. package/dist/sqlite-DCtZFEVm.mjs +30 -0
  48. package/dist/{sqlite-db-CzcD_FW8.mjs → sqlite-db-qLTs52Ny.mjs} +2 -3
  49. package/dist/{store-codec-pAG2oPgQ-SqDXlPBR.mjs → store-N8PXxDAS-BdL4Sq-f.mjs} +6 -2
  50. package/dist/{store-memory-B0PkVSuQ.mjs → store-memory-CKQVEzXN.mjs} +2 -4
  51. package/dist/store-memory-OdGsc-t_.mjs +2 -0
  52. package/dist/{store-polling-BZt2Rf3D-Div-bJ_D.mjs → store-polling-BZt2Rf3D-oh3aU_An.mjs} +1 -1
  53. package/dist/store-sqlite-CTxAVCcz.mjs +2 -0
  54. package/dist/{store-sqlite-D85t3tE7.mjs → store-sqlite-D6fIszST.mjs} +3 -4
  55. package/dist/sync-chat-sdk.d.mts +2 -2
  56. package/dist/sync-chat-sdk.mjs +2 -2
  57. package/dist/sync-github.d.mts +2 -2
  58. package/dist/sync-github.mjs +2 -2
  59. package/dist/sync-linear.d.mts +2 -3
  60. package/dist/sync-linear.mjs +2 -2
  61. package/dist/sync-slack.d.mts +3 -3
  62. package/dist/sync-slack.mjs +4 -4
  63. package/dist/sync.d.mts +2 -2
  64. package/dist/sync.mjs +2 -2
  65. package/dist/{watchers-hash-CurCzwhe.mjs → targets-CknPGGVi.mjs} +40 -10
  66. package/dist/{tokens-C7kYyrAG.mjs → tokens-DPKjl3jf.mjs} +15 -43
  67. package/docs/01-board/01-mounting.md +243 -288
  68. package/docs/01-board/03-identity.md +41 -50
  69. package/docs/01-board/04-messages.md +15 -14
  70. package/docs/01-board/05-reading.md +3 -3
  71. package/docs/01-board/06-watchers.md +58 -105
  72. package/docs/01-board/07-schedules.md +21 -41
  73. package/docs/01-board/08-middleware.md +11 -17
  74. package/docs/01-board/09-access.md +76 -313
  75. package/docs/01-board/10-local.md +81 -0
  76. package/docs/01-quickstart.md +49 -126
  77. package/docs/02-sync/01-overview.md +25 -80
  78. package/docs/02-sync/02-functions.md +10 -16
  79. package/docs/02-sync/03-slack.md +13 -26
  80. package/docs/02-sync/04-github.md +8 -20
  81. package/docs/02-sync/07-linear.md +6 -10
  82. package/docs/03-guides/02-inspector.md +3 -3
  83. package/docs/03-guides/03-ci.md +88 -128
  84. package/docs/03-guides/04-triage.md +7 -15
  85. package/docs/03-guides/05-agent-factory.md +30 -36
  86. package/docs/04-reference/01-cli.md +104 -22
  87. package/docs/04-reference/02-board.md +60 -74
  88. package/docs/04-reference/03-http.md +119 -57
  89. package/docs/04-reference/05-conformance.md +31 -45
  90. package/docs/index.md +41 -65
  91. package/package.json +12 -83
  92. package/dist/a2-DiDc77Uf.mjs +0 -4238
  93. package/dist/access-DPcrKIH_.d.mts +0 -37
  94. package/dist/backend-a2/blob-vercel.d.mts +0 -8
  95. package/dist/backend-a2/blob-vercel.mjs +0 -81
  96. package/dist/backend-a2/contract.d.mts +0 -828
  97. package/dist/backend-a2/contract.mjs +0 -5
  98. package/dist/backend-a2/scheduler-local.d.mts +0 -11
  99. package/dist/backend-a2/scheduler-local.mjs +0 -2
  100. package/dist/backend-a2/scheduler-qstash.d.mts +0 -79
  101. package/dist/backend-a2/scheduler-qstash.mjs +0 -522
  102. package/dist/backend-a2/scheduler-vercel.d.mts +0 -38
  103. package/dist/backend-a2/scheduler-vercel.mjs +0 -204
  104. package/dist/backend-a2/store-memory.d.mts +0 -11
  105. package/dist/backend-a2/store-postgres.d.mts +0 -38
  106. package/dist/backend-a2/store-postgres.mjs +0 -2977
  107. package/dist/backend-a2/store-redis-http.d.mts +0 -17
  108. package/dist/backend-a2/store-redis-http.mjs +0 -520
  109. package/dist/backend-a2/store-redis.d.mts +0 -31
  110. package/dist/backend-a2/store-redis.mjs +0 -88
  111. package/dist/backend-a2/store-sqlite.d.mts +0 -12
  112. package/dist/backend-a2/store-sqlite.mjs +0 -31
  113. package/dist/backend-a2.d.mts +0 -2633
  114. package/dist/backend-a2.mjs +0 -3
  115. package/dist/backend-http-CaN06CaD.d.mts +0 -672
  116. package/dist/backend-http-CoaCghuJ.mjs +0 -18
  117. package/dist/backend-http-l5A8UmL-.mjs +0 -585
  118. package/dist/backend-http.d.mts +0 -10
  119. package/dist/backend-http.mjs +0 -2
  120. package/dist/backend-http.node.d.mts +0 -10
  121. package/dist/backend-http.node.mjs +0 -2
  122. package/dist/backend-vercel-BE65okBC.mjs +0 -86
  123. package/dist/backend-vercel-CVxoTNF2.mjs +0 -1744
  124. package/dist/backend-vercel-jg-6PAgD.d.mts +0 -674
  125. package/dist/backend-vercel.d.mts +0 -9
  126. package/dist/backend-vercel.mjs +0 -11
  127. package/dist/backend-vercel.node.d.mts +0 -17
  128. package/dist/backend-vercel.node.mjs +0 -2
  129. package/dist/blob-Bx8QPWEd.d.mts +0 -40
  130. package/dist/blob-WbB2DJKn.mjs +0 -201
  131. package/dist/errors-2vGs49Db.d.mts +0 -16
  132. package/dist/exports-BnUZuRm9.mjs +0 -1389
  133. package/dist/exports-u5mApVvn.d.mts +0 -5
  134. package/dist/files-SniSmeEr.mjs +0 -47
  135. package/dist/folds-DsWfIftc.mjs +0 -208
  136. package/dist/index-UXpTPWNc.d.mts +0 -11
  137. package/dist/index.default-Dp8gexln.mjs +0 -12
  138. package/dist/local-C76Fy5ad.mjs +0 -44
  139. package/dist/middleware-BavYSDUa.mjs +0 -62
  140. package/dist/platform-B4TnJtWu-Do3agKr5.mjs +0 -32
  141. package/dist/project-4Vl7_uy5.mjs +0 -124
  142. package/dist/provider-gynDUoyW.d.mts +0 -665
  143. package/dist/redis-tables-BFRj_SEJ.mjs +0 -3895
  144. package/dist/reducer-Bswr11ar-P324o9vn.mjs +0 -74
  145. package/dist/reducer-CYPHsSmd-BXjGiptm.d.mts +0 -170
  146. package/dist/reducers-DQVSP3kk.mjs +0 -538
  147. package/dist/retryable-lazy-DZWmHpii-DpTc5PIP.mjs +0 -19
  148. package/dist/scheduler-task-X1SToDjP-D2Il2rln.mjs +0 -69
  149. package/dist/server-B9gu0qi1-DI1WvcVK.d.mts +0 -391
  150. package/dist/server-DX7mM6nm-D7N_7bug.mjs +0 -3611
  151. package/dist/server-wIpAEjpX.mjs +0 -17
  152. package/dist/session-clear-XJYpmUpg-2q8l_FJR.mjs +0 -63
  153. package/dist/store-DEzcHZOA-B-5vhxef.d.mts +0 -540
  154. package/dist/store-N8PXxDAS-DWWgv-Vz.mjs +0 -5
  155. package/dist/store-memory-4IBl0Ztu.mjs +0 -2
  156. package/dist/store-presence-polling-JuAy2Ck2-Dh-g_KYM.mjs +0 -109
  157. package/dist/store-sqlite-iBTYYKBj.mjs +0 -2
  158. package/dist/stream-buffer-DrTyiIuo-Be10yOBR.mjs +0 -53
  159. package/dist/targets-Cgjs29T0.mjs +0 -33
  160. package/dist/types-CmrFjpml.d.mts +0 -102
  161. package/dist/wait-until-Dw4XrIDQ.mjs +0 -42
  162. package/docs/01-board/02-database.md +0 -258
  163. package/docs/04-reference/04-log.md +0 -247
  164. package/sql/postgres/board.sql +0 -145
  165. package/sql/postgres/notifications.sql +0 -24
  166. package/sql/postgres/schema.sql +0 -451
@@ -1,665 +0,0 @@
1
- import { d as ExternalFile, f as ExternalLink, l as ExternalAuthor, p as Link, t as Actor, u as ExternalEvent } from "./folds-DLUzfibJ.mjs";
2
- import { U as MessageView, _ as BoardEventView, dt as SourceJoin, mt as SourceRead, t as BoardClient } from "./client-COfYrgfV.mjs";
3
- import { z } from "zod";
4
- //#region src/sync/events.d.ts
5
- declare const EventBase: z.ZodObject<{
6
- channel: z.ZodString;
7
- thread: z.ZodString;
8
- subthread: z.ZodNullable<z.ZodString>;
9
- id: z.ZodString;
10
- platform: z.ZodString;
11
- key: z.ZodString;
12
- raw: z.ZodUnknown;
13
- }, z.core.$strip>;
14
- type EventBase<P extends string = string> = Omit<z.infer<typeof EventBase>, 'platform'> & {
15
- platform: P;
16
- };
17
- type ProviderEvent = EventBase & ExternalEvent & {
18
- type: string;
19
- };
20
- declare function envelope(platform: string, key: string, event: ExternalEvent, raw: unknown, id: string): {
21
- channel: string;
22
- thread: string;
23
- subthread: string | null;
24
- kind: "message";
25
- message: string;
26
- isRoot: boolean;
27
- text: string;
28
- context: string | null;
29
- author: {
30
- id: string;
31
- handle: string;
32
- name: string;
33
- avatar: string | null;
34
- isBot: boolean;
35
- };
36
- files?: {
37
- type: "audio" | "file" | "image" | "video";
38
- name?: string | undefined;
39
- mimeType?: string | undefined;
40
- size?: number | undefined;
41
- url?: string | undefined;
42
- fetchMetadata?: Record<string, string> | undefined;
43
- }[] | undefined;
44
- links?: {
45
- url: string;
46
- thread: string;
47
- message: string;
48
- snapshot: {
49
- author: string;
50
- text: string;
51
- createdAt: string | null;
52
- files: {
53
- name: string;
54
- url: string | null;
55
- }[];
56
- } | null;
57
- }[] | undefined;
58
- id: string;
59
- platform: string;
60
- key: string;
61
- raw: unknown;
62
- type: string;
63
- } | {
64
- channel: string;
65
- thread: string;
66
- subthread: string | null;
67
- kind: "edited";
68
- message: string;
69
- text: string;
70
- author: {
71
- id: string;
72
- handle: string;
73
- name: string;
74
- avatar: string | null;
75
- isBot: boolean;
76
- };
77
- links?: {
78
- url: string;
79
- thread: string;
80
- message: string;
81
- snapshot: {
82
- author: string;
83
- text: string;
84
- createdAt: string | null;
85
- files: {
86
- name: string;
87
- url: string | null;
88
- }[];
89
- } | null;
90
- }[] | undefined;
91
- linksOnly?: boolean | undefined;
92
- id: string;
93
- platform: string;
94
- key: string;
95
- raw: unknown;
96
- type: string;
97
- } | {
98
- channel: string;
99
- thread: string;
100
- subthread: string | null;
101
- kind: "deleted";
102
- message: string;
103
- id: string;
104
- platform: string;
105
- key: string;
106
- raw: unknown;
107
- type: string;
108
- } | {
109
- channel: string;
110
- thread: string;
111
- subthread: string | null;
112
- kind: "reaction";
113
- message: string;
114
- emoji: string;
115
- added: boolean;
116
- author: {
117
- id: string;
118
- handle: string;
119
- name: string;
120
- avatar: string | null;
121
- isBot: boolean;
122
- };
123
- id: string;
124
- platform: string;
125
- key: string;
126
- raw: unknown;
127
- type: string;
128
- } | {
129
- channel: string;
130
- thread: string;
131
- subthread: string | null;
132
- kind: "lifecycle";
133
- title: string;
134
- url: string | null;
135
- body?: string | null | undefined;
136
- labels: Record<string, string>;
137
- unset: string[];
138
- owns?: string[] | undefined;
139
- reply: string | null;
140
- createRoot: boolean;
141
- retitled?: boolean | undefined;
142
- author: {
143
- id: string;
144
- handle: string;
145
- name: string;
146
- avatar: string | null;
147
- isBot: boolean;
148
- };
149
- id: string;
150
- platform: string;
151
- key: string;
152
- raw: unknown;
153
- type: string;
154
- };
155
- declare function eventSchema<P extends string, M extends string>(platform: P, messageType: M): z.ZodDiscriminatedUnion<[z.ZodObject<{
156
- channel: z.ZodString;
157
- thread: z.ZodString;
158
- subthread: z.ZodNullable<z.ZodString>;
159
- kind: z.ZodLiteral<"message">;
160
- message: z.ZodString;
161
- isRoot: z.ZodBoolean;
162
- text: z.ZodString;
163
- context: z.ZodNullable<z.ZodString>;
164
- author: z.ZodObject<{
165
- id: z.ZodString;
166
- handle: z.ZodString;
167
- name: z.ZodString;
168
- avatar: z.ZodNullable<z.ZodString>;
169
- isBot: z.ZodBoolean;
170
- }, z.core.$strip>;
171
- files: z.ZodOptional<z.ZodArray<z.ZodObject<{
172
- type: z.ZodEnum<{
173
- audio: "audio";
174
- file: "file";
175
- image: "image";
176
- video: "video";
177
- }>;
178
- name: z.ZodOptional<z.ZodString>;
179
- mimeType: z.ZodOptional<z.ZodString>;
180
- size: z.ZodOptional<z.ZodNumber>;
181
- url: z.ZodOptional<z.ZodString>;
182
- fetchMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
183
- }, z.core.$strip>>>;
184
- links: z.ZodOptional<z.ZodArray<z.ZodObject<{
185
- url: z.ZodString;
186
- thread: z.ZodString;
187
- message: z.ZodString;
188
- snapshot: z.ZodNullable<z.ZodObject<{
189
- author: z.ZodString;
190
- text: z.ZodString;
191
- createdAt: z.ZodNullable<z.ZodString>;
192
- files: z.ZodArray<z.ZodObject<{
193
- name: z.ZodString;
194
- url: z.ZodNullable<z.ZodString>;
195
- }, z.core.$strip>>;
196
- }, z.core.$strip>>;
197
- }, z.core.$strip>>>;
198
- id: z.ZodString;
199
- key: z.ZodString;
200
- raw: z.ZodUnknown;
201
- platform: z.ZodLiteral<P>;
202
- type: z.ZodLiteral<M>;
203
- }, z.core.$strip>, z.ZodObject<{
204
- channel: z.ZodString;
205
- thread: z.ZodString;
206
- subthread: z.ZodNullable<z.ZodString>;
207
- kind: z.ZodLiteral<"edited">;
208
- message: z.ZodString;
209
- text: z.ZodString;
210
- author: z.ZodObject<{
211
- id: z.ZodString;
212
- handle: z.ZodString;
213
- name: z.ZodString;
214
- avatar: z.ZodNullable<z.ZodString>;
215
- isBot: z.ZodBoolean;
216
- }, z.core.$strip>;
217
- links: z.ZodOptional<z.ZodArray<z.ZodObject<{
218
- url: z.ZodString;
219
- thread: z.ZodString;
220
- message: z.ZodString;
221
- snapshot: z.ZodNullable<z.ZodObject<{
222
- author: z.ZodString;
223
- text: z.ZodString;
224
- createdAt: z.ZodNullable<z.ZodString>;
225
- files: z.ZodArray<z.ZodObject<{
226
- name: z.ZodString;
227
- url: z.ZodNullable<z.ZodString>;
228
- }, z.core.$strip>>;
229
- }, z.core.$strip>>;
230
- }, z.core.$strip>>>;
231
- linksOnly: z.ZodOptional<z.ZodBoolean>;
232
- id: z.ZodString;
233
- key: z.ZodString;
234
- raw: z.ZodUnknown;
235
- platform: z.ZodLiteral<P>;
236
- type: z.ZodLiteral<"message.edited">;
237
- }, z.core.$strip>, z.ZodObject<{
238
- channel: z.ZodString;
239
- thread: z.ZodString;
240
- subthread: z.ZodNullable<z.ZodString>;
241
- kind: z.ZodLiteral<"deleted">;
242
- message: z.ZodString;
243
- id: z.ZodString;
244
- key: z.ZodString;
245
- raw: z.ZodUnknown;
246
- platform: z.ZodLiteral<P>;
247
- type: z.ZodLiteral<"message.deleted">;
248
- }, z.core.$strip>, z.ZodObject<{
249
- channel: z.ZodString;
250
- thread: z.ZodString;
251
- subthread: z.ZodNullable<z.ZodString>;
252
- kind: z.ZodLiteral<"reaction">;
253
- message: z.ZodString;
254
- emoji: z.ZodString;
255
- added: z.ZodBoolean;
256
- author: z.ZodObject<{
257
- id: z.ZodString;
258
- handle: z.ZodString;
259
- name: z.ZodString;
260
- avatar: z.ZodNullable<z.ZodString>;
261
- isBot: z.ZodBoolean;
262
- }, z.core.$strip>;
263
- id: z.ZodString;
264
- key: z.ZodString;
265
- raw: z.ZodUnknown;
266
- platform: z.ZodLiteral<P>;
267
- type: z.ZodEnum<{
268
- "reaction.added": "reaction.added";
269
- "reaction.removed": "reaction.removed";
270
- }>;
271
- }, z.core.$strip>, z.ZodObject<{
272
- channel: z.ZodString;
273
- thread: z.ZodString;
274
- subthread: z.ZodNullable<z.ZodString>;
275
- kind: z.ZodLiteral<"lifecycle">;
276
- type: z.ZodString;
277
- title: z.ZodString;
278
- url: z.ZodNullable<z.ZodString>;
279
- body: z.ZodOptional<z.ZodNullable<z.ZodString>>;
280
- labels: z.ZodRecord<z.ZodString, z.ZodString>;
281
- unset: z.ZodArray<z.ZodString>;
282
- owns: z.ZodOptional<z.ZodArray<z.ZodString>>;
283
- reply: z.ZodNullable<z.ZodString>;
284
- createRoot: z.ZodBoolean;
285
- retitled: z.ZodOptional<z.ZodBoolean>;
286
- author: z.ZodObject<{
287
- id: z.ZodString;
288
- handle: z.ZodString;
289
- name: z.ZodString;
290
- avatar: z.ZodNullable<z.ZodString>;
291
- isBot: z.ZodBoolean;
292
- }, z.core.$strip>;
293
- id: z.ZodString;
294
- key: z.ZodString;
295
- raw: z.ZodUnknown;
296
- platform: z.ZodLiteral<P>;
297
- }, z.core.$strip>], "kind">;
298
- type SyncRoot = {
299
- text: string;
300
- labels: Record<string, string>;
301
- author: ExternalAuthor;
302
- raw: unknown;
303
- };
304
- type RootOverride = (root: Readonly<SyncRoot>) => {
305
- text?: string;
306
- labels?: Record<string, string>;
307
- };
308
- declare const SyncOverrides: z.ZodObject<{
309
- root: z.ZodOptional<z.ZodCustom<RootOverride, RootOverride>>;
310
- text: z.ZodOptional<z.ZodString>;
311
- labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
312
- unset: z.ZodOptional<z.ZodArray<z.ZodString>>;
313
- noSync: z.ZodOptional<z.ZodBoolean>;
314
- }, z.core.$strict>;
315
- type SyncOverrides = z.infer<typeof SyncOverrides>;
316
- /** What an import made: its thread's root and the message, as IDs clients pass back as they got them. */
317
- type SyncResult = {
318
- root: string | null;
319
- message: string | null;
320
- };
321
- //#endregion
322
- //#region src/sync/fn.d.ts
323
- /** An event coming in from the platform. */
324
- type SyncIn<E extends ProviderEvent = ProviderEvent> = {
325
- direction: 'in';
326
- /** The sync entry's key: `slack` in `sync: { slack: slack(…) }`. */
327
- key: string;
328
- /** The platform channel it happened in, as the platform names it: `C0123ABC`, `owner/repo:pulls`, a phone number ID. */
329
- channel: string;
330
- /** The event, validated and frozen. */
331
- event: E;
332
- /** The board, as the platform user the event came from: its writes are theirs. */
333
- board: BoardClient;
334
- /**
335
- * Imports the event: into its board thread when the board syncs its platform thread, otherwise
336
- * as a new root in `channel`. Without a channel, an event in a thread the board doesn't sync
337
- * stays off it. Runs once: a second call answers what the first did.
338
- */
339
- import(channel?: string, overrides?: SyncOverrides): Promise<SyncResult>;
340
- /** The platform's own link to the event's message, or null when it has none. Nothing is synced or joined. */
341
- permalink(): Promise<string | null>;
342
- /** A platform channel's ID from its name (`#dev` → `C0123ABC`), as `channel` names it. */
343
- resolve(name: string): Promise<string>;
344
- };
345
- /** A board event going out to the platform. */
346
- type SyncOut = {
347
- direction: 'out';
348
- key: string;
349
- /** The platform channel `target` is in, as the platform names it; null for a new root, which isn't on the platform yet. */
350
- channel: string | null;
351
- event: BoardEventView;
352
- /** The message the event is about, as it is now. */
353
- message: MessageView;
354
- /** Where it goes: a platform thread or channel the board thread syncs with (`slack:C0123ABC:1727000000.123456`), or null for a new root. */
355
- target: string | null;
356
- /**
357
- * Sends the event to `target`: a new thread's root and what's been said in it, a reply, an
358
- * edit, a delete, a reaction, or the copy a label change re-renders. A new root has no target
359
- * yet, so it sends nothing. Runs once: a second call answers what the first did.
360
- */
361
- deliver(options?: {
362
- render?: Renderer;
363
- }): Promise<void>;
364
- /**
365
- * Syncs the message's thread with a platform channel (`#dev`, `C0123ABC`): the board starts a
366
- * thread there, and its root and replies follow. Never the channel it came from.
367
- */
368
- start(channel: string): Promise<void>;
369
- resolve(name: string): Promise<string>;
370
- };
371
- type Sync<E extends ProviderEvent = ProviderEvent> = SyncIn<E> | SyncOut;
372
- /**
373
- * What every event does, both ways. Inbound, it calls `import` to bring the event onto the board;
374
- * outbound, `deliver` to send it to the platform, or `start` to open a new root's thread there.
375
- * One that calls neither does nothing. A throw is retried.
376
- *
377
- * The webhook keeps an event (stores it in the inbox for the function) when the board syncs its
378
- * thread, or when its channel is one that `channels`, `repos`, or `numbers` routes. A function of
379
- * your own at the top keeps every event the platform sends, so keep the helper outermost.
380
- */
381
- type SyncFn<E extends ProviderEvent = ProviderEvent> = (sync: Sync<E>) => unknown;
382
- /** A sync function, or a board channel: what a string means is up to the helper that takes it. */
383
- type SyncUnit<E extends ProviderEvent = ProviderEvent> = string | SyncFn<E>;
384
- /**
385
- * A two-way mirror of a board channel: what comes in lands in `channel`, what's said on the
386
- * board goes out, and a new root in `channel` starts a thread in the platform channel.
387
- */
388
- declare function mirror(channel: string): SyncFn;
389
- /** Imports into a board channel, and sends nothing back. */
390
- declare function into(channel: string): SyncFn;
391
- /** `inner`, delivering with `renderer` unless it passes its own. */
392
- declare function render<E extends ProviderEvent = ProviderEvent>(renderer: Renderer, inner: SyncFn<E>): SyncFn<E>;
393
- /**
394
- * Routes each event by its platform channel. Keys are platform channels, by name (`'#dev'`) or
395
- * ID (`'C0123ABC'`); values are a board channel to `mirror`, or a sync function. A new root goes
396
- * to every channel's function, with `channel` set to that one. A thread the board syncs outside
397
- * these channels (someone ran `vb sync` on it) stays synced both ways. A key the platform says
398
- * doesn't exist is skipped. While one can't be checked, an event outside the resolved channels
399
- * throws, so it's retried, rather than going past that key's function to the default. A new root
400
- * starts only in the channels that resolved.
401
- */
402
- declare function channels<E extends ProviderEvent = ProviderEvent>(map: Record<string, SyncUnit<E>>): SyncFn<E>;
403
- //#endregion
404
- //#region src/sync/provider.d.ts
405
- declare const ResolvedTarget: z.ZodObject<{
406
- target: z.ZodString;
407
- channel: z.ZodString;
408
- kind: z.ZodEnum<{
409
- channel: "channel";
410
- thread: "thread";
411
- }>;
412
- }, z.core.$strict>;
413
- type ResolvedTarget = z.infer<typeof ResolvedTarget>;
414
- /** The fields a provider's `event` builds its typed event from. */
415
- type SyncContext = {
416
- id: string;
417
- key: string;
418
- event: ExternalEvent;
419
- raw: unknown;
420
- };
421
- type RenderInput = {
422
- /** The message as clients see it: its IDs are refs. */
423
- message: Readonly<MessageView>;
424
- author: Readonly<Actor> | null;
425
- /** How this platform mentions an actor when it's one of its own (`<@U123>`); null for anyone else. */
426
- mentionOf: (actor: string) => string | null;
427
- label: string;
428
- target: string;
429
- };
430
- /** How a platform shows a board message: markdown, which the platform converts to its own format. */
431
- type Renderer = (input: RenderInput) => string;
432
- type FileDelivery = {
433
- message: string;
434
- files: string[];
435
- };
436
- /** What a linked message said, or why the platform wouldn't say. */
437
- type FetchedLink = Pick<Link, 'snapshot' | 'unavailable'>;
438
- /** Why a platform wouldn't read a channel or thread on demand. Its message is shown as is. */
439
- declare class UnreadableError extends Error {
440
- readonly code: string;
441
- constructor(code: string, message: string);
442
- }
443
- /** A file to send: its bytes (a Node `Buffer` is one), its name, and its type. */
444
- type ProviderFile = {
445
- data: Uint8Array;
446
- filename: string;
447
- mimeType?: string;
448
- };
449
- /**
450
- * Who a post is from, for a platform that can show it as the sender (Slack's per-message
451
- * username and icon): `name` is the label the text opens with (`**name**: …`).
452
- */
453
- type ProviderSender = {
454
- name: string;
455
- avatar: string | null;
456
- };
457
- type ProviderPost = {
458
- markdown: string;
459
- files?: ProviderFile[];
460
- as?: ProviderSender;
461
- };
462
- type ProviderDelivery = {
463
- thread: string;
464
- message: string;
465
- files?: string[];
466
- };
467
- type ProviderOptions = {
468
- platform: string;
469
- canStartThreads?: boolean;
470
- singleReaction?: boolean;
471
- uploadsFiles?: boolean;
472
- /** Whether a new thread's root can carry its files in the same message as its text. */
473
- startsThreadsWithFiles?: boolean;
474
- };
475
- declare const ReceivedEvent: z.ZodObject<{
476
- event: z.ZodDiscriminatedUnion<[z.ZodObject<{
477
- channel: z.ZodString;
478
- thread: z.ZodString;
479
- subthread: z.ZodNullable<z.ZodString>;
480
- kind: z.ZodLiteral<"message">;
481
- message: z.ZodString;
482
- isRoot: z.ZodBoolean;
483
- text: z.ZodString;
484
- context: z.ZodNullable<z.ZodString>;
485
- author: z.ZodObject<{
486
- id: z.ZodString;
487
- handle: z.ZodString;
488
- name: z.ZodString;
489
- avatar: z.ZodNullable<z.ZodString>;
490
- isBot: z.ZodBoolean;
491
- }, z.core.$strip>;
492
- files: z.ZodOptional<z.ZodArray<z.ZodObject<{
493
- type: z.ZodEnum<{
494
- audio: "audio";
495
- file: "file";
496
- image: "image";
497
- video: "video";
498
- }>;
499
- name: z.ZodOptional<z.ZodString>;
500
- mimeType: z.ZodOptional<z.ZodString>;
501
- size: z.ZodOptional<z.ZodNumber>;
502
- url: z.ZodOptional<z.ZodString>;
503
- fetchMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
504
- }, z.core.$strip>>>;
505
- links: z.ZodOptional<z.ZodArray<z.ZodObject<{
506
- url: z.ZodString;
507
- thread: z.ZodString;
508
- message: z.ZodString;
509
- snapshot: z.ZodNullable<z.ZodObject<{
510
- author: z.ZodString;
511
- text: z.ZodString;
512
- createdAt: z.ZodNullable<z.ZodString>;
513
- files: z.ZodArray<z.ZodObject<{
514
- name: z.ZodString;
515
- url: z.ZodNullable<z.ZodString>;
516
- }, z.core.$strip>>;
517
- }, z.core.$strip>>;
518
- }, z.core.$strip>>>;
519
- }, z.core.$strip>, z.ZodObject<{
520
- channel: z.ZodString;
521
- thread: z.ZodString;
522
- subthread: z.ZodNullable<z.ZodString>;
523
- kind: z.ZodLiteral<"edited">;
524
- message: z.ZodString;
525
- text: z.ZodString;
526
- author: z.ZodObject<{
527
- id: z.ZodString;
528
- handle: z.ZodString;
529
- name: z.ZodString;
530
- avatar: z.ZodNullable<z.ZodString>;
531
- isBot: z.ZodBoolean;
532
- }, z.core.$strip>;
533
- links: z.ZodOptional<z.ZodArray<z.ZodObject<{
534
- url: z.ZodString;
535
- thread: z.ZodString;
536
- message: z.ZodString;
537
- snapshot: z.ZodNullable<z.ZodObject<{
538
- author: z.ZodString;
539
- text: z.ZodString;
540
- createdAt: z.ZodNullable<z.ZodString>;
541
- files: z.ZodArray<z.ZodObject<{
542
- name: z.ZodString;
543
- url: z.ZodNullable<z.ZodString>;
544
- }, z.core.$strip>>;
545
- }, z.core.$strip>>;
546
- }, z.core.$strip>>>;
547
- linksOnly: z.ZodOptional<z.ZodBoolean>;
548
- }, z.core.$strip>, z.ZodObject<{
549
- channel: z.ZodString;
550
- thread: z.ZodString;
551
- subthread: z.ZodNullable<z.ZodString>;
552
- kind: z.ZodLiteral<"deleted">;
553
- message: z.ZodString;
554
- }, z.core.$strip>, z.ZodObject<{
555
- channel: z.ZodString;
556
- thread: z.ZodString;
557
- subthread: z.ZodNullable<z.ZodString>;
558
- kind: z.ZodLiteral<"reaction">;
559
- message: z.ZodString;
560
- emoji: z.ZodString;
561
- added: z.ZodBoolean;
562
- author: z.ZodObject<{
563
- id: z.ZodString;
564
- handle: z.ZodString;
565
- name: z.ZodString;
566
- avatar: z.ZodNullable<z.ZodString>;
567
- isBot: z.ZodBoolean;
568
- }, z.core.$strip>;
569
- }, z.core.$strip>, z.ZodObject<{
570
- channel: z.ZodString;
571
- thread: z.ZodString;
572
- kind: z.ZodLiteral<"lifecycle">;
573
- type: z.ZodString;
574
- title: z.ZodString;
575
- url: z.ZodNullable<z.ZodString>;
576
- body: z.ZodOptional<z.ZodNullable<z.ZodString>>;
577
- labels: z.ZodRecord<z.ZodString, z.ZodString>;
578
- unset: z.ZodArray<z.ZodString>;
579
- owns: z.ZodOptional<z.ZodArray<z.ZodString>>;
580
- reply: z.ZodNullable<z.ZodString>;
581
- createRoot: z.ZodBoolean;
582
- retitled: z.ZodOptional<z.ZodBoolean>;
583
- author: z.ZodObject<{
584
- id: z.ZodString;
585
- handle: z.ZodString;
586
- name: z.ZodString;
587
- avatar: z.ZodNullable<z.ZodString>;
588
- isBot: z.ZodBoolean;
589
- }, z.core.$strip>;
590
- }, z.core.$strip>], "kind">;
591
- raw: z.ZodUnknown;
592
- dedupe: z.ZodString;
593
- }, z.core.$strip>;
594
- type ReceivedEvent = z.infer<typeof ReceivedEvent>;
595
- type Receive = (received: ReceivedEvent) => Promise<void>;
596
- declare abstract class SyncProvider<E extends ProviderEvent = ProviderEvent> {
597
- readonly platform: string;
598
- readonly canStartThreads: boolean;
599
- readonly singleReaction: boolean;
600
- readonly uploadsFiles: boolean;
601
- readonly startsThreadsWithFiles: boolean;
602
- private readonly fn;
603
- protected readonly options: ProviderOptions;
604
- constructor(options: ProviderOptions, sync: SyncFn<E>);
605
- abstract receive(key: string, request: Request, emit: Receive): Promise<Response>;
606
- abstract resolveChannel(key: string): Promise<string>;
607
- abstract resolveTarget(target: string): Promise<ResolvedTarget>;
608
- abstract post(target: string, kind: ResolvedTarget['kind'], body: ProviderPost): Promise<ProviderDelivery>;
609
- findByEmail(_email: string): Promise<ExternalAuthor | null>;
610
- mention(_actor: Actor): string | null;
611
- fetchRoot(_thread: string): Promise<SyncRoot | null>;
612
- fetchFile(_file: ExternalFile): Promise<Uint8Array | null>;
613
- /** The platform's own link to an event's message, or null when it has none. */
614
- permalink(_event: E): Promise<string | null>;
615
- /**
616
- * A linked message the platform didn't describe, read from the platform. `linker` is the
617
- * platform message that links it, by its own IDs: what the platform says about the link may be
618
- * there by now.
619
- */
620
- fetchLink(_link: ExternalLink, _linker: {
621
- thread: string;
622
- message: string;
623
- }): Promise<FetchedLink>;
624
- /**
625
- * The message a URL of this platform's names, by its own thread and message IDs, or null for a
626
- * URL that isn't one. `message` is null for a link to a thread itself. It asks the platform
627
- * nothing: the board answers from what it synced (`vb read <url>`).
628
- */
629
- locate(_url: string): {
630
- thread: string;
631
- message: string | null;
632
- } | null;
633
- /** The platform's URL for one of its messages, by its own IDs, or null when it has none (`vb sync <id>`). */
634
- url(_thread: string, _message: string): Promise<string | null>;
635
- /**
636
- * A channel or thread, read on demand for whoever asked: nothing is synced,
637
- * stored, or joined. Throws `UnreadableError` for what it won't read.
638
- */
639
- read(_target: string, _options: {
640
- limit: number;
641
- after: string | null;
642
- }): Promise<SourceRead>;
643
- /** Adds the board's app to a channel so `read` can read it, where the board opted in. Throws `UnreadableError` otherwise. */
644
- join(_target: string): Promise<SourceJoin>;
645
- edit(_thread: string, _message: string, _body: ProviderPost): Promise<void>;
646
- delete(_thread: string, _message: string): Promise<void>;
647
- react(_thread: string, _message: string, _emoji: string, _added: boolean): Promise<void>;
648
- startTyping(_thread: string, _latest: string | null, _status?: string): Promise<void>;
649
- /**
650
- * The channel whose inbox a thread's events land in (`slack:C0123ABC` for `slack:C0123ABC:1727.1234`),
651
- * worked out without calling the platform. Null when the provider can't tell: a key's inbox then
652
- * lists only the mapped channels'.
653
- */
654
- inboxChannel(_key: string, _thread: string): string | null;
655
- deleteFiles(_ids: string[]): Promise<void>;
656
- refusesFiles(_error: unknown): boolean;
657
- uploadFiles(_thread: string, _files: ProviderFile[]): Promise<FileDelivery>;
658
- abstract event(context: SyncContext): E;
659
- /** Runs the sync function the provider was made with: what every event does, both ways. */
660
- sync(sync: Sync<E>): unknown;
661
- /** The default rendering: `**${label}**: ${text}`. A `Renderer` passed to `deliver` replaces it. */
662
- render(input: RenderInput): string;
663
- }
664
- //#endregion
665
- export { envelope as A, render as C, SyncOverrides as D, RootOverride as E, SyncResult as O, mirror as S, ProviderEvent as T, SyncIn as _, ProviderOptions as a, channels as b, ReceivedEvent as c, ResolvedTarget as d, SyncContext as f, SyncFn as g, Sync as h, ProviderFile as i, eventSchema as j, SyncRoot as k, RenderInput as l, UnreadableError as m, FileDelivery as n, ProviderPost as o, SyncProvider as p, ProviderDelivery as r, Receive as s, FetchedLink as t, Renderer as u, SyncOut as v, EventBase as w, into as x, SyncUnit as y };