@vercel/board 0.32.0 → 0.33.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 (166) hide show
  1. package/README.md +25 -20
  2. package/dist/{access-CY5xVMIK.mjs → access-N3XmkKXg.mjs} +3 -3
  3. package/dist/access.d.mts +4 -5
  4. package/dist/access.mjs +5 -5
  5. package/dist/{actors-Bm-ojWWT.mjs → actors-ihyN47OV.mjs} +3 -3
  6. package/dist/{auth-K8dY1nBY.d.mts → auth-D6z3rMNj.d.mts} +7 -93
  7. package/dist/{auth-8pRZnF1M.mjs → auth-r-_PeZyw.mjs} +32 -148
  8. package/dist/{backend-DxE9wGKm.d.mts → backend-CWpyR1A7.d.mts} +81 -51
  9. package/dist/backend-local.d.mts +28 -0
  10. package/dist/backend-local.mjs +2 -0
  11. package/dist/{chat-provider-DkFp2hrh.mjs → chat-provider-9hCT654s.mjs} +2 -2
  12. package/dist/{chat-provider-BChYrrA7.d.mts → chat-provider-DJpFUaFv.d.mts} +2 -3
  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 +1 -1
  17. package/dist/cli.mjs +6 -6
  18. package/dist/{commands-CpyPV_tk.d.mts → commands-BOBQHVqM.d.mts} +9 -0
  19. package/dist/{commands-DsnQKTdB.mjs → commands-CHoMl06v.mjs} +12 -1
  20. package/dist/{conformance-3RBKxwbp.mjs → conformance-qKmGLTAT.mjs} +5 -5
  21. package/dist/conformance.d.mts +1 -1
  22. package/dist/conformance.mjs +1 -1
  23. package/dist/{engine-DurYIRt8.mjs → engine-JxgZiikU.mjs} +6 -8
  24. package/dist/{errors-CJXhhzvT.mjs → errors-Pk0XV1hK.mjs} +56 -2
  25. package/dist/{events-lujPA3gQ.mjs → events-IQg0k281.mjs} +2 -2
  26. package/dist/exports-BuKjVq2t.d.mts +4 -0
  27. package/dist/exports-gHDHlg0i.mjs +3207 -0
  28. package/dist/{external-D3p5T57R.mjs → external-CYe424fO.mjs} +1 -1
  29. package/dist/{folds-DLUzfibJ.d.mts → folds-DjFTiqIM.d.mts} +38 -44
  30. package/dist/index-CXvvYNYj.d.mts +11 -0
  31. package/dist/index.d.mts +9 -8
  32. package/dist/index.mjs +21 -8
  33. package/dist/index.node.d.mts +5 -6
  34. package/dist/index.node.mjs +3 -3
  35. package/dist/inspect/app.js +95 -95
  36. package/dist/{internal-CvsrprnU-zZMpDiRY.mjs → internal-CvsrprnU-CEPOUpAv.mjs} +63 -43
  37. package/dist/local-BbLjA5vI.mjs +8818 -0
  38. package/dist/{main-CcYDo9Hb.mjs → main-CQpCZJFw.mjs} +91 -23
  39. package/dist/{backend-a2/store-memory.mjs → memory-7RRnLa4X.mjs} +3 -3
  40. package/dist/middleware-BU7rVi9F.mjs +103 -0
  41. package/dist/{client-COfYrgfV.d.mts → provider-BlzUvcM9.d.mts} +665 -5
  42. package/dist/{schemas-DBmUO6pr.mjs → schemas-BG205xds.mjs} +2 -5
  43. package/dist/{serve-Bplieh0C.mjs → serve-D8_W4UN6.mjs} +33 -24
  44. package/dist/{node-BgeGcwX0.mjs → server-BiIUXWbU.mjs} +419 -6
  45. package/dist/{serving-Y7s7VDjB.mjs → serving-D7rcUtSC.mjs} +1 -1
  46. package/dist/{sql-E1K5g_ih.mjs → sql-BQzKUqQt.mjs} +349 -114
  47. package/dist/sqlite-DCtZFEVm.mjs +30 -0
  48. package/dist/{sqlite-db-CzcD_FW8.mjs → sqlite-db-qLTs52Ny.mjs} +2 -3
  49. package/dist/{store-codec-pAG2oPgQ-SqDXlPBR.mjs → store-N8PXxDAS-BdL4Sq-f.mjs} +6 -2
  50. package/dist/{store-memory-B0PkVSuQ.mjs → store-memory-CKQVEzXN.mjs} +2 -4
  51. package/dist/store-memory-OdGsc-t_.mjs +2 -0
  52. package/dist/{store-polling-BZt2Rf3D-Div-bJ_D.mjs → store-polling-BZt2Rf3D-oh3aU_An.mjs} +1 -1
  53. package/dist/store-sqlite-CTxAVCcz.mjs +2 -0
  54. package/dist/{store-sqlite-D85t3tE7.mjs → store-sqlite-D6fIszST.mjs} +3 -4
  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 +2 -3
  60. package/dist/sync-linear.mjs +2 -2
  61. package/dist/sync-slack.d.mts +3 -3
  62. package/dist/sync-slack.mjs +4 -4
  63. package/dist/sync.d.mts +2 -2
  64. package/dist/sync.mjs +2 -2
  65. package/dist/{watchers-hash-CurCzwhe.mjs → targets-CknPGGVi.mjs} +40 -10
  66. package/dist/{tokens-C7kYyrAG.mjs → tokens-DPKjl3jf.mjs} +15 -43
  67. package/docs/01-board/01-mounting.md +243 -288
  68. package/docs/01-board/03-identity.md +41 -50
  69. package/docs/01-board/04-messages.md +15 -14
  70. package/docs/01-board/05-reading.md +3 -3
  71. package/docs/01-board/06-watchers.md +58 -105
  72. package/docs/01-board/07-schedules.md +21 -41
  73. package/docs/01-board/08-middleware.md +11 -17
  74. package/docs/01-board/09-access.md +76 -313
  75. package/docs/01-board/10-local.md +81 -0
  76. package/docs/01-quickstart.md +49 -126
  77. package/docs/02-sync/01-overview.md +25 -80
  78. package/docs/02-sync/02-functions.md +10 -16
  79. package/docs/02-sync/03-slack.md +13 -26
  80. package/docs/02-sync/04-github.md +8 -20
  81. package/docs/02-sync/07-linear.md +6 -10
  82. package/docs/03-guides/02-inspector.md +3 -3
  83. package/docs/03-guides/03-ci.md +88 -128
  84. package/docs/03-guides/04-triage.md +7 -15
  85. package/docs/03-guides/05-agent-factory.md +30 -36
  86. package/docs/04-reference/01-cli.md +104 -22
  87. package/docs/04-reference/02-board.md +60 -74
  88. package/docs/04-reference/03-http.md +119 -57
  89. package/docs/04-reference/05-conformance.md +31 -45
  90. package/docs/index.md +41 -65
  91. package/package.json +12 -83
  92. package/dist/a2-DiDc77Uf.mjs +0 -4238
  93. package/dist/access-DPcrKIH_.d.mts +0 -37
  94. package/dist/backend-a2/blob-vercel.d.mts +0 -8
  95. package/dist/backend-a2/blob-vercel.mjs +0 -81
  96. package/dist/backend-a2/contract.d.mts +0 -828
  97. package/dist/backend-a2/contract.mjs +0 -5
  98. package/dist/backend-a2/scheduler-local.d.mts +0 -11
  99. package/dist/backend-a2/scheduler-local.mjs +0 -2
  100. package/dist/backend-a2/scheduler-qstash.d.mts +0 -79
  101. package/dist/backend-a2/scheduler-qstash.mjs +0 -522
  102. package/dist/backend-a2/scheduler-vercel.d.mts +0 -38
  103. package/dist/backend-a2/scheduler-vercel.mjs +0 -204
  104. package/dist/backend-a2/store-memory.d.mts +0 -11
  105. package/dist/backend-a2/store-postgres.d.mts +0 -38
  106. package/dist/backend-a2/store-postgres.mjs +0 -2977
  107. package/dist/backend-a2/store-redis-http.d.mts +0 -17
  108. package/dist/backend-a2/store-redis-http.mjs +0 -520
  109. package/dist/backend-a2/store-redis.d.mts +0 -31
  110. package/dist/backend-a2/store-redis.mjs +0 -88
  111. package/dist/backend-a2/store-sqlite.d.mts +0 -12
  112. package/dist/backend-a2/store-sqlite.mjs +0 -31
  113. package/dist/backend-a2.d.mts +0 -2633
  114. package/dist/backend-a2.mjs +0 -3
  115. package/dist/backend-http-CaN06CaD.d.mts +0 -672
  116. package/dist/backend-http-CoaCghuJ.mjs +0 -18
  117. package/dist/backend-http-l5A8UmL-.mjs +0 -585
  118. package/dist/backend-http.d.mts +0 -10
  119. package/dist/backend-http.mjs +0 -2
  120. package/dist/backend-http.node.d.mts +0 -10
  121. package/dist/backend-http.node.mjs +0 -2
  122. package/dist/backend-vercel-BE65okBC.mjs +0 -86
  123. package/dist/backend-vercel-CVxoTNF2.mjs +0 -1744
  124. package/dist/backend-vercel-jg-6PAgD.d.mts +0 -674
  125. package/dist/backend-vercel.d.mts +0 -9
  126. package/dist/backend-vercel.mjs +0 -11
  127. package/dist/backend-vercel.node.d.mts +0 -17
  128. package/dist/backend-vercel.node.mjs +0 -2
  129. package/dist/blob-Bx8QPWEd.d.mts +0 -40
  130. package/dist/blob-WbB2DJKn.mjs +0 -201
  131. package/dist/errors-2vGs49Db.d.mts +0 -16
  132. package/dist/exports-BnUZuRm9.mjs +0 -1389
  133. package/dist/exports-u5mApVvn.d.mts +0 -5
  134. package/dist/files-SniSmeEr.mjs +0 -47
  135. package/dist/folds-DsWfIftc.mjs +0 -208
  136. package/dist/index-UXpTPWNc.d.mts +0 -11
  137. package/dist/index.default-Dp8gexln.mjs +0 -12
  138. package/dist/local-C76Fy5ad.mjs +0 -44
  139. package/dist/middleware-BavYSDUa.mjs +0 -62
  140. package/dist/platform-B4TnJtWu-Do3agKr5.mjs +0 -32
  141. package/dist/project-4Vl7_uy5.mjs +0 -124
  142. package/dist/provider-gynDUoyW.d.mts +0 -665
  143. package/dist/redis-tables-BFRj_SEJ.mjs +0 -3895
  144. package/dist/reducer-Bswr11ar-P324o9vn.mjs +0 -74
  145. package/dist/reducer-CYPHsSmd-BXjGiptm.d.mts +0 -170
  146. package/dist/reducers-DQVSP3kk.mjs +0 -538
  147. package/dist/retryable-lazy-DZWmHpii-DpTc5PIP.mjs +0 -19
  148. package/dist/scheduler-task-X1SToDjP-D2Il2rln.mjs +0 -69
  149. package/dist/server-B9gu0qi1-DI1WvcVK.d.mts +0 -391
  150. package/dist/server-DX7mM6nm-D7N_7bug.mjs +0 -3611
  151. package/dist/server-wIpAEjpX.mjs +0 -17
  152. package/dist/session-clear-XJYpmUpg-2q8l_FJR.mjs +0 -63
  153. package/dist/store-DEzcHZOA-B-5vhxef.d.mts +0 -540
  154. package/dist/store-N8PXxDAS-DWWgv-Vz.mjs +0 -5
  155. package/dist/store-memory-4IBl0Ztu.mjs +0 -2
  156. package/dist/store-presence-polling-JuAy2Ck2-Dh-g_KYM.mjs +0 -109
  157. package/dist/store-sqlite-iBTYYKBj.mjs +0 -2
  158. package/dist/stream-buffer-DrTyiIuo-Be10yOBR.mjs +0 -53
  159. package/dist/targets-Cgjs29T0.mjs +0 -33
  160. package/dist/types-CmrFjpml.d.mts +0 -102
  161. package/dist/wait-until-Dw4XrIDQ.mjs +0 -42
  162. package/docs/01-board/02-database.md +0 -258
  163. package/docs/04-reference/04-log.md +0 -247
  164. package/sql/postgres/board.sql +0 -145
  165. package/sql/postgres/notifications.sql +0 -24
  166. package/sql/postgres/schema.sql +0 -451
@@ -1,5 +1,5 @@
1
- import { g as withRoutes, i as eventSchema, p as into, r as envelope } from "./events-lujPA3gQ.mjs";
2
- import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-DkFp2hrh.mjs";
1
+ import { g as withRoutes, i as eventSchema, p as into, r as envelope } from "./events-IQg0k281.mjs";
2
+ import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-9hCT654s.mjs";
3
3
  import { n as tagOf } from "./tags-BpFo6q0_.mjs";
4
4
  import { z } from "zod";
5
5
  import { connectGitHubAdapter } from "@vercel/connect/chat";
@@ -1,6 +1,5 @@
1
- import { mt as SourceRead } from "./client-COfYrgfV.mjs";
2
- import { c as ReceivedEvent, d as ResolvedTarget, f as SyncContext, g as SyncFn, o as ProviderPost, r as ProviderDelivery, y as SyncUnit } from "./provider-gynDUoyW.mjs";
3
- import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-BChYrrA7.mjs";
1
+ import { Gt as SourceRead, c as ReceivedEvent, d as ResolvedTarget, f as SyncContext, g as SyncFn, o as ProviderPost, r as ProviderDelivery, y as SyncUnit } from "./provider-BlzUvcM9.mjs";
2
+ import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-DJpFUaFv.mjs";
4
3
  import { z } from "zod";
5
4
  import { Adapter } from "chat";
6
5
  //#region src/sync/linear.d.ts
@@ -1,5 +1,5 @@
1
- import { f as channels, i as eventSchema, l as UnreadableError, r as envelope } from "./events-lujPA3gQ.mjs";
2
- import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-DkFp2hrh.mjs";
1
+ import { f as channels, i as eventSchema, l as UnreadableError, r as envelope } from "./events-IQg0k281.mjs";
2
+ import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-9hCT654s.mjs";
3
3
  import { n as tagOf, t as slug } from "./tags-BpFo6q0_.mjs";
4
4
  import "zod";
5
5
  import { connectLinearAdapter } from "@vercel/connect/chat";
@@ -1,6 +1,6 @@
1
- import { f as ExternalLink } from "./folds-DLUzfibJ.mjs";
2
- import { b as channels, d as ResolvedTarget, f as SyncContext, g as SyncFn, o as ProviderPost, r as ProviderDelivery } from "./provider-gynDUoyW.mjs";
3
- import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-BChYrrA7.mjs";
1
+ import { c as ExternalLink } from "./folds-DjFTiqIM.mjs";
2
+ import { b as channels, d as ResolvedTarget, f as SyncContext, g as SyncFn, o as ProviderPost, r as ProviderDelivery } from "./provider-BlzUvcM9.mjs";
3
+ import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-DJpFUaFv.mjs";
4
4
  import { z } from "zod";
5
5
  import { Adapter } from "chat";
6
6
  //#region src/sync/slack.d.ts
@@ -1,7 +1,7 @@
1
- import { m as MESSAGE_TEXT_MAX } from "./schemas-DBmUO6pr.mjs";
2
- import "./external-D3p5T57R.mjs";
3
- import { f as channels, i as eventSchema, l as UnreadableError, r as envelope } from "./events-lujPA3gQ.mjs";
4
- import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-DkFp2hrh.mjs";
1
+ import { d as MESSAGE_TEXT_MAX } from "./schemas-BG205xds.mjs";
2
+ import "./external-CYe424fO.mjs";
3
+ import { f as channels, i as eventSchema, l as UnreadableError, r as envelope } from "./events-IQg0k281.mjs";
4
+ import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-9hCT654s.mjs";
5
5
  import { z } from "zod";
6
6
  import { stringifyMarkdown } from "chat";
7
7
  import { createSlackAdapter } from "@chat-adapter/slack";
package/dist/sync.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { d as ExternalFile, l as ExternalAuthor, u as ExternalEvent } from "./folds-DLUzfibJ.mjs";
2
- import { A as envelope, C as render, D as SyncOverrides, E as RootOverride, O as SyncResult, S as mirror, T as ProviderEvent, _ as SyncIn, a as ProviderOptions, b as channels, c as ReceivedEvent, d as ResolvedTarget, f as SyncContext, g as SyncFn, h as Sync, i as ProviderFile, j as eventSchema, k as SyncRoot, l as RenderInput, m as UnreadableError, n as FileDelivery, o as ProviderPost, p as SyncProvider, r as ProviderDelivery, s as Receive, u as Renderer, v as SyncOut, w as EventBase, x as into, y as SyncUnit } from "./provider-gynDUoyW.mjs";
1
+ import { a as ExternalAuthor, o as ExternalEvent, s as ExternalFile } from "./folds-DjFTiqIM.mjs";
2
+ import { A as envelope, C as render, D as SyncOverrides, E as RootOverride, O as SyncResult, S as mirror, T as ProviderEvent, _ as SyncIn, a as ProviderOptions, b as channels, c as ReceivedEvent, d as ResolvedTarget, f as SyncContext, g as SyncFn, h as Sync, i as ProviderFile, j as eventSchema, k as SyncRoot, l as RenderInput, m as UnreadableError, n as FileDelivery, o as ProviderPost, p as SyncProvider, r as ProviderDelivery, s as Receive, u as Renderer, v as SyncOut, w as EventBase, x as into, y as SyncUnit } from "./provider-BlzUvcM9.mjs";
3
3
  export { EventBase, type ExternalAuthor, ExternalEvent, type ExternalFile, type FileDelivery, type ProviderDelivery, type ProviderEvent, type ProviderFile, type ProviderOptions, type ProviderPost, type Receive, ReceivedEvent, type RenderInput, type Renderer, ResolvedTarget, type RootOverride, type Sync, type SyncContext, type SyncFn, type SyncIn, type SyncOut, SyncOverrides, SyncProvider, type SyncResult, type SyncRoot, type SyncUnit, UnreadableError, channels, envelope, eventSchema, into, mirror, render };
package/dist/sync.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { n as ExternalEvent } from "./external-D3p5T57R.mjs";
2
- import { c as SyncProvider, f as channels, h as render, i as eventSchema, l as UnreadableError, m as mirror, n as SyncOverrides, o as ReceivedEvent, p as into, r as envelope, s as ResolvedTarget, t as EventBase } from "./events-lujPA3gQ.mjs";
1
+ import { n as ExternalEvent } from "./external-CYe424fO.mjs";
2
+ import { c as SyncProvider, f as channels, h as render, i as eventSchema, l as UnreadableError, m as mirror, n as SyncOverrides, o as ReceivedEvent, p as into, r as envelope, s as ResolvedTarget, t as EventBase } from "./events-IQg0k281.mjs";
3
3
  export { EventBase, ExternalEvent, ReceivedEvent, ResolvedTarget, SyncOverrides, SyncProvider, UnreadableError, channels, envelope, eventSchema, into, mirror, render };
@@ -1,13 +1,13 @@
1
- import { n as DIRECT_UPLOAD_BYTES_MAX, t as ATTACHMENT_BYTES_MAX } from "./files-SniSmeEr.mjs";
2
- import { S as storable, a as AttachmentId, c as ChannelPath, d as LabelKey, f as LabelValue, g as MessageText, l as Emoji, m as MESSAGE_TEXT_MAX, p as Labels, x as platformAvatar } from "./schemas-DBmUO6pr.mjs";
3
- import { a as Link, i as ExternalTarget, n as ExternalEvent, o as Origin, t as ExternalAuthor } from "./external-D3p5T57R.mjs";
4
- import { r as badRequest, t as HttpError } from "./errors-CJXhhzvT.mjs";
5
- import { o as options } from "./commands-DsnQKTdB.mjs";
1
+ import { m as DIRECT_UPLOAD_BYTES_MAX, p as ATTACHMENT_BYTES_MAX, r as badRequest, t as HttpError } from "./errors-Pk0XV1hK.mjs";
2
+ import { a as ChannelPath, c as LabelKey, d as MESSAGE_TEXT_MAX, l as LabelValue, o as Emoji, p as MessageText, r as AttachmentId, u as Labels, v as platformAvatar, y as storable } from "./schemas-BG205xds.mjs";
3
+ import { a as Link, i as ExternalTarget, l as isThreadTarget, n as ExternalEvent, o as Origin, t as ExternalAuthor } from "./external-CYe424fO.mjs";
4
+ import { o as options } from "./commands-CHoMl06v.mjs";
5
+ import { n as replaceMentions, t as extractMentions } from "./mentions-CB6ShY4R.mjs";
6
6
  import { z } from "zod";
7
7
  //#region src/api/routes.ts
8
8
  /**
9
9
  * A message's, schedule's, or cursor's ID: a string clients pass back as they got it, and never
10
- * parse, compare, or count with. Each backend picks its own; a board on `a2()` writes decimals,
10
+ * parse, compare, or count with. Each backend picks its own; a board on `local()` writes decimals,
11
11
  * and `s12` for a schedule.
12
12
  */
13
13
  const Ref = z.string().min(1).max(128);
@@ -673,13 +673,13 @@ const routes = {
673
673
  }
674
674
  };
675
675
  //#endregion
676
+ //#region src/version.ts
677
+ const VERSION = "0.33.0";
678
+ //#endregion
676
679
  //#region src/server/backend.ts
677
680
  /** The subscription sync's outbound runs on, in `BoardBinding.subscriptions`. No watcher's ID starts with `@`. */
678
681
  const SYNC = "@sync";
679
682
  //#endregion
680
- //#region src/version.ts
681
- const VERSION = "0.32.0";
682
- //#endregion
683
683
  //#region src/server/routing.ts
684
684
  /** board()'s own routes: the files it serves, and sync's, which run where board() does. */
685
685
  const BOARD_ROUTES = [
@@ -1029,4 +1029,34 @@ function canonicalWatchers(watch, sync = []) {
1029
1029
  return JSON.stringify(canonical);
1030
1030
  }
1031
1031
  //#endregion
1032
- export { RegisterBody as A, ThreadsQuery as B, LabelBody as C, PostBody as D, MessagesQuery as E, SyncBody as F, TypingBody as H, SyncCopiesQuery as I, SyncFindQuery as L, SchedulesQuery as M, SourceJoinBody as N, ReactBody as O, SourceReadQuery as P, SyncImportBody as R, InboxQuery as S, MatchesQuery as T, UploadStartBody as U, TokenBody as V, routes as W, EventsQuery as _, METHODS as a, InboxNextQuery as b, queryObject as c, VERSION as d, SYNC as f, EditBody as g, DeleteBody as h, withMentions as i, ScheduleBody as j, Ref as k, readCapped as l, CreateChannelBody as m, compileWatcher as n, createRouter as o, AckBody as p, hasCriteria as r, openapi as s, canonicalWatchers as t, readJson as u, GrantBody as v, LinkedQuery as w, InboxPushBody as x, InboxAckBody as y, SyncReceiptBody as z };
1032
+ //#region src/server/targets.ts
1033
+ /** A target as a post or a receipt names it, resolved: a plain one's kind goes by its shape. */
1034
+ const syncTarget = (target) => typeof target === "string" ? {
1035
+ target,
1036
+ kind: isThreadTarget(target) ? "thread" : "channel"
1037
+ } : target;
1038
+ /** Whether `text` mentions anyone by email, `@[ada@vercel.com]`, which sync looks up. */
1039
+ const mentionsEmails = (text) => extractMentions(text).some((token) => token.kind === "actor" && token.actor.includes("@"));
1040
+ /**
1041
+ * `@[ada@vercel.com]`: each email `find` knows (a synced platform's user) becomes that user's
1042
+ * exact mention, `@[slack:user:U0456]`, so it reads natively there; the rest stay plain text.
1043
+ */
1044
+ async function withEmailMentions(text, find) {
1045
+ const emails = extractMentions(text).flatMap((token) => token.kind === "actor" && token.actor.includes("@") ? [token.actor] : []);
1046
+ if (emails.length === 0) return {
1047
+ text,
1048
+ found: []
1049
+ };
1050
+ const byEmail = /* @__PURE__ */ new Map();
1051
+ for (const email of emails) byEmail.set(email, await find?.(email).catch(() => null) ?? null);
1052
+ return {
1053
+ text: replaceMentions(text, (token) => {
1054
+ if (token.kind !== "actor" || !byEmail.has(token.actor)) return null;
1055
+ const actor = byEmail.get(token.actor);
1056
+ return actor ? `@[${actor.id}]` : token.actor;
1057
+ }),
1058
+ found: [...byEmail.values()].filter((actor) => actor !== null)
1059
+ };
1060
+ }
1061
+ //#endregion
1062
+ export { PostBody as A, SyncFindQuery as B, InboxNextQuery as C, LinkedQuery as D, LabelBody as E, SchedulesQuery as F, TypingBody as G, SyncReceiptBody as H, SourceJoinBody as I, UploadStartBody as K, SourceReadQuery as L, Ref as M, RegisterBody as N, MatchesQuery as O, ScheduleBody as P, SyncBody as R, InboxAckBody as S, InboxQuery as T, ThreadsQuery as U, SyncImportBody as V, TokenBody as W, CreateChannelBody as _, compileWatcher as a, EventsQuery as b, METHODS as c, queryObject as d, readCapped as f, AckBody as g, VERSION as h, canonicalWatchers as i, ReactBody as j, MessagesQuery as k, createRouter as l, SYNC as m, syncTarget as n, hasCriteria as o, readJson as p, routes as q, withEmailMentions as r, withMentions as s, mentionsEmails as t, openapi as u, DeleteBody as v, InboxPushBody as w, GrantBody as x, EditBody as y, SyncCopiesQuery as z };
@@ -1,5 +1,5 @@
1
- import { l as unauthorized } from "./errors-CJXhhzvT.mjs";
2
- import { a as VERCEL_ISSUER, b as trustedIssuers, g as markVerified, i as TOKENS, m as issuerName, v as privateHost } from "./auth-8pRZnF1M.mjs";
1
+ import { l as unauthorized } from "./errors-Pk0XV1hK.mjs";
2
+ import { a as VERCEL_ISSUER, f as issuerName, g as trustedIssuers, i as TOKENS, m as privateHost, p as markVerified } from "./auth-r-_PeZyw.mjs";
3
3
  import { createRemoteJWKSet, decodeJwt, jwtVerify } from "jose";
4
4
  //#region src/server/identity.ts
5
5
  let fromDisk;
@@ -26,20 +26,18 @@ function readLinkedProject() {
26
26
  }
27
27
  /**
28
28
  * The board's own Vercel project. Verification only trusts the project ID,
29
- * from config, the platform's `VERCEL_PROJECT_ID`, or the linked project.
29
+ * from the platform's `VERCEL_PROJECT_ID`, or the linked project.
30
30
  */
31
- async function ownProjectId(configured) {
32
- if (configured) return configured.id;
31
+ async function ownProjectId() {
33
32
  if (process.env.VERCEL_PROJECT_ID) return process.env.VERCEL_PROJECT_ID;
34
33
  return (await readLinkedProject()).projectId;
35
34
  }
36
35
  /**
37
- * The board's own team, from config, `VERCEL_ORG_ID`, or the linked project.
38
- * On Vercel there's usually none of these, so verification falls back to the
39
- * platform's token for the board's project.
36
+ * The board's own team, from `VERCEL_ORG_ID`, or the linked project. On Vercel
37
+ * there's usually neither, so verification falls back to the platform's token
38
+ * for the board's project.
40
39
  */
41
- async function ownTeamId(configured) {
42
- if (configured?.teamId) return configured.teamId;
40
+ async function ownTeamId() {
43
41
  if (process.env.VERCEL_ORG_ID) return process.env.VERCEL_ORG_ID;
44
42
  return (await readLinkedProject()).teamId;
45
43
  }
@@ -48,12 +46,8 @@ async function ownTeamId(configured) {
48
46
  * request token is decoded without trust, since a spoofed header can only
49
47
  * mislead the response it's attached to.
50
48
  */
51
- async function discoveryIdentity(headers, configured) {
52
- const projectId = await ownProjectId(configured);
53
- if (configured?.teamId) return {
54
- projectId,
55
- teamId: configured.teamId
56
- };
49
+ async function discoveryIdentity(headers) {
50
+ const projectId = await ownProjectId();
57
51
  const header = headers?.get("x-vercel-oidc-token");
58
52
  if (header) try {
59
53
  const claims = decodeJwt(header);
@@ -114,29 +108,12 @@ async function keysFor(iss) {
114
108
  remoteKeys.set(iss, keys);
115
109
  return keys;
116
110
  }
117
- /** What tokens are verified with: the platform's issuers, OIDC issuers the board's rules name, and test issuers. */
111
+ /** What tokens are verified with: the platform's issuers, OIDC issuers the board's grants name, and test issuers. */
118
112
  function createVerifier(options) {
119
113
  const vercelIssuer = options.auth?.vercel ?? { issuer: VERCEL_ISSUER };
120
114
  const githubIssuer = options.auth?.github ?? { issuer: "https://token.actions.githubusercontent.com" };
121
115
  const oidcIssuers = trustedIssuers(options.issuers);
122
- let platformTeam = null;
123
- /**
124
- * The team on a Vercel-signed token for the board's own project. Project IDs
125
- * are unique, so its `owner_id` is the board's team, whoever sent the token.
126
- */
127
- async function teamFrom(platformToken, ownProject) {
128
- if (platformTeam !== null || !platformToken || ownProject === null) return platformTeam;
129
- try {
130
- const iss = String(decodeJwt(platformToken).iss ?? "");
131
- if (!issuerMatches(iss, vercelIssuer.issuer)) return null;
132
- const keys = vercelIssuer.jwks ?? await keysFor(iss);
133
- const { payload } = await jwtVerify(platformToken, keys, { issuer: iss });
134
- if (payload.project_id === ownProject && typeof payload.owner_id === "string") platformTeam = payload.owner_id;
135
- } catch {}
136
- return platformTeam;
137
- }
138
- /** `platformToken`: the board's own OIDC token, which Vercel sends with each request. */
139
- async function verify(token, audience, platformToken) {
116
+ async function verify(token, audience) {
140
117
  let iss;
141
118
  try {
142
119
  iss = String(decodeJwt(token).iss ?? "");
@@ -191,11 +168,7 @@ function createVerifier(options) {
191
168
  expiresAt
192
169
  };
193
170
  }
194
- const teamId = await options.teamId() ?? await teamFrom(platformToken ?? process.env.VERCEL_OIDC_TOKEN, ownProject) ?? null;
195
- return deployment(teamId === null ? facts : {
196
- ...facts,
197
- team: teamId
198
- }, project, environment, expiresAt);
171
+ return deployment(facts, project, environment, expiresAt);
199
172
  }
200
173
  return { verify };
201
174
  }
@@ -236,7 +209,7 @@ const environmentBoard = {
236
209
  };
237
210
  /**
238
211
  * The OIDC tokens made out to this board: a request's bearer token, from Vercel (people and
239
- * deployments), GitHub Actions, an `oidc()` rule's issuer, or `local`'s (`vb serve`'s), verified
212
+ * deployments), GitHub Actions, an issuer a grant names, or `local`'s (`vb serve`'s), verified
240
213
  * for the board's URL. Null for a request with no token, and a 401 for one whose token fails.
241
214
  * Without `request.board`, the board's project is the environment's, and it trusts no issuer past
242
215
  * Vercel's and GitHub's.
@@ -252,12 +225,11 @@ function oidcTokens(options = {}) {
252
225
  issuers,
253
226
  verify: createVerifier({
254
227
  projectId: async () => (await board.project()).id,
255
- teamId: async () => (await board.project()).teamId,
256
228
  issuers: board.issuers,
257
229
  auth: options
258
230
  }).verify
259
231
  };
260
- return markVerified(await made.verify(request.credential, request.audience, request.headers.get("x-vercel-oidc-token") ?? void 0));
232
+ return markVerified(await made.verify(request.credential, request.audience));
261
233
  };
262
234
  return Object.assign(authenticate, { [TOKENS]: true });
263
235
  }