@vercel/board 0.32.0 → 0.34.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-CdBcYPQH.mjs} +170 -13
- package/dist/access.d.mts +4 -5
- package/dist/access.mjs +5 -5
- package/dist/{actors-Bm-ojWWT.mjs → actors-MrIEr9LI.mjs} +3 -3
- package/dist/auth-DjoJygbG.mjs +599 -0
- package/dist/{auth-K8dY1nBY.d.mts → auth-aaoKt5DK.d.mts} +133 -100
- package/dist/backend-local.d.mts +28 -0
- package/dist/backend-local.mjs +2 -0
- package/dist/{backend-DxE9wGKm.d.mts → backend-u1sVvybh.d.mts} +108 -55
- package/dist/{chat-provider-DkFp2hrh.mjs → chat-provider-9hCT654s.mjs} +2 -2
- package/dist/{chat-provider-BChYrrA7.d.mts → chat-provider-De0iDnUB.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-DsnQKTdB.mjs → commands-B8oZEByR.mjs} +37 -52
- package/dist/{commands-CpyPV_tk.d.mts → commands-BkVMdXP1.d.mts} +9 -6
- package/dist/{conformance-3RBKxwbp.mjs → conformance-gqYBkXFS.mjs} +79 -86
- package/dist/conformance.d.mts +1 -1
- package/dist/conformance.mjs +1 -1
- package/dist/{engine-DurYIRt8.mjs → engine-rtOVWsiF.mjs} +6 -8
- package/dist/{errors-CJXhhzvT.mjs → errors-D8ifv16L.mjs} +75 -6
- package/dist/{events-lujPA3gQ.mjs → events-IQg0k281.mjs} +2 -2
- package/dist/exports-Bx2dGpzr.mjs +3252 -0
- package/dist/exports-uwRl5qIj.d.mts +4 -0
- package/dist/{external-D3p5T57R.mjs → external-CYe424fO.mjs} +1 -1
- package/dist/index-D6mK0Ial.d.mts +11 -0
- package/dist/index.d.mts +10 -9
- package/dist/index.mjs +21 -8
- package/dist/index.node.d.mts +6 -7
- 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-CPz22MQ8.mjs +9225 -0
- package/dist/{main-CcYDo9Hb.mjs → main-DScDKwQN.mjs} +129 -54
- package/dist/{backend-a2/store-memory.mjs → memory-7RRnLa4X.mjs} +3 -3
- package/dist/middleware-BjYpk4yq.mjs +103 -0
- package/dist/{provider-gynDUoyW.d.mts → provider-hB8QNrwm.d.mts} +369 -3
- package/dist/{client-COfYrgfV.d.mts → routes-De4W6lEs.d.mts} +997 -367
- package/dist/{schemas-DBmUO6pr.mjs → schemas-BG205xds.mjs} +2 -5
- package/dist/{serve-Bplieh0C.mjs → serve-B1noQRkn.mjs} +33 -24
- package/dist/{node-BgeGcwX0.mjs → server-Ov6GBJ8j.mjs} +419 -6
- package/dist/{serving-Y7s7VDjB.mjs → serving-2s7lqSBS.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 +3 -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-aMdbp84G.mjs} +134 -16
- package/dist/{tokens-C7kYyrAG.mjs → tokens-LHLrnV_P.mjs} +15 -43
- package/docs/01-board/01-mounting.md +245 -288
- package/docs/01-board/03-identity.md +42 -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 +187 -343
- 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 +29 -36
- package/docs/04-reference/01-cli.md +113 -38
- package/docs/04-reference/02-board.md +79 -82
- package/docs/04-reference/03-http.md +138 -69
- package/docs/04-reference/05-conformance.md +32 -46
- 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/auth-8pRZnF1M.mjs +0 -393
- 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-DLUzfibJ.d.mts +0 -558
- 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/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,6 @@
|
|
|
1
|
-
import {
|
|
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-
|
|
3
|
-
import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-
|
|
1
|
+
import { ot as SourceRead } from "./routes-De4W6lEs.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-hB8QNrwm.mjs";
|
|
3
|
+
import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-De0iDnUB.mjs";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { Adapter } from "chat";
|
|
6
6
|
//#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 { an as ExternalLink } from "./routes-De4W6lEs.mjs";
|
|
2
|
+
import { b as channels, d as ResolvedTarget, f as SyncContext, g as SyncFn, o as ProviderPost, r as ProviderDelivery } from "./provider-hB8QNrwm.mjs";
|
|
3
|
+
import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-De0iDnUB.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 { in as ExternalFile, nn as ExternalAuthor, rn as ExternalEvent } from "./routes-De4W6lEs.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-hB8QNrwm.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-D8ifv16L.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-B8oZEByR.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);
|
|
@@ -132,12 +132,87 @@ const CanGrant = z.union([z.literal("all"), z.array(z.string().min(1).max(16)).m
|
|
|
132
132
|
/** What a grant or token lets do: `'all'`, a list for every channel, or a map from channel pattern to one. board() checks the patterns. */
|
|
133
133
|
const Can = z.union([CanGrant, z.record(z.string().min(1).max(300), CanGrant)]);
|
|
134
134
|
const ClaimValue = z.string().min(1).max(1e3);
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
135
|
+
const Environments = z.array(z.string().min(1).max(100)).min(1).max(16);
|
|
136
|
+
/**
|
|
137
|
+
* Who a grant names, as people write it: a user by email (or, where the board can't look one up,
|
|
138
|
+
* by ID), a project by name or ID, a repository by `owner/name`. The board resolves names and keeps
|
|
139
|
+
* IDs; a board that verifies tokens itself takes IDs only. A `user` names `email` or `userId`.
|
|
140
|
+
* Nothing else: a key it doesn't know (a misspelled `workflows`, say) is a 400, never dropped,
|
|
141
|
+
* since dropping it would name more than was meant.
|
|
142
|
+
*/
|
|
143
|
+
const PrincipalInput = z.discriminatedUnion("kind", [
|
|
144
|
+
z.strictObject({
|
|
145
|
+
kind: z.literal("user"),
|
|
146
|
+
email: z.string().min(3).max(320).optional(),
|
|
147
|
+
userId: z.string().min(1).max(200).optional()
|
|
148
|
+
}),
|
|
149
|
+
z.strictObject({
|
|
150
|
+
kind: z.literal("project"),
|
|
151
|
+
project: z.string().min(1).max(200),
|
|
152
|
+
environments: Environments.optional()
|
|
153
|
+
}),
|
|
154
|
+
z.strictObject({
|
|
155
|
+
kind: z.literal("github"),
|
|
156
|
+
repository: z.string().min(3).max(200),
|
|
157
|
+
workflow: z.string().min(1).max(300).optional(),
|
|
158
|
+
branch: z.string().min(1).max(255).optional(),
|
|
159
|
+
event: z.string().min(1).max(64).optional()
|
|
160
|
+
}),
|
|
161
|
+
z.strictObject({
|
|
162
|
+
kind: z.literal("oidc"),
|
|
163
|
+
issuer: z.string().min(1).max(1e3),
|
|
164
|
+
claims: z.record(z.string().min(1).max(200), z.union([ClaimValue, z.array(ClaimValue).min(1).max(32)]))
|
|
165
|
+
}),
|
|
166
|
+
z.strictObject({ kind: z.literal("all-users") }),
|
|
167
|
+
z.strictObject({
|
|
168
|
+
kind: z.literal("all-projects"),
|
|
169
|
+
environments: Environments.optional()
|
|
170
|
+
}),
|
|
171
|
+
z.strictObject({
|
|
172
|
+
kind: z.literal("app"),
|
|
173
|
+
app: z.string().min(1).max(200)
|
|
174
|
+
}),
|
|
175
|
+
z.strictObject({ kind: z.literal("all-apps") }),
|
|
176
|
+
z.strictObject({ kind: z.literal("everyone") })
|
|
177
|
+
]);
|
|
178
|
+
/** What a grant lets its principals do: a map from channel pattern to `'all'` or a list, `[]` for none. Kept as written. */
|
|
179
|
+
const GrantCan = z.record(z.string().min(1).max(300), CanGrant);
|
|
180
|
+
/** A grant: who it names, and one `can` for all of them. The same principals again are another grant. */
|
|
181
|
+
const GrantBody = z.strictObject({
|
|
182
|
+
principals: z.array(PrincipalInput).min(1).max(32),
|
|
183
|
+
can: GrantCan
|
|
140
184
|
});
|
|
185
|
+
/**
|
|
186
|
+
* Which grant decides a channel, and what it gives, for the caller or a principal it names: a
|
|
187
|
+
* `user` (by email, or by ID where the board can't look one up), a `project` in one `environment`
|
|
188
|
+
* (production by default), a `github` repository's run (with its `workflow`, `branch`, and
|
|
189
|
+
* `event`), or an `oidc` issuer's token with each `claim` as `name=value`.
|
|
190
|
+
*/
|
|
191
|
+
const ExplainQuery = z.object({
|
|
192
|
+
channel: ChannelPath,
|
|
193
|
+
user: z.string().min(1).max(320).optional(),
|
|
194
|
+
project: z.string().min(1).max(200).optional(),
|
|
195
|
+
environment: z.string().min(1).max(100).optional(),
|
|
196
|
+
github: z.string().min(3).max(200).optional(),
|
|
197
|
+
workflow: z.string().min(1).max(300).optional(),
|
|
198
|
+
branch: z.string().min(1).max(255).optional(),
|
|
199
|
+
event: z.string().min(1).max(64).optional(),
|
|
200
|
+
oidc: z.string().min(1).max(1e3).optional(),
|
|
201
|
+
claim: repeated.optional(),
|
|
202
|
+
app: z.string().min(1).max(200).optional()
|
|
203
|
+
}).refine((query) => [
|
|
204
|
+
query.user,
|
|
205
|
+
query.project,
|
|
206
|
+
query.github,
|
|
207
|
+
query.oidc,
|
|
208
|
+
query.app
|
|
209
|
+
].filter((value) => value !== void 0).length <= 1, "name one principal: user, project, github, oidc, or app").refine((query) => query.environment === void 0 || query.project !== void 0, "environment goes with project").refine((query) => query.workflow === void 0 && query.branch === void 0 && query.event === void 0 || query.github !== void 0, "workflow, branch, and event go with github").refine((query) => query.claim === void 0 || query.oidc !== void 0, "claim goes with oidc");
|
|
210
|
+
/** A grant's change: principals to add and to remove, and a `can` to replace its own. */
|
|
211
|
+
const UpdateGrantBody = z.strictObject({
|
|
212
|
+
add: z.array(PrincipalInput).min(1).max(32).optional(),
|
|
213
|
+
remove: z.array(PrincipalInput).min(1).max(32).optional(),
|
|
214
|
+
can: GrantCan.optional()
|
|
215
|
+
}).refine((body) => body.add !== void 0 || body.remove !== void 0 || body.can !== void 0, "name principals to add or remove, or a can");
|
|
141
216
|
/** A token acting as the caller: what it may do, and the profile and session every request with it writes as. */
|
|
142
217
|
const TokenBody = z.object({
|
|
143
218
|
name: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/, "a token name is up to 64 letters, numbers, and ._-"),
|
|
@@ -509,7 +584,7 @@ const routes = {
|
|
|
509
584
|
method: "POST",
|
|
510
585
|
path: "/schedules/:id/cancel"
|
|
511
586
|
},
|
|
512
|
-
/**
|
|
587
|
+
/** Listing grants needs manage at `*`; changing one, manage at each pattern its `can` names. Team owners always may. */
|
|
513
588
|
grants: {
|
|
514
589
|
method: "GET",
|
|
515
590
|
path: "/grants"
|
|
@@ -519,6 +594,17 @@ const routes = {
|
|
|
519
594
|
path: "/grants",
|
|
520
595
|
body: GrantBody
|
|
521
596
|
},
|
|
597
|
+
updateGrant: {
|
|
598
|
+
method: "PATCH",
|
|
599
|
+
path: "/grants/:id",
|
|
600
|
+
body: UpdateGrantBody
|
|
601
|
+
},
|
|
602
|
+
/** Which grant decides a channel, for the caller or, with `manage` at `*`, a principal it names. */
|
|
603
|
+
explain: {
|
|
604
|
+
method: "GET",
|
|
605
|
+
path: "/grants/explain",
|
|
606
|
+
query: ExplainQuery
|
|
607
|
+
},
|
|
522
608
|
revokeGrant: {
|
|
523
609
|
method: "POST",
|
|
524
610
|
path: "/grants/:id/revoke"
|
|
@@ -673,13 +759,13 @@ const routes = {
|
|
|
673
759
|
}
|
|
674
760
|
};
|
|
675
761
|
//#endregion
|
|
762
|
+
//#region src/version.ts
|
|
763
|
+
const VERSION = "0.34.0";
|
|
764
|
+
//#endregion
|
|
676
765
|
//#region src/server/backend.ts
|
|
677
766
|
/** The subscription sync's outbound runs on, in `BoardBinding.subscriptions`. No watcher's ID starts with `@`. */
|
|
678
767
|
const SYNC = "@sync";
|
|
679
768
|
//#endregion
|
|
680
|
-
//#region src/version.ts
|
|
681
|
-
const VERSION = "0.32.0";
|
|
682
|
-
//#endregion
|
|
683
769
|
//#region src/server/routing.ts
|
|
684
770
|
/** board()'s own routes: the files it serves, and sync's, which run where board() does. */
|
|
685
771
|
const BOARD_ROUTES = [
|
|
@@ -709,6 +795,8 @@ const METHODS = [
|
|
|
709
795
|
"cancelSchedule",
|
|
710
796
|
"grants",
|
|
711
797
|
"createGrant",
|
|
798
|
+
"updateGrant",
|
|
799
|
+
"explain",
|
|
712
800
|
"revokeGrant",
|
|
713
801
|
"tokens",
|
|
714
802
|
"createToken",
|
|
@@ -1029,4 +1117,34 @@ function canonicalWatchers(watch, sync = []) {
|
|
|
1029
1117
|
return JSON.stringify(canonical);
|
|
1030
1118
|
}
|
|
1031
1119
|
//#endregion
|
|
1032
|
-
|
|
1120
|
+
//#region src/server/targets.ts
|
|
1121
|
+
/** A target as a post or a receipt names it, resolved: a plain one's kind goes by its shape. */
|
|
1122
|
+
const syncTarget = (target) => typeof target === "string" ? {
|
|
1123
|
+
target,
|
|
1124
|
+
kind: isThreadTarget(target) ? "thread" : "channel"
|
|
1125
|
+
} : target;
|
|
1126
|
+
/** Whether `text` mentions anyone by email, `@[ada@vercel.com]`, which sync looks up. */
|
|
1127
|
+
const mentionsEmails = (text) => extractMentions(text).some((token) => token.kind === "actor" && token.actor.includes("@"));
|
|
1128
|
+
/**
|
|
1129
|
+
* `@[ada@vercel.com]`: each email `find` knows (a synced platform's user) becomes that user's
|
|
1130
|
+
* exact mention, `@[slack:user:U0456]`, so it reads natively there; the rest stay plain text.
|
|
1131
|
+
*/
|
|
1132
|
+
async function withEmailMentions(text, find) {
|
|
1133
|
+
const emails = extractMentions(text).flatMap((token) => token.kind === "actor" && token.actor.includes("@") ? [token.actor] : []);
|
|
1134
|
+
if (emails.length === 0) return {
|
|
1135
|
+
text,
|
|
1136
|
+
found: []
|
|
1137
|
+
};
|
|
1138
|
+
const byEmail = /* @__PURE__ */ new Map();
|
|
1139
|
+
for (const email of emails) byEmail.set(email, await find?.(email).catch(() => null) ?? null);
|
|
1140
|
+
return {
|
|
1141
|
+
text: replaceMentions(text, (token) => {
|
|
1142
|
+
if (token.kind !== "actor" || !byEmail.has(token.actor)) return null;
|
|
1143
|
+
const actor = byEmail.get(token.actor);
|
|
1144
|
+
return actor ? `@[${actor.id}]` : token.actor;
|
|
1145
|
+
}),
|
|
1146
|
+
found: [...byEmail.values()].filter((actor) => actor !== null)
|
|
1147
|
+
};
|
|
1148
|
+
}
|
|
1149
|
+
//#endregion
|
|
1150
|
+
export { MessagesQuery as A, SyncCopiesQuery as B, InboxAckBody as C, LabelBody as D, InboxQuery as E, ScheduleBody as F, TokenBody as G, SyncImportBody as H, SchedulesQuery as I, UploadStartBody as J, TypingBody as K, SourceJoinBody as L, ReactBody as M, Ref as N, LinkedQuery as O, RegisterBody as P, SourceReadQuery as R, GrantBody as S, InboxPushBody as T, SyncReceiptBody as U, SyncFindQuery as V, ThreadsQuery as W, routes as Y, 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, PostBody as j, MatchesQuery as k, createRouter as l, SYNC as m, syncTarget as n, hasCriteria as o, readJson as p, UpdateGrantBody as q, withEmailMentions as r, withMentions as s, mentionsEmails as t, openapi as u, DeleteBody as v, InboxNextQuery as w, ExplainQuery as x, EditBody as y, SyncBody as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as unauthorized } from "./errors-
|
|
2
|
-
import { a as VERCEL_ISSUER, b as trustedIssuers, g as markVerified, i as TOKENS, m as issuerName
|
|
1
|
+
import { l as unauthorized } from "./errors-D8ifv16L.mjs";
|
|
2
|
+
import { _ as privateHost, a as VERCEL_ISSUER, b as trustedIssuers, g as markVerified, i as TOKENS, m as issuerName } from "./auth-DjoJygbG.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
|
}
|