@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
|
@@ -1,5 +1,88 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Ft as Access, Gt as Level, Kt as Permission, Lt as Can, qt as WrittenCan } from "./routes-De4W6lEs.mjs";
|
|
2
|
+
import { JWTVerifyGetKey } from "jose";
|
|
3
|
+
//#region src/server/grants.d.ts
|
|
4
|
+
/** Who asks, as a verified token says, in the terms grants name them by. */
|
|
5
|
+
type Caller = {
|
|
6
|
+
kind: 'user';
|
|
7
|
+
userId: string;
|
|
8
|
+
} | {
|
|
9
|
+
kind: 'project';
|
|
10
|
+
projectId: string;
|
|
11
|
+
environment: string;
|
|
12
|
+
teamId?: string;
|
|
13
|
+
} | {
|
|
14
|
+
kind: 'github';
|
|
15
|
+
repository: string;
|
|
16
|
+
repositoryId?: string;
|
|
17
|
+
workflowRef?: string;
|
|
18
|
+
ref?: string;
|
|
19
|
+
event?: string;
|
|
20
|
+
} | {
|
|
21
|
+
kind: 'oidc';
|
|
22
|
+
issuer: string;
|
|
23
|
+
claims: Readonly<Record<string, unknown>>;
|
|
24
|
+
} | {
|
|
25
|
+
kind: 'app';
|
|
26
|
+
clientId: string;
|
|
27
|
+
};
|
|
28
|
+
/** A grant as the decision reads it: whom it names, and what it gives where. */
|
|
29
|
+
type DecidingGrant = {
|
|
30
|
+
readonly principals: readonly GrantPrincipal[];
|
|
31
|
+
readonly can: WrittenCan;
|
|
32
|
+
};
|
|
33
|
+
/** What decides a caller's access, all of it plain data or a predicate the backend answers. */
|
|
34
|
+
type GrantFacts<G extends DecidingGrant = DecidingGrant> = {
|
|
35
|
+
caller: Caller;
|
|
36
|
+
/** The board's grants, as they are, or as a write is about to leave them. */
|
|
37
|
+
grants: readonly G[];
|
|
38
|
+
/** Whether the caller, a user, is a person on the board's team: `all-users` names them, and that lets them in. */
|
|
39
|
+
member?: boolean;
|
|
40
|
+
/** Whether the caller, a project, is on the board's team: `all-projects` names it. */
|
|
41
|
+
teamProject?: boolean;
|
|
42
|
+
/** Whether the caller, an app, is installed on the board's team: `all-apps` names it. */
|
|
43
|
+
teamApp?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* The most the caller may do anywhere, whatever the grants say: what a backend makes of a
|
|
46
|
+
* person's team role (a viewer is `['read', 'react']`) or an app's scopes. Nothing caps it,
|
|
47
|
+
* without it.
|
|
48
|
+
*/
|
|
49
|
+
cap?: readonly Permission[];
|
|
50
|
+
/** A token's `can`, which narrows what the grants give. */
|
|
51
|
+
can?: Can;
|
|
52
|
+
};
|
|
53
|
+
/** Where a matched grant came from: one the board keeps. */
|
|
54
|
+
type GrantSource<G extends DecidingGrant = DecidingGrant> = {
|
|
55
|
+
grant: G;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* What the caller may do by the board's grants: `caller`, all of it, as `GET /me` says, and `own`,
|
|
59
|
+
* the same without `everyone`'s grants, what `checkGrantChange` judges reach by. At each channel the
|
|
60
|
+
* most specific pattern a grant naming it gives decides, then the closest principal there, and
|
|
61
|
+
* grants tied there add up; `cap` caps both, and a token's `can` narrows them. Null when
|
|
62
|
+
* nothing but `everyone` names it, since `everyone` lets no one in itself.
|
|
63
|
+
*/
|
|
64
|
+
declare function grantAccess<G extends DecidingGrant>(facts: GrantFacts<G>): {
|
|
65
|
+
caller: Access;
|
|
66
|
+
own: Access;
|
|
67
|
+
} | null;
|
|
68
|
+
/**
|
|
69
|
+
* Which grants decide `channel` for the caller: the `pattern` that wins there, the patterns it wins
|
|
70
|
+
* `over`, most specific first, the `level` that wins at it, the `grants` at that level, which add
|
|
71
|
+
* up, and what the caller may do there, `permissions`, after its `cap` and its token's `can`.
|
|
72
|
+
* `capped` says whether the cap took anything away. `pattern` and `level` are null for a caller
|
|
73
|
+
* nothing lets in, whose `permissions` are empty. What `grantAccess` gives, explained.
|
|
74
|
+
*/
|
|
75
|
+
type GrantExplanation<G extends DecidingGrant = DecidingGrant> = {
|
|
76
|
+
pattern: string | null;
|
|
77
|
+
over: string[];
|
|
78
|
+
level: Level | null;
|
|
79
|
+
grants: G[];
|
|
80
|
+
capped: boolean;
|
|
81
|
+
permissions: Permission[];
|
|
82
|
+
};
|
|
83
|
+
/** Which grants decide `channel` for the caller `facts` describes, from plain data, as a board explains it. */
|
|
84
|
+
declare function explainGrants<G extends DecidingGrant>(facts: GrantFacts<G>, channel: string): GrantExplanation<G>;
|
|
85
|
+
//#endregion
|
|
3
86
|
//#region src/server/auth.d.ts
|
|
4
87
|
/**
|
|
5
88
|
* What a request says about who's calling, beside its credential: labels the caller picks for
|
|
@@ -67,75 +150,13 @@ type Pinned = {
|
|
|
67
150
|
type Granted = Principal & {
|
|
68
151
|
access: Access;
|
|
69
152
|
};
|
|
70
|
-
/** A verified token's claims, as rules match them. */
|
|
71
|
-
type TokenClaims = JWTPayload & Record<string, unknown>;
|
|
72
153
|
/** What a verified token said: its issuer and its claims, never the token itself. */
|
|
73
154
|
type TokenFacts = {
|
|
74
155
|
/** `host`: a host's own verifier recognized the caller; its claims are when that runs out. */
|
|
75
156
|
issuer: 'vercel' | 'github' | 'oidc' | 'host';
|
|
76
157
|
iss: string;
|
|
77
158
|
claims: Readonly<Record<string, string | number | boolean>>;
|
|
78
|
-
/**
|
|
79
|
-
* The board's own Vercel team, as the board knew it when it verified the
|
|
80
|
-
* token. A schedule's send may run where the board can't work it out (the
|
|
81
|
-
* scheduler's own function, with no request to learn it from), and a rule
|
|
82
|
-
* naming a project without its team needs it. Only the board writes it.
|
|
83
|
-
*/
|
|
84
|
-
team?: string;
|
|
85
|
-
};
|
|
86
|
-
/** What a rule may compare claims to: the board's own Vercel team and project, when they're known. */
|
|
87
|
-
type MatchContext = {
|
|
88
|
-
teamId: string | null;
|
|
89
|
-
projectId: string | null;
|
|
90
|
-
};
|
|
91
|
-
/** One entry in `board({ access })`: who it matches, and what they may do. The first entry that matches decides. */
|
|
92
|
-
type AccessRule = {
|
|
93
|
-
/** `vercel` and `github` are their platforms' issuers; `oidc` is the exact `url`. */
|
|
94
|
-
issuer: 'vercel' | 'github' | 'oidc';
|
|
95
|
-
/** For `oidc`: the issuer URL, pinned in code. */
|
|
96
|
-
url?: string;
|
|
97
|
-
matches(claims: TokenClaims, context: MatchContext): boolean;
|
|
98
|
-
access: Access;
|
|
99
159
|
};
|
|
100
|
-
/**
|
|
101
|
-
* A Vercel project's deployments, by name or ID. A name is only unique within
|
|
102
|
-
* a team, so without `team` it means the board's own team, and matches nothing
|
|
103
|
-
* when that isn't known. An ID is unique on Vercel, so it matches on any team.
|
|
104
|
-
* `'self'` is the board's own project: its deployments in the environment the
|
|
105
|
-
* board runs in have full access unless a rule says otherwise, and its other
|
|
106
|
-
* environments have none unless one lists them. Its development tokens are
|
|
107
|
-
* people, which no rule changes.
|
|
108
|
-
*/
|
|
109
|
-
declare function vercelProject(options: {
|
|
110
|
-
project: string;
|
|
111
|
-
team?: string;
|
|
112
|
-
environments?: readonly string[];
|
|
113
|
-
can: Can;
|
|
114
|
-
}): AccessRule;
|
|
115
|
-
/**
|
|
116
|
-
* A GitHub Actions workflow. A `pull_request` run's token carries
|
|
117
|
-
* `ref: refs/pull/<n>/merge`, so match those on `event` and `workflow`, not `ref`.
|
|
118
|
-
*/
|
|
119
|
-
declare function githubActions(options: {
|
|
120
|
-
repository: string;
|
|
121
|
-
event?: string | readonly string[];
|
|
122
|
-
workflow?: string;
|
|
123
|
-
ref?: string;
|
|
124
|
-
can: Can;
|
|
125
|
-
}): AccessRule;
|
|
126
|
-
/**
|
|
127
|
-
* Any OIDC issuer's tokens: GitLab, Buildkite, a cloud's workload identity.
|
|
128
|
-
* The issuer is pinned here, and only issuers some rule names are trusted or
|
|
129
|
-
* have their keys fetched. Every listed claim must match exactly (a list is
|
|
130
|
-
* any of its values), and there must be at least one, since an issuer signs
|
|
131
|
-
* tokens for everyone it serves. The principal is `oidc:<issuer host and path>:<sub>`,
|
|
132
|
-
* with any `:` or `%` in the issuer part percent-encoded, so it ends at the first `:`.
|
|
133
|
-
*/
|
|
134
|
-
declare function oidc(options: {
|
|
135
|
-
issuer: string;
|
|
136
|
-
claims: Readonly<Record<string, string | readonly string[]>>;
|
|
137
|
-
can: Can;
|
|
138
|
-
}): AccessRule;
|
|
139
160
|
type IssuerConfig = {
|
|
140
161
|
/** Accepted `iss` values. */
|
|
141
162
|
issuer: string | RegExp;
|
|
@@ -146,7 +167,7 @@ type IssuerConfig = {
|
|
|
146
167
|
type OidcTokensOptions = {
|
|
147
168
|
vercel?: IssuerConfig;
|
|
148
169
|
github?: IssuerConfig;
|
|
149
|
-
/** Keys for
|
|
170
|
+
/** Keys for the OIDC issuers grants name, by issuer URL, instead of their published JWKS. It trusts no issuer by itself. */
|
|
150
171
|
oidc?: Readonly<Record<string, JWTVerifyGetKey>>;
|
|
151
172
|
/**
|
|
152
173
|
* A local board's own issuer (`vb serve`): its tokens' `sub` is a person on
|
|
@@ -158,29 +179,53 @@ type OidcTokensOptions = {
|
|
|
158
179
|
jwks: JWTVerifyGetKey;
|
|
159
180
|
};
|
|
160
181
|
};
|
|
161
|
-
/**
|
|
162
|
-
* What a host's own model gives a principal: what it may do, or null for nothing. It sees only the
|
|
163
|
-
* principals its own `authenticate` returned.
|
|
164
|
-
*/
|
|
165
|
-
type AccessFunction = (principal: Known) => Can | null | undefined | Promise<Can | null | undefined>;
|
|
166
|
-
/**
|
|
167
|
-
* A rule of your own, among `vercelProject()` and the rest: what it gives a principal (`'all'`,
|
|
168
|
-
* `['read']`, `{ 'support/': ['read', 'post'] }`), null for nothing, or undefined to leave it to the
|
|
169
|
-
* next rule. It's asked whenever a principal acts, a schedule's send included, and never about a
|
|
170
|
-
* person or the board's own deployments in its environment, which the defaults decide first.
|
|
171
|
-
*/
|
|
172
|
-
type RuleFunction = (principal: Known) => Can | null | undefined | Promise<Can | null | undefined>;
|
|
173
182
|
/** A principal as the board keeps it to work its access out again: who it is, its token's facts, its scope, and the board token it came with. */
|
|
174
183
|
type Known = Pick<Principal, 'id' | 'kind' | 'handle' | 'facts' | 'scope' | 'token'>;
|
|
175
|
-
/**
|
|
176
|
-
|
|
177
|
-
|
|
184
|
+
/**
|
|
185
|
+
* Who a grant names, as the board keeps it: IDs, with the names it knows beside them. A board
|
|
186
|
+
* that verifies tokens itself knows none, so it keeps what was written: a user's ID, a project's
|
|
187
|
+
* ID, a repository's `owner/name`.
|
|
188
|
+
*/
|
|
189
|
+
type GrantPrincipal = {
|
|
190
|
+
kind: 'user';
|
|
191
|
+
userId: string;
|
|
192
|
+
email?: string;
|
|
193
|
+
} | {
|
|
194
|
+
kind: 'project';
|
|
195
|
+
projectId: string;
|
|
196
|
+
name?: string;
|
|
197
|
+
environments: readonly string[];
|
|
198
|
+
teamId?: string;
|
|
199
|
+
} | {
|
|
200
|
+
kind: 'github';
|
|
201
|
+
repository: string;
|
|
202
|
+
repositoryId?: string;
|
|
203
|
+
workflow?: string;
|
|
204
|
+
branch?: string;
|
|
205
|
+
event?: string;
|
|
206
|
+
} | {
|
|
207
|
+
kind: 'oidc';
|
|
178
208
|
issuer: string;
|
|
179
209
|
claims: Readonly<Record<string, string | readonly string[]>>;
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
210
|
+
} | {
|
|
211
|
+
kind: 'all-users';
|
|
212
|
+
} | {
|
|
213
|
+
kind: 'all-projects';
|
|
214
|
+
environments: readonly string[];
|
|
215
|
+
} | {
|
|
216
|
+
kind: 'app';
|
|
217
|
+
clientId: string;
|
|
218
|
+
name?: string;
|
|
219
|
+
} | {
|
|
220
|
+
kind: 'all-apps';
|
|
221
|
+
} | {
|
|
222
|
+
kind: 'everyone';
|
|
223
|
+
};
|
|
224
|
+
/** A grant the board keeps: who it names, and one `can` for all of them, as written. */
|
|
225
|
+
type StoredGrant = {
|
|
226
|
+
id: string;
|
|
227
|
+
principals: readonly GrantPrincipal[];
|
|
228
|
+
can: WrittenCan;
|
|
184
229
|
};
|
|
185
230
|
/**
|
|
186
231
|
* What a grant or a token left without `can` gives: what Vercel's API gives a project it lets use a
|
|
@@ -188,26 +233,14 @@ type StoredGrant = {
|
|
|
188
233
|
* exports it, so code that imports it can't widen them.
|
|
189
234
|
*/
|
|
190
235
|
declare const DEFAULT_CAN: Can;
|
|
191
|
-
/**
|
|
192
|
-
* What a principal may do under `rules` (`vercelProject()`, `githubActions()`, `oidc()`, and
|
|
193
|
-
* functions of your own), the first that matches deciding, past the defaults: people, and the
|
|
194
|
-
* board's own deployments in the environment it runs in, may do everything. Its scope narrows what
|
|
195
|
-
* it gets. A 401 or 403 that names the rule that would let it in, when it may do nothing.
|
|
196
|
-
*/
|
|
197
|
-
declare function compileRules(rules: readonly (AccessRule | RuleFunction)[], board: {
|
|
198
|
-
project(): Promise<{
|
|
199
|
-
id: string | null;
|
|
200
|
-
teamId: string | null;
|
|
201
|
-
}>;
|
|
202
|
-
}): (principal: Known) => Promise<Access>;
|
|
203
|
-
/** What board() knows that verifying a request needs: its own Vercel project, and the OIDC issuers its rules trust. */
|
|
236
|
+
/** What board() knows that verifying a request needs: its own Vercel project, and the OIDC issuers its grants trust. */
|
|
204
237
|
type AuthenticateContext = {
|
|
205
238
|
/** The board's own Vercel project and team: its people's development tokens are for it. */
|
|
206
239
|
project(): Promise<{
|
|
207
240
|
id: string | null;
|
|
208
241
|
teamId: string | null;
|
|
209
242
|
}>;
|
|
210
|
-
/** OIDC issuers past Vercel's and GitHub's whose tokens may be trusted: the ones
|
|
243
|
+
/** OIDC issuers past Vercel's and GitHub's whose tokens may be trusted: the ones grants name. */
|
|
211
244
|
issuers: readonly string[];
|
|
212
245
|
};
|
|
213
246
|
/** What a verifier gets: what the request said, and what the board knows that verifying it needs. */
|
|
@@ -220,7 +253,7 @@ type AuthenticateRequest = CallerRequest & {
|
|
|
220
253
|
* `request.headers`, say). Null when the request carries nothing it recognizes, so verifiers
|
|
221
254
|
* compose: `(request) => (await staff(request)) ?? (await tokens(request))`. To reject a
|
|
222
255
|
* credential that fails, throw an `HttpError` (a 401), or return or throw a `Response`; anything
|
|
223
|
-
* else thrown is a 500. What a principal may do is
|
|
256
|
+
* else thrown is a 500. What a principal may do is the board's defaults' and grants' to say.
|
|
224
257
|
*/
|
|
225
258
|
type Authenticate = (request: AuthenticateRequest) => Principal | HostPrincipal | Response | null | undefined | Promise<Principal | HostPrincipal | Response | null | undefined>;
|
|
226
259
|
/** What a host's own verifier returns: a principal in the board's ID scheme. */
|
|
@@ -233,4 +266,4 @@ type HostPrincipal = {
|
|
|
233
266
|
expiresAt?: Date | null;
|
|
234
267
|
};
|
|
235
268
|
//#endregion
|
|
236
|
-
export {
|
|
269
|
+
export { GrantExplanation as _, DEFAULT_CAN as a, explainGrants as b, IssuerConfig as c, Pinned as d, Principal as f, DecidingGrant as g, Caller as h, Claims as i, Known as l, StoredGrant as m, AuthenticateContext as n, Granted as o, PrincipalKind as p, CallerRequest as r, HostPrincipal as s, Authenticate as t, OidcTokensOptions as u, GrantFacts as v, grantAccess as x, GrantSource as y };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { t as Backend } from "./backend-u1sVvybh.mjs";
|
|
2
|
+
//#region src/server/local.d.ts
|
|
3
|
+
type LocalOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* Where it keeps its files: `.board` under the working directory by default. Each board is one
|
|
6
|
+
* SQLite file there, `local.db` for the default board and one named for the board otherwise,
|
|
7
|
+
* whatever its team, with its attachments in the folder of the same name.
|
|
8
|
+
*/
|
|
9
|
+
dir?: string;
|
|
10
|
+
/** Keeps the board in memory, attachments too, for tests: nothing is written, and it's gone with the process. */
|
|
11
|
+
memory?: boolean;
|
|
12
|
+
};
|
|
13
|
+
/** A board kept in this process. `close()` closes its file, once nothing uses it. */
|
|
14
|
+
type LocalBackend = Backend & {
|
|
15
|
+
/** Stops its timers and closes the board's file. What was still to send doesn't, as after a restart. */
|
|
16
|
+
close(): Promise<void>;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* A board kept in this process: in SQLite under `.board/` (or `dir`), one file per board's name
|
|
20
|
+
* (whatever `board({ team })` says: there's one team here),
|
|
21
|
+
* its attachments next to it, and a scheduler whose timers run here, so schedules send, and
|
|
22
|
+
* watchers and sync retry, while the process runs. `memory` keeps it all in memory, for tests.
|
|
23
|
+
* A restart drops pending timers, so it's for development, `vb serve`, tests, and working offline,
|
|
24
|
+
* never serverless functions.
|
|
25
|
+
*/
|
|
26
|
+
export declare function local(options?: LocalOptions): LocalBackend;
|
|
27
|
+
//#endregion
|
|
28
|
+
export type { LocalBackend, LocalOptions };
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { t as Access } from "./
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { $ as RegisterBody, A as InboxAckBody, At as ThreadsPage, B as MatchView, C as EventsPage, D as GrantBody, Dt as SyncedView, Et as SyncThreadView, F as InboxQuery, Ft as TokenView, G as MessagesQuery, H as Me, It as TypingBody, J as PostBody, L as LabelBody, M as InboxItem, N as InboxNextQuery, Nt as TokenBody, P as InboxPushBody, Rt as UploadStartBody, S as EditBody, St as SyncImportBody, U as MessageView, V as MatchesQuery, W as MessagesPage, Z as ReactBody, _ as BoardEventView, _t as SyncCopiesQuery, b as DeleteBody, bt as SyncFindQuery, ct as SchedulesQuery, dt as SourceJoin, ft as SourceJoinBody, ht as SourceReadQuery, it as ScheduleBody, j as InboxEntry, jt as ThreadsQuery, k as GrantView, kt as ThreadView, m as AckBody, mt as SourceRead, o as ProfileOption, st as ScheduleView, t as BoardClient, tt as RegistrationView, v as ChannelView, vt as SyncCopiesView, w as EventsQuery, wt as SyncReceiptBody, x as Discovery, xt as SyncFindView, y as CreateChannelBody, z as LinkedQuery, zt as UploadTicket } from "./client-COfYrgfV.mjs";
|
|
5
|
-
import { t as HttpError } from "./errors-2vGs49Db.mjs";
|
|
6
|
-
import { p as SyncProvider } from "./provider-gynDUoyW.mjs";
|
|
1
|
+
import { $ as ScheduleView, $t as Attachment, A as MatchView, At as UpdateGrantBody, C as InboxNextQuery, Ct as ThreadsQuery, D as LabelBody, Dt as TokenView, F as MessagesQuery, Ft as Access, G as RegisterBody, Gt as Level, Kt as Permission, M as Me, Mt as UploadStartBody, N as MessageView, Nt as UploadTicket, Ot as TypingBody, P as MessagesPage, R as PostBody, S as InboxItem, St as ThreadsPage, T as InboxQuery, Tt as TokenBody, U as ReactBody, X as ScheduleBody, Zt as Actor, a as ChannelView, b as InboxAckBody, c as Discovery, d as EventsQuery, en as Author, et as SchedulesQuery, ft as SyncFindQuery, g as GrantBody, gt as SyncReceiptBody, i as BoardEventView, it as SourceJoinBody, j as MatchesQuery, k as LinkedQuery, l as EditBody, lt as SyncCopiesQuery, m as Explanation, mt as SyncImportBody, o as CreateChannelBody, ot as SourceRead, p as ExplainQuery, pt as SyncFindView, q as RegistrationView, rn as ExternalEvent, rt as SourceJoin, s as DeleteBody, st as SourceReadQuery, t as AckBody, tn as Labels, u as EventsPage, ut as SyncCopiesView, vt as SyncThreadView, w as InboxPushBody, x as InboxEntry, xt as ThreadView, y as GrantView, yt as SyncedView } from "./routes-De4W6lEs.mjs";
|
|
2
|
+
import { d as Pinned, l as Known, m as StoredGrant, o as Granted, t as Authenticate } from "./auth-aaoKt5DK.mjs";
|
|
3
|
+
import { L as ProfileOption, M as BoardClient, P as ErrorOrigin, p as SyncProvider } from "./provider-hB8QNrwm.mjs";
|
|
7
4
|
import { z } from "zod";
|
|
8
5
|
//#region src/api/protocol.d.ts
|
|
9
6
|
type Input<S extends z.ZodType> = NonNullable<z.output<S>>;
|
|
@@ -121,21 +118,32 @@ type Protocol = {
|
|
|
121
118
|
canceled: boolean;
|
|
122
119
|
};
|
|
123
120
|
};
|
|
124
|
-
/** The board's grants: needs `manage`
|
|
121
|
+
/** The board's grants: needs `manage` at `*`, or a team owner. 501 `no_grants` where the board keeps none. */
|
|
125
122
|
grants: {
|
|
126
123
|
input: Nothing;
|
|
127
124
|
output: {
|
|
128
125
|
grants: GrantView[];
|
|
129
126
|
};
|
|
130
127
|
};
|
|
131
|
-
/**
|
|
128
|
+
/** A new grant, always: the same principals again are another. Needs `manage` at each pattern its `can` names. */
|
|
132
129
|
createGrant: {
|
|
133
130
|
input: Input<typeof GrantBody>;
|
|
134
131
|
output: {
|
|
135
132
|
grant: GrantView;
|
|
136
|
-
created: boolean;
|
|
137
133
|
};
|
|
138
134
|
};
|
|
135
|
+
/** Adds and removes principals, or replaces its `can`: needs what `checkGrantChange` says, for the grant as it was and as it'd be. 404 `grant_not_found`. */
|
|
136
|
+
updateGrant: {
|
|
137
|
+
input: Id & Input<typeof UpdateGrantBody>;
|
|
138
|
+
output: {
|
|
139
|
+
grant: GrantView;
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
/** Which grant decides `channel` for the caller, or with `manage` at `*` (or a team owner), the principal it names. */
|
|
143
|
+
explain: {
|
|
144
|
+
input: Input<typeof ExplainQuery>;
|
|
145
|
+
output: Explanation;
|
|
146
|
+
};
|
|
139
147
|
/** `revoked` is false when it was already gone. */
|
|
140
148
|
revokeGrant: {
|
|
141
149
|
input: Id;
|
|
@@ -316,6 +324,20 @@ type Protocol = {
|
|
|
316
324
|
};
|
|
317
325
|
type Method = keyof Protocol;
|
|
318
326
|
//#endregion
|
|
327
|
+
//#region src/server/errors.d.ts
|
|
328
|
+
declare class HttpError extends Error {
|
|
329
|
+
readonly status: number;
|
|
330
|
+
readonly code: string;
|
|
331
|
+
/** What fixes it, when there's one (`BoardError`'s `hint`). */
|
|
332
|
+
readonly hint: string | undefined;
|
|
333
|
+
/** `handle` for a handle's own error on its way through: everything else is the board's. */
|
|
334
|
+
readonly origin: ErrorOrigin;
|
|
335
|
+
constructor(status: number, code: string, message: string, options?: {
|
|
336
|
+
hint?: string;
|
|
337
|
+
origin?: ErrorOrigin;
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
//#endregion
|
|
319
341
|
//#region src/server/middleware.d.ts
|
|
320
342
|
/** Where a write came from, as the middleware sees it. */
|
|
321
343
|
type WriteSource =
|
|
@@ -393,6 +415,14 @@ declare class DroppedError extends HttpError {
|
|
|
393
415
|
}
|
|
394
416
|
//#endregion
|
|
395
417
|
//#region src/server/policy.d.ts
|
|
418
|
+
/** What decides a channel for a principal: the winning pattern and level, the grants there or the rule, and what they give. */
|
|
419
|
+
type Decided = {
|
|
420
|
+
pattern: string | null;
|
|
421
|
+
over: string[];
|
|
422
|
+
level: Level | null;
|
|
423
|
+
grants: StoredGrant[];
|
|
424
|
+
permissions: Permission[];
|
|
425
|
+
};
|
|
396
426
|
/** Who may use a board, and what they may do: `board()`'s options for it. */
|
|
397
427
|
type PolicyOptions = {
|
|
398
428
|
/**
|
|
@@ -402,33 +432,11 @@ type PolicyOptions = {
|
|
|
402
432
|
* from its credential or its headers (a session cookie). It replaces the built-in one, so no
|
|
403
433
|
* token's audience or the board's own project counts then, unless it calls `oidcTokens()` itself.
|
|
404
434
|
* Null when it recognizes nothing; to reject, return or throw a `Response`.
|
|
405
|
-
*/
|
|
406
|
-
authenticate?: Authenticate;
|
|
407
|
-
/**
|
|
408
|
-
* Who besides the board's people and its own deployments in the environment it runs in may use
|
|
409
|
-
* it, and what they may do in each channel: `vercelProject()`, `githubActions()`, `oidc()` from
|
|
410
|
-
* `@vercel/board/access`, and functions of your own, `(principal) => can`, for principals your
|
|
411
|
-
* `authenticate` returns. The first rule that matches decides; a function's undefined leaves it to
|
|
412
|
-
* the next. A production board's previews need a rule, as
|
|
413
|
-
* `vercelProject({ project: 'self', environments: ['preview'], can })`.
|
|
414
435
|
*
|
|
415
|
-
*
|
|
416
|
-
* may do
|
|
417
|
-
* Nothing else is trusted then, not the board's own people or deployments.
|
|
418
|
-
*
|
|
419
|
-
* On `http()`, a board with none serves no requests but wake-ups and webhooks; with one, it serves
|
|
420
|
-
* its callers within it, as its project on the board it uses.
|
|
421
|
-
*/
|
|
422
|
-
access?: readonly (AccessRule | RuleFunction)[] | AccessFunction;
|
|
423
|
-
/**
|
|
424
|
-
* The board's Vercel project: `self` in the rules, whose people's development tokens it takes,
|
|
425
|
-
* and what discovery names for clients to mint them. Defaults to `VERCEL_PROJECT_ID` or
|
|
426
|
-
* `.vercel/project.json`.
|
|
436
|
+
* What a principal may do isn't its to say: people, and the board's own deployments in its
|
|
437
|
+
* environment, may do everything, and anyone else what the board's grants give.
|
|
427
438
|
*/
|
|
428
|
-
|
|
429
|
-
id: string;
|
|
430
|
-
teamId?: string;
|
|
431
|
-
};
|
|
439
|
+
authenticate?: Authenticate;
|
|
432
440
|
};
|
|
433
441
|
//#endregion
|
|
434
442
|
//#region src/server/origin.d.ts
|
|
@@ -482,13 +490,27 @@ type Watcher = {
|
|
|
482
490
|
* `board()`'s options: where the board lives, who may use it and what its writes go through, and
|
|
483
491
|
* what runs here. The backend keeps or reaches the log; the policy is the board's.
|
|
484
492
|
*/
|
|
485
|
-
type BoardOptions = PolicyOptions & {
|
|
493
|
+
type BoardOptions = PolicyOptions & (BackendOptions | DefaultOptions) & {
|
|
494
|
+
/**
|
|
495
|
+
* Which of the team's boards this is, by its name: `security` is the team's board named
|
|
496
|
+
* security. Without one, the team's default board. A name is 1 to 64 characters with no `/`, and
|
|
497
|
+
* matches whatever its case. The backend reads it when board() binds it: `vercel()` finds that
|
|
498
|
+
* board, a board on `http()` is the one at its URL, whatever its name.
|
|
499
|
+
*/
|
|
500
|
+
name?: string;
|
|
486
501
|
/**
|
|
487
|
-
*
|
|
488
|
-
*
|
|
489
|
-
*
|
|
502
|
+
* With `name`: whether to make that board when the team has none by that name, whoever calls (a
|
|
503
|
+
* deployment, or a person: `next dev` with a login, a script). It does by default; `ensure: false`
|
|
504
|
+
* only finds one, and a name the team has none for fails with 404 `no_board`. `vb` passes false
|
|
505
|
+
* unless `--ensure` is given, so a typo at a terminal makes no board.
|
|
490
506
|
*/
|
|
491
|
-
|
|
507
|
+
ensure?: boolean;
|
|
508
|
+
/**
|
|
509
|
+
* Whose board this is: another team's, by its ID (`team_…`) or its slug, with `name` or without
|
|
510
|
+
* it for that team's default board. Without one, the team the environment finds: in Node, the
|
|
511
|
+
* deployment's, `VERCEL_ORG_ID`, or the linked project's.
|
|
512
|
+
*/
|
|
513
|
+
team?: string;
|
|
492
514
|
/**
|
|
493
515
|
* Runs on every post and edit before it reaches the backend, whatever it came from: requests (a
|
|
494
516
|
* board on `http()` using this one included), watchers, schedules, the handle, and sync's imports.
|
|
@@ -515,7 +537,7 @@ type BoardOptions = PolicyOptions & {
|
|
|
515
537
|
* The handle on a board: its methods act as the board's caller, through board(), which calls the
|
|
516
538
|
* backend's methods, and `fetch` serves it. Over `http()` the caller is whoever its `fetch`'s
|
|
517
539
|
* credentials say, with the profile `BOARD_AS` or the agent it runs in picks; on a board it keeps
|
|
518
|
-
* (`
|
|
540
|
+
* (`local()`), its own code, as `board:client`.
|
|
519
541
|
*/
|
|
520
542
|
type Board = BoardClient & {
|
|
521
543
|
/**
|
|
@@ -525,10 +547,30 @@ type Board = BoardClient & {
|
|
|
525
547
|
fetch(request: Request): Promise<Response>;
|
|
526
548
|
/**
|
|
527
549
|
* The handle, acting with `profile`: `<principal>+<profile>` over HTTP, `board:client:<profile>`
|
|
528
|
-
* on `
|
|
550
|
+
* on `local()`. `null` acts as yourself, outside any agent session.
|
|
529
551
|
*/
|
|
530
552
|
as(profile: ProfileOption): Board;
|
|
531
553
|
};
|
|
554
|
+
/** A board on a backend you pass, which says how it reaches the board itself. */
|
|
555
|
+
type BackendOptions = {
|
|
556
|
+
/**
|
|
557
|
+
* Where the board lives: `local()` from `@vercel/board/backend-local` keeps it in this process,
|
|
558
|
+
* or a backend of your own. By default, Vercel's board for your team, the one `name` names, or
|
|
559
|
+
* with `BOARD_URL` set (in Node), the board at that URL.
|
|
560
|
+
*/
|
|
561
|
+
backend: Backend;
|
|
562
|
+
fetch?: never;
|
|
563
|
+
};
|
|
564
|
+
/** A board on the backend board() picks: Vercel's, or with `BOARD_URL` set, the board at that URL. */
|
|
565
|
+
type DefaultOptions = {
|
|
566
|
+
backend?: undefined;
|
|
567
|
+
/**
|
|
568
|
+
* How requests reach Vercel's API, with credentials it takes: a token for the team. In Node it
|
|
569
|
+
* defaults to `VERCEL_TOKEN`, the deployment's OIDC token, or your `vercel login`; elsewhere, a
|
|
570
|
+
* browser say, pass one. A board at `BOARD_URL` gets the credentials `vb` sends it instead.
|
|
571
|
+
*/
|
|
572
|
+
fetch?: typeof fetch;
|
|
573
|
+
};
|
|
532
574
|
//#endregion
|
|
533
575
|
//#region src/server/backend.d.ts
|
|
534
576
|
/**
|
|
@@ -557,7 +599,7 @@ type SelfCaller = {
|
|
|
557
599
|
/**
|
|
558
600
|
* A handle (`via: client`, with the profile from `as(profile)`, or null for the board's own), a
|
|
559
601
|
* watcher, the middleware's handle (`via: middleware`), or sync (`via: engine`). Each backend
|
|
560
|
-
* decides who that is on its board: `board:client` and `board:client:<profile>` on
|
|
602
|
+
* decides who that is on its board: `board:client` and `board:client:<profile>` on local(), the
|
|
561
603
|
* token's holder with that profile elsewhere.
|
|
562
604
|
*/
|
|
563
605
|
self: string | null;
|
|
@@ -608,11 +650,21 @@ type InboxDelivery = {
|
|
|
608
650
|
};
|
|
609
651
|
/** What a backend gets from the board it serves: once, in memory, when board() is created. */
|
|
610
652
|
type BoardBinding = {
|
|
653
|
+
/**
|
|
654
|
+
* Which of the team's boards this is, as `board({ name })` says it: `security`, or null for the
|
|
655
|
+
* team's default board. A backend that keeps one board, or reaches one by its URL, may leave it
|
|
656
|
+
* unread.
|
|
657
|
+
*/
|
|
658
|
+
name: string | null;
|
|
659
|
+
/** Whose board it is, as `board({ team })` says it, by the team's ID or slug: null for the team the environment finds. */
|
|
660
|
+
team: string | null;
|
|
661
|
+
/** Whether to make the board `name` names when the team has none by that name: `board({ ensure })`, true unless it says false. */
|
|
662
|
+
ensure: boolean;
|
|
611
663
|
/** What runs on this board's events, by ID: this project's watchers, and sync's outbound at `SYNC` when it syncs. */
|
|
612
664
|
subscriptions: Record<string, Subscription>;
|
|
613
665
|
/**
|
|
614
666
|
* Runs one subscription on an event. A throw is the backend's to retry; `attempt` counts tries
|
|
615
|
-
* from 1, and sync gives up on a delivery, and says so, before
|
|
667
|
+
* from 1, and sync gives up on a delivery, and says so, before the backend stops trying it.
|
|
616
668
|
*/
|
|
617
669
|
run(id: string, event: WatcherContext['event'], meta: {
|
|
618
670
|
trigger: string;
|
|
@@ -658,17 +710,19 @@ type BoardBinding = {
|
|
|
658
710
|
*/
|
|
659
711
|
typing(messages: readonly MessageView[], status: string | undefined): Promise<string[]>;
|
|
660
712
|
/**
|
|
661
|
-
* What a principal the backend stored may do now, under board()'s
|
|
662
|
-
* at each send, a registrant at each event and pull. Null once it may do nothing.
|
|
713
|
+
* What a principal the backend stored may do now, under board()'s defaults and the board's grants:
|
|
714
|
+
* a schedule's creator at each send, a registrant at each event and pull. Null once it may do nothing.
|
|
715
|
+
* With `grants`, under those instead of the board's grants as they are: a grant write's own
|
|
716
|
+
* snapshot, so what it checks is what it appends to.
|
|
663
717
|
*/
|
|
664
|
-
accessNow(principal: Known): Promise<Access | null>;
|
|
718
|
+
accessNow(principal: Known, grants?: readonly StoredGrant[]): Promise<Access | null>;
|
|
719
|
+
/** Which grants, or which rule, decide `channel` for a principal under board()'s `access`, and what they give: what `explain` answers. */
|
|
720
|
+
explain(principal: Known, channel: string): Promise<Decided>;
|
|
665
721
|
/** The board's own Vercel project and team, as board() knows them: what discovery names, for clients to mint tokens with. */
|
|
666
722
|
project(): Promise<{
|
|
667
723
|
id: string | null;
|
|
668
724
|
teamId: string | null;
|
|
669
725
|
}>;
|
|
670
|
-
/** The OIDC issuers board()'s rules name, which no grant's issuer may share principals with. */
|
|
671
|
-
issuers(): readonly string[];
|
|
672
726
|
/**
|
|
673
727
|
* A handle through board(), as `caller`: what a backend writes for someone outside a request
|
|
674
728
|
* goes through it, so board()'s middleware sees it, a schedule's send as its creator, say. A
|
|
@@ -708,19 +762,18 @@ interface Backend extends ProtocolMethods {
|
|
|
708
762
|
/** Routes of its own, beside the protocol: one at a protocol route's path takes its place. */
|
|
709
763
|
readonly routes: readonly BackendRoute[];
|
|
710
764
|
/**
|
|
711
|
-
* Whether the board lives here. One that keeps it (`
|
|
712
|
-
*
|
|
713
|
-
*
|
|
714
|
-
* project.
|
|
765
|
+
* Whether the board lives here. One that keeps it (`local()`) serves requests: its people, the
|
|
766
|
+
* board's own deployments, and whoever its grants and tokens let in. One that uses another board
|
|
767
|
+
* (Vercel's, or one at `BOARD_URL`) answers only wake-ups and webhooks.
|
|
715
768
|
*/
|
|
716
769
|
readonly keeps: boolean;
|
|
717
770
|
/**
|
|
718
|
-
* Whether a schedule's sends come back through board(), as
|
|
771
|
+
* Whether a schedule's sends come back through board(), as local()'s do, so its middleware screens
|
|
719
772
|
* each. A backend whose sends post elsewhere, as vercel()'s do from Vercel's API, says false, and
|
|
720
773
|
* board() screens a schedule's message once, when it's made. True when left out.
|
|
721
774
|
*/
|
|
722
775
|
readonly sendsSchedulesHere?: boolean;
|
|
723
|
-
/** Its grants and tokens, for a backend that keeps them (`
|
|
776
|
+
/** Its grants and tokens, for a backend that keeps them (`local()`): board() checks requests against them. */
|
|
724
777
|
readonly trust?: Trust;
|
|
725
778
|
/**
|
|
726
779
|
* board() calls it once, when it's created, before any request: what background work needs
|
|
@@ -729,4 +782,4 @@ interface Backend extends ProtocolMethods {
|
|
|
729
782
|
bind(board: BoardBinding): void;
|
|
730
783
|
}
|
|
731
784
|
//#endregion
|
|
732
|
-
export { Protocol as C, Method as S,
|
|
785
|
+
export { Protocol as C, Method as S, MiddlewareContext as _, Identity as a, WriteSource as b, SelfCaller as c, Board as d, BoardOptions as f, Middleware as g, DroppedError as h, Caller as i, Subscription as l, WatcherContext as m, BackendRoute as n, InboxDelivery as o, Watcher as p, BoardBinding as r, ProtocolMethods as s, Backend as t, VerifiedCaller as u, Write as v, HttpError as x, WritePatch as y };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./external-
|
|
2
|
-
import { c as SyncProvider, s as ResolvedTarget } from "./events-
|
|
1
|
+
import "./external-CYe424fO.mjs";
|
|
2
|
+
import { c as SyncProvider, s as ResolvedTarget } from "./events-IQg0k281.mjs";
|
|
3
3
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
4
|
import { Chat, stringifyMarkdown } from "chat";
|
|
5
5
|
//#region src/sync/chat.ts
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { T as ProviderEvent, a as ProviderOptions, c as ReceivedEvent, d as ResolvedTarget, g as SyncFn, i as ProviderFile, k as SyncRoot, n as FileDelivery, o as ProviderPost, p as SyncProvider, r as ProviderDelivery, s as Receive, t as FetchedLink } from "./provider-gynDUoyW.mjs";
|
|
1
|
+
import { Zt as Actor, an as ExternalLink, in as ExternalFile, nn as ExternalAuthor, ot as SourceRead, rt as SourceJoin } from "./routes-De4W6lEs.mjs";
|
|
2
|
+
import { T as ProviderEvent, a as ProviderOptions, c as ReceivedEvent, d as ResolvedTarget, g as SyncFn, i as ProviderFile, k as SyncRoot, n as FileDelivery, o as ProviderPost, p as SyncProvider, r as ProviderDelivery, s as Receive, t as FetchedLink } from "./provider-hB8QNrwm.mjs";
|
|
4
3
|
import { Adapter, Author, FileUpload, Message, ReactionEvent, StateAdapter } from "chat";
|
|
5
4
|
//#region src/sync/chat-provider.d.ts
|
|
6
5
|
type ChatInput = {
|
package/dist/cli-commands.d.mts
CHANGED
|
@@ -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-
|
|
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-BkVMdXP1.mjs";
|
|
2
2
|
export { CliArgument, CliCommand, CliExample, CliOption, OptionName, commands, filters, globalOptions, groups, option, options, usage };
|
package/dist/cli-commands.mjs
CHANGED
|
@@ -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-
|
|
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-B8oZEByR.mjs";
|
|
2
2
|
export { commands, filters, globalOptions, groups, option, options, usage };
|
package/dist/cli-embedded.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./index-
|
|
1
|
+
import { d as Board } from "./backend-u1sVvybh.mjs";
|
|
2
|
+
import "./index-D6mK0Ial.mjs";
|
|
3
3
|
//#region src/cli/failure.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* What kind of failure it is, which fixes the exit code: 2 for `usage` and `missing_input`, 130
|