@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.
- package/README.md +25 -20
- package/dist/{access-CY5xVMIK.mjs → access-N3XmkKXg.mjs} +3 -3
- package/dist/access.d.mts +4 -5
- package/dist/access.mjs +5 -5
- package/dist/{actors-Bm-ojWWT.mjs → actors-ihyN47OV.mjs} +3 -3
- package/dist/{auth-K8dY1nBY.d.mts → auth-D6z3rMNj.d.mts} +7 -93
- package/dist/{auth-8pRZnF1M.mjs → auth-r-_PeZyw.mjs} +32 -148
- package/dist/{backend-DxE9wGKm.d.mts → backend-CWpyR1A7.d.mts} +81 -51
- package/dist/backend-local.d.mts +28 -0
- package/dist/backend-local.mjs +2 -0
- package/dist/{chat-provider-DkFp2hrh.mjs → chat-provider-9hCT654s.mjs} +2 -2
- package/dist/{chat-provider-BChYrrA7.d.mts → chat-provider-DJpFUaFv.d.mts} +2 -3
- package/dist/cli-commands.d.mts +1 -1
- package/dist/cli-commands.mjs +1 -1
- package/dist/cli-embedded.d.mts +2 -2
- package/dist/cli-embedded.mjs +1 -1
- package/dist/cli.mjs +6 -6
- package/dist/{commands-CpyPV_tk.d.mts → commands-BOBQHVqM.d.mts} +9 -0
- package/dist/{commands-DsnQKTdB.mjs → commands-CHoMl06v.mjs} +12 -1
- package/dist/{conformance-3RBKxwbp.mjs → conformance-qKmGLTAT.mjs} +5 -5
- package/dist/conformance.d.mts +1 -1
- package/dist/conformance.mjs +1 -1
- package/dist/{engine-DurYIRt8.mjs → engine-JxgZiikU.mjs} +6 -8
- package/dist/{errors-CJXhhzvT.mjs → errors-Pk0XV1hK.mjs} +56 -2
- package/dist/{events-lujPA3gQ.mjs → events-IQg0k281.mjs} +2 -2
- package/dist/exports-BuKjVq2t.d.mts +4 -0
- package/dist/exports-gHDHlg0i.mjs +3207 -0
- package/dist/{external-D3p5T57R.mjs → external-CYe424fO.mjs} +1 -1
- package/dist/{folds-DLUzfibJ.d.mts → folds-DjFTiqIM.d.mts} +38 -44
- package/dist/index-CXvvYNYj.d.mts +11 -0
- package/dist/index.d.mts +9 -8
- package/dist/index.mjs +21 -8
- package/dist/index.node.d.mts +5 -6
- package/dist/index.node.mjs +3 -3
- package/dist/inspect/app.js +95 -95
- package/dist/{internal-CvsrprnU-zZMpDiRY.mjs → internal-CvsrprnU-CEPOUpAv.mjs} +63 -43
- package/dist/local-BbLjA5vI.mjs +8818 -0
- package/dist/{main-CcYDo9Hb.mjs → main-CQpCZJFw.mjs} +91 -23
- package/dist/{backend-a2/store-memory.mjs → memory-7RRnLa4X.mjs} +3 -3
- package/dist/middleware-BU7rVi9F.mjs +103 -0
- package/dist/{client-COfYrgfV.d.mts → provider-BlzUvcM9.d.mts} +665 -5
- package/dist/{schemas-DBmUO6pr.mjs → schemas-BG205xds.mjs} +2 -5
- package/dist/{serve-Bplieh0C.mjs → serve-D8_W4UN6.mjs} +33 -24
- package/dist/{node-BgeGcwX0.mjs → server-BiIUXWbU.mjs} +419 -6
- package/dist/{serving-Y7s7VDjB.mjs → serving-D7rcUtSC.mjs} +1 -1
- package/dist/{sql-E1K5g_ih.mjs → sql-BQzKUqQt.mjs} +349 -114
- package/dist/sqlite-DCtZFEVm.mjs +30 -0
- package/dist/{sqlite-db-CzcD_FW8.mjs → sqlite-db-qLTs52Ny.mjs} +2 -3
- package/dist/{store-codec-pAG2oPgQ-SqDXlPBR.mjs → store-N8PXxDAS-BdL4Sq-f.mjs} +6 -2
- package/dist/{store-memory-B0PkVSuQ.mjs → store-memory-CKQVEzXN.mjs} +2 -4
- package/dist/store-memory-OdGsc-t_.mjs +2 -0
- package/dist/{store-polling-BZt2Rf3D-Div-bJ_D.mjs → store-polling-BZt2Rf3D-oh3aU_An.mjs} +1 -1
- package/dist/store-sqlite-CTxAVCcz.mjs +2 -0
- package/dist/{store-sqlite-D85t3tE7.mjs → store-sqlite-D6fIszST.mjs} +3 -4
- package/dist/sync-chat-sdk.d.mts +2 -2
- package/dist/sync-chat-sdk.mjs +2 -2
- package/dist/sync-github.d.mts +2 -2
- package/dist/sync-github.mjs +2 -2
- package/dist/sync-linear.d.mts +2 -3
- package/dist/sync-linear.mjs +2 -2
- package/dist/sync-slack.d.mts +3 -3
- package/dist/sync-slack.mjs +4 -4
- package/dist/sync.d.mts +2 -2
- package/dist/sync.mjs +2 -2
- package/dist/{watchers-hash-CurCzwhe.mjs → targets-CknPGGVi.mjs} +40 -10
- package/dist/{tokens-C7kYyrAG.mjs → tokens-DPKjl3jf.mjs} +15 -43
- package/docs/01-board/01-mounting.md +243 -288
- package/docs/01-board/03-identity.md +41 -50
- package/docs/01-board/04-messages.md +15 -14
- package/docs/01-board/05-reading.md +3 -3
- package/docs/01-board/06-watchers.md +58 -105
- package/docs/01-board/07-schedules.md +21 -41
- package/docs/01-board/08-middleware.md +11 -17
- package/docs/01-board/09-access.md +76 -313
- package/docs/01-board/10-local.md +81 -0
- package/docs/01-quickstart.md +49 -126
- package/docs/02-sync/01-overview.md +25 -80
- package/docs/02-sync/02-functions.md +10 -16
- package/docs/02-sync/03-slack.md +13 -26
- package/docs/02-sync/04-github.md +8 -20
- package/docs/02-sync/07-linear.md +6 -10
- package/docs/03-guides/02-inspector.md +3 -3
- package/docs/03-guides/03-ci.md +88 -128
- package/docs/03-guides/04-triage.md +7 -15
- package/docs/03-guides/05-agent-factory.md +30 -36
- package/docs/04-reference/01-cli.md +104 -22
- package/docs/04-reference/02-board.md +60 -74
- package/docs/04-reference/03-http.md +119 -57
- package/docs/04-reference/05-conformance.md +31 -45
- package/docs/index.md +41 -65
- package/package.json +12 -83
- package/dist/a2-DiDc77Uf.mjs +0 -4238
- package/dist/access-DPcrKIH_.d.mts +0 -37
- package/dist/backend-a2/blob-vercel.d.mts +0 -8
- package/dist/backend-a2/blob-vercel.mjs +0 -81
- package/dist/backend-a2/contract.d.mts +0 -828
- package/dist/backend-a2/contract.mjs +0 -5
- package/dist/backend-a2/scheduler-local.d.mts +0 -11
- package/dist/backend-a2/scheduler-local.mjs +0 -2
- package/dist/backend-a2/scheduler-qstash.d.mts +0 -79
- package/dist/backend-a2/scheduler-qstash.mjs +0 -522
- package/dist/backend-a2/scheduler-vercel.d.mts +0 -38
- package/dist/backend-a2/scheduler-vercel.mjs +0 -204
- package/dist/backend-a2/store-memory.d.mts +0 -11
- package/dist/backend-a2/store-postgres.d.mts +0 -38
- package/dist/backend-a2/store-postgres.mjs +0 -2977
- package/dist/backend-a2/store-redis-http.d.mts +0 -17
- package/dist/backend-a2/store-redis-http.mjs +0 -520
- package/dist/backend-a2/store-redis.d.mts +0 -31
- package/dist/backend-a2/store-redis.mjs +0 -88
- package/dist/backend-a2/store-sqlite.d.mts +0 -12
- package/dist/backend-a2/store-sqlite.mjs +0 -31
- package/dist/backend-a2.d.mts +0 -2633
- package/dist/backend-a2.mjs +0 -3
- package/dist/backend-http-CaN06CaD.d.mts +0 -672
- package/dist/backend-http-CoaCghuJ.mjs +0 -18
- package/dist/backend-http-l5A8UmL-.mjs +0 -585
- package/dist/backend-http.d.mts +0 -10
- package/dist/backend-http.mjs +0 -2
- package/dist/backend-http.node.d.mts +0 -10
- package/dist/backend-http.node.mjs +0 -2
- package/dist/backend-vercel-BE65okBC.mjs +0 -86
- package/dist/backend-vercel-CVxoTNF2.mjs +0 -1744
- package/dist/backend-vercel-jg-6PAgD.d.mts +0 -674
- package/dist/backend-vercel.d.mts +0 -9
- package/dist/backend-vercel.mjs +0 -11
- package/dist/backend-vercel.node.d.mts +0 -17
- package/dist/backend-vercel.node.mjs +0 -2
- package/dist/blob-Bx8QPWEd.d.mts +0 -40
- package/dist/blob-WbB2DJKn.mjs +0 -201
- package/dist/errors-2vGs49Db.d.mts +0 -16
- package/dist/exports-BnUZuRm9.mjs +0 -1389
- package/dist/exports-u5mApVvn.d.mts +0 -5
- package/dist/files-SniSmeEr.mjs +0 -47
- package/dist/folds-DsWfIftc.mjs +0 -208
- package/dist/index-UXpTPWNc.d.mts +0 -11
- package/dist/index.default-Dp8gexln.mjs +0 -12
- package/dist/local-C76Fy5ad.mjs +0 -44
- package/dist/middleware-BavYSDUa.mjs +0 -62
- package/dist/platform-B4TnJtWu-Do3agKr5.mjs +0 -32
- package/dist/project-4Vl7_uy5.mjs +0 -124
- package/dist/provider-gynDUoyW.d.mts +0 -665
- package/dist/redis-tables-BFRj_SEJ.mjs +0 -3895
- package/dist/reducer-Bswr11ar-P324o9vn.mjs +0 -74
- package/dist/reducer-CYPHsSmd-BXjGiptm.d.mts +0 -170
- package/dist/reducers-DQVSP3kk.mjs +0 -538
- package/dist/retryable-lazy-DZWmHpii-DpTc5PIP.mjs +0 -19
- package/dist/scheduler-task-X1SToDjP-D2Il2rln.mjs +0 -69
- package/dist/server-B9gu0qi1-DI1WvcVK.d.mts +0 -391
- package/dist/server-DX7mM6nm-D7N_7bug.mjs +0 -3611
- package/dist/server-wIpAEjpX.mjs +0 -17
- package/dist/session-clear-XJYpmUpg-2q8l_FJR.mjs +0 -63
- package/dist/store-DEzcHZOA-B-5vhxef.d.mts +0 -540
- package/dist/store-N8PXxDAS-DWWgv-Vz.mjs +0 -5
- package/dist/store-memory-4IBl0Ztu.mjs +0 -2
- package/dist/store-presence-polling-JuAy2Ck2-Dh-g_KYM.mjs +0 -109
- package/dist/store-sqlite-iBTYYKBj.mjs +0 -2
- package/dist/stream-buffer-DrTyiIuo-Be10yOBR.mjs +0 -53
- package/dist/targets-Cgjs29T0.mjs +0 -33
- package/dist/types-CmrFjpml.d.mts +0 -102
- package/dist/wait-until-Dw4XrIDQ.mjs +0 -42
- package/docs/01-board/02-database.md +0 -258
- package/docs/04-reference/04-log.md +0 -247
- package/sql/postgres/board.sql +0 -145
- package/sql/postgres/notifications.sql +0 -24
- package/sql/postgres/schema.sql +0 -451
package/dist/sync-github.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as withRoutes, i as eventSchema, p as into, r as envelope } from "./events-
|
|
2
|
-
import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-
|
|
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";
|
package/dist/sync-linear.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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
|
package/dist/sync-linear.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { f as channels, i as eventSchema, l as UnreadableError, r as envelope } from "./events-
|
|
2
|
-
import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-
|
|
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";
|
package/dist/sync-slack.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { b as channels, d as ResolvedTarget, f as SyncContext, g as SyncFn, o as ProviderPost, r as ProviderDelivery } from "./provider-
|
|
3
|
-
import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-
|
|
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
|
package/dist/sync-slack.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./external-
|
|
3
|
-
import { f as channels, i as eventSchema, l as UnreadableError, r as envelope } from "./events-
|
|
4
|
-
import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-
|
|
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 {
|
|
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-
|
|
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-
|
|
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-
|
|
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 {
|
|
2
|
-
import {
|
|
3
|
-
import { a as Link, i as ExternalTarget, n as ExternalEvent, o as Origin, t as ExternalAuthor } from "./external-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
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 `
|
|
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
|
-
|
|
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-
|
|
2
|
-
import { a as VERCEL_ISSUER,
|
|
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
|
|
29
|
+
* from the platform's `VERCEL_PROJECT_ID`, or the linked project.
|
|
30
30
|
*/
|
|
31
|
-
async function ownProjectId(
|
|
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
|
|
38
|
-
*
|
|
39
|
-
*
|
|
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(
|
|
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
|
|
52
|
-
const projectId = await ownProjectId(
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
232
|
+
return markVerified(await made.verify(request.credential, request.audience));
|
|
261
233
|
};
|
|
262
234
|
return Object.assign(authenticate, { [TOKENS]: true });
|
|
263
235
|
}
|