@vercel/board 0.36.0 → 0.38.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/dist/{access-BsP0hvcC.mjs → access-CVkjSfxj.mjs} +12 -12
- package/dist/access.d.mts +3 -3
- package/dist/access.mjs +6 -5
- package/dist/{actors-DFOpTw89.mjs → actors-kfMejhaw.mjs} +6 -4
- package/dist/{auth-CrjXLgOb.mjs → auth-B3bBYOqf.mjs} +2 -2
- package/dist/{auth-C21V0EK1.d.mts → auth-BXLCkeB0.d.mts} +3 -3
- package/dist/{backend-D21q8mdm.d.mts → backend-BkQlF1LQ.d.mts} +3 -9
- package/dist/backend-local.d.mts +1 -1
- package/dist/backend-local.mjs +1 -1
- package/dist/{chat-provider-Bb-jeJLY.mjs → chat-provider-1WKsLEnM.mjs} +2 -2
- package/dist/{chat-provider-DmZCmBkb.d.mts → chat-provider-DyNy5xdC.d.mts} +2 -2
- package/dist/cli-commands.d.mts +1 -1
- package/dist/cli-commands.mjs +1 -1
- package/dist/cli-embedded.d.mts +18 -2
- package/dist/cli-embedded.mjs +22 -4
- package/dist/cli.mjs +50 -676
- package/dist/{commands-DGID-4Z2.d.mts → commands-B5d-lmNN.d.mts} +1 -1
- package/dist/{commands-BLtqSwha.mjs → commands-BLS7erNu.mjs} +12 -1
- package/dist/{conformance-CKrwglzA.mjs → conformance-qJF96jZI.mjs} +164 -23
- package/dist/conformance.d.mts +10 -2
- package/dist/conformance.mjs +1 -1
- package/dist/digest-DAxy9Ula.mjs +4 -0
- package/dist/{engine-B_prP0b8.mjs → engine-eUgO5jTM.mjs} +18 -14
- package/dist/{events-AEKh9tJm.mjs → events-C6HwB046.mjs} +23 -9
- package/dist/exports-BJ3wmEMY.d.mts +4 -0
- package/dist/{exports-Ck4Xu3OV.mjs → exports-BsfcChdp.mjs} +805 -193
- package/dist/{external-BA2aCC_3.mjs → external-CHDxWIVf.mjs} +1 -1
- package/dist/{index-LREsSZb2.d.mts → index-DpVyZa9b.d.mts} +2 -2
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +3 -3
- package/dist/index.node.d.mts +5 -5
- package/dist/index.node.mjs +2 -2
- package/dist/inspect/app.js +44 -44
- package/dist/inspect/engine.js +5 -5
- package/dist/inspect-5mkjJYMS.mjs +2 -0
- package/dist/inspect-DtCbBtOW.mjs +643 -0
- package/dist/{local-DJ_qI9q7.mjs → local-Bo3XzEKB.mjs} +29 -84
- package/dist/{main-Jz4nbNJi.mjs → main-0nvLgajF.mjs} +45 -37
- package/dist/{memory-DqwXlyK4.mjs → memory-DkoqhxIH.mjs} +2 -2
- package/dist/{middleware-BxgizazV.mjs → middleware-CPqAuRtp.mjs} +10 -2
- package/dist/page-R0RoE_gM.mjs +2 -0
- package/dist/page-UsfvSIWc.mjs +30 -0
- package/dist/{provider-DEOfc4Ls.d.mts → provider-D5yVFisj.d.mts} +5 -3
- package/dist/{routes-BpKdMvgX.d.mts → routes-BffuaoTX.d.mts} +11 -18
- package/dist/{schemas-BG205xds.mjs → schemas-AZkxk06N.mjs} +3 -3
- package/dist/{serve-Puf3I-oI.mjs → serve-D7I3KisQ.mjs} +3 -3
- package/dist/{server-CS-1aeTl.mjs → server-Cc3nYq3H.mjs} +23 -13
- package/dist/{serving-6_bhBNAW.mjs → serving-DJMcG0dT.mjs} +1 -1
- package/dist/{sql-aetuEBZC.mjs → sql-l3ysn4O5.mjs} +2 -2
- package/dist/{sqlite-DvsB8ENQ.mjs → sqlite-CAwNHbQD.mjs} +2 -2
- package/dist/{sqlite-db-BPwRoDI7.mjs → sqlite-db-cm5yhrD-.mjs} +1 -1
- 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/{targets-Dk_xgS9q.mjs → targets-B4Uikw0J.mjs} +66 -21
- package/dist/{tokens-Dn4cPZIr.mjs → tokens-DA9ipsZ-.mjs} +1 -1
- package/docs/01-board/01-mounting.md +12 -9
- package/docs/01-board/03-identity.md +2 -1
- package/docs/01-board/06-watchers.md +71 -40
- package/docs/01-board/09-access.md +10 -5
- package/docs/01-quickstart.md +1 -1
- package/docs/02-sync/01-overview.md +7 -7
- package/docs/02-sync/02-functions.md +5 -8
- package/docs/02-sync/03-slack.md +0 -8
- package/docs/02-sync/04-github.md +0 -8
- package/docs/02-sync/07-linear.md +0 -6
- package/docs/03-guides/01-coding-agents.md +1 -0
- package/docs/03-guides/02-inspector.md +3 -2
- package/docs/03-guides/03-ci.md +10 -4
- package/docs/03-guides/04-triage.md +8 -13
- package/docs/04-reference/01-cli.md +51 -13
- package/docs/04-reference/02-board.md +2 -1
- package/docs/04-reference/03-http.md +4 -4
- package/docs/04-reference/05-conformance.md +10 -3
- package/docs/index.md +3 -10
- package/package.json +2 -1
- package/dist/attempts-HXcskN1w.mjs +0 -10
- package/dist/exports-BxljH73E.d.mts +0 -4
|
@@ -446,7 +446,7 @@ declare const options: {
|
|
|
446
446
|
readonly expires: {
|
|
447
447
|
readonly type: 'string';
|
|
448
448
|
readonly value: 'duration';
|
|
449
|
-
readonly description: 'how long it lives (default: 30d, at most 90d)';
|
|
449
|
+
readonly description: 'how long it lives (default: 30d, at most 90d; 1d and 7d on Vercel\'s board)';
|
|
450
450
|
};
|
|
451
451
|
readonly port: {
|
|
452
452
|
readonly type: 'string';
|
|
@@ -398,7 +398,7 @@ const options = {
|
|
|
398
398
|
expires: {
|
|
399
399
|
type: "string",
|
|
400
400
|
value: "duration",
|
|
401
|
-
description: "how long it lives (default: 30d, at most 90d)"
|
|
401
|
+
description: "how long it lives (default: 30d, at most 90d; 1d and 7d on Vercel's board)"
|
|
402
402
|
},
|
|
403
403
|
port: {
|
|
404
404
|
type: "string",
|
|
@@ -1168,6 +1168,17 @@ const commands = [
|
|
|
1168
1168
|
value: "wait dev --mentions --timeout 10m"
|
|
1169
1169
|
}]
|
|
1170
1170
|
},
|
|
1171
|
+
{
|
|
1172
|
+
group: "live",
|
|
1173
|
+
name: "inspect",
|
|
1174
|
+
description: "the board in your browser, as you: read, post, react (local only)",
|
|
1175
|
+
arguments: [],
|
|
1176
|
+
options: [option("port", "the port to listen on (default: a free one)"), option("no-open")],
|
|
1177
|
+
examples: [{
|
|
1178
|
+
name: "open the board in your browser",
|
|
1179
|
+
value: "inspect"
|
|
1180
|
+
}]
|
|
1181
|
+
},
|
|
1171
1182
|
{
|
|
1172
1183
|
group: "live",
|
|
1173
1184
|
name: "help",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { u as BoardError } from "./errors-rYDxZEuN.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { c as compileAccess } from "./access-CVkjSfxj.mjs";
|
|
3
3
|
//#region src/conformance/index.ts
|
|
4
4
|
var Mismatch = class extends Error {};
|
|
5
5
|
const show = (value) => JSON.stringify(value) ?? String(value);
|
|
@@ -28,6 +28,21 @@ async function refused(attempt, status, what) {
|
|
|
28
28
|
}
|
|
29
29
|
throw new Mismatch(`${what}: expected ${status}, and it succeeded`);
|
|
30
30
|
}
|
|
31
|
+
const NO_CAN = "this run can't call the board with an x-board-can header";
|
|
32
|
+
/**
|
|
33
|
+
* That `attempt`, by a caller narrowed with `x-board-can`, is refused as one: 403 `forbidden`.
|
|
34
|
+
* Vercel's API's refusal of a person's watchers goes on as it is, for the run to skip.
|
|
35
|
+
*/
|
|
36
|
+
async function narrowedOut(attempt, what) {
|
|
37
|
+
try {
|
|
38
|
+
await attempt;
|
|
39
|
+
} catch (error) {
|
|
40
|
+
if (error instanceof BoardError && error.code === "watchers_need_project") throw error;
|
|
41
|
+
if (error instanceof BoardError && error.status === 403 && error.code === "forbidden") return;
|
|
42
|
+
throw new Mismatch(`${what}, by a caller narrowed with x-board-can: expected 403 forbidden, got ${error instanceof BoardError ? `${error.status} ${error.code}` : String(error)}`);
|
|
43
|
+
}
|
|
44
|
+
throw new Mismatch(`${what}, by a caller narrowed with x-board-can: expected 403 forbidden, and it succeeded`);
|
|
45
|
+
}
|
|
31
46
|
/** Where a registration is woken, to put back after a check replaces it: its path (and branch) on a board that wakes by path, or its url. */
|
|
32
47
|
function wokenAt(registered) {
|
|
33
48
|
if (!registered?.path) return { url: registered?.url ?? null };
|
|
@@ -76,6 +91,17 @@ const grantFor = (ctx) => ({
|
|
|
76
91
|
principals: [projectFor(ctx)],
|
|
77
92
|
can: { [`${subtreeOf(ctx)}ci/`]: ["post"] }
|
|
78
93
|
});
|
|
94
|
+
/**
|
|
95
|
+
* Whom the checks that grant to someone besides the project name: the app the run was given, or
|
|
96
|
+
* else the repository, which a board that takes no GitHub principal in a grant refuses (Vercel's).
|
|
97
|
+
*/
|
|
98
|
+
const granteeOf = (ctx) => ctx.principals.app !== null ? {
|
|
99
|
+
kind: "app",
|
|
100
|
+
app: ctx.principals.app
|
|
101
|
+
} : {
|
|
102
|
+
kind: "github",
|
|
103
|
+
repository: ctx.principals.repository
|
|
104
|
+
};
|
|
79
105
|
/** A check that can't run here, and why: it's skipped, not failed. */
|
|
80
106
|
var Skip = class extends Error {};
|
|
81
107
|
/** A board that looks names up and has none for one a check named: what to pass instead. */
|
|
@@ -109,6 +135,7 @@ async function withGrants(ctx, check) {
|
|
|
109
135
|
made.push(grant.id);
|
|
110
136
|
} catch (error) {
|
|
111
137
|
if (error instanceof BoardError && error.status === 403) return;
|
|
138
|
+
if (error instanceof BoardError && error.code === "unsupported_principal") throw error;
|
|
112
139
|
throw unnamed(error) ?? new Mismatch(`${what}: expected 403, got ${error instanceof BoardError ? `${error.status} ${error.code}` : messageOf(error)}`);
|
|
113
140
|
}
|
|
114
141
|
throw new Mismatch(`${what}: expected 403, and it made the grant`);
|
|
@@ -568,6 +595,27 @@ const CHECKS = [
|
|
|
568
595
|
}), 400, "invalid_request", "posting to a malformed channel");
|
|
569
596
|
}
|
|
570
597
|
},
|
|
598
|
+
{
|
|
599
|
+
group: "core",
|
|
600
|
+
name: "narrows a caller to what its x-board-can says",
|
|
601
|
+
run: async (ctx) => {
|
|
602
|
+
if (!ctx.withCan) return NO_CAN;
|
|
603
|
+
const { root } = needRoot(ctx);
|
|
604
|
+
const narrowed = ctx.withCan(`${ctx.channel}=read`);
|
|
605
|
+
const me = await narrowed.me();
|
|
606
|
+
same(me.principal, ctx.me.principal, "a narrowed caller's principal, its own");
|
|
607
|
+
alike(me.can, { [ctx.channel]: ["read"] }, "what a caller narrowed to read says it may do");
|
|
608
|
+
same((await narrowed.thread(root.id)).message.id, root.id, "a thread read by a caller narrowed to read it");
|
|
609
|
+
await refused(narrowed.post(ctx.channel, {
|
|
610
|
+
text: "conformance: narrowed to read",
|
|
611
|
+
labels: ctx.labels,
|
|
612
|
+
noSync: true
|
|
613
|
+
}).then((message) => {
|
|
614
|
+
ctx.posted.push(message.id);
|
|
615
|
+
return message;
|
|
616
|
+
}), 403, "a post by a caller narrowed to read");
|
|
617
|
+
}
|
|
618
|
+
},
|
|
571
619
|
{
|
|
572
620
|
group: "schedules",
|
|
573
621
|
name: "schedules a reply, lists it, and cancels it",
|
|
@@ -627,7 +675,7 @@ const CHECKS = [
|
|
|
627
675
|
const first = await make(grantFor(ctx));
|
|
628
676
|
const again = await make(grantFor(ctx));
|
|
629
677
|
check(again.id !== first.id, `the same principals again should be another grant, got ${again.id} twice`);
|
|
630
|
-
const
|
|
678
|
+
const other = granteeOf(ctx);
|
|
631
679
|
const ci = `${subtreeOf(ctx)}ci/`;
|
|
632
680
|
const update = async (change) => {
|
|
633
681
|
try {
|
|
@@ -637,29 +685,23 @@ const CHECKS = [
|
|
|
637
685
|
}
|
|
638
686
|
};
|
|
639
687
|
const added = await update({
|
|
640
|
-
add: [
|
|
641
|
-
kind: "github",
|
|
642
|
-
repository
|
|
643
|
-
}, projectFor(ctx, ["production"])],
|
|
688
|
+
add: [other, projectFor(ctx, ["production"])],
|
|
644
689
|
can: { [ci]: ["read", "post"] }
|
|
645
690
|
});
|
|
646
691
|
same(added.grant.id, first.id, "the updated grant's id");
|
|
647
|
-
alike(added.grant.principals.map((principal) => principal.kind), ["project",
|
|
692
|
+
alike(added.grant.principals.map((principal) => principal.kind), ["project", other.kind], `principals after adding ${other.kind === "app" ? "an app" : "a repository"}, and the project again`);
|
|
648
693
|
const project = added.grant.principals[0];
|
|
649
694
|
alike(sortedOf(project?.kind === "project" ? project.environments : void 0), sortedOf(["preview", "production"]), "the project's environments, after adding it again");
|
|
650
695
|
alike(added.grant.can, { [ci]: ["read", "post"] }, "the updated grant's can");
|
|
651
696
|
alike((await update({ remove: [{
|
|
652
697
|
kind: "project",
|
|
653
698
|
project: ctx.principals.project
|
|
654
|
-
}] })).grant.principals.map((principal) => principal.kind), [
|
|
699
|
+
}] })).grant.principals.map((principal) => principal.kind), [other.kind], "principals after removing the project");
|
|
655
700
|
await rejects(update({ remove: [{
|
|
656
701
|
kind: "project",
|
|
657
702
|
project: ctx.principals.project
|
|
658
703
|
}] }), 400, "not_in_grant", "removing a principal the grant no longer names");
|
|
659
|
-
await rejects(update({ remove: [
|
|
660
|
-
kind: "github",
|
|
661
|
-
repository
|
|
662
|
-
}] }), 400, "grant_empty", "removing the last principal");
|
|
704
|
+
await rejects(update({ remove: [other] }), 400, "grant_empty", "removing the last principal");
|
|
663
705
|
await rejects(ctx.board.updateGrant(`${first.id}0`, { can: { [ci]: ["read"] } }), 404, "grant_not_found", "updating a grant that was never made");
|
|
664
706
|
})
|
|
665
707
|
},
|
|
@@ -862,10 +904,7 @@ const CHECKS = [
|
|
|
862
904
|
run: (ctx) => withGrants(ctx, async ({ make, deny, mint, keep }) => {
|
|
863
905
|
const subtree = subtreeOf(ctx);
|
|
864
906
|
const secret = `${subtree}secret/`;
|
|
865
|
-
const run =
|
|
866
|
-
kind: "github",
|
|
867
|
-
repository: ctx.principals.repository
|
|
868
|
-
};
|
|
907
|
+
const run = granteeOf(ctx);
|
|
869
908
|
const narrowed = await mint({
|
|
870
909
|
"*": "all",
|
|
871
910
|
[secret]: []
|
|
@@ -905,10 +944,7 @@ const CHECKS = [
|
|
|
905
944
|
can: { [open]: ["read"] }
|
|
906
945
|
});
|
|
907
946
|
await deny(narrowed, {
|
|
908
|
-
principals: [
|
|
909
|
-
kind: "github",
|
|
910
|
-
repository: ctx.principals.repository
|
|
911
|
-
}],
|
|
947
|
+
principals: [granteeOf(ctx)],
|
|
912
948
|
can: { [`${subtree}ci/`]: ["post"] }
|
|
913
949
|
}, `a grant from a token kept out of ${open}, which everyone reads`);
|
|
914
950
|
})
|
|
@@ -1037,7 +1073,6 @@ const CHECKS = [
|
|
|
1037
1073
|
if (registered && (Object.keys(registered.watch).length > 0 || (registered.sync?.length ?? 0) > 0)) return "this token has watchers or a sync registered here, and checking would replace them";
|
|
1038
1074
|
const byPath = (await ctx.board.discovery()).wake_by_path;
|
|
1039
1075
|
const environment = /^vercel:project:[^:]+:(.+)$/.exec(ctx.me.principal)?.[1] ?? null;
|
|
1040
|
-
if (byPath && environment !== null && environment !== "production" && environment !== "preview") return `a path wakes production or a preview, and this token is ${environment}'s`;
|
|
1041
1076
|
const where = wokenAt(registered);
|
|
1042
1077
|
const branch = environment === "preview" ? { branch: "conformance" } : {};
|
|
1043
1078
|
const attempt = () => ctx.board.register({
|
|
@@ -1062,6 +1097,23 @@ const CHECKS = [
|
|
|
1062
1097
|
}
|
|
1063
1098
|
}
|
|
1064
1099
|
},
|
|
1100
|
+
{
|
|
1101
|
+
group: "watchers",
|
|
1102
|
+
name: "refuses a caller narrowed with x-board-can its principal's watchers: registering, pulling, and acking",
|
|
1103
|
+
run: async (ctx) => {
|
|
1104
|
+
if (!ctx.withCan) return NO_CAN;
|
|
1105
|
+
const narrowed = ctx.withCan(`${ctx.channel}=all`);
|
|
1106
|
+
const registered = (await ctx.board.watchers()).find((r) => r.owner === ctx.me.principal);
|
|
1107
|
+
const now = {
|
|
1108
|
+
...wokenAt(registered),
|
|
1109
|
+
watch: registered?.watch ?? {},
|
|
1110
|
+
...registered?.sync ? { sync: registered.sync } : {}
|
|
1111
|
+
};
|
|
1112
|
+
await narrowedOut(narrowed.register(now), "registering watchers");
|
|
1113
|
+
await narrowedOut(narrowed.matches(), "pulling matches");
|
|
1114
|
+
await narrowedOut(narrowed.ack(`conformance-${ctx.labels.conformance}`, { lease: "conformance" }), "acking a match");
|
|
1115
|
+
}
|
|
1116
|
+
},
|
|
1065
1117
|
{
|
|
1066
1118
|
group: "sync",
|
|
1067
1119
|
name: "keeps sync's records: an import as a platform author, its lookups by platform ID, a receipt, and where it's synced",
|
|
@@ -1278,6 +1330,82 @@ const CHECKS = [
|
|
|
1278
1330
|
same(thread.message.noSync, true, "a post's noSync, read back");
|
|
1279
1331
|
same(thread.replies.find((m) => m.id === reply.id)?.noSync, true, "a reply's noSync, read back");
|
|
1280
1332
|
}
|
|
1333
|
+
},
|
|
1334
|
+
{
|
|
1335
|
+
group: "sync",
|
|
1336
|
+
name: "refuses a caller narrowed with x-board-can sync's records: imports, receipts, and the inbox",
|
|
1337
|
+
run: async (ctx) => {
|
|
1338
|
+
if (!ctx.withCan) return NO_CAN;
|
|
1339
|
+
const { root } = needRoot(ctx);
|
|
1340
|
+
const registered = await registerSync(ctx);
|
|
1341
|
+
if ("skip" in registered) return registered.skip;
|
|
1342
|
+
const run = ctx.labels.conformance;
|
|
1343
|
+
const author = {
|
|
1344
|
+
id: `${SYNC_KEY}:user:${run}`,
|
|
1345
|
+
handle: "conformance",
|
|
1346
|
+
name: "Conformance",
|
|
1347
|
+
avatar: null,
|
|
1348
|
+
isBot: false
|
|
1349
|
+
};
|
|
1350
|
+
const thread = `${SYNC_KEY}:${run}:narrowed`;
|
|
1351
|
+
try {
|
|
1352
|
+
const narrowed = ctx.withCan(`${ctx.channel}=all`);
|
|
1353
|
+
await narrowedOut(narrowed.syncImport({
|
|
1354
|
+
op: "post",
|
|
1355
|
+
author,
|
|
1356
|
+
from: SYNC_KEY,
|
|
1357
|
+
channel: ctx.channel,
|
|
1358
|
+
text: "conformance: a narrowed import",
|
|
1359
|
+
labels: ctx.labels,
|
|
1360
|
+
noSync: true,
|
|
1361
|
+
origin: {
|
|
1362
|
+
channel: `${SYNC_KEY}:${run}`,
|
|
1363
|
+
thread,
|
|
1364
|
+
subthread: null,
|
|
1365
|
+
message: "1",
|
|
1366
|
+
context: null
|
|
1367
|
+
}
|
|
1368
|
+
}), "an import");
|
|
1369
|
+
await narrowedOut(narrowed.syncReceipt({
|
|
1370
|
+
kind: "failed",
|
|
1371
|
+
message: root.id,
|
|
1372
|
+
target: thread,
|
|
1373
|
+
error: "conformance"
|
|
1374
|
+
}), "a receipt");
|
|
1375
|
+
const event = {
|
|
1376
|
+
kind: "message",
|
|
1377
|
+
channel: `${SYNC_KEY}:${run}`,
|
|
1378
|
+
thread,
|
|
1379
|
+
subthread: null,
|
|
1380
|
+
message: "1",
|
|
1381
|
+
isRoot: true,
|
|
1382
|
+
text: "conformance: a narrowed push",
|
|
1383
|
+
context: null,
|
|
1384
|
+
author
|
|
1385
|
+
};
|
|
1386
|
+
await narrowedOut(narrowed.inboxPush(SYNC_KEY, [{
|
|
1387
|
+
id: `conformance-narrowed-${run}`,
|
|
1388
|
+
event,
|
|
1389
|
+
raw: null
|
|
1390
|
+
}]), "a push to the inbox");
|
|
1391
|
+
await narrowedOut(narrowed.inboxNext(SYNC_KEY, { limit: 1 }), "a lease from the inbox");
|
|
1392
|
+
await narrowedOut(narrowed.inboxAck(SYNC_KEY, `conformance-narrowed-${run}`, { lease: "conformance" }), "an ack to the inbox");
|
|
1393
|
+
} finally {
|
|
1394
|
+
await ctx.board.syncImport({
|
|
1395
|
+
op: "delete",
|
|
1396
|
+
author,
|
|
1397
|
+
from: SYNC_KEY,
|
|
1398
|
+
origin: {
|
|
1399
|
+
thread,
|
|
1400
|
+
message: "1"
|
|
1401
|
+
}
|
|
1402
|
+
}).catch(() => {});
|
|
1403
|
+
await ctx.board.register({
|
|
1404
|
+
...registered.where,
|
|
1405
|
+
watch: {}
|
|
1406
|
+
}).catch(() => {});
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1281
1409
|
}
|
|
1282
1410
|
];
|
|
1283
1411
|
/**
|
|
@@ -1367,6 +1495,7 @@ async function conformance(board, options = {}) {
|
|
|
1367
1495
|
me,
|
|
1368
1496
|
posted: [],
|
|
1369
1497
|
...options.withToken ? { withToken: options.withToken } : {},
|
|
1498
|
+
...options.withCan ? { withCan: options.withCan } : {},
|
|
1370
1499
|
principals: {
|
|
1371
1500
|
project: options.principals?.project ?? `prj_conformance${label}`,
|
|
1372
1501
|
repository: options.principals?.repository ?? `acme/conformance-${label}`,
|
|
@@ -1395,11 +1524,23 @@ async function conformance(board, options = {}) {
|
|
|
1395
1524
|
status: "skipped",
|
|
1396
1525
|
detail: `not kept here: ${error.message}`
|
|
1397
1526
|
});
|
|
1398
|
-
else if (group === "watchers" && error instanceof BoardError && error.code === "
|
|
1527
|
+
else if (group === "watchers" && error instanceof BoardError && error.code === "watchers_need_project") checks.push({
|
|
1528
|
+
group,
|
|
1529
|
+
name,
|
|
1530
|
+
status: "skipped",
|
|
1531
|
+
detail: "only a deployment registers watchers here"
|
|
1532
|
+
});
|
|
1533
|
+
else if (group === "grants" && error instanceof BoardError && error.code === "unsupported_principal") checks.push({
|
|
1534
|
+
group,
|
|
1535
|
+
name,
|
|
1536
|
+
status: "skipped",
|
|
1537
|
+
detail: "this board takes no GitHub or OIDC principals in a grant"
|
|
1538
|
+
});
|
|
1539
|
+
else if (group === "tokens" && error instanceof BoardError && error.code === "unsupported_principal") checks.push({
|
|
1399
1540
|
group,
|
|
1400
1541
|
name,
|
|
1401
1542
|
status: "skipped",
|
|
1402
|
-
detail: "
|
|
1543
|
+
detail: "this board mints tokens only for a deployment: run as one to check them"
|
|
1403
1544
|
});
|
|
1404
1545
|
else checks.push({
|
|
1405
1546
|
group,
|
package/dist/conformance.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as Board } from "./backend-
|
|
1
|
+
import { d as Board } from "./backend-BkQlF1LQ.mjs";
|
|
2
2
|
//#region src/conformance/index.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Checks that a board speaks the protocol, through a handle on it (`conformance(board())`), as
|
|
@@ -30,13 +30,21 @@ export type ConformanceOptions = {
|
|
|
30
30
|
* that check is skipped.
|
|
31
31
|
*/
|
|
32
32
|
withToken?: (secret: string) => Board;
|
|
33
|
+
/**
|
|
34
|
+
* The same board, with this run's credential and an `x-board-can` header that narrows it to
|
|
35
|
+
* `can` (`conformance=read`), as a proxy holding the credential sends it: the checks of a
|
|
36
|
+
* narrowed caller call it so. Without it, they're skipped.
|
|
37
|
+
*/
|
|
38
|
+
withCan?: (can: string) => Board;
|
|
33
39
|
/**
|
|
34
40
|
* Whom the grants checks name. A board that verifies tokens itself (`vb serve`) takes the made-up
|
|
35
41
|
* IDs they use without it; one that looks names up, as Vercel's API does, needs real ones on its
|
|
36
42
|
* team, or skips the checks that name them: a `project` (its name or ID), a GitHub `repository`
|
|
37
43
|
* no grant names, a `viewer` (a person's email or ID whose team role is viewer), to check
|
|
38
44
|
* that a role caps what grants give, and an `app` installed on the board's team (its slug or
|
|
39
|
-
* client ID), which a local board has none of.
|
|
45
|
+
* client ID), which a local board has none of. Checks that grant to someone besides the project
|
|
46
|
+
* name the app when there's one, and the repository otherwise: Vercel's board takes no GitHub
|
|
47
|
+
* principal in a grant, so give it an app. None may be the run's own: it throws before it
|
|
40
48
|
* writes.
|
|
41
49
|
*/
|
|
42
50
|
principals?: {
|
package/dist/conformance.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as conformance } from "./conformance-
|
|
1
|
+
import { t as conformance } from "./conformance-qJF96jZI.mjs";
|
|
2
2
|
export { conformance };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { _ as fileSize, h as IMPORT_BYTES_MAX, p as ATTACHMENT_BYTES_MAX, r as badRequest, s as notFound, t as HttpError, y as typeOf } from "./errors-rYDxZEuN.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { l as isThreadTarget, s as channelOf } from "./external-
|
|
2
|
+
import { b as toStorable, f as MESSAGE_TEXT_MAX, o as ChannelPath } from "./schemas-AZkxk06N.mjs";
|
|
3
|
+
import { l as isThreadTarget, s as channelOf } from "./external-CHDxWIVf.mjs";
|
|
4
4
|
import { t as canonicalEmoji } from "./emoji-CTLpvH-A.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { a as waitUntil, i as afterRetry, s as derivedId, t as DroppedError } from "./middleware-CPqAuRtp.mjs";
|
|
6
6
|
import { n as replaceMentions } from "./mentions-CB6ShY4R.mjs";
|
|
7
|
-
import {
|
|
8
|
-
import { a as immutable, d as routesFor, l as UnreadableError, n as SyncOverrides, o as ReceivedEvent, s as ResolvedTarget, u as channelMissing } from "./events-AEKh9tJm.mjs";
|
|
7
|
+
import { a as immutable, d as routesFor, l as UnreadableError, n as SyncOverrides, o as ReceivedEvent, s as ResolvedTarget, u as channelMissing } from "./events-C6HwB046.mjs";
|
|
9
8
|
import { t as displayText } from "./bots-CGkO76qH.mjs";
|
|
10
9
|
//#region src/sync/engine.ts
|
|
11
10
|
/** `files`: a message with files may have no text. */
|
|
@@ -22,12 +21,12 @@ const keepsNoFiles = (error) => error instanceof HttpError && error.code === "no
|
|
|
22
21
|
* A platform file on a board that keeps no files: a link to where it lives on the platform, which
|
|
23
22
|
* its readers there can open, or its name when the platform gave no URL.
|
|
24
23
|
*/
|
|
25
|
-
const fileLink = (file) => {
|
|
24
|
+
const fileLink = (file, why) => {
|
|
26
25
|
const name = file.name ?? "a file";
|
|
27
|
-
if (!file.url || !/^https?:\/\//.test(file.url)) return fileNote(file,
|
|
26
|
+
if (!file.url || !/^https?:\/\//.test(file.url)) return fileNote(file, why);
|
|
28
27
|
const label = name.replace(/[[\]\\]/g, (char) => `\\${char}`);
|
|
29
28
|
const url = file.url.replace(/[ ()]/g, (char) => `%${char.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
30
|
-
return fileNote(file,
|
|
29
|
+
return fileNote(file, why, `[${label}](${url})`);
|
|
31
30
|
};
|
|
32
31
|
/** A platform message's text with its file notes after it. */
|
|
33
32
|
const withNotes = (text, notes) => notes.length ? `${text.trim() ? `${text}\n\n` : ""}${notes.join("\n")}` : text;
|
|
@@ -227,7 +226,11 @@ function createSyncEngine(entries) {
|
|
|
227
226
|
"subthread" in event ? event.subthread : null
|
|
228
227
|
]) if (location !== null && !location.startsWith(`${key}:`)) throw badRequest(`provider locations must belong to sync entry ${key}`);
|
|
229
228
|
const routes = routesFor(platformOf(key));
|
|
230
|
-
|
|
229
|
+
const kept = routes && await routes(native(event.channel), (name) => resolve(key, name)).catch(async (error) => {
|
|
230
|
+
if (await syncsThread(event.thread)) return true;
|
|
231
|
+
throw error;
|
|
232
|
+
});
|
|
233
|
+
if (routes && !kept && !await syncsThread(event.thread)) return;
|
|
231
234
|
await call("inboxPush", {
|
|
232
235
|
key,
|
|
233
236
|
events: [{
|
|
@@ -377,10 +380,11 @@ function createSyncEngine(entries) {
|
|
|
377
380
|
async function importFiles(platform, files, attempt) {
|
|
378
381
|
const attachments = [];
|
|
379
382
|
const notes = [];
|
|
380
|
-
|
|
383
|
+
/** Why the board takes none of them, in its words, once it said so. */
|
|
384
|
+
let noFiles = null;
|
|
381
385
|
for (const file of files.slice(0, 10)) {
|
|
382
|
-
if (noFiles) {
|
|
383
|
-
notes.push(fileLink(file));
|
|
386
|
+
if (noFiles !== null) {
|
|
387
|
+
notes.push(fileLink(file, noFiles));
|
|
384
388
|
continue;
|
|
385
389
|
}
|
|
386
390
|
if (file.size !== void 0 && file.size > 26214400) {
|
|
@@ -422,8 +426,8 @@ function createSyncEngine(entries) {
|
|
|
422
426
|
continue;
|
|
423
427
|
}
|
|
424
428
|
if (!keepsNoFiles(error)) throw error;
|
|
425
|
-
noFiles =
|
|
426
|
-
notes.push(fileLink(file));
|
|
429
|
+
noFiles = error.message;
|
|
430
|
+
notes.push(fileLink(file, noFiles));
|
|
427
431
|
}
|
|
428
432
|
}
|
|
429
433
|
for (const file of files.slice(10)) notes.push(fileNote(file, `a message carries at most 10`));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as ExternalEvent, r as ExternalLocation } from "./external-
|
|
1
|
+
import { d as Labels, l as LabelKey } from "./schemas-AZkxk06N.mjs";
|
|
2
|
+
import { n as ExternalEvent, r as ExternalLocation } from "./external-CHDxWIVf.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/sync/fn.ts
|
|
5
5
|
const ROUTES = Symbol.for("board.syncRoutes");
|
|
@@ -54,26 +54,32 @@ const follow = async (sync) => {
|
|
|
54
54
|
* to every channel's function, with `channel` set to that one. A thread the board syncs outside
|
|
55
55
|
* these channels (someone ran `vb sync` on it) stays synced both ways. A key the platform says
|
|
56
56
|
* doesn't exist is skipped. While one can't be checked, an event outside the resolved channels
|
|
57
|
-
*
|
|
58
|
-
*
|
|
57
|
+
* that it may be (any, for a name; its own, for an ID) throws, so it's retried, rather than
|
|
58
|
+
* going past that key's function to the default. The webhook keeps one an ID may be; one only a
|
|
59
|
+
* name may be, it refuses, so the platform sends it again and nothing off the map is stored. A
|
|
60
|
+
* new root starts only in the channels that resolved.
|
|
59
61
|
*/
|
|
60
62
|
function channels(map) {
|
|
61
63
|
const units = Object.entries(map).map(([name, unit]) => [name, typeof unit === "string" ? mirror(unit) : unit]);
|
|
62
64
|
const resolved = async (resolve) => {
|
|
63
65
|
const ids = await Promise.allSettled(units.map(([name]) => resolve(name)));
|
|
64
66
|
const found = /* @__PURE__ */ new Map();
|
|
65
|
-
|
|
67
|
+
const unchecked = [];
|
|
66
68
|
ids.forEach((id, i) => {
|
|
67
69
|
if (id.status === "fulfilled") found.set(id.value, units[i][1]);
|
|
68
|
-
else if (!channelMissing(id.reason)) unchecked
|
|
70
|
+
else if (!channelMissing(id.reason)) unchecked.push({
|
|
71
|
+
key: units[i][0],
|
|
72
|
+
reason: id.reason
|
|
73
|
+
});
|
|
69
74
|
});
|
|
75
|
+
const pending = (channel) => unchecked.find(({ key }) => key.toLowerCase() === channel.toLowerCase()) ?? unchecked.find(({ key }) => key.startsWith("#"));
|
|
70
76
|
return {
|
|
71
77
|
found,
|
|
72
|
-
|
|
78
|
+
pending
|
|
73
79
|
};
|
|
74
80
|
};
|
|
75
81
|
const fn = async (sync) => {
|
|
76
|
-
const { found,
|
|
82
|
+
const { found, pending } = await resolved(sync.resolve);
|
|
77
83
|
if (sync.direction === "out" && sync.target === null) {
|
|
78
84
|
for (const [channel, unit] of found) await unit({
|
|
79
85
|
...sync,
|
|
@@ -83,10 +89,18 @@ function channels(map) {
|
|
|
83
89
|
}
|
|
84
90
|
const unit = found.get(sync.channel);
|
|
85
91
|
if (unit) return void await unit(sync);
|
|
92
|
+
const unchecked = pending(sync.channel);
|
|
86
93
|
if (unchecked) throw unchecked.reason;
|
|
87
94
|
await follow(sync);
|
|
88
95
|
};
|
|
89
|
-
return withRoutes(fn, async (channel, resolve) =>
|
|
96
|
+
return withRoutes(fn, async (channel, resolve) => {
|
|
97
|
+
const { found, pending } = await resolved(resolve);
|
|
98
|
+
if (found.has(channel)) return true;
|
|
99
|
+
const unchecked = pending(channel);
|
|
100
|
+
if (!unchecked) return false;
|
|
101
|
+
if (unchecked.key.startsWith("#")) throw unchecked.reason;
|
|
102
|
+
return true;
|
|
103
|
+
});
|
|
90
104
|
}
|
|
91
105
|
//#endregion
|
|
92
106
|
//#region src/sync/provider.ts
|