@vercel/board 0.33.0 → 0.34.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/dist/{access-N3XmkKXg.mjs → access-CdBcYPQH.mjs} +169 -12
  2. package/dist/access.d.mts +3 -3
  3. package/dist/access.mjs +5 -5
  4. package/dist/{actors-ihyN47OV.mjs → actors-MrIEr9LI.mjs} +2 -2
  5. package/dist/auth-DjoJygbG.mjs +599 -0
  6. package/dist/{auth-D6z3rMNj.d.mts → auth-aaoKt5DK.d.mts} +128 -9
  7. package/dist/backend-local.d.mts +1 -1
  8. package/dist/backend-local.mjs +1 -1
  9. package/dist/{backend-CWpyR1A7.d.mts → backend-u1sVvybh.d.mts} +30 -7
  10. package/dist/{chat-provider-DJpFUaFv.d.mts → chat-provider-De0iDnUB.d.mts} +2 -2
  11. package/dist/cli-commands.d.mts +1 -1
  12. package/dist/cli-commands.mjs +1 -1
  13. package/dist/cli-embedded.d.mts +2 -2
  14. package/dist/cli-embedded.mjs +1 -1
  15. package/dist/cli.mjs +5 -5
  16. package/dist/{commands-CHoMl06v.mjs → commands-B8oZEByR.mjs} +25 -51
  17. package/dist/{commands-BOBQHVqM.d.mts → commands-BkVMdXP1.d.mts} +0 -6
  18. package/dist/{conformance-qKmGLTAT.mjs → conformance-gqYBkXFS.mjs} +76 -83
  19. package/dist/conformance.d.mts +1 -1
  20. package/dist/conformance.mjs +1 -1
  21. package/dist/{engine-JxgZiikU.mjs → engine-rtOVWsiF.mjs} +2 -2
  22. package/dist/{errors-Pk0XV1hK.mjs → errors-D8ifv16L.mjs} +19 -4
  23. package/dist/{exports-gHDHlg0i.mjs → exports-Bx2dGpzr.mjs} +55 -10
  24. package/dist/exports-uwRl5qIj.d.mts +4 -0
  25. package/dist/{index-CXvvYNYj.d.mts → index-D6mK0Ial.d.mts} +2 -2
  26. package/dist/index.d.mts +6 -6
  27. package/dist/index.mjs +4 -4
  28. package/dist/index.node.d.mts +6 -6
  29. package/dist/index.node.mjs +3 -3
  30. package/dist/inspect/app.js +31 -31
  31. package/dist/{local-BbLjA5vI.mjs → local-CPz22MQ8.mjs} +1981 -1574
  32. package/dist/{main-CQpCZJFw.mjs → main-DScDKwQN.mjs} +45 -38
  33. package/dist/{middleware-BU7rVi9F.mjs → middleware-BjYpk4yq.mjs} +1 -1
  34. package/dist/provider-hB8QNrwm.d.mts +1031 -0
  35. package/dist/{provider-BlzUvcM9.d.mts → routes-De4W6lEs.d.mts} +2439 -2469
  36. package/dist/{serve-D8_W4UN6.mjs → serve-B1noQRkn.mjs} +4 -4
  37. package/dist/{server-BiIUXWbU.mjs → server-Ov6GBJ8j.mjs} +7 -7
  38. package/dist/{serving-D7rcUtSC.mjs → serving-2s7lqSBS.mjs} +1 -1
  39. package/dist/sync-chat-sdk.d.mts +2 -2
  40. package/dist/sync-github.d.mts +2 -2
  41. package/dist/sync-linear.d.mts +3 -2
  42. package/dist/sync-slack.d.mts +3 -3
  43. package/dist/sync.d.mts +2 -2
  44. package/dist/{targets-CknPGGVi.mjs → targets-aMdbp84G.mjs} +98 -10
  45. package/dist/{tokens-DPKjl3jf.mjs → tokens-LHLrnV_P.mjs} +2 -2
  46. package/docs/01-board/01-mounting.md +5 -3
  47. package/docs/01-board/03-identity.md +14 -13
  48. package/docs/01-board/07-schedules.md +1 -1
  49. package/docs/01-board/09-access.md +140 -59
  50. package/docs/03-guides/03-ci.md +15 -15
  51. package/docs/03-guides/05-agent-factory.md +5 -6
  52. package/docs/04-reference/01-cli.md +9 -16
  53. package/docs/04-reference/02-board.md +19 -8
  54. package/docs/04-reference/03-http.md +20 -13
  55. package/docs/04-reference/05-conformance.md +1 -1
  56. package/package.json +1 -1
  57. package/dist/auth-r-_PeZyw.mjs +0 -277
  58. package/dist/exports-BuKjVq2t.d.mts +0 -4
  59. package/dist/folds-DjFTiqIM.d.mts +0 -552
@@ -0,0 +1,1031 @@
1
+ import { $ as ScheduleView, $t as Attachment, A as MatchView, Dt as TokenView, Et as TokenInput, I as MessagesQueryInput, K as RegisterInput, M as Me, N as MessageView, P as MessagesPage, Qt as ExternalCopy, S as InboxItem, St as ThreadsPage, Zt as Actor, _t as SyncReceiptInput, a as ChannelView, an as ExternalLink, c as Discovery, dt as SyncFindInput, h as FiltersInput, ht as SyncImportInput, i as BoardEventView, in as ExternalFile, jt as UpdateGrantInput, m as Explanation, nn as ExternalAuthor, on as Link, ot as SourceRead, pt as SyncFindView, q as RegistrationView, rn as ExternalEvent, rt as SourceJoin, tt as SchedulesQueryInput, u as EventsPage, v as GrantInput, vt as SyncThreadView, wt as ThreadsQueryInput, x as InboxEntry, xt as ThreadView, y as GrantView, yt as SyncedView } from "./routes-De4W6lEs.mjs";
2
+ import { z } from "zod";
3
+ //#region src/client/client.d.ts
4
+ /**
5
+ * Where an error came from: `handle`, raised by the handle on this machine (no Vercel login,
6
+ * Deployment Protection), or `board`, a board's answer, whose words are its own whatever code it
7
+ * names.
8
+ */
9
+ type ErrorOrigin = 'handle' | 'board';
10
+ /**
11
+ * What went wrong: `message` says what and why, `code` is what to branch on, `hint`, when there's
12
+ * one, what fixes it, and `origin` who said so. Trust a `board` one's message and hint as you would
13
+ * the board.
14
+ */
15
+ declare class BoardError extends Error {
16
+ readonly code: string;
17
+ readonly status: number;
18
+ readonly hint: string | undefined;
19
+ readonly origin: ErrorOrigin;
20
+ constructor(code: string, message: string, status: number, options?: {
21
+ hint?: string;
22
+ origin?: ErrorOrigin;
23
+ });
24
+ }
25
+ type Resolvable<T> = T | (() => T | Promise<T>);
26
+ /** A profile name, `{ name, avatar }`, or null for no profile. */
27
+ type ProfileOption = string | {
28
+ name: string;
29
+ avatar?: string;
30
+ } | null;
31
+ type ClientOptions = {
32
+ /** The board's URL, e.g. `https://www.example.com/api/board`. */
33
+ url: string;
34
+ /** An OIDC token whose audience is the board's URL, or a function returning one. Without one, `fetch` brings the credentials. */
35
+ token?: Resolvable<string>;
36
+ profile?: Resolvable<ProfileOption>;
37
+ /** Runtime session, recorded on writes and used to scope read cursors. */
38
+ session?: Resolvable<string | null>;
39
+ /** A person's handle; the board falls back to one derived from their user ID. */
40
+ handle?: Resolvable<string | null>;
41
+ /** Your display name and avatar, shown when you write as yourself (not as a profile). */
42
+ person?: Resolvable<{
43
+ name?: string | null;
44
+ avatar?: string | null;
45
+ } | null>;
46
+ /** Extra headers on every request. */
47
+ headers?: Resolvable<Record<string, string>>;
48
+ fetch?: typeof fetch;
49
+ /**
50
+ * How a direct upload's bytes go to the blob store's signed URL: `fetch` by default, never the
51
+ * board's own, which brings the board's credentials and would hand them to the store.
52
+ */
53
+ storeFetch?: typeof fetch;
54
+ };
55
+ type PostOptions = {
56
+ text: string;
57
+ labels?: Record<string, string>;
58
+ /** Keep this message on the board: no configured sync targets. */
59
+ noSync?: boolean;
60
+ /** External targets the new thread starts with: `slack:#incidents` starts one, `github:owner/repo:12` joins one. */
61
+ sync?: string[];
62
+ /** Makes retries idempotent: the same id never posts twice. */
63
+ id?: string;
64
+ /** Files from `upload`, or their IDs. */
65
+ attachments?: (Attachment | string)[];
66
+ };
67
+ type ReplyOptions = Omit<PostOptions, 'sync'> & {
68
+ /**
69
+ * Posts only while this is the thread's newest message: the ID of the last one you read. If
70
+ * another has come after it, nothing is posted, and it throws a 409 `newer_message`.
71
+ */
72
+ after?: string;
73
+ };
74
+ /**
75
+ * When a scheduled message goes out: once `in` a while or `at` a time, or
76
+ * `every` so often (first at `at`, `in`, or one `every` from now), stopping
77
+ * `until` a time, `for` a while after the first send, or after `times` sends.
78
+ * A repeat with no stop runs until it's canceled.
79
+ */
80
+ type ScheduleTiming = {
81
+ in?: string;
82
+ at?: Date | string;
83
+ every?: string;
84
+ until?: Date | string;
85
+ for?: string;
86
+ times?: number;
87
+ };
88
+ type ScheduleOptions = Omit<PostOptions, 'sync' | 'id'> & ScheduleTiming;
89
+ /** What `upload` takes: the bytes, and what to call them. */
90
+ type UploadInput = {
91
+ data: Blob | Uint8Array<ArrayBuffer>;
92
+ name: string;
93
+ /** A MIME type; a `Blob`'s own type, or one from the name's extension, otherwise. */
94
+ type?: string;
95
+ };
96
+ type WaitOptions = {
97
+ /** `'30s'`, `'10m'`, `'1h'`, or milliseconds. Default `'30m'`. */
98
+ timeout?: string | number;
99
+ signal?: AbortSignal;
100
+ };
101
+ declare function duration(value: string | number): number;
102
+ type Filters = Omit<FiltersInput, 'label'> & {
103
+ /** `{ status: 'open' }` or `['status=open']`. */
104
+ label?: Record<string, string> | string[];
105
+ };
106
+ type BoardClient = ReturnType<typeof createBoardClient>;
107
+ /** Whom `explain` asks about: nobody for yourself, or one principal as people name it. */
108
+ type ExplainPrincipal = {
109
+ user?: string;
110
+ project?: string;
111
+ /** Where the project's deployment runs: production when left out. */
112
+ environment?: string;
113
+ github?: string;
114
+ workflow?: string;
115
+ branch?: string;
116
+ event?: string;
117
+ oidc?: string;
118
+ claims?: Record<string, string>;
119
+ /** An app on the team, by its slug or client ID. */
120
+ app?: string;
121
+ };
122
+ /** What a write returns, with the handles in it that matched nobody and stayed plain text. */
123
+ type Written<T> = T & {
124
+ unknownMentions?: string[];
125
+ };
126
+ declare function createBoardClient(options: ClientOptions): {
127
+ url: string;
128
+ /**
129
+ * The board's HTTP API with this client's credentials, and the response as
130
+ * the board sent it, errors included: for proxies like `vb inspect`.
131
+ */
132
+ request: (path: string, init?: {
133
+ method?: string;
134
+ body?: Uint8Array<ArrayBuffer>;
135
+ headers?: Record<string, string>;
136
+ signal?: AbortSignal;
137
+ /** Act as this profile (`null` for yourself) instead of the client's. */
138
+ as?: ProfileOption;
139
+ }) => Promise<Response>;
140
+ discovery: () => Promise<Discovery>;
141
+ me: () => Promise<Me>;
142
+ channels: () => Promise<ChannelView[]>;
143
+ /**
144
+ * Makes a channel before anything posts to it, as a first post would. Needs `read` and `post`
145
+ * there. `created` is false when it was there already; it's left as it is.
146
+ */
147
+ createChannel: (path: string) => Promise<{
148
+ channel: ChannelView;
149
+ created: boolean;
150
+ }>;
151
+ actors: () => Promise<Actor[]>;
152
+ messages: (query?: Filters & Omit<MessagesQueryInput, keyof FiltersInput>) => Promise<MessagesPage>;
153
+ thread: (id: string) => Promise<ThreadView>;
154
+ /** Your own post with the client ID you gave it, as posting it answered: 404 `post_not_found` when there's none. */
155
+ posted: (id: string) => Promise<MessageView>;
156
+ /** Threads with a matching message, one summary each (root, reply count, latest reply), by latest activity. `limit` counts threads. */
157
+ threads: (query?: Filters & Omit<ThreadsQueryInput, keyof FiltersInput>) => Promise<ThreadsPage>;
158
+ /** `unknownMentions` lists the handles that matched nobody: they posted as plain text. */
159
+ post(channel: string, input: string | PostOptions): Promise<Written<MessageView>>;
160
+ reply(id: string, input: string | ReplyOptions): Promise<Written<MessageView>>;
161
+ /**
162
+ * Posts later, as you: a new thread when `target` is a channel, a reply when it's
163
+ * `{ re }`, any message's ID in the thread. Each message it posts carries
164
+ * `schedule: { id, n }`. Needs a board with a scheduler.
165
+ */
166
+ schedule(target: string | {
167
+ re: string;
168
+ }, input: ScheduleOptions): Promise<Written<ScheduleView>>;
169
+ /** Pending schedules (`all` for done and canceled too), oldest first. `re` is any message in a thread. */
170
+ schedules: (query?: Omit<SchedulesQueryInput, 'all'> & {
171
+ all?: boolean;
172
+ }) => Promise<ScheduleView[]>;
173
+ /** Stops a schedule: yours, or any with manage in its channel. `canceled` is false when it was already done or canceled. */
174
+ cancelSchedule: (id: string) => Promise<{
175
+ schedule: ScheduleView;
176
+ canceled: boolean;
177
+ }>;
178
+ /**
179
+ * A new grant: `principals` may do what `can` says, a map from channel pattern to permissions
180
+ * (`[]` for none). The same principals again are another grant. At each channel, the most
181
+ * specific pattern among the grants that name a caller decides, then the closest principal,
182
+ * and grants tied there add up. Needs manage at each pattern `can` names.
183
+ */
184
+ createGrant: (input: GrantInput) => Promise<{
185
+ grant: GrantView;
186
+ }>;
187
+ /** Adds and removes principals (by who they are, environments aside), or replaces its `can`. Needs what `checkGrantChange` says, for the grant as it was and as it'd be. */
188
+ updateGrant: (id: string, input: UpdateGrantInput) => Promise<{
189
+ grant: GrantView;
190
+ }>;
191
+ /**
192
+ * Which grants decide `channel`, and what they give: for you, or with manage at `*`, for the
193
+ * principal `principal` names (`{ user }`, `{ project, environment }`, `{ github, workflow,
194
+ * branch, event }`, or `{ oidc, claims }`).
195
+ */
196
+ explain: (channel: string, principal?: ExplainPrincipal) => Promise<Explanation>;
197
+ /** The board's grants. Needs manage at `*`, or a team owner. */
198
+ grants: () => Promise<GrantView[]>;
199
+ /** `revoked` is false when it was already gone. Its principals' next requests are refused. */
200
+ revokeGrant: (id: string) => Promise<{
201
+ revoked: boolean;
202
+ }>;
203
+ /**
204
+ * A token that acts as you, narrowed to `can`, writing as `profile` and `session` when they're
205
+ * given: for a widget, a sandbox, a script. `secret` shows only here. It lives 30 days, or
206
+ * `expires`, at most 90.
207
+ */
208
+ createToken: (input: TokenInput) => Promise<{
209
+ token: TokenView;
210
+ secret: string;
211
+ }>;
212
+ /** Your live tokens, or everyone's with manage in every channel. Never their secrets. */
213
+ tokens: () => Promise<TokenView[]>;
214
+ /** It and every token minted with it stop. `revoked` is false when it was already revoked. */
215
+ revokeToken: (id: string) => Promise<{
216
+ revoked: boolean;
217
+ }>;
218
+ /**
219
+ * Stores a file on the board, for a post or reply's `attachments`. Up to 4 MB goes in one
220
+ * request; bigger, up to 100 MB, goes straight to the board's blob store on a URL the board
221
+ * signs, where its store can (`no_direct_uploads` where it can't).
222
+ */
223
+ upload(input: UploadInput): Promise<Attachment>;
224
+ /** An attachment's bytes, as the board serves them: `content-type` is the file's type. */
225
+ download: (id: string, opts?: {
226
+ signal?: AbortSignal;
227
+ }) => Promise<Response>;
228
+ /**
229
+ * `revision` is the message's as you read it: if it's been edited or deleted since, nothing
230
+ * changes, and it throws a 409 `revision_conflict`.
231
+ */
232
+ edit: (id: string, text: string, opts?: {
233
+ revision?: number;
234
+ }) => Promise<{
235
+ ok: true;
236
+ unknownMentions?: string[];
237
+ }>;
238
+ delete: (id: string, opts?: {
239
+ revision?: number;
240
+ }) => Promise<{
241
+ ok: true;
242
+ }>;
243
+ /** `emoji` is a short name, `:name:`, or the character itself. */
244
+ react: (id: string, emoji: string, opts?: {
245
+ remove?: boolean;
246
+ }) => Promise<{
247
+ ok: true;
248
+ }>;
249
+ /**
250
+ * `if` is what the labels must be now, a value or null for one that mustn't be set: if one
251
+ * isn't, nothing changes, and it throws a 409 `label_conflict`.
252
+ */
253
+ label: (id: string, change: {
254
+ set?: Record<string, string>;
255
+ unset?: string[];
256
+ if?: Record<string, string | null>;
257
+ }) => Promise<{
258
+ ok: true;
259
+ }>;
260
+ /**
261
+ * Shows typing in the platform threads the message's thread is synced to.
262
+ * Ephemeral: nothing goes in the log. Answers the external threads that took it.
263
+ * `status` replaces "Typing…" on Slack ("running tests…").
264
+ */
265
+ typing: (id: string, status?: string) => Promise<string[]>;
266
+ /**
267
+ * With a target, attaches the message's thread to it, backfilling it: attaching twice is a no-op.
268
+ * Without one, where the thread is synced, and this message's copy on each target, with its link.
269
+ */
270
+ sync: {
271
+ (id: string): Promise<SyncedView>;
272
+ (id: string, target: string): Promise<{
273
+ target: string;
274
+ attached: boolean;
275
+ }>;
276
+ };
277
+ /**
278
+ * The thread of the board message a platform link names (a Slack permalink, a GitHub comment's
279
+ * URL), from what the board synced: the platform is never asked. 404 for one it didn't sync.
280
+ */
281
+ linked: (url: string) => Promise<ThreadView>;
282
+ /** Raw platform events for a sync entry, newest first. */
283
+ inbox: (key: string, opts?: {
284
+ channel?: string;
285
+ limit?: number;
286
+ }) => Promise<InboxEntry[]>;
287
+ /** Registers the caller's watchers, replacing its last registration: what a board on `http()` does. */
288
+ register: (input: RegisterInput) => Promise<RegistrationView>;
289
+ /** Registered watchers: every one to `manage` everywhere, the caller's own to anyone else. */
290
+ watchers: () => Promise<RegistrationView[]>;
291
+ /** The caller's matches it can run now, each leased to it until it acks. `wait` holds the request up to that many seconds for one. */
292
+ matches: (opts?: {
293
+ limit?: number;
294
+ wait?: number;
295
+ signal?: AbortSignal;
296
+ }) => Promise<MatchView[]>;
297
+ /** How a pulled match went: done, an error to try again, or `skip` to drop it. */
298
+ ack: (id: string, body: {
299
+ lease: string;
300
+ error?: string;
301
+ skip?: boolean;
302
+ }) => Promise<{
303
+ ok: true;
304
+ }>;
305
+ /**
306
+ * Reads a platform channel (`#name`, an ID), thread (`C0123:1727000000.123456`),
307
+ * or message permalink on demand, without syncing or storing it. Full access only.
308
+ */
309
+ readSource: (key: string, target: string, opts?: {
310
+ limit?: number;
311
+ after?: string;
312
+ }) => Promise<SourceRead>;
313
+ /** Adds the app to a public channel so `readSource` can read it, where the sync opted in with `join`. Full access only. */
314
+ joinSource: (key: string, target: string) => Promise<SourceJoin>;
315
+ poll: (query?: Filters & {
316
+ after?: string;
317
+ wait?: number;
318
+ all?: boolean;
319
+ }, signal?: AbortSignal) => Promise<EventsPage>;
320
+ /** A platform's write, as its platform author: idempotent per platform event for a post, found from its origin otherwise. */
321
+ syncImport: (body: SyncImportInput) => Promise<{
322
+ message: string | null;
323
+ dropped?: string[];
324
+ }>;
325
+ /** What sync did on a platform: a delivery, its files, a failure, or a thread's new target. */
326
+ syncReceipt: (body: SyncReceiptInput) => Promise<{
327
+ ok: true;
328
+ attached?: boolean;
329
+ }>;
330
+ /** A board thread's sync, by its key. */
331
+ syncThread: (thread: string) => Promise<SyncThreadView>;
332
+ /** What platform IDs are on the board: a thread, or a message. */
333
+ syncFind: (query: SyncFindInput, opts?: {
334
+ signal?: AbortSignal;
335
+ }) => Promise<SyncFindView>;
336
+ /** Messages' copies on platforms, by message and target. */
337
+ syncCopies: (messages: string[]) => Promise<Record<string, Record<string, ExternalCopy>>>;
338
+ /** Pushes platform events into your inbox for sync key `key`; each platform ID lands once. */
339
+ inboxPush: (key: string, events: {
340
+ id: string;
341
+ event: InboxItem['event'];
342
+ raw: unknown;
343
+ }[]) => Promise<{
344
+ ok: true;
345
+ }>;
346
+ /** Your next inbox events for `key`, leased to you until you ack them, one platform thread at a time. */
347
+ inboxNext: (key: string, opts?: {
348
+ limit?: number;
349
+ }) => Promise<InboxItem[]>;
350
+ /** How an inbox event went: done, or an error to try it again. */
351
+ inboxAck: (key: string, id: string, body: {
352
+ lease: string;
353
+ error?: string;
354
+ }) => Promise<{
355
+ ok: true;
356
+ }>;
357
+ /** Live events. Reconnects from the last seen index whenever the stream closes. */
358
+ events(query?: Filters & {
359
+ after?: string;
360
+ all?: boolean;
361
+ }, opts?: {
362
+ signal?: AbortSignal;
363
+ }): AsyncGenerator<BoardEventView>;
364
+ /** The next matching event after `after` (default: now), or null on timeout. */
365
+ wait(query?: Filters & {
366
+ after?: string;
367
+ }, opts?: WaitOptions): Promise<BoardEventView | null>;
368
+ };
369
+ //#endregion
370
+ //#region src/sync/events.d.ts
371
+ declare const EventBase: z.ZodObject<{
372
+ channel: z.ZodString;
373
+ thread: z.ZodString;
374
+ subthread: z.ZodNullable<z.ZodString>;
375
+ id: z.ZodString;
376
+ platform: z.ZodString;
377
+ key: z.ZodString;
378
+ raw: z.ZodUnknown;
379
+ }, z.core.$strip>;
380
+ type EventBase<P extends string = string> = Omit<z.infer<typeof EventBase>, 'platform'> & {
381
+ platform: P;
382
+ };
383
+ type ProviderEvent = EventBase & ExternalEvent & {
384
+ type: string;
385
+ };
386
+ declare function envelope(platform: string, key: string, event: ExternalEvent, raw: unknown, id: string): {
387
+ channel: string;
388
+ thread: string;
389
+ subthread: string | null;
390
+ kind: "message";
391
+ message: string;
392
+ isRoot: boolean;
393
+ text: string;
394
+ context: string | null;
395
+ author: {
396
+ id: string;
397
+ handle: string;
398
+ name: string;
399
+ avatar: string | null;
400
+ isBot: boolean;
401
+ };
402
+ files?: {
403
+ type: "audio" | "file" | "image" | "video";
404
+ name?: string | undefined;
405
+ mimeType?: string | undefined;
406
+ size?: number | undefined;
407
+ url?: string | undefined;
408
+ fetchMetadata?: Record<string, string> | undefined;
409
+ }[] | undefined;
410
+ links?: {
411
+ url: string;
412
+ thread: string;
413
+ message: string;
414
+ snapshot: {
415
+ author: string;
416
+ text: string;
417
+ createdAt: string | null;
418
+ files: {
419
+ name: string;
420
+ url: string | null;
421
+ }[];
422
+ } | null;
423
+ }[] | undefined;
424
+ id: string;
425
+ platform: string;
426
+ key: string;
427
+ raw: unknown;
428
+ type: string;
429
+ } | {
430
+ channel: string;
431
+ thread: string;
432
+ subthread: string | null;
433
+ kind: "edited";
434
+ message: string;
435
+ text: string;
436
+ author: {
437
+ id: string;
438
+ handle: string;
439
+ name: string;
440
+ avatar: string | null;
441
+ isBot: boolean;
442
+ };
443
+ links?: {
444
+ url: string;
445
+ thread: string;
446
+ message: string;
447
+ snapshot: {
448
+ author: string;
449
+ text: string;
450
+ createdAt: string | null;
451
+ files: {
452
+ name: string;
453
+ url: string | null;
454
+ }[];
455
+ } | null;
456
+ }[] | undefined;
457
+ linksOnly?: boolean | undefined;
458
+ id: string;
459
+ platform: string;
460
+ key: string;
461
+ raw: unknown;
462
+ type: string;
463
+ } | {
464
+ channel: string;
465
+ thread: string;
466
+ subthread: string | null;
467
+ kind: "deleted";
468
+ message: string;
469
+ id: string;
470
+ platform: string;
471
+ key: string;
472
+ raw: unknown;
473
+ type: string;
474
+ } | {
475
+ channel: string;
476
+ thread: string;
477
+ subthread: string | null;
478
+ kind: "reaction";
479
+ message: string;
480
+ emoji: string;
481
+ added: boolean;
482
+ author: {
483
+ id: string;
484
+ handle: string;
485
+ name: string;
486
+ avatar: string | null;
487
+ isBot: boolean;
488
+ };
489
+ id: string;
490
+ platform: string;
491
+ key: string;
492
+ raw: unknown;
493
+ type: string;
494
+ } | {
495
+ channel: string;
496
+ thread: string;
497
+ subthread: string | null;
498
+ kind: "lifecycle";
499
+ title: string;
500
+ url: string | null;
501
+ body?: string | null | undefined;
502
+ labels: Record<string, string>;
503
+ unset: string[];
504
+ owns?: string[] | undefined;
505
+ reply: string | null;
506
+ createRoot: boolean;
507
+ retitled?: boolean | undefined;
508
+ author: {
509
+ id: string;
510
+ handle: string;
511
+ name: string;
512
+ avatar: string | null;
513
+ isBot: boolean;
514
+ };
515
+ id: string;
516
+ platform: string;
517
+ key: string;
518
+ raw: unknown;
519
+ type: string;
520
+ };
521
+ declare function eventSchema<P extends string, M extends string>(platform: P, messageType: M): z.ZodDiscriminatedUnion<[z.ZodObject<{
522
+ channel: z.ZodString;
523
+ thread: z.ZodString;
524
+ subthread: z.ZodNullable<z.ZodString>;
525
+ kind: z.ZodLiteral<"message">;
526
+ message: z.ZodString;
527
+ isRoot: z.ZodBoolean;
528
+ text: z.ZodString;
529
+ context: z.ZodNullable<z.ZodString>;
530
+ author: z.ZodObject<{
531
+ id: z.ZodString;
532
+ handle: z.ZodString;
533
+ name: z.ZodString;
534
+ avatar: z.ZodNullable<z.ZodString>;
535
+ isBot: z.ZodBoolean;
536
+ }, z.core.$strip>;
537
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
538
+ type: z.ZodEnum<{
539
+ audio: "audio";
540
+ file: "file";
541
+ image: "image";
542
+ video: "video";
543
+ }>;
544
+ name: z.ZodOptional<z.ZodString>;
545
+ mimeType: z.ZodOptional<z.ZodString>;
546
+ size: z.ZodOptional<z.ZodNumber>;
547
+ url: z.ZodOptional<z.ZodString>;
548
+ fetchMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
549
+ }, z.core.$strip>>>;
550
+ links: z.ZodOptional<z.ZodArray<z.ZodObject<{
551
+ url: z.ZodString;
552
+ thread: z.ZodString;
553
+ message: z.ZodString;
554
+ snapshot: z.ZodNullable<z.ZodObject<{
555
+ author: z.ZodString;
556
+ text: z.ZodString;
557
+ createdAt: z.ZodNullable<z.ZodString>;
558
+ files: z.ZodArray<z.ZodObject<{
559
+ name: z.ZodString;
560
+ url: z.ZodNullable<z.ZodString>;
561
+ }, z.core.$strip>>;
562
+ }, z.core.$strip>>;
563
+ }, z.core.$strip>>>;
564
+ id: z.ZodString;
565
+ key: z.ZodString;
566
+ raw: z.ZodUnknown;
567
+ platform: z.ZodLiteral<P>;
568
+ type: z.ZodLiteral<M>;
569
+ }, z.core.$strip>, z.ZodObject<{
570
+ channel: z.ZodString;
571
+ thread: z.ZodString;
572
+ subthread: z.ZodNullable<z.ZodString>;
573
+ kind: z.ZodLiteral<"edited">;
574
+ message: z.ZodString;
575
+ text: z.ZodString;
576
+ author: z.ZodObject<{
577
+ id: z.ZodString;
578
+ handle: z.ZodString;
579
+ name: z.ZodString;
580
+ avatar: z.ZodNullable<z.ZodString>;
581
+ isBot: z.ZodBoolean;
582
+ }, z.core.$strip>;
583
+ links: z.ZodOptional<z.ZodArray<z.ZodObject<{
584
+ url: z.ZodString;
585
+ thread: z.ZodString;
586
+ message: z.ZodString;
587
+ snapshot: z.ZodNullable<z.ZodObject<{
588
+ author: z.ZodString;
589
+ text: z.ZodString;
590
+ createdAt: z.ZodNullable<z.ZodString>;
591
+ files: z.ZodArray<z.ZodObject<{
592
+ name: z.ZodString;
593
+ url: z.ZodNullable<z.ZodString>;
594
+ }, z.core.$strip>>;
595
+ }, z.core.$strip>>;
596
+ }, z.core.$strip>>>;
597
+ linksOnly: z.ZodOptional<z.ZodBoolean>;
598
+ id: z.ZodString;
599
+ key: z.ZodString;
600
+ raw: z.ZodUnknown;
601
+ platform: z.ZodLiteral<P>;
602
+ type: z.ZodLiteral<"message.edited">;
603
+ }, z.core.$strip>, z.ZodObject<{
604
+ channel: z.ZodString;
605
+ thread: z.ZodString;
606
+ subthread: z.ZodNullable<z.ZodString>;
607
+ kind: z.ZodLiteral<"deleted">;
608
+ message: z.ZodString;
609
+ id: z.ZodString;
610
+ key: z.ZodString;
611
+ raw: z.ZodUnknown;
612
+ platform: z.ZodLiteral<P>;
613
+ type: z.ZodLiteral<"message.deleted">;
614
+ }, z.core.$strip>, z.ZodObject<{
615
+ channel: z.ZodString;
616
+ thread: z.ZodString;
617
+ subthread: z.ZodNullable<z.ZodString>;
618
+ kind: z.ZodLiteral<"reaction">;
619
+ message: z.ZodString;
620
+ emoji: z.ZodString;
621
+ added: z.ZodBoolean;
622
+ author: z.ZodObject<{
623
+ id: z.ZodString;
624
+ handle: z.ZodString;
625
+ name: z.ZodString;
626
+ avatar: z.ZodNullable<z.ZodString>;
627
+ isBot: z.ZodBoolean;
628
+ }, z.core.$strip>;
629
+ id: z.ZodString;
630
+ key: z.ZodString;
631
+ raw: z.ZodUnknown;
632
+ platform: z.ZodLiteral<P>;
633
+ type: z.ZodEnum<{
634
+ "reaction.added": "reaction.added";
635
+ "reaction.removed": "reaction.removed";
636
+ }>;
637
+ }, z.core.$strip>, z.ZodObject<{
638
+ channel: z.ZodString;
639
+ thread: z.ZodString;
640
+ subthread: z.ZodNullable<z.ZodString>;
641
+ kind: z.ZodLiteral<"lifecycle">;
642
+ type: z.ZodString;
643
+ title: z.ZodString;
644
+ url: z.ZodNullable<z.ZodString>;
645
+ body: z.ZodOptional<z.ZodNullable<z.ZodString>>;
646
+ labels: z.ZodRecord<z.ZodString, z.ZodString>;
647
+ unset: z.ZodArray<z.ZodString>;
648
+ owns: z.ZodOptional<z.ZodArray<z.ZodString>>;
649
+ reply: z.ZodNullable<z.ZodString>;
650
+ createRoot: z.ZodBoolean;
651
+ retitled: z.ZodOptional<z.ZodBoolean>;
652
+ author: z.ZodObject<{
653
+ id: z.ZodString;
654
+ handle: z.ZodString;
655
+ name: z.ZodString;
656
+ avatar: z.ZodNullable<z.ZodString>;
657
+ isBot: z.ZodBoolean;
658
+ }, z.core.$strip>;
659
+ id: z.ZodString;
660
+ key: z.ZodString;
661
+ raw: z.ZodUnknown;
662
+ platform: z.ZodLiteral<P>;
663
+ }, z.core.$strip>], "kind">;
664
+ type SyncRoot = {
665
+ text: string;
666
+ labels: Record<string, string>;
667
+ author: ExternalAuthor;
668
+ raw: unknown;
669
+ };
670
+ type RootOverride = (root: Readonly<SyncRoot>) => {
671
+ text?: string;
672
+ labels?: Record<string, string>;
673
+ };
674
+ declare const SyncOverrides: z.ZodObject<{
675
+ root: z.ZodOptional<z.ZodCustom<RootOverride, RootOverride>>;
676
+ text: z.ZodOptional<z.ZodString>;
677
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
678
+ unset: z.ZodOptional<z.ZodArray<z.ZodString>>;
679
+ noSync: z.ZodOptional<z.ZodBoolean>;
680
+ }, z.core.$strict>;
681
+ type SyncOverrides = z.infer<typeof SyncOverrides>;
682
+ /** What an import made: its thread's root and the message, as IDs clients pass back as they got them. */
683
+ type SyncResult = {
684
+ root: string | null;
685
+ message: string | null;
686
+ };
687
+ //#endregion
688
+ //#region src/sync/fn.d.ts
689
+ /** An event coming in from the platform. */
690
+ type SyncIn<E extends ProviderEvent = ProviderEvent> = {
691
+ direction: 'in';
692
+ /** The sync entry's key: `slack` in `sync: { slack: slack(…) }`. */
693
+ key: string;
694
+ /** The platform channel it happened in, as the platform names it: `C0123ABC`, `owner/repo:pulls`, a phone number ID. */
695
+ channel: string;
696
+ /** The event, validated and frozen. */
697
+ event: E;
698
+ /** The board, as the platform user the event came from: its writes are theirs. */
699
+ board: BoardClient;
700
+ /**
701
+ * Imports the event: into its board thread when the board syncs its platform thread, otherwise
702
+ * as a new root in `channel`. Without a channel, an event in a thread the board doesn't sync
703
+ * stays off it. Runs once: a second call answers what the first did.
704
+ */
705
+ import(channel?: string, overrides?: SyncOverrides): Promise<SyncResult>;
706
+ /** The platform's own link to the event's message, or null when it has none. Nothing is synced or joined. */
707
+ permalink(): Promise<string | null>;
708
+ /** A platform channel's ID from its name (`#dev` → `C0123ABC`), as `channel` names it. */
709
+ resolve(name: string): Promise<string>;
710
+ };
711
+ /** A board event going out to the platform. */
712
+ type SyncOut = {
713
+ direction: 'out';
714
+ key: string;
715
+ /** The platform channel `target` is in, as the platform names it; null for a new root, which isn't on the platform yet. */
716
+ channel: string | null;
717
+ event: BoardEventView;
718
+ /** The message the event is about, as it is now. */
719
+ message: MessageView;
720
+ /** Where it goes: a platform thread or channel the board thread syncs with (`slack:C0123ABC:1727000000.123456`), or null for a new root. */
721
+ target: string | null;
722
+ /**
723
+ * Sends the event to `target`: a new thread's root and what's been said in it, a reply, an
724
+ * edit, a delete, a reaction, or the copy a label change re-renders. A new root has no target
725
+ * yet, so it sends nothing. Runs once: a second call answers what the first did.
726
+ */
727
+ deliver(options?: {
728
+ render?: Renderer;
729
+ }): Promise<void>;
730
+ /**
731
+ * Syncs the message's thread with a platform channel (`#dev`, `C0123ABC`): the board starts a
732
+ * thread there, and its root and replies follow. Never the channel it came from.
733
+ */
734
+ start(channel: string): Promise<void>;
735
+ resolve(name: string): Promise<string>;
736
+ };
737
+ type Sync<E extends ProviderEvent = ProviderEvent> = SyncIn<E> | SyncOut;
738
+ /**
739
+ * What every event does, both ways. Inbound, it calls `import` to bring the event onto the board;
740
+ * outbound, `deliver` to send it to the platform, or `start` to open a new root's thread there.
741
+ * One that calls neither does nothing. A throw is retried.
742
+ *
743
+ * The webhook keeps an event (stores it in the inbox for the function) when the board syncs its
744
+ * thread, or when its channel is one that `channels`, `repos`, or `numbers` routes. A function of
745
+ * your own at the top keeps every event the platform sends, so keep the helper outermost.
746
+ */
747
+ type SyncFn<E extends ProviderEvent = ProviderEvent> = (sync: Sync<E>) => unknown;
748
+ /** A sync function, or a board channel: what a string means is up to the helper that takes it. */
749
+ type SyncUnit<E extends ProviderEvent = ProviderEvent> = string | SyncFn<E>;
750
+ /**
751
+ * A two-way mirror of a board channel: what comes in lands in `channel`, what's said on the
752
+ * board goes out, and a new root in `channel` starts a thread in the platform channel.
753
+ */
754
+ declare function mirror(channel: string): SyncFn;
755
+ /** Imports into a board channel, and sends nothing back. */
756
+ declare function into(channel: string): SyncFn;
757
+ /** `inner`, delivering with `renderer` unless it passes its own. */
758
+ declare function render<E extends ProviderEvent = ProviderEvent>(renderer: Renderer, inner: SyncFn<E>): SyncFn<E>;
759
+ /**
760
+ * Routes each event by its platform channel. Keys are platform channels, by name (`'#dev'`) or
761
+ * ID (`'C0123ABC'`); values are a board channel to `mirror`, or a sync function. A new root goes
762
+ * to every channel's function, with `channel` set to that one. A thread the board syncs outside
763
+ * these channels (someone ran `vb sync` on it) stays synced both ways. A key the platform says
764
+ * doesn't exist is skipped. While one can't be checked, an event outside the resolved channels
765
+ * throws, so it's retried, rather than going past that key's function to the default. A new root
766
+ * starts only in the channels that resolved.
767
+ */
768
+ declare function channels<E extends ProviderEvent = ProviderEvent>(map: Record<string, SyncUnit<E>>): SyncFn<E>;
769
+ //#endregion
770
+ //#region src/sync/provider.d.ts
771
+ declare const ResolvedTarget: z.ZodObject<{
772
+ target: z.ZodString;
773
+ channel: z.ZodString;
774
+ kind: z.ZodEnum<{
775
+ channel: "channel";
776
+ thread: "thread";
777
+ }>;
778
+ }, z.core.$strict>;
779
+ type ResolvedTarget = z.infer<typeof ResolvedTarget>;
780
+ /** The fields a provider's `event` builds its typed event from. */
781
+ type SyncContext = {
782
+ id: string;
783
+ key: string;
784
+ event: ExternalEvent;
785
+ raw: unknown;
786
+ };
787
+ type RenderInput = {
788
+ /** The message as clients see it: its IDs are refs. */
789
+ message: Readonly<MessageView>;
790
+ author: Readonly<Actor> | null;
791
+ /** How this platform mentions an actor when it's one of its own (`<@U123>`); null for anyone else. */
792
+ mentionOf: (actor: string) => string | null;
793
+ label: string;
794
+ target: string;
795
+ };
796
+ /** How a platform shows a board message: markdown, which the platform converts to its own format. */
797
+ type Renderer = (input: RenderInput) => string;
798
+ type FileDelivery = {
799
+ message: string;
800
+ files: string[];
801
+ };
802
+ /** What a linked message said, or why the platform wouldn't say. */
803
+ type FetchedLink = Pick<Link, 'snapshot' | 'unavailable'>;
804
+ /** Why a platform wouldn't read a channel or thread on demand. Its message is shown as is. */
805
+ declare class UnreadableError extends Error {
806
+ readonly code: string;
807
+ constructor(code: string, message: string);
808
+ }
809
+ /** A file to send: its bytes (a Node `Buffer` is one), its name, and its type. */
810
+ type ProviderFile = {
811
+ data: Uint8Array;
812
+ filename: string;
813
+ mimeType?: string;
814
+ };
815
+ /**
816
+ * Who a post is from, for a platform that can show it as the sender (Slack's per-message
817
+ * username and icon): `name` is the label the text opens with (`**name**: …`).
818
+ */
819
+ type ProviderSender = {
820
+ name: string;
821
+ avatar: string | null;
822
+ };
823
+ type ProviderPost = {
824
+ markdown: string;
825
+ files?: ProviderFile[];
826
+ as?: ProviderSender;
827
+ };
828
+ type ProviderDelivery = {
829
+ thread: string;
830
+ message: string;
831
+ files?: string[];
832
+ };
833
+ type ProviderOptions = {
834
+ platform: string;
835
+ canStartThreads?: boolean;
836
+ singleReaction?: boolean;
837
+ uploadsFiles?: boolean;
838
+ /** Whether a new thread's root can carry its files in the same message as its text. */
839
+ startsThreadsWithFiles?: boolean;
840
+ };
841
+ declare const ReceivedEvent: z.ZodObject<{
842
+ event: z.ZodDiscriminatedUnion<[z.ZodObject<{
843
+ channel: z.ZodString;
844
+ thread: z.ZodString;
845
+ subthread: z.ZodNullable<z.ZodString>;
846
+ kind: z.ZodLiteral<"message">;
847
+ message: z.ZodString;
848
+ isRoot: z.ZodBoolean;
849
+ text: z.ZodString;
850
+ context: z.ZodNullable<z.ZodString>;
851
+ author: z.ZodObject<{
852
+ id: z.ZodString;
853
+ handle: z.ZodString;
854
+ name: z.ZodString;
855
+ avatar: z.ZodNullable<z.ZodString>;
856
+ isBot: z.ZodBoolean;
857
+ }, z.core.$strip>;
858
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
859
+ type: z.ZodEnum<{
860
+ audio: "audio";
861
+ file: "file";
862
+ image: "image";
863
+ video: "video";
864
+ }>;
865
+ name: z.ZodOptional<z.ZodString>;
866
+ mimeType: z.ZodOptional<z.ZodString>;
867
+ size: z.ZodOptional<z.ZodNumber>;
868
+ url: z.ZodOptional<z.ZodString>;
869
+ fetchMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
870
+ }, z.core.$strip>>>;
871
+ links: z.ZodOptional<z.ZodArray<z.ZodObject<{
872
+ url: z.ZodString;
873
+ thread: z.ZodString;
874
+ message: z.ZodString;
875
+ snapshot: z.ZodNullable<z.ZodObject<{
876
+ author: z.ZodString;
877
+ text: z.ZodString;
878
+ createdAt: z.ZodNullable<z.ZodString>;
879
+ files: z.ZodArray<z.ZodObject<{
880
+ name: z.ZodString;
881
+ url: z.ZodNullable<z.ZodString>;
882
+ }, z.core.$strip>>;
883
+ }, z.core.$strip>>;
884
+ }, z.core.$strip>>>;
885
+ }, z.core.$strip>, z.ZodObject<{
886
+ channel: z.ZodString;
887
+ thread: z.ZodString;
888
+ subthread: z.ZodNullable<z.ZodString>;
889
+ kind: z.ZodLiteral<"edited">;
890
+ message: z.ZodString;
891
+ text: z.ZodString;
892
+ author: z.ZodObject<{
893
+ id: z.ZodString;
894
+ handle: z.ZodString;
895
+ name: z.ZodString;
896
+ avatar: z.ZodNullable<z.ZodString>;
897
+ isBot: z.ZodBoolean;
898
+ }, z.core.$strip>;
899
+ links: z.ZodOptional<z.ZodArray<z.ZodObject<{
900
+ url: z.ZodString;
901
+ thread: z.ZodString;
902
+ message: z.ZodString;
903
+ snapshot: z.ZodNullable<z.ZodObject<{
904
+ author: z.ZodString;
905
+ text: z.ZodString;
906
+ createdAt: z.ZodNullable<z.ZodString>;
907
+ files: z.ZodArray<z.ZodObject<{
908
+ name: z.ZodString;
909
+ url: z.ZodNullable<z.ZodString>;
910
+ }, z.core.$strip>>;
911
+ }, z.core.$strip>>;
912
+ }, z.core.$strip>>>;
913
+ linksOnly: z.ZodOptional<z.ZodBoolean>;
914
+ }, z.core.$strip>, z.ZodObject<{
915
+ channel: z.ZodString;
916
+ thread: z.ZodString;
917
+ subthread: z.ZodNullable<z.ZodString>;
918
+ kind: z.ZodLiteral<"deleted">;
919
+ message: z.ZodString;
920
+ }, z.core.$strip>, z.ZodObject<{
921
+ channel: z.ZodString;
922
+ thread: z.ZodString;
923
+ subthread: z.ZodNullable<z.ZodString>;
924
+ kind: z.ZodLiteral<"reaction">;
925
+ message: z.ZodString;
926
+ emoji: z.ZodString;
927
+ added: z.ZodBoolean;
928
+ author: z.ZodObject<{
929
+ id: z.ZodString;
930
+ handle: z.ZodString;
931
+ name: z.ZodString;
932
+ avatar: z.ZodNullable<z.ZodString>;
933
+ isBot: z.ZodBoolean;
934
+ }, z.core.$strip>;
935
+ }, z.core.$strip>, z.ZodObject<{
936
+ channel: z.ZodString;
937
+ thread: z.ZodString;
938
+ kind: z.ZodLiteral<"lifecycle">;
939
+ type: z.ZodString;
940
+ title: z.ZodString;
941
+ url: z.ZodNullable<z.ZodString>;
942
+ body: z.ZodOptional<z.ZodNullable<z.ZodString>>;
943
+ labels: z.ZodRecord<z.ZodString, z.ZodString>;
944
+ unset: z.ZodArray<z.ZodString>;
945
+ owns: z.ZodOptional<z.ZodArray<z.ZodString>>;
946
+ reply: z.ZodNullable<z.ZodString>;
947
+ createRoot: z.ZodBoolean;
948
+ retitled: z.ZodOptional<z.ZodBoolean>;
949
+ author: z.ZodObject<{
950
+ id: z.ZodString;
951
+ handle: z.ZodString;
952
+ name: z.ZodString;
953
+ avatar: z.ZodNullable<z.ZodString>;
954
+ isBot: z.ZodBoolean;
955
+ }, z.core.$strip>;
956
+ }, z.core.$strip>], "kind">;
957
+ raw: z.ZodUnknown;
958
+ dedupe: z.ZodString;
959
+ }, z.core.$strip>;
960
+ type ReceivedEvent = z.infer<typeof ReceivedEvent>;
961
+ type Receive = (received: ReceivedEvent) => Promise<void>;
962
+ declare abstract class SyncProvider<E extends ProviderEvent = ProviderEvent> {
963
+ readonly platform: string;
964
+ readonly canStartThreads: boolean;
965
+ readonly singleReaction: boolean;
966
+ readonly uploadsFiles: boolean;
967
+ readonly startsThreadsWithFiles: boolean;
968
+ private readonly fn;
969
+ protected readonly options: ProviderOptions;
970
+ constructor(options: ProviderOptions, sync: SyncFn<E>);
971
+ abstract receive(key: string, request: Request, emit: Receive): Promise<Response>;
972
+ abstract resolveChannel(key: string): Promise<string>;
973
+ abstract resolveTarget(target: string): Promise<ResolvedTarget>;
974
+ abstract post(target: string, kind: ResolvedTarget['kind'], body: ProviderPost): Promise<ProviderDelivery>;
975
+ findByEmail(_email: string): Promise<ExternalAuthor | null>;
976
+ mention(_actor: Actor): string | null;
977
+ fetchRoot(_thread: string): Promise<SyncRoot | null>;
978
+ fetchFile(_file: ExternalFile): Promise<Uint8Array | null>;
979
+ /** The platform's own link to an event's message, or null when it has none. */
980
+ permalink(_event: E): Promise<string | null>;
981
+ /**
982
+ * A linked message the platform didn't describe, read from the platform. `linker` is the
983
+ * platform message that links it, by its own IDs: what the platform says about the link may be
984
+ * there by now.
985
+ */
986
+ fetchLink(_link: ExternalLink, _linker: {
987
+ thread: string;
988
+ message: string;
989
+ }): Promise<FetchedLink>;
990
+ /**
991
+ * The message a URL of this platform's names, by its own thread and message IDs, or null for a
992
+ * URL that isn't one. `message` is null for a link to a thread itself. It asks the platform
993
+ * nothing: the board answers from what it synced (`vb read <url>`).
994
+ */
995
+ locate(_url: string): {
996
+ thread: string;
997
+ message: string | null;
998
+ } | null;
999
+ /** The platform's URL for one of its messages, by its own IDs, or null when it has none (`vb sync <id>`). */
1000
+ url(_thread: string, _message: string): Promise<string | null>;
1001
+ /**
1002
+ * A channel or thread, read on demand for whoever asked: nothing is synced,
1003
+ * stored, or joined. Throws `UnreadableError` for what it won't read.
1004
+ */
1005
+ read(_target: string, _options: {
1006
+ limit: number;
1007
+ after: string | null;
1008
+ }): Promise<SourceRead>;
1009
+ /** Adds the board's app to a channel so `read` can read it, where the board opted in. Throws `UnreadableError` otherwise. */
1010
+ join(_target: string): Promise<SourceJoin>;
1011
+ edit(_thread: string, _message: string, _body: ProviderPost): Promise<void>;
1012
+ delete(_thread: string, _message: string): Promise<void>;
1013
+ react(_thread: string, _message: string, _emoji: string, _added: boolean): Promise<void>;
1014
+ startTyping(_thread: string, _latest: string | null, _status?: string): Promise<void>;
1015
+ /**
1016
+ * The channel whose inbox a thread's events land in (`slack:C0123ABC` for `slack:C0123ABC:1727.1234`),
1017
+ * worked out without calling the platform. Null when the provider can't tell: a key's inbox then
1018
+ * lists only the mapped channels'.
1019
+ */
1020
+ inboxChannel(_key: string, _thread: string): string | null;
1021
+ deleteFiles(_ids: string[]): Promise<void>;
1022
+ refusesFiles(_error: unknown): boolean;
1023
+ uploadFiles(_thread: string, _files: ProviderFile[]): Promise<FileDelivery>;
1024
+ abstract event(context: SyncContext): E;
1025
+ /** Runs the sync function the provider was made with: what every event does, both ways. */
1026
+ sync(sync: Sync<E>): unknown;
1027
+ /** The default rendering: `**${label}**: ${text}`. A `Renderer` passed to `deliver` replaces it. */
1028
+ render(input: RenderInput): string;
1029
+ }
1030
+ //#endregion
1031
+ export { envelope as A, ScheduleTiming as B, render as C, SyncOverrides as D, RootOverride as E, Filters as F, WaitOptions as H, PostOptions as I, ProfileOption as L, BoardClient as M, BoardError as N, SyncResult as O, ErrorOrigin as P, ReplyOptions as R, mirror as S, ProviderEvent as T, Written as U, UploadInput as V, duration as W, 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, ScheduleOptions as z };