@vercel/board 0.25.0 → 0.25.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 (72) hide show
  1. package/dist/{a2-CQ3WcqMv.mjs → a2-A830f5NS.mjs} +6 -6
  2. package/dist/access.d.mts +1 -2
  3. package/dist/access.mjs +3 -3
  4. package/dist/{actors-CDDhhFNY.mjs → actors-BLXVp4oZ.mjs} +2 -2
  5. package/dist/{auth-BwWH3Twu.mjs → auth-lTkOgvcE.mjs} +1 -1
  6. package/dist/{backend-DmXjVnil.d.mts → backend-ZKYTe3xa.d.mts} +5 -15
  7. package/dist/backend-a2/blob-vercel.d.mts +1 -1
  8. package/dist/backend-a2/contract.d.mts +1 -2
  9. package/dist/backend-a2/store-memory.d.mts +1 -1
  10. package/dist/backend-a2/store-postgres.d.mts +1 -1
  11. package/dist/backend-a2/store-redis-http.d.mts +1 -1
  12. package/dist/backend-a2/store-redis.d.mts +1 -1
  13. package/dist/backend-a2/store-sqlite.d.mts +1 -1
  14. package/dist/backend-a2.d.mts +5 -6
  15. package/dist/backend-a2.mjs +1 -1
  16. package/dist/{backend-http-Cs-UKpYp.mjs → backend-http-CJd4Fu0U.mjs} +2 -2
  17. package/dist/{backend-http-BJ7AdK0c.mjs → backend-http-CYtfwqAW.mjs} +8 -5
  18. package/dist/{backend-http-BsP0Xq9e.d.mts → backend-http-E7YU0qhn.d.mts} +3 -4
  19. package/dist/backend-http.d.mts +1 -1
  20. package/dist/backend-http.mjs +1 -1
  21. package/dist/backend-http.node.d.mts +1 -1
  22. package/dist/backend-http.node.mjs +1 -1
  23. package/dist/{backend-vercel-CG2SYa03.mjs → backend-vercel-BhwPExmE.mjs} +3 -3
  24. package/dist/{backend-vercel-B0Q0K0O5.mjs → backend-vercel-Bqg2QfTd.mjs} +7 -4
  25. package/dist/{backend-vercel-CED673bx.d.mts → backend-vercel-CIRObA0t.d.mts} +3 -4
  26. package/dist/backend-vercel.d.mts +1 -1
  27. package/dist/backend-vercel.mjs +1 -1
  28. package/dist/backend-vercel.node.d.mts +1 -1
  29. package/dist/backend-vercel.node.mjs +1 -1
  30. package/dist/{blob-C0J3wbGv.d.mts → blob-B-9AvYis.d.mts} +2 -1
  31. package/dist/{chat-provider-6eYkL2ef.d.mts → chat-provider-DsNEBQiA.d.mts} +3 -2
  32. package/dist/cli-embedded.d.mts +2 -2
  33. package/dist/cli-embedded.mjs +1 -1
  34. package/dist/cli.mjs +3 -3
  35. package/dist/{client-BY-BCggB.mjs → client-D0Px7KzF.mjs} +16 -4
  36. package/dist/{provider-C_sj4-GL.d.mts → client-xLxeDz0f.d.mts} +13 -689
  37. package/dist/{conformance-BZ53bxrG.mjs → conformance-DlnfuzEB.mjs} +1 -1
  38. package/dist/conformance.d.mts +1 -1
  39. package/dist/conformance.mjs +1 -1
  40. package/dist/{engine-SeaJ_CIY.mjs → engine-ROa7-IQY.mjs} +2 -2
  41. package/dist/errors-CB4tnZGz.d.mts +16 -0
  42. package/dist/{errors-Bven0k29.mjs → errors-CusN4x2l.mjs} +14 -6
  43. package/dist/exports-D22M68rk.d.mts +5 -0
  44. package/dist/{exports-ByvYtxFT.mjs → exports-DCqgO_mr.mjs} +6 -6
  45. package/dist/{folds-CRYY14kc.d.mts → folds-jS9wlh9_.d.mts} +49 -2
  46. package/dist/{index-k2LfZxl-.d.mts → index-C05it0mC.d.mts} +2 -2
  47. package/dist/index.d.mts +5 -4
  48. package/dist/{index.default-DmfhBZZi.mjs → index.default-BejExznB.mjs} +1 -1
  49. package/dist/index.mjs +6 -6
  50. package/dist/index.node.d.mts +5 -4
  51. package/dist/index.node.mjs +4 -4
  52. package/dist/inspect/app.js +108 -108
  53. package/dist/{main-BNkywL2P.mjs → main-DOhNCWMd.mjs} +70 -65
  54. package/dist/{middleware-B0J7QBq7.mjs → middleware-ChKM1zuu.mjs} +1 -1
  55. package/dist/{node-C51_xzCb.mjs → node-Bkd1x0QI.mjs} +37 -9
  56. package/dist/provider-Cdg1qadh.d.mts +688 -0
  57. package/dist/{serve-DYQ64Q5R.mjs → serve-D2O0C6Kk.mjs} +5 -5
  58. package/dist/{server-BgK1sgj7.mjs → server-BF4WJ7qi.mjs} +4 -4
  59. package/dist/{serving-rXQcEgTO.mjs → serving-CvOWEym2.mjs} +1 -1
  60. package/dist/sync-github.d.mts +2 -2
  61. package/dist/sync-kapso.d.mts +2 -2
  62. package/dist/sync-linear.d.mts +2 -2
  63. package/dist/sync-slack.d.mts +3 -3
  64. package/dist/sync.chat.d.mts +1 -1
  65. package/dist/sync.d.mts +2 -2
  66. package/dist/{tokens-U-XRlEfq.mjs → tokens-BuCU-61R.mjs} +2 -2
  67. package/dist/{types-8yq2VnKI.d.mts → types-aCAf6lGU.d.mts} +1 -1
  68. package/dist/{watchers-hash-C4CJg7K1.mjs → watchers-hash-BHNXy_N7.mjs} +2 -2
  69. package/docs/04-reference/02-board.md +6 -2
  70. package/package.json +1 -1
  71. package/dist/exports-CPrIkpz3.d.mts +0 -4
  72. package/dist/schemas-CWxs3ECJ.d.mts +0 -50
@@ -0,0 +1,688 @@
1
+ import { d as ExternalFile, f as ExternalLink, l as ExternalAuthor, p as Link, t as Actor, u as ExternalEvent } from "./folds-jS9wlh9_.mjs";
2
+ import { V as MessageView, _ as BoardEventView, dt as SourceJoin, mt as SourceRead, t as BoardClient } from "./client-xLxeDz0f.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
+ labels: Record<string, string>;
136
+ unset: string[];
137
+ owns?: string[] | undefined;
138
+ reply: string | null;
139
+ createRoot: boolean;
140
+ retitled?: boolean | undefined;
141
+ author: {
142
+ id: string;
143
+ handle: string;
144
+ name: string;
145
+ avatar: string | null;
146
+ isBot: boolean;
147
+ };
148
+ id: string;
149
+ platform: string;
150
+ key: string;
151
+ raw: unknown;
152
+ type: string;
153
+ };
154
+ declare function eventSchema<P extends string, M extends string>(platform: P, messageType: M): z.ZodDiscriminatedUnion<[z.ZodObject<{
155
+ channel: z.ZodString;
156
+ thread: z.ZodString;
157
+ subthread: z.ZodNullable<z.ZodString>;
158
+ kind: z.ZodLiteral<"message">;
159
+ message: z.ZodString;
160
+ isRoot: z.ZodBoolean;
161
+ text: z.ZodString;
162
+ context: z.ZodNullable<z.ZodString>;
163
+ author: z.ZodObject<{
164
+ id: z.ZodString;
165
+ handle: z.ZodString;
166
+ name: z.ZodString;
167
+ avatar: z.ZodNullable<z.ZodString>;
168
+ isBot: z.ZodBoolean;
169
+ }, z.core.$strip>;
170
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
171
+ type: z.ZodEnum<{
172
+ audio: "audio";
173
+ file: "file";
174
+ image: "image";
175
+ video: "video";
176
+ }>;
177
+ name: z.ZodOptional<z.ZodString>;
178
+ mimeType: z.ZodOptional<z.ZodString>;
179
+ size: z.ZodOptional<z.ZodNumber>;
180
+ url: z.ZodOptional<z.ZodString>;
181
+ fetchMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
182
+ }, z.core.$strip>>>;
183
+ links: z.ZodOptional<z.ZodArray<z.ZodObject<{
184
+ url: z.ZodString;
185
+ thread: z.ZodString;
186
+ message: z.ZodString;
187
+ snapshot: z.ZodNullable<z.ZodObject<{
188
+ author: z.ZodString;
189
+ text: z.ZodString;
190
+ createdAt: z.ZodNullable<z.ZodString>;
191
+ files: z.ZodArray<z.ZodObject<{
192
+ name: z.ZodString;
193
+ url: z.ZodNullable<z.ZodString>;
194
+ }, z.core.$strip>>;
195
+ }, z.core.$strip>>;
196
+ }, z.core.$strip>>>;
197
+ id: z.ZodString;
198
+ key: z.ZodString;
199
+ raw: z.ZodUnknown;
200
+ platform: z.ZodLiteral<P>;
201
+ type: z.ZodLiteral<M>;
202
+ }, z.core.$strip>, z.ZodObject<{
203
+ channel: z.ZodString;
204
+ thread: z.ZodString;
205
+ subthread: z.ZodNullable<z.ZodString>;
206
+ kind: z.ZodLiteral<"edited">;
207
+ message: z.ZodString;
208
+ text: z.ZodString;
209
+ author: z.ZodObject<{
210
+ id: z.ZodString;
211
+ handle: z.ZodString;
212
+ name: z.ZodString;
213
+ avatar: z.ZodNullable<z.ZodString>;
214
+ isBot: z.ZodBoolean;
215
+ }, z.core.$strip>;
216
+ links: z.ZodOptional<z.ZodArray<z.ZodObject<{
217
+ url: z.ZodString;
218
+ thread: z.ZodString;
219
+ message: z.ZodString;
220
+ snapshot: z.ZodNullable<z.ZodObject<{
221
+ author: z.ZodString;
222
+ text: z.ZodString;
223
+ createdAt: z.ZodNullable<z.ZodString>;
224
+ files: z.ZodArray<z.ZodObject<{
225
+ name: z.ZodString;
226
+ url: z.ZodNullable<z.ZodString>;
227
+ }, z.core.$strip>>;
228
+ }, z.core.$strip>>;
229
+ }, z.core.$strip>>>;
230
+ linksOnly: z.ZodOptional<z.ZodBoolean>;
231
+ id: z.ZodString;
232
+ key: z.ZodString;
233
+ raw: z.ZodUnknown;
234
+ platform: z.ZodLiteral<P>;
235
+ type: z.ZodLiteral<"message.edited">;
236
+ }, z.core.$strip>, z.ZodObject<{
237
+ channel: z.ZodString;
238
+ thread: z.ZodString;
239
+ subthread: z.ZodNullable<z.ZodString>;
240
+ kind: z.ZodLiteral<"deleted">;
241
+ message: z.ZodString;
242
+ id: z.ZodString;
243
+ key: z.ZodString;
244
+ raw: z.ZodUnknown;
245
+ platform: z.ZodLiteral<P>;
246
+ type: z.ZodLiteral<"message.deleted">;
247
+ }, z.core.$strip>, z.ZodObject<{
248
+ channel: z.ZodString;
249
+ thread: z.ZodString;
250
+ subthread: z.ZodNullable<z.ZodString>;
251
+ kind: z.ZodLiteral<"reaction">;
252
+ message: z.ZodString;
253
+ emoji: z.ZodString;
254
+ added: z.ZodBoolean;
255
+ author: z.ZodObject<{
256
+ id: z.ZodString;
257
+ handle: z.ZodString;
258
+ name: z.ZodString;
259
+ avatar: z.ZodNullable<z.ZodString>;
260
+ isBot: z.ZodBoolean;
261
+ }, z.core.$strip>;
262
+ id: z.ZodString;
263
+ key: z.ZodString;
264
+ raw: z.ZodUnknown;
265
+ platform: z.ZodLiteral<P>;
266
+ type: z.ZodEnum<{
267
+ "reaction.added": "reaction.added";
268
+ "reaction.removed": "reaction.removed";
269
+ }>;
270
+ }, z.core.$strip>, z.ZodObject<{
271
+ channel: z.ZodString;
272
+ thread: z.ZodString;
273
+ subthread: z.ZodNullable<z.ZodString>;
274
+ kind: z.ZodLiteral<"lifecycle">;
275
+ type: z.ZodString;
276
+ title: z.ZodString;
277
+ url: z.ZodNullable<z.ZodString>;
278
+ labels: z.ZodRecord<z.ZodString, z.ZodString>;
279
+ unset: z.ZodArray<z.ZodString>;
280
+ owns: z.ZodOptional<z.ZodArray<z.ZodString>>;
281
+ reply: z.ZodNullable<z.ZodString>;
282
+ createRoot: z.ZodBoolean;
283
+ retitled: z.ZodOptional<z.ZodBoolean>;
284
+ author: z.ZodObject<{
285
+ id: z.ZodString;
286
+ handle: z.ZodString;
287
+ name: z.ZodString;
288
+ avatar: z.ZodNullable<z.ZodString>;
289
+ isBot: z.ZodBoolean;
290
+ }, z.core.$strip>;
291
+ id: z.ZodString;
292
+ key: z.ZodString;
293
+ raw: z.ZodUnknown;
294
+ platform: z.ZodLiteral<P>;
295
+ }, z.core.$strip>], "kind">;
296
+ type SyncRoot = {
297
+ text: string;
298
+ labels: Record<string, string>;
299
+ author: ExternalAuthor;
300
+ raw: unknown;
301
+ };
302
+ type RootOverride = (root: Readonly<SyncRoot>) => {
303
+ text?: string;
304
+ labels?: Record<string, string>;
305
+ };
306
+ declare const SyncOverrides: z.ZodObject<{
307
+ root: z.ZodOptional<z.ZodCustom<RootOverride, RootOverride>>;
308
+ text: z.ZodOptional<z.ZodString>;
309
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
310
+ unset: z.ZodOptional<z.ZodArray<z.ZodString>>;
311
+ noSync: z.ZodOptional<z.ZodBoolean>;
312
+ }, z.core.$strict>;
313
+ type SyncOverrides = z.infer<typeof SyncOverrides>;
314
+ /** What an import made: its thread's root and the message, as IDs clients pass back as they got them. */
315
+ type SyncResult = {
316
+ root: string | null;
317
+ message: string | null;
318
+ };
319
+ //#endregion
320
+ //#region src/sync/fn.d.ts
321
+ /** An event coming in from the platform. */
322
+ type SyncIn<E extends ProviderEvent = ProviderEvent> = {
323
+ direction: 'in';
324
+ /** The sync entry's key: `slack` in `sync: { slack: slack(…) }`. */
325
+ key: string;
326
+ /** The platform channel it happened in, as the platform names it: `C0123ABC`, `owner/repo:pulls`, a phone number ID. */
327
+ channel: string;
328
+ /** The event, validated and frozen. */
329
+ event: E;
330
+ /** The board, as the platform user the event came from: its writes are theirs. */
331
+ board: BoardClient;
332
+ /**
333
+ * Imports the event: into its board thread when the board syncs its platform thread, otherwise
334
+ * as a new root in `channel`. Without a channel, an event in a thread the board doesn't sync
335
+ * stays off it. Runs once: a second call answers what the first did.
336
+ */
337
+ import(channel?: string, overrides?: SyncOverrides): Promise<SyncResult>;
338
+ /** The platform's own link to the event's message, or null when it has none. Nothing is synced or joined. */
339
+ permalink(): Promise<string | null>;
340
+ /** A platform channel's ID from its name (`#dev` → `C0123ABC`), as `channel` names it. */
341
+ resolve(name: string): Promise<string>;
342
+ };
343
+ /** A board event going out to the platform. */
344
+ type SyncOut = {
345
+ direction: 'out';
346
+ key: string;
347
+ /** The platform channel `target` is in, as the platform names it; null for a new root, which isn't on the platform yet. */
348
+ channel: string | null;
349
+ event: BoardEventView;
350
+ /** The message the event is about, as it is now. */
351
+ message: MessageView;
352
+ /** Where it goes: a platform thread or channel the board thread syncs with (`slack:C0123ABC:1727000000.123456`), or null for a new root. */
353
+ target: string | null;
354
+ /**
355
+ * Sends the event to `target`: a new thread's root and what's been said in it, a reply, an
356
+ * edit, a delete, a reaction, or the copy a label change re-renders. A new root has no target
357
+ * yet, so it sends nothing. Runs once: a second call answers what the first did.
358
+ */
359
+ deliver(options?: {
360
+ render?: Renderer;
361
+ }): Promise<void>;
362
+ /**
363
+ * Syncs the message's thread with a platform channel (`#dev`, `C0123ABC`): the board starts a
364
+ * thread there, and its root and replies follow. Never the channel it came from.
365
+ */
366
+ start(channel: string): Promise<void>;
367
+ resolve(name: string): Promise<string>;
368
+ };
369
+ type Sync<E extends ProviderEvent = ProviderEvent> = SyncIn<E> | SyncOut;
370
+ /**
371
+ * What every event does, both ways. Inbound, it calls `import` to bring the event onto the board;
372
+ * outbound, `deliver` to send it to the platform, or `start` to open a new root's thread there.
373
+ * One that calls neither does nothing. A throw is retried.
374
+ *
375
+ * The webhook keeps an event (stores it in the inbox for the function) when the board syncs its
376
+ * thread, or when its channel is one that `channels`, `repos`, or `numbers` routes. A function of
377
+ * your own at the top keeps every event the platform sends, so keep the helper outermost.
378
+ */
379
+ type SyncFn<E extends ProviderEvent = ProviderEvent> = (sync: Sync<E>) => unknown;
380
+ /** A sync function, or a board channel: what a string means is up to the helper that takes it. */
381
+ type SyncUnit<E extends ProviderEvent = ProviderEvent> = string | SyncFn<E>;
382
+ /**
383
+ * A two-way mirror of a board channel: what comes in lands in `channel`, what's said on the
384
+ * board goes out, and a new root in `channel` starts a thread in the platform channel.
385
+ */
386
+ declare function mirror(channel: string): SyncFn;
387
+ /** Imports into a board channel, and sends nothing back. */
388
+ declare function into(channel: string): SyncFn;
389
+ /** `inner`, delivering with `renderer` unless it passes its own. */
390
+ declare function render<E extends ProviderEvent = ProviderEvent>(renderer: Renderer, inner: SyncFn<E>): SyncFn<E>;
391
+ /**
392
+ * Routes each event by its platform channel. Keys are platform channels, by name (`'#dev'`) or
393
+ * ID (`'C0123ABC'`); values are a board channel to `mirror`, or a sync function. A new root goes
394
+ * to every channel's function, with `channel` set to that one. A thread the board syncs outside
395
+ * these channels (someone ran `vb sync` on it) stays synced both ways. A key the platform says
396
+ * doesn't exist is skipped. While one can't be checked, an event outside the resolved channels
397
+ * throws, so it's retried, rather than going past that key's function to the default. A new root
398
+ * starts only in the channels that resolved.
399
+ */
400
+ declare function channels<E extends ProviderEvent = ProviderEvent>(map: Record<string, SyncUnit<E>>): SyncFn<E>;
401
+ //#endregion
402
+ //#region src/sync/users.d.ts
403
+ /**
404
+ * People's own platform tokens, so a board message they wrote reaches Slack or
405
+ * GitHub as them, and signing in proves an account is theirs. The board never
406
+ * stores a token: it asks for one at each delivery, and a person without one
407
+ * (never signed in, revoked, expired) is delivered as the bot, as before.
408
+ */
409
+ type UserTokens = {
410
+ /**
411
+ * A sign-in URL that binds whoever completes it to `principal`. Show it only to them. With
412
+ * `callback`, the platform sends them there once they've approved.
413
+ */
414
+ authorize(principal: string, options?: {
415
+ callback?: string;
416
+ }): Promise<string>;
417
+ /** `principal`'s token on the platform, or null when they haven't signed in. */
418
+ token(principal: string): Promise<string | null>;
419
+ };
420
+ /**
421
+ * Gives an adapter people's tokens, for your own OAuth: `slack({ adapter:
422
+ * withUserTokens(createSlackAdapter(...), { authorize, token }) }, sync)`. A
423
+ * Connect connector name (`slack('slack/acme', sync)`) does this for you.
424
+ */
425
+ declare function withUserTokens<A extends object>(adapter: A, tokens: UserTokens): A;
426
+ /** Vercel Connect's user tokens for `connector`: the subject is the board's principal, so Connect binds the account to it. */
427
+ declare function connectUserTokens(connector: string): UserTokens;
428
+ //#endregion
429
+ //#region src/sync/provider.d.ts
430
+ declare const ResolvedTarget: z.ZodObject<{
431
+ target: z.ZodString;
432
+ channel: z.ZodString;
433
+ kind: z.ZodEnum<{
434
+ channel: "channel";
435
+ thread: "thread";
436
+ }>;
437
+ }, z.core.$strict>;
438
+ type ResolvedTarget = z.infer<typeof ResolvedTarget>;
439
+ /** The fields a provider's `event` builds its typed event from. */
440
+ type SyncContext = {
441
+ id: string;
442
+ key: string;
443
+ event: ExternalEvent;
444
+ raw: unknown;
445
+ };
446
+ type RenderInput = {
447
+ /** The message as clients see it: its IDs are refs. */
448
+ message: Readonly<MessageView>;
449
+ author: Readonly<Actor> | null;
450
+ /** How this platform mentions an actor, through linked accounts; null when it can't. */
451
+ mentionOf: (actor: string) => string | null;
452
+ label: string;
453
+ target: string;
454
+ };
455
+ /** How a platform shows a board message: markdown, which the platform converts to its own format. */
456
+ type Renderer = (input: RenderInput) => string;
457
+ type FileDelivery = {
458
+ message: string;
459
+ files: string[];
460
+ };
461
+ /** What a linked message said, or why the platform wouldn't say. */
462
+ type FetchedLink = Pick<Link, 'snapshot' | 'unavailable'>;
463
+ /** Why a platform wouldn't read a channel or thread on demand. Its message is shown as is. */
464
+ declare class UnreadableError extends Error {
465
+ readonly code: string;
466
+ constructor(code: string, message: string);
467
+ }
468
+ /** A file to send: its bytes (a Node `Buffer` is one), its name, and its type. */
469
+ type ProviderFile = {
470
+ data: Uint8Array;
471
+ filename: string;
472
+ mimeType?: string;
473
+ };
474
+ /**
475
+ * Who a post is from, for a platform that can show it as the sender (Slack's per-message
476
+ * username and icon): `name` is the label the text opens with (`**name**: …`).
477
+ */
478
+ type ProviderSender = {
479
+ name: string;
480
+ avatar: string | null;
481
+ };
482
+ type ProviderPost = {
483
+ markdown: string;
484
+ files?: ProviderFile[];
485
+ as?: ProviderSender;
486
+ };
487
+ type ProviderDelivery = {
488
+ thread: string;
489
+ message: string;
490
+ files?: string[];
491
+ };
492
+ type ProviderOptions = {
493
+ platform: string;
494
+ canStartThreads?: boolean;
495
+ singleReaction?: boolean;
496
+ uploadsFiles?: boolean;
497
+ /** People's own tokens, to post as them and to link accounts by signing in. */
498
+ users?: UserTokens | null;
499
+ };
500
+ declare const ReceivedEvent: z.ZodObject<{
501
+ event: z.ZodDiscriminatedUnion<[z.ZodObject<{
502
+ channel: z.ZodString;
503
+ thread: z.ZodString;
504
+ subthread: z.ZodNullable<z.ZodString>;
505
+ kind: z.ZodLiteral<"message">;
506
+ message: z.ZodString;
507
+ isRoot: z.ZodBoolean;
508
+ text: z.ZodString;
509
+ context: z.ZodNullable<z.ZodString>;
510
+ author: z.ZodObject<{
511
+ id: z.ZodString;
512
+ handle: z.ZodString;
513
+ name: z.ZodString;
514
+ avatar: z.ZodNullable<z.ZodString>;
515
+ isBot: z.ZodBoolean;
516
+ }, z.core.$strip>;
517
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
518
+ type: z.ZodEnum<{
519
+ audio: "audio";
520
+ file: "file";
521
+ image: "image";
522
+ video: "video";
523
+ }>;
524
+ name: z.ZodOptional<z.ZodString>;
525
+ mimeType: z.ZodOptional<z.ZodString>;
526
+ size: z.ZodOptional<z.ZodNumber>;
527
+ url: z.ZodOptional<z.ZodString>;
528
+ fetchMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
529
+ }, z.core.$strip>>>;
530
+ links: z.ZodOptional<z.ZodArray<z.ZodObject<{
531
+ url: z.ZodString;
532
+ thread: z.ZodString;
533
+ message: z.ZodString;
534
+ snapshot: z.ZodNullable<z.ZodObject<{
535
+ author: z.ZodString;
536
+ text: z.ZodString;
537
+ createdAt: z.ZodNullable<z.ZodString>;
538
+ files: z.ZodArray<z.ZodObject<{
539
+ name: z.ZodString;
540
+ url: z.ZodNullable<z.ZodString>;
541
+ }, z.core.$strip>>;
542
+ }, z.core.$strip>>;
543
+ }, z.core.$strip>>>;
544
+ }, z.core.$strip>, z.ZodObject<{
545
+ channel: z.ZodString;
546
+ thread: z.ZodString;
547
+ subthread: z.ZodNullable<z.ZodString>;
548
+ kind: z.ZodLiteral<"edited">;
549
+ message: z.ZodString;
550
+ text: z.ZodString;
551
+ author: z.ZodObject<{
552
+ id: z.ZodString;
553
+ handle: z.ZodString;
554
+ name: z.ZodString;
555
+ avatar: z.ZodNullable<z.ZodString>;
556
+ isBot: z.ZodBoolean;
557
+ }, z.core.$strip>;
558
+ links: z.ZodOptional<z.ZodArray<z.ZodObject<{
559
+ url: z.ZodString;
560
+ thread: z.ZodString;
561
+ message: z.ZodString;
562
+ snapshot: z.ZodNullable<z.ZodObject<{
563
+ author: z.ZodString;
564
+ text: z.ZodString;
565
+ createdAt: z.ZodNullable<z.ZodString>;
566
+ files: z.ZodArray<z.ZodObject<{
567
+ name: z.ZodString;
568
+ url: z.ZodNullable<z.ZodString>;
569
+ }, z.core.$strip>>;
570
+ }, z.core.$strip>>;
571
+ }, z.core.$strip>>>;
572
+ linksOnly: z.ZodOptional<z.ZodBoolean>;
573
+ }, z.core.$strip>, z.ZodObject<{
574
+ channel: z.ZodString;
575
+ thread: z.ZodString;
576
+ subthread: z.ZodNullable<z.ZodString>;
577
+ kind: z.ZodLiteral<"deleted">;
578
+ message: z.ZodString;
579
+ }, z.core.$strip>, z.ZodObject<{
580
+ channel: z.ZodString;
581
+ thread: z.ZodString;
582
+ subthread: z.ZodNullable<z.ZodString>;
583
+ kind: z.ZodLiteral<"reaction">;
584
+ message: z.ZodString;
585
+ emoji: z.ZodString;
586
+ added: z.ZodBoolean;
587
+ author: z.ZodObject<{
588
+ id: z.ZodString;
589
+ handle: z.ZodString;
590
+ name: z.ZodString;
591
+ avatar: z.ZodNullable<z.ZodString>;
592
+ isBot: z.ZodBoolean;
593
+ }, z.core.$strip>;
594
+ }, z.core.$strip>, z.ZodObject<{
595
+ channel: z.ZodString;
596
+ thread: z.ZodString;
597
+ kind: z.ZodLiteral<"lifecycle">;
598
+ type: z.ZodString;
599
+ title: z.ZodString;
600
+ url: z.ZodNullable<z.ZodString>;
601
+ labels: z.ZodRecord<z.ZodString, z.ZodString>;
602
+ unset: z.ZodArray<z.ZodString>;
603
+ owns: z.ZodOptional<z.ZodArray<z.ZodString>>;
604
+ reply: z.ZodNullable<z.ZodString>;
605
+ createRoot: z.ZodBoolean;
606
+ retitled: z.ZodOptional<z.ZodBoolean>;
607
+ author: z.ZodObject<{
608
+ id: z.ZodString;
609
+ handle: z.ZodString;
610
+ name: z.ZodString;
611
+ avatar: z.ZodNullable<z.ZodString>;
612
+ isBot: z.ZodBoolean;
613
+ }, z.core.$strip>;
614
+ }, z.core.$strip>], "kind">;
615
+ raw: z.ZodUnknown;
616
+ dedupe: z.ZodString;
617
+ }, z.core.$strip>;
618
+ type ReceivedEvent = z.infer<typeof ReceivedEvent>;
619
+ type Receive = (received: ReceivedEvent) => Promise<void>;
620
+ declare abstract class SyncProvider<E extends ProviderEvent = ProviderEvent> {
621
+ readonly platform: string;
622
+ readonly canStartThreads: boolean;
623
+ readonly singleReaction: boolean;
624
+ readonly uploadsFiles: boolean;
625
+ private readonly fn;
626
+ /** People's tokens, when the adapter has them: messages they write post as them. */
627
+ readonly users: UserTokens | null;
628
+ protected readonly options: ProviderOptions;
629
+ constructor(options: ProviderOptions, sync: SyncFn<E>);
630
+ abstract receive(key: string, request: Request, emit: Receive): Promise<Response>;
631
+ abstract resolveChannel(key: string): Promise<string>;
632
+ abstract resolveTarget(target: string): Promise<ResolvedTarget>;
633
+ abstract post(target: string, kind: ResolvedTarget['kind'], body: ProviderPost): Promise<ProviderDelivery>;
634
+ /** The platform account a person's token belongs to. */
635
+ whoAmI(_token: string): Promise<ExternalAuthor>;
636
+ /** `post`, as the person whose token this is. */
637
+ postAs(_token: string, _target: string, _kind: ResolvedTarget['kind'], _body: ProviderPost): Promise<ProviderDelivery>;
638
+ editAs(_token: string, _thread: string, _message: string, _body: ProviderPost): Promise<void>;
639
+ deleteAs(_token: string, _thread: string, _message: string): Promise<void>;
640
+ findByEmail(_email: string): Promise<ExternalAuthor | null>;
641
+ mention(_actor: Actor): string | null;
642
+ fetchRoot(_thread: string): Promise<SyncRoot | null>;
643
+ fetchFile(_file: ExternalFile): Promise<Uint8Array | null>;
644
+ /** The platform's own link to an event's message, or null when it has none. */
645
+ permalink(_event: E): Promise<string | null>;
646
+ /** A linked message the platform didn't describe, read from the platform. */
647
+ fetchLink(_link: ExternalLink): Promise<FetchedLink>;
648
+ /**
649
+ * The message a URL of this platform's names, by its own thread and message IDs, or null for a
650
+ * URL that isn't one. `message` is null for a link to a thread itself. It asks the platform
651
+ * nothing: the board answers from what it synced (`vb read <url>`).
652
+ */
653
+ locate(_url: string): {
654
+ thread: string;
655
+ message: string | null;
656
+ } | null;
657
+ /** The platform's URL for one of its messages, by its own IDs, or null when it has none (`vb sync <id>`). */
658
+ url(_thread: string, _message: string): Promise<string | null>;
659
+ /**
660
+ * A channel or thread, read on demand for whoever asked: nothing is synced,
661
+ * stored, or joined. Throws `UnreadableError` for what it won't read.
662
+ */
663
+ read(_target: string, _options: {
664
+ limit: number;
665
+ }): Promise<SourceRead>;
666
+ /** Adds the board's app to a channel so `read` can read it, where the board opted in. Throws `UnreadableError` otherwise. */
667
+ join(_target: string): Promise<SourceJoin>;
668
+ edit(_thread: string, _message: string, _body: ProviderPost): Promise<void>;
669
+ delete(_thread: string, _message: string): Promise<void>;
670
+ react(_thread: string, _message: string, _emoji: string, _added: boolean): Promise<void>;
671
+ startTyping(_thread: string, _latest: string | null, _status?: string): Promise<void>;
672
+ /**
673
+ * The channel whose inbox a thread's events land in (`slack:C0123ABC` for `slack:C0123ABC:1727.1234`),
674
+ * worked out without calling the platform. Null when the provider can't tell: a key's inbox then
675
+ * lists only the mapped channels'.
676
+ */
677
+ inboxChannel(_key: string, _thread: string): string | null;
678
+ deleteFiles(_ids: string[]): Promise<void>;
679
+ refusesFiles(_error: unknown): boolean;
680
+ uploadFiles(_thread: string, _files: ProviderFile[]): Promise<FileDelivery>;
681
+ abstract event(context: SyncContext): E;
682
+ /** Runs the sync function the provider was made with: what every event does, both ways. */
683
+ sync(sync: Sync<E>): unknown;
684
+ /** The default rendering: `**${label}**: ${text}`. A `Renderer` passed to `deliver` replaces it. */
685
+ render(input: RenderInput): string;
686
+ }
687
+ //#endregion
688
+ export { SyncOverrides as A, channels as C, EventBase as D, render as E, SyncRoot as M, envelope as N, ProviderEvent as O, eventSchema as P, SyncUnit as S, mirror as T, withUserTokens as _, ProviderOptions as a, SyncIn as b, ReceivedEvent as c, ResolvedTarget as d, SyncContext as f, connectUserTokens as g, UserTokens as h, ProviderFile as i, SyncResult as j, RootOverride 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, Sync as v, into as w, SyncOut as x, SyncFn as y };
@@ -1,8 +1,8 @@
1
- import { t as BoardError } from "./client-BY-BCggB.mjs";
2
- import { i as localTokenFile } from "./node-C51_xzCb.mjs";
3
- import { t as board } from "./server-BgK1sgj7.mjs";
4
- import { t as oidcTokens } from "./tokens-U-XRlEfq.mjs";
5
- import { n as fsBlob, t as a2 } from "./a2-CQ3WcqMv.mjs";
1
+ import { t as BoardError } from "./client-D0Px7KzF.mjs";
2
+ import { i as localTokenFile } from "./node-Bkd1x0QI.mjs";
3
+ import { t as board } from "./server-BF4WJ7qi.mjs";
4
+ import { t as oidcTokens } from "./tokens-BuCU-61R.mjs";
5
+ import { n as fsBlob, t as a2 } from "./a2-A830f5NS.mjs";
6
6
  import { t as localScheduler } from "./local-DhkrAqPP.mjs";
7
7
  import { mkdir, rm, writeFile } from "node:fs/promises";
8
8
  import { userInfo } from "node:os";