@vercel/board 0.43.1 → 0.45.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 (79) hide show
  1. package/dist/{access-BgBiaCyx.mjs → access-3udXjJAg.mjs} +2 -2
  2. package/dist/access.d.mts +3 -3
  3. package/dist/access.mjs +6 -6
  4. package/dist/{actors-DkZsnMgA.mjs → actors-DasGZnfb.mjs} +3 -3
  5. package/dist/{auth-Bn8J_1F2.d.mts → auth-BG_whr9_.d.mts} +1 -1
  6. package/dist/{auth-Ft4AJptx.mjs → auth-aiOVE82-.mjs} +2 -2
  7. package/dist/{backend-DMrK55mU.d.mts → backend-D6yTo8Un.d.mts} +3 -3
  8. package/dist/backend-local.d.mts +1 -1
  9. package/dist/backend-local.mjs +1 -1
  10. package/dist/{bots-CGkO76qH.mjs → bots-CLKKMgYf.mjs} +6 -1
  11. package/dist/{chat-provider-CPZg2MQb.mjs → chat-provider-BvNqOQFL.mjs} +7 -5
  12. package/dist/{chat-provider-Cgkh9xJw.d.mts → chat-provider-V2jnjVLq.d.mts} +4 -4
  13. package/dist/cli-commands.d.mts +1 -1
  14. package/dist/cli-commands.mjs +1 -1
  15. package/dist/cli-embedded.d.mts +2 -2
  16. package/dist/cli-embedded.mjs +2 -2
  17. package/dist/cli.mjs +14 -7
  18. package/dist/{commands-C4fR0md0.mjs → commands-CqdnjUkm.mjs} +7 -1
  19. package/dist/{commands-BlM-ckFS.d.mts → commands-DewS14_P.d.mts} +7 -1
  20. package/dist/{conformance-BORt5nky.mjs → conformance-BInS4_6b.mjs} +68 -2
  21. package/dist/conformance.d.mts +1 -1
  22. package/dist/conformance.mjs +1 -1
  23. package/dist/{data-values-C-Cq80hz.mjs → data-values-CoTP0SQG.mjs} +43 -54
  24. package/dist/{engine-BVHSH2Kn.mjs → engine-XVBt02Bl.mjs} +20 -13
  25. package/dist/{errors-DUzpDSrJ.mjs → errors-ZazTZh-s.mjs} +20 -3
  26. package/dist/{events-BT8y_81j.mjs → events-D17RndlV.mjs} +5 -3
  27. package/dist/{exports-BVgUNVsP.mjs → exports-DCf75prP.mjs} +184 -45
  28. package/dist/exports-Gspe1eEq.d.mts +4 -0
  29. package/dist/{external-DymyhUzl.mjs → external-DfhN7lKK.mjs} +1 -1
  30. package/dist/{index-CydxnBND.d.mts → index-Djmr4GzQ.d.mts} +2 -2
  31. package/dist/index.d.mts +6 -6
  32. package/dist/index.mjs +4 -4
  33. package/dist/index.node.d.mts +6 -6
  34. package/dist/index.node.mjs +3 -3
  35. package/dist/inspect/app.js +88 -88
  36. package/dist/inspect/engine.js +5 -5
  37. package/dist/{inspect-ZGkTJl3f.mjs → inspect-B0_aKQM8.mjs} +23 -7
  38. package/dist/inspect-CULoD54F.mjs +2 -0
  39. package/dist/{local-yB2DFcRi.mjs → local-Bel_oeFa.mjs} +26 -13
  40. package/dist/{main-DjEJPCgo.mjs → main-DmsdcUZ_.mjs} +36 -13
  41. package/dist/{memory-DhduVbUu.mjs → memory-DyEL0fvN.mjs} +2 -2
  42. package/dist/{middleware-0DUFrav-.mjs → middleware-BHHKHA9q.mjs} +2 -2
  43. package/dist/origin-BHmEdok7.mjs +428 -0
  44. package/dist/{provider-dY54GFNz.d.mts → provider-BC9mPYVh.d.mts} +39 -6
  45. package/dist/{origin-9Ch-Zonv.mjs → routes-CkUetTO2.mjs} +14 -437
  46. package/dist/{routes-By9lmvUD.d.mts → routes-zm4TXKCC.d.mts} +8 -1
  47. package/dist/{schemas-DAzSsgWk.mjs → schemas-BhZaystC.mjs} +8 -2
  48. package/dist/schemas.mjs +1 -1
  49. package/dist/{serve-Cnb4TpaJ.mjs → serve-bPSEx_8X.mjs} +4 -4
  50. package/dist/{server-BHpUqip5.mjs → server-CcvxkXzG.mjs} +8 -7
  51. package/dist/{serving-hcxzaCCO.mjs → serving-BLVRrJ7P.mjs} +1 -1
  52. package/dist/{sql-P9g-rLIF.mjs → sql-CyVcjw8x.mjs} +2 -2
  53. package/dist/{sqlite-B3rCcIof.mjs → sqlite-Con-8duk.mjs} +2 -2
  54. package/dist/{sqlite-db-D0Fyju-4.mjs → sqlite-db-BdzxtUOV.mjs} +1 -1
  55. package/dist/sync-chat-sdk.d.mts +2 -2
  56. package/dist/sync-chat-sdk.mjs +2 -2
  57. package/dist/sync-github.d.mts +2 -2
  58. package/dist/sync-github.mjs +2 -2
  59. package/dist/sync-linear.d.mts +3 -3
  60. package/dist/sync-linear.mjs +3 -3
  61. package/dist/sync-slack.d.mts +27 -4
  62. package/dist/sync-slack.mjs +208 -12
  63. package/dist/sync.d.mts +3 -3
  64. package/dist/sync.mjs +2 -2
  65. package/dist/{tokens-BSMpTPEe.mjs → tokens-BErYXuHZ.mjs} +2 -2
  66. package/docs/01-board/04-messages.md +1 -1
  67. package/docs/01-board/09-access.md +8 -0
  68. package/docs/02-sync/02-functions.md +4 -1
  69. package/docs/02-sync/03-slack.md +24 -1
  70. package/docs/02-sync/04-github.md +5 -2
  71. package/docs/02-sync/06-providers.md +1 -1
  72. package/docs/03-guides/02-inspector.md +16 -0
  73. package/docs/04-reference/01-cli.md +1 -1
  74. package/docs/04-reference/02-board.md +24 -3
  75. package/docs/04-reference/03-http.md +8 -2
  76. package/docs/04-reference/05-conformance.md +1 -1
  77. package/package.json +3 -1
  78. package/dist/exports-Bw_OYNRl.d.mts +0 -4
  79. package/dist/inspect-DRPRCOaV.mjs +0 -2
@@ -1,4 +1,4 @@
1
- import { f as MESSAGE_TEXT_MAX } from "./schemas-DAzSsgWk.mjs";
1
+ import { p as MESSAGE_TEXT_MAX } from "./schemas-BhZaystC.mjs";
2
2
  import { r as normalizeEmoji } from "./emoji-CTLpvH-A.mjs";
3
3
  import { ZodError } from "zod";
4
4
  //#region src/contract/files.ts
@@ -244,6 +244,19 @@ const messageBody = (input) => {
244
244
  attachments: attachments.map((a) => typeof a === "string" ? a : a.id)
245
245
  } : rest;
246
246
  };
247
+ /** Tells `onState` each change, once: `live` when the board answers, `retrying` when a request fails. It never guesses. */
248
+ function eventsState(onState) {
249
+ let current = null;
250
+ const tell = (next) => {
251
+ if (next === current) return;
252
+ current = next;
253
+ onState?.(next);
254
+ };
255
+ return {
256
+ answered: () => tell("live"),
257
+ failed: () => tell("retrying")
258
+ };
259
+ }
247
260
  const UNITS = {
248
261
  ms: 1,
249
262
  s: 1e3,
@@ -605,10 +618,11 @@ function createBoardClient(options) {
605
618
  inboxNext: async (key, opts = {}) => (await call("GET", `/inbox/${path(key)}/next${queryString(opts)}`)).items,
606
619
  /** How an inbox event went: done, or an error to try it again. */
607
620
  inboxAck: (key, id, body) => call("POST", `/inbox/${path(key)}/${path(id)}/ack`, { body }),
608
- /** Live events. Reconnects from the last seen index whenever the stream closes. */
621
+ /** Live events. Reconnects from the last seen index whenever the stream closes, and tells `onState` whether it's live or retrying. */
609
622
  async *events(query = {}, opts = {}) {
610
623
  let after = query.after;
611
624
  let failures = 0;
625
+ const state = eventsState(opts.onState);
612
626
  while (!opts.signal?.aborted) {
613
627
  let response;
614
628
  try {
@@ -622,10 +636,12 @@ function createBoardClient(options) {
622
636
  } catch (error) {
623
637
  if (opts.signal?.aborted) return;
624
638
  if (error instanceof BoardError && error.status >= 400 && error.status < 500) throw error;
639
+ state.failed();
625
640
  await new Promise((r) => setTimeout(r, Math.min(3e4, 500 * 2 ** failures++)));
626
641
  continue;
627
642
  }
628
643
  failures = 0;
644
+ state.answered();
629
645
  try {
630
646
  for await (const message of parseSse(response.body, opts.signal)) {
631
647
  if (message.id !== void 0) after = message.id;
@@ -633,6 +649,7 @@ function createBoardClient(options) {
633
649
  }
634
650
  } catch (error) {
635
651
  if (opts.signal?.aborted) return;
652
+ state.failed();
636
653
  await new Promise((r) => setTimeout(r, Math.min(3e4, 500 * 2 ** failures++)));
637
654
  }
638
655
  }
@@ -757,4 +774,4 @@ function toErrorResponse(error) {
757
774
  } }, 500);
758
775
  }
759
776
  //#endregion
760
- export { IMPORT_BYTES_MAX as _, forbidden as a, mediaType as b, toErrorResponse as c, createBoardClient as d, duration as f, DIRECT_UPLOAD_BYTES_MAX as g, ATTACHMENT_BYTES_MAX as h, duplicateId as i, unauthorized as l, parseProfileHeader as m, RejectedError as n, json as o, formatProfileHeader as p, badRequest as r, notFound as s, HttpError as t, BoardError as u, fileName as v, typeOf as x, fileSize as y };
777
+ export { typeOf as C, mediaType as S, ATTACHMENT_BYTES_MAX as _, forbidden as a, fileName as b, textTooLong as c, BoardError as d, createBoardClient as f, parseProfileHeader as g, formatProfileHeader as h, duplicateId as i, toErrorResponse as l, eventsState as m, RejectedError as n, json as o, duration as p, badRequest as r, notFound as s, HttpError as t, unauthorized as u, DIRECT_UPLOAD_BYTES_MAX as v, fileSize as x, IMPORT_BYTES_MAX as y };
@@ -1,5 +1,5 @@
1
- import { d as Labels, l as LabelKey } from "./schemas-DAzSsgWk.mjs";
2
- import { n as ExternalEvent, r as ExternalLocation } from "./external-DymyhUzl.mjs";
1
+ import { f as Labels, u as LabelKey } from "./schemas-BhZaystC.mjs";
2
+ import { n as ExternalEvent, r as ExternalLocation } from "./external-DfhN7lKK.mjs";
3
3
  import { z } from "zod";
4
4
  //#region src/sync/fn.ts
5
5
  const ROUTES = Symbol.for("board.syncRoutes");
@@ -228,6 +228,8 @@ var SyncProvider = class {
228
228
  return `**${input.label}**: ${input.message.text}`;
229
229
  }
230
230
  };
231
+ /** Whether a text opens a block (a code fence, a list, a heading, a quote, a table), which is one only at a line's start. */
232
+ const opensBlock = (text) => /^(```|~~~|[-*+] |\d+[.)] |#{1,6} |>|\|)/.test(text);
231
233
  //#endregion
232
234
  //#region src/sync/events.ts
233
235
  const EventBase = z.object({
@@ -300,4 +302,4 @@ function immutable(value) {
300
302
  return value;
301
303
  }
302
304
  //#endregion
303
- export { immutable as a, SyncProvider as c, routesFor as d, channels as f, withRoutes as g, render as h, eventSchema as i, UnreadableError as l, mirror as m, SyncOverrides as n, ReceivedEvent as o, into as p, envelope as r, ResolvedTarget as s, EventBase as t, channelMissing as u };
305
+ export { withRoutes as _, immutable as a, SyncProvider as c, opensBlock as d, routesFor as f, render as g, mirror as h, eventSchema as i, UnreadableError as l, into as m, SyncOverrides as n, ReceivedEvent as o, channels as p, envelope as r, ResolvedTarget as s, EventBase as t, channelMissing as u };
@@ -1,12 +1,13 @@
1
- import { _ as IMPORT_BYTES_MAX, a as forbidden, b as mediaType, c as toErrorResponse, d as createBoardClient, f as duration, h as ATTACHMENT_BYTES_MAX, l as unauthorized, n as RejectedError, o as json, p as formatProfileHeader, r as badRequest, s as notFound, t as HttpError, u as BoardError, v as fileName } from "./errors-DUzpDSrJ.mjs";
2
- import { h as RemoteWatcherId } from "./schemas-DAzSsgWk.mjs";
1
+ import { S as mediaType, _ as ATTACHMENT_BYTES_MAX, a as forbidden, b as fileName, d as BoardError, f as createBoardClient, h as formatProfileHeader, l as toErrorResponse, m as eventsState, n as RejectedError, o as json, p as duration, r as badRequest, s as notFound, t as HttpError, u as unauthorized, y as IMPORT_BYTES_MAX } from "./errors-ZazTZh-s.mjs";
2
+ import { g as RemoteWatcherId } from "./schemas-BhZaystC.mjs";
3
+ import { A as SyncReceiptBody, C as SchemaBody, D as SyncCopiesQuery, E as SyncBody, F as routes, M as TypingBody, N as UpdateGrantBody, O as SyncFindQuery, P as UploadStartBody, S as SchedulesQuery, T as SourceReadQuery, _ as PostBody, a as EventsQuery, b as RegisterBody, c as GrantBody, d as InboxPushBody, f as InboxQuery, g as MessagesQuery, h as MatchesQuery, i as EditBody, j as ThreadsQuery, k as SyncImportBody, l as InboxAckBody, m as LinkedQuery, n as CreateChannelBody, o as ExplainQuery, p as LabelBody, r as DeleteBody, t as AckBody, u as InboxNextQuery, v as ReactBody, w as SourceJoinBody, x as ScheduleBody, y as Ref } from "./routes-CkUetTO2.mjs";
4
+ import { _ as sha256, a as waitUntil, c as platformProfile, d as userIdOf, m as derivedId, o as actorParts, r as runMiddleware, s as importedHandle, t as DroppedError, u as underPrincipal } from "./middleware-BHHKHA9q.mjs";
3
5
  import { n as blocksIn, r as findBlocks } from "./blocks-CVoBC7ur.mjs";
4
- import { A as MessagesQuery, B as SyncBody, C as InboxAckBody, D as LabelBody, E as InboxQuery, F as ScheduleBody, G as ThreadsQuery, H as SyncFindQuery, I as SchedulesQuery, J as UploadStartBody, K as TypingBody, L as SchemaBody, M as ReactBody, N as Ref, O as LinkedQuery, P as RegisterBody, R as SourceJoinBody, S as GrantBody, T as InboxPushBody, U as SyncImportBody, V as SyncCopiesQuery, W as SyncReceiptBody, Y as routes, _ 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 runMatch, j as PostBody, k as MatchesQuery, l as createRouter, m as SYNC, n as syncTarget, p as readJson, q as UpdateGrantBody, r as canonicalWatchers, t as SYNC_ACTOR, u as openapi, v as DeleteBody, w as InboxNextQuery, x as ExplainQuery, y as EditBody, z as SourceReadQuery } from "./origin-9Ch-Zonv.mjs";
5
- import { _ as sha256, a as waitUntil, c as platformProfile, d as userIdOf, m as derivedId, o as actorParts, r as runMiddleware, s as importedHandle, t as DroppedError, u as underPrincipal } from "./middleware-0DUFrav-.mjs";
6
- import { a as canText, c as compileAccess, d as parsePattern, n as InvalidCan, r as PERMISSIONS, t as FULL_ACCESS, u as parseCan } from "./access-BgBiaCyx.mjs";
7
- import { C as explainGrants, b as verifiesTokens, d as grantIssuers, f as hostPrincipal, i as VERCEL_ISSUER, l as createAuthority, t as DEFAULT_CAN$1, u as fromTokens, y as verifiedIssuers } from "./auth-Ft4AJptx.mjs";
8
- import { a as resolveActor, o as viaOf, r as claimsOf, t as KNOWN_AGENTS } from "./actors-DkZsnMgA.mjs";
9
- import { t as checkValue } from "./data-values-C-Cq80hz.mjs";
6
+ import { a as compileWatcher, c as METHODS, d as queryObject, f as readCapped, h as VERSION, i as runMatch, l as createRouter, m as SYNC, n as syncTarget, p as readJson, r as canonicalWatchers, t as SYNC_ACTOR, u as openapi } from "./origin-BHmEdok7.mjs";
7
+ import { a as canText, c as compileAccess, d as parsePattern, n as InvalidCan, r as PERMISSIONS, t as FULL_ACCESS, u as parseCan } from "./access-3udXjJAg.mjs";
8
+ import { C as explainGrants, b as verifiesTokens, d as grantIssuers, f as hostPrincipal, i as VERCEL_ISSUER, l as createAuthority, t as DEFAULT_CAN$1, u as fromTokens, y as verifiedIssuers } from "./auth-aiOVE82-.mjs";
9
+ import { a as resolveActor, o as viaOf, r as claimsOf, t as KNOWN_AGENTS } from "./actors-DasGZnfb.mjs";
10
+ import { t as checkValue } from "./data-values-CoTP0SQG.mjs";
10
11
  //#region src/server/registrant.ts
11
12
  /** Registering again this soon after the same registration only repeats it. */
12
13
  const REGISTER_EVERY_MS = 1e4;
@@ -1200,22 +1201,100 @@ function createVercel(options, environment) {
1200
1201
  };
1201
1202
  /** The actor in a read of the list, or undefined when it doesn't have them or failed. */
1202
1203
  const inList = (read, id) => read.views.then((views) => views.get(id), () => void 0);
1204
+ /** Whether the API answers actors by their IDs. An older one answers 400 for a query it doesn't know, `id`, and names come from the whole list. */
1205
+ let namesById = true;
1206
+ /** Actor IDs one request names, as many as the API takes. */
1207
+ const NAMED_AT_ONCE = 100;
1208
+ /** Each actor asked for by ID, and when: one the API didn't have is asked for again after `NAMES_FRESH_MS`, as one it had is. */
1209
+ const asked = /* @__PURE__ */ new Map();
1210
+ /** The request for actors by ID that hasn't gone out yet: everyone named before this turn's promises settle shares it. */
1211
+ let asking = null;
1203
1212
  /**
1204
- * An actor as board shows them: a person by their Vercel username and name, and an agent acting
1205
- * for a person by its profile under them, as the API names them; anyone else (a project, an app,
1206
- * an agent of one), or someone the API doesn't list, by their principal. The list is read again
1207
- * every few minutes, and at once for someone who wrote since it was.
1213
+ * Once everything already running in this turn has had its say, and before any timer or request answers: the
1214
+ * views of a page each name their author as they start, a few promise steps apart, and what waits on them
1215
+ * (a watcher's run, a wake-up's answer) is no later than it was.
1208
1216
  */
1209
- async function nameOf(who, actor) {
1217
+ const settled = async () => {
1218
+ for (let step = 0; step < 16; step++) await null;
1219
+ };
1220
+ /** The actors `ids` name, in one request, or null from an API that doesn't answer them by ID. */
1221
+ const readNamed = async (who, ids) => {
1222
+ try {
1223
+ const { actors } = await api(who, "GET", await onBoard(who, "/actors"), { query: { id: ids } });
1224
+ return new Map(actors.map((view) => [view.id, view]));
1225
+ } catch (error) {
1226
+ if (!(error instanceof HttpError && error.status >= 400 && error.status < 500 && error.status !== 429)) throw error;
1227
+ if (error.status === 400 && /additional property/i.test(error.message)) namesById = false;
1228
+ return null;
1229
+ }
1230
+ };
1231
+ /** Asks for `actors` by ID together, before each is named: a page's authors, or a page of changes', in one request. */
1232
+ const naming = (who, actors) => {
1233
+ if (namesById) for (const actor of actors) byId(who, actor.id);
1234
+ };
1235
+ /**
1236
+ * An actor as the API names them, asked for by ID with everyone else named in the same turn: the
1237
+ * authors on a page cost one request however many actors the board has. Undefined for one the API
1238
+ * doesn't have or a read that failed, which isn't kept; null when the API doesn't answer by ID.
1239
+ */
1240
+ function byId(who, id) {
1241
+ const kept = asked.get(id);
1242
+ if (kept && Date.now() - kept.at <= NAMES_FRESH_MS) return kept.view;
1243
+ let batch = asking;
1244
+ if (!batch || batch.ids.length >= NAMED_AT_ONCE) {
1245
+ const ids = [];
1246
+ const next = {
1247
+ ids,
1248
+ views: settled().then(() => {
1249
+ if (asking === next) asking = null;
1250
+ return readNamed(who, ids);
1251
+ })
1252
+ };
1253
+ batch = asking = next;
1254
+ }
1255
+ batch.ids.push(id);
1256
+ const view = batch.views.then((views) => views === null ? null : views.get(id), () => {
1257
+ if (asked.get(id)?.view === view) asked.delete(id);
1258
+ });
1259
+ if (asked.size >= 1e4) asked.clear();
1260
+ asked.set(id, {
1261
+ at: Date.now(),
1262
+ view
1263
+ });
1264
+ return view;
1265
+ }
1266
+ /**
1267
+ * The name of the project `actor` is of, one of its deployments or their agents: as its own actor names it,
1268
+ * asked for by ID, or else as the actors list does. Undefined for an actor of no project, or one nothing names.
1269
+ */
1270
+ async function projectOf(who, actor, own) {
1271
+ if (actor.principal.type !== "project") return void 0;
1272
+ const { projectId } = actor.principal;
1273
+ const view = own === void 0 ? namesById ? await byId(who, actor.id) : null : own;
1274
+ return (view ? projectNamesOf([[actor.id, view]]).get(projectId) : void 0) ?? await namedProject(who, projectId);
1275
+ }
1276
+ /** An actor as the actors list names them: read again every few minutes, and at once for someone who wrote since it was. */
1277
+ async function listed(who, id) {
1210
1278
  const current = !actorNames || Date.now() - actorNames.at > NAMES_FRESH_MS ? readNames(who) : actorNames;
1211
- let found = await inList(current, actor.id);
1212
- if (!found && !unlisted.has(actor.id)) {
1279
+ let found = await inList(current, id);
1280
+ if (!found && !unlisted.has(id)) {
1213
1281
  const again = actorNames && actorNames !== current ? actorNames : readNames(who);
1214
- found = await inList(again, actor.id);
1215
- if (!found && await again.views.then(() => true, () => false)) unlisted.add(actor.id);
1282
+ found = await inList(again, id);
1283
+ if (!found && await again.views.then(() => true, () => false)) unlisted.add(id);
1216
1284
  }
1285
+ return found;
1286
+ }
1287
+ /**
1288
+ * An actor as board shows them: a person by their Vercel username and name, and an agent acting
1289
+ * for a person by its profile under them, as the API names them; anyone else (a project, an app,
1290
+ * an agent of one), or someone the API doesn't have, by their principal. The API is asked for
1291
+ * them by ID, or on an older API for its whole list.
1292
+ */
1293
+ async function nameOf(who, actor) {
1294
+ const own = namesById ? await byId(who, actor.id) : null;
1295
+ const found = own === null ? await listed(who, actor.id) : own;
1217
1296
  const kind = found && apiKind(found.kind);
1218
- const project = actor.principal.type === "project" ? await namedProject(who, actor.principal.projectId) : void 0;
1297
+ const project = await projectOf(who, actor, own);
1219
1298
  if (!found || !(kind === "person" || kind === "external" || kind === "agent" && actor.principal.type === "user")) return actorView(actor, found, project);
1220
1299
  const via = actor.profile && actor.principal.type !== "external" ? { via: viaFor(actor.principal, found, project) } : {};
1221
1300
  const platform = found.platform ?? actor.profile?.platform?.platform;
@@ -1278,10 +1357,12 @@ function createVercel(options, environment) {
1278
1357
  if (from === void 0) return null;
1279
1358
  const project = importerOf(by);
1280
1359
  if (project === null || project === await ownProject(who)) return from;
1281
- return `${await projectName(who, project)}/${from}`;
1360
+ return `${await projectOf(who, by) ?? project}/${from}`;
1282
1361
  }
1283
1362
  async function view(who, message, channel) {
1284
1363
  const root = message.sequence === 1;
1364
+ const author = nameOf(who, message.createdBy);
1365
+ author.catch(() => {});
1285
1366
  return {
1286
1367
  id: message.id,
1287
1368
  channel,
@@ -1308,7 +1389,7 @@ function createVercel(options, environment) {
1308
1389
  })),
1309
1390
  version: message.version,
1310
1391
  revision: message.revision,
1311
- author: await nameOf(who, message.createdBy),
1392
+ author: await author,
1312
1393
  ...message.schedule ? { schedule: {
1313
1394
  id: message.schedule.id,
1314
1395
  n: message.schedule.n
@@ -1478,6 +1559,31 @@ function createVercel(options, environment) {
1478
1559
  label
1479
1560
  }, signal);
1480
1561
  }
1562
+ /** Whether the API lists threads with their first and newest messages (`include=messages`): until it refuses the parameter, it's asked. */
1563
+ let threadsWithMessages = true;
1564
+ /**
1565
+ * A page of a channel's threads, each with its first and newest message where the API sends them, so
1566
+ * showing them costs no read of its own. An API from before `include=messages` takes no parameter
1567
+ * it doesn't know and answers 400: the page is read again without it, and it's never asked again.
1568
+ */
1569
+ async function threadPage(who, path, query, signal) {
1570
+ if (threadsWithMessages) try {
1571
+ return await api(who, "GET", path, {
1572
+ query: {
1573
+ ...query,
1574
+ include: "messages"
1575
+ },
1576
+ signal
1577
+ });
1578
+ } catch (error) {
1579
+ if (!(error instanceof HttpError && error.status === 400 && /additional property/i.test(error.message))) throw error;
1580
+ threadsWithMessages = false;
1581
+ }
1582
+ return api(who, "GET", path, {
1583
+ query,
1584
+ signal
1585
+ });
1586
+ }
1481
1587
  /**
1482
1588
  * A channel's threads, as far as a read needs: the API lists them most recently active first, so
1483
1589
  * it stops at the first not active since `after`, or at the `limit` newest when it's given one
@@ -1489,14 +1595,11 @@ function createVercel(options, environment) {
1489
1595
  const out = [];
1490
1596
  let cursor;
1491
1597
  do {
1492
- const found = await api(who, "GET", path, {
1493
- query: {
1494
- channelId: channel.id,
1495
- label,
1496
- cursor
1497
- },
1498
- signal
1499
- });
1598
+ const found = await threadPage(who, path, {
1599
+ channelId: channel.id,
1600
+ label,
1601
+ cursor
1602
+ }, signal);
1500
1603
  out.push(...found.threads);
1501
1604
  cursor = found.cursor ?? void 0;
1502
1605
  const last = out.at(-1);
@@ -1504,14 +1607,26 @@ function createVercel(options, environment) {
1504
1607
  } while (cursor);
1505
1608
  return out;
1506
1609
  }
1507
- /** A thread at a glance: its root, its reply count, and its latest reply, read by reference. */
1508
- async function summary(who, thread, channel, signal) {
1509
- const [root, last] = await Promise.all([messageById(who, idAt(thread.id, 1), signal), thread.lastMessage && thread.lastMessage.sequence > 1 ? messageById(who, thread.lastMessage.id, signal) : null]);
1510
- return {
1511
- message: await view(who, root.message, channel.name),
1512
- replies: thread.messageCount - 1,
1513
- last: last && await view(who, last.message, channel.name)
1514
- };
1610
+ /**
1611
+ * A page of threads as their summaries: each thread's first and newest messages as its thread list brought them,
1612
+ * or read by reference from an API that lists threads without them, then every author on the page is asked for
1613
+ * together, before any is named.
1614
+ */
1615
+ async function summaries(who, page, signal) {
1616
+ const read = await Promise.all(page.map(({ thread }) => {
1617
+ const replied = thread.lastMessage !== void 0 && thread.lastMessage.sequence > 1;
1618
+ return Promise.all([thread.rootMessage ?? messageById(who, idAt(thread.id, 1), signal).then((found) => found.message), !replied ? null : thread.latestMessage ?? messageById(who, thread.lastMessage.id, signal).then((found) => found.message)]);
1619
+ }));
1620
+ naming(who, read.flatMap(([root, last]) => [root.createdBy, ...last ? [last.createdBy] : []]));
1621
+ return Promise.all(page.map(async ({ thread, channel }, i) => {
1622
+ const [root, last] = read[i];
1623
+ const [message, newest] = await Promise.all([view(who, root, channel.name), last && view(who, last, channel.name)]);
1624
+ return {
1625
+ message,
1626
+ replies: thread.messageCount - 1,
1627
+ last: newest
1628
+ };
1629
+ }));
1515
1630
  }
1516
1631
  let me = null;
1517
1632
  /** Who these credentials are, asked once. */
@@ -1767,6 +1882,7 @@ function createVercel(options, environment) {
1767
1882
  page
1768
1883
  }))).sort((a, b) => a.change.createdAt - b.change.createdAt);
1769
1884
  const events = [];
1885
+ naming(who, merged.flatMap(({ change }) => [change.actor, ...change.currentMessage ? [change.currentMessage.createdBy] : []]));
1770
1886
  for (const { change, i, page } of merged) {
1771
1887
  running[page.channel.id] = {
1772
1888
  at: page.at,
@@ -1897,6 +2013,7 @@ function createVercel(options, environment) {
1897
2013
  });
1898
2014
  cursor = page.cursor;
1899
2015
  const events = [];
2016
+ naming(who, page.events.flatMap((change) => [change.actor, ...change.currentMessage ? [change.currentMessage.createdBy] : []]));
1900
2017
  for (const change of page.events) {
1901
2018
  const message = change.currentMessage;
1902
2019
  const found = message && change.threadId ? {
@@ -2357,10 +2474,20 @@ function createVercel(options, environment) {
2357
2474
  ...Object.fromEntries(METHODS.map((method) => [method, async () => {
2358
2475
  throw notSupported(method === "register" || method === "watchers" || method === "matches" || method === "ack" ? "watchers" : method);
2359
2476
  }])),
2360
- async discovery() {
2477
+ async discovery(caller) {
2361
2478
  const who = { profile: null };
2362
2479
  const team = await teamId();
2363
- if (options.board) await api(who, "GET", await onBoard(who));
2480
+ const path = await onBoard(who);
2481
+ const reached = options.board ? await api(who, "GET", path) : null;
2482
+ const can = "self" in caller ? caller.can : void 0;
2483
+ const reads = can === void 0 || compileAccess(parseCan(can)).anywhere("read");
2484
+ const found = reached !== null && can === void 0 ? reached : reads ? await api(can === void 0 ? who : {
2485
+ ...who,
2486
+ can
2487
+ }, "GET", path).catch((error) => {
2488
+ if (error instanceof HttpError && error.status === 403) return null;
2489
+ throw error;
2490
+ }) : null;
2364
2491
  const id = team?.startsWith("team_") ? team : (await self(who)).teamId;
2365
2492
  return {
2366
2493
  version: VERSION,
@@ -2368,6 +2495,7 @@ function createVercel(options, environment) {
2368
2495
  audience: origin,
2369
2496
  team_id: id,
2370
2497
  project_id: null,
2498
+ ...found?.board.name ? { name: found.board.name } : {},
2371
2499
  sync: (binding?.sync ?? []).map(({ key, platform }) => ({
2372
2500
  key,
2373
2501
  platform
@@ -2502,7 +2630,7 @@ function createVercel(options, environment) {
2502
2630
  at: Math.max(latest.get(thread.id)?.at ?? 0, message.createdAt)
2503
2631
  });
2504
2632
  return {
2505
- threads: await Promise.all(pick([...latest.values()]).map(({ thread, channel }) => summary(who, thread, channel, signal))),
2633
+ threads: await summaries(who, pick([...latest.values()]), signal),
2506
2634
  cursor: cursorOf({
2507
2635
  t: newest,
2508
2636
  feeds
@@ -2523,7 +2651,7 @@ function createVercel(options, environment) {
2523
2651
  const rooted = found.filter(({ thread }) => (query.label ?? []).every(([key, values]) => thread.labels !== void 0 && Object.hasOwn(thread.labels, key) && (values === null || values.includes(thread.labels[key]))));
2524
2652
  const newest = found.reduce((max, { at }) => Math.max(max, at), 0);
2525
2653
  if (!query.label?.length) return {
2526
- threads: await Promise.all(pick(rooted).map(({ thread, channel }) => summary(who, thread, channel, signal))),
2654
+ threads: await summaries(who, pick(rooted), signal),
2527
2655
  cursor: cursorOf({
2528
2656
  t: newest,
2529
2657
  feeds
@@ -2535,7 +2663,7 @@ function createVercel(options, environment) {
2535
2663
  for (let next = 0; next < candidates.length && threads.length < limit;) {
2536
2664
  const page = candidates.slice(next, next + limit - threads.length);
2537
2665
  next += page.length;
2538
- for (const shown of await Promise.all(page.map(({ thread, channel }) => summary(who, thread, channel, signal)))) if (!shown.message.deleted) threads.push(shown);
2666
+ for (const shown of await summaries(who, page, signal)) if (!shown.message.deleted) threads.push(shown);
2539
2667
  }
2540
2668
  if (after === void 0) threads.reverse();
2541
2669
  return {
@@ -2551,9 +2679,10 @@ function createVercel(options, environment) {
2551
2679
  const { thread, channel } = await messageIn(who, id, signal);
2552
2680
  const [root, ...replies] = await threadMessages(who, thread.id, signal);
2553
2681
  if (!root) throw notFound(`message not found: ${id}`, "message_not_found");
2682
+ const [message, ...shown] = await Promise.all([root, ...replies].map((each) => view(who, each, channel.name)));
2554
2683
  return {
2555
- message: await view(who, root, channel.name),
2556
- replies: await Promise.all(replies.map((reply) => view(who, reply, channel.name))),
2684
+ message,
2685
+ replies: shown,
2557
2686
  cursor: cursorOf({
2558
2687
  t: Math.max(root.createdAt, ...replies.map((reply) => reply.createdAt)),
2559
2688
  feeds: {}
@@ -4621,26 +4750,36 @@ function createBoard(options, runtime) {
4621
4750
  }
4622
4751
  /**
4623
4752
  * Live events for a handle, from the backend's long-poll: each page from the last cursor it saw,
4624
- * waiting for the next. It backs off after a failure, up to 30 seconds; a 4xx throws.
4753
+ * waiting for the next. It backs off after a failure, up to 30 seconds; a 4xx throws. `onState`
4754
+ * hears `live` when a poll is answered and `retrying` when one failed. The first poll, and the
4755
+ * first after a failure, ask without waiting, so it's `live` as soon as the board answers, not a
4756
+ * quiet board's whole wait later.
4625
4757
  */
4626
4758
  async function* events(client, query = {}, opts = {}) {
4627
4759
  let after = query.after;
4628
4760
  let failures = 0;
4761
+ /** Whether the board has answered since the feed started, or since it last failed. */
4762
+ let answered = false;
4763
+ const state = eventsState(opts.onState);
4629
4764
  while (!opts.signal?.aborted) {
4630
4765
  let page;
4631
4766
  try {
4632
4767
  page = await client.poll({
4633
4768
  ...query,
4634
4769
  ...after !== void 0 ? { after } : {},
4635
- wait: EVENTS_WAIT_S
4770
+ wait: answered ? EVENTS_WAIT_S : 0
4636
4771
  }, opts.signal);
4637
4772
  } catch (error) {
4638
4773
  if (opts.signal?.aborted) return;
4639
4774
  if (error instanceof BoardError && error.status >= 400 && error.status < 500) throw error;
4775
+ answered = false;
4776
+ state.failed();
4640
4777
  await new Promise((resolve) => setTimeout(resolve, Math.min(3e4, 500 * 2 ** failures++)));
4641
4778
  continue;
4642
4779
  }
4643
4780
  failures = 0;
4781
+ answered = true;
4782
+ state.answered();
4644
4783
  for (const event of page.events) {
4645
4784
  yield event;
4646
4785
  if (opts.signal?.aborted) return;
@@ -0,0 +1,4 @@
1
+ import "./routes-zm4TXKCC.mjs";
2
+ import "./auth-BG_whr9_.mjs";
3
+ import "./backend-D6yTo8Un.mjs";
4
+ import "./provider-BC9mPYVh.mjs";
@@ -1,4 +1,4 @@
1
- import { f as MESSAGE_TEXT_MAX, p as MessageId } from "./schemas-DAzSsgWk.mjs";
1
+ import { m as MessageId, p as MESSAGE_TEXT_MAX } from "./schemas-BhZaystC.mjs";
2
2
  import { z } from "zod";
3
3
  //#region src/contract/external.ts
4
4
  /**
@@ -1,5 +1,5 @@
1
- import { f as Board, p as BoardOptions } from "./backend-DMrK55mU.mjs";
2
- import "./exports-Bw_OYNRl.mjs";
1
+ import { f as Board, p as BoardOptions } from "./backend-D6yTo8Un.mjs";
2
+ import "./exports-Gspe1eEq.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,9 +1,9 @@
1
- import { $ as ScheduleBodyOutput, A as LinkView, At as TypingBody, B as PostBody, C as InboxEntry, Ct as SyncThreadView, D as InboxQuery, Dt as ThreadsPage, E as InboxPushBody, Et as ThreadView, F as MessageView, Ft as UploadTicket, G as ReactBody, H as PrincipalInput, I as MessagesPage, It as routes, J as RegisterInput, K as Ref, L as MessagesQuery, M as MatchView, Mt as UpdateGrantBody, N as MatchesQuery, Nt as UpdateGrantInput, O as LABEL_CONDITIONS_MAX, Ot as ThreadsQuery, P as Me, Pt as UploadStartBody, Q as ScheduleBody, R as MessagesQueryInput, S as InboxAckBody, St as SyncReceiptInput, T as InboxNextQuery, Tt as ThreadSummaryView, U as PrincipalView, V as PostInput, W as REGISTERED_WATCHERS_MAX, X as ResolvedSyncTarget, Y as RegistrationView, Z as RouteName, _ as FiltersInput, _t as SyncFindQuery, a as BoardEventView, at as SchemaBody, b as GrantInput, bt as SyncImportInput, c as CreateChannelBody, ct as SourceJoin, d as EditBody, dt as SourceRead, et as ScheduleInput, f as EventsPage, ft as SourceReadQuery, g as Explanation, gt as SyncFindInput, h as ExplainQuery, ht as SyncCopiesView, i as BlockView, it as SchedulesQueryOutput, j as LinkedQuery, jt as TypingResult, k as LabelBody, kt as ThreadsQueryInput, l as DeleteBody, lt as SourceJoinBody, m as EventsQueryInput, mt as SyncCopiesQuery, n as ActorView, nn as Attachment, nt as SchedulesQuery, o as CanAt, ot as SchemaInput, p as EventsQuery, pt as SyncBody, q as RegisterBody, r as ApiError, rt as SchedulesQueryInput, s as ChannelView, st as SchemaView, t as AckBody, tt as ScheduleView, u as Discovery, ut as SourceMessage, v as GrantBody, vt as SyncFindView, w as InboxItem, wt as SyncedView, x as GrantView, xt as SyncReceiptBody, y as GrantCan, yt as SyncImportBody, z as ParsedFilters } from "./routes-By9lmvUD.mjs";
2
- import { i as Claims, r as CallerRequest } from "./auth-Bn8J_1F2.mjs";
3
- import { C as Method, D as SandboxPolicy, E as SandboxMatcher, O as SandboxPolicyOptions, S as HttpError, T as SandboxMatch, _ as Middleware, a as Identity, b as WritePatch, c as SelfCaller, d as AsOptions, f as Board, g as DroppedError, h as WatcherContext, i as Caller, k as SandboxRule, l as Subscription, m as Watcher, n as BackendRoute, o as InboxDelivery, p as BoardOptions, r as BoardBinding, s as ProtocolMethods, t as Backend, u as VerifiedCaller, v as MiddlewareContext, w as Protocol, x as WriteSource, y as Write } from "./backend-DMrK55mU.mjs";
4
- import { B as ScheduleOptions, H as UploadInput, I as Filters, L as PostOptions, P as BoardError, R as ProfileOption, U as WaitOptions, V as ScheduleTiming, W as duration, z as ReplyOptions } from "./provider-dY54GFNz.mjs";
1
+ import { $ as ScheduleBody, A as LabelBody, At as ThreadsQueryInput, B as ParsedFilters, C as InboxAckBody, Ct as SyncReceiptInput, D as InboxPushBody, Dt as ThreadView, E as InboxNextQuery, Et as ThreadSummaryView, F as Me, Ft as UploadStartBody, G as REGISTERED_WATCHERS_MAX, H as PostInput, I as MessageView, It as UploadTicket, J as RegisterBody, K as ReactBody, L as MessagesPage, Lt as routes, M as LinkedQuery, Mt as TypingResult, N as MatchView, Nt as UpdateGrantBody, O as InboxQuery, Ot as ThreadsPage, P as MatchesQuery, Pt as UpdateGrantInput, Q as RouteName, R as MessagesQuery, S as INBOX_EVENT_ID_MAX, St as SyncReceiptBody, T as InboxItem, Tt as SyncedView, U as PrincipalInput, V as PostBody, W as PrincipalView, X as RegistrationView, Y as RegisterInput, Z as ResolvedSyncTarget, _ as FiltersInput, _t as SyncFindInput, a as BoardEventView, at as SchedulesQueryOutput, b as GrantInput, bt as SyncImportBody, c as CreateChannelBody, ct as SchemaView, d as EditBody, dt as SourceMessage, et as ScheduleBodyOutput, f as EventsPage, ft as SourceRead, g as Explanation, gt as SyncCopiesView, h as ExplainQuery, ht as SyncCopiesQuery, i as BlockView, in as Attachment, it as SchedulesQueryInput, j as LinkView, jt as TypingBody, k as LABEL_CONDITIONS_MAX, kt as ThreadsQuery, l as DeleteBody, lt as SourceJoin, m as EventsQueryInput, mt as SyncBody, n as ActorView, nt as ScheduleView, o as CanAt, ot as SchemaBody, p as EventsQuery, pt as SourceReadQuery, q as Ref, r as ApiError, rt as SchedulesQuery, s as ChannelView, st as SchemaInput, t as AckBody, tt as ScheduleInput, u as Discovery, ut as SourceJoinBody, v as GrantBody, vt as SyncFindQuery, w as InboxEntry, wt as SyncThreadView, x as GrantView, xt as SyncImportInput, y as GrantCan, yt as SyncFindView, z as MessagesQueryInput } from "./routes-zm4TXKCC.mjs";
2
+ import { i as Claims, r as CallerRequest } from "./auth-BG_whr9_.mjs";
3
+ import { C as Method, D as SandboxPolicy, E as SandboxMatcher, O as SandboxPolicyOptions, S as HttpError, T as SandboxMatch, _ as Middleware, a as Identity, b as WritePatch, c as SelfCaller, d as AsOptions, f as Board, g as DroppedError, h as WatcherContext, i as Caller, k as SandboxRule, l as Subscription, m as Watcher, n as BackendRoute, o as InboxDelivery, p as BoardOptions, r as BoardBinding, s as ProtocolMethods, t as Backend, u as VerifiedCaller, v as MiddlewareContext, w as Protocol, x as WriteSource, y as Write } from "./backend-D6yTo8Un.mjs";
4
+ import { B as Filters, F as BoardError, G as ScheduleTiming, H as ProfileOption, J as duration, K as UploadInput, L as EventsOptions, R as EventsState, U as ReplyOptions, V as PostOptions, W as ScheduleOptions, q as WaitOptions, z as ExplainPrincipal } from "./provider-BC9mPYVh.mjs";
5
5
  import { n as block } from "./blocks-DGvh2alZ.mjs";
6
- import "./exports-Bw_OYNRl.mjs";
6
+ import "./exports-Gspe1eEq.mjs";
7
7
  //#region src/server/index.default.d.ts
8
8
  /**
9
9
  * The handle on a board. Without a `backend`, it's Vercel's board for the team, the one `name`
@@ -13,4 +13,4 @@ import "./exports-Bw_OYNRl.mjs";
13
13
  */
14
14
  export declare function board(options?: BoardOptions): Board;
15
15
  //#endregion
16
- export { type AckBody, type ActorView, type ApiError, type AsOptions, type Attachment, type Backend, type BackendRoute, type BlockView, 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 SandboxMatch, type SandboxMatcher, type SandboxPolicy, type SandboxPolicyOptions, type SandboxRule, type ScheduleBody, type ScheduleBodyOutput, type ScheduleInput, type ScheduleOptions, type ScheduleTiming, type ScheduleView, type SchedulesQuery, type SchedulesQueryInput, type SchedulesQueryOutput, type SchemaBody, type SchemaInput, type SchemaView, 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 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, block, duration, type routes };
16
+ export { type AckBody, type ActorView, type ApiError, type AsOptions, type Attachment, type Backend, type BackendRoute, type BlockView, 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 EventsOptions, type EventsPage, type EventsQuery, type EventsQueryInput, type EventsState, type ExplainPrincipal, type ExplainQuery, type Explanation, type Filters, type FiltersInput, type GrantBody, type GrantCan, type GrantInput, type GrantView, HttpError, type INBOX_EVENT_ID_MAX, 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 SandboxMatch, type SandboxMatcher, type SandboxPolicy, type SandboxPolicyOptions, type SandboxRule, type ScheduleBody, type ScheduleBodyOutput, type ScheduleInput, type ScheduleOptions, type ScheduleTiming, type ScheduleView, type SchedulesQuery, type SchedulesQueryInput, type SchedulesQueryOutput, type SchemaBody, type SchemaInput, type SchemaView, 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 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, block, duration, type routes };
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { f as duration, t as HttpError, u as BoardError } from "./errors-DUzpDSrJ.mjs";
1
+ import { d as BoardError, p as duration, t as HttpError } from "./errors-ZazTZh-s.mjs";
2
+ import { t as DroppedError } from "./middleware-BHHKHA9q.mjs";
2
3
  import { t as block } from "./blocks-CVoBC7ur.mjs";
3
- import { t as DroppedError } from "./middleware-0DUFrav-.mjs";
4
- import { i as createVercel, t as createBoard } from "./exports-BVgUNVsP.mjs";
4
+ import { i as createVercel, t as createBoard } from "./exports-DCf75prP.mjs";
5
5
  //#region src/backend-vercel/index.default.ts
6
6
  /**
7
7
  * Your team's board, in Vercel's API. Outside Node there's no environment to find credentials or
@@ -24,7 +24,7 @@ function board(options = {}) {
24
24
  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");
25
25
  return vercel({ fetch });
26
26
  },
27
- sync: () => import("./engine-BVHSH2Kn.mjs"),
27
+ sync: () => import("./engine-XVBt02Bl.mjs"),
28
28
  serving: null,
29
29
  sandbox: null
30
30
  });
@@ -1,7 +1,7 @@
1
- import { $ as ScheduleBodyOutput, A as LinkView, At as TypingBody, B as PostBody, C as InboxEntry, Ct as SyncThreadView, D as InboxQuery, Dt as ThreadsPage, E as InboxPushBody, Et as ThreadView, F as MessageView, Ft as UploadTicket, G as ReactBody, H as PrincipalInput, I as MessagesPage, It as routes, J as RegisterInput, K as Ref, L as MessagesQuery, M as MatchView, Mt as UpdateGrantBody, N as MatchesQuery, Nt as UpdateGrantInput, O as LABEL_CONDITIONS_MAX, Ot as ThreadsQuery, P as Me, Pt as UploadStartBody, Q as ScheduleBody, R as MessagesQueryInput, S as InboxAckBody, St as SyncReceiptInput, T as InboxNextQuery, Tt as ThreadSummaryView, U as PrincipalView, V as PostInput, W as REGISTERED_WATCHERS_MAX, X as ResolvedSyncTarget, Y as RegistrationView, Z as RouteName, _ as FiltersInput, _t as SyncFindQuery, a as BoardEventView, at as SchemaBody, b as GrantInput, bt as SyncImportInput, c as CreateChannelBody, ct as SourceJoin, d as EditBody, dt as SourceRead, et as ScheduleInput, f as EventsPage, ft as SourceReadQuery, g as Explanation, gt as SyncFindInput, h as ExplainQuery, ht as SyncCopiesView, i as BlockView, it as SchedulesQueryOutput, j as LinkedQuery, jt as TypingResult, k as LabelBody, kt as ThreadsQueryInput, l as DeleteBody, lt as SourceJoinBody, m as EventsQueryInput, mt as SyncCopiesQuery, n as ActorView, nn as Attachment, nt as SchedulesQuery, o as CanAt, ot as SchemaInput, p as EventsQuery, pt as SyncBody, q as RegisterBody, r as ApiError, rt as SchedulesQueryInput, s as ChannelView, st as SchemaView, t as AckBody, tt as ScheduleView, u as Discovery, ut as SourceMessage, v as GrantBody, vt as SyncFindView, w as InboxItem, wt as SyncedView, x as GrantView, xt as SyncReceiptBody, y as GrantCan, yt as SyncImportBody, z as ParsedFilters } from "./routes-By9lmvUD.mjs";
2
- import { i as Claims, r as CallerRequest } from "./auth-Bn8J_1F2.mjs";
3
- import { C as Method, D as SandboxPolicy, E as SandboxMatcher, O as SandboxPolicyOptions, S as HttpError, T as SandboxMatch, _ as Middleware, a as Identity, b as WritePatch, c as SelfCaller, d as AsOptions, f as Board, g as DroppedError, h as WatcherContext, i as Caller, k as SandboxRule, l as Subscription, m as Watcher, n as BackendRoute, o as InboxDelivery, p as BoardOptions, r as BoardBinding, s as ProtocolMethods, t as Backend, u as VerifiedCaller, v as MiddlewareContext, w as Protocol, x as WriteSource, y as Write } from "./backend-DMrK55mU.mjs";
4
- import { B as ScheduleOptions, H as UploadInput, I as Filters, L as PostOptions, P as BoardError, R as ProfileOption, U as WaitOptions, V as ScheduleTiming, W as duration, z as ReplyOptions } from "./provider-dY54GFNz.mjs";
1
+ import { $ as ScheduleBody, A as LabelBody, At as ThreadsQueryInput, B as ParsedFilters, C as InboxAckBody, Ct as SyncReceiptInput, D as InboxPushBody, Dt as ThreadView, E as InboxNextQuery, Et as ThreadSummaryView, F as Me, Ft as UploadStartBody, G as REGISTERED_WATCHERS_MAX, H as PostInput, I as MessageView, It as UploadTicket, J as RegisterBody, K as ReactBody, L as MessagesPage, Lt as routes, M as LinkedQuery, Mt as TypingResult, N as MatchView, Nt as UpdateGrantBody, O as InboxQuery, Ot as ThreadsPage, P as MatchesQuery, Pt as UpdateGrantInput, Q as RouteName, R as MessagesQuery, S as INBOX_EVENT_ID_MAX, St as SyncReceiptBody, T as InboxItem, Tt as SyncedView, U as PrincipalInput, V as PostBody, W as PrincipalView, X as RegistrationView, Y as RegisterInput, Z as ResolvedSyncTarget, _ as FiltersInput, _t as SyncFindInput, a as BoardEventView, at as SchedulesQueryOutput, b as GrantInput, bt as SyncImportBody, c as CreateChannelBody, ct as SchemaView, d as EditBody, dt as SourceMessage, et as ScheduleBodyOutput, f as EventsPage, ft as SourceRead, g as Explanation, gt as SyncCopiesView, h as ExplainQuery, ht as SyncCopiesQuery, i as BlockView, in as Attachment, it as SchedulesQueryInput, j as LinkView, jt as TypingBody, k as LABEL_CONDITIONS_MAX, kt as ThreadsQuery, l as DeleteBody, lt as SourceJoin, m as EventsQueryInput, mt as SyncBody, n as ActorView, nt as ScheduleView, o as CanAt, ot as SchemaBody, p as EventsQuery, pt as SourceReadQuery, q as Ref, r as ApiError, rt as SchedulesQuery, s as ChannelView, st as SchemaInput, t as AckBody, tt as ScheduleInput, u as Discovery, ut as SourceJoinBody, v as GrantBody, vt as SyncFindQuery, w as InboxEntry, wt as SyncThreadView, x as GrantView, xt as SyncImportInput, y as GrantCan, yt as SyncFindView, z as MessagesQueryInput } from "./routes-zm4TXKCC.mjs";
2
+ import { i as Claims, r as CallerRequest } from "./auth-BG_whr9_.mjs";
3
+ import { C as Method, D as SandboxPolicy, E as SandboxMatcher, O as SandboxPolicyOptions, S as HttpError, T as SandboxMatch, _ as Middleware, a as Identity, b as WritePatch, c as SelfCaller, d as AsOptions, f as Board, g as DroppedError, h as WatcherContext, i as Caller, k as SandboxRule, l as Subscription, m as Watcher, n as BackendRoute, o as InboxDelivery, p as BoardOptions, r as BoardBinding, s as ProtocolMethods, t as Backend, u as VerifiedCaller, v as MiddlewareContext, w as Protocol, x as WriteSource, y as Write } from "./backend-D6yTo8Un.mjs";
4
+ import { B as Filters, F as BoardError, G as ScheduleTiming, H as ProfileOption, J as duration, K as UploadInput, L as EventsOptions, R as EventsState, U as ReplyOptions, V as PostOptions, W as ScheduleOptions, q as WaitOptions, z as ExplainPrincipal } from "./provider-BC9mPYVh.mjs";
5
5
  import { n as block } from "./blocks-DGvh2alZ.mjs";
6
- import { t as board } from "./index-CydxnBND.mjs";
7
- export { type AckBody, type ActorView, type ApiError, type AsOptions, type Attachment, type Backend, type BackendRoute, type BlockView, 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 SandboxMatch, type SandboxMatcher, type SandboxPolicy, type SandboxPolicyOptions, type SandboxRule, type ScheduleBody, type ScheduleBodyOutput, type ScheduleInput, type ScheduleOptions, type ScheduleTiming, type ScheduleView, type SchedulesQuery, type SchedulesQueryInput, type SchedulesQueryOutput, type SchemaBody, type SchemaInput, type SchemaView, 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 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, block, board, duration, type routes };
6
+ import { t as board } from "./index-Djmr4GzQ.mjs";
7
+ export { type AckBody, type ActorView, type ApiError, type AsOptions, type Attachment, type Backend, type BackendRoute, type BlockView, 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 EventsOptions, type EventsPage, type EventsQuery, type EventsQueryInput, type EventsState, type ExplainPrincipal, type ExplainQuery, type Explanation, type Filters, type FiltersInput, type GrantBody, type GrantCan, type GrantInput, type GrantView, HttpError, type INBOX_EVENT_ID_MAX, 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 SandboxMatch, type SandboxMatcher, type SandboxPolicy, type SandboxPolicyOptions, type SandboxRule, type ScheduleBody, type ScheduleBodyOutput, type ScheduleInput, type ScheduleOptions, type ScheduleTiming, type ScheduleView, type SchedulesQuery, type SchedulesQueryInput, type SchedulesQueryOutput, type SchemaBody, type SchemaInput, type SchemaView, 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 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, block, board, duration, type routes };
@@ -1,5 +1,5 @@
1
- import { f as duration, t as HttpError, u as BoardError } from "./errors-DUzpDSrJ.mjs";
1
+ import { d as BoardError, p as duration, t as HttpError } from "./errors-ZazTZh-s.mjs";
2
+ import { t as DroppedError } from "./middleware-BHHKHA9q.mjs";
2
3
  import { t as block } from "./blocks-CVoBC7ur.mjs";
3
- import { t as DroppedError } from "./middleware-0DUFrav-.mjs";
4
- import { t as board } from "./server-BHpUqip5.mjs";
4
+ import { t as board } from "./server-CcvxkXzG.mjs";
5
5
  export { BoardError, DroppedError, HttpError, block, board, duration };