@vercel/board 0.35.0 → 0.36.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 (35) hide show
  1. package/dist/backend-local.mjs +1 -1
  2. package/dist/{chat-provider-9hCT654s.mjs → chat-provider-Bb-jeJLY.mjs} +2 -2
  3. package/dist/cli-commands.d.mts +1 -1
  4. package/dist/cli-commands.mjs +1 -1
  5. package/dist/cli-embedded.mjs +1 -1
  6. package/dist/cli.mjs +4 -4
  7. package/dist/{commands-CENWob9m.mjs → commands-BLtqSwha.mjs} +8 -6
  8. package/dist/{commands-BorACIFS.d.mts → commands-DGID-4Z2.d.mts} +4 -2
  9. package/dist/{engine-wN7quvbU.mjs → engine-B_prP0b8.mjs} +2 -2
  10. package/dist/{events-IQg0k281.mjs → events-AEKh9tJm.mjs} +1 -1
  11. package/dist/{exports-GIRJm2Ja.mjs → exports-Ck4Xu3OV.mjs} +49 -3
  12. package/dist/{external-CYe424fO.mjs → external-BA2aCC_3.mjs} +1 -1
  13. package/dist/index.mjs +2 -2
  14. package/dist/index.node.mjs +1 -1
  15. package/dist/inspect/app.js +3 -3
  16. package/dist/{local-yKwdgukb.mjs → local-DJ_qI9q7.mjs} +5 -5
  17. package/dist/{main-DjokcEAL.mjs → main-Jz4nbNJi.mjs} +12 -10
  18. package/dist/{memory-7RRnLa4X.mjs → memory-DqwXlyK4.mjs} +2 -2
  19. package/dist/{serve-CJ8hauK2.mjs → serve-Puf3I-oI.mjs} +2 -2
  20. package/dist/{server-CtaTtyhw.mjs → server-CS-1aeTl.mjs} +3 -3
  21. package/dist/{sql-BQzKUqQt.mjs → sql-aetuEBZC.mjs} +1 -1
  22. package/dist/{sqlite-DCtZFEVm.mjs → sqlite-DvsB8ENQ.mjs} +2 -2
  23. package/dist/{sqlite-db-qLTs52Ny.mjs → sqlite-db-BPwRoDI7.mjs} +1 -1
  24. package/dist/sync-chat-sdk.mjs +2 -2
  25. package/dist/sync-github.mjs +2 -2
  26. package/dist/sync-linear.mjs +2 -2
  27. package/dist/sync-slack.mjs +3 -3
  28. package/dist/sync.mjs +2 -2
  29. package/dist/{targets-n2i2ZOWI.mjs → targets-Dk_xgS9q.mjs} +3 -3
  30. package/docs/01-board/03-identity.md +1 -1
  31. package/docs/01-board/09-access.md +1 -1
  32. package/docs/03-guides/03-ci.md +1 -1
  33. package/docs/04-reference/01-cli.md +4 -4
  34. package/docs/04-reference/02-board.md +5 -0
  35. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- import { t as local } from "./local-yKwdgukb.mjs";
1
+ import { t as local } from "./local-DJ_qI9q7.mjs";
2
2
  export { local };
@@ -1,5 +1,5 @@
1
- import "./external-CYe424fO.mjs";
2
- import { c as SyncProvider, s as ResolvedTarget } from "./events-IQg0k281.mjs";
1
+ import "./external-BA2aCC_3.mjs";
2
+ import { c as SyncProvider, s as ResolvedTarget } from "./events-AEKh9tJm.mjs";
3
3
  import { AsyncLocalStorage } from "node:async_hooks";
4
4
  import { Chat, stringifyMarkdown } from "chat";
5
5
  //#region src/sync/chat.ts
@@ -1,2 +1,2 @@
1
- import { a as OptionName, c as globalOptions, d as options, f as usage, i as CliOption, l as groups, n as CliCommand, o as commands, r as CliExample, s as filters, t as CliArgument, u as option } from "./commands-BorACIFS.mjs";
1
+ import { a as OptionName, c as globalOptions, d as options, f as usage, i as CliOption, l as groups, n as CliCommand, o as commands, r as CliExample, s as filters, t as CliArgument, u as option } from "./commands-DGID-4Z2.mjs";
2
2
  export { CliArgument, CliCommand, CliExample, CliOption, OptionName, commands, filters, globalOptions, groups, option, options, usage };
@@ -1,2 +1,2 @@
1
- import { a as option, i as groups, n as filters, o as options, r as globalOptions, s as usage, t as commands } from "./commands-CENWob9m.mjs";
1
+ import { a as option, i as groups, n as filters, o as options, r as globalOptions, s as usage, t as commands } from "./commands-BLtqSwha.mjs";
2
2
  export { commands, filters, globalOptions, groups, option, options, usage };
@@ -1,4 +1,4 @@
1
- import { a as commandLine, c as failureLines, i as mainWith, l as formatFailure, n as commandWord, o as exitCode, r as main, s as failureDocument, t as Failed } from "./main-DjokcEAL.mjs";
1
+ import { a as commandLine, c as failureLines, i as mainWith, l as formatFailure, n as commandWord, o as exitCode, r as main, s as failureDocument, t as Failed } from "./main-Jz4nbNJi.mjs";
2
2
  //#region src/cli/embedded.ts
3
3
  /**
4
4
  * Board's CLI as `appName` names it in help, usage, and errors (`vercel board`). With no board
package/dist/cli.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import { p as ATTACHMENT_BYTES_MAX } from "./errors-rYDxZEuN.mjs";
3
3
  import "./schemas-BG205xds.mjs";
4
- import { a as option } from "./commands-CENWob9m.mjs";
5
- import { d as projectDir } from "./server-CtaTtyhw.mjs";
6
- import { r as main, u as who } from "./main-DjokcEAL.mjs";
4
+ import { a as option } from "./commands-BLtqSwha.mjs";
5
+ import { d as projectDir } from "./server-CS-1aeTl.mjs";
6
+ import { r as main, u as who } from "./main-Jz4nbNJi.mjs";
7
7
  import { randomBytes, timingSafeEqual } from "node:crypto";
8
8
  import { appendFile, readFile } from "node:fs/promises";
9
9
  import { join } from "node:path";
@@ -661,7 +661,7 @@ const local = {
661
661
  if (args.length > 0) throw usage("serve takes no arguments: pass its port with --port, and its directory with --dir.");
662
662
  const port = portFlag();
663
663
  const root = projectDir();
664
- const { localHandle, serveLocal } = await import("./serve-CJ8hauK2.mjs");
664
+ const { localHandle, serveLocal } = await import("./serve-Puf3I-oI.mjs");
665
665
  const handle = flags.handle ?? process.env.BOARD_HANDLE;
666
666
  const local = await serveLocal({
667
667
  dir: flags.dir ?? join(root, ".board"),
@@ -220,6 +220,7 @@ const options = {
220
220
  project: {
221
221
  type: "string",
222
222
  multiple: true,
223
+ short: "p",
223
224
  value: "name|id",
224
225
  description: "a project's deployments"
225
226
  },
@@ -260,7 +261,8 @@ const options = {
260
261
  environment: {
261
262
  type: "string",
262
263
  multiple: true,
263
- value: "envs",
264
+ short: "e",
265
+ value: "environment",
264
266
  description: "where its --project runs"
265
267
  },
266
268
  workflow: {
@@ -269,7 +271,7 @@ const options = {
269
271
  value: "file",
270
272
  description: "its --github's workflow, e.g. ci.yml"
271
273
  },
272
- branch: {
274
+ "git-branch": {
273
275
  type: "string",
274
276
  multiple: true,
275
277
  value: "branch",
@@ -587,7 +589,7 @@ const commands = [
587
589
  option("environment", "where its --project runs (default: production)"),
588
590
  ...[
589
591
  "workflow",
590
- "branch",
592
+ "git-branch",
591
593
  "event",
592
594
  "claim"
593
595
  ].map((name) => option(name)),
@@ -608,7 +610,7 @@ const commands = [
608
610
  },
609
611
  {
610
612
  name: "two repositories' workflows",
611
- value: "grants create --github acme/web --workflow ci.yml --branch main --github acme/api --workflow deploy.yml --can 'ci/=post'"
613
+ value: "grants create --github acme/web --workflow ci.yml --git-branch main --github acme/api --workflow deploy.yml --can 'ci/=post'"
612
614
  },
613
615
  {
614
616
  name: "another issuer's tokens",
@@ -645,7 +647,7 @@ const commands = [
645
647
  "remove-everyone",
646
648
  "environment",
647
649
  "workflow",
648
- "branch",
650
+ "git-branch",
649
651
  "event",
650
652
  "claim"
651
653
  ].map((name) => option(name)), option("can", "replaces what it lets them do", "pattern=perms")],
@@ -673,7 +675,7 @@ const commands = [
673
675
  "app",
674
676
  "environment",
675
677
  "workflow",
676
- "branch",
678
+ "git-branch",
677
679
  "event",
678
680
  "claim"
679
681
  ].map((name) => option(name))],
@@ -268,6 +268,7 @@ declare const options: {
268
268
  readonly project: {
269
269
  readonly type: 'string';
270
270
  readonly multiple: true;
271
+ readonly short: 'p';
271
272
  readonly value: 'name|id';
272
273
  readonly description: "a project's deployments";
273
274
  };
@@ -308,7 +309,8 @@ declare const options: {
308
309
  readonly environment: {
309
310
  readonly type: 'string';
310
311
  readonly multiple: true;
311
- readonly value: 'envs';
312
+ readonly short: 'e';
313
+ readonly value: 'environment';
312
314
  readonly description: 'where its --project runs';
313
315
  };
314
316
  readonly workflow: {
@@ -317,7 +319,7 @@ declare const options: {
317
319
  readonly value: 'file';
318
320
  readonly description: "its --github's workflow, e.g. ci.yml";
319
321
  };
320
- readonly branch: {
322
+ readonly 'git-branch': {
321
323
  readonly type: 'string';
322
324
  readonly multiple: true;
323
325
  readonly value: 'branch';
@@ -1,11 +1,11 @@
1
1
  import { _ as fileSize, h as IMPORT_BYTES_MAX, p as ATTACHMENT_BYTES_MAX, r as badRequest, s as notFound, t as HttpError, y as typeOf } from "./errors-rYDxZEuN.mjs";
2
2
  import { a as ChannelPath, b as toStorable, d as MESSAGE_TEXT_MAX } from "./schemas-BG205xds.mjs";
3
- import { l as isThreadTarget, s as channelOf } from "./external-CYe424fO.mjs";
3
+ import { l as isThreadTarget, s as channelOf } from "./external-BA2aCC_3.mjs";
4
4
  import { t as canonicalEmoji } from "./emoji-CTLpvH-A.mjs";
5
5
  import { i as waitUntil, o as derivedId, t as DroppedError } from "./middleware-BxgizazV.mjs";
6
6
  import { n as replaceMentions } from "./mentions-CB6ShY4R.mjs";
7
7
  import { t as afterRetry } from "./attempts-HXcskN1w.mjs";
8
- import { a as immutable, d as routesFor, l as UnreadableError, n as SyncOverrides, o as ReceivedEvent, s as ResolvedTarget, u as channelMissing } from "./events-IQg0k281.mjs";
8
+ import { a as immutable, d as routesFor, l as UnreadableError, n as SyncOverrides, o as ReceivedEvent, s as ResolvedTarget, u as channelMissing } from "./events-AEKh9tJm.mjs";
9
9
  import { t as displayText } from "./bots-CGkO76qH.mjs";
10
10
  //#region src/sync/engine.ts
11
11
  /** `files`: a message with files may have no text. */
@@ -1,5 +1,5 @@
1
1
  import { c as LabelKey, u as Labels } from "./schemas-BG205xds.mjs";
2
- import { n as ExternalEvent, r as ExternalLocation } from "./external-CYe424fO.mjs";
2
+ import { n as ExternalEvent, r as ExternalLocation } from "./external-BA2aCC_3.mjs";
3
3
  import { z } from "zod";
4
4
  //#region src/sync/fn.ts
5
5
  const ROUTES = Symbol.for("board.syncRoutes");
@@ -1,6 +1,6 @@
1
1
  import { a as forbidden, c as toErrorResponse, d as createBoardClient, f as duration, g as fileName, h as IMPORT_BYTES_MAX, l as unauthorized, n as RejectedError, o as json, p as ATTACHMENT_BYTES_MAX, r as badRequest, s as notFound, t as HttpError, u as BoardError, v as mediaType } from "./errors-rYDxZEuN.mjs";
2
2
  import { m as RemoteWatcherId } from "./schemas-BG205xds.mjs";
3
- import { A as MessagesQuery, B as SyncCopiesQuery, C as InboxAckBody, D as LabelBody, E as InboxQuery, F as ScheduleBody, G as TokenBody, H as SyncImportBody, I as SchedulesQuery, J as UploadStartBody, K as TypingBody, L as SourceJoinBody, M as ReactBody, N as Ref, O as LinkedQuery, P as RegisterBody, R as SourceReadQuery, S as GrantBody, T as InboxPushBody, U as SyncReceiptBody, V as SyncFindQuery, W as ThreadsQuery, _ as CreateChannelBody, a as compileWatcher, b as EventsQuery, c as METHODS, d as queryObject, f as readCapped, g as AckBody, h as VERSION, i as canonicalWatchers, j as PostBody, k as MatchesQuery, l as createRouter, m as SYNC, n as syncTarget, p as readJson, q as UpdateGrantBody, r as withEmailMentions, t as mentionsEmails, u as openapi, v as DeleteBody, w as InboxNextQuery, x as ExplainQuery, y as EditBody, z as SyncBody } from "./targets-n2i2ZOWI.mjs";
3
+ import { A as MessagesQuery, B as SyncCopiesQuery, C as InboxAckBody, D as LabelBody, E as InboxQuery, F as ScheduleBody, G as TokenBody, H as SyncImportBody, I as SchedulesQuery, J as UploadStartBody, K as TypingBody, L as SourceJoinBody, M as ReactBody, N as Ref, O as LinkedQuery, P as RegisterBody, R as SourceReadQuery, S as GrantBody, T as InboxPushBody, U as SyncReceiptBody, V as SyncFindQuery, W as ThreadsQuery, _ as CreateChannelBody, a as compileWatcher, b as EventsQuery, c as METHODS, d as queryObject, f as readCapped, g as AckBody, h as VERSION, i as canonicalWatchers, j as PostBody, k as MatchesQuery, l as createRouter, m as SYNC, n as syncTarget, p as readJson, q as UpdateGrantBody, r as withEmailMentions, t as mentionsEmails, u as openapi, v as DeleteBody, w as InboxNextQuery, x as ExplainQuery, y as EditBody, z as SyncBody } from "./targets-Dk_xgS9q.mjs";
4
4
  import { i as waitUntil, l as sha256, o as derivedId, r as runMiddleware, t as DroppedError } from "./middleware-BxgizazV.mjs";
5
5
  import { d as scopeOf, l as parsePattern, r as PERMISSIONS, s as compileAccess, u as parseScope } from "./access-BsP0hvcC.mjs";
6
6
  import { S as verifiesTokens, T as explainGrants, a as VERCEL_ISSUER, d as fromTokens, f as grantIssuers, p as hostPrincipal, u as createAuthority, x as verifiedIssuers, y as tokenHash } from "./auth-CrjXLgOb.mjs";
@@ -861,13 +861,49 @@ function createVercel(options, environment) {
861
861
  });
862
862
  }
863
863
  }
864
- messages.sort((a, b) => a.message.createdAt - b.message.createdAt || a.thread.id.localeCompare(b.thread.id) || a.message.sequence - b.message.sequence);
864
+ messages.sort(byTime);
865
865
  return {
866
866
  messages,
867
867
  feeds,
868
868
  newest
869
869
  };
870
870
  }
871
+ /** A thread's messages in order; across threads, by time, as a person reads a channel. */
872
+ const byTime = (a, b) => a.message.createdAt - b.message.createdAt || a.message.threadId.localeCompare(b.message.threadId) || a.message.sequence - b.message.sequence;
873
+ /**
874
+ * The latest `limit` in `listed`, unfiltered: each channel's latest page from the API's message
875
+ * list, all at once, never a thread at a time. The list goes back one page, so a full page cuts the
876
+ * answer off at its oldest message: every message newer than the oldest it answers with is in it,
877
+ * even when that's fewer than `limit`. Each page's cursor is its channel's feed then, which the
878
+ * read's cursor goes on from.
879
+ */
880
+ async function latest(who, listed, limit, signal) {
881
+ const path = await onBoard(who, "/messages");
882
+ const asked = Math.min(limit, PAGE_MAX);
883
+ const pages = await Promise.all(listed.map(async (channel) => ({
884
+ channel,
885
+ ...await api(who, "GET", path, {
886
+ query: {
887
+ channelId: channel.id,
888
+ limit: String(asked)
889
+ },
890
+ signal
891
+ })
892
+ })));
893
+ const full = pages.filter((page) => page.messages.length === asked);
894
+ const cutoff = Math.max(-Infinity, ...full.map((page) => Math.min(...page.messages.map((message) => message.createdAt))));
895
+ return {
896
+ messages: pages.flatMap(({ channel, messages }) => messages.map((message) => ({
897
+ message,
898
+ channel
899
+ }))).filter(({ message }) => message.createdAt >= cutoff).sort(byTime).slice(-limit),
900
+ feeds: Object.fromEntries(pages.map((page) => [page.channel.id, {
901
+ at: page.cursor,
902
+ skip: 0
903
+ }])),
904
+ newest: Math.max(0, ...pages.flatMap((page) => page.messages.map((message) => message.createdAt)))
905
+ };
906
+ }
871
907
  /** A change in the API's feed as a board event, with the message as it is now. Null for what isn't a message's. */
872
908
  async function eventOf(who, change, channel, cursor, filters, me, given, threads = threadReader(who)) {
873
909
  if (!change.messageId || !change.type.startsWith("message.")) return null;
@@ -1401,10 +1437,20 @@ function createVercel(options, environment) {
1401
1437
  };
1402
1438
  }
1403
1439
  if (query.after !== void 0 && API_CURSOR.test(query.after)) throw new HttpError(400, "invalid_request", `after: ${query.after} is one channel's cursor: read that channel`);
1440
+ const limit = query.limit ?? 50;
1441
+ if (query.re === void 0 && query.after === void 0 && query.before === void 0 && !filtered(query)) {
1442
+ const { messages, feeds, newest } = await latest(who, await channelsFor(who, query.channel), limit, signal);
1443
+ return {
1444
+ messages: await Promise.all(messages.map(({ message, channel }) => view(who, message, channel.name))),
1445
+ cursor: cursorOf({
1446
+ t: newest,
1447
+ feeds
1448
+ })
1449
+ };
1450
+ }
1404
1451
  const { messages, feeds, newest } = await collect(who, query, signal);
1405
1452
  const after = query.after !== void 0 ? await timeOf(who, query.after) : void 0;
1406
1453
  const before = query.before !== void 0 ? await timeOf(who, query.before) : void 0;
1407
- const limit = query.limit ?? 50;
1408
1454
  const bounded = messages.filter(({ message }) => (after === void 0 || message.createdAt > after) && (before === void 0 || message.createdAt < before));
1409
1455
  const page = after !== void 0 ? bounded.slice(0, limit) : bounded.slice(-limit);
1410
1456
  return {
@@ -4,7 +4,7 @@ import { z } from "zod";
4
4
  /**
5
5
  * An external thread or channel, prefixed with its sync key:
6
6
  * `slack:C0123ABC` (a channel), `slack:C0123ABC:1727.1234` (a thread),
7
- * `github:basehub-ai/www:12` (a PR thread).
7
+ * `github:acme/web:12` (a PR thread).
8
8
  */
9
9
  const ExternalTarget = z.string().min(3).max(300);
10
10
  /** Where a message came from on a platform. `thread` is grouped (GitHub review threads fold into their PR). */
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { f as duration, t as HttpError, u as BoardError } from "./errors-rYDxZEuN.mjs";
2
2
  import { t as DroppedError } from "./middleware-BxgizazV.mjs";
3
- import { r as createVercel, t as createBoard } from "./exports-GIRJm2Ja.mjs";
3
+ import { r as createVercel, t as createBoard } from "./exports-Ck4Xu3OV.mjs";
4
4
  //#region src/backend-vercel/index.default.ts
5
5
  /**
6
6
  * Your team's board, in Vercel's API. Outside Node there's no environment to find credentials or
@@ -23,7 +23,7 @@ function board(options = {}) {
23
23
  if (!fetch) throw new Error("board: pass a fetch that sends credentials Vercel's API takes, or a backend: outside Node there's no environment to find them in");
24
24
  return vercel({ fetch });
25
25
  },
26
- sync: () => import("./engine-wN7quvbU.mjs"),
26
+ sync: () => import("./engine-B_prP0b8.mjs"),
27
27
  serving: null
28
28
  });
29
29
  }
@@ -1,4 +1,4 @@
1
1
  import { f as duration, t as HttpError, u as BoardError } from "./errors-rYDxZEuN.mjs";
2
2
  import { t as DroppedError } from "./middleware-BxgizazV.mjs";
3
- import { t as board } from "./server-CtaTtyhw.mjs";
3
+ import { t as board } from "./server-CS-1aeTl.mjs";
4
4
  export { BoardError, DroppedError, HttpError, board, duration };