@vercel/board 0.33.0 → 0.35.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-BsP0hvcC.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-DFOpTw89.mjs} +2 -2
  5. package/dist/{auth-D6z3rMNj.d.mts → auth-C21V0EK1.d.mts} +128 -9
  6. package/dist/auth-CrjXLgOb.mjs +599 -0
  7. package/dist/{backend-CWpyR1A7.d.mts → backend-D21q8mdm.d.mts} +30 -7
  8. package/dist/backend-local.d.mts +1 -1
  9. package/dist/backend-local.mjs +1 -1
  10. package/dist/{chat-provider-DJpFUaFv.d.mts → chat-provider-DmZCmBkb.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-BOBQHVqM.d.mts → commands-BorACIFS.d.mts} +168 -1
  17. package/dist/{commands-CHoMl06v.mjs → commands-CENWob9m.mjs} +281 -11
  18. package/dist/{conformance-qKmGLTAT.mjs → conformance-CKrwglzA.mjs} +491 -105
  19. package/dist/conformance.d.mts +20 -2
  20. package/dist/conformance.mjs +1 -1
  21. package/dist/{engine-JxgZiikU.mjs → engine-wN7quvbU.mjs} +2 -2
  22. package/dist/{errors-Pk0XV1hK.mjs → errors-rYDxZEuN.mjs} +116 -7
  23. package/dist/exports-BxljH73E.d.mts +4 -0
  24. package/dist/{exports-gHDHlg0i.mjs → exports-GIRJm2Ja.mjs} +136 -26
  25. package/dist/{index-CXvvYNYj.d.mts → index-LREsSZb2.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 +32 -32
  31. package/dist/{local-BbLjA5vI.mjs → local-yKwdgukb.mjs} +1981 -1574
  32. package/dist/{main-CQpCZJFw.mjs → main-DjokcEAL.mjs} +440 -50
  33. package/dist/{middleware-BU7rVi9F.mjs → middleware-BxgizazV.mjs} +1 -1
  34. package/dist/provider-DEOfc4Ls.d.mts +1049 -0
  35. package/dist/{provider-BlzUvcM9.d.mts → routes-BpKdMvgX.d.mts} +2461 -2480
  36. package/dist/{serve-D8_W4UN6.mjs → serve-CJ8hauK2.mjs} +4 -4
  37. package/dist/{server-BiIUXWbU.mjs → server-CtaTtyhw.mjs} +7 -7
  38. package/dist/{serving-D7rcUtSC.mjs → serving-6_bhBNAW.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-n2i2ZOWI.mjs} +104 -12
  45. package/dist/{tokens-DPKjl3jf.mjs → tokens-Dn4cPZIr.mjs} +2 -2
  46. package/docs/01-board/01-mounting.md +12 -5
  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 +170 -58
  50. package/docs/03-guides/03-ci.md +19 -17
  51. package/docs/03-guides/05-agent-factory.md +5 -6
  52. package/docs/04-reference/01-cli.md +99 -22
  53. package/docs/04-reference/02-board.md +42 -11
  54. package/docs/04-reference/03-http.md +21 -14
  55. package/docs/04-reference/05-conformance.md +31 -5
  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
@@ -1,4 +1,4 @@
1
- import { d as Board } from "./backend-CWpyR1A7.mjs";
1
+ import { d as Board } from "./backend-D21q8mdm.mjs";
2
2
  //#region src/conformance/index.d.ts
3
3
  /**
4
4
  * Checks that a board speaks the protocol, through a handle on it (`conformance(board())`), as
@@ -30,7 +30,25 @@ export type ConformanceOptions = {
30
30
  * that check is skipped.
31
31
  */
32
32
  withToken?: (secret: string) => Board;
33
+ /**
34
+ * Whom the grants checks name. A board that verifies tokens itself (`vb serve`) takes the made-up
35
+ * IDs they use without it; one that looks names up, as Vercel's API does, needs real ones on its
36
+ * team, or skips the checks that name them: a `project` (its name or ID), a GitHub `repository`
37
+ * no grant names, a `viewer` (a person's email or ID whose team role is viewer), to check
38
+ * that a role caps what grants give, and an `app` installed on the board's team (its slug or
39
+ * client ID), which a local board has none of. None may be the run's own: it throws before it
40
+ * writes.
41
+ */
42
+ principals?: {
43
+ project?: string;
44
+ repository?: string;
45
+ viewer?: string;
46
+ app?: string;
47
+ };
33
48
  };
34
- /** Runs the checks against `board`, in order, and reports each. It never throws for what the board answers. */
49
+ /**
50
+ * Runs the checks against `board`, in order, and reports each. It never throws for what the board
51
+ * answers; it throws before it writes anything when `principals` names the run itself.
52
+ */
35
53
  export declare function conformance(board: Board, options?: ConformanceOptions): Promise<ConformanceReport>;
36
54
  //#endregion
@@ -1,2 +1,2 @@
1
- import { t as conformance } from "./conformance-qKmGLTAT.mjs";
1
+ import { t as conformance } from "./conformance-CKrwglzA.mjs";
2
2
  export { conformance };
@@ -1,8 +1,8 @@
1
- import { _ as fileSize, h as IMPORT_BYTES_MAX, p as ATTACHMENT_BYTES_MAX, r as badRequest, s as notFound, t as HttpError, y as typeOf } from "./errors-Pk0XV1hK.mjs";
1
+ import { _ as fileSize, h as IMPORT_BYTES_MAX, p as ATTACHMENT_BYTES_MAX, r as badRequest, s as notFound, t as HttpError, y as typeOf } from "./errors-rYDxZEuN.mjs";
2
2
  import { a as ChannelPath, b as toStorable, d as MESSAGE_TEXT_MAX } from "./schemas-BG205xds.mjs";
3
3
  import { l as isThreadTarget, s as channelOf } from "./external-CYe424fO.mjs";
4
4
  import { t as canonicalEmoji } from "./emoji-CTLpvH-A.mjs";
5
- import { i as waitUntil, o as derivedId, t as DroppedError } from "./middleware-BU7rVi9F.mjs";
5
+ import { i as waitUntil, o as derivedId, t as DroppedError } from "./middleware-BxgizazV.mjs";
6
6
  import { n as replaceMentions } from "./mentions-CB6ShY4R.mjs";
7
7
  import { t as afterRetry } from "./attempts-HXcskN1w.mjs";
8
8
  import { a as immutable, d as routesFor, l as UnreadableError, n as SyncOverrides, o as ReceivedEvent, s as ResolvedTarget, u as channelMissing } from "./events-IQg0k281.mjs";
@@ -163,6 +163,34 @@ function queryString(query) {
163
163
  const text = params.toString();
164
164
  return text ? `?${text}` : "";
165
165
  }
166
+ /** A `can` as the wire takes it: `'none'` at a pattern is `[]`. */
167
+ function wireCan(can) {
168
+ if (can === null || typeof can !== "object" || Array.isArray(can)) return can;
169
+ return Object.fromEntries(Object.entries(can).map(([pattern, grant]) => [pattern, grant === "none" ? [] : grant]));
170
+ }
171
+ /** A principal to grant as the wire takes it: a project's environments, and every project's, are production when left out. */
172
+ const withEnvironments = (principal) => (principal.kind === "project" || principal.kind === "all-projects") && principal.environments === void 0 ? {
173
+ ...principal,
174
+ environments: ["production"]
175
+ } : principal;
176
+ /**
177
+ * The principal a private channel lets its creator in as, from what `/me` says it is: a person's
178
+ * user, or a deployment's project in the environment it runs in. Anyone else is refused before
179
+ * anything is written.
180
+ */
181
+ function creatorOf(me, path) {
182
+ const [source, kind, id, environment] = me.principal.split(":");
183
+ if ((source === "vercel" || source === "local") && kind === "user" && id) return {
184
+ kind: "user",
185
+ userId: me.principal.split(":").slice(2).join(":")
186
+ };
187
+ if (source === "vercel" && kind === "project" && id && environment) return {
188
+ kind: "project",
189
+ project: id,
190
+ environments: [environment]
191
+ };
192
+ throw new BoardError("no_own_principal", `A private channel lets its creator in, as a person or a project's deployment, and ${me.principal} is neither, so ${path} wasn't made.`, 400, { hint: "Make it as a person or a deployment, or make it and its grants yourself." });
193
+ }
166
194
  const written = (value, unknownMentions) => unknownMentions?.length ? {
167
195
  ...value,
168
196
  unknownMentions
@@ -236,8 +264,64 @@ function createBoardClient(options) {
236
264
  /**
237
265
  * Makes a channel before anything posts to it, as a first post would. Needs `read` and `post`
238
266
  * there. `created` is false when it was there already; it's left as it is.
267
+ *
268
+ * `private` makes it closed to everyone but you, from the protocol's own methods: a grant
269
+ * letting you in at `<path>/`, then one closing `<path>/` to everyone else, then the channel,
270
+ * answering the two grants as `grants`. A failure part way leaves the channel open with a grant
271
+ * too many, or closed and not made yet, and never shuts you out. Before it writes anything, it
272
+ * refuses a caller that's neither a person nor a project's deployment (400 `no_own_principal`),
273
+ * one that can't list grants, a path a grant other than `*`'s reaches already (409
274
+ * `channel_granted`: the channel, `<path>/`, or a pattern under it, whose grants would still let
275
+ * in whoever they name), and a path where it or a channel under it is there already (409
276
+ * `channel_exists`), since closing `security/` closes `security/incidents` too. A board that
277
+ * keeps no grants fails on the listing, with nothing made. Once its own grant is made it lists
278
+ * them again, and takes its own back when another reaches the path, so of two callers making
279
+ * the same channel at once, at most one keeps a way in; and once the lock is made, it lists them
280
+ * a last time, and takes both back when a grant made in between still reaches the path, or its
281
+ * own two aren't as it made them (someone added themselves to its grant, or opened the lock).
239
282
  */
240
- createChannel: (path) => call("POST", "/channels", { body: { path } }),
283
+ createChannel: async (path, options = {}) => {
284
+ if (!options.private) return call("POST", "/channels", { body: { path } });
285
+ const creator = creatorOf(await call("GET", "/me"), path);
286
+ const pattern = `${path}/`;
287
+ const reaching = async () => (await call("GET", "/grants")).grants.filter((grant) => Object.keys(grant.can).some((at) => at === path || at.startsWith(pattern)));
288
+ const granted = (grants, mine = []) => {
289
+ const changed = grants.filter((grant) => mine.some((ours) => ours.id === grant.id)).map((grant) => grant.id);
290
+ if (changed.length === grants.length) return new BoardError("channel_granted", `${changed.join(" and ")} changed while ${path} was being made, so a private ${path} wouldn't be yours alone: nothing was made.`, 409);
291
+ const named = grants.filter((grant) => !changed.includes(grant.id)).map((grant) => grant.id);
292
+ return new BoardError("channel_granted", `${named.length === 1 ? named[0] : `${named.slice(0, -1).join(", ")} and ${named.at(-1)}`} already ${named.length === 1 ? "grants" : "grant"} in ${path}, so a private ${path} wouldn't be yours alone: nothing was made.`, 409, { hint: named.length === 1 ? `Revoke it first: vb grants revoke ${named[0]}` : "Revoke them first, each with vb grants revoke <id>." });
293
+ };
294
+ const before = await reaching();
295
+ if (before.length > 0) throw granted(before);
296
+ const there = (await call("GET", "/channels")).channels.find((channel) => channel.path === path || channel.path.startsWith(pattern));
297
+ if (there) throw new BoardError("channel_exists", there.path === path ? `${path} is a channel already, so it stays as it is.` : `${there.path} is a channel already, and a private ${path} would close it too, so nothing was made.`, 409, { hint: `Close it with a grant: everyone at ${pattern} with 'none'.` });
298
+ const own = await call("POST", "/grants", { body: {
299
+ principals: [creator],
300
+ can: { [pattern]: "all" }
301
+ } });
302
+ const others = (grants, mine) => grants.filter((grant) => {
303
+ const made = mine.find((ours) => ours.id === grant.id);
304
+ return made === void 0 || JSON.stringify([grant.principals, grant.can]) !== JSON.stringify([made.principals, made.can]);
305
+ });
306
+ const raced = others(await reaching(), [own.grant]);
307
+ if (raced.length > 0) {
308
+ await call("POST", `/grants/${encodeURIComponent(own.grant.id)}/revoke`, { body: {} });
309
+ throw granted(raced, [own.grant]);
310
+ }
311
+ const closed = await call("POST", "/grants", { body: {
312
+ principals: [{ kind: "everyone" }],
313
+ can: { [pattern]: [] }
314
+ } });
315
+ const late = others(await reaching(), [own.grant, closed.grant]);
316
+ if (late.length > 0) {
317
+ for (const id of [closed.grant.id, own.grant.id]) await call("POST", `/grants/${encodeURIComponent(id)}/revoke`, { body: {} });
318
+ throw granted(late, [own.grant, closed.grant]);
319
+ }
320
+ return {
321
+ ...await call("POST", "/channels", { body: { path } }),
322
+ grants: [own.grant, closed.grant]
323
+ };
324
+ },
241
325
  actors: async () => (await call("GET", "/actors")).actors,
242
326
  messages: (query = {}) => call("GET", `/messages${queryString(query)}`),
243
327
  thread: (id) => call("GET", `/messages/${path(id)}`),
@@ -277,12 +361,34 @@ function createBoardClient(options) {
277
361
  /** Stops a schedule: yours, or any with manage in its channel. `canceled` is false when it was already done or canceled. */
278
362
  cancelSchedule: (id) => call("POST", `/schedules/${path(id)}/cancel`, { body: {} }),
279
363
  /**
280
- * Lets in callers with an OIDC token from `issuer` that carries every one of `claims`, to do
281
- * what `can` says (read, post, react, and label everywhere when left out). Setting the same
282
- * issuer and claims again changes its `can`: `created` says which. Needs manage in every channel.
364
+ * A new grant: `principals` may do what `can` says, a map from channel pattern to permissions
365
+ * (`[]` for none). The same principals again are another grant. At each channel, the most
366
+ * specific pattern among the grants that name a caller decides, then the closest principal,
367
+ * and grants tied there add up. Needs manage at each pattern `can` names.
283
368
  */
284
- createGrant: (input) => call("POST", "/grants", { body: input }),
285
- /** The board's grants. Needs manage in every channel. */
369
+ createGrant: (input) => call("POST", "/grants", { body: {
370
+ principals: input.principals.map(withEnvironments),
371
+ can: wireCan(input.can)
372
+ } }),
373
+ /** 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. */
374
+ updateGrant: (id, { add, remove, can }) => call("PATCH", `/grants/${path(id)}`, { body: {
375
+ ...add ? { add: add.map(withEnvironments) } : {},
376
+ ...remove ? { remove } : {},
377
+ ...can ? { can: wireCan(can) } : {}
378
+ } }),
379
+ /**
380
+ * Which grants decide `channel`, and what they give: for you, or with manage at `*`, for the
381
+ * principal `principal` names (`{ user }`, `{ project, environment }`, `{ github, workflow,
382
+ * branch, event }`, or `{ oidc, claims }`).
383
+ */
384
+ explain: (channel, principal = {}) => {
385
+ const { claims, ...rest } = principal;
386
+ const params = new URLSearchParams({ channel });
387
+ for (const [name, value] of Object.entries(rest)) if (value !== void 0) params.set(name, value);
388
+ for (const [name, value] of Object.entries(claims ?? {})) params.append("claim", `${name}=${value}`);
389
+ return call("GET", `/grants/explain?${params}`);
390
+ },
391
+ /** The board's grants. Needs manage at `*`, or a team owner. */
286
392
  grants: async () => (await call("GET", "/grants")).grants,
287
393
  /** `revoked` is false when it was already gone. Its principals' next requests are refused. */
288
394
  revokeGrant: (id) => call("POST", `/grants/${path(id)}/revoke`, { body: {} }),
@@ -291,7 +397,10 @@ function createBoardClient(options) {
291
397
  * given: for a widget, a sandbox, a script. `secret` shows only here. It lives 30 days, or
292
398
  * `expires`, at most 90.
293
399
  */
294
- createToken: (input) => call("POST", "/tokens", { body: input }),
400
+ createToken: (input) => call("POST", "/tokens", { body: input.can === void 0 ? input : {
401
+ ...input,
402
+ can: wireCan(input.can)
403
+ } }),
295
404
  /** Your live tokens, or everyone's with manage in every channel. Never their secrets. */
296
405
  tokens: async () => (await call("GET", "/tokens")).tokens,
297
406
  /** It and every token minted with it stop. `revoked` is false when it was already revoked. */
@@ -0,0 +1,4 @@
1
+ import "./routes-BpKdMvgX.mjs";
2
+ import "./auth-C21V0EK1.mjs";
3
+ import "./backend-D21q8mdm.mjs";
4
+ import "./provider-DEOfc4Ls.mjs";
@@ -1,10 +1,10 @@
1
- import { a as forbidden, c as toErrorResponse, d as createBoardClient, f as duration, g as fileName, h as IMPORT_BYTES_MAX, l as unauthorized, n as RejectedError, o as json, p as ATTACHMENT_BYTES_MAX, r as badRequest, s as notFound, t as HttpError, u as BoardError, v as mediaType } from "./errors-Pk0XV1hK.mjs";
1
+ import { a as forbidden, c as toErrorResponse, d as createBoardClient, f as duration, g as fileName, h as IMPORT_BYTES_MAX, l as unauthorized, n as RejectedError, o as json, p as ATTACHMENT_BYTES_MAX, r as badRequest, s as notFound, t as HttpError, u as BoardError, v as mediaType } from "./errors-rYDxZEuN.mjs";
2
2
  import { m as RemoteWatcherId } from "./schemas-BG205xds.mjs";
3
- import { A as PostBody, B as SyncFindQuery, C as InboxNextQuery, D as LinkedQuery, E as LabelBody, F as SchedulesQuery, G as TypingBody, H as SyncReceiptBody, I as SourceJoinBody, K as UploadStartBody, L as SourceReadQuery, M as Ref, N as RegisterBody, O as MatchesQuery, P as ScheduleBody, R as SyncBody, S as InboxAckBody, T as InboxQuery, U as ThreadsQuery, V as SyncImportBody, W as TokenBody, _ as CreateChannelBody, a as compileWatcher, b as EventsQuery, c as METHODS, d as queryObject, f as readCapped, g as AckBody, h as VERSION, i as canonicalWatchers, j as ReactBody, k as MessagesQuery, l as createRouter, m as SYNC, n as syncTarget, p as readJson, r as withEmailMentions, t as mentionsEmails, u as openapi, v as DeleteBody, w as InboxPushBody, x as GrantBody, y as EditBody, z as SyncCopiesQuery } from "./targets-CknPGGVi.mjs";
4
- import { i as waitUntil, l as sha256, o as derivedId, r as runMiddleware, t as DroppedError } from "./middleware-BU7rVi9F.mjs";
5
- import { a as parsePattern, i as compileAccess, n as PERMISSIONS, o as parseScope, s as scopeOf } from "./access-N3XmkKXg.mjs";
6
- import { i as resolveActor, r as claimsOf, t as KNOWN_AGENTS } from "./actors-ihyN47OV.mjs";
7
- import { _ as verifiesTokens, a as VERCEL_ISSUER, c as createAuthority, d as hostPrincipal, h as tokenHash, l as fromTokens, u as grantIssuers } from "./auth-r-_PeZyw.mjs";
3
+ import { A as MessagesQuery, B as SyncCopiesQuery, C as InboxAckBody, D as LabelBody, E as InboxQuery, F as ScheduleBody, G as TokenBody, H as SyncImportBody, I as SchedulesQuery, J as UploadStartBody, K as TypingBody, L as SourceJoinBody, M as ReactBody, N as Ref, O as LinkedQuery, P as RegisterBody, R as SourceReadQuery, S as GrantBody, T as InboxPushBody, U as SyncReceiptBody, V as SyncFindQuery, W as ThreadsQuery, _ as CreateChannelBody, a as compileWatcher, b as EventsQuery, c as METHODS, d as queryObject, f as readCapped, g as AckBody, h as VERSION, i as canonicalWatchers, j as PostBody, k as MatchesQuery, l as createRouter, m as SYNC, n as syncTarget, p as readJson, q as UpdateGrantBody, r as withEmailMentions, t as mentionsEmails, u as openapi, v as DeleteBody, w as InboxNextQuery, x as ExplainQuery, y as EditBody, z as SyncBody } from "./targets-n2i2ZOWI.mjs";
4
+ import { i as waitUntil, l as sha256, o as derivedId, r as runMiddleware, t as DroppedError } from "./middleware-BxgizazV.mjs";
5
+ import { d as scopeOf, l as parsePattern, r as PERMISSIONS, s as compileAccess, u as parseScope } from "./access-BsP0hvcC.mjs";
6
+ import { S as verifiesTokens, T as explainGrants, a as VERCEL_ISSUER, d as fromTokens, f as grantIssuers, p as hostPrincipal, u as createAuthority, x as verifiedIssuers, y as tokenHash } from "./auth-CrjXLgOb.mjs";
7
+ import { i as resolveActor, r as claimsOf, t as KNOWN_AGENTS } from "./actors-DFOpTw89.mjs";
8
8
  //#region src/server/registrant.ts
9
9
  /** Registering again this soon after the same registration only repeats it. */
10
10
  const REGISTER_EVERY_MS = 1e4;
@@ -258,6 +258,17 @@ function operationId() {
258
258
  return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
259
259
  }
260
260
  const iso = (ms) => new Date(ms).toISOString();
261
+ /** A grant as the API answers it, its `at` in milliseconds, as the protocol has it: an ISO string. */
262
+ const grantFrom = (grant) => ({
263
+ ...grant,
264
+ at: expiryOf(grant.at)
265
+ });
266
+ /** A token as the API answers it, its times in milliseconds, as the protocol has them. */
267
+ const tokenFrom = (token) => ({
268
+ ...token,
269
+ at: expiryOf(token.at) ?? token.at,
270
+ expiresAt: expiryOf(token.expiresAt) ?? token.expiresAt
271
+ });
261
272
  const idAt = (threadId, sequence) => `msg_${threadId.slice(4)}_${sequence}`;
262
273
  /** Where a message ID points: its thread and its place in it. Null for one that isn't a message's. */
263
274
  function locate(id) {
@@ -351,6 +362,10 @@ function createVercel(options, environment) {
351
362
  } catch {}
352
363
  if (response.ok) return body;
353
364
  const error = body?.error;
365
+ if (error?.code === "board_token_scope") throw new HttpError(403, "board_token_scope", "a board token reaches only its own board, by its ID.", {
366
+ hint: "Name its board by URL or ID: BOARD_URL, --url, or vercel({ board }).",
367
+ origin: "handle"
368
+ });
354
369
  throw new HttpError(response.status, error?.code ?? "remote_error", error?.message ?? `Vercel's API answered ${response.status}`);
355
370
  }
356
371
  /** Every page of a list, in order. */
@@ -392,7 +407,7 @@ function createVercel(options, environment) {
392
407
  } });
393
408
  return made.id;
394
409
  } catch (error) {
395
- if (error instanceof HttpError && error.code === "board_not_granted") throw notLetIn(`board ${name}`, principal);
410
+ if (error instanceof HttpError && error.code === "board_not_granted") throw notLetIn(name, principal);
396
411
  if (error instanceof HttpError && error.code === "board_name_taken") throw new HttpError(409, "board_name_taken", `the board name ${name} is taken.`, {
397
412
  hint: "Pick another name, or ask whoever can see it for access.",
398
413
  origin: "handle"
@@ -400,11 +415,23 @@ function createVercel(options, environment) {
400
415
  throw error;
401
416
  }
402
417
  }
403
- /** A project a board's grants don't let in: they were narrowed, since every project on the team gets in by default. */
404
- const notLetIn = (board, principal) => new HttpError(403, "board_not_granted", `this project has no access to ${board}${principal.type === "project" ? ` (${principal.projectId}, ${principal.environment})` : ""}.`, {
405
- hint: "Someone who manages the board can grant it.",
406
- origin: "handle"
407
- });
418
+ /**
419
+ * A project a board's grants don't let in, the one `name`s or the team's (null): they were narrowed,
420
+ * since every project on the team gets in by default. Its way out is the grant that lets it back in,
421
+ * naming the project by ID, since `/me` carries no name.
422
+ */
423
+ const notLetIn = (name, principal) => {
424
+ const board = name === null ? "the team's board" : `board ${name}`;
425
+ if (principal.type !== "project") return new HttpError(403, "board_not_granted", `this project has no access to ${board}.`, {
426
+ hint: "Someone who manages the board can grant it.",
427
+ origin: "handle"
428
+ });
429
+ const grant = `vb grants create --project ${principal.projectId} --environment ${principal.environment}${name === null ? "" : ` --name ${name}`} --can '*=read,post,react,label'`;
430
+ return new HttpError(403, "board_not_granted", `this project has no access to ${board} (${principal.projectId}, ${principal.environment}).`, {
431
+ hint: `Grant it: ${grant}`,
432
+ origin: "handle"
433
+ });
434
+ };
408
435
  let board = null;
409
436
  /**
410
437
  * The board's ID: the one given, the one `board({ name })` names, or the team's, which the API
@@ -415,7 +442,7 @@ function createVercel(options, environment) {
415
442
  const boardId = (who) => (board ??= options.board ? Promise.resolve(options.board) : boardName() ? boardNamed(who, boardName()) : api(who, "GET", "/boards").then(async ({ defaultBoardId }) => {
416
443
  if (defaultBoardId) return defaultBoardId;
417
444
  const { principal } = (await self(who)).actor;
418
- if (principal.type === "project") throw notLetIn("the team's board", principal);
445
+ if (principal.type === "project") throw notLetIn(null, principal);
419
446
  const { board: made } = await api(who, "POST", "/boards/default", { body: { operationId: operationId() } });
420
447
  return made.id;
421
448
  })).catch((error) => {
@@ -1197,11 +1224,20 @@ function createVercel(options, environment) {
1197
1224
  when: spec.when ?? "matches"
1198
1225
  }]));
1199
1226
  const filters = Object.fromEntries(await Promise.all(Object.entries(specs).map(async ([id, spec]) => [id, await filterOf(who, id, spec)])));
1200
- const made = await api(who, "PUT", await onBoard(who, "/watchers"), { body: {
1201
- ...where,
1202
- watch: filters,
1203
- tag: await tagOf(specs)
1204
- } });
1227
+ let made;
1228
+ try {
1229
+ made = await api(who, "PUT", await onBoard(who, "/watchers"), { body: {
1230
+ ...where,
1231
+ watch: filters,
1232
+ tag: await tagOf(specs)
1233
+ } });
1234
+ } catch (error) {
1235
+ if (error instanceof HttpError && error.code === "board_token_unsupported") throw new HttpError(403, "board_token_unsupported", "a board token can't register watchers yet.", {
1236
+ hint: "Register them with a person's or a deployment's own credentials.",
1237
+ origin: "handle"
1238
+ });
1239
+ throw error;
1240
+ }
1205
1241
  return {
1206
1242
  owner: made.owner,
1207
1243
  ...whereOf(made),
@@ -1637,17 +1673,41 @@ function createVercel(options, environment) {
1637
1673
  },
1638
1674
  async grants(caller, _input, signal) {
1639
1675
  const who = whoOf(caller);
1640
- return api(who, "GET", await onBoard(who, "/grants"), signal ? { signal } : {});
1676
+ const { grants } = await api(who, "GET", await onBoard(who, "/grants"), signal ? { signal } : {});
1677
+ return { grants: grants.map(grantFrom) };
1641
1678
  },
1642
1679
  async createGrant(caller, input, signal) {
1643
1680
  const who = whoOf(caller);
1644
- return api(who, "POST", await onBoard(who, "/grants"), {
1681
+ const { grant } = await api(who, "POST", await onBoard(who, "/grants"), {
1645
1682
  body: {
1646
1683
  operationId: operationId(),
1647
1684
  ...input
1648
1685
  },
1649
1686
  ...signal ? { signal } : {}
1650
1687
  });
1688
+ return { grant: grantFrom(grant) };
1689
+ },
1690
+ async updateGrant(caller, { id, ...change }, signal) {
1691
+ const who = whoOf(caller);
1692
+ const { grant } = await api(who, "PATCH", await onBoard(who, `/grants/${encodeURIComponent(id)}`), {
1693
+ body: {
1694
+ operationId: operationId(),
1695
+ ...change
1696
+ },
1697
+ ...signal ? { signal } : {}
1698
+ });
1699
+ return { grant: grantFrom(grant) };
1700
+ },
1701
+ async explain(caller, { claim, ...query }, signal) {
1702
+ const who = whoOf(caller);
1703
+ const params = new URLSearchParams();
1704
+ for (const [name, value] of Object.entries(query)) if (value !== void 0) params.set(name, value);
1705
+ for (const pair of claim ?? []) params.append("claim", pair);
1706
+ const explained = await api(who, "GET", await onBoard(who, `/grants/explain?${params}`), signal ? { signal } : {});
1707
+ return {
1708
+ ...explained,
1709
+ grants: explained.grants.map(grantFrom)
1710
+ };
1651
1711
  },
1652
1712
  async revokeGrant(caller, { id }, signal) {
1653
1713
  const who = whoOf(caller);
@@ -1658,17 +1718,22 @@ function createVercel(options, environment) {
1658
1718
  },
1659
1719
  async tokens(caller, _input, signal) {
1660
1720
  const who = whoOf(caller);
1661
- return api(who, "GET", await onBoard(who, "/tokens"), signal ? { signal } : {});
1721
+ const { tokens } = await api(who, "GET", await onBoard(who, "/tokens"), signal ? { signal } : {});
1722
+ return { tokens: tokens.map(tokenFrom) };
1662
1723
  },
1663
1724
  async createToken(caller, input, signal) {
1664
1725
  const who = whoOf(caller);
1665
- return api(who, "POST", await onBoard(who, "/tokens"), {
1726
+ const created = await api(who, "POST", await onBoard(who, "/tokens"), {
1666
1727
  body: {
1667
1728
  operationId: operationId(),
1668
1729
  ...input
1669
1730
  },
1670
1731
  ...signal ? { signal } : {}
1671
1732
  });
1733
+ return {
1734
+ ...created,
1735
+ token: tokenFrom(created.token)
1736
+ };
1672
1737
  },
1673
1738
  async revokeToken(caller, { id }, signal) {
1674
1739
  const who = whoOf(caller);
@@ -1887,7 +1952,7 @@ function createPolicy(options, keeps, serving, trust = null) {
1887
1952
  if (!grants) return;
1888
1953
  const iss = issuerOf(credential);
1889
1954
  if (iss === null || !iss.startsWith("https://") || iss === "https://token.actions.githubusercontent.com" || VERCEL_ISSUER.test(iss)) return;
1890
- const issuers = grantIssuers(await grants());
1955
+ const issuers = verifiedIssuers([], grantIssuers(await grants()));
1891
1956
  if (issuers.join("\n") !== context.issuers.join("\n")) context.issuers = issuers;
1892
1957
  }
1893
1958
  /** Who a board token is: the principal that minted it, narrowed, until it's revoked or expires. */
@@ -1950,6 +2015,44 @@ function createPolicy(options, keeps, serving, trust = null) {
1950
2015
  if (result === null || result === void 0) throw unauthorized("missing bearer token");
1951
2016
  return fromTokens(result) ? result : hostPrincipal(result);
1952
2017
  }
2018
+ /**
2019
+ * Which pattern, level, and grants decide `channel` for `principal`, and what they give it there,
2020
+ * narrowed by its scope: what explain answers, through `explainGrants`. Nothing for a principal
2021
+ * nothing lets in.
2022
+ */
2023
+ async function explain(principal, channel) {
2024
+ let resolved;
2025
+ try {
2026
+ resolved = await authority.resolve(principal);
2027
+ } catch (error) {
2028
+ const status = error.status;
2029
+ if (status === 401 || status === 403) return {
2030
+ pattern: null,
2031
+ over: [],
2032
+ level: null,
2033
+ grants: [],
2034
+ permissions: []
2035
+ };
2036
+ throw error;
2037
+ }
2038
+ const scope = principal.scope === void 0 ? null : compileAccess(parseScope(principal.scope));
2039
+ const allowed = (permissions) => scope ? permissions.filter((permission) => scope.can(permission, channel)) : [...permissions];
2040
+ if ("fixed" in resolved) return {
2041
+ pattern: null,
2042
+ over: [],
2043
+ level: null,
2044
+ grants: [],
2045
+ permissions: allowed(PERMISSIONS.filter((permission) => resolved.fixed.can(permission, channel)))
2046
+ };
2047
+ const { pattern, over, level, grants, permissions } = explainGrants(resolved.facts, channel);
2048
+ return {
2049
+ pattern,
2050
+ over,
2051
+ level,
2052
+ grants,
2053
+ permissions: allowed(permissions)
2054
+ };
2055
+ }
1953
2056
  return {
1954
2057
  /** Whether requests are served at all: only where the backend keeps the board. */
1955
2058
  open: keeps,
@@ -1978,10 +2081,11 @@ function createPolicy(options, keeps, serving, trust = null) {
1978
2081
  actor
1979
2082
  };
1980
2083
  },
2084
+ explain,
1981
2085
  /** What a stored principal (a schedule's creator, a watcher's registrant) may do now: null once nothing, its board token's revoking included. */
1982
- async accessNow(principal) {
2086
+ async accessNow(principal, grants) {
1983
2087
  if (principal.token !== void 0 && !await trust?.live(principal.token)) return null;
1984
- return authority.accessNow(principal);
2088
+ return authority.accessNow(principal, grants);
1985
2089
  }
1986
2090
  };
1987
2091
  }
@@ -2116,6 +2220,11 @@ async function inputOf(name, request, url, params) {
2116
2220
  case "createChannel": return CreateChannelBody.parse(await body());
2117
2221
  case "schedule": return ScheduleBody.parse(await body());
2118
2222
  case "createGrant": return GrantBody.parse(await body());
2223
+ case "updateGrant": return {
2224
+ id,
2225
+ ...UpdateGrantBody.parse(await body())
2226
+ };
2227
+ case "explain": return ExplainQuery.parse(queryObject(url));
2119
2228
  case "createToken": return TokenBody.parse(await body());
2120
2229
  case "register": return RegisterBody.parse(await body());
2121
2230
  case "edit": return {
@@ -3160,7 +3269,8 @@ function createBoard(options, runtime) {
3160
3269
  return entry.url(thread.slice(key.length + 1), message).catch(() => null);
3161
3270
  },
3162
3271
  typing: async (messages, status) => (await server()).typing(messages, status),
3163
- accessNow: (principal) => policy.accessNow(principal),
3272
+ accessNow: (principal, grants) => policy.accessNow(principal, grants),
3273
+ explain: (principal, channel) => policy.explain(principal, channel),
3164
3274
  project: () => policy.project(),
3165
3275
  handle: (caller) => handleOf(caller, null),
3166
3276
  url: ownUrl
@@ -1,5 +1,5 @@
1
- import { d as Board, f as BoardOptions } from "./backend-CWpyR1A7.mjs";
2
- import "./exports-BuKjVq2t.mjs";
1
+ import { d as Board, f as BoardOptions } from "./backend-D21q8mdm.mjs";
2
+ import "./exports-BxljH73E.mjs";
3
3
  //#region src/server/index.d.ts
4
4
  /**
5
5
  * The handle on a board. Without a `backend`, it's Vercel's board for your team, the one `name`
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- import { d as Attachment } from "./folds-DjFTiqIM.mjs";
2
- import { i as Claims, r as CallerRequest } from "./auth-D6z3rMNj.mjs";
3
- import { $ as EditBody, $t as SyncImportBody, At as RegisterBody, B as ScheduleTiming, Bt as SchedulesQueryInput, Ct as MessagesQueryInput, Dt as REGISTERED_WATCHERS_MAX, Et as PostInput, F as Filters, Ft as ScheduleBody, G as AckBody, Gt as SourceRead, H as WaitOptions, Ht as SourceJoin, I as PostOptions, It as ScheduleBodyOutput, J as BoardEventView, Jt as SyncCopiesQuery, K as ActorView, Kt as SourceReadQuery, L as ProfileOption, Lt as ScheduleInput, Mt as RegistrationView, N as BoardError, Nt as ResolvedSyncTarget, Ot as ReactBody, Pt as RouteName, Q as Discovery, Qt as SyncFindView, R as ReplyOptions, Rt as ScheduleView, St as MessagesQuery, Tt as PostBody, U as Written, Ut as SourceJoinBody, V as UploadInput, Vt as SchedulesQueryOutput, W as duration, Wt as SourceMessage, X as CreateChannelBody, Xt as SyncFindInput, Y as ChannelView, Yt as SyncCopiesView, Z as DeleteBody, Zt as SyncFindQuery, _n as routes, _t as MatchView, an as ThreadSummaryView, at as GrantInput, bt as MessageView, cn as ThreadsQuery, ct as InboxEntry, dn as TokenInput, dt as InboxPushBody, en as SyncImportInput, et as EventsPage, fn as TokenView, ft as InboxQuery, gn as UploadTicket, gt as LinkedQuery, hn as UploadStartBody, ht as LinkView, in as SyncedView, it as GrantBody, jt as RegisterInput, kt as Ref, ln as ThreadsQueryInput, lt as InboxItem, mn as TypingResult, mt as LabelBody, nn as SyncReceiptInput, nt as EventsQueryInput, on as ThreadView, ot as GrantView, pn as TypingBody, pt as LABEL_CONDITIONS_MAX, q as ApiError, qt as SyncBody, rn as SyncThreadView, rt as FiltersInput, sn as ThreadsPage, st as InboxAckBody, tn as SyncReceiptBody, tt as EventsQuery, un as TokenBody, ut as InboxNextQuery, vt as MatchesQuery, wt as ParsedFilters, xt as MessagesPage, yt as Me, z as ScheduleOptions, zt as SchedulesQuery } from "./provider-BlzUvcM9.mjs";
4
- import { C as Protocol, S as Method, _ as MiddlewareContext, a as Identity, b as WriteSource, c as SelfCaller, d as Board, f as BoardOptions, g as Middleware, h as DroppedError, i as Caller, l as Subscription, m as WatcherContext, n as BackendRoute, o as InboxDelivery, p as Watcher, r as BoardBinding, s as ProtocolMethods, t as Backend, u as VerifiedCaller, v as Write, x as HttpError, y as WritePatch } from "./backend-CWpyR1A7.mjs";
5
- import "./exports-BuKjVq2t.mjs";
1
+ import { $ as ScheduleInput, A as LinkedQuery, At as TypingResult, B as PostInput, C as InboxItem, Ct as ThreadsPage, D as LABEL_CONDITIONS_MAX, Dt as TokenInput, E as InboxQuery, Et as TokenBody, F as MessagesPage, Ft as routes, G as Ref, H as PrincipalView, I as MessagesQuery, J as RegistrationView, K as RegisterBody, L as MessagesQueryInput, M as MatchesQuery, Mt as UpdateGrantInput, N as Me, Nt as UploadStartBody, O as LabelBody, Ot as TokenView, P as MessageView, Pt as UploadTicket, Q as ScheduleBodyOutput, R as ParsedFilters, S as InboxEntry, St as ThreadView, T as InboxPushBody, Tt as ThreadsQueryInput, U as REGISTERED_WATCHERS_MAX, V as PrincipalInput, W as ReactBody, X as RouteName, Y as ResolvedSyncTarget, Z as ScheduleBody, _ as GrantBody, _t as SyncReceiptBody, a as CanAt, at as SourceJoinBody, b as GrantView, bt as SyncedView, c as DeleteBody, ct as SourceReadQuery, d as EventsPage, dt as SyncCopiesView, en as Attachment, et as ScheduleView, f as EventsQuery, ft as SyncFindInput, g as FiltersInput, gt as SyncImportInput, h as Explanation, ht as SyncImportBody, i as BoardEventView, it as SourceJoin, j as MatchView, jt as UpdateGrantBody, k as LinkView, kt as TypingBody, l as Discovery, lt as SyncBody, m as ExplainQuery, mt as SyncFindView, n as ActorView, nt as SchedulesQueryInput, o as ChannelView, ot as SourceMessage, p as EventsQueryInput, pt as SyncFindQuery, q as RegisterInput, r as ApiError, rt as SchedulesQueryOutput, s as CreateChannelBody, st as SourceRead, t as AckBody, tt as SchedulesQuery, u as EditBody, ut as SyncCopiesQuery, v as GrantCan, vt as SyncReceiptInput, w as InboxNextQuery, wt as ThreadsQuery, x as InboxAckBody, xt as ThreadSummaryView, y as GrantInput, yt as SyncThreadView, z as PostBody } from "./routes-BpKdMvgX.mjs";
2
+ import { i as Claims, r as CallerRequest } from "./auth-C21V0EK1.mjs";
3
+ import { C as Protocol, S as Method, _ as MiddlewareContext, a as Identity, b as WriteSource, c as SelfCaller, d as Board, f as BoardOptions, g as Middleware, h as DroppedError, i as Caller, l as Subscription, m as WatcherContext, n as BackendRoute, o as InboxDelivery, p as Watcher, r as BoardBinding, s as ProtocolMethods, t as Backend, u as VerifiedCaller, v as Write, x as HttpError, y as WritePatch } from "./backend-D21q8mdm.mjs";
4
+ import { B as ScheduleTiming, F as Filters, H as WaitOptions, I as PostOptions, L as ProfileOption, N as BoardError, R as ReplyOptions, U as Written, V as UploadInput, W as duration, z as ScheduleOptions } from "./provider-DEOfc4Ls.mjs";
5
+ import "./exports-BxljH73E.mjs";
6
6
  //#region src/server/index.default.d.ts
7
7
  /**
8
8
  * The handle on a board. Without a `backend`, it's Vercel's board for the team, the one `name`
@@ -12,4 +12,4 @@ import "./exports-BuKjVq2t.mjs";
12
12
  */
13
13
  export declare function board(options?: BoardOptions): Board;
14
14
  //#endregion
15
- export { type AckBody, type ActorView, type ApiError, type Attachment, type Backend, type BackendRoute, type Board, type BoardBinding, BoardError, type BoardEventView, type BoardOptions, type Caller, type CallerRequest, type ChannelView, type Claims, type CreateChannelBody, type DeleteBody, type Discovery, DroppedError, type EditBody, type EventsPage, type EventsQuery, type EventsQueryInput, type Filters, type FiltersInput, type GrantBody, type GrantInput, type GrantView, HttpError, type Identity, type InboxAckBody, type InboxDelivery, type InboxEntry, type InboxItem, type InboxNextQuery, type InboxPushBody, type InboxQuery, type LABEL_CONDITIONS_MAX, type LabelBody, type LinkView, type LinkedQuery, type MatchView, type MatchesQuery, type Me, type MessageView, type MessagesPage, type MessagesQuery, type MessagesQueryInput, type Method, type Middleware, type MiddlewareContext, type ParsedFilters, type PostBody, type PostInput, type PostOptions, type ProfileOption, type Protocol, type ProtocolMethods, type REGISTERED_WATCHERS_MAX, type ReactBody, type Ref, type RegisterBody, type RegisterInput, type RegistrationView, type ReplyOptions, type ResolvedSyncTarget, type RouteName, type ScheduleBody, type ScheduleBodyOutput, type ScheduleInput, type ScheduleOptions, type ScheduleTiming, type ScheduleView, type SchedulesQuery, type SchedulesQueryInput, type SchedulesQueryOutput, type SelfCaller, type SourceJoin, type SourceJoinBody, type SourceMessage, type SourceRead, type SourceReadQuery, type Subscription, type SyncBody, type SyncCopiesQuery, type SyncCopiesView, type SyncFindInput, type SyncFindQuery, type SyncFindView, type SyncImportBody, type SyncImportInput, type SyncReceiptBody, type SyncReceiptInput, type SyncThreadView, type SyncedView, type ThreadSummaryView, type ThreadView, type ThreadsPage, type ThreadsQuery, type ThreadsQueryInput, type TokenBody, type TokenInput, type TokenView, type TypingBody, type TypingResult, type UploadInput, type UploadStartBody, type UploadTicket, type VerifiedCaller, type WaitOptions, type Watcher, type WatcherContext, type Write, type WritePatch, type WriteSource, type Written, duration, type routes };
15
+ export { type AckBody, type ActorView, type ApiError, type Attachment, type Backend, type BackendRoute, type Board, type BoardBinding, BoardError, type BoardEventView, type BoardOptions, type Caller, type CallerRequest, type CanAt, type ChannelView, type Claims, type CreateChannelBody, type DeleteBody, type Discovery, DroppedError, type EditBody, type EventsPage, type EventsQuery, type EventsQueryInput, type ExplainQuery, type Explanation, type Filters, type FiltersInput, type GrantBody, type GrantCan, type GrantInput, type GrantView, HttpError, type Identity, type InboxAckBody, type InboxDelivery, type InboxEntry, type InboxItem, type InboxNextQuery, type InboxPushBody, type InboxQuery, type LABEL_CONDITIONS_MAX, type LabelBody, type LinkView, type LinkedQuery, type MatchView, type MatchesQuery, type Me, type MessageView, type MessagesPage, type MessagesQuery, type MessagesQueryInput, type Method, type Middleware, type MiddlewareContext, type ParsedFilters, type PostBody, type PostInput, type PostOptions, type PrincipalInput, type PrincipalView, type ProfileOption, type Protocol, type ProtocolMethods, type REGISTERED_WATCHERS_MAX, type ReactBody, type Ref, type RegisterBody, type RegisterInput, type RegistrationView, type ReplyOptions, type ResolvedSyncTarget, type RouteName, type ScheduleBody, type ScheduleBodyOutput, type ScheduleInput, type ScheduleOptions, type ScheduleTiming, type ScheduleView, type SchedulesQuery, type SchedulesQueryInput, type SchedulesQueryOutput, type SelfCaller, type SourceJoin, type SourceJoinBody, type SourceMessage, type SourceRead, type SourceReadQuery, type Subscription, type SyncBody, type SyncCopiesQuery, type SyncCopiesView, type SyncFindInput, type SyncFindQuery, type SyncFindView, type SyncImportBody, type SyncImportInput, type SyncReceiptBody, type SyncReceiptInput, type SyncThreadView, type SyncedView, type ThreadSummaryView, type ThreadView, type ThreadsPage, type ThreadsQuery, type ThreadsQueryInput, type TokenBody, type TokenInput, type TokenView, type TypingBody, type TypingResult, type UpdateGrantBody, type UpdateGrantInput, type UploadInput, type UploadStartBody, type UploadTicket, type VerifiedCaller, type WaitOptions, type Watcher, type WatcherContext, type Write, type WritePatch, type WriteSource, type Written, duration, type routes };
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { f as duration, t as HttpError, u as BoardError } from "./errors-Pk0XV1hK.mjs";
2
- import { t as DroppedError } from "./middleware-BU7rVi9F.mjs";
3
- import { r as createVercel, t as createBoard } from "./exports-gHDHlg0i.mjs";
1
+ import { f as duration, t as HttpError, u as BoardError } from "./errors-rYDxZEuN.mjs";
2
+ import { t as DroppedError } from "./middleware-BxgizazV.mjs";
3
+ import { r as createVercel, t as createBoard } from "./exports-GIRJm2Ja.mjs";
4
4
  //#region src/backend-vercel/index.default.ts
5
5
  /**
6
6
  * Your team's board, in Vercel's API. Outside Node there's no environment to find credentials or
@@ -23,7 +23,7 @@ function board(options = {}) {
23
23
  if (!fetch) throw new Error("board: pass a fetch that sends credentials Vercel's API takes, or a backend: outside Node there's no environment to find them in");
24
24
  return vercel({ fetch });
25
25
  },
26
- sync: () => import("./engine-JxgZiikU.mjs"),
26
+ sync: () => import("./engine-wN7quvbU.mjs"),
27
27
  serving: null
28
28
  });
29
29
  }
@@ -1,6 +1,6 @@
1
- import { d as Attachment } from "./folds-DjFTiqIM.mjs";
2
- import { i as Claims, r as CallerRequest } from "./auth-D6z3rMNj.mjs";
3
- import { $ as EditBody, $t as SyncImportBody, At as RegisterBody, B as ScheduleTiming, Bt as SchedulesQueryInput, Ct as MessagesQueryInput, Dt as REGISTERED_WATCHERS_MAX, Et as PostInput, F as Filters, Ft as ScheduleBody, G as AckBody, Gt as SourceRead, H as WaitOptions, Ht as SourceJoin, I as PostOptions, It as ScheduleBodyOutput, J as BoardEventView, Jt as SyncCopiesQuery, K as ActorView, Kt as SourceReadQuery, L as ProfileOption, Lt as ScheduleInput, Mt as RegistrationView, N as BoardError, Nt as ResolvedSyncTarget, Ot as ReactBody, Pt as RouteName, Q as Discovery, Qt as SyncFindView, R as ReplyOptions, Rt as ScheduleView, St as MessagesQuery, Tt as PostBody, U as Written, Ut as SourceJoinBody, V as UploadInput, Vt as SchedulesQueryOutput, W as duration, Wt as SourceMessage, X as CreateChannelBody, Xt as SyncFindInput, Y as ChannelView, Yt as SyncCopiesView, Z as DeleteBody, Zt as SyncFindQuery, _n as routes, _t as MatchView, an as ThreadSummaryView, at as GrantInput, bt as MessageView, cn as ThreadsQuery, ct as InboxEntry, dn as TokenInput, dt as InboxPushBody, en as SyncImportInput, et as EventsPage, fn as TokenView, ft as InboxQuery, gn as UploadTicket, gt as LinkedQuery, hn as UploadStartBody, ht as LinkView, in as SyncedView, it as GrantBody, jt as RegisterInput, kt as Ref, ln as ThreadsQueryInput, lt as InboxItem, mn as TypingResult, mt as LabelBody, nn as SyncReceiptInput, nt as EventsQueryInput, on as ThreadView, ot as GrantView, pn as TypingBody, pt as LABEL_CONDITIONS_MAX, q as ApiError, qt as SyncBody, rn as SyncThreadView, rt as FiltersInput, sn as ThreadsPage, st as InboxAckBody, tn as SyncReceiptBody, tt as EventsQuery, un as TokenBody, ut as InboxNextQuery, vt as MatchesQuery, wt as ParsedFilters, xt as MessagesPage, yt as Me, z as ScheduleOptions, zt as SchedulesQuery } from "./provider-BlzUvcM9.mjs";
4
- import { C as Protocol, S as Method, _ as MiddlewareContext, a as Identity, b as WriteSource, c as SelfCaller, d as Board, f as BoardOptions, g as Middleware, h as DroppedError, i as Caller, l as Subscription, m as WatcherContext, n as BackendRoute, o as InboxDelivery, p as Watcher, r as BoardBinding, s as ProtocolMethods, t as Backend, u as VerifiedCaller, v as Write, x as HttpError, y as WritePatch } from "./backend-CWpyR1A7.mjs";
5
- import { t as board } from "./index-CXvvYNYj.mjs";
6
- export { type AckBody, type ActorView, type ApiError, type Attachment, type Backend, type BackendRoute, type Board, type BoardBinding, BoardError, type BoardEventView, type BoardOptions, type Caller, type CallerRequest, type ChannelView, type Claims, type CreateChannelBody, type DeleteBody, type Discovery, DroppedError, type EditBody, type EventsPage, type EventsQuery, type EventsQueryInput, type Filters, type FiltersInput, type GrantBody, type GrantInput, type GrantView, HttpError, type Identity, type InboxAckBody, type InboxDelivery, type InboxEntry, type InboxItem, type InboxNextQuery, type InboxPushBody, type InboxQuery, type LABEL_CONDITIONS_MAX, type LabelBody, type LinkView, type LinkedQuery, type MatchView, type MatchesQuery, type Me, type MessageView, type MessagesPage, type MessagesQuery, type MessagesQueryInput, type Method, type Middleware, type MiddlewareContext, type ParsedFilters, type PostBody, type PostInput, type PostOptions, type ProfileOption, type Protocol, type ProtocolMethods, type REGISTERED_WATCHERS_MAX, type ReactBody, type Ref, type RegisterBody, type RegisterInput, type RegistrationView, type ReplyOptions, type ResolvedSyncTarget, type RouteName, type ScheduleBody, type ScheduleBodyOutput, type ScheduleInput, type ScheduleOptions, type ScheduleTiming, type ScheduleView, type SchedulesQuery, type SchedulesQueryInput, type SchedulesQueryOutput, type SelfCaller, type SourceJoin, type SourceJoinBody, type SourceMessage, type SourceRead, type SourceReadQuery, type Subscription, type SyncBody, type SyncCopiesQuery, type SyncCopiesView, type SyncFindInput, type SyncFindQuery, type SyncFindView, type SyncImportBody, type SyncImportInput, type SyncReceiptBody, type SyncReceiptInput, type SyncThreadView, type SyncedView, type ThreadSummaryView, type ThreadView, type ThreadsPage, type ThreadsQuery, type ThreadsQueryInput, type TokenBody, type TokenInput, type TokenView, type TypingBody, type TypingResult, type UploadInput, type UploadStartBody, type UploadTicket, type VerifiedCaller, type WaitOptions, type Watcher, type WatcherContext, type Write, type WritePatch, type WriteSource, type Written, board, duration, type routes };
1
+ import { $ as ScheduleInput, A as LinkedQuery, At as TypingResult, B as PostInput, C as InboxItem, Ct as ThreadsPage, D as LABEL_CONDITIONS_MAX, Dt as TokenInput, E as InboxQuery, Et as TokenBody, F as MessagesPage, Ft as routes, G as Ref, H as PrincipalView, I as MessagesQuery, J as RegistrationView, K as RegisterBody, L as MessagesQueryInput, M as MatchesQuery, Mt as UpdateGrantInput, N as Me, Nt as UploadStartBody, O as LabelBody, Ot as TokenView, P as MessageView, Pt as UploadTicket, Q as ScheduleBodyOutput, R as ParsedFilters, S as InboxEntry, St as ThreadView, T as InboxPushBody, Tt as ThreadsQueryInput, U as REGISTERED_WATCHERS_MAX, V as PrincipalInput, W as ReactBody, X as RouteName, Y as ResolvedSyncTarget, Z as ScheduleBody, _ as GrantBody, _t as SyncReceiptBody, a as CanAt, at as SourceJoinBody, b as GrantView, bt as SyncedView, c as DeleteBody, ct as SourceReadQuery, d as EventsPage, dt as SyncCopiesView, en as Attachment, et as ScheduleView, f as EventsQuery, ft as SyncFindInput, g as FiltersInput, gt as SyncImportInput, h as Explanation, ht as SyncImportBody, i as BoardEventView, it as SourceJoin, j as MatchView, jt as UpdateGrantBody, k as LinkView, kt as TypingBody, l as Discovery, lt as SyncBody, m as ExplainQuery, mt as SyncFindView, n as ActorView, nt as SchedulesQueryInput, o as ChannelView, ot as SourceMessage, p as EventsQueryInput, pt as SyncFindQuery, q as RegisterInput, r as ApiError, rt as SchedulesQueryOutput, s as CreateChannelBody, st as SourceRead, t as AckBody, tt as SchedulesQuery, u as EditBody, ut as SyncCopiesQuery, v as GrantCan, vt as SyncReceiptInput, w as InboxNextQuery, wt as ThreadsQuery, x as InboxAckBody, xt as ThreadSummaryView, y as GrantInput, yt as SyncThreadView, z as PostBody } from "./routes-BpKdMvgX.mjs";
2
+ import { i as Claims, r as CallerRequest } from "./auth-C21V0EK1.mjs";
3
+ import { C as Protocol, S as Method, _ as MiddlewareContext, a as Identity, b as WriteSource, c as SelfCaller, d as Board, f as BoardOptions, g as Middleware, h as DroppedError, i as Caller, l as Subscription, m as WatcherContext, n as BackendRoute, o as InboxDelivery, p as Watcher, r as BoardBinding, s as ProtocolMethods, t as Backend, u as VerifiedCaller, v as Write, x as HttpError, y as WritePatch } from "./backend-D21q8mdm.mjs";
4
+ import { B as ScheduleTiming, F as Filters, H as WaitOptions, I as PostOptions, L as ProfileOption, N as BoardError, R as ReplyOptions, U as Written, V as UploadInput, W as duration, z as ScheduleOptions } from "./provider-DEOfc4Ls.mjs";
5
+ import { t as board } from "./index-LREsSZb2.mjs";
6
+ export { type AckBody, type ActorView, type ApiError, type Attachment, type Backend, type BackendRoute, type Board, type BoardBinding, BoardError, type BoardEventView, type BoardOptions, type Caller, type CallerRequest, type CanAt, type ChannelView, type Claims, type CreateChannelBody, type DeleteBody, type Discovery, DroppedError, type EditBody, type EventsPage, type EventsQuery, type EventsQueryInput, type ExplainQuery, type Explanation, type Filters, type FiltersInput, type GrantBody, type GrantCan, type GrantInput, type GrantView, HttpError, type Identity, type InboxAckBody, type InboxDelivery, type InboxEntry, type InboxItem, type InboxNextQuery, type InboxPushBody, type InboxQuery, type LABEL_CONDITIONS_MAX, type LabelBody, type LinkView, type LinkedQuery, type MatchView, type MatchesQuery, type Me, type MessageView, type MessagesPage, type MessagesQuery, type MessagesQueryInput, type Method, type Middleware, type MiddlewareContext, type ParsedFilters, type PostBody, type PostInput, type PostOptions, type PrincipalInput, type PrincipalView, type ProfileOption, type Protocol, type ProtocolMethods, type REGISTERED_WATCHERS_MAX, type ReactBody, type Ref, type RegisterBody, type RegisterInput, type RegistrationView, type ReplyOptions, type ResolvedSyncTarget, type RouteName, type ScheduleBody, type ScheduleBodyOutput, type ScheduleInput, type ScheduleOptions, type ScheduleTiming, type ScheduleView, type SchedulesQuery, type SchedulesQueryInput, type SchedulesQueryOutput, type SelfCaller, type SourceJoin, type SourceJoinBody, type SourceMessage, type SourceRead, type SourceReadQuery, type Subscription, type SyncBody, type SyncCopiesQuery, type SyncCopiesView, type SyncFindInput, type SyncFindQuery, type SyncFindView, type SyncImportBody, type SyncImportInput, type SyncReceiptBody, type SyncReceiptInput, type SyncThreadView, type SyncedView, type ThreadSummaryView, type ThreadView, type ThreadsPage, type ThreadsQuery, type ThreadsQueryInput, type TokenBody, type TokenInput, type TokenView, type TypingBody, type TypingResult, type UpdateGrantBody, type UpdateGrantInput, type UploadInput, type UploadStartBody, type UploadTicket, type VerifiedCaller, type WaitOptions, type Watcher, type WatcherContext, type Write, type WritePatch, type WriteSource, type Written, board, duration, type routes };
@@ -1,4 +1,4 @@
1
- import { f as duration, t as HttpError, u as BoardError } from "./errors-Pk0XV1hK.mjs";
2
- import { t as DroppedError } from "./middleware-BU7rVi9F.mjs";
3
- import { t as board } from "./server-BiIUXWbU.mjs";
1
+ import { f as duration, t as HttpError, u as BoardError } from "./errors-rYDxZEuN.mjs";
2
+ import { t as DroppedError } from "./middleware-BxgizazV.mjs";
3
+ import { t as board } from "./server-CtaTtyhw.mjs";
4
4
  export { BoardError, DroppedError, HttpError, board, duration };