@vercel/board 0.56.1 → 0.57.1

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 (96) hide show
  1. package/README.md +1 -1
  2. package/dist/{access-HzqFpgL_.mjs → access-CZ419Vho.mjs} +1 -1
  3. package/dist/access.d.mts +2 -2
  4. package/dist/access.mjs +4 -4
  5. package/dist/{actors-D-u6bitG.mjs → actors-CXMWplob.mjs} +2 -2
  6. package/dist/{auth-D9ycDQK0.mjs → auth-AwZJQpCO.mjs} +2 -2
  7. package/dist/{auth-ULldUvir.d.mts → auth-C0Mla9OU.d.mts} +1 -1
  8. package/dist/{backend-BHN6GTjB.d.mts → backend-BuqwQbb4.d.mts} +6 -22
  9. package/dist/backend-local.d.mts +1 -1
  10. package/dist/backend-local.mjs +1 -1
  11. package/dist/backend-postgres/blob-vercel.d.mts +8 -0
  12. package/dist/backend-postgres/blob-vercel.mjs +81 -0
  13. package/dist/backend-postgres/scheduler-vercel.d.mts +2 -0
  14. package/dist/backend-postgres/scheduler-vercel.mjs +2 -0
  15. package/dist/backend-postgres.d.mts +74 -0
  16. package/dist/backend-postgres.mjs +3229 -0
  17. package/dist/blob-DjS53D1A.d.mts +35 -0
  18. package/dist/{chat-provider-F7UqWVZK.d.mts → chat-provider-CpYdXEpI.d.mts} +2 -2
  19. package/dist/cli-commands.d.mts +1 -1
  20. package/dist/cli-commands.mjs +1 -1
  21. package/dist/cli-embedded.d.mts +2 -2
  22. package/dist/cli-embedded.mjs +2 -2
  23. package/dist/cli.mjs +6 -6
  24. package/dist/{client-CFHunEFn.d.mts → client-B0DGOt7P.d.mts} +1 -1
  25. package/dist/{commands-DLPIX7Jw.d.mts → commands-Dcm4_pc1.d.mts} +3 -3
  26. package/dist/{commands-7FY_8p92.mjs → commands-DeYAQUcP.mjs} +10 -5
  27. package/dist/{conformance-BNiLcKra.mjs → conformance-EtEq22w1.mjs} +2 -2
  28. package/dist/conformance.d.mts +1 -1
  29. package/dist/conformance.mjs +1 -1
  30. package/dist/{engine-C8wCzkw-.mjs → engine-CfVTyEeo.mjs} +3 -3
  31. package/dist/errors-DBZtbfph.d.mts +19 -0
  32. package/dist/{errors-DDfXnZ2b.mjs → errors-DjatfYjl.mjs} +220 -18
  33. package/dist/{exports-DSX-CI5c.mjs → exports-B_UGnrnN.mjs} +187 -62
  34. package/dist/{exports-BBmjHyCB.d.mts → exports-BvJTIorX.d.mts} +5 -4
  35. package/dist/{index-Ce3SDZ3Y.d.mts → index-DuibwQf9.d.mts} +2 -2
  36. package/dist/index.d.mts +6 -5
  37. package/dist/index.mjs +4 -4
  38. package/dist/index.node.d.mts +7 -6
  39. package/dist/index.node.mjs +4 -4
  40. package/dist/inspect/app.js +126 -146
  41. package/dist/inspect/engine.js +3 -3
  42. package/dist/inspect/sheet-presentation.js +1 -0
  43. package/dist/{inspect-C-vDnB_n.mjs → inspect-DfJzHFiE.mjs} +2 -2
  44. package/dist/inspect-H1MISWwN.mjs +2 -0
  45. package/dist/inspect.d.mts +1 -1
  46. package/dist/inspect.mjs +1 -1
  47. package/dist/{internal-CvsrprnU-CEPOUpAv.mjs → internal-CvsrprnU-DhZF6sZK.mjs} +43 -1
  48. package/dist/local-BiG1WJk0.mjs +98 -0
  49. package/dist/{local-B5aZcAwj.mjs → local-D2i5sxuY.mjs} +141 -3957
  50. package/dist/{main-DSlpMoBN.mjs → main-Bbqg3Unf.mjs} +167 -38
  51. package/dist/{memory-wmUDblhm.mjs → memory-BmsyKyHu.mjs} +3 -3
  52. package/dist/{mentions-CnWt9Z5b.mjs → mentions-DBGmqkr2.mjs} +5 -1
  53. package/dist/{middleware-BY4qqIh3.mjs → middleware-D2AGrGj7.mjs} +2 -32
  54. package/dist/{provider-DgGp4Zej.d.mts → provider-BNVyVKtH.d.mts} +2 -2
  55. package/dist/{routes-DNmQSOvQ.d.mts → routes-CSnxZyyb.d.mts} +2 -2
  56. package/dist/{serve-CI3kvpx_.mjs → serve-D06-DMej.mjs} +6 -6
  57. package/dist/{server-55vryxAl.mjs → server-BXbcS-n9.mjs} +27 -12
  58. package/dist/server-DX7mM6nm-Cq1xPyqJ.mjs +3769 -0
  59. package/dist/{serving-C1mhZQqH.mjs → serving-B2BNr4PR.mjs} +1 -1
  60. package/dist/{shell-7nGyF--f.mjs → shell-C8EowDEz.mjs} +15 -7
  61. package/dist/{sql-D0MqINA6.mjs → sql-CvBbb5Ui.mjs} +33 -22
  62. package/dist/{sqlite-Dj2ZEtgy.mjs → sqlite-B9ZLSDUT.mjs} +3 -3
  63. package/dist/{sqlite-db-DjbTlUwN.mjs → sqlite-db-DawFxCk6.mjs} +22 -7
  64. package/dist/store-N8PXxDAS-DWWgv-Vz.mjs +5 -0
  65. package/dist/{store-N8PXxDAS-BdL4Sq-f.mjs → store-codec-pAG2oPgQ-DbEYfF5Y.mjs} +2 -6
  66. package/dist/{store-memory-CKQVEzXN.mjs → store-memory-DOMraCLN.mjs} +3 -2
  67. package/dist/store-memory-XNDFHASI.mjs +2 -0
  68. package/dist/{store-polling-BZt2Rf3D-oh3aU_An.mjs → store-polling-BZt2Rf3D-nlZUQLz2.mjs} +1 -1
  69. package/dist/store-sqlite-Cs8dH9EX.mjs +2 -0
  70. package/dist/{store-sqlite-D6fIszST.mjs → store-sqlite-DUdQnX_6.mjs} +4 -3
  71. package/dist/sync-chat-sdk.d.mts +2 -2
  72. package/dist/sync-github.d.mts +2 -2
  73. package/dist/sync-linear.d.mts +3 -3
  74. package/dist/sync-slack.d.mts +3 -3
  75. package/dist/sync-slack.mjs +1 -1
  76. package/dist/sync.d.mts +2 -2
  77. package/dist/{task-batch-iecHMssy.mjs → task-batch-YMVr_c5R.mjs} +4 -4
  78. package/dist/{tokens-B3gXkQCs.mjs → tokens-CaEPmiG1.mjs} +2 -2
  79. package/dist/vercel-B5FM4uS8.d.mts +21 -0
  80. package/dist/vercel-BUb8II-P.mjs +305 -0
  81. package/dist/{version-gbihG3ui.mjs → version-BRR9FkLa.mjs} +1 -1
  82. package/docs/01-board/01-mounting.md +10 -0
  83. package/docs/01-board/05-reading.md +2 -1
  84. package/docs/01-board/09-access.md +8 -4
  85. package/docs/01-board/11-tasks.md +1 -1
  86. package/docs/01-board/12-postgres.md +222 -0
  87. package/docs/03-guides/02-inspector.md +34 -1
  88. package/docs/03-guides/07-build-a-ui.md +8 -4
  89. package/docs/04-reference/01-cli.md +1 -1
  90. package/docs/04-reference/03-http.md +2 -1
  91. package/docs/index.md +4 -1
  92. package/package.json +32 -3
  93. package/sql/postgres/schema.sql +389 -0
  94. package/dist/inspect-CJ8osLQ-.mjs +0 -2
  95. package/dist/store-memory-OdGsc-t_.mjs +0 -2
  96. package/dist/store-sqlite-CTxAVCcz.mjs +0 -2
@@ -1,14 +1,14 @@
1
1
  import { d as mediaType, i as ATTACHMENT_BYTES_MAX, n as formatProfileHeader, o as IMPORT_BYTES_MAX } from "./profile-header-O8wC8yk8.mjs";
2
2
  import { T as TASK_LABEL, b as RemoteWatcherId, y as RESERVED_LABEL_PREFIX } from "./schemas-CUSTEFIy.mjs";
3
- import { $ as SchedulesQuery, A as CreatedTasksQuery, B as InboxPushBody, C as ClaimReadyTaskBody, D as CreateGrantsBody, E as CreateChannelBody, F as FailTaskBody, G as PostBody, H as LabelBody, J as RegisterBody, K as ReactBody, L as GrantBody, M as EditBody, N as EventsQuery, O as CreateTaskBody, P as ExplainQuery, Q as ScheduleBody, R as InboxAckBody, S as ChannelsQuery, T as CompleteTaskBody, U as LinkedQuery, V as InboxQuery, W as MatchesQuery, X as RenewTaskBody, Y as ReleaseTaskBody, Z as RevokeGrantBody, _ as ActorsQuery, a as duplicateId, at as SyncFindQuery, b as CancelTaskBody, c as notFound, ct as TaskNeedsBody, d as unauthorized, dt as ThreadsQuery, et as SchemaBody, f as BoardError, ft as TypingBody, g as AckBody, h as eventsState, ht as routes, i as batchTooLarge, it as SyncCopiesQuery, j as DeleteBody, k as CreateTasksBody, lt as TasksQuery, m as duration, mt as UploadStartBody, n as RejectedError, nt as SourceReadQuery, o as forbidden, ot as SyncImportBody, p as createBoardClient, pt as UpdateGrantBody, q as Ref, r as badRequest, rt as SyncBody, s as json, st as SyncReceiptBody, t as HttpError, tt as SourceJoinBody, u as toErrorResponse, ut as ThreadQuery, v as AssignTaskBody, w as ClaimTaskBody, x as ChannelMessagesQuery, y as BlockTaskBody, z as InboxNextQuery } from "./errors-DDfXnZ2b.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-BY4qqIh3.mjs";
3
+ import { $ as Ref, A as ClaimTaskBody, B as ExplainQuery, C as ActorsQuery, D as ChannelMessagesQuery, E as CancelTaskBody, F as CreateTasksBody, G as InboxNextQuery, I as CreatedTasksQuery, J as LabelBody, K as InboxPushBody, L as DeleteBody, M as CreateChannelBody, N as CreateGrantsBody, O as ChannelsQuery, P as CreateTaskBody, Q as ReactBody, R as EditBody, S as AckBody, T as BlockTaskBody, U as GrantBody, V as FailTaskBody, W as InboxAckBody, X as MatchesQuery, Y as LinkedQuery, Z as PostBody, _t as ThreadsQuery, a as duplicateId, at as SchedulesQuery, bt as UploadStartBody, c as notFound, ct as SourceReadQuery, d as unauthorized, dt as SyncFindQuery, et as RegisterBody, f as BoardError, ft as SyncImportBody, g as refusalCode, gt as ThreadQuery, h as eventsState, ht as TasksQuery, i as batchTooLarge, it as ScheduleBody, j as CompleteTaskBody, k as ClaimReadyTaskBody, lt as SyncBody, m as duration, mt as TaskNeedsBody, n as RejectedError, nt as RenewTaskBody, o as forbidden, ot as SchemaBody, p as createBoardClient, pt as SyncReceiptBody, q as InboxQuery, r as badRequest, rt as RevokeGrantBody, s as json, st as SourceJoinBody, t as HttpError, tt as ReleaseTaskBody, u as toErrorResponse, ut as SyncCopiesQuery, v as derivedId, vt as TypingBody, w as AssignTaskBody, x as sha256, xt as routes, yt as UpdateGrantBody, z as EventsQuery } from "./errors-DjatfYjl.mjs";
5
4
  import { n as blocksIn, r as findBlocks } from "./blocks-CVoBC7ur.mjs";
6
- import { a as replaceMentions, i as mentionTerms, o as settleMentions, r as mentionTerm, t as extractMentions } from "./mentions-CnWt9Z5b.mjs";
7
- import { t as VERSION } from "./version-gbihG3ui.mjs";
8
- 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-HzqFpgL_.mjs";
9
- import { _ as uploadName, a as runMatch, d as createRouter, f as openapi, g as carried, h as readJson, i as canonicalWatchers, m as readCapped, n as SYNC_ACTOR, o as compileWatcher, p as queryObject, r as syncTarget, t as batchPlan, u as METHODS, v as SYNC } from "./task-batch-iecHMssy.mjs";
10
- import { C as verifiedIssuers, D as explainGrants, d as createAuthority, f as fromTokens, m as hostPrincipal, o as VERCEL_ISSUER, p as grantIssuers, t as DEFAULT_CAN$1, v as namesByLogin, w as verifiesTokens } from "./auth-D9ycDQK0.mjs";
11
- import { a as resolveActor, o as viaOf, r as claimsOf, t as KNOWN_AGENTS } from "./actors-D-u6bitG.mjs";
5
+ import { a as mentionTerms, c as settleMentions, i as mentionTerm, r as meTerms, s as replaceMentions, t as extractMentions } from "./mentions-DBGmqkr2.mjs";
6
+ import { a as waitUntil, c as platformProfile, d as userIdOf, o as actorParts, r as runMiddleware, s as importedHandle, t as DroppedError, u as underPrincipal } from "./middleware-D2AGrGj7.mjs";
7
+ import { t as VERSION } from "./version-BRR9FkLa.mjs";
8
+ 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-CZ419Vho.mjs";
9
+ import { _ as uploadName, a as runMatch, d as createRouter, f as openapi, g as carried, h as readJson, i as canonicalWatchers, m as readCapped, n as SYNC_ACTOR, o as compileWatcher, p as queryObject, r as syncTarget, t as batchPlan, u as METHODS, v as SYNC } from "./task-batch-YMVr_c5R.mjs";
10
+ import { C as verifiedIssuers, D as explainGrants, d as createAuthority, f as fromTokens, m as hostPrincipal, o as VERCEL_ISSUER, p as grantIssuers, t as DEFAULT_CAN$1, v as namesByLogin, w as verifiesTokens } from "./auth-AwZJQpCO.mjs";
11
+ import { a as resolveActor, o as viaOf, r as claimsOf, t as KNOWN_AGENTS } from "./actors-CXMWplob.mjs";
12
12
  import { t as checkValue } from "./data-values-CoTP0SQG.mjs";
13
13
  //#region src/server/registrant.ts
14
14
  /** Registering again this soon after the same registration only repeats it. */
@@ -725,6 +725,12 @@ const servesNone = () => new HttpError(404, "not_found", "this board uses Vercel
725
725
  const apiKind = (kind) => kind === "app" ? "workflow" : kind;
726
726
  /** How many more times a request goes out after the API puts it off. */
727
727
  const RETRIES = 4;
728
+ /** What the API or its gateway answers when it may answer the same request on another try: unavailable, or a gateway's lost answer. */
729
+ const TRANSIENT = /* @__PURE__ */ new Set([
730
+ 502,
731
+ 503,
732
+ 504
733
+ ]);
728
734
  /** The first wait before sending again, doubling each time. */
729
735
  const RETRY_MS = 1e3;
730
736
  /**
@@ -1092,11 +1098,27 @@ function createVercel(options, environment) {
1092
1098
  /** The last answer to a read of channels or actors with its `ETag`, by its URL and who asked: sent back, a 304 says it holds. The newest few. */
1093
1099
  const tagged = /* @__PURE__ */ new Map();
1094
1100
  /**
1095
- * One request to the API, as `who`. Its errors are the API's own, with its status and code. One the
1096
- * API puts off (429, or a 503) waits and goes again as it was, so a write keeps its operation ID
1097
- * and lands once.
1101
+ * A request to the API, as `who`. A path that names the board by its name (`onBoard`) asked nothing
1102
+ * first, so where the API knows no such board the caller can enter (404 `board_not_found`), the
1103
+ * board is found or made as `boardId` does it, once, and the request goes again by its ID, as
1104
+ * every one after it does.
1098
1105
  */
1099
1106
  async function api(who, method, path, init = {}) {
1107
+ const named = path.startsWith("/boards/") ? namedBoard() : null;
1108
+ if (named === null || !(path === named || path.startsWith(`${named}/`) || path.startsWith(`${named}?`))) return request(who, method, path, init);
1109
+ if (board === null) try {
1110
+ return await request(who, method, path, init);
1111
+ } catch (error) {
1112
+ if (!(error instanceof HttpError && error.status === 404 && error.code === "board_not_found")) throw error;
1113
+ }
1114
+ return request(who, method, `/boards/${encodeURIComponent(await boardId(who))}${path.slice(named.length)}`, init);
1115
+ }
1116
+ /**
1117
+ * One request to the API, as `who`. Its errors are the API's own, with its status and code. One the
1118
+ * API puts off (429, or a 503), or that its gateway lost (502, 504), waits and goes again as it was,
1119
+ * so a write keeps its operation ID and lands once.
1120
+ */
1121
+ async function request(who, method, path, init = {}) {
1100
1122
  const url = new URL(`${origin}/v${init.version ?? 1}/messageboard${path}`);
1101
1123
  const id = await teamId();
1102
1124
  if (id) url.searchParams.set(id.startsWith("team_") ? "teamId" : "slug", id);
@@ -1115,6 +1137,7 @@ function createVercel(options, environment) {
1115
1137
  if (kept) headers["if-none-match"] = kept.etag;
1116
1138
  const repeatable = method !== "POST" && method !== "PATCH" || typeof init.body?.operationId === "string";
1117
1139
  const started = Date.now();
1140
+ let renewed = false;
1118
1141
  for (let attempt = 0;; attempt++) {
1119
1142
  let response;
1120
1143
  try {
@@ -1157,14 +1180,20 @@ function createVercel(options, environment) {
1157
1180
  }
1158
1181
  return body;
1159
1182
  }
1160
- if (attempt < RETRIES && !init.signal?.aborted && (response.status === 429 || response.status === 503 && repeatable)) {
1183
+ if (attempt < RETRIES && !init.signal?.aborted && (response.status === 429 || TRANSIENT.has(response.status) && repeatable)) {
1161
1184
  await pause(retryWait(attempt, response.headers.get("retry-after")), init.signal);
1162
1185
  init.signal?.throwIfAborted();
1163
1186
  continue;
1164
1187
  }
1165
1188
  const error = body?.error;
1189
+ if (response.status === 403 && error?.invalidToken === true && !renewed && !init.signal?.aborted) {
1190
+ renewed = true;
1191
+ await pause(retryWait(0, null), init.signal);
1192
+ init.signal?.throwIfAborted();
1193
+ continue;
1194
+ }
1166
1195
  if (response.status === 429) throw throttled(response, error?.code ?? "rate_limited", attempt, Date.now() - started);
1167
- const refused = new HttpError(response.status, error?.code ?? "remote_error", error?.message ?? `Vercel's API answered ${response.status}`);
1196
+ const refused = new HttpError(response.status, refusalCode(response.status, error) ?? "remote_error", error?.message ?? `Vercel's API answered ${response.status}`);
1168
1197
  if (typeof error?.reason === "string" && /^[a-z_]{1,64}$/.test(error.reason)) reasons.set(refused, error.reason);
1169
1198
  throw refused;
1170
1199
  }
@@ -1205,6 +1234,12 @@ function createVercel(options, environment) {
1205
1234
  }
1206
1235
  }
1207
1236
  }
1237
+ /** A board's name as the API keeps one, which counts its characters once it's trimmed and NFC-normalized. */
1238
+ const boardNameOf = (given) => {
1239
+ const name = given.trim().normalize("NFC");
1240
+ if (!/^[^/]{1,64}$/.test(name)) throw new HttpError(400, "invalid_board_name", `${JSON.stringify(given)} isn't a board's name: one is 1 to 64 characters with no /.`, { origin: "handle" });
1241
+ return name;
1242
+ };
1208
1243
  /**
1209
1244
  * The board named `name` in the team: the one the API lists for it. Where it lists none, the
1210
1245
  * caller makes it (a project's is granted to that project, in its environment), unless it says
@@ -1212,9 +1247,8 @@ function createVercel(options, environment) {
1212
1247
  * team's boards, the ones you can't see included.
1213
1248
  */
1214
1249
  async function boardNamed(who, given) {
1215
- const name = given.trim().normalize("NFC");
1216
- if (!/^[^/]{1,64}$/.test(name)) throw new HttpError(400, "invalid_board_name", `${JSON.stringify(given)} isn't a board's name: one is 1 to 64 characters with no /.`, { origin: "handle" });
1217
- const { boards } = await api(who, "GET", "/boards", { query: { name } });
1250
+ const name = boardNameOf(given);
1251
+ const { boards } = await request(who, "GET", "/boards", { query: { name } });
1218
1252
  if (boards[0]) return boards[0].id;
1219
1253
  const me = await self(who);
1220
1254
  const { principal } = me.actor;
@@ -1223,7 +1257,7 @@ function createVercel(options, environment) {
1223
1257
  origin: "handle"
1224
1258
  });
1225
1259
  try {
1226
- const { board: made } = await api(who, "POST", "/boards/ensure", { body: {
1260
+ const { board: made } = await request(who, "POST", "/boards/ensure", { body: {
1227
1261
  name,
1228
1262
  operationId: operationId()
1229
1263
  } });
@@ -1272,20 +1306,38 @@ function createVercel(options, environment) {
1272
1306
  * The board's ID: the one given, the one `board({ name })` names, or the team's, which the API
1273
1307
  * names only to those it lets in. A team with none gets one the first time a person uses it, as
1274
1308
  * the API asks of its clients; a project can't make it, and needs a person to grant it the board
1275
- * anyway. Each is asked for once.
1309
+ * anyway. Each is asked for once, and only where a path can't name the board by its name: the API
1310
+ * knew none by it, or the ID itself is wanted, as a URL to the board is.
1276
1311
  */
1277
- const boardId = (who) => (board ??= options.board ? Promise.resolve(options.board) : boardName() ? boardNamed(who, boardName()) : api(who, "GET", "/boards").then(async ({ defaultBoardId }) => {
1312
+ const boardId = (who) => (board ??= options.board ? Promise.resolve(options.board) : boardName() ? boardNamed(who, boardName()) : request(who, "GET", "/boards").then(async ({ defaultBoardId }) => {
1278
1313
  if (defaultBoardId) return defaultBoardId;
1279
1314
  const me = await self(who);
1280
1315
  const { principal } = me.actor;
1281
1316
  if (principal.type === "project" || principal.type === "github" || principal.type === "oidc") throw notLetIn(null, principal, me.teamId);
1282
- const { board: made } = await api(who, "POST", "/boards/default", { body: { operationId: operationId() } });
1317
+ const { board: made } = await request(who, "POST", "/boards/default", { body: { operationId: operationId() } });
1283
1318
  return made.id;
1284
1319
  })).catch((error) => {
1285
1320
  board = null;
1286
1321
  throw error;
1287
1322
  });
1288
- const onBoard = async (who, path = "") => `/boards/${encodeURIComponent(await boardId(who))}${path}`;
1323
+ /** The team's default board's name in a path, whatever the board is named. */
1324
+ const DEFAULT_BOARD = "General";
1325
+ /**
1326
+ * `/boards/<name>`, as a path names a board that was given no ID: the API takes a board's name
1327
+ * where it takes its ID, and the default board's for the team's. Null for a board named by its ID,
1328
+ * and for a name a path would read as something else, which is asked for its ID as a name: `.` or
1329
+ * `..`, a step in a URL's path, and one that starts as an ID does (`brd_`), which the API takes for
1330
+ * an ID, another board's if it has one.
1331
+ */
1332
+ const namedBoard = () => {
1333
+ if (options.board) return null;
1334
+ const name = boardNameOf(boardName() ?? DEFAULT_BOARD);
1335
+ return name === "." || name === ".." || name.startsWith("brd_") ? null : `/boards/${encodeURIComponent(name)}`;
1336
+ };
1337
+ /** A path on the board: by its ID where that's known, and else by its name, so nothing is asked for it first. */
1338
+ const onBoard = async (who, path = "") => `${(board === null ? namedBoard() : null) ?? await boardById(who)}${path}`;
1339
+ /** `/boards/<id>`, for what must hold when the board's name changes hands: a URL someone keeps. */
1340
+ const boardById = async (who) => `/boards/${encodeURIComponent(await boardId(who))}`;
1289
1341
  let channels = null;
1290
1342
  const loadChannels = async (who, fresh = false) => {
1291
1343
  if (fresh) channels = null;
@@ -1559,51 +1611,81 @@ function createVercel(options, environment) {
1559
1611
  };
1560
1612
  /** A message's labels: a deleted message keeps none, though the API still holds them. */
1561
1613
  const labelsOf = (message) => message.deletedAt === void 0 ? { ...message.labels } : {};
1562
- const threadMessages = async (who, threadId, signal) => {
1614
+ /**
1615
+ * A thread's messages, all of them, and with `include` its channel: the API answers it with a page of them
1616
+ * (`include=channel`), so naming it costs no request of its own. The first page is asked for it, and it's kept
1617
+ * as any channel an answer names. An API that doesn't take the parameter here refuses the read, and nothing
1618
+ * is read in its place.
1619
+ */
1620
+ const threadMessages = async (who, threadId, signal, include) => {
1563
1621
  const path = await onBoard(who, `/threads/${encodeURIComponent(threadId)}/messages`);
1564
1622
  const messages = [];
1623
+ let channel;
1565
1624
  let cursor;
1566
1625
  do {
1567
1626
  const page = await reading(who, path, {
1568
- query: { cursor },
1627
+ query: {
1628
+ cursor,
1629
+ include: channel ? void 0 : include
1630
+ },
1569
1631
  ...signal ? { signal } : {}
1570
1632
  });
1571
1633
  messages.push(...page.messages);
1634
+ if (page.channel) learn(who, channel = page.channel);
1572
1635
  cursor = page.cursor ?? void 0;
1573
1636
  } while (cursor);
1574
- return messages;
1637
+ return {
1638
+ messages,
1639
+ channel,
1640
+ end: messages.at(-1)?.sequence ?? 0
1641
+ };
1575
1642
  };
1576
1643
  /** Whether the API reads a thread's messages in a range (`after`, `limit`, `order`): until it refuses one, it's asked. */
1577
1644
  let threadRanges = true;
1578
1645
  /**
1579
1646
  * A thread's root, and its replies in a range: after the message at `after`, the first `limit` of them, or with no
1580
- * `after`, the newest. The API reads the range itself, a page of 100 at most, and the root apart when the range
1581
- * leaves it out; one from before ranges answers 400 for the parameter, and the whole thread is read and cut here.
1647
+ * `after`, the newest. The API reads the range itself, a page of 100 at most, and answers the thread with its
1648
+ * first page (`include=thread`): its first message, which a range may leave out, and how many messages it has,
1649
+ * which is where it ends. So a range costs no request for the root. With `include`, the thread's channel too,
1650
+ * from the same page. The API takes `include=thread` here or the read fails: nothing is read in its place. One
1651
+ * from before ranges answers 400 for their parameters, and the whole thread is read and cut here.
1582
1652
  */
1583
- async function threadRange(who, threadId, range, signal) {
1584
- const cut = ([root, ...replies]) => {
1653
+ async function threadRange(who, threadId, range, signal, include) {
1654
+ const cut = ({ messages: [root, ...replies], channel, end }) => {
1585
1655
  const rest = range.after === void 0 ? replies : replies.filter((reply) => reply.sequence > range.after);
1586
- return root ? [root, ...range.limit === void 0 ? rest : range.after === void 0 ? rest.slice(-range.limit) : rest.slice(0, range.limit)] : [];
1656
+ return {
1657
+ messages: root ? [root, ...range.limit === void 0 ? rest : range.after === void 0 ? rest.slice(-range.limit) : rest.slice(0, range.limit)] : [],
1658
+ channel,
1659
+ end
1660
+ };
1587
1661
  };
1588
- if (!threadRanges) return cut(await threadMessages(who, threadId, signal));
1662
+ if (!threadRanges) return cut(await threadMessages(who, threadId, signal, include));
1589
1663
  const path = await onBoard(who, `/threads/${encodeURIComponent(threadId)}/messages`);
1590
- const wanted = range.limit === void 0 ? Infinity : range.after === void 0 ? range.limit + 1 : range.limit;
1664
+ const wanted = range.limit ?? Infinity;
1591
1665
  const order = range.after === void 0 ? { order: "desc" } : { after: String(range.after) };
1592
- const read = [];
1666
+ const replies = [];
1667
+ let answered = 0;
1668
+ let channel;
1669
+ let thread;
1593
1670
  try {
1594
1671
  let cursor;
1595
1672
  do {
1673
+ const first = cursor === void 0;
1596
1674
  const page = await reading(who, path, {
1597
1675
  query: {
1598
1676
  ...order,
1599
- limit: String(Math.min(PAGE_MAX, wanted - read.length)),
1600
- cursor
1677
+ limit: String(Math.min(PAGE_MAX, wanted - replies.length)),
1678
+ cursor,
1679
+ include: first ? ["thread", ...include ? [include] : []] : void 0
1601
1680
  },
1602
1681
  ...signal ? { signal } : {}
1603
1682
  });
1604
- read.push(...page.messages);
1683
+ answered += page.messages.length;
1684
+ replies.push(...page.messages.filter((message) => message.sequence > 1));
1685
+ if (page.channel) learn(who, channel = page.channel);
1686
+ if (first) thread = page.thread;
1605
1687
  cursor = page.cursor ?? void 0;
1606
- } while (cursor && read.length < wanted);
1688
+ } while (cursor && replies.length < wanted);
1607
1689
  } catch (error) {
1608
1690
  if (![
1609
1691
  "after",
@@ -1611,10 +1693,22 @@ function createVercel(options, environment) {
1611
1693
  "order"
1612
1694
  ].some((name) => unknownParameter(error, name))) throw error;
1613
1695
  threadRanges = false;
1614
- return cut(await threadMessages(who, threadId, signal));
1696
+ return cut(await threadMessages(who, threadId, signal, include));
1697
+ }
1698
+ if (!thread?.rootMessage) {
1699
+ if (answered > 0) throw new HttpError(502, "remote_error", "Vercel's API answered a range of a thread's messages without the thread and its first message");
1700
+ return {
1701
+ messages: [],
1702
+ channel,
1703
+ end: 0
1704
+ };
1615
1705
  }
1616
- const replies = read.filter((message) => message.sequence > 1).sort((a, b) => a.sequence - b.sequence);
1617
- return [read.find((message) => message.sequence === 1) ?? (await messageById(who, idAt(threadId, 1), signal)).message, ...range.limit === void 0 ? replies : range.after === void 0 ? replies.slice(-range.limit) : replies.slice(0, range.limit)];
1706
+ replies.sort((a, b) => a.sequence - b.sequence);
1707
+ return {
1708
+ messages: [thread.rootMessage, ...range.limit === void 0 ? replies : range.after === void 0 ? replies.slice(-range.limit) : replies.slice(0, range.limit)],
1709
+ channel,
1710
+ end: thread.messageCount
1711
+ };
1618
1712
  }
1619
1713
  /** Who reacted with each emoji. The API counts them on the message and lists them apart. */
1620
1714
  async function reactors(who, message) {
@@ -1759,19 +1853,23 @@ function createVercel(options, environment) {
1759
1853
  } finally {
1760
1854
  answered();
1761
1855
  }
1762
- if (!read.actors) return read;
1763
- const views = new Map(read.actors.map((view) => [view.id, view]));
1856
+ return keepActors(who, read);
1857
+ }
1858
+ /** Keeps the actors an answer came with (`with=actors`), as if each one it names had been asked for by ID, one the API left out as one it doesn't have. */
1859
+ function keepActors(who, answer) {
1860
+ if (!answer.actors) return answer;
1861
+ const views = new Map(answer.actors.map((view) => [view.id, view]));
1764
1862
  const { asked } = namesOf(who);
1765
1863
  const at = Date.now();
1766
1864
  if (asked.size >= 1e4) asked.clear();
1767
- for (const { id } of namedIn(read)) {
1865
+ for (const { id } of namedIn(answer)) {
1768
1866
  const view = views.get(id);
1769
1867
  if (view || !asked.has(id) || at - asked.get(id).at > NAMES_FRESH_MS) asked.set(id, {
1770
1868
  at,
1771
1869
  view: Promise.resolve(view)
1772
1870
  });
1773
1871
  }
1774
- return read;
1872
+ return answer;
1775
1873
  }
1776
1874
  /**
1777
1875
  * An actor as the API names them, asked for by ID with everyone else named in the same turn: the
@@ -2164,7 +2262,10 @@ function createVercel(options, environment) {
2164
2262
  let prefixes = [];
2165
2263
  if (value === "me") {
2166
2264
  const found = await api(who, "GET", await onBoard(who, "/me"));
2167
- terms = [found.actor.id, ...found.view?.handle ? [mentionTerm(found.view.handle)] : []];
2265
+ terms = meTerms({
2266
+ id: found.actor.id,
2267
+ handle: found.view?.handle
2268
+ });
2168
2269
  } else {
2169
2270
  terms = [mentionTerm(value)];
2170
2271
  prefixes = [value.includes(":") ? `${value}+` : `${mentionTerm(value)}/`];
@@ -2401,7 +2502,7 @@ function createVercel(options, environment) {
2401
2502
  const named = (profile) => {
2402
2503
  if (profile === null) return null;
2403
2504
  const name = typeof profile === "string" ? profile : profile.name;
2404
- if (!PROFILE.test(name)) throw new HttpError(400, "invalid_request", `as: ${name}: profiles start with a letter and use up to 32 letters, numbers, and hyphens`);
2505
+ if (!PROFILE.test(name)) throw new HttpError(400, "invalid_profile", `as: ${name}: profiles start with a letter and use up to 32 letters, numbers, and hyphens`);
2405
2506
  return typeof profile === "string" || !profile.avatar ? { name } : {
2406
2507
  name,
2407
2508
  avatar: profile.avatar
@@ -2446,7 +2547,7 @@ function createVercel(options, environment) {
2446
2547
  const { thread, channel } = found;
2447
2548
  if (filters.channel !== void 0 && !inPattern(channel.name, filters.channel)) return none;
2448
2549
  const feeds = await heads(who, [channel]);
2449
- const all = await threadMessages(who, thread.id, signal);
2550
+ const { messages: all } = await threadMessages(who, thread.id, signal);
2450
2551
  const labeled = labeledBy(thread, all.find((message) => message.sequence === 1));
2451
2552
  let newest = 0;
2452
2553
  const messages = [];
@@ -3362,6 +3463,15 @@ function createVercel(options, environment) {
3362
3463
  if (TASK_CONFLICTS.has(code)) return new HttpError(409, code, message);
3363
3464
  return error;
3364
3465
  }
3466
+ /** Finishes an upload. The API says which check refused it, and bytes that aren't the type their name says are the uploader's to fix. */
3467
+ async function completeUpload(who, id) {
3468
+ try {
3469
+ return (await api(who, "POST", await onBoard(who, `/attachments/${encodeURIComponent(id)}/complete`))).attachment;
3470
+ } catch (error) {
3471
+ if (error instanceof HttpError && error.code === "attachment_mismatch" && reasons.get(error) === "media_type") throw new HttpError(422, "attachment_type_mismatch", "the file's bytes aren't the image or video type its name says");
3472
+ throw error;
3473
+ }
3474
+ }
3365
3475
  /** One write to a task route, `/tasks` and `path` after it, with an operation ID of its own. */
3366
3476
  async function taskWrite(who, path, body, about = {}) {
3367
3477
  try {
@@ -3635,7 +3745,7 @@ function createVercel(options, environment) {
3635
3745
  const id = team?.startsWith("team_") ? team : (await self(who)).teamId;
3636
3746
  return {
3637
3747
  version: VERSION,
3638
- url: `${origin}/v1/messageboard${await onBoard(who)}?teamId=${encodeURIComponent(id)}`,
3748
+ url: `${origin}/v1/messageboard${typeof found?.board.id === "string" ? `/boards/${encodeURIComponent(found.board.id)}` : await boardById(who)}?teamId=${encodeURIComponent(id)}`,
3639
3749
  audience: origin,
3640
3750
  team_id: id,
3641
3751
  project_id: null,
@@ -3873,14 +3983,22 @@ function createVercel(options, environment) {
3873
3983
  },
3874
3984
  async message(caller, { id, after, limit }, signal) {
3875
3985
  const who = whoOf(caller);
3876
- const { thread, channel } = await messageIn(who, id, signal);
3986
+ const missing = () => notFound(`message not found: ${id}`, "message_not_found");
3987
+ const at = locate(id);
3988
+ if (!at) throw missing();
3877
3989
  const from = after === void 0 ? void 0 : locate(after);
3878
- if (after !== void 0 && from?.threadId !== thread.id) throw new HttpError(400, "invalid_request", `after: ${after} isn't a message of this thread`);
3879
- const [root, ...replies] = from !== void 0 || limit !== void 0 ? await threadRange(who, thread.id, {
3990
+ if (after !== void 0 && from?.threadId !== at.threadId) throw new HttpError(400, "invalid_request", `after: ${after} isn't a message of this thread`);
3991
+ const read = await (from !== void 0 || limit !== void 0 ? threadRange(who, at.threadId, {
3880
3992
  ...from ? { after: from.sequence } : {},
3881
3993
  ...limit !== void 0 ? { limit } : {}
3882
- }, signal) : await threadMessages(who, thread.id, signal);
3883
- if (!root) throw notFound(`message not found: ${id}`, "message_not_found");
3994
+ }, signal, "channel") : threadMessages(who, at.threadId, signal, "channel")).catch((error) => {
3995
+ if (error instanceof HttpError && (error.code === "thread_not_found" || error.code === "message_not_found")) throw missing();
3996
+ throw error;
3997
+ });
3998
+ const [root, ...replies] = read.messages;
3999
+ if (!root || at.sequence > read.end) throw missing();
4000
+ const { channel } = read;
4001
+ if (!channel) throw new HttpError(502, "remote_error", "Vercel's API answered a thread's messages without their channel");
3884
4002
  const [message, ...shown] = await Promise.all([root, ...replies].map((each) => view(who, each, channel.name)));
3885
4003
  return {
3886
4004
  message,
@@ -3911,8 +4029,7 @@ function createVercel(options, environment) {
3911
4029
  redirect: "error"
3912
4030
  });
3913
4031
  if (!put.ok) throw new HttpError(502, "upload_failed", `the upload to Vercel's storage answered ${put.status}`);
3914
- const { attachment } = await api(who, "POST", await onBoard(who, `/attachments/${encodeURIComponent(started.attachment.id)}/complete`));
3915
- return { attachment: fileOf(attachment) };
4032
+ return { attachment: fileOf(await completeUpload(who, started.attachment.id)) };
3916
4033
  },
3917
4034
  async uploadStart(caller, { name, type, size, sha256 }) {
3918
4035
  const who = whoOf(caller);
@@ -3933,8 +4050,7 @@ function createVercel(options, environment) {
3933
4050
  },
3934
4051
  async uploadFinish(caller, { id }) {
3935
4052
  const who = whoOf(caller);
3936
- const { attachment } = await api(who, "POST", await onBoard(who, `/attachments/${encodeURIComponent(id)}/complete`));
3937
- return { attachment: fileOf(attachment) };
4053
+ return { attachment: fileOf(await completeUpload(who, id)) };
3938
4054
  },
3939
4055
  async attachment(caller, { id }, signal) {
3940
4056
  const who = whoOf(caller);
@@ -3970,15 +4086,19 @@ function createVercel(options, environment) {
3970
4086
  signal
3971
4087
  });
3972
4088
  } else {
3973
- const { thread, message: to, channel } = await messageIn(who, input.re, signal);
3974
- channelName = channel.name;
4089
+ const to = locate(input.re);
4090
+ if (!to) throw notFound(`message not found: ${input.re}`, "message_not_found");
3975
4091
  const after = input.after === void 0 ? void 0 : locate(input.after);
3976
- if (after !== void 0 && after?.threadId !== thread.id) {
4092
+ if (after !== void 0 && after?.threadId !== to.threadId) {
3977
4093
  const landed = clientId ? await api(who, "GET", await onBoard(who, `/posts/${encodeURIComponent(clientId)}`), { signal }).catch(() => null) : null;
3978
- if (landed?.thread.id === thread.id) return { message: await view(who, landed.message, channel.name) };
4094
+ if (landed?.thread.id === to.threadId) return { message: await view(who, landed.message, (await channelById(who, landed.thread.channelId)).name) };
3979
4095
  throw badRequest(`after: ${input.after} isn't in ${input.re}'s thread`, "invalid_after");
3980
4096
  }
3981
- made = await api(who, "POST", await onBoard(who, `/threads/${encodeURIComponent(thread.id)}/messages`), {
4097
+ const reply = await api(who, "POST", await onBoard(who, `/threads/${encodeURIComponent(to.threadId)}/messages`), {
4098
+ query: {
4099
+ include: "channel",
4100
+ ...namesById ? { with: "actors" } : {}
4101
+ },
3982
4102
  body: {
3983
4103
  operationId: operationId(),
3984
4104
  text: input.text,
@@ -3992,8 +4112,13 @@ function createVercel(options, environment) {
3992
4112
  signal
3993
4113
  }).catch((error) => {
3994
4114
  if (error instanceof HttpError && error.code === "newer_message") throw new HttpError(409, "newer_message", `a message came after ${input.after}`);
4115
+ if (error instanceof HttpError && (error.code === "thread_not_found" || error.code === "invalid_reply")) throw notFound(`message not found: ${input.re}`, "message_not_found");
3995
4116
  throw error;
3996
4117
  });
4118
+ if ("text" in reply.message) keepActors(who, reply);
4119
+ if (reply.channel) learn(who, reply.channel);
4120
+ channelName = (reply.channel ?? (reply.thread.channelId !== void 0 ? await channelById(who, reply.thread.channelId) : (await messageIn(who, input.re, signal)).channel)).name;
4121
+ made = reply;
3997
4122
  }
3998
4123
  channelName = await landedIn(who, made.thread.channelId, channelName, clientId);
3999
4124
  return { message: await view(who, "text" in made.message ? made.message : await sent(who, made.message, input), channelName) };
@@ -4820,7 +4945,7 @@ function createVercel(options, environment) {
4820
4945
  const who = { profile: null };
4821
4946
  const team = await teamId();
4822
4947
  const id = team?.startsWith("team_") ? team : (await self(who)).teamId;
4823
- const board = await onBoard(who);
4948
+ const board = await boardById(who);
4824
4949
  const url = `${origin}/v1/messageboard${board}?teamId=${encodeURIComponent(id)}`;
4825
4950
  return {
4826
4951
  url,
@@ -1,7 +1,8 @@
1
- import { ut as MessageView } from "./routes-DNmQSOvQ.mjs";
2
- import "./auth-ULldUvir.mjs";
3
- import "./backend-BHN6GTjB.mjs";
4
- import { g as TaskInBatch, n as BoardError } from "./client-CFHunEFn.mjs";
1
+ import { ut as MessageView } from "./routes-CSnxZyyb.mjs";
2
+ import "./auth-C0Mla9OU.mjs";
3
+ import "./backend-BuqwQbb4.mjs";
4
+ import { g as TaskInBatch, n as BoardError } from "./client-B0DGOt7P.mjs";
5
+ import "./errors-DBZtbfph.mjs";
5
6
  //#region src/client/chunks.d.ts
6
7
  /** What `createTasksInChunks` makes tasks with: a handle, or anything with its `tasks.createMany`. */
7
8
  type TaskBatches = {
@@ -1,5 +1,5 @@
1
- import { f as Board, p as BoardOptions } from "./backend-BHN6GTjB.mjs";
2
- import "./exports-BBmjHyCB.mjs";
1
+ import { f as Board, p as BoardOptions } from "./backend-BuqwQbb4.mjs";
2
+ import "./exports-BvJTIorX.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,9 @@
1
- import { $ as InboxNextQuery, $t as SyncThreadView, A as CreateTasksInput, At as ScheduleInput, B as Explanation, Bt as SourceMessage, C as ClaimTaskBody, Ct as ReleaseTaskBody, D as CreateTaskBody, Dt as RouteName, E as CreateGrantsBody, Et as RevokeGrantBody, F as EditBody, Ft as SchemaBody, G as GrantCan, Gt as SyncCopiesView, H as FiltersInput, Ht as SourceReadQuery, I as EventsPage, It as SchemaInput, J as GrantWriteOptions, Jt as SyncFindView, K as GrantInput, Kt as SyncFindInput, L as EventsQuery, Lt as SchemaView, M as DeleteBody, Mt as SchedulesQuery, N as Discovery, Nt as SchedulesQueryInput, O as CreateTaskInput, Ot as ScheduleBody, P as EVENTS_LAST_MAX, Pt as SchedulesQueryOutput, Q as InboxItem, Qt as SyncReceiptInput, R as EventsQueryInput, Rt as SourceJoin, S as ClaimReadyTaskInput, Sn as routes, St as RegistrationView, T as CreateChannelBody, Tt as ResolvedSyncTarget, U as GRANT_BATCH_MAX, Un as Attachment, Ut as SyncBody, V as FailTaskBody, Vt as SourceRead, W as GrantBody, Wt as SyncCopiesQuery, X as InboxAckBody, Xt as SyncImportInput, Y as INBOX_EVENT_ID_MAX, Yt as SyncImportBody, Z as InboxEntry, Zt as SyncReceiptBody, _ as ChannelView, _n as TypingResult, _t as REGISTERED_WATCHERS_MAX, a as ActorsQueryInput, an as TaskView, at as LinkView, b as ChannelsQueryInput, bn as UploadStartBody, bt as RegisterBody, c as BlockTaskBody, cn as TasksQueryInput, ct as MatchesQuery, d as CHANNELS_LIMIT_DEFAULT, dn as ThreadSummaryView, dt as MessagesPage, en as SyncedView, et as InboxPushBody, f as CHANNELS_LIMIT_MAX, fn as ThreadView, ft as ParsedFilters, g as ChannelMessagesQueryInput, gn as TypingBody, gt as PrincipalView, h as ChannelMessagesQuery, hn as ThreadsQueryInput, ht as PrincipalInput, i as ActorsQuery, in as TaskNeedsBody, it as LabelBody, j as CreatedTasksQuery, jt as ScheduleView, k as CreateTasksBody, kt as ScheduleBodyOutput, l as BlockView, ln as ThreadQuery, lt as Me, m as CancelTaskBody, mn as ThreadsQuery, mt as PostInput, n as AckBody, nn as THREADS_LIMIT_MAX, nt as LABEL_CONDITIONS_MAX, o as ApiError, on as TasksPage, ot as LinkedQuery, p as CanAt, pn as ThreadsPage, pt as PostBody, q as GrantView, qt as SyncFindQuery, r as ActorView, rn as TaskClaim, rt as LEASE_DEFAULT_S, s as AssignTaskBody, sn as TasksQuery, st as MatchView, t as ACTORS_BY_ID_MAX, tn as THREADS_LIMIT_DEFAULT, tt as InboxQuery, u as BoardEventView, un as ThreadQueryInput, ut as MessageView, v as ChannelsPage, vn as UpdateGrantBody, vt as ReactBody, w as CompleteTaskBody, wt as RenewTaskBody, x as ClaimReadyTaskBody, xn as UploadTicket, xt as RegisterInput, y as ChannelsQuery, yn as UpdateGrantInput, yt as Ref, z as ExplainQuery, zt as SourceJoinBody } from "./routes-DNmQSOvQ.mjs";
2
- import { i as Claims, r as CallerRequest } from "./auth-ULldUvir.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-BHN6GTjB.mjs";
4
- import { C as MentionedActor, S as Mentioned, _ as TaskOptions, a as EventsOptions, b as Written, c as Filters, d as PostOptions, f as ProfileOption, g as TaskInBatch, h as ScheduleTiming, l as HeldTask, m as ScheduleOptions, n as BoardError, o as EventsState, p as ReplyOptions, r as ClaimedTask, s as ExplainPrincipal, u as NewTaskOptions, v as UploadInput, x as duration, y as WaitOptions } from "./client-CFHunEFn.mjs";
5
- import { n as TasksInChunksError, r as createTasksInChunks, t as TaskBatches } from "./exports-BBmjHyCB.mjs";
1
+ import { $ as InboxNextQuery, $t as SyncThreadView, A as CreateTasksInput, At as ScheduleInput, B as Explanation, Bt as SourceMessage, C as ClaimTaskBody, Ct as ReleaseTaskBody, D as CreateTaskBody, Dt as RouteName, E as CreateGrantsBody, Et as RevokeGrantBody, F as EditBody, Ft as SchemaBody, G as GrantCan, Gt as SyncCopiesView, H as FiltersInput, Ht as SourceReadQuery, I as EventsPage, It as SchemaInput, J as GrantWriteOptions, Jt as SyncFindView, K as GrantInput, Kt as SyncFindInput, L as EventsQuery, Lt as SchemaView, M as DeleteBody, Mt as SchedulesQuery, N as Discovery, Nt as SchedulesQueryInput, O as CreateTaskInput, Ot as ScheduleBody, P as EVENTS_LAST_MAX, Pt as SchedulesQueryOutput, Q as InboxItem, Qt as SyncReceiptInput, R as EventsQueryInput, Rt as SourceJoin, S as ClaimReadyTaskInput, Sn as routes, St as RegistrationView, T as CreateChannelBody, Tt as ResolvedSyncTarget, U as GRANT_BATCH_MAX, Un as Attachment, Ut as SyncBody, V as FailTaskBody, Vt as SourceRead, W as GrantBody, Wt as SyncCopiesQuery, X as InboxAckBody, Xt as SyncImportInput, Y as INBOX_EVENT_ID_MAX, Yt as SyncImportBody, Z as InboxEntry, Zt as SyncReceiptBody, _ as ChannelView, _n as TypingResult, _t as REGISTERED_WATCHERS_MAX, a as ActorsQueryInput, an as TaskView, at as LinkView, b as ChannelsQueryInput, bn as UploadStartBody, bt as RegisterBody, c as BlockTaskBody, cn as TasksQueryInput, ct as MatchesQuery, d as CHANNELS_LIMIT_DEFAULT, dn as ThreadSummaryView, dt as MessagesPage, en as SyncedView, et as InboxPushBody, f as CHANNELS_LIMIT_MAX, fn as ThreadView, ft as ParsedFilters, g as ChannelMessagesQueryInput, gn as TypingBody, gt as PrincipalView, h as ChannelMessagesQuery, hn as ThreadsQueryInput, ht as PrincipalInput, i as ActorsQuery, in as TaskNeedsBody, it as LabelBody, j as CreatedTasksQuery, jt as ScheduleView, k as CreateTasksBody, kt as ScheduleBodyOutput, l as BlockView, ln as ThreadQuery, lt as Me, m as CancelTaskBody, mn as ThreadsQuery, mt as PostInput, n as AckBody, nn as THREADS_LIMIT_MAX, nt as LABEL_CONDITIONS_MAX, o as ApiError, on as TasksPage, ot as LinkedQuery, p as CanAt, pn as ThreadsPage, pt as PostBody, q as GrantView, qt as SyncFindQuery, r as ActorView, rn as TaskClaim, rt as LEASE_DEFAULT_S, s as AssignTaskBody, sn as TasksQuery, st as MatchView, t as ACTORS_BY_ID_MAX, tn as THREADS_LIMIT_DEFAULT, tt as InboxQuery, u as BoardEventView, un as ThreadQueryInput, ut as MessageView, v as ChannelsPage, vn as UpdateGrantBody, vt as ReactBody, w as CompleteTaskBody, wt as RenewTaskBody, x as ClaimReadyTaskBody, xn as UploadTicket, xt as RegisterInput, y as ChannelsQuery, yn as UpdateGrantInput, yt as Ref, z as ExplainQuery, zt as SourceJoinBody } from "./routes-CSnxZyyb.mjs";
2
+ import { i as Claims, r as CallerRequest } from "./auth-C0Mla9OU.mjs";
3
+ import { C as Protocol, D as SandboxPolicyOptions, E as SandboxPolicy, O as SandboxRule, S as Method, T as SandboxMatcher, _ 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, 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 SandboxMatch, x as WriteSource, y as Write } from "./backend-BuqwQbb4.mjs";
4
+ import { C as MentionedActor, S as Mentioned, _ as TaskOptions, a as EventsOptions, b as Written, c as Filters, d as PostOptions, f as ProfileOption, g as TaskInBatch, h as ScheduleTiming, l as HeldTask, m as ScheduleOptions, n as BoardError, o as EventsState, p as ReplyOptions, r as ClaimedTask, s as ExplainPrincipal, u as NewTaskOptions, v as UploadInput, x as duration, y as WaitOptions } from "./client-B0DGOt7P.mjs";
5
+ import { t as HttpError } from "./errors-DBZtbfph.mjs";
6
+ import { n as TasksInChunksError, r as createTasksInChunks, t as TaskBatches } from "./exports-BvJTIorX.mjs";
6
7
  import { n as block } from "./blocks-DGvh2alZ.mjs";
7
8
  //#region src/server/index.default.d.ts
8
9
  /**
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { f as BoardError, m as duration, t as HttpError } from "./errors-DDfXnZ2b.mjs";
2
- import { t as DroppedError } from "./middleware-BY4qqIh3.mjs";
1
+ import { f as BoardError, m as duration, t as HttpError } from "./errors-DjatfYjl.mjs";
3
2
  import { t as block } from "./blocks-CVoBC7ur.mjs";
4
- import { c as createVercel, n as createTasksInChunks, r as createBoard, t as TasksInChunksError } from "./exports-DSX-CI5c.mjs";
3
+ import { t as DroppedError } from "./middleware-D2AGrGj7.mjs";
4
+ import { c as createVercel, n as createTasksInChunks, r as createBoard, t as TasksInChunksError } from "./exports-B_UGnrnN.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-C8wCzkw-.mjs"),
27
+ sync: () => import("./engine-CfVTyEeo.mjs"),
28
28
  serving: null,
29
29
  sandbox: null
30
30
  });
@@ -1,8 +1,9 @@
1
- import { $ as InboxNextQuery, $t as SyncThreadView, A as CreateTasksInput, At as ScheduleInput, B as Explanation, Bt as SourceMessage, C as ClaimTaskBody, Ct as ReleaseTaskBody, D as CreateTaskBody, Dt as RouteName, E as CreateGrantsBody, Et as RevokeGrantBody, F as EditBody, Ft as SchemaBody, G as GrantCan, Gt as SyncCopiesView, H as FiltersInput, Ht as SourceReadQuery, I as EventsPage, It as SchemaInput, J as GrantWriteOptions, Jt as SyncFindView, K as GrantInput, Kt as SyncFindInput, L as EventsQuery, Lt as SchemaView, M as DeleteBody, Mt as SchedulesQuery, N as Discovery, Nt as SchedulesQueryInput, O as CreateTaskInput, Ot as ScheduleBody, P as EVENTS_LAST_MAX, Pt as SchedulesQueryOutput, Q as InboxItem, Qt as SyncReceiptInput, R as EventsQueryInput, Rt as SourceJoin, S as ClaimReadyTaskInput, Sn as routes, St as RegistrationView, T as CreateChannelBody, Tt as ResolvedSyncTarget, U as GRANT_BATCH_MAX, Un as Attachment, Ut as SyncBody, V as FailTaskBody, Vt as SourceRead, W as GrantBody, Wt as SyncCopiesQuery, X as InboxAckBody, Xt as SyncImportInput, Y as INBOX_EVENT_ID_MAX, Yt as SyncImportBody, Z as InboxEntry, Zt as SyncReceiptBody, _ as ChannelView, _n as TypingResult, _t as REGISTERED_WATCHERS_MAX, a as ActorsQueryInput, an as TaskView, at as LinkView, b as ChannelsQueryInput, bn as UploadStartBody, bt as RegisterBody, c as BlockTaskBody, cn as TasksQueryInput, ct as MatchesQuery, d as CHANNELS_LIMIT_DEFAULT, dn as ThreadSummaryView, dt as MessagesPage, en as SyncedView, et as InboxPushBody, f as CHANNELS_LIMIT_MAX, fn as ThreadView, ft as ParsedFilters, g as ChannelMessagesQueryInput, gn as TypingBody, gt as PrincipalView, h as ChannelMessagesQuery, hn as ThreadsQueryInput, ht as PrincipalInput, i as ActorsQuery, in as TaskNeedsBody, it as LabelBody, j as CreatedTasksQuery, jt as ScheduleView, k as CreateTasksBody, kt as ScheduleBodyOutput, l as BlockView, ln as ThreadQuery, lt as Me, m as CancelTaskBody, mn as ThreadsQuery, mt as PostInput, n as AckBody, nn as THREADS_LIMIT_MAX, nt as LABEL_CONDITIONS_MAX, o as ApiError, on as TasksPage, ot as LinkedQuery, p as CanAt, pn as ThreadsPage, pt as PostBody, q as GrantView, qt as SyncFindQuery, r as ActorView, rn as TaskClaim, rt as LEASE_DEFAULT_S, s as AssignTaskBody, sn as TasksQuery, st as MatchView, t as ACTORS_BY_ID_MAX, tn as THREADS_LIMIT_DEFAULT, tt as InboxQuery, u as BoardEventView, un as ThreadQueryInput, ut as MessageView, v as ChannelsPage, vn as UpdateGrantBody, vt as ReactBody, w as CompleteTaskBody, wt as RenewTaskBody, x as ClaimReadyTaskBody, xn as UploadTicket, xt as RegisterInput, y as ChannelsQuery, yn as UpdateGrantInput, yt as Ref, z as ExplainQuery, zt as SourceJoinBody } from "./routes-DNmQSOvQ.mjs";
2
- import { i as Claims, r as CallerRequest } from "./auth-ULldUvir.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-BHN6GTjB.mjs";
4
- import { C as MentionedActor, S as Mentioned, _ as TaskOptions, a as EventsOptions, b as Written, c as Filters, d as PostOptions, f as ProfileOption, g as TaskInBatch, h as ScheduleTiming, l as HeldTask, m as ScheduleOptions, n as BoardError, o as EventsState, p as ReplyOptions, r as ClaimedTask, s as ExplainPrincipal, u as NewTaskOptions, v as UploadInput, x as duration, y as WaitOptions } from "./client-CFHunEFn.mjs";
5
- import { n as TasksInChunksError, r as createTasksInChunks, t as TaskBatches } from "./exports-BBmjHyCB.mjs";
1
+ import { $ as InboxNextQuery, $t as SyncThreadView, A as CreateTasksInput, At as ScheduleInput, B as Explanation, Bt as SourceMessage, C as ClaimTaskBody, Ct as ReleaseTaskBody, D as CreateTaskBody, Dt as RouteName, E as CreateGrantsBody, Et as RevokeGrantBody, F as EditBody, Ft as SchemaBody, G as GrantCan, Gt as SyncCopiesView, H as FiltersInput, Ht as SourceReadQuery, I as EventsPage, It as SchemaInput, J as GrantWriteOptions, Jt as SyncFindView, K as GrantInput, Kt as SyncFindInput, L as EventsQuery, Lt as SchemaView, M as DeleteBody, Mt as SchedulesQuery, N as Discovery, Nt as SchedulesQueryInput, O as CreateTaskInput, Ot as ScheduleBody, P as EVENTS_LAST_MAX, Pt as SchedulesQueryOutput, Q as InboxItem, Qt as SyncReceiptInput, R as EventsQueryInput, Rt as SourceJoin, S as ClaimReadyTaskInput, Sn as routes, St as RegistrationView, T as CreateChannelBody, Tt as ResolvedSyncTarget, U as GRANT_BATCH_MAX, Un as Attachment, Ut as SyncBody, V as FailTaskBody, Vt as SourceRead, W as GrantBody, Wt as SyncCopiesQuery, X as InboxAckBody, Xt as SyncImportInput, Y as INBOX_EVENT_ID_MAX, Yt as SyncImportBody, Z as InboxEntry, Zt as SyncReceiptBody, _ as ChannelView, _n as TypingResult, _t as REGISTERED_WATCHERS_MAX, a as ActorsQueryInput, an as TaskView, at as LinkView, b as ChannelsQueryInput, bn as UploadStartBody, bt as RegisterBody, c as BlockTaskBody, cn as TasksQueryInput, ct as MatchesQuery, d as CHANNELS_LIMIT_DEFAULT, dn as ThreadSummaryView, dt as MessagesPage, en as SyncedView, et as InboxPushBody, f as CHANNELS_LIMIT_MAX, fn as ThreadView, ft as ParsedFilters, g as ChannelMessagesQueryInput, gn as TypingBody, gt as PrincipalView, h as ChannelMessagesQuery, hn as ThreadsQueryInput, ht as PrincipalInput, i as ActorsQuery, in as TaskNeedsBody, it as LabelBody, j as CreatedTasksQuery, jt as ScheduleView, k as CreateTasksBody, kt as ScheduleBodyOutput, l as BlockView, ln as ThreadQuery, lt as Me, m as CancelTaskBody, mn as ThreadsQuery, mt as PostInput, n as AckBody, nn as THREADS_LIMIT_MAX, nt as LABEL_CONDITIONS_MAX, o as ApiError, on as TasksPage, ot as LinkedQuery, p as CanAt, pn as ThreadsPage, pt as PostBody, q as GrantView, qt as SyncFindQuery, r as ActorView, rn as TaskClaim, rt as LEASE_DEFAULT_S, s as AssignTaskBody, sn as TasksQuery, st as MatchView, t as ACTORS_BY_ID_MAX, tn as THREADS_LIMIT_DEFAULT, tt as InboxQuery, u as BoardEventView, un as ThreadQueryInput, ut as MessageView, v as ChannelsPage, vn as UpdateGrantBody, vt as ReactBody, w as CompleteTaskBody, wt as RenewTaskBody, x as ClaimReadyTaskBody, xn as UploadTicket, xt as RegisterInput, y as ChannelsQuery, yn as UpdateGrantInput, yt as Ref, z as ExplainQuery, zt as SourceJoinBody } from "./routes-CSnxZyyb.mjs";
2
+ import { i as Claims, r as CallerRequest } from "./auth-C0Mla9OU.mjs";
3
+ import { C as Protocol, D as SandboxPolicyOptions, E as SandboxPolicy, O as SandboxRule, S as Method, T as SandboxMatcher, _ 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, 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 SandboxMatch, x as WriteSource, y as Write } from "./backend-BuqwQbb4.mjs";
4
+ import { C as MentionedActor, S as Mentioned, _ as TaskOptions, a as EventsOptions, b as Written, c as Filters, d as PostOptions, f as ProfileOption, g as TaskInBatch, h as ScheduleTiming, l as HeldTask, m as ScheduleOptions, n as BoardError, o as EventsState, p as ReplyOptions, r as ClaimedTask, s as ExplainPrincipal, u as NewTaskOptions, v as UploadInput, x as duration, y as WaitOptions } from "./client-B0DGOt7P.mjs";
5
+ import { t as HttpError } from "./errors-DBZtbfph.mjs";
6
+ import { n as TasksInChunksError, r as createTasksInChunks, t as TaskBatches } from "./exports-BvJTIorX.mjs";
6
7
  import { n as block } from "./blocks-DGvh2alZ.mjs";
7
- import { t as board } from "./index-Ce3SDZ3Y.mjs";
8
+ import { t as board } from "./index-DuibwQf9.mjs";
8
9
  export { type ACTORS_BY_ID_MAX, type AckBody, type ActorView, type ActorsQuery, type ActorsQueryInput, type ApiError, type AsOptions, type AssignTaskBody, type Attachment, type Backend, type BackendRoute, type BlockTaskBody, type BlockView, type Board, type BoardBinding, BoardError, type BoardEventView, type BoardOptions, type CHANNELS_LIMIT_DEFAULT, type CHANNELS_LIMIT_MAX, type Caller, type CallerRequest, type CanAt, type CancelTaskBody, type ChannelMessagesQuery, type ChannelMessagesQueryInput, type ChannelView, type ChannelsPage, type ChannelsQuery, type ChannelsQueryInput, type ClaimReadyTaskBody, type ClaimReadyTaskInput, type ClaimTaskBody, type ClaimedTask, type Claims, type CompleteTaskBody, type CreateChannelBody, type CreateGrantsBody, type CreateTaskBody, type CreateTaskInput, type CreateTasksBody, type CreateTasksInput, type CreatedTasksQuery, type DeleteBody, type Discovery, DroppedError, type EVENTS_LAST_MAX, type EditBody, type EventsOptions, type EventsPage, type EventsQuery, type EventsQueryInput, type EventsState, type ExplainPrincipal, type ExplainQuery, type Explanation, type FailTaskBody, type Filters, type FiltersInput, type GRANT_BATCH_MAX, type GrantBody, type GrantCan, type GrantInput, type GrantView, type GrantWriteOptions, type HeldTask, 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 LEASE_DEFAULT_S, type LabelBody, type LinkView, type LinkedQuery, type MatchView, type MatchesQuery, type Me, type Mentioned, type MentionedActor, type MessageView, type MessagesPage, type Method, type Middleware, type MiddlewareContext, type NewTaskOptions, 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 ReleaseTaskBody, type RenewTaskBody, type ReplyOptions, type ResolvedSyncTarget, type RevokeGrantBody, 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 THREADS_LIMIT_DEFAULT, type THREADS_LIMIT_MAX, type TaskBatches, type TaskClaim, type TaskInBatch, type TaskNeedsBody, type TaskOptions, type TaskView, TasksInChunksError, type TasksPage, type TasksQuery, type TasksQueryInput, type ThreadQuery, type ThreadQueryInput, 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, type Written, block, board, createTasksInChunks, duration, type routes };
@@ -1,6 +1,6 @@
1
- import { f as BoardError, m as duration, t as HttpError } from "./errors-DDfXnZ2b.mjs";
2
- import { t as DroppedError } from "./middleware-BY4qqIh3.mjs";
1
+ import { f as BoardError, m as duration, t as HttpError } from "./errors-DjatfYjl.mjs";
3
2
  import { t as block } from "./blocks-CVoBC7ur.mjs";
4
- import { n as createTasksInChunks, t as TasksInChunksError } from "./exports-DSX-CI5c.mjs";
5
- import { t as board } from "./server-55vryxAl.mjs";
3
+ import { t as DroppedError } from "./middleware-D2AGrGj7.mjs";
4
+ import { n as createTasksInChunks, t as TasksInChunksError } from "./exports-B_UGnrnN.mjs";
5
+ import { t as board } from "./server-BXbcS-n9.mjs";
6
6
  export { BoardError, DroppedError, HttpError, TasksInChunksError, block, board, createTasksInChunks, duration };