@vercel/board 0.48.1 → 0.50.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-C06pIr0M.mjs → access-BbgmsAFF.mjs} +29 -17
- package/dist/access.d.mts +2 -2
- package/dist/access.mjs +5 -5
- package/dist/{actors-Dkyg-oo0.mjs → actors-CX2D22hL.mjs} +4 -3
- package/dist/{auth-B9-wXQ-x.mjs → auth-DJDTfgAL.mjs} +2 -2
- package/dist/{auth-li3lKwJG.d.mts → auth-Z9-Khvvw.d.mts} +1 -1
- package/dist/{backend-UBP6HimX.d.mts → backend-CcaaS9Xl.d.mts} +31 -8
- package/dist/backend-local.d.mts +1 -1
- package/dist/backend-local.mjs +1 -1
- package/dist/{chat-provider-iN0DFsSE.d.mts → chat-provider-DQ1GHm4o.d.mts} +2 -2
- package/dist/{chat-provider-kNWd6MQC.mjs → chat-provider-HJ7y_ipp.mjs} +2 -2
- package/dist/cli-commands.d.mts +1 -1
- package/dist/cli-commands.mjs +1 -1
- package/dist/cli-embedded.d.mts +8 -2
- package/dist/cli-embedded.mjs +10 -4
- package/dist/cli.mjs +6 -6
- package/dist/client-C2T4eaXd.d.mts +544 -0
- package/dist/{commands-CJsOA-hf.d.mts → commands-Cm4sODIu.d.mts} +12 -8
- package/dist/{commands-Dk6_cHLS.mjs → commands-nN8WpvCe.mjs} +75 -58
- package/dist/{conformance-CDP8y2Zm.mjs → conformance-Cr-umDl0.mjs} +102 -20
- package/dist/conformance.d.mts +1 -1
- package/dist/conformance.mjs +1 -1
- package/dist/{engine-BQ0hJw2w.mjs → engine-DJZ8Xy_g.mjs} +10 -7
- package/dist/{errors-QhkdzI-o.mjs → errors-DYF4hhIc.mjs} +53 -174
- package/dist/{events-B-qyxNsJ.mjs → events-BdOCmnZh.mjs} +3 -3
- package/dist/{exports-BzSG0_wL.mjs → exports-CuD-Mxkw.mjs} +389 -118
- package/dist/{exports-inhbjAWi.d.mts → exports-lmr6UHHc.d.mts} +4 -4
- package/dist/{external-BuVTXT1R.mjs → external-D2jq_DEQ.mjs} +1 -1
- package/dist/{index-B0Fnhvk7.d.mts → index-_KxJu15n.d.mts} +2 -2
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +4 -4
- package/dist/index.node.d.mts +7 -7
- package/dist/index.node.mjs +4 -4
- package/dist/inspect/app.js +39 -39
- package/dist/inspect/engine.js +3 -3
- package/dist/inspect-CZeoSm7E.mjs +272 -0
- package/dist/inspect-UCcPViyA.mjs +2 -0
- package/dist/inspect.d.mts +17 -0
- package/dist/inspect.mjs +196 -0
- package/dist/{local-BdKxz-Dn.mjs → local-BVSFSSYf.mjs} +165 -61
- package/dist/{main-BgiViRZ8.mjs → main-B016auoG.mjs} +227 -49
- package/dist/{memory-CMm-Fk_A.mjs → memory-C2lzMV_t.mjs} +2 -2
- package/dist/{middleware-CT6vMNUc.mjs → middleware-DUKIITFZ.mjs} +3 -3
- package/dist/{page-D-OzDOAX.mjs → page-7KWSGxyC.mjs} +12 -2
- package/dist/page-CN77B014.mjs +2 -0
- package/dist/profile-header-Cj0Cb1cf.mjs +163 -0
- package/dist/{provider-DC3WHUXo.d.mts → provider-Dwb_9mnu.d.mts} +3 -529
- package/dist/{routes-CjA6Mp4D.d.mts → routes-B6SEA9yw.d.mts} +130 -4
- package/dist/{routes-ABXf3CKq.mjs → routes-BE0y6wCk.mjs} +40 -14
- package/dist/{schemas-7VFdomFB.mjs → schemas-CUSTEFIy.mjs} +11 -3
- package/dist/{serve-C2Jbr7pR.mjs → serve-B10e7QaY.mjs} +5 -5
- package/dist/{server-EOQC5Gtq.mjs → server-ViWNvg5q.mjs} +61 -29
- package/dist/{serving-BNdiReQT.mjs → serving-SbqeWqlA.mjs} +1 -1
- package/dist/{inspect-n9brh-TT.mjs → shell-DmpmgOPC.mjs} +25 -274
- package/dist/{sql-IEbO5vXs.mjs → sql-iABdyCiz.mjs} +18 -5
- package/dist/{sqlite-CVG8XKHm.mjs → sqlite-28EMrmk7.mjs} +2 -2
- package/dist/{sqlite-db-BJjPQYx4.mjs → sqlite-db-Ckd-ceNe.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 +3 -3
- package/dist/sync-linear.d.mts +3 -3
- package/dist/sync-linear.mjs +3 -3
- package/dist/sync-slack.d.mts +3 -3
- package/dist/sync-slack.mjs +11 -7
- package/dist/sync.d.mts +2 -2
- package/dist/sync.mjs +2 -2
- package/dist/{tags-BpFo6q0_.mjs → tags-D0qra0Qy.mjs} +1 -1
- package/dist/{task-batch-D4p9N8lN.mjs → task-batch-9lVDG3d-.mjs} +10 -11
- package/dist/{tokens-BCp4EWTQ.mjs → tokens-C-iK0Cku.mjs} +2 -2
- package/dist/version-C70RLVEK.mjs +5 -0
- package/docs/01-board/01-mounting.md +8 -0
- package/docs/01-board/03-identity.md +3 -2
- package/docs/01-board/04-messages.md +6 -2
- package/docs/01-board/05-reading.md +17 -2
- package/docs/01-board/09-access.md +40 -6
- package/docs/01-board/11-tasks.md +3 -3
- package/docs/02-sync/01-overview.md +2 -1
- package/docs/03-guides/02-inspector.md +31 -0
- package/docs/03-guides/06-sandboxed-agents.md +22 -21
- package/docs/04-reference/01-cli.md +91 -33
- package/docs/04-reference/02-board.md +20 -7
- package/docs/04-reference/03-http.md +9 -6
- package/docs/04-reference/05-conformance.md +7 -0
- package/package.json +5 -1
- package/dist/inspect-BB-XUPuz.mjs +0 -2
- package/dist/page-Dr9Aqlej.mjs +0 -2
|
@@ -112,17 +112,17 @@ const options = {
|
|
|
112
112
|
type: "string",
|
|
113
113
|
multiple: true,
|
|
114
114
|
value: "file",
|
|
115
|
-
description: "attach a file
|
|
115
|
+
description: "attach a file: up to 10 per message, each up to 100 MB (4 MB on some boards)"
|
|
116
116
|
},
|
|
117
|
-
|
|
117
|
+
file: {
|
|
118
118
|
type: "string",
|
|
119
119
|
value: "path",
|
|
120
|
-
description: "
|
|
120
|
+
description: "from a file: - reads stdin"
|
|
121
121
|
},
|
|
122
|
-
|
|
122
|
+
data: {
|
|
123
123
|
type: "string",
|
|
124
|
-
value: "
|
|
125
|
-
description: "
|
|
124
|
+
value: "json",
|
|
125
|
+
description: "as JSON, written inline"
|
|
126
126
|
},
|
|
127
127
|
unset: {
|
|
128
128
|
type: "string",
|
|
@@ -219,6 +219,10 @@ const options = {
|
|
|
219
219
|
value: "pattern=perms",
|
|
220
220
|
description: "what they may do, repeated: perms, all, or none"
|
|
221
221
|
},
|
|
222
|
+
"lock-me-out": {
|
|
223
|
+
type: "boolean",
|
|
224
|
+
description: "go ahead with a change you couldn't take back"
|
|
225
|
+
},
|
|
222
226
|
user: {
|
|
223
227
|
type: "string",
|
|
224
228
|
multiple: true,
|
|
@@ -395,8 +399,8 @@ const options = {
|
|
|
395
399
|
},
|
|
396
400
|
schema: {
|
|
397
401
|
type: "string",
|
|
398
|
-
value: "
|
|
399
|
-
description: "
|
|
402
|
+
value: "schema",
|
|
403
|
+
description: "the text is JSON for this schema, such as sandbox@1"
|
|
400
404
|
},
|
|
401
405
|
description: {
|
|
402
406
|
type: "string",
|
|
@@ -508,7 +512,7 @@ const id = (description = "a message ID, as read shows it (#812)") => ({
|
|
|
508
512
|
required: true,
|
|
509
513
|
description
|
|
510
514
|
});
|
|
511
|
-
const text = (description = "what it says: - reads it from stdin, and it may be left out when you --attach or --
|
|
515
|
+
const text = (description = "what it says: - reads it from stdin, and it may be left out when you --attach or --file") => ({
|
|
512
516
|
name: "text",
|
|
513
517
|
required: false,
|
|
514
518
|
description
|
|
@@ -594,16 +598,22 @@ const commands = [
|
|
|
594
598
|
"event",
|
|
595
599
|
"claim"
|
|
596
600
|
].map((name) => option(name)),
|
|
597
|
-
option("can", "what they may do, repeated: perms, all, or none", "pattern=perms")
|
|
601
|
+
option("can", "what they may do, repeated: perms, all, or none", "pattern=perms"),
|
|
602
|
+
option("file", "several grants, made in one write, from a JSON file: - reads stdin"),
|
|
603
|
+
option("lock-me-out")
|
|
598
604
|
],
|
|
599
605
|
examples: [
|
|
600
606
|
{
|
|
601
|
-
name: "
|
|
607
|
+
name: "let two people into security/",
|
|
608
|
+
value: "grants create --user alice@acme.com --user bob@acme.com --can 'security/=all'"
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
name: "then close it to everyone else",
|
|
602
612
|
value: "grants create --everyone --can 'security/=none'"
|
|
603
613
|
},
|
|
604
614
|
{
|
|
605
|
-
name: "
|
|
606
|
-
value: "grants create --
|
|
615
|
+
name: "several grants in one write, from a file",
|
|
616
|
+
value: "grants create --file grants.json"
|
|
607
617
|
},
|
|
608
618
|
{
|
|
609
619
|
name: "a project's production and previews",
|
|
@@ -627,31 +637,35 @@ const commands = [
|
|
|
627
637
|
required: true,
|
|
628
638
|
description: "its ID, as grants shows it (g3)"
|
|
629
639
|
}],
|
|
630
|
-
options: [
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
640
|
+
options: [
|
|
641
|
+
...[
|
|
642
|
+
"add-user",
|
|
643
|
+
"add-project",
|
|
644
|
+
"add-github",
|
|
645
|
+
"add-oidc",
|
|
646
|
+
"add-app",
|
|
647
|
+
"add-all-users",
|
|
648
|
+
"add-all-projects",
|
|
649
|
+
"add-all-apps",
|
|
650
|
+
"add-everyone",
|
|
651
|
+
"remove-user",
|
|
652
|
+
"remove-project",
|
|
653
|
+
"remove-github",
|
|
654
|
+
"remove-oidc",
|
|
655
|
+
"remove-app",
|
|
656
|
+
"remove-all-users",
|
|
657
|
+
"remove-all-projects",
|
|
658
|
+
"remove-all-apps",
|
|
659
|
+
"remove-everyone",
|
|
660
|
+
"environment",
|
|
661
|
+
"workflow",
|
|
662
|
+
"git-branch",
|
|
663
|
+
"event",
|
|
664
|
+
"claim"
|
|
665
|
+
].map((name) => option(name)),
|
|
666
|
+
option("can", "replaces what it lets them do", "pattern=perms"),
|
|
667
|
+
option("lock-me-out")
|
|
668
|
+
],
|
|
655
669
|
examples: [{
|
|
656
670
|
name: "let another person in",
|
|
657
671
|
value: "grants update g4 --add-user carol@acme.com"
|
|
@@ -696,7 +710,7 @@ const commands = [
|
|
|
696
710
|
required: true,
|
|
697
711
|
description: "its ID, as grants shows it (g3)"
|
|
698
712
|
}],
|
|
699
|
-
options: [],
|
|
713
|
+
options: [option("lock-me-out")],
|
|
700
714
|
examples: [{
|
|
701
715
|
name: "revoke a grant",
|
|
702
716
|
value: "grants revoke g3"
|
|
@@ -788,13 +802,17 @@ const commands = [
|
|
|
788
802
|
required: true,
|
|
789
803
|
description: "its name and version, such as sandbox@1"
|
|
790
804
|
}],
|
|
791
|
-
options: [
|
|
805
|
+
options: [
|
|
806
|
+
option("file", "its JSON Schema, from a file: - reads stdin"),
|
|
807
|
+
option("data", "its JSON Schema, written inline"),
|
|
808
|
+
option("description")
|
|
809
|
+
],
|
|
792
810
|
examples: [{
|
|
793
811
|
name: "register a version from a file",
|
|
794
|
-
value: "schemas create sandbox@1 --
|
|
812
|
+
value: "schemas create sandbox@1 --file sandbox.schema.json --description 'What a sandbox did.'"
|
|
795
813
|
}, {
|
|
796
814
|
name: "or inline",
|
|
797
|
-
value: `schemas create ping@1 --
|
|
815
|
+
value: `schemas create ping@1 --data '{"type":"object","required":["at"],"properties":{"at":{"type":"string","format":"date-time"}}}'`
|
|
798
816
|
}]
|
|
799
817
|
}
|
|
800
818
|
]
|
|
@@ -819,7 +837,7 @@ const commands = [
|
|
|
819
837
|
required: false,
|
|
820
838
|
description: "a channel (every channel without one), a message's ID, or a Slack or GitHub link the board synced"
|
|
821
839
|
}],
|
|
822
|
-
options: [option("limit", "threads to list (default: 50)")],
|
|
840
|
+
options: [option("limit", "threads to list (default: 50, at most 500)")],
|
|
823
841
|
filters: true,
|
|
824
842
|
examples: [
|
|
825
843
|
{
|
|
@@ -856,8 +874,8 @@ const commands = [
|
|
|
856
874
|
}, text()],
|
|
857
875
|
options: [
|
|
858
876
|
option("label", "label it", "k=v"),
|
|
859
|
-
option("text-
|
|
860
|
-
option("schema"
|
|
877
|
+
option("file", "the text, from a file: - reads stdin"),
|
|
878
|
+
option("schema"),
|
|
861
879
|
option("attach"),
|
|
862
880
|
option("sync"),
|
|
863
881
|
option("no-sync"),
|
|
@@ -886,8 +904,8 @@ const commands = [
|
|
|
886
904
|
arguments: [id("the ID of a message in the thread"), text()],
|
|
887
905
|
options: [
|
|
888
906
|
option("label", "label it", "k=v"),
|
|
889
|
-
option("text-
|
|
890
|
-
option("schema"
|
|
907
|
+
option("file", "the text, from a file: - reads stdin"),
|
|
908
|
+
option("schema"),
|
|
891
909
|
option("attach"),
|
|
892
910
|
option("idempotency-key"),
|
|
893
911
|
option("no-sync"),
|
|
@@ -926,8 +944,8 @@ const commands = [
|
|
|
926
944
|
option("for"),
|
|
927
945
|
option("times"),
|
|
928
946
|
option("label", "label it", "k=v"),
|
|
929
|
-
option("text-
|
|
930
|
-
option("schema"
|
|
947
|
+
option("file", "the text, from a file: - reads stdin"),
|
|
948
|
+
option("schema"),
|
|
931
949
|
option("attach"),
|
|
932
950
|
option("no-sync")
|
|
933
951
|
],
|
|
@@ -981,11 +999,11 @@ const commands = [
|
|
|
981
999
|
arguments: [id(), {
|
|
982
1000
|
name: "text",
|
|
983
1001
|
required: false,
|
|
984
|
-
description: "its new text: - reads it from stdin, and it may be left out when you --
|
|
1002
|
+
description: "its new text: - reads it from stdin, and it may be left out when you --file"
|
|
985
1003
|
}],
|
|
986
1004
|
options: [
|
|
987
|
-
option("text-
|
|
988
|
-
option("schema"
|
|
1005
|
+
option("file", "the text, from a file: - reads stdin"),
|
|
1006
|
+
option("schema"),
|
|
989
1007
|
option("if-revision")
|
|
990
1008
|
],
|
|
991
1009
|
examples: [{
|
|
@@ -1032,7 +1050,7 @@ const commands = [
|
|
|
1032
1050
|
name: "k=v",
|
|
1033
1051
|
required: false,
|
|
1034
1052
|
multiple: true,
|
|
1035
|
-
description: "a label to set"
|
|
1053
|
+
description: "a label to set: a key of up to 64 lowercase letters, numbers, ., _, and -, starting with a letter or number, and a value of up to 256 characters"
|
|
1036
1054
|
}],
|
|
1037
1055
|
options: [
|
|
1038
1056
|
option("unset"),
|
|
@@ -1211,7 +1229,7 @@ const commands = [
|
|
|
1211
1229
|
subcommands: [
|
|
1212
1230
|
{
|
|
1213
1231
|
name: "create",
|
|
1214
|
-
description: "start a thread as a task, or with an ID, make that thread one: you own it. With --
|
|
1232
|
+
description: "start a thread as a task, or with an ID, make that thread one: you own it. With --file, a plan of them",
|
|
1215
1233
|
arguments: [{
|
|
1216
1234
|
name: "channel|id",
|
|
1217
1235
|
required: true,
|
|
@@ -1219,7 +1237,7 @@ const commands = [
|
|
|
1219
1237
|
}, {
|
|
1220
1238
|
name: "text",
|
|
1221
1239
|
required: false,
|
|
1222
|
-
description: "what to do, for a new thread: - reads it from stdin, and
|
|
1240
|
+
description: "what to do, for a new thread: - reads it from stdin, and --file takes its place"
|
|
1223
1241
|
}],
|
|
1224
1242
|
options: [
|
|
1225
1243
|
option("label", "label it, to route it", "k=v"),
|
|
@@ -1227,8 +1245,7 @@ const commands = [
|
|
|
1227
1245
|
option("for", "only this profile of yours claims it", "profile"),
|
|
1228
1246
|
claimNow,
|
|
1229
1247
|
option("lease", "with --claim: how long to hold it"),
|
|
1230
|
-
option("
|
|
1231
|
-
option("tasks-file", "a JSON array of tasks, each { key?, text, labels?, needs?, for?, noSync?, attachments? }: all of them, in as many writes as it takes"),
|
|
1248
|
+
option("file", "a plan, from a JSON file (- reads stdin): an array of tasks, each { key?, text, labels?, needs?, for?, noSync?, attachments? }, all made, in as many writes as it takes"),
|
|
1232
1249
|
option("no-sync"),
|
|
1233
1250
|
option("idempotency-key", "sending the same one again makes it once")
|
|
1234
1251
|
],
|
|
@@ -1247,7 +1264,7 @@ const commands = [
|
|
|
1247
1264
|
},
|
|
1248
1265
|
{
|
|
1249
1266
|
name: "a plan of tasks that wait for each other",
|
|
1250
|
-
value: "tasks create work --
|
|
1267
|
+
value: "tasks create work --file plan.json --idempotency-key migration-7"
|
|
1251
1268
|
}
|
|
1252
1269
|
]
|
|
1253
1270
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "./
|
|
1
|
+
import "./routes-BE0y6wCk.mjs";
|
|
2
|
+
import { f as BoardError } from "./errors-DYF4hhIc.mjs";
|
|
3
3
|
import { c as canonical, t as block } from "./blocks-CVoBC7ur.mjs";
|
|
4
|
-
import { a as canText, c as compileAccess } from "./access-
|
|
4
|
+
import { a as canText, c as compileAccess } from "./access-BbgmsAFF.mjs";
|
|
5
5
|
//#region src/conformance/index.ts
|
|
6
6
|
var Mismatch = class extends Error {};
|
|
7
7
|
const show = (value) => JSON.stringify(value) ?? String(value);
|
|
@@ -142,9 +142,9 @@ const messageOf = (error) => error instanceof Error ? error.message : String(err
|
|
|
142
142
|
async function withGrants(ctx, check) {
|
|
143
143
|
const made = [];
|
|
144
144
|
const grants = {
|
|
145
|
-
async make(input, by) {
|
|
145
|
+
async make(input, by, options) {
|
|
146
146
|
try {
|
|
147
|
-
const { grant } = await (by ?? ctx.board).createGrant(input);
|
|
147
|
+
const { grant } = await (by ?? ctx.board).createGrant(input, options);
|
|
148
148
|
made.push(grant.id);
|
|
149
149
|
return grant;
|
|
150
150
|
} catch (error) {
|
|
@@ -152,6 +152,34 @@ async function withGrants(ctx, check) {
|
|
|
152
152
|
throw unnamed(error) ?? error;
|
|
153
153
|
}
|
|
154
154
|
},
|
|
155
|
+
async makeAll(inputs) {
|
|
156
|
+
try {
|
|
157
|
+
const { grants: all } = await ctx.board.createGrants(inputs);
|
|
158
|
+
const closes = (grant) => grant.principals.some((principal) => principal.kind === "everyone");
|
|
159
|
+
made.push(...all.filter((grant) => !closes(grant)).map((grant) => grant.id), ...all.filter(closes).map((grant) => grant.id));
|
|
160
|
+
return all;
|
|
161
|
+
} catch (error) {
|
|
162
|
+
throw unnamed(error) ?? error;
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
self() {
|
|
166
|
+
const [source, kind, id, environment] = ctx.me.principal.split(":");
|
|
167
|
+
if (source === "board") return null;
|
|
168
|
+
if (ctx.me.kind === "person") return {
|
|
169
|
+
kind: "user",
|
|
170
|
+
userId: ctx.me.principal.split(":").slice(2).join(":")
|
|
171
|
+
};
|
|
172
|
+
if (kind === "project" && id && environment) return {
|
|
173
|
+
kind: "project",
|
|
174
|
+
project: id,
|
|
175
|
+
environments: [environment]
|
|
176
|
+
};
|
|
177
|
+
if (kind === "app" && id) return {
|
|
178
|
+
kind: "app",
|
|
179
|
+
app: id
|
|
180
|
+
};
|
|
181
|
+
throw new Skip("closing a pattern to everyone would close it to this run too, which no grant could keep in: it's neither a person, a project, nor an app");
|
|
182
|
+
},
|
|
155
183
|
async deny(by, input, what) {
|
|
156
184
|
try {
|
|
157
185
|
const { grant } = await by.createGrant(input);
|
|
@@ -168,21 +196,8 @@ async function withGrants(ctx, check) {
|
|
|
168
196
|
return ctx.withCan(canText(compileAccess(can)));
|
|
169
197
|
},
|
|
170
198
|
async keep(pattern) {
|
|
171
|
-
const
|
|
172
|
-
if (
|
|
173
|
-
const self = ctx.me.kind === "person" ? {
|
|
174
|
-
kind: "user",
|
|
175
|
-
userId: ctx.me.principal.split(":").slice(2).join(":")
|
|
176
|
-
} : kind === "project" && id && environment ? {
|
|
177
|
-
kind: "project",
|
|
178
|
-
project: id,
|
|
179
|
-
environments: [environment]
|
|
180
|
-
} : kind === "app" && id ? {
|
|
181
|
-
kind: "app",
|
|
182
|
-
app: id
|
|
183
|
-
} : null;
|
|
184
|
-
if (!self) throw new Skip("closing a pattern to everyone would close it to this run too, which no grant could keep in: it's neither a person, a project, nor an app");
|
|
185
|
-
await grants.make({
|
|
199
|
+
const self = grants.self();
|
|
200
|
+
if (self) await grants.make({
|
|
186
201
|
principals: [self],
|
|
187
202
|
can: { [pattern]: "all" }
|
|
188
203
|
});
|
|
@@ -2090,6 +2105,73 @@ const CHECKS = [
|
|
|
2090
2105
|
}, `a grant from a caller narrowed out of ${open}, which everyone reads`);
|
|
2091
2106
|
})
|
|
2092
2107
|
},
|
|
2108
|
+
{
|
|
2109
|
+
group: "grants",
|
|
2110
|
+
name: "refuses a grant its maker couldn't take back, unless it says lockMeOut",
|
|
2111
|
+
run: (ctx) => withGrants(ctx, async ({ make }) => {
|
|
2112
|
+
const pattern = `${subtreeOf(ctx)}lockout/`;
|
|
2113
|
+
await make(grantFor(ctx), void 0, { lockMeOut: true }).catch((error) => {
|
|
2114
|
+
if (error instanceof BoardError && error.status === 400) throw new Mismatch(`a grant that says lockMeOut: expected it made, got ${error.status} ${error.code}`);
|
|
2115
|
+
throw error;
|
|
2116
|
+
});
|
|
2117
|
+
const before = (await ctx.board.grants()).length;
|
|
2118
|
+
let made;
|
|
2119
|
+
try {
|
|
2120
|
+
made = (await ctx.board.createGrant({
|
|
2121
|
+
principals: [{ kind: "everyone" }],
|
|
2122
|
+
can: { [pattern]: [] }
|
|
2123
|
+
})).grant;
|
|
2124
|
+
} catch (error) {
|
|
2125
|
+
if (!(error instanceof BoardError) || error.status !== 409 || error.code !== "grant_lockout") throw new Mismatch(`closing ${pattern} to everyone, this run included: expected 409 grant_lockout, got ${error instanceof BoardError ? `${error.status} ${error.code}` : messageOf(error)}`);
|
|
2126
|
+
same((await ctx.board.grants()).length, before, "how many grants there are after the one refused");
|
|
2127
|
+
return;
|
|
2128
|
+
}
|
|
2129
|
+
await ctx.board.revokeGrant(made.id).catch((error) => {
|
|
2130
|
+
throw new Mismatch(`closing ${pattern} to everyone, this run included: expected 409 grant_lockout, and the board made ${made.id}, which this run can't revoke now (${messageOf(error)})`);
|
|
2131
|
+
});
|
|
2132
|
+
return "nothing locks this run out of a channel, so no grant it makes is a lockout: it owns the board, or it's the board's own code";
|
|
2133
|
+
})
|
|
2134
|
+
},
|
|
2135
|
+
{
|
|
2136
|
+
group: "grants",
|
|
2137
|
+
name: "makes several grants in one write, or none of them, a lock with the grant that keeps its maker in",
|
|
2138
|
+
run: (ctx) => withGrants(ctx, async ({ make, makeAll, self }) => {
|
|
2139
|
+
const subtree = subtreeOf(ctx);
|
|
2140
|
+
const pattern = `${subtree}batch/`;
|
|
2141
|
+
const lock = {
|
|
2142
|
+
principals: [{ kind: "everyone" }],
|
|
2143
|
+
can: { [pattern]: [] }
|
|
2144
|
+
};
|
|
2145
|
+
const me = self();
|
|
2146
|
+
await make({
|
|
2147
|
+
principals: [projectFor(ctx)],
|
|
2148
|
+
can: { [`${subtree}batch/ci/`]: ["read"] }
|
|
2149
|
+
});
|
|
2150
|
+
const made = await makeAll(me ? [
|
|
2151
|
+
lock,
|
|
2152
|
+
{
|
|
2153
|
+
principals: [me],
|
|
2154
|
+
can: { [pattern]: "all" }
|
|
2155
|
+
},
|
|
2156
|
+
grantFor(ctx)
|
|
2157
|
+
] : [lock, grantFor(ctx)]);
|
|
2158
|
+
alike(made.map((grant) => grant.principals[0]?.kind), me ? [
|
|
2159
|
+
"everyone",
|
|
2160
|
+
me.kind,
|
|
2161
|
+
"project"
|
|
2162
|
+
] : ["everyone", "project"], "the batch's grants, in the order given");
|
|
2163
|
+
check(new Set(made.map((grant) => grant.id)).size === made.length, `each of a batch's grants should have its own ID, got ${show(made.map((grant) => grant.id))}`);
|
|
2164
|
+
const listed = (await ctx.board.grants()).map((grant) => grant.id);
|
|
2165
|
+
check(made.every((grant) => listed.includes(grant.id)), `grants should list each one a batch made, got ${show(listed)}`);
|
|
2166
|
+
await rejects(ctx.board.createGrants([grantFor(ctx), {
|
|
2167
|
+
principals: [projectFor(ctx)],
|
|
2168
|
+
can: { [`${subtree}*/ci`]: ["post"] }
|
|
2169
|
+
}]), 400, "invalid_grant", "a batch with a grant whose pattern isn't one");
|
|
2170
|
+
const after = (await ctx.board.grants()).map((grant) => grant.id);
|
|
2171
|
+
for (const id of after) if (!listed.includes(id)) await ctx.board.revokeGrant(id);
|
|
2172
|
+
alike(after, listed, "the grants after a batch that was refused");
|
|
2173
|
+
})
|
|
2174
|
+
},
|
|
2093
2175
|
{
|
|
2094
2176
|
group: "grants",
|
|
2095
2177
|
name: "lets a member grant on a pattern after a lock under it",
|
package/dist/conformance.d.mts
CHANGED
package/dist/conformance.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as conformance } from "./conformance-
|
|
1
|
+
import { t as conformance } from "./conformance-Cr-umDl0.mjs";
|
|
2
2
|
export { conformance };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { l as isThreadTarget, s as channelOf } from "./external-
|
|
1
|
+
import { c as fileSize, i as ATTACHMENT_BYTES_MAX, o as IMPORT_BYTES_MAX, u as typeOf } from "./profile-header-Cj0Cb1cf.mjs";
|
|
2
|
+
import { P as toStorable, m as MESSAGE_TEXT_MAX, s as ChannelPath } from "./schemas-CUSTEFIy.mjs";
|
|
3
|
+
import { l as isThreadTarget, s as channelOf } from "./external-D2jq_DEQ.mjs";
|
|
4
4
|
import { t as canonicalEmoji } from "./emoji-CTLpvH-A.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { c as notFound, r as badRequest, t as HttpError } from "./errors-DYF4hhIc.mjs";
|
|
6
|
+
import { a as waitUntil, c as platformProfile, f as viaText, i as afterRetry, l as shownName, m as derivedId, o as actorParts, t as DroppedError } from "./middleware-DUKIITFZ.mjs";
|
|
6
7
|
import { a as replaceMentions, n as isEmail, t as extractMentions } from "./mentions-CnWt9Z5b.mjs";
|
|
7
|
-
import { a as immutable, d as opensBlock, f as routesFor, l as UnreadableError, n as SyncOverrides, o as ReceivedEvent, s as ResolvedTarget, u as channelMissing } from "./events-
|
|
8
|
+
import { a as immutable, d as opensBlock, f as routesFor, l as UnreadableError, n as SyncOverrides, o as ReceivedEvent, s as ResolvedTarget, u as channelMissing } from "./events-BdOCmnZh.mjs";
|
|
8
9
|
import { i as vercelDeployments, n as displayText, t as byVercelBot } from "./bots-CqPYxkqK.mjs";
|
|
9
10
|
//#region src/sync/engine.ts
|
|
10
11
|
/** `files`: a message with files may have no text. */
|
|
@@ -1231,7 +1232,7 @@ function createSyncEngine(entries) {
|
|
|
1231
1232
|
const synced = await syncOf(thread);
|
|
1232
1233
|
if (!synced?.targets.includes(target)) return;
|
|
1233
1234
|
const [root, ...replies] = await threadOf(synced.root);
|
|
1234
|
-
if (!root || root.id !== synced.root || root.deleted) return;
|
|
1235
|
+
if (!root || root.id !== synced.root || root.deleted || root.noSync) return;
|
|
1235
1236
|
const failures = [];
|
|
1236
1237
|
try {
|
|
1237
1238
|
await offer(keyOf(target), event, root, target, (renderer) => backfill(synced, root, replies, target, failures, renderer));
|
|
@@ -1323,7 +1324,9 @@ function createSyncEngine(entries) {
|
|
|
1323
1324
|
if (event.payload.noSync) return;
|
|
1324
1325
|
const synced = await syncOf(event.payload.thread);
|
|
1325
1326
|
if (!synced || synced.targets.length === 0) return;
|
|
1326
|
-
const
|
|
1327
|
+
const thread = await threadOf(synced.root);
|
|
1328
|
+
if (thread[0]?.id !== synced.root || thread[0].noSync) return;
|
|
1329
|
+
const message = thread.find((found) => found.id === event.message.id);
|
|
1327
1330
|
if (!message || message.deleted) return;
|
|
1328
1331
|
const actors = await actorsNow();
|
|
1329
1332
|
const failures = [];
|