@vercel/board 0.48.1 → 0.49.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 (82) hide show
  1. package/dist/{access-C06pIr0M.mjs → access-B8DnrnHa.mjs} +29 -17
  2. package/dist/access.d.mts +2 -2
  3. package/dist/access.mjs +5 -5
  4. package/dist/{actors-Dkyg-oo0.mjs → actors-DewJKyqy.mjs} +4 -3
  5. package/dist/{auth-B9-wXQ-x.mjs → auth-CEU06Nyp.mjs} +2 -2
  6. package/dist/{auth-li3lKwJG.d.mts → auth-Z9-Khvvw.d.mts} +1 -1
  7. package/dist/{backend-UBP6HimX.d.mts → backend-BzCXxVZ-.d.mts} +19 -5
  8. package/dist/backend-local.d.mts +1 -1
  9. package/dist/backend-local.mjs +1 -1
  10. package/dist/{chat-provider-kNWd6MQC.mjs → chat-provider-BS_fr61g.mjs} +2 -2
  11. package/dist/{chat-provider-iN0DFsSE.d.mts → chat-provider-DQ1GHm4o.d.mts} +2 -2
  12. package/dist/cli-commands.d.mts +1 -1
  13. package/dist/cli-commands.mjs +1 -1
  14. package/dist/cli-embedded.d.mts +2 -2
  15. package/dist/cli-embedded.mjs +3 -3
  16. package/dist/cli.mjs +6 -6
  17. package/dist/client-C2T4eaXd.d.mts +544 -0
  18. package/dist/{commands-CJsOA-hf.d.mts → commands-Cm4sODIu.d.mts} +12 -8
  19. package/dist/{commands-Dk6_cHLS.mjs → commands-nN8WpvCe.mjs} +75 -58
  20. package/dist/{conformance-CDP8y2Zm.mjs → conformance-0xONNKcB.mjs} +102 -20
  21. package/dist/conformance.d.mts +1 -1
  22. package/dist/conformance.mjs +1 -1
  23. package/dist/{engine-BQ0hJw2w.mjs → engine-BH_nfJ3N.mjs} +6 -5
  24. package/dist/{errors-QhkdzI-o.mjs → errors-DwV7I0g4.mjs} +53 -174
  25. package/dist/{events-B-qyxNsJ.mjs → events-B76-4bNp.mjs} +2 -2
  26. package/dist/{exports-inhbjAWi.d.mts → exports-CKEK1fxf.d.mts} +4 -4
  27. package/dist/{exports-BzSG0_wL.mjs → exports-DLzyKwEp.mjs} +336 -82
  28. package/dist/{external-BuVTXT1R.mjs → external-BLI4W_-V.mjs} +1 -1
  29. package/dist/{index-B0Fnhvk7.d.mts → index-DxqSw8yd.d.mts} +2 -2
  30. package/dist/index.d.mts +6 -6
  31. package/dist/index.mjs +4 -4
  32. package/dist/index.node.d.mts +7 -7
  33. package/dist/index.node.mjs +4 -4
  34. package/dist/inspect/app.js +39 -39
  35. package/dist/inspect-B2ImmOvw.mjs +272 -0
  36. package/dist/inspect-DnRQUmP8.mjs +2 -0
  37. package/dist/inspect.d.mts +17 -0
  38. package/dist/inspect.mjs +196 -0
  39. package/dist/{local-BdKxz-Dn.mjs → local-DPpSEq2_.mjs} +132 -50
  40. package/dist/{main-BgiViRZ8.mjs → main-CqX7JqzE.mjs} +214 -46
  41. package/dist/{memory-CMm-Fk_A.mjs → memory-DzqkXIB-.mjs} +2 -2
  42. package/dist/{middleware-CT6vMNUc.mjs → middleware-ysFm2S4v.mjs} +2 -2
  43. package/dist/{page-D-OzDOAX.mjs → page-7KWSGxyC.mjs} +12 -2
  44. package/dist/page-CN77B014.mjs +2 -0
  45. package/dist/profile-header-Cj0Cb1cf.mjs +163 -0
  46. package/dist/{provider-DC3WHUXo.d.mts → provider-Dwb_9mnu.d.mts} +3 -529
  47. package/dist/{routes-CjA6Mp4D.d.mts → routes-B6SEA9yw.d.mts} +130 -4
  48. package/dist/{routes-ABXf3CKq.mjs → routes-qS92xz8U.mjs} +33 -7
  49. package/dist/{schemas-7VFdomFB.mjs → schemas-TeVe4Udh.mjs} +4 -2
  50. package/dist/{serve-C2Jbr7pR.mjs → serve-CYr4RwRM.mjs} +5 -5
  51. package/dist/{server-EOQC5Gtq.mjs → server-V7qyVUiJ.mjs} +11 -9
  52. package/dist/{serving-BNdiReQT.mjs → serving-BzNxlnDV.mjs} +1 -1
  53. package/dist/{inspect-n9brh-TT.mjs → shell-BLHZoP-x.mjs} +25 -274
  54. package/dist/{sql-IEbO5vXs.mjs → sql-DIKQd5Me.mjs} +2 -2
  55. package/dist/{sqlite-CVG8XKHm.mjs → sqlite-BF9kBDh1.mjs} +2 -2
  56. package/dist/{sqlite-db-BJjPQYx4.mjs → sqlite-db-CSYwiZ4E.mjs} +1 -1
  57. package/dist/sync-chat-sdk.d.mts +2 -2
  58. package/dist/sync-chat-sdk.mjs +2 -2
  59. package/dist/sync-github.d.mts +2 -2
  60. package/dist/sync-github.mjs +2 -2
  61. package/dist/sync-linear.d.mts +3 -3
  62. package/dist/sync-linear.mjs +2 -2
  63. package/dist/sync-slack.d.mts +3 -3
  64. package/dist/sync-slack.mjs +11 -7
  65. package/dist/sync.d.mts +2 -2
  66. package/dist/sync.mjs +2 -2
  67. package/dist/{task-batch-D4p9N8lN.mjs → task-batch-CujTLmTB.mjs} +10 -11
  68. package/dist/{tokens-BCp4EWTQ.mjs → tokens-BmCDAT4N.mjs} +2 -2
  69. package/dist/version-BCoWGLEW.mjs +5 -0
  70. package/docs/01-board/01-mounting.md +8 -0
  71. package/docs/01-board/04-messages.md +6 -2
  72. package/docs/01-board/05-reading.md +17 -2
  73. package/docs/01-board/09-access.md +40 -6
  74. package/docs/01-board/11-tasks.md +3 -3
  75. package/docs/03-guides/02-inspector.md +31 -0
  76. package/docs/04-reference/01-cli.md +81 -32
  77. package/docs/04-reference/02-board.md +14 -3
  78. package/docs/04-reference/03-http.md +5 -3
  79. package/docs/04-reference/05-conformance.md +7 -0
  80. package/package.json +5 -1
  81. package/dist/inspect-BB-XUPuz.mjs +0 -2
  82. package/dist/page-Dr9Aqlej.mjs +0 -2
@@ -1,532 +1,6 @@
1
- import { $ as MessagesQueryInput, A as FiltersInput, An as ExternalAuthor, Bt as SyncThreadView, Ct as SchemaInput, En as Attachment, Ft as SyncFindView, Gt as TasksPage, Ht as TaskClaim, L as InboxEntry, Lt as SyncImportInput, Mn as ExternalFile, N as GrantInput, Nn as ExternalLink, Nt as SyncFindInput, O as Explanation, Ot as SourceRead, P as GrantView, Pn as Link, Qt as ThreadsQueryInput, R as InboxItem, S as Discovery, Tn as ExternalCopy, Tt as SourceJoin, Vt as SyncedView, X as MessageView, Xt as ThreadsPage, Y as Me, Yt as ThreadView, Z as MessagesPage, bt as SchedulesQueryInput, jn as ExternalEvent, lt as RegisterInput, n as ActorView, nn as UpdateGrantInput, q as MatchView, qt as TasksQueryInput, s as BoardEventView, u as ChannelView, ut as RegistrationView, vt as ScheduleView, w as EventsPage, wn as Actor, wt as SchemaView, zt as SyncReceiptInput } from "./routes-CjA6Mp4D.mjs";
1
+ import { $ as MessageView, An as Actor, Bn as Link, In as ExternalAuthor, Ln as ExternalEvent, Mt as SourceRead, Rn as ExternalFile, kt as SourceJoin, s as BoardEventView, zn as ExternalLink } from "./routes-B6SEA9yw.mjs";
2
+ import { t as BoardClient } from "./client-C2T4eaXd.mjs";
2
3
  import { z } from "zod";
3
- //#region src/contract/mentions.d.ts
4
- /** An actor as a write's answer names them. */
5
- type MentionedActor = {
6
- id: string;
7
- handle: string;
8
- name: string;
9
- };
10
- /**
11
- * What became of an `@handle` a write typed. With `actor`, it named that one actor and the text now
12
- * has `@[actor-id]` in its place. With `actor: null`, it's still in the text as typed, a mention of
13
- * no one: `candidates` is who it could have meant, the several who have that handle, or for a handle
14
- * with no `/`, whoever has it under a name (`support/malte` for `@malte`).
15
- */
16
- type Mentioned = {
17
- written: string;
18
- actor: MentionedActor | null;
19
- candidates: MentionedActor[];
20
- };
21
- //#endregion
22
- //#region src/client/client.d.ts
23
- /**
24
- * Where an error came from: `handle`, raised by the handle on this machine (no Vercel login,
25
- * Deployment Protection), or `board`, a board's answer, whose words are its own whatever code it
26
- * names.
27
- */
28
- type ErrorOrigin = 'handle' | 'board';
29
- /**
30
- * What went wrong: `message` says what and why, `code` is what to branch on, `hint`, when there's
31
- * one, what fixes it, and `origin` who said so. Trust a `board` one's message and hint as you would
32
- * the board.
33
- */
34
- declare class BoardError extends Error {
35
- readonly code: string;
36
- readonly status: number;
37
- readonly hint: string | undefined;
38
- readonly origin: ErrorOrigin;
39
- constructor(code: string, message: string, status: number, options?: {
40
- hint?: string;
41
- origin?: ErrorOrigin;
42
- });
43
- }
44
- type Resolvable<T> = T | (() => T | Promise<T>);
45
- /** A profile name, `{ name, avatar }`, or null for no profile. */
46
- type ProfileOption = string | {
47
- name: string;
48
- avatar?: string;
49
- } | null;
50
- type ClientOptions = {
51
- /** The board's URL, e.g. `https://www.example.com/api/board`. */
52
- url: string;
53
- /** An OIDC token whose audience is the board's URL, or a function returning one. Without one, `fetch` brings the credentials. */
54
- token?: Resolvable<string>;
55
- profile?: Resolvable<ProfileOption>;
56
- /** Extra headers on every request. */
57
- headers?: Resolvable<Record<string, string>>;
58
- fetch?: typeof fetch;
59
- /**
60
- * How a direct upload's bytes go to the blob store's signed URL: `fetch` by default, never the
61
- * board's own, which brings the board's credentials and would hand them to the store.
62
- */
63
- storeFetch?: typeof fetch;
64
- };
65
- /**
66
- * What a write that took a text answers: what it made, and under `mentions`, what became of each
67
- * `@handle` the text typed, when it typed any.
68
- */
69
- type Written<T> = T & {
70
- mentions?: Mentioned[];
71
- };
72
- type PostOptions = {
73
- text: string;
74
- labels?: Record<string, string>;
75
- /** Keep this message on the board: no configured sync targets. */
76
- noSync?: boolean;
77
- /** External targets the new thread starts with: `slack:#incidents` starts one, `github:owner/repo:12` joins one. */
78
- sync?: string[];
79
- /** Makes retries idempotent: the same id never posts twice. */
80
- id?: string;
81
- /** Files from `upload`, or their IDs. */
82
- attachments?: (Attachment | string)[];
83
- };
84
- type ReplyOptions = Omit<PostOptions, 'sync'> & {
85
- /**
86
- * Posts only while this is the thread's newest message: the ID of the last one you read. If
87
- * another has come after it, nothing is posted, and it throws a 409 `newer_message`.
88
- */
89
- after?: string;
90
- };
91
- /**
92
- * When a scheduled message goes out: once `in` a while or `at` a time, or
93
- * `every` so often (first at `at`, `in`, or one `every` from now), stopping
94
- * `until` a time, `for` a while after the first send, or after `times` sends.
95
- * A repeat with no stop runs until it's canceled.
96
- */
97
- type ScheduleTiming = {
98
- in?: string;
99
- at?: Date | string;
100
- every?: string;
101
- until?: Date | string;
102
- for?: string;
103
- times?: number;
104
- };
105
- type ScheduleOptions = Omit<PostOptions, 'sync' | 'id'> & ScheduleTiming;
106
- /**
107
- * What makes a thread a task: the tasks it waits for (`needs`, by their IDs), the one actor of
108
- * yours that claims it (`for`, `<your principal>+<profile>`), and `claim`, which claims it in the
109
- * same write, for `lease` seconds.
110
- */
111
- type TaskOptions = {
112
- needs?: string[];
113
- for?: string | null;
114
- claim?: boolean;
115
- lease?: number;
116
- };
117
- /** A new thread that's a task: its root's text, labels, `noSync`, `attachments`, and `id`, as a post takes them, and what makes it a task. */
118
- type NewTaskOptions = TaskOptions & Pick<PostOptions, 'text' | 'labels' | 'noSync' | 'attachments' | 'id'>;
119
- /**
120
- * One task of several made together: its root's text, labels, `noSync`, and `attachments`, as a
121
- * post takes them. `key` is a name for it among the others, and `needs` takes a task's ID, or
122
- * `{ key }` for one made with it, before or after it. `for` is the one actor of yours that claims it.
123
- */
124
- type TaskInBatch = Required<Pick<PostOptions, 'text'>> & Pick<PostOptions, 'labels' | 'noSync' | 'attachments'> & {
125
- key?: string;
126
- needs?: (string | {
127
- key: string;
128
- })[];
129
- for?: string | null;
130
- };
131
- /**
132
- * What a claim does, each fenced by the claim: once it's over (released, settled, held, taken over,
133
- * or past its lease), they throw a 409 `claim_lost` and change nothing.
134
- */
135
- type HeldTask = {
136
- /** Extends the lease from now, by `lease` seconds (the board's default without one). Answers the claim with its new `until`. */
137
- renew(lease?: number): Promise<ClaimedTask>;
138
- /** Gives the task back: it's ready again. */
139
- release(): Promise<MessageView>;
140
- complete(result?: string): Promise<MessageView>;
141
- fail(reason: string): Promise<MessageView>;
142
- /** Holds the task for a person, which ends the claim: `kind` says what for (`needs_input`, `awaiting_approval`). */
143
- block(reason: string, opts?: {
144
- kind?: string;
145
- }): Promise<MessageView>;
146
- };
147
- /**
148
- * A task you hold until `until`: its root as the claim left it, and the claim's `epoch` and
149
- * `token`, which `held` takes to act on it from another process.
150
- */
151
- type ClaimedTask = HeldTask & TaskClaim & {
152
- task: MessageView;
153
- };
154
- /** What `upload` takes: the bytes, and what to call them. */
155
- type UploadInput = {
156
- data: Blob | Uint8Array<ArrayBuffer>;
157
- name: string;
158
- /** A MIME type; a `Blob`'s own type, or one from the name's extension, otherwise. */
159
- type?: string;
160
- };
161
- /** Whether live events are flowing: `live` once the board has answered a request for them, `retrying` once one failed and it's backing off. */
162
- type EventsState = 'live' | 'retrying';
163
- /**
164
- * What following events takes: a `signal` that stops it, and `onState`, told each time the feed
165
- * goes live or starts retrying. It hears nothing before the first answer or failure.
166
- */
167
- type EventsOptions = {
168
- signal?: AbortSignal;
169
- onState?: (state: EventsState) => void;
170
- };
171
- type WaitOptions = {
172
- /** `'30s'`, `'10m'`, `'1h'`, or milliseconds. Default `'30m'`. */
173
- timeout?: string | number;
174
- signal?: AbortSignal;
175
- };
176
- declare function duration(value: string | number): number;
177
- type Filters = Omit<FiltersInput, 'label'> & {
178
- /** `{ status: 'open' }` or `['status=open']`. */
179
- label?: Record<string, string> | string[];
180
- };
181
- type BoardClient = ReturnType<typeof createBoardClient>;
182
- /** Whom `explain` asks about: nobody for yourself, or one principal as people name it. */
183
- type ExplainPrincipal = {
184
- user?: string;
185
- project?: string;
186
- /** Where the project's deployment runs: production when left out. */
187
- environment?: string;
188
- github?: string;
189
- workflow?: string;
190
- branch?: string;
191
- event?: string;
192
- oidc?: string;
193
- claims?: Record<string, string>;
194
- /** An app on the team, by its slug or client ID. */
195
- app?: string;
196
- };
197
- declare function createBoardClient(options: ClientOptions): {
198
- url: string;
199
- /**
200
- * The board's HTTP API with this client's credentials, and the response as
201
- * the board sent it, errors included: for proxies like `vb inspect`.
202
- */
203
- request: (path: string, init?: {
204
- method?: string;
205
- body?: Uint8Array<ArrayBuffer>;
206
- headers?: Record<string, string>;
207
- signal?: AbortSignal;
208
- /** Act as this profile (`null` for yourself) instead of the client's. */
209
- as?: ProfileOption;
210
- }) => Promise<Response>;
211
- discovery: () => Promise<Discovery>;
212
- me: () => Promise<Me>;
213
- channels: () => Promise<ChannelView[]>;
214
- /**
215
- * Makes a channel before anything posts to it, as a first post would. Needs `read` and `post`
216
- * there. `created` is false when it was there already; it's left as it is.
217
- *
218
- * `private` makes it closed to everyone but you, from the protocol's own methods: a grant
219
- * letting you in at `<path>/`, then one closing `<path>/` to everyone else, then the channel,
220
- * answering the two grants as `grants`. A failure part way leaves the channel open with a grant
221
- * too many, or closed and not made yet, and never shuts you out. Before it writes anything, it
222
- * refuses a caller that's neither a person nor a project's deployment (400 `no_own_principal`),
223
- * one that can't list grants, a path a grant other than `*`'s reaches already (409
224
- * `channel_granted`: the channel, `<path>/`, or a pattern under it, whose grants would still let
225
- * in whoever they name), and a path where it or a channel under it is there already (409
226
- * `channel_exists`), since closing `security/` closes `security/incidents` too. A board that
227
- * keeps no grants fails on the listing, with nothing made. Once its own grant is made it lists
228
- * them again, and takes its own back when another reaches the path, so of two callers making
229
- * the same channel at once, at most one keeps a way in; and once the lock is made, it lists them
230
- * a last time, and takes both back when a grant made in between still reaches the path, or its
231
- * own two aren't as it made them (someone added themselves to its grant, or opened the lock).
232
- */
233
- createChannel: (path: string, options?: {
234
- private?: boolean;
235
- }) => Promise<{
236
- channel: ChannelView;
237
- created: boolean;
238
- grants?: GrantView[];
239
- }>;
240
- actors: () => Promise<(Actor & Pick<ActorView, "verified">)[]>;
241
- messages: (query?: Filters & Omit<MessagesQueryInput, keyof FiltersInput>) => Promise<MessagesPage>;
242
- thread: (id: string) => Promise<ThreadView>;
243
- /** Your own post with the client ID you gave it, as posting it answered: 404 `post_not_found` when there's none. */
244
- posted: (id: string) => Promise<MessageView>;
245
- /** Threads with a matching message, one summary each (root, reply count, latest reply), by latest activity. `limit` counts threads; `before` takes a page's `older`. */
246
- threads: (query?: Filters & Omit<ThreadsQueryInput, keyof FiltersInput>) => Promise<ThreadsPage>;
247
- /**
248
- * Starts a thread. An `@handle` in the text that names exactly one actor you can see is stored as
249
- * `@[actor-id]`, a mention of them; one that names none or several stays as typed, a mention of
250
- * no one. `mentions` on what comes back says what became of each, when the text typed any.
251
- */
252
- post(channel: string, input: string | PostOptions): Promise<Written<MessageView>>;
253
- /** Replies in a thread. Its `@handle`s are settled as `post`'s are: of several who share one, it's the one who wrote in the thread. */
254
- reply(id: string, input: string | ReplyOptions): Promise<Written<MessageView>>;
255
- /**
256
- * Posts later, as you: a new thread when `target` is a channel, a reply when it's
257
- * `{ re }`, any message's ID in the thread. Each message it posts carries
258
- * `schedule: { id, n }`. Needs a board with a scheduler.
259
- */
260
- schedule(target: string | {
261
- re: string;
262
- }, input: ScheduleOptions): Promise<Written<ScheduleView>>;
263
- /** Pending schedules (`all` for done and canceled too), oldest first. `re` is any message in a thread. */
264
- schedules: (query?: Omit<SchedulesQueryInput, 'all'> & {
265
- all?: boolean;
266
- }) => Promise<ScheduleView[]>;
267
- /** Stops a schedule: yours, or any with manage in its channel. `canceled` is false when it was already done or canceled. */
268
- cancelSchedule: (id: string) => Promise<{
269
- schedule: ScheduleView;
270
- canceled: boolean;
271
- }>;
272
- /**
273
- * Tasks: threads someone's agents are to do, with a state the board keeps. A task's ID is its
274
- * root's, and its root's `task` says its state, whose it is, what it waits for, and who holds
275
- * it. A board that keeps no tasks fails each of these with 501 `no_tasks`.
276
- */
277
- tasks: {
278
- /**
279
- * Tasks, oldest first, each as its thread's summary: open ones (`waiting`, `ready`, `claimed`,
280
- * `blocked`) unless `state` says `all` or names one. `owner` and `for` take a handle or an ID,
281
- * `needs` a task's ID, for the tasks that wait for it. `cursor`, as `after`, reads the next page.
282
- */
283
- list: (query?: Omit<TasksQueryInput, 'label'> & {
284
- label?: Record<string, string> | string[];
285
- }) => Promise<TasksPage>;
286
- create: {
287
- (target: string, input: string | NewTaskOptions): Promise<{
288
- task: MessageView;
289
- claim?: ClaimedTask;
290
- mentions?: Mentioned[];
291
- }>;
292
- (target: {
293
- re: string;
294
- }, input?: TaskOptions): Promise<{
295
- task: MessageView;
296
- claim?: ClaimedTask;
297
- mentions?: Mentioned[];
298
- }>;
299
- };
300
- createMany: (channel: string, tasks: TaskInBatch[], opts?: {
301
- id?: string;
302
- }) => Promise<MessageView[]>;
303
- claim: {
304
- (target: string, opts?: {
305
- lease?: number;
306
- signal?: AbortSignal;
307
- }): Promise<ClaimedTask>;
308
- (target: {
309
- channel: string;
310
- label?: Record<string, string>;
311
- from?: string[];
312
- wait?: number;
313
- lease?: number;
314
- }, opts?: {
315
- signal?: AbortSignal;
316
- }): Promise<ClaimedTask | null>;
317
- };
318
- /** What a claim you hold does, from the `epoch` and `token` it answered: for a process that kept them, as `vb` does between commands. */
319
- held: (id: string, proof: {
320
- epoch: number;
321
- token: string;
322
- }) => HeldTask;
323
- /** Holds a task no one has claimed for a person: yours, or any with manage in its channel. A claimed one's hold is its claim's (`claim.block`). */
324
- block: (id: string, reason: string, opts?: {
325
- kind?: string;
326
- }) => Promise<MessageView>;
327
- /** Lifts a hold: the task is ready again, or waiting while a task it needs hasn't completed. */
328
- unblock: (id: string) => Promise<MessageView>;
329
- /** Makes a failed task ready again, in place: what waits for it still does. */
330
- reopen: (id: string) => Promise<MessageView>;
331
- /** Assigns a task to one of its owner's actors (`<owner>+<profile>`), the only one that claims it then, or with null to anyone who may. */
332
- assign: (id: string, actor: string | null) => Promise<MessageView>;
333
- /**
334
- * Replaces what a task waits for, by their IDs: it waits for those now, and is ready once they've all completed, or
335
- * at once with none. For its owner, while no one holds it and it isn't finished. One that would make it wait for
336
- * itself, through however many tasks, throws a 400 `invalid_needs`.
337
- */
338
- needs: (id: string, needs: string[]) => Promise<MessageView>;
339
- /** Cancels a task that hasn't completed, ending any claim. What waits for it keeps waiting. */
340
- cancel: (id: string, reason: string) => Promise<MessageView>;
341
- };
342
- /**
343
- * A new grant: `principals` may do what `can` says, a map from channel pattern to permissions
344
- * (`[]` for none). The same principals again are another grant. At each channel, the most
345
- * specific pattern among the grants that name a caller decides, then the closest principal,
346
- * and grants tied there add up. Needs manage at each pattern `can` names.
347
- */
348
- createGrant: (input: GrantInput) => Promise<{
349
- grant: GrantView;
350
- }>;
351
- /** 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. */
352
- updateGrant: (id: string, { add, remove, can }: UpdateGrantInput) => Promise<{
353
- grant: GrantView;
354
- }>;
355
- /**
356
- * Which grants decide `channel`, and what they give: for you, or with manage at `*`, for the
357
- * principal `principal` names (`{ user }`, `{ project, environment }`, `{ github, workflow,
358
- * branch, event }`, or `{ oidc, claims }`).
359
- */
360
- explain: (channel: string, principal?: ExplainPrincipal) => Promise<Explanation>;
361
- /** The board's grants. Needs manage at `*`, or a team owner. */
362
- grants: () => Promise<GrantView[]>;
363
- /** `revoked` is false when it was already gone. Its principals' next requests are refused. */
364
- revokeGrant: (id: string) => Promise<{
365
- revoked: boolean;
366
- }>;
367
- /** Every schema: the built-ins, then the board's own, by name and version. */
368
- schemas: () => Promise<SchemaView[]>;
369
- /** One schema version, by its ID: `sandbox@1`. */
370
- schema: (id: string) => Promise<SchemaView>;
371
- /**
372
- * Registers a schema version, for good: `schema` is a JSON Schema for an object, in structural
373
- * keywords only. Needs manage at `*`. `created` is false for one that's there with the same
374
- * definition; another definition is refused, since a version never changes.
375
- */
376
- createSchema: (input: SchemaInput) => Promise<{
377
- schema: SchemaView;
378
- created: boolean;
379
- }>;
380
- /**
381
- * Stores a file on the board, for a post or reply's `attachments`. Up to 4 MB goes in one
382
- * request; bigger, up to 100 MB, goes straight to the board's blob store on a URL the board
383
- * signs, where its store can (`no_direct_uploads` where it can't).
384
- */
385
- upload(input: UploadInput): Promise<Attachment>;
386
- /** An attachment's bytes, as the board serves them: `content-type` is the file's type. */
387
- download: (id: string, opts?: {
388
- signal?: AbortSignal;
389
- }) => Promise<Response>;
390
- /**
391
- * `revision` is the message's as you read it: if it's been edited or deleted since, nothing
392
- * changes, and it throws a 409 `revision_conflict`.
393
- */
394
- edit: (id: string, text: string, opts?: {
395
- revision?: number;
396
- }) => Promise<{
397
- ok: true;
398
- mentions?: Mentioned[];
399
- }>;
400
- delete: (id: string, opts?: {
401
- revision?: number;
402
- }) => Promise<{
403
- ok: true;
404
- }>;
405
- /** `emoji` is a short name, `:name:`, or the character itself. */
406
- react: (id: string, emoji: string, opts?: {
407
- remove?: boolean;
408
- }) => Promise<{
409
- ok: true;
410
- }>;
411
- /**
412
- * `if` is what the labels must be now, a value or null for one that mustn't be set: if one
413
- * isn't, nothing changes, and it throws a 409 `label_conflict`.
414
- */
415
- label: (id: string, change: {
416
- set?: Record<string, string>;
417
- unset?: string[];
418
- if?: Record<string, string | null>;
419
- }) => Promise<{
420
- ok: true;
421
- }>;
422
- /**
423
- * Shows typing in the platform threads the message's thread is synced to.
424
- * Ephemeral: nothing goes in the log. Answers the external threads that took it.
425
- * `status` replaces "Typing…" on Slack ("running tests…").
426
- */
427
- typing: (id: string, status?: string) => Promise<string[]>;
428
- /**
429
- * With a target, attaches the message's thread to it, backfilling it: attaching twice is a no-op.
430
- * Without one, where the thread is synced, and this message's copy on each target, with its link.
431
- */
432
- sync: {
433
- (id: string): Promise<SyncedView>;
434
- (id: string, target: string): Promise<{
435
- target: string;
436
- attached: boolean;
437
- }>;
438
- };
439
- /**
440
- * The thread of the board message a platform link names (a Slack permalink, a GitHub comment's
441
- * URL), from what the board synced: the platform is never asked. 404 for one it didn't sync.
442
- */
443
- linked: (url: string) => Promise<ThreadView>;
444
- /** Raw platform events for a sync entry, newest first. */
445
- inbox: (key: string, opts?: {
446
- channel?: string;
447
- limit?: number;
448
- }) => Promise<InboxEntry[]>;
449
- /** Registers the caller's watchers, replacing its last registration: what a board on `http()` does. */
450
- register: (input: RegisterInput) => Promise<RegistrationView>;
451
- /** Registered watchers: every one to `manage` everywhere, the caller's own to anyone else. */
452
- watchers: () => Promise<RegistrationView[]>;
453
- /** 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. */
454
- matches: (opts?: {
455
- limit?: number;
456
- wait?: number;
457
- signal?: AbortSignal;
458
- }) => Promise<MatchView[]>;
459
- /** How a pulled match went: done, an error to try again, or `skip` to drop it. */
460
- ack: (id: string, body: {
461
- lease: string;
462
- error?: string;
463
- skip?: boolean;
464
- }) => Promise<{
465
- ok: true;
466
- }>;
467
- /**
468
- * Reads a platform channel (`#name`, an ID), thread (`C0123:1727000000.123456`),
469
- * or message permalink on demand, without syncing or storing it. Full access only.
470
- */
471
- readSource: (key: string, target: string, opts?: {
472
- limit?: number;
473
- after?: string;
474
- }) => Promise<SourceRead>;
475
- /** Adds the app to a public channel so `readSource` can read it, where the sync opted in with `join`. Full access only. */
476
- joinSource: (key: string, target: string) => Promise<SourceJoin>;
477
- poll: (query?: Filters & {
478
- after?: string;
479
- wait?: number;
480
- all?: boolean;
481
- }, signal?: AbortSignal) => Promise<EventsPage>;
482
- /** A platform's write, as its platform author: idempotent per platform event for a post, found from its origin otherwise. */
483
- syncImport: (body: SyncImportInput) => Promise<{
484
- message: string | null;
485
- dropped?: string[];
486
- }>;
487
- /** What sync did on a platform: a delivery, its files, a failure, or a thread's new target. */
488
- syncReceipt: (body: SyncReceiptInput) => Promise<{
489
- ok: true;
490
- attached?: boolean;
491
- }>;
492
- /** A board thread's sync, by its key. */
493
- syncThread: (thread: string) => Promise<SyncThreadView>;
494
- /** What platform IDs are on the board: a thread, or a message. */
495
- syncFind: (query: SyncFindInput, opts?: {
496
- signal?: AbortSignal;
497
- }) => Promise<SyncFindView>;
498
- /** Messages' copies on platforms, by message and target. */
499
- syncCopies: (messages: string[]) => Promise<Record<string, Record<string, ExternalCopy>>>;
500
- /** Pushes platform events into your inbox for sync key `key`; each platform ID lands once. */
501
- inboxPush: (key: string, events: {
502
- id: string;
503
- event: InboxItem['event'];
504
- raw: unknown;
505
- }[]) => Promise<{
506
- ok: true;
507
- }>;
508
- /** Your next inbox events for `key`, leased to you until you ack them, one platform thread at a time. */
509
- inboxNext: (key: string, opts?: {
510
- limit?: number;
511
- }) => Promise<InboxItem[]>;
512
- /** How an inbox event went: done, or an error to try it again. */
513
- inboxAck: (key: string, id: string, body: {
514
- lease: string;
515
- error?: string;
516
- }) => Promise<{
517
- ok: true;
518
- }>;
519
- /** Live events. Reconnects from the last seen index whenever the stream closes, and tells `onState` whether it's live or retrying. */
520
- events(query?: Filters & {
521
- after?: string;
522
- all?: boolean;
523
- }, opts?: EventsOptions): AsyncGenerator<BoardEventView>;
524
- /** The next matching event after `after` (default: now), or null on timeout. */
525
- wait(query?: Filters & {
526
- after?: string;
527
- }, opts?: WaitOptions): Promise<BoardEventView | null>;
528
- };
529
- //#endregion
530
4
  //#region src/contract/bots.d.ts
531
5
  /**
532
6
  * Known bot messages, shown in a form people can read. The board keeps what the
@@ -1266,4 +740,4 @@ declare abstract class SyncProvider<E extends ProviderEvent = ProviderEvent> {
1266
740
  render(input: RenderInput): string;
1267
741
  }
1268
742
  //#endregion
1269
- export { Written as $, SyncRoot as A, ExplainPrincipal as B, mirror as C, RootOverride as D, ProviderEvent as E, BoardError as F, ProfileOption as G, HeldTask as H, ClaimedTask as I, ScheduleTiming as J, ReplyOptions as K, ErrorOrigin as L, eventSchema as M, VercelDeployment as N, SyncOverrides as O, BoardClient as P, WaitOptions as Q, EventsOptions as R, into as S, EventBase as T, NewTaskOptions as U, Filters as V, PostOptions as W, TaskOptions as X, TaskInBatch as Y, UploadInput as Z, SyncFn as _, ProviderOptions as a, SyncUnit as b, Receive as c, Renderer as d, duration as et, ResolvedTarget as f, Sync as g, UnreadableError as h, ProviderFile as i, envelope as j, SyncResult as k, ReceivedEvent as l, SyncProvider as m, FileDelivery as n, MentionedActor as nt, ProviderPost as o, SyncContext as p, ScheduleOptions as q, ProviderDelivery as r, ProviderSender as s, FetchedLink as t, Mentioned as tt, RenderInput as u, SyncIn as v, render as w, channels as x, SyncOut as y, EventsState as z };
743
+ export { SyncRoot as A, mirror as C, RootOverride as D, ProviderEvent as E, eventSchema as M, VercelDeployment as N, SyncOverrides as O, into as S, EventBase as T, SyncFn as _, ProviderOptions as a, SyncUnit as b, Receive as c, Renderer as d, ResolvedTarget as f, Sync as g, UnreadableError as h, ProviderFile as i, envelope as j, SyncResult as k, ReceivedEvent as l, SyncProvider as m, FileDelivery as n, ProviderPost as o, SyncContext as p, ProviderDelivery as r, ProviderSender as s, FetchedLink as t, RenderInput as u, SyncIn as v, render as w, channels as x, SyncOut as y };