@vercel/board 0.37.0 → 0.39.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 (77) hide show
  1. package/dist/{access-BsP0hvcC.mjs → access-CVkjSfxj.mjs} +12 -12
  2. package/dist/access.d.mts +3 -3
  3. package/dist/access.mjs +6 -5
  4. package/dist/{actors-uoD62kiN.mjs → actors-kfMejhaw.mjs} +5 -4
  5. package/dist/{auth-CrjXLgOb.mjs → auth-B3bBYOqf.mjs} +2 -2
  6. package/dist/{auth-BHXgi696.d.mts → auth-BXLCkeB0.d.mts} +3 -3
  7. package/dist/{backend-BIvl2z1z.d.mts → backend-HcCCGPG4.d.mts} +4 -4
  8. package/dist/backend-local.d.mts +1 -1
  9. package/dist/backend-local.mjs +1 -1
  10. package/dist/{chat-provider-C0WUS3-G.mjs → chat-provider-1WKsLEnM.mjs} +2 -2
  11. package/dist/{chat-provider-DFYEReZL.d.mts → chat-provider-DyNy5xdC.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 +5 -5
  17. package/dist/{commands-DGID-4Z2.d.mts → commands-B5d-lmNN.d.mts} +1 -1
  18. package/dist/{commands-D2pFCMSh.mjs → commands-BLS7erNu.mjs} +1 -1
  19. package/dist/{conformance-rCrc_mwi.mjs → conformance-D59Py2m2.mjs} +166 -28
  20. package/dist/conformance.d.mts +10 -2
  21. package/dist/conformance.mjs +1 -1
  22. package/dist/digest-krhjNAt4.mjs +4 -0
  23. package/dist/{engine-COa73McY.mjs → engine-eUgO5jTM.mjs} +4 -4
  24. package/dist/{events-v8f7pF9f.mjs → events-C6HwB046.mjs} +2 -2
  25. package/dist/{exports-DTezg4xR.mjs → exports-M5o4PTfO.mjs} +100 -40
  26. package/dist/exports-vLQ2Y2Nd.d.mts +4 -0
  27. package/dist/{external-BA2aCC_3.mjs → external-CHDxWIVf.mjs} +1 -1
  28. package/dist/{index-B1TZrMMu.d.mts → index-rNqqgkyu.d.mts} +2 -2
  29. package/dist/index.d.mts +5 -5
  30. package/dist/index.mjs +3 -3
  31. package/dist/index.node.d.mts +5 -5
  32. package/dist/index.node.mjs +2 -2
  33. package/dist/inspect/app.js +22 -22
  34. package/dist/{inspect-CoFk2Xj7.mjs → inspect-BkXxR2uB.mjs} +4 -4
  35. package/dist/inspect-lnv1sLXM.mjs +2 -0
  36. package/dist/{local-Cm7a7_Q0.mjs → local-DvkOWf4U.mjs} +248 -532
  37. package/dist/{main-DoZ8IFPb.mjs → main-DtV_Po9i.mjs} +42 -36
  38. package/dist/{memory-DqwXlyK4.mjs → memory-DkoqhxIH.mjs} +2 -2
  39. package/dist/{middleware-k_XKQ6f7.mjs → middleware-CPqAuRtp.mjs} +1 -1
  40. package/dist/{page-LysMGAl3.mjs → page-64IwoGRu.mjs} +2 -2
  41. package/dist/page-BUj8_UZv.mjs +2 -0
  42. package/dist/{provider-7pOnK8Jw.d.mts → provider-D5yVFisj.d.mts} +1 -1
  43. package/dist/{routes-BtsZzal-.d.mts → routes-BffuaoTX.d.mts} +11 -1
  44. package/dist/{schemas-BG205xds.mjs → schemas-AZkxk06N.mjs} +3 -3
  45. package/dist/{serve-2U_JPJtS.mjs → serve-CX1rqDF_.mjs} +3 -3
  46. package/dist/{server-Drul_uwj.mjs → server-DkYkyarg.mjs} +47 -100
  47. package/dist/{serving-6_bhBNAW.mjs → serving-DJMcG0dT.mjs} +1 -1
  48. package/dist/{sql-aetuEBZC.mjs → sql-l3ysn4O5.mjs} +2 -2
  49. package/dist/{sqlite-DvsB8ENQ.mjs → sqlite-CAwNHbQD.mjs} +2 -2
  50. package/dist/{sqlite-db-BPwRoDI7.mjs → sqlite-db-cm5yhrD-.mjs} +1 -1
  51. package/dist/sync-chat-sdk.d.mts +2 -2
  52. package/dist/sync-chat-sdk.mjs +2 -2
  53. package/dist/sync-github.d.mts +2 -2
  54. package/dist/sync-github.mjs +2 -2
  55. package/dist/sync-linear.d.mts +3 -3
  56. package/dist/sync-linear.mjs +2 -2
  57. package/dist/sync-slack.d.mts +3 -3
  58. package/dist/sync-slack.mjs +4 -4
  59. package/dist/sync.d.mts +2 -2
  60. package/dist/sync.mjs +2 -2
  61. package/dist/{targets-B0D4tJDY.mjs → targets-C1mT3M1N.mjs} +6 -6
  62. package/dist/{tokens-Dn4cPZIr.mjs → tokens-DA9ipsZ-.mjs} +1 -1
  63. package/docs/01-board/01-mounting.md +3 -3
  64. package/docs/01-board/03-identity.md +1 -1
  65. package/docs/01-board/06-watchers.md +8 -11
  66. package/docs/01-board/09-access.md +11 -6
  67. package/docs/02-sync/01-overview.md +2 -5
  68. package/docs/03-guides/03-ci.md +10 -4
  69. package/docs/04-reference/01-cli.md +23 -9
  70. package/docs/04-reference/02-board.md +2 -1
  71. package/docs/04-reference/03-http.md +6 -6
  72. package/docs/04-reference/05-conformance.md +9 -2
  73. package/package.json +1 -1
  74. package/dist/digest-CLGw7653.mjs +0 -4
  75. package/dist/exports-Bb0m03fT.d.mts +0 -4
  76. package/dist/inspect-B8c0Wh5Z.mjs +0 -2
  77. package/dist/page-BAQpb-s-.mjs +0 -2
@@ -1,10 +1,10 @@
1
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
- import { a as ChannelPath, b as toStorable, d as MESSAGE_TEXT_MAX } from "./schemas-BG205xds.mjs";
3
- import { l as isThreadTarget, s as channelOf } from "./external-BA2aCC_3.mjs";
2
+ import { b as toStorable, f as MESSAGE_TEXT_MAX, o as ChannelPath } from "./schemas-AZkxk06N.mjs";
3
+ import { l as isThreadTarget, s as channelOf } from "./external-CHDxWIVf.mjs";
4
4
  import { t as canonicalEmoji } from "./emoji-CTLpvH-A.mjs";
5
- import { a as waitUntil, i as afterRetry, s as derivedId, t as DroppedError } from "./middleware-k_XKQ6f7.mjs";
5
+ import { a as waitUntil, i as afterRetry, s as derivedId, t as DroppedError } from "./middleware-CPqAuRtp.mjs";
6
6
  import { n as replaceMentions } from "./mentions-CB6ShY4R.mjs";
7
- import { a as immutable, d as routesFor, l as UnreadableError, n as SyncOverrides, o as ReceivedEvent, s as ResolvedTarget, u as channelMissing } from "./events-v8f7pF9f.mjs";
7
+ import { a as immutable, d as routesFor, l as UnreadableError, n as SyncOverrides, o as ReceivedEvent, s as ResolvedTarget, u as channelMissing } from "./events-C6HwB046.mjs";
8
8
  import { t as displayText } from "./bots-CGkO76qH.mjs";
9
9
  //#region src/sync/engine.ts
10
10
  /** `files`: a message with files may have no text. */
@@ -1,5 +1,5 @@
1
- import { c as LabelKey, u as Labels } from "./schemas-BG205xds.mjs";
2
- import { n as ExternalEvent, r as ExternalLocation } from "./external-BA2aCC_3.mjs";
1
+ import { d as Labels, l as LabelKey } from "./schemas-AZkxk06N.mjs";
2
+ import { n as ExternalEvent, r as ExternalLocation } from "./external-CHDxWIVf.mjs";
3
3
  import { z } from "zod";
4
4
  //#region src/sync/fn.ts
5
5
  const ROUTES = Symbol.for("board.syncRoutes");
@@ -1,10 +1,10 @@
1
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
- import { m as RemoteWatcherId } from "./schemas-BG205xds.mjs";
3
- import { A as MatchesQuery, B as SyncBody, C as GrantBody, D as InboxQuery, E as InboxPushBody, F as RegisterBody, G as ThreadsQuery, H as SyncFindQuery, I as ScheduleBody, J as UpdateGrantBody, K as TokenBody, L as SchedulesQuery, M as PostBody, N as ReactBody, O as LabelBody, P as Ref, R as SourceJoinBody, S as ExplainQuery, T as InboxNextQuery, U as SyncImportBody, V as SyncCopiesQuery, W as SyncReceiptBody, Y as UploadStartBody, _ as AckBody, a as runMatch, b as EditBody, d as openapi, f as queryObject, g as VERSION, h as SYNC, i as canonicalWatchers, j as MessagesQuery, k as LinkedQuery, l as METHODS, m as readJson, n as syncTarget, o as compileWatcher, p as readCapped, q as TypingBody, r as withEmailMentions, t as mentionsEmails, u as createRouter, v as CreateChannelBody, w as InboxAckBody, x as EventsQuery, y as DeleteBody, z as SourceReadQuery } from "./targets-B0D4tJDY.mjs";
4
- import { a as waitUntil, r as runMiddleware, s as derivedId, t as DroppedError, u as sha256 } from "./middleware-k_XKQ6f7.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-uoD62kiN.mjs";
2
+ import { h as RemoteWatcherId } from "./schemas-AZkxk06N.mjs";
3
+ import { A as MatchesQuery, B as SyncBody, C as GrantBody, D as InboxQuery, E as InboxPushBody, F as RegisterBody, G as ThreadsQuery, H as SyncFindQuery, I as ScheduleBody, J as UpdateGrantBody, K as TokenBody, L as SchedulesQuery, M as PostBody, N as ReactBody, O as LabelBody, P as Ref, R as SourceJoinBody, S as ExplainQuery, T as InboxNextQuery, U as SyncImportBody, V as SyncCopiesQuery, W as SyncReceiptBody, Y as UploadStartBody, _ as AckBody, a as runMatch, b as EditBody, d as openapi, f as queryObject, g as VERSION, h as SYNC, i as canonicalWatchers, j as MessagesQuery, k as LinkedQuery, l as METHODS, m as readJson, n as syncTarget, o as compileWatcher, p as readCapped, q as TypingBody, r as withEmailMentions, t as mentionsEmails, u as createRouter, v as CreateChannelBody, w as InboxAckBody, x as EventsQuery, y as DeleteBody, z as SourceReadQuery } from "./targets-C1mT3M1N.mjs";
4
+ import { a as waitUntil, r as runMiddleware, s as derivedId, t as DroppedError, u as sha256 } from "./middleware-CPqAuRtp.mjs";
5
+ import { a as canText, c as compileAccess, d as parsePattern, r as PERMISSIONS, u as parseCan } from "./access-CVkjSfxj.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-B3bBYOqf.mjs";
7
+ import { i as resolveActor, r as claimsOf, t as KNOWN_AGENTS } from "./actors-kfMejhaw.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;
@@ -17,8 +17,8 @@ const POLL_WAIT_S = 25;
17
17
  const describe$1 = (error) => ((error instanceof Error ? error.message : String(error)) || "unknown error").slice(0, 500);
18
18
  /** Only an https URL can be woken; anything else pulls on its own. */
19
19
  const wakeable = (here) => here?.startsWith("https://") ? here : null;
20
- /** Whether a registration is woken at all: one with neither a URL nor a path pulls on its own, off Vercel. */
21
- const pulls = (registration) => registration.url === null && registration.path === void 0;
20
+ /** Whether a registration is woken at all: one with no path pulls on its own, off Vercel. */
21
+ const pulls = (registration) => registration.path === void 0;
22
22
  /**
23
23
  * Whether this is a deployment on Vercel, whose function doesn't outlive its request: `VERCEL` is 1,
24
24
  * outside development. `vercel env pull` and `vercel dev` set both for a dev server, which stays up.
@@ -39,11 +39,10 @@ function wakePath(here) {
39
39
  };
40
40
  }
41
41
  /**
42
- * Runs a board's watchers on another board that matches them: it registers them there, is woken
43
- * when one matches, with nothing in the wake-up but a hash, and pulls what matched with its own
44
- * credentials, runs it, and acks it. When it can't be woken (no https URL of its own, a dev
45
- * server say, or no path on a board that wakes only paths), it pulls on its own. http() and a
46
- * deployment's vercel() run their watchers this way.
42
+ * Runs a deployment's watchers on Vercel's API, which matches them: it registers them there, is
43
+ * woken at its path when one matches, with nothing in the wake-up but a hash, and pulls what
44
+ * matched with its own credentials, runs it, and acks it. With no path to wake (a dev server, say),
45
+ * it pulls on its own. vercel() runs a deployment's watchers this way.
47
46
  */
48
47
  function registrant(options) {
49
48
  const { registry, rethrow } = options;
@@ -656,6 +655,8 @@ function createVercel(options, environment) {
656
655
  if (found) named.set(name, found);
657
656
  return found ?? null;
658
657
  }
658
+ /** Channels' names by ID, as posts without a client ID named them: a post's own channel, which it may not be able to list. */
659
+ const posted = /* @__PURE__ */ new Map();
659
660
  async function channelById(who, id) {
660
661
  const found = (await loadChannels(who)).find((channel) => channel.id === id) ?? (await loadChannels(who, true)).find((channel) => channel.id === id);
661
662
  if (!found) throw new HttpError(502, "remote_error", `Vercel's API names a channel it doesn't list: ${id}`);
@@ -833,6 +834,31 @@ function createVercel(options, environment) {
833
834
  } } : {}
834
835
  };
835
836
  }
837
+ /**
838
+ * The message a post made, from what it sent, when the API answers with its IDs only: the caller
839
+ * may post there but not read it back. It's by the caller, as its credentials and profile name it.
840
+ */
841
+ async function sent(who, ids, input) {
842
+ const { actor } = await self(who);
843
+ const by = {
844
+ id: await actorOf(who),
845
+ principal: actor.principal,
846
+ ...who.profile ? { profile: who.profile } : {},
847
+ ...who.session ? { session: who.session } : {}
848
+ };
849
+ const attachments = (await Promise.all((input.attachments ?? []).map(async (id) => api(who, "GET", await onBoard(who, `/attachments/${encodeURIComponent(id)}`)).then(({ attachment }) => fileOf(attachment), () => null)))).filter((file) => file !== null);
850
+ return {
851
+ ...ids,
852
+ text: input.text,
853
+ version: 1,
854
+ revision: 1,
855
+ createdAt: Date.now(),
856
+ createdBy: by,
857
+ ...input.labels && Object.keys(input.labels).length ? { labels: { ...input.labels } } : {},
858
+ ...input.noSync ? { noSync: true } : {},
859
+ ...attachments.length ? { attachments } : {}
860
+ };
861
+ }
836
862
  async function scheduleView(who, schedule) {
837
863
  const { canceled } = schedule;
838
864
  return {
@@ -1491,16 +1517,19 @@ function createVercel(options, environment) {
1491
1517
  for (const { key, values } of filter.labels ?? []) parts.push(`--label ${values ? `${key}=${values.join("|")}` : key}`);
1492
1518
  return parts.join(" ");
1493
1519
  }
1494
- /** Where a registration is woken, as board shows it: its URL, or a path on its project (and a preview's branch). */
1495
1520
  const syncOf = (found) => (found.sync ?? []).map(({ key, platform }) => ({
1496
1521
  key,
1497
1522
  platform
1498
1523
  }));
1524
+ /**
1525
+ * Where a registration is woken, as board shows it: a path on its project (and a preview's branch),
1526
+ * or, with none, nowhere: it pulls. The API never wakes a URL, and its replies carry none.
1527
+ */
1499
1528
  const whereOf = (found) => found.path ? {
1500
1529
  url: null,
1501
1530
  path: found.path,
1502
1531
  ...found.branch ? { branch: found.branch } : {}
1503
- } : { url: found.url };
1532
+ } : { url: null };
1504
1533
  /**
1505
1534
  * Vercel's API takes watchers only from a deployment's own credentials: never a person's, an app's,
1506
1535
  * or a board token's, whoever made it. Anyone else's registration, pull, or ack is its 403
@@ -1634,7 +1663,7 @@ function createVercel(options, environment) {
1634
1663
  matches: ({ signal, ...query }) => pullAs(deployment, query, signal, tails),
1635
1664
  ack: (id, body) => ackAs(deployment, id, body)
1636
1665
  },
1637
- wakeAt: async (here) => wakePath(here) ?? { url: null },
1666
+ wakeAt: async (here) => wakePath(here) ?? {},
1638
1667
  binding: bound,
1639
1668
  hash: () => tagOf(tails, bound().sync),
1640
1669
  hasWork: () => Object.keys(tails).length > 0 || bound().sync.length > 0,
@@ -1787,6 +1816,30 @@ function createVercel(options, environment) {
1787
1816
  }
1788
1817
  /** A sync key's inbox, under the board. */
1789
1818
  const inboxPath = (who, key, rest = "") => onBoard(who, `/sync/inbox/${encodeURIComponent(key)}${rest}`);
1819
+ /** A grant Vercel's API won't keep: one naming a GitHub run or an OIDC issuer, which an app stands in for. */
1820
+ const grantRefused = (error) => {
1821
+ if (error instanceof HttpError && error.code === "unsupported_principal") throw new HttpError(400, "unsupported_principal", "Vercel's board takes no GitHub or OIDC principals in a grant.", {
1822
+ hint: "Grant an app that an OIDC exchange policy issues tokens for: --app <slug>.",
1823
+ origin: "handle"
1824
+ });
1825
+ throw error;
1826
+ };
1827
+ /** An explain Vercel's API won't answer: for a GitHub run or an OIDC issuer, which no grant there names. */
1828
+ const explainRefused = (error) => {
1829
+ if (error instanceof HttpError && error.code === "unsupported_principal") throw new HttpError(400, "unsupported_principal", "Vercel's board explains no GitHub or OIDC caller: no grant names one.", {
1830
+ hint: "Explain the app an OIDC exchange policy issues tokens for: --app <slug>.",
1831
+ origin: "handle"
1832
+ });
1833
+ throw error;
1834
+ };
1835
+ /** A mint Vercel's API won't make: only a deployment mints board tokens there, and a board token mints from itself. */
1836
+ const mintRefused = (error) => {
1837
+ if (error instanceof HttpError && error.code === "unsupported_principal") throw new HttpError(403, "unsupported_principal", "Vercel's board mints board tokens only for a deployment.", {
1838
+ hint: "Mint it from a deployment, with its OIDC token, or from a board token.",
1839
+ origin: "handle"
1840
+ });
1841
+ throw error;
1842
+ };
1790
1843
  const methods = {
1791
1844
  ...Object.fromEntries(METHODS.map((method) => [method, async () => {
1792
1845
  throw notSupported(method === "register" || method === "watchers" || method === "matches" || method === "ack" ? "watchers" : method);
@@ -2040,12 +2093,13 @@ function createVercel(options, environment) {
2040
2093
  const who = whoOf(caller);
2041
2094
  const clientId = input.id !== void 0 ? await clientIdOf(input.id) : void 0;
2042
2095
  let made;
2096
+ let channelName;
2043
2097
  if (input.channel !== void 0) {
2044
- const channel = await channelToPost(who, input.channel);
2098
+ channelName = input.channel;
2045
2099
  made = await api(who, "POST", await onBoard(who, "/threads"), {
2046
2100
  body: {
2047
2101
  operationId: operationId(),
2048
- channelId: channel.id,
2102
+ channel: input.channel,
2049
2103
  text: input.text,
2050
2104
  ...input.labels && Object.keys(input.labels).length ? { labels: input.labels } : {},
2051
2105
  ...clientId ? { clientId } : {},
@@ -2056,13 +2110,14 @@ function createVercel(options, environment) {
2056
2110
  });
2057
2111
  } else {
2058
2112
  const { thread, message: to, channel } = await messageIn(who, input.re, signal);
2113
+ channelName = channel.name;
2059
2114
  const after = input.after === void 0 ? void 0 : locate(input.after);
2060
2115
  if (after !== void 0 && after?.threadId !== thread.id) {
2061
2116
  const landed = clientId ? await api(who, "GET", await onBoard(who, `/posts/${encodeURIComponent(clientId)}`), { signal }).catch(() => null) : null;
2062
2117
  if (landed?.thread.id === thread.id) return { message: await view(who, landed.message, channel.name) };
2063
2118
  throw badRequest(`after: ${input.after} isn't in ${input.re}'s thread`, "invalid_after");
2064
2119
  }
2065
- made = await api(who, "POST", await onBoard(who, `/threads/${encodeURIComponent(thread.id)}/messages`), {
2120
+ const reply = await api(who, "POST", await onBoard(who, `/threads/${encodeURIComponent(thread.id)}/messages`), {
2066
2121
  body: {
2067
2122
  operationId: operationId(),
2068
2123
  text: input.text,
@@ -2078,25 +2133,27 @@ function createVercel(options, environment) {
2078
2133
  throw error;
2079
2134
  });
2080
2135
  if (input.labels && Object.keys(input.labels).length) {
2081
- const labeled = await api(who, "POST", await onBoard(who, `/threads/${encodeURIComponent(thread.id)}/messages/${made.message.sequence}/labels`), {
2136
+ const labeled = await api(who, "POST", await onBoard(who, `/threads/${encodeURIComponent(thread.id)}/messages/${reply.message.sequence}/labels`), {
2082
2137
  body: {
2083
2138
  operationId: operationId(),
2084
2139
  set: input.labels
2085
2140
  },
2086
2141
  signal
2087
2142
  });
2088
- made = {
2089
- ...made,
2090
- message: {
2091
- ...made.message,
2092
- ...labeled.meta.labels ? { labels: labeled.meta.labels } : {},
2093
- version: labeled.meta.version
2094
- }
2143
+ reply.message = {
2144
+ ...reply.message,
2145
+ ...labeled.meta.labels ? { labels: labeled.meta.labels } : {},
2146
+ version: labeled.meta.version
2095
2147
  };
2096
2148
  }
2149
+ made = reply;
2150
+ }
2151
+ const channelId = made.thread.channelId;
2152
+ if (channelId !== void 0) {
2153
+ if (clientId !== void 0 && posted.get(channelId) !== channelName) channelName = await channelById(who, channelId).then((channel) => (posted.set(channelId, channel.name), channel.name), () => channelName);
2154
+ else posted.set(channelId, channelName);
2097
2155
  }
2098
- const channel = await channelById(who, made.thread.channelId);
2099
- return { message: await view(who, made.message, channel.name) };
2156
+ return { message: await view(who, "text" in made.message ? made.message : await sent(who, made.message, input), channelName) };
2100
2157
  },
2101
2158
  async posted(caller, { id }, signal) {
2102
2159
  const who = whoOf(caller);
@@ -2173,7 +2230,7 @@ function createVercel(options, environment) {
2173
2230
  ...input
2174
2231
  },
2175
2232
  ...signal ? { signal } : {}
2176
- });
2233
+ }).catch(grantRefused);
2177
2234
  return { grant: grantFrom(grant) };
2178
2235
  },
2179
2236
  async updateGrant(caller, { id, ...change }, signal) {
@@ -2184,7 +2241,7 @@ function createVercel(options, environment) {
2184
2241
  ...change
2185
2242
  },
2186
2243
  ...signal ? { signal } : {}
2187
- });
2244
+ }).catch(grantRefused);
2188
2245
  return { grant: grantFrom(grant) };
2189
2246
  },
2190
2247
  async explain(caller, { claim, ...query }, signal) {
@@ -2192,7 +2249,7 @@ function createVercel(options, environment) {
2192
2249
  const params = new URLSearchParams();
2193
2250
  for (const [name, value] of Object.entries(query)) if (value !== void 0) params.set(name, value);
2194
2251
  for (const pair of claim ?? []) params.append("claim", pair);
2195
- const explained = await api(who, "GET", await onBoard(who, `/grants/explain?${params}`), signal ? { signal } : {});
2252
+ const explained = await api(who, "GET", await onBoard(who, `/grants/explain?${params}`), signal ? { signal } : {}).catch(explainRefused);
2196
2253
  return {
2197
2254
  ...explained,
2198
2255
  grants: explained.grants.map(grantFrom)
@@ -2218,7 +2275,7 @@ function createVercel(options, environment) {
2218
2275
  ...input
2219
2276
  },
2220
2277
  ...signal ? { signal } : {}
2221
- });
2278
+ }).catch(mintRefused);
2222
2279
  return {
2223
2280
  ...created,
2224
2281
  token: tokenFrom(created.token)
@@ -2453,7 +2510,7 @@ function createVercel(options, environment) {
2453
2510
  return registerAs(whoOf(caller), typeof body.path === "string" ? {
2454
2511
  path: body.path,
2455
2512
  ...body.branch ? { branch: body.branch } : {}
2456
- } : { url: body.url ?? null }, body.watch, body.sync ?? [], false);
2513
+ } : {}, body.watch, body.sync ?? [], false);
2457
2514
  },
2458
2515
  async matches(caller, query, signal) {
2459
2516
  return { matches: await pullAs(whoOf(caller), query, signal) };
@@ -2498,7 +2555,7 @@ function createVercel(options, environment) {
2498
2555
  /**
2499
2556
  * The policy a board's options say: verifying requests, and what they and the principals its
2500
2557
  * backend stores may do. `keeps`: the backend keeps the board, so it serves requests; one that
2501
- * uses another board's (Vercel's, or one at `BOARD_URL`) answers only wake-ups and webhooks.
2558
+ * uses another board's answers only wake-ups and webhooks on Vercel's, and nothing at `BOARD_URL`.
2502
2559
  */
2503
2560
  function createPolicy(options, keeps, serving, trust = null) {
2504
2561
  const grants = trust ? () => trust.grants() : null;
@@ -2631,7 +2688,7 @@ function createPolicy(options, keeps, serving, trust = null) {
2631
2688
  };
2632
2689
  throw error;
2633
2690
  }
2634
- const scope = principal.scope === void 0 ? null : compileAccess(parseScope(principal.scope));
2691
+ const scope = principal.scope === void 0 ? null : compileAccess(parseCan(principal.scope));
2635
2692
  const allowed = (permissions) => scope ? permissions.filter((permission) => scope.can(permission, channel)) : [...permissions];
2636
2693
  if ("fixed" in resolved) return {
2637
2694
  pattern: null,
@@ -2662,7 +2719,7 @@ function createPolicy(options, keeps, serving, trust = null) {
2662
2719
  async identify(request) {
2663
2720
  const found = await principalOf(request);
2664
2721
  const claims = found.pinned ? pinnedClaims(found.pinned, request.claims) : request.claims;
2665
- const scope = found.scope === void 0 ? claims.scope ?? void 0 : claims.scope === null ? found.scope : scopeOf(compileAccess(parseScope(found.scope)).narrow(parseScope(claims.scope)));
2722
+ const scope = found.scope === void 0 ? claims.scope ?? void 0 : claims.scope === null ? found.scope : canText(compileAccess(parseCan(found.scope)).narrow(parseCan(claims.scope)));
2666
2723
  const principal = scope === void 0 ? found : {
2667
2724
  ...found,
2668
2725
  scope
@@ -2959,8 +3016,11 @@ async function createServe(context) {
2959
3016
  origin: { via: { kind: "api" } }
2960
3017
  };
2961
3018
  }
2962
- /** What a board that serves no requests answers them: one that uses another board's. */
2963
- const servesOnly = () => new HttpError(404, "not_found", `${ownUrl() ?? "this board"} answers only wake-ups and webhooks`);
3019
+ /**
3020
+ * What a board that serves no requests answers them: one that uses another board's. One on
3021
+ * Vercel's still takes wake-ups and webhooks; one at `BOARD_URL` has neither.
3022
+ */
3023
+ const servesOnly = () => new HttpError(404, "not_found", `${ownUrl() ?? "this board"} answers ${backend.routes.length > 0 || engine ? "only wake-ups and webhooks" : "nothing itself"}`);
2964
3024
  /**
2965
3025
  * `@[ada@vercel.com]`: an email a synced platform knows becomes that user's mention, and the
2966
3026
  * board learns who they are; the rest stay plain text.
@@ -3917,4 +3977,4 @@ async function* events(client, query = {}, opts = {}) {
3917
3977
  }
3918
3978
  }
3919
3979
  //#endregion
3920
- export { registrant as a, isApiMessageId as i, isBoardName as n, wakePath as o, createVercel as r, createBoard as t };
3980
+ export { tailWatchers as a, isApiMessageId as i, isBoardName as n, deployedOnVercel as o, createVercel as r, createBoard as t };
@@ -0,0 +1,4 @@
1
+ import "./routes-BffuaoTX.mjs";
2
+ import "./auth-BXLCkeB0.mjs";
3
+ import "./backend-HcCCGPG4.mjs";
4
+ import "./provider-D5yVFisj.mjs";
@@ -1,4 +1,4 @@
1
- import { d as MESSAGE_TEXT_MAX, f as MessageId } from "./schemas-BG205xds.mjs";
1
+ import { f as MESSAGE_TEXT_MAX, p as MessageId } from "./schemas-AZkxk06N.mjs";
2
2
  import { z } from "zod";
3
3
  //#region src/contract/external.ts
4
4
  /**
@@ -1,5 +1,5 @@
1
- import { d as Board, f as BoardOptions } from "./backend-BIvl2z1z.mjs";
2
- import "./exports-Bb0m03fT.mjs";
1
+ import { d as Board, f as BoardOptions } from "./backend-HcCCGPG4.mjs";
2
+ import "./exports-vLQ2Y2Nd.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 { $ 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-BtsZzal-.mjs";
2
- import { i as Claims, r as CallerRequest } from "./auth-BHXgi696.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-BIvl2z1z.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-7pOnK8Jw.mjs";
5
- import "./exports-Bb0m03fT.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, 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, tn as Attachment, 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-BffuaoTX.mjs";
2
+ import { i as Claims, r as CallerRequest } from "./auth-BXLCkeB0.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-HcCCGPG4.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-D5yVFisj.mjs";
5
+ import "./exports-vLQ2Y2Nd.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`
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { f as duration, t as HttpError, u as BoardError } from "./errors-rYDxZEuN.mjs";
2
- import { t as DroppedError } from "./middleware-k_XKQ6f7.mjs";
3
- import { r as createVercel, t as createBoard } from "./exports-DTezg4xR.mjs";
2
+ import { t as DroppedError } from "./middleware-CPqAuRtp.mjs";
3
+ import { r as createVercel, t as createBoard } from "./exports-M5o4PTfO.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-COa73McY.mjs"),
26
+ sync: () => import("./engine-eUgO5jTM.mjs"),
27
27
  serving: null
28
28
  });
29
29
  }
@@ -1,6 +1,6 @@
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-BtsZzal-.mjs";
2
- import { i as Claims, r as CallerRequest } from "./auth-BHXgi696.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-BIvl2z1z.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-7pOnK8Jw.mjs";
5
- import { t as board } from "./index-B1TZrMMu.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, 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, tn as Attachment, 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-BffuaoTX.mjs";
2
+ import { i as Claims, r as CallerRequest } from "./auth-BXLCkeB0.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-HcCCGPG4.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-D5yVFisj.mjs";
5
+ import { t as board } from "./index-rNqqgkyu.mjs";
6
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
1
  import { f as duration, t as HttpError, u as BoardError } from "./errors-rYDxZEuN.mjs";
2
- import { t as DroppedError } from "./middleware-k_XKQ6f7.mjs";
3
- import { t as board } from "./server-Drul_uwj.mjs";
2
+ import { t as DroppedError } from "./middleware-CPqAuRtp.mjs";
3
+ import { t as board } from "./server-DkYkyarg.mjs";
4
4
  export { BoardError, DroppedError, HttpError, board, duration };