@vercel/board 0.48.1 → 0.49.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.
Files changed (82) hide show
  1. package/dist/{access-C06pIr0M.mjs → access-B8DnrnHa.mjs} +29 -17
  2. package/dist/access.d.mts +2 -2
  3. package/dist/access.mjs +5 -5
  4. package/dist/{actors-Dkyg-oo0.mjs → actors-DewJKyqy.mjs} +4 -3
  5. package/dist/{auth-B9-wXQ-x.mjs → auth-CEU06Nyp.mjs} +2 -2
  6. package/dist/{auth-li3lKwJG.d.mts → auth-Z9-Khvvw.d.mts} +1 -1
  7. package/dist/{backend-UBP6HimX.d.mts → backend-BzCXxVZ-.d.mts} +19 -5
  8. package/dist/backend-local.d.mts +1 -1
  9. package/dist/backend-local.mjs +1 -1
  10. package/dist/{chat-provider-kNWd6MQC.mjs → chat-provider-BS_fr61g.mjs} +2 -2
  11. package/dist/{chat-provider-iN0DFsSE.d.mts → chat-provider-DQ1GHm4o.d.mts} +2 -2
  12. package/dist/cli-commands.d.mts +1 -1
  13. package/dist/cli-commands.mjs +1 -1
  14. package/dist/cli-embedded.d.mts +2 -2
  15. package/dist/cli-embedded.mjs +3 -3
  16. package/dist/cli.mjs +6 -6
  17. package/dist/client-C2T4eaXd.d.mts +544 -0
  18. package/dist/{commands-CJsOA-hf.d.mts → commands-Cm4sODIu.d.mts} +12 -8
  19. package/dist/{commands-Dk6_cHLS.mjs → commands-nN8WpvCe.mjs} +75 -58
  20. package/dist/{conformance-CDP8y2Zm.mjs → conformance-0xONNKcB.mjs} +102 -20
  21. package/dist/conformance.d.mts +1 -1
  22. package/dist/conformance.mjs +1 -1
  23. package/dist/{engine-BQ0hJw2w.mjs → engine-BH_nfJ3N.mjs} +6 -5
  24. package/dist/{errors-QhkdzI-o.mjs → errors-DwV7I0g4.mjs} +53 -174
  25. package/dist/{events-B-qyxNsJ.mjs → events-B76-4bNp.mjs} +2 -2
  26. package/dist/{exports-inhbjAWi.d.mts → exports-CKEK1fxf.d.mts} +4 -4
  27. package/dist/{exports-BzSG0_wL.mjs → exports-DLzyKwEp.mjs} +336 -82
  28. package/dist/{external-BuVTXT1R.mjs → external-BLI4W_-V.mjs} +1 -1
  29. package/dist/{index-B0Fnhvk7.d.mts → index-DxqSw8yd.d.mts} +2 -2
  30. package/dist/index.d.mts +6 -6
  31. package/dist/index.mjs +4 -4
  32. package/dist/index.node.d.mts +7 -7
  33. package/dist/index.node.mjs +4 -4
  34. package/dist/inspect/app.js +39 -39
  35. package/dist/inspect-B2ImmOvw.mjs +272 -0
  36. package/dist/inspect-DnRQUmP8.mjs +2 -0
  37. package/dist/inspect.d.mts +17 -0
  38. package/dist/inspect.mjs +196 -0
  39. package/dist/{local-BdKxz-Dn.mjs → local-DPpSEq2_.mjs} +132 -50
  40. package/dist/{main-BgiViRZ8.mjs → main-CqX7JqzE.mjs} +214 -46
  41. package/dist/{memory-CMm-Fk_A.mjs → memory-DzqkXIB-.mjs} +2 -2
  42. package/dist/{middleware-CT6vMNUc.mjs → middleware-ysFm2S4v.mjs} +2 -2
  43. package/dist/{page-D-OzDOAX.mjs → page-7KWSGxyC.mjs} +12 -2
  44. package/dist/page-CN77B014.mjs +2 -0
  45. package/dist/profile-header-Cj0Cb1cf.mjs +163 -0
  46. package/dist/{provider-DC3WHUXo.d.mts → provider-Dwb_9mnu.d.mts} +3 -529
  47. package/dist/{routes-CjA6Mp4D.d.mts → routes-B6SEA9yw.d.mts} +130 -4
  48. package/dist/{routes-ABXf3CKq.mjs → routes-qS92xz8U.mjs} +33 -7
  49. package/dist/{schemas-7VFdomFB.mjs → schemas-TeVe4Udh.mjs} +4 -2
  50. package/dist/{serve-C2Jbr7pR.mjs → serve-CYr4RwRM.mjs} +5 -5
  51. package/dist/{server-EOQC5Gtq.mjs → server-V7qyVUiJ.mjs} +11 -9
  52. package/dist/{serving-BNdiReQT.mjs → serving-BzNxlnDV.mjs} +1 -1
  53. package/dist/{inspect-n9brh-TT.mjs → shell-BLHZoP-x.mjs} +25 -274
  54. package/dist/{sql-IEbO5vXs.mjs → sql-DIKQd5Me.mjs} +2 -2
  55. package/dist/{sqlite-CVG8XKHm.mjs → sqlite-BF9kBDh1.mjs} +2 -2
  56. package/dist/{sqlite-db-BJjPQYx4.mjs → sqlite-db-CSYwiZ4E.mjs} +1 -1
  57. package/dist/sync-chat-sdk.d.mts +2 -2
  58. package/dist/sync-chat-sdk.mjs +2 -2
  59. package/dist/sync-github.d.mts +2 -2
  60. package/dist/sync-github.mjs +2 -2
  61. package/dist/sync-linear.d.mts +3 -3
  62. package/dist/sync-linear.mjs +2 -2
  63. package/dist/sync-slack.d.mts +3 -3
  64. package/dist/sync-slack.mjs +11 -7
  65. package/dist/sync.d.mts +2 -2
  66. package/dist/sync.mjs +2 -2
  67. package/dist/{task-batch-D4p9N8lN.mjs → task-batch-CujTLmTB.mjs} +10 -11
  68. package/dist/{tokens-BCp4EWTQ.mjs → tokens-BmCDAT4N.mjs} +2 -2
  69. package/dist/version-BCoWGLEW.mjs +5 -0
  70. package/docs/01-board/01-mounting.md +8 -0
  71. package/docs/01-board/04-messages.md +6 -2
  72. package/docs/01-board/05-reading.md +17 -2
  73. package/docs/01-board/09-access.md +40 -6
  74. package/docs/01-board/11-tasks.md +3 -3
  75. package/docs/03-guides/02-inspector.md +31 -0
  76. package/docs/04-reference/01-cli.md +81 -32
  77. package/docs/04-reference/02-board.md +14 -3
  78. package/docs/04-reference/03-http.md +5 -3
  79. package/docs/04-reference/05-conformance.md +7 -0
  80. package/package.json +5 -1
  81. package/dist/inspect-BB-XUPuz.mjs +0 -2
  82. package/dist/page-Dr9Aqlej.mjs +0 -2
@@ -65,9 +65,12 @@ import { board } from '@vercel/board'
65
65
  // The board at BOARD_URL, one that keeps grants: vb serve's, say.
66
66
  const team = board()
67
67
 
68
- // Close security/ to everyone, then open it to two people.
69
- await team.createGrant({ principals: [{ kind: 'everyone' }], can: { 'security/': [] } })
70
- const { grant } = await team.createGrant({ principals: [{ kind: 'user', email: 'alice@acme.com' }, { kind: 'user', email: 'bob@acme.com' }], can: { 'security/': 'all' } })
68
+ // Close security/ to everyone but two people, in one write.
69
+ const { grants } = await team.createGrants([
70
+ { principals: [{ kind: 'everyone' }], can: { 'security/': [] } },
71
+ { principals: [{ kind: 'user', email: 'alice@acme.com' }, { kind: 'user', email: 'bob@acme.com' }], can: { 'security/': 'all' } },
72
+ ])
73
+ const grant = grants[1]
71
74
  // acme/web's CI posts in ci/ from its main branch.
72
75
  await team.createGrant({ principals: [{ kind: 'github', repository: 'acme/web', workflow: 'ci.yml', branch: 'main' }], can: { 'ci/': ['post'] } })
73
76
  await team.updateGrant(grant.id, { add: [{ kind: 'user', email: 'carol@acme.com' }] })
@@ -84,8 +87,9 @@ deployments.
84
87
  | CLI | Handle |
85
88
  | --- | --- |
86
89
  | `vb grants` | `team.grants()` |
87
- | `vb grants create --everyone --can 'security/=none'` | `team.createGrant({ principals: [{ kind: 'everyone' }], can: { 'security/': 'none' } })` |
88
90
  | `vb grants create --user alice@acme.com --user bob@acme.com --can 'security/=all'` | `team.createGrant({ principals: [{ kind: 'user', email: 'alice@acme.com' }, { kind: 'user', email: 'bob@acme.com' }], can: { 'security/': 'all' } })` |
91
+ | `vb grants create --file grants.json` | `team.createGrants([{ principals: [{ kind: 'everyone' }], can: { 'security/': 'none' } }, { principals: [{ kind: 'user', email: 'alice@acme.com' }], can: { 'security/': 'all' } }])` |
92
+ | `vb grants create --everyone --can 'attic/=none' --lock-me-out` | `team.createGrant({ principals: [{ kind: 'everyone' }], can: { 'attic/': 'none' } }, { lockMeOut: true })` |
89
93
  | `vb grants create --project sec --environment production,preview --can 'security/=read,post'` | `team.createGrant({ principals: [{ kind: 'project', project: 'sec', environments: ['production', 'preview'] }], can: { 'security/': ['read', 'post'] } })` |
90
94
  | `vb grants create --github acme/web --workflow ci.yml --git-branch main --can 'ci/=post'` | `team.createGrant({ principals: [{ kind: 'github', repository: 'acme/web', workflow: 'ci.yml', branch: 'main' }], can: { 'ci/': ['post'] } })` |
91
95
  | `vb grants create --oidc https://gitlab.com --claim project_id=42 --can 'ci/=post'` | `team.createGrant({ principals: [{ kind: 'oidc', issuer: 'https://gitlab.com', claims: { project_id: '42' } }], can: { 'ci/': ['post'] } })` |
@@ -193,12 +197,26 @@ more specific pattern decides first.
193
197
  so what `everyone` gets doesn't count. Unless you may list the grants,
194
198
  revoking or changing one you can't reach answers the same 403 as one that
195
199
  isn't there, so trying g1, g2, and on finds out nothing.
200
+ - **A change you couldn't take back takes saying so.** Closing `security/` to
201
+ `everyone` closes it to whoever closes it, and lifting it takes `manage`
202
+ there. So a grant write that takes its caller's own `manage` at a pattern it
203
+ names is 409 `grant_lockout`, and nothing is written. Keep yourself in with
204
+ a grant that names you at each pattern the lock names, made before it or in
205
+ the same write, or pass `lockMeOut` (`--lock-me-out`) to go ahead. Revoking
206
+ or narrowing the grant that keeps you in is the same lockout.
207
+ - **Several grants go in one write.** `createGrants([…])`
208
+ (`POST /grants/batch`, 16 at most) makes all of them or none, in the order
209
+ given. Each needs what it would alone, on the grants as they are, and what
210
+ they leave you with is judged with all of them made. So a lock and the
211
+ grant that keeps you in pass together, whichever comes first.
212
+ `vb grants create --file` makes the ones a JSON file holds.
196
213
  - **Naming an `oidc` principal takes `manage` everywhere,** since the board
197
214
  then fetches its issuer's keys. Listing grants takes `manage` at `*`.
198
215
  - **Owners always may.** On Vercel's API, the team's owners. On a local board,
199
216
  its local user, the one `vb serve` mints a token for: a person on the team
200
- is a principal like any other. Reading a closed channel still takes a
201
- grant, an owner's too.
217
+ is a principal like any other. Nothing locks an owner out, so no write of
218
+ theirs is a lockout. Reading a closed channel still takes a grant, an
219
+ owner's too.
202
220
  - **A private channel is two grants and the channel.**
203
221
  `createChannel(path, { private: true })` makes a grant letting you in at
204
222
  `<path>/`, then one closing it to `everyone`, then the channel. Before it
@@ -445,6 +463,22 @@ and opens to them only as it opens to you, so grants on `*` stay yours to
445
463
  make. A grant on `security/` itself doesn't: it would meet the lock there and
446
464
  win, being closer. The board's owners always may.
447
465
 
466
+ ### Why won't the board let me close a channel to everyone?
467
+
468
+ Because that closes it to you too, and then you couldn't open it again:
469
+ lifting a lock takes `manage` where it applies. Make the grant that keeps you
470
+ in first, and it stays yours to change:
471
+
472
+ ```bash
473
+ vb grants create --user you@acme.com --can 'security/=all'
474
+ vb grants create --everyone --can 'security/=none'
475
+ ```
476
+
477
+ `vb grants create --file` makes both in one write.
478
+
479
+ `--lock-me-out` makes it anyway. Then only an owner, or someone a grant names
480
+ there with `manage`, can change it.
481
+
448
482
  ### How do I keep a channel from the project's own people?
449
483
 
450
484
  You can't, on one board: people who can access the board's Vercel project can
@@ -21,8 +21,8 @@ replies are the work log, and the board keeps its state. It's still a thread:
21
21
  on it as on any other.
22
22
 
23
23
  - **`vb tasks create <channel> "<text>"`** starts a thread as a task. It takes
24
- `--label`, `--text-file`, `--no-sync`, and `--idempotency-key` as `post`
25
- does.
24
+ `--label`, `--no-sync`, and `--idempotency-key` as `post` does, and `-` as
25
+ the text reads it from stdin. Its `--file` is a plan of several.
26
26
  - **`vb tasks create <id>`** makes a task of a thread that's there, as it is:
27
27
  an issue someone filed, a question from Slack. Its text stays its author's.
28
28
  - **You own the tasks you make.** A task's owner, or anyone with `manage` in
@@ -219,7 +219,7 @@ $ vb tasks needs 814 --none
219
219
  ```
220
220
 
221
221
  ```bash
222
- vb tasks create work --tasks-file plan.json --idempotency-key cve-123
222
+ vb tasks create work --file plan.json --idempotency-key cve-123
223
223
  ```
224
224
 
225
225
  ```text
@@ -178,6 +178,37 @@ board under it at `/api/board`. Behind `tailscale serve`, use
178
178
  whoever Tailscale says opened it, not as you. See
179
179
  [Share a local board on a tailnet](08-tailnet.md).
180
180
 
181
+ ## In your app
182
+
183
+ `@vercel/board/inspect` serves the same page from a route in your app, so
184
+ people open the board at your deployment's URL, from any browser, phone
185
+ included, with nothing to run:
186
+
187
+ ```ts
188
+ // app/board/[[...path]]/route.ts
189
+ import { inspector } from '@vercel/board/inspect'
190
+ import { team } from '@/lib/board'
191
+
192
+ const inspect = inspector({ board: team, basePath: '/board' })
193
+
194
+ export const GET = inspect, POST = inspect, PATCH = inspect, PUT = inspect, DELETE = inspect
195
+ ```
196
+
197
+ The page is at `/board`, its bundle at `/board/app.js`, and its proxy at
198
+ `/board/board/*`. Each request acts as the handle you pass, under the
199
+ profile the page picks, so a person who names themselves `ada` posts as
200
+ `ada via <your app>`. The handle is your app, not whoever's visiting, so the
201
+ page asks who's posting before it loads, and the proxy refuses a write that
202
+ names no profile (401 `profile_required`). Reads need none.
203
+
204
+ Whoever reaches the route reads and writes as that handle, so put it behind
205
+ something that turns strangers away, like Vercel's Deployment Protection,
206
+ and refuse requests in front of it that the handle shouldn't take. The proxy
207
+ answers only its own page: every request carries a header the page sends,
208
+ a browser's must say it's from the same origin (`Sec-Fetch-Site`), and a write
209
+ needs the page's `Origin`. Next.js's Turbopack build copies the bundle into
210
+ its output on its own.
211
+
181
212
  ## Try writes safely
182
213
 
183
214
  The inspector writes to whichever board it points at, and a board's writes
@@ -237,9 +237,14 @@ for one to pass.
237
237
  `completed 812`, `blocked 813`, `unassigned 815`.
238
238
  - **IDs go in as they come out.** Output shows `#812`; pass `812`, or quote
239
239
  it as `'#812'`, since in a shell an unquoted `#` starts a comment.
240
- - **Text can come from a file or stdin.** `--text-file note.md` reads a file,
241
- and `--text-file -`, or `-` as the text, reads stdin. Text may be left out
240
+ - **Text can come from a file or stdin.** `--file note.md` reads a file,
241
+ and `--file -`, or `-` as the text, reads stdin. Text may be left out
242
242
  when the message has `--attach` files.
243
+ - **`--file` is what a command takes from a file,** and `-` there reads
244
+ stdin: a message's text on `post`, `reply`, `edit`, and `schedule`, a plan
245
+ of tasks on `tasks create`, several grants on `grants create`, and a JSON
246
+ Schema on `schemas create`, which also takes one written inline, as
247
+ `--data`.
243
248
  - **Errors go to stderr**: `error:` and what failed, then how to fix it, the
244
249
  command to run indented under it. With `--json`, one JSON document instead.
245
250
  See [Errors](#errors).
@@ -499,10 +504,11 @@ options every command takes: board help
499
504
 
500
505
  ```text
501
506
  vb grants [list]
502
- vb grants create <principal>... --can <pattern=permissions>...
503
- vb grants update <grant> [--add-<kind> <name>]... [--remove-<kind> <name>]... [--can <pattern=permissions>]...
507
+ vb grants create <principal>... --can <pattern=permissions>... [--lock-me-out]
508
+ vb grants create --file <path> [--lock-me-out]
509
+ vb grants update <grant> [--add-<kind> <name>]... [--remove-<kind> <name>]... [--can <pattern=permissions>]... [--lock-me-out]
504
510
  vb grants explain [<principal>] <channel>
505
- vb grants revoke <grant>
511
+ vb grants revoke <grant> [--lock-me-out]
506
512
  ```
507
513
 
508
514
  `vb grants` lists each grant's ID, the principals it names as the flags that
@@ -534,7 +540,13 @@ comma-separated list, `all`, or `none`. A board that verifies tokens itself,
534
540
  as `vb serve` does, takes IDs: `--user u_123`, `--project prj_123`, and an
535
541
  app's client ID.
536
542
 
537
- `create` prints the grant it made as its row. `update` takes `--add-<kind>` and
543
+ `create --file <path>` makes several grants in one write, or none of them:
544
+ the file is a JSON array of grants, each `{ principals, can }` as
545
+ [`createGrants`](./02-board.md#creategrant) takes them, and `-` reads it from
546
+ stdin. A lock and the grant that keeps you in go together that way, in either
547
+ order.
548
+
549
+ `create` prints each grant it made as its row. `update` takes `--add-<kind>` and
538
550
  `--remove-<kind>` for each kind (`--add-user`, `--remove-project`,
539
551
  `--add-github … --workflow …`), and `--can`, which replaces the grant's.
540
552
  Adding a project it names already adds the environments; to narrow one,
@@ -542,18 +554,53 @@ remove it and add it back in the same update. Each needs `manage` at the
542
554
  patterns the grant names, before and after. `revoke` stops one.
543
555
 
544
556
  ```text
545
- $ vb grants create --everyone --can 'security/=none'
546
- created g4 --everyone security/=none
547
557
  $ vb grants create --user alice@acme.com --user bob@acme.com --can 'security/=all'
548
- created g5 --user alice@acme.com --user bob@acme.com security/=all
558
+ created g4 --user alice@acme.com --user bob@acme.com security/=all
559
+ $ vb grants create --everyone --can 'security/=none'
560
+ created g5 --everyone security/=none
549
561
  $ vb grants create --project sec --environment production,preview --can 'security/=read,post'
550
562
  created g6 --project sec --environment production,preview security/=read,post
551
- $ vb grants update g5 --add-user carol@acme.com
552
- updated g5 --user alice@acme.com --user bob@acme.com --user carol@acme.com security/=all
563
+ $ vb grants update g4 --add-user carol@acme.com
564
+ updated g4 --user alice@acme.com --user bob@acme.com --user carol@acme.com security/=all
553
565
  $ vb grants update g6 --remove-project sec --add-project sec --environment production --can 'security/=read'
554
566
  updated g6 --project sec --environment production security/=read
555
- $ vb grants revoke g4
556
- revoked g4
567
+ $ vb grants revoke g5
568
+ revoked g5
569
+ ```
570
+
571
+ ```json grants.json
572
+ [
573
+ { "principals": [{ "kind": "everyone" }], "can": { "security/": "none" } },
574
+ { "principals": [{ "kind": "user", "userId": "u_julian" }], "can": { "security/": "all" } }
575
+ ]
576
+ ```
577
+
578
+ ```text
579
+ $ vb grants create --file grants.json
580
+ created g6 --everyone security/=none
581
+ created g7 --user u_julian security/=all
582
+ ```
583
+
584
+ A change you couldn't take back is refused, with reason `grant_lockout`:
585
+ closing a channel to everyone closes it to you, and lifting that takes
586
+ `manage` there. It says which grant to make first to keep yourself in, naming
587
+ you as a grant would (`--user`, `--project` and `--environment`, `--app`, or
588
+ `--github`), and `--lock-me-out` goes ahead. Revoking or narrowing the grant
589
+ that keeps you in is refused the same way. An owner is never locked out.
590
+
591
+ ```text
592
+ $ vb grants create --everyone --can factory/=read
593
+ error: Can't create the grant: it would lock you out.
594
+ this grant would leave you unable to manage grants in factory/
595
+
596
+ Keep manage there yourself first:
597
+ vb grants create --user u_julian --can factory/=all
598
+ Make it anyway:
599
+ vb grants create --everyone --can factory/=read --lock-me-out
600
+ $ vb grants create --user u_julian --can factory/=all
601
+ created g4 --user u_julian factory/=all
602
+ $ vb grants create --everyone --can factory/=read
603
+ created g5 --everyone factory/=read
557
604
  ```
558
605
 
559
606
  Vercel's board takes no `--github` or `--oidc` principal: a workflow gets in
@@ -644,7 +691,7 @@ one with a profile: `Malte via support (preview)`), and actor ID.
644
691
  ```text
645
692
  vb schemas [list]
646
693
  vb schemas inspect <schema>
647
- vb schemas create <schema> --schema <json|@file|-> [--description <text>]
694
+ vb schemas create <schema> (--file <path> | --data <json>) [--description <text>]
648
695
  ```
649
696
 
650
697
  A schema says what a piece of structured data holds: a JSON Schema for an
@@ -659,17 +706,18 @@ vercel-deployment@1 built in A Vercel deployment, by its URL and optionally t
659
706
  sandbox@1 2d What a sandbox did.
660
707
  ```
661
708
 
662
- `create` registers a version, for good. `--schema` takes the JSON Schema
663
- inline, from a file as `@<path>`, or from stdin as `-`. A version never
709
+ `create` registers a version, for good. `--file` takes the JSON Schema
710
+ from a file, or from stdin as `-`, and `--data` takes it written inline. A
711
+ version never
664
712
  changes: the same definition again registers nothing, and another one is
665
713
  refused, so a change is the next version. It needs `manage` at `*`.
666
714
 
667
715
  ```text
668
- $ vb schemas create sandbox@1 --schema @sandbox.schema.json --description 'What a sandbox did.'
716
+ $ vb schemas create sandbox@1 --file sandbox.schema.json --description 'What a sandbox did.'
669
717
  created sandbox@1
670
- $ vb schemas create sandbox@1 --schema @sandbox.schema.json --description 'What a sandbox did.'
718
+ $ vb schemas create sandbox@1 --file sandbox.schema.json --description 'What a sandbox did.'
671
719
  sandbox@1 is already registered
672
- $ vb schemas create sandbox@1 --schema '{"type":"object","required":["id"]}'
720
+ $ vb schemas create sandbox@1 --data '{"type":"object","required":["id"]}'
673
721
  error: Can't register schema sandbox@1.
674
722
  sandbox@1 is registered with another definition, and a version never changes: register a new version
675
723
 
@@ -679,7 +727,8 @@ error: Can't register schema sandbox@1.
679
727
 
680
728
  | Flag | Effect |
681
729
  | --- | --- |
682
- | `--schema <json\|@file\|->` | its JSON Schema: inline, the file `@<path>` names, or stdin for `-` |
730
+ | `--file <path>` | its JSON Schema, from a file, or stdin for `-` |
731
+ | `--data <json>` | its JSON Schema, written inline |
683
732
  | `--description <text>` | what it holds, in a sentence. Part of the version: it never changes either |
684
733
 
685
734
  `inspect` prints one version with its JSON Schema, to read before writing data
@@ -783,7 +832,7 @@ and canceled ones.
783
832
  ### post
784
833
 
785
834
  ```text
786
- vb post <channel|id> ["<text>" | --text-file <path>] [--schema <schema>] [--label k=v]... [--attach <file>]... [--sync <target>]... [--no-sync] [--idempotency-key <key>] [--after <id>]
835
+ vb post <channel|id> ["<text>" | --file <path>] [--schema <schema>] [--label k=v]... [--attach <file>]... [--sync <target>]... [--no-sync] [--idempotency-key <key>] [--after <id>]
787
836
  ```
788
837
 
789
838
  Starts a thread. The channel is created by its first post. Given a message ID
@@ -831,7 +880,7 @@ See [Data](../01-board/04-messages.md#data).
831
880
  ### reply
832
881
 
833
882
  ```text
834
- vb reply <id> ["<text>" | --text-file <path>] [--label k=v]... [--attach <file>]... [--no-sync] [--idempotency-key <key>] [--after <id>]
883
+ vb reply <id> ["<text>" | --file <path>] [--label k=v]... [--attach <file>]... [--no-sync] [--idempotency-key <key>] [--after <id>]
835
884
  ```
836
885
 
837
886
  Replies in a thread. `<id>` may be any message in it: the board stores the
@@ -843,7 +892,7 @@ you read, is still the thread's newest: see
843
892
  ### edit
844
893
 
845
894
  ```text
846
- vb edit <id> ("<text>" | --text-file <path>) [--if-revision N]
895
+ vb edit <id> ("<text>" | --file <path>) [--if-revision N]
847
896
  ```
848
897
 
849
898
  Replaces a message's text. Only its author may edit it: as yourself, any
@@ -894,7 +943,7 @@ Keys under `board.` are the board's own: writing one fails with
894
943
  ### schedule
895
944
 
896
945
  ```text
897
- vb schedule <channel|id> ["<text>" | --text-file <path>] (--in 1d | --at <time> | --every 30m)
946
+ vb schedule <channel|id> ["<text>" | --file <path>] (--in 1d | --at <time> | --every 30m)
898
947
  [--until <time> | --for 24h | --times N] [--label k=v]... [--attach <file>]... [--no-sync]
899
948
  vb schedule cancel <schedule>
900
949
  ```
@@ -922,9 +971,9 @@ with `manage` in its channel, and prints
922
971
 
923
972
  ```text
924
973
  vb tasks [channel] [--state <state>|open|all] [--label k=v]... [--by <handle>] [--for <profile>] [--after <cursor>] [--limit N]
925
- vb tasks create (<channel> ["<text>" | --text-file <path>] | <id>) [--label k=v]... [--needs <id>]... [--for <profile>]
974
+ vb tasks create (<channel> "<text>" | <id>) [--label k=v]... [--needs <id>]... [--for <profile>]
926
975
  [--claim [--lease <duration>]] [--no-sync] [--idempotency-key <key>]
927
- vb tasks create <channel> --tasks-file <path> [--idempotency-key <key>]
976
+ vb tasks create <channel> --file <path> [--idempotency-key <key>]
928
977
  vb tasks claim (<id> | --ready <channel> [--label k=v]... [--from <id>]... [--wait <duration>]) [--lease <duration>]
929
978
  vb tasks run (<id> | --ready <channel> [--label k=v]... [--from <id>]... [--wait <duration>])
930
979
  [--result "<text>"] [--lease <duration>] -- <cmd>...
@@ -947,7 +996,7 @@ Threads agents are to do, each with a state the board keeps. See
947
996
  | --- | --- | --- |
948
997
  | `tasks [channel]` | lists open tasks, oldest first: `waiting`, `ready`, `claimed`, and `blocked` | a row per task: its ID, state, first line, and labels |
949
998
  | `tasks create` | starts a thread as a task, or with an ID makes that thread one. You own it | its ID, or with `--claim` the claim |
950
- | `tasks create --tasks-file` | starts a thread for each task a JSON file holds, in as many writes as the board needs | a row per task, as the list shows it |
999
+ | `tasks create --file` | starts a thread for each task a JSON file holds, in as many writes as the board needs | a row per task, as the list shows it |
951
1000
  | `tasks claim` | holds a task for a lease: by its ID, or with `--ready` the oldest ready one in a channel | the claim: `#812 yours for 15m fix CVE-123 in acme/web` |
952
1001
  | `tasks run` | claims a task, runs a command on it, and settles it by how the command exits | what the command prints, then `completed 812` or `failed 812`. With `--json`, what the command prints goes to stderr, and stdout is the one document |
953
1002
  | `tasks renew` | extends your lease, from now | the claim |
@@ -990,7 +1039,7 @@ $ vb tasks work/ --state all --limit 2
990
1039
  - **`--ready`** takes a task assigned to you first, then the oldest unassigned
991
1040
  one you own, or whose owner `--from <id>` names. `--wait` holds until one is
992
1041
  ready.
993
- - **`--tasks-file <path>`** makes a plan: a JSON array of tasks, each `{ key?,
1042
+ - **`--file <path>`** makes a plan: a JSON array of tasks, each `{ key?,
994
1043
  text, labels?, needs?, for?, noSync?, attachments? }`, from a file, or from
995
1044
  stdin for `-`. A task's `key` names it for the others of the file, and
996
1045
  `needs` takes `{ "key": "fix" }` for one of them or a task's ID for one
@@ -1047,7 +1096,7 @@ What can go wrong, by `reason`:
1047
1096
  | `task_not_owned` | the change is its owner's to make, or `manage`'s in its channel. A profile owns only the tasks it made | 1 |
1048
1097
  | `not_a_task`, `already_a_task` | the thread isn't a task, or `create <id>` named one that is | 1 |
1049
1098
  | `invalid_needs` | `--needs` or `tasks needs` named something that isn't a task you can read, or `tasks needs` a task that waits for this one. In a plan, a `key` two tasks have or none has, or tasks that wait for each other | 2 |
1050
- | `duplicate_id` | `--idempotency-key` was used for another task, or with `--tasks-file`, for another plan: other tasks where it made some, or more once it finished | 1 |
1099
+ | `duplicate_id` | `--idempotency-key` was used for another task, or with `--file`, for another plan: other tasks where it made some, or more once it finished | 1 |
1051
1100
  | `invalid_from` | `--from` named an owner by handle: several can share one, so it takes IDs | 2 |
1052
1101
  | `command_not_found` | `run`'s command couldn't start. The task is released | 1 |
1053
1102
  | `claim_too_wide` | on Vercel's board, `--ready` with `--from` would look in more than 200 places, its channels times the owners it takes from: name fewer owners, or a smaller subtree | 1 |
@@ -1086,17 +1135,17 @@ error: Can't change what task #814 needs. It waits for tasks you can read, and n
1086
1135
  ```
1087
1136
 
1088
1137
  ```text
1089
- $ vb tasks create work --tasks-file plan.json --idempotency-key cve-123
1138
+ $ vb tasks create work --file plan.json --idempotency-key cve-123
1090
1139
  #2 ready fix CVE-123 in acme/web step=fix
1091
1140
  #4 waiting review the fix for CVE-123 step=review needs #2
1092
1141
  #6 waiting ship it needs #4 #2
1093
- $ vb tasks create migration --tasks-file shards.json
1142
+ $ vb tasks create migration --file shards.json
1094
1143
  error: Can't create tasks in migration. A task's needs are tasks you can read, or keys of the plan's own.
1095
1144
  needs: #999999 isn't a task
1096
1145
  made 100 of 250: #214 to #412
1097
1146
 
1098
1147
  Make the rest, under the same key: what was made stays as it is:
1099
- vb tasks create migration --tasks-file shards.json --idempotency-key d2bee830-84e4-44d2-aec1-5b1fefbbed82
1148
+ vb tasks create migration --file shards.json --idempotency-key d2bee830-84e4-44d2-aec1-5b1fefbbed82
1100
1149
  ```
1101
1150
 
1102
1151
  ### typing
@@ -610,11 +610,12 @@ A board that keeps no tasks fails each with 501 `no_tasks`. See
610
610
  ### createGrant
611
611
 
612
612
  ```ts
613
- createGrant(input: { principals: PrincipalInput[]; can: GrantCan }): Promise<{ grant: GrantView }>
614
- updateGrant(id: string, input: { add?: PrincipalInput[]; remove?: PrincipalInput[]; can?: GrantCan }): Promise<{ grant: GrantView }>
613
+ createGrant(input: { principals: PrincipalInput[]; can: GrantCan }, options?: { lockMeOut?: boolean }): Promise<{ grant: GrantView }>
614
+ createGrants(inputs: { principals: PrincipalInput[]; can: GrantCan }[], options?: { lockMeOut?: boolean }): Promise<{ grants: GrantView[] }>
615
+ updateGrant(id: string, input: { add?: PrincipalInput[]; remove?: PrincipalInput[]; can?: GrantCan }, options?: { lockMeOut?: boolean }): Promise<{ grant: GrantView }>
615
616
  grants(): Promise<GrantView[]>
616
617
  explain(channel: string, principal?: ExplainPrincipal): Promise<Explanation>
617
- revokeGrant(id: string): Promise<{ revoked: boolean }>
618
+ revokeGrant(id: string, options?: { lockMeOut?: boolean }): Promise<{ revoked: boolean }>
618
619
  ```
619
620
 
620
621
  `createGrant` lets `principals` do what `can` says: a map from channel pattern
@@ -627,6 +628,11 @@ Making or widening one needs what you'd grant: `manage` at its patterns and
627
628
  under them wherever your own limits narrow you, and what `everyone` gives, for
628
629
  anyone it lets in. Revoking one, or removing from it, needs the same but what
629
630
  `everyone` gives; `grants` needs `manage` at `*`. Owners always may.
631
+ A change you couldn't take back, since it takes your own `manage` at a
632
+ pattern it names, is 409 `grant_lockout`: closing a channel to `everyone`
633
+ closes it to you. `createGrants` makes several grants in one write, all or
634
+ none, judged together, so the lock goes with the grant that keeps you in;
635
+ `lockMeOut` goes ahead without one.
630
636
  `explain` says which grants decide a channel, and what they give, for you or,
631
637
  with `manage` at `*`, for `{ user }`, `{ project, environment }`, `{ github,
632
638
  workflow, branch, event }`, `{ oidc, claims }`, or `{ app }`. A local board has
@@ -639,6 +645,11 @@ const { grant } = await team.createGrant({ principals: [{ kind: 'github', reposi
639
645
  await team.updateGrant(grant.id, { add: [{ kind: 'user', email: 'ada@acme.com' }] })
640
646
  const { pattern, grants, can } = await team.explain('ci/deploys', { user: 'ada@acme.com' })
641
647
  await team.revokeGrant(grant.id)
648
+ // Closed to everyone but Ada, in one write.
649
+ await team.createGrants([
650
+ { principals: [{ kind: 'everyone' }], can: { 'security/': 'none' } },
651
+ { principals: [{ kind: 'user', email: 'ada@acme.com' }], can: { 'security/': 'all' } },
652
+ ])
642
653
  ```
643
654
 
644
655
  See [Grants](../01-board/09-access.md#grants).
@@ -133,10 +133,11 @@ a refused write it can read answers 403. `GET /me` returns the caller's
133
133
  | POST | `/tasks/:id/needs` | `{ needs }`: the IDs of the tasks it waits for now, in place of what it waited for |
134
134
  | POST | `/tasks/:id/cancel` | `{ reason }`: any task that hasn't completed or been canceled |
135
135
  | GET | `/grants` | `{ grants }`: each one's `id`, `principals`, `can`, `capped`, `by`, and `at`. Needs `manage` at `*`, or a team owner. See [Grants](#grants) |
136
- | POST | `/grants` | `{ principals, can }`: a new grant, even for principals another grant names. Needs `manage` at each pattern in `can`, and under each wherever your `x-board-can`'s or your own grants' limits narrow you, and what `everyone` gives wherever it gives something; `manage` everywhere to name an `oidc` principal. A key it doesn't know is 400. Answers `{ grant }` |
137
- | PATCH | `/grants/:id` | `{ add?, remove?, can? }`: adds principals, removes them by who they are, or replaces `can`. Needs, at the grant as it was, what `POST /grants` needs but what `everyone` gives, and to add principals or set `can`, all of it. Answers `{ grant }`; 404 `grant_not_found`, 400 `not_in_grant` or `grant_empty` |
136
+ | POST | `/grants` | `{ principals, can }`: a new grant, even for principals another grant names. Needs `manage` at each pattern in `can`, and under each wherever your `x-board-can`'s or your own grants' limits narrow you, and what `everyone` gives wherever it gives something; `manage` everywhere to name an `oidc` principal. A key it doesn't know is 400. Answers `{ grant }` One its caller couldn't take back, since it takes their own `manage` at a pattern it names, is 409 `grant_lockout` unless the body says `lockMeOut: true`, as any grant write's may |
137
+ | POST | `/grants/batch` | `{ grants, lockMeOut? }`: 1 to 16 grants, each `{ principals, can }`, made in one write, all or none. Each needs what `POST /grants` needs, on the grants as they are; what `everyone` gives, and a lockout, are judged with all of them made. Answers `{ grants }`, in the order given |
138
+ | PATCH | `/grants/:id` | `{ add?, remove?, can?, lockMeOut? }`: adds principals, removes them by who they are, or replaces `can`. Needs, at the grant as it was, what `POST /grants` needs but what `everyone` gives, and to add principals or set `can`, all of it. Answers `{ grant }`; 404 `grant_not_found`, 400 `not_in_grant` or `grant_empty` |
138
139
  | GET | `/grants/explain` | Which grants decide a channel: `{ channel, pattern, over, level, grants, capped, can }`, `over` the other patterns that cover it, most specific first. Query: `channel`, and for someone else (with `manage` at `*`) `user`, `project` and `environment`, `github` and `workflow`, `branch`, `event`, `oidc` and `claim=name=value`, or `app`. `grants` is empty for a caller that can't list them |
139
- | POST | `/grants/:id/revoke` | Answers `{ revoked }`, false when it was already gone. Needs what `POST /grants` needs at its patterns, but what `everyone` gives |
140
+ | POST | `/grants/:id/revoke` | No body, or `{ lockMeOut }`. Answers `{ revoked }`, false when it was already gone. Needs what `POST /grants` needs at its patterns, but what `everyone` gives |
140
141
  | GET | `/schemas` | `{ schemas }`: the built-in ones, then the board's own by name and version. Each one's `id`, `name`, `version`, `description`, `schema`, `builtIn`, `by`, and `at`. Anyone the board lets in. See [Schemas](#schemas) |
141
142
  | GET | `/schemas/:id` | `{ schema }`: one version, by `name@version` |
142
143
  | POST | `/schemas` | `{ name, version, description?, schema }`: register a version, for good. Needs `manage` at `*`. Answers `{ schema, created }`, `created` false for one that's there with the same definition |
@@ -883,6 +884,7 @@ When the board knows what fixes it, the error carries a `hint` too, as
883
884
  | 409 | `stale_lease` | an ack whose lease ran out: the match or inbox event was pulled again |
884
885
  | 413 | `too_large` | an upload over 4 MB, or a direct upload over 100 MB |
885
886
  | 429 | `ratelimited` | the platform rate-limited a source read |
887
+ | 429 | `rate_limited`, … | on Vercel's board, its API rate-limited the caller, after four retries: `Retry-After` says how many seconds to wait, and the message what the limit is |
886
888
  | 500 | `no_store` | a local board that can't open its file, in a directory it can't write: the message says where |
887
889
  | 500 | `internal` | anything else; the board logs it |
888
890
  | 501 | `no_scheduler` | a schedule on a board that keeps no schedules |
@@ -71,6 +71,13 @@ outside it. It revokes them all when a check ends, and a revoke that fails
71
71
  fails the check. Two runs on one board at once see each other's grants there,
72
72
  so run one at a time, on a scratch board.
73
73
 
74
+ To check that a board refuses a grant its maker couldn't take back, a run
75
+ that isn't the board's owner closes a pattern to everyone, itself included,
76
+ and expects 409 `grant_lockout`. A board that made that grant would leave one
77
+ the run can't revoke, so the check first makes a grant that says `lockMeOut`,
78
+ and stops where the board refuses the key. A run that owns the board skips
79
+ the check: nothing locks it out.
80
+
74
81
  The grants checks name a project, a GitHub repository, a person who's a
75
82
  viewer, and an app installed on the team. A board that verifies tokens
76
83
  itself, as `vb serve` does, takes the made-up IDs they use by default, and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/board",
3
- "version": "0.48.1",
3
+ "version": "0.49.0",
4
4
  "description": "A message board you mount in one route: one durable log, verified authors, live tail, and two-way sync.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -42,6 +42,10 @@
42
42
  "types": "./dist/cli-commands.d.mts",
43
43
  "default": "./dist/cli-commands.mjs"
44
44
  },
45
+ "./inspect": {
46
+ "types": "./dist/inspect.d.mts",
47
+ "default": "./dist/inspect.mjs"
48
+ },
45
49
  "./backend-local": {
46
50
  "types": "./dist/backend-local.d.mts",
47
51
  "default": "./dist/backend-local.mjs"
@@ -1,2 +0,0 @@
1
- import { n as inspect } from "./inspect-n9brh-TT.mjs";
2
- export { inspect };
@@ -1,2 +0,0 @@
1
- import { t as page } from "./page-D-OzDOAX.mjs";
2
- export { page };