@vercel/board 0.30.0 → 0.31.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 (125) hide show
  1. package/README.md +8 -17
  2. package/dist/{a2-D_28Pdip.mjs → a2-DngWY2Eb.mjs} +573 -361
  3. package/dist/{access-CQ39gqEV.mjs → access-CY5xVMIK.mjs} +19 -3
  4. package/dist/{access-CV96SYgr.d.mts → access-DPcrKIH_.d.mts} +6 -1
  5. package/dist/access.d.mts +4 -4
  6. package/dist/access.mjs +5 -4
  7. package/dist/{actors-xPiamLWk.mjs → actors-Bm-ojWWT.mjs} +2 -2
  8. package/dist/{auth-BPinwfN0.mjs → auth-CyO2aw5n.mjs} +127 -14
  9. package/dist/{auth-CU56Q2Xh.d.mts → auth-DLYSt_-A.d.mts} +32 -4
  10. package/dist/{backend-n3hajfrD.d.mts → backend-Bob-5CM7.d.mts} +86 -41
  11. package/dist/backend-a2/blob-vercel.d.mts +1 -1
  12. package/dist/backend-a2/contract.d.mts +37 -97
  13. package/dist/backend-a2/contract.mjs +1 -1
  14. package/dist/backend-a2/store-memory.d.mts +1 -1
  15. package/dist/backend-a2/store-memory.mjs +2 -2
  16. package/dist/backend-a2/store-postgres.d.mts +1 -1
  17. package/dist/backend-a2/store-postgres.mjs +1 -1
  18. package/dist/backend-a2/store-redis-http.d.mts +1 -1
  19. package/dist/backend-a2/store-redis-http.mjs +1 -1
  20. package/dist/backend-a2/store-redis.d.mts +1 -1
  21. package/dist/backend-a2/store-redis.mjs +1 -1
  22. package/dist/backend-a2/store-sqlite.d.mts +1 -1
  23. package/dist/backend-a2/store-sqlite.mjs +2 -2
  24. package/dist/backend-a2.d.mts +131 -240
  25. package/dist/backend-a2.mjs +2 -2
  26. package/dist/{backend-http-3PoBYQoo.d.mts → backend-http-BRrRbjRx.d.mts} +49 -45
  27. package/dist/{backend-http-BPaNYLWj.mjs → backend-http-CvUKOn-m.mjs} +11 -9
  28. package/dist/{backend-http-16SbvnAK.mjs → backend-http-D8mUzuKQ.mjs} +2 -2
  29. package/dist/backend-http.d.mts +1 -1
  30. package/dist/backend-http.mjs +1 -1
  31. package/dist/backend-http.node.d.mts +1 -1
  32. package/dist/backend-http.node.mjs +1 -1
  33. package/dist/{backend-vercel-Kd8nvW5A.mjs → backend-vercel-Ba8JDtqW.mjs} +3 -3
  34. package/dist/{backend-vercel-qznuDxnN.d.mts → backend-vercel-BaSEUdwg.d.mts} +49 -45
  35. package/dist/{backend-vercel-C4Kee2-K.mjs → backend-vercel-CmY9yZ9m.mjs} +80 -15
  36. package/dist/backend-vercel.d.mts +1 -1
  37. package/dist/backend-vercel.mjs +1 -1
  38. package/dist/backend-vercel.node.d.mts +1 -1
  39. package/dist/backend-vercel.node.mjs +1 -1
  40. package/dist/{blob-CqILvdmr.d.mts → blob-Bx8QPWEd.d.mts} +2 -2
  41. package/dist/{blob-DQK5prXT.mjs → blob-WbB2DJKn.mjs} +30 -11
  42. package/dist/{chat-provider-D6jVT4wS.d.mts → chat-provider-BChYrrA7.d.mts} +32 -28
  43. package/dist/{chat-provider-COtsU5jB.mjs → chat-provider-DkFp2hrh.mjs} +105 -60
  44. package/dist/cli-commands.d.mts +1 -1
  45. package/dist/cli-commands.mjs +1 -1
  46. package/dist/cli-embedded.d.mts +2 -2
  47. package/dist/cli-embedded.mjs +1 -1
  48. package/dist/cli.mjs +4 -4
  49. package/dist/{client-CjAatpV4.d.mts → client-COfYrgfV.d.mts} +184 -221
  50. package/dist/{commands-BtH69yqt.d.mts → commands-DK4W3HCJ.d.mts} +30 -10
  51. package/dist/{commands-B5DHjZKK.mjs → commands-L1JSGz2Z.mjs} +162 -45
  52. package/dist/{conformance-C7fwIvmN.mjs → conformance-DK43HiHf.mjs} +224 -20
  53. package/dist/conformance.d.mts +8 -2
  54. package/dist/conformance.mjs +1 -1
  55. package/dist/{engine-DkdkXQEy.mjs → engine-DurYIRt8.mjs} +29 -210
  56. package/dist/{errors-87TVtXeb.d.mts → errors-2vGs49Db.d.mts} +1 -1
  57. package/dist/{errors-C_5rB8Iz.mjs → errors-CJXhhzvT.mjs} +28 -23
  58. package/dist/{provider-BaVmi4Hi.mjs → events-lujPA3gQ.mjs} +80 -17
  59. package/dist/{exports-CG0P8Qi4.mjs → exports-CWIdN0Ub.mjs} +146 -80
  60. package/dist/exports-FBOQWT7O.d.mts +5 -0
  61. package/dist/{folds-DGYkMW19.mjs → folds-Cu9Q9zyQ.mjs} +2 -22
  62. package/dist/{folds-8wRRXjAt.d.mts → folds-DLUzfibJ.d.mts} +13 -40
  63. package/dist/{index-BygAXP7t.d.mts → index-Ho-ayyQL.d.mts} +2 -2
  64. package/dist/index.d.mts +7 -7
  65. package/dist/{index.default-DhkgpfR2.mjs → index.default-BUcwDaAe.mjs} +1 -1
  66. package/dist/index.mjs +5 -5
  67. package/dist/index.node.d.mts +7 -7
  68. package/dist/index.node.mjs +3 -3
  69. package/dist/inspect/app.js +62 -61
  70. package/dist/inspect/engine.js +3 -3
  71. package/dist/{main-D2s-QBOK.mjs → main-Dz-8komG.mjs} +189 -112
  72. package/dist/{middleware-DlJQYiwV.mjs → middleware-BavYSDUa.mjs} +1 -1
  73. package/dist/{node-D8Rtg1su.mjs → node-BgeGcwX0.mjs} +7 -3
  74. package/dist/{project-C_2xs57L.mjs → project-CQ4VUibA.mjs} +1 -1
  75. package/dist/{provider-Bm46LAdp.d.mts → provider-gynDUoyW.d.mts} +13 -43
  76. package/dist/{redis-tables-BWJZHUGg.mjs → redis-tables-DHf85ixI.mjs} +1 -19
  77. package/dist/{reducers-8jqLewgw.mjs → reducers-DcENwtwZ.mjs} +72 -75
  78. package/dist/{serve-lPoBDEds.mjs → serve-CTmow-YH.mjs} +6 -6
  79. package/dist/{server-D82a4uMe.mjs → server-DG8D6VV0.mjs} +4 -4
  80. package/dist/{serving-DKny38LK.mjs → serving-DBFRo6U_.mjs} +1 -1
  81. package/dist/{sql-Bj0fk6dn.mjs → sql-CT5xVuGr.mjs} +2 -8
  82. package/dist/{sqlite-db-Dc8G78XV.mjs → sqlite-db-0WeSOEZN.mjs} +1 -1
  83. package/dist/{sync-kapso.d.mts → sync-chat-sdk.d.mts} +33 -37
  84. package/dist/sync-chat-sdk.mjs +44 -0
  85. package/dist/sync-github.d.mts +5 -18
  86. package/dist/sync-github.mjs +4 -70
  87. package/dist/sync-linear.d.mts +3 -3
  88. package/dist/sync-linear.mjs +2 -3
  89. package/dist/sync-slack.d.mts +7 -7
  90. package/dist/sync-slack.mjs +33 -54
  91. package/dist/sync.d.mts +3 -3
  92. package/dist/sync.mjs +2 -4
  93. package/dist/{tokens-C5_yGRlL.mjs → tokens-Dnyd_y1n.mjs} +15 -6
  94. package/dist/{types-shZmGZ-q.d.mts → types-CmrFjpml.d.mts} +1 -3
  95. package/dist/{watchers-hash-B_5b0-ZG.mjs → watchers-hash-BjwlnGD9.mjs} +85 -105
  96. package/docs/01-board/01-mounting.md +2 -2
  97. package/docs/01-board/03-identity.md +5 -6
  98. package/docs/01-board/04-messages.md +3 -2
  99. package/docs/01-board/05-reading.md +2 -1
  100. package/docs/01-board/06-watchers.md +8 -6
  101. package/docs/01-board/08-middleware.md +1 -1
  102. package/docs/01-board/09-access.md +145 -14
  103. package/docs/02-sync/01-overview.md +19 -26
  104. package/docs/02-sync/02-functions.md +8 -9
  105. package/docs/02-sync/03-slack.md +5 -5
  106. package/docs/02-sync/04-github.md +2 -2
  107. package/docs/02-sync/06-providers.md +91 -62
  108. package/docs/03-guides/01-coding-agents.md +1 -1
  109. package/docs/03-guides/03-ci.md +7 -4
  110. package/docs/04-reference/01-cli.md +86 -41
  111. package/docs/04-reference/02-board.md +56 -23
  112. package/docs/04-reference/03-http.md +59 -32
  113. package/docs/04-reference/04-log.md +8 -11
  114. package/docs/04-reference/05-conformance.md +35 -6
  115. package/docs/index.md +2 -2
  116. package/package.json +6 -9
  117. package/sql/postgres/board.sql +1 -1
  118. package/sql/postgres/schema.sql +1 -1
  119. package/dist/events-qf5XG5VQ.mjs +0 -75
  120. package/dist/exports-CrGA5_yN.d.mts +0 -5
  121. package/dist/sync-kapso.mjs +0 -89
  122. package/dist/sync.chat.d.mts +0 -2
  123. package/dist/sync.chat.mjs +0 -2
  124. package/dist/users-yryHKFMo.mjs +0 -42
  125. package/docs/02-sync/05-whatsapp.md +0 -152
@@ -1,6 +1,6 @@
1
- import { t as Actor, x as Attachment } from "./folds-8wRRXjAt.mjs";
2
- import { A as InboxItem, Ct as SyncCopiesView, D as IdentityView, Et as SyncFindView, H as MessageView, It as ThreadView, L as LinkedAccount, Lt as ThreadsPage, Mt as SyncThreadView, Pt as SyncedView, S as EventsPage, U as MessagesPage, Ut as UploadTicket, V as Me, b as Discovery, ft as SourceJoin, ht as SourceRead, k as InboxEntry, o as ProfileOption, q as PersonView, st as ScheduleView, tt as RegistrationView, v as ChannelView, xt as SyncCodeView, z as MatchView } from "./client-CjAatpV4.mjs";
3
- import { i as Caller, n as BackendRoute, r as BoardBinding } from "./backend-n3hajfrD.mjs";
1
+ import { t as Actor, x as Attachment } from "./folds-DLUzfibJ.mjs";
2
+ import { At as ThreadsPage, B as MatchView, C as EventsPage, Dt as SyncedView, Et as SyncThreadView, Ft as TokenView, H as Me, M as InboxItem, U as MessageView, W as MessagesPage, dt as SourceJoin, j as InboxEntry, k as GrantView, kt as ThreadView, mt as SourceRead, o as ProfileOption, st as ScheduleView, tt as RegistrationView, v as ChannelView, vt as SyncCopiesView, x as Discovery, xt as SyncFindView, zt as UploadTicket } from "./client-COfYrgfV.mjs";
3
+ import { i as Caller, n as BackendRoute, r as BoardBinding } from "./backend-Bob-5CM7.mjs";
4
4
  //#region src/server/backend-http.d.ts
5
5
  type HttpOptions = {
6
6
  /**
@@ -46,17 +46,18 @@ declare function createHttp(url: string | undefined, options: HttpOptions, envir
46
46
  channels: ChannelView[];
47
47
  cursor: string;
48
48
  }>;
49
+ createChannel: (caller: Caller, input: {
50
+ path: string;
51
+ }, signal: AbortSignal) => Promise<{
52
+ channel: ChannelView;
53
+ created: boolean;
54
+ }>;
49
55
  actors: (caller: Caller, input: {
50
56
  [x: string]: never;
51
57
  }, signal: AbortSignal) => Promise<{
52
- actors: (Actor & {
53
- person?: PersonView;
54
- })[];
58
+ actors: Actor[];
55
59
  cursor: string;
56
60
  }>;
57
- identity: (caller: Caller, input: {
58
- [x: string]: never;
59
- }, signal: AbortSignal) => Promise<IdentityView>;
60
61
  messages: (caller: Caller, input: {
61
62
  channel?: string | undefined;
62
63
  re?: string | undefined;
@@ -169,6 +170,45 @@ declare function createHttp(url: string | undefined, options: HttpOptions, envir
169
170
  schedule: ScheduleView;
170
171
  canceled: boolean;
171
172
  }>;
173
+ grants: (caller: Caller, input: {
174
+ [x: string]: never;
175
+ }, signal: AbortSignal) => Promise<{
176
+ grants: GrantView[];
177
+ }>;
178
+ createGrant: (caller: Caller, input: {
179
+ issuer: string;
180
+ claims: Record<string, string | string[]>;
181
+ can?: "all" | string[] | Record<string, "all" | string[]> | undefined;
182
+ }, signal: AbortSignal) => Promise<{
183
+ grant: GrantView;
184
+ created: boolean;
185
+ }>;
186
+ revokeGrant: (caller: Caller, input: {
187
+ id: string;
188
+ }, signal: AbortSignal) => Promise<{
189
+ revoked: boolean;
190
+ }>;
191
+ tokens: (caller: Caller, input: {
192
+ [x: string]: never;
193
+ }, signal: AbortSignal) => Promise<{
194
+ tokens: TokenView[];
195
+ }>;
196
+ createToken: (caller: Caller, input: {
197
+ name: string;
198
+ can?: "all" | string[] | Record<string, "all" | string[]> | undefined;
199
+ profile?: string | undefined;
200
+ avatar?: string | undefined;
201
+ session?: string | undefined;
202
+ expires?: string | undefined;
203
+ }, signal: AbortSignal) => Promise<{
204
+ token: TokenView;
205
+ secret: string;
206
+ }>;
207
+ revokeToken: (caller: Caller, input: {
208
+ id: string;
209
+ }, signal: AbortSignal) => Promise<{
210
+ revoked: boolean;
211
+ }>;
172
212
  upload: (caller: Caller, input: {
173
213
  data: Uint8Array;
174
214
  name: string | null;
@@ -206,7 +246,6 @@ declare function createHttp(url: string | undefined, options: HttpOptions, envir
206
246
  sync?: {
207
247
  key: string;
208
248
  platform: string;
209
- signIn: boolean;
210
249
  }[] | undefined;
211
250
  url?: string | null | undefined;
212
251
  path?: null | undefined;
@@ -219,7 +258,6 @@ declare function createHttp(url: string | undefined, options: HttpOptions, envir
219
258
  sync?: {
220
259
  key: string;
221
260
  platform: string;
222
- signIn: boolean;
223
261
  }[] | undefined;
224
262
  url?: null | undefined;
225
263
  path: string;
@@ -443,7 +481,6 @@ declare function createHttp(url: string | undefined, options: HttpOptions, envir
443
481
  external: {
444
482
  thread: string;
445
483
  message: string;
446
- asUser?: true | undefined;
447
484
  };
448
485
  files?: string[] | null | undefined;
449
486
  } | {
@@ -470,22 +507,13 @@ declare function createHttp(url: string | undefined, options: HttpOptions, envir
470
507
  thread: string;
471
508
  }, signal: AbortSignal) => Promise<SyncThreadView>;
472
509
  syncFind: (caller: Caller, input: {
473
- code?: string | undefined;
474
510
  post?: string | undefined;
475
511
  thread?: string | undefined;
476
512
  message?: string | undefined;
477
- account?: string | undefined;
478
- person?: string | undefined;
479
513
  }, signal: AbortSignal) => Promise<SyncFindView>;
480
514
  syncCopies: (caller: Caller, input: {
481
515
  message: string[];
482
516
  }, signal: AbortSignal) => Promise<SyncCopiesView>;
483
- syncRoots: (caller: Caller, input: {
484
- by: string;
485
- since: number;
486
- }, signal: AbortSignal) => Promise<{
487
- roots: MessageView[];
488
- }>;
489
517
  inboxPush: (caller: Caller, input: {
490
518
  key: string;
491
519
  } & {
@@ -631,30 +659,6 @@ declare function createHttp(url: string | undefined, options: HttpOptions, envir
631
659
  }, signal: AbortSignal) => Promise<{
632
660
  events: InboxEntry[];
633
661
  }>;
634
- syncCode: (caller: Caller, input: {
635
- sync: string;
636
- }, signal: AbortSignal) => Promise<SyncCodeView>;
637
- syncAccount: (caller: Caller, input: {
638
- sync: string;
639
- account: {
640
- id: string;
641
- handle: string;
642
- name: string;
643
- isBot: boolean;
644
- avatar: string | null;
645
- };
646
- code: string;
647
- message?: string | undefined;
648
- method?: "code" | "consent" | undefined;
649
- }, signal: AbortSignal) => Promise<{
650
- person: string;
651
- link: LinkedAccount;
652
- }>;
653
- syncUnlink: (caller: Caller, input: {
654
- account: string;
655
- }, signal: AbortSignal) => Promise<{
656
- ok: true;
657
- }>;
658
662
  routes: BackendRoute[];
659
663
  keeps: boolean;
660
664
  bind(next: BoardBinding): void;
@@ -1,7 +1,7 @@
1
1
  import "./files-SniSmeEr.mjs";
2
2
  import "./schemas-DBmUO6pr.mjs";
3
- import { a as METHODS, k as RegisterBody, n as compileWatcher, q as routes, t as canonicalWatchers } from "./watchers-hash-B_5b0-ZG.mjs";
4
- import { a as forbidden, d as createBoardClient, o as json, t as HttpError, u as BoardError } from "./errors-C_5rB8Iz.mjs";
3
+ import { A as RegisterBody, W as routes, a as METHODS, n as compileWatcher, t as canonicalWatchers } from "./watchers-hash-BjwlnGD9.mjs";
4
+ import { a as forbidden, d as createBoardClient, o as json, t as HttpError, u as BoardError } from "./errors-CJXhhzvT.mjs";
5
5
  import { a as keyId, n as DERIVED_ID, o as sha256, r as derivedId, t as waitUntil } from "./wait-until-Dw4XrIDQ.mjs";
6
6
  //#region src/server/registrant.ts
7
7
  /** Registering again this soon after the same registration only repeats it. */
@@ -186,12 +186,12 @@ const PROFILE = /^[A-Za-z][A-Za-z0-9-]{0,31}$/;
186
186
  const PROFILE_RULE = "ids start with a letter and use up to 32 letters, numbers, and hyphens";
187
187
  /**
188
188
  * What a board's own callers can't do on the board it uses, where they act as its project: what's
189
- * the project's own there (its registration, its sync, its links), and what's anyone's own there by
189
+ * the project's own there (its registration, its sync, its links, who it trusts and the tokens it
190
+ * mints, which would act as the project), and what's anyone's own there by
190
191
  * principal (editing, deleting, scheduling, and uploading, since a file is its uploader's to read
191
192
  * and attach until a message carries it), which the board it uses can't tell them apart for.
192
193
  */
193
194
  const PROJECTS_OWN = /* @__PURE__ */ new Set([
194
- "identity",
195
195
  "edit",
196
196
  "delete",
197
197
  "schedule",
@@ -203,19 +203,21 @@ const PROJECTS_OWN = /* @__PURE__ */ new Set([
203
203
  "register",
204
204
  "matches",
205
205
  "ack",
206
+ "grants",
207
+ "createGrant",
208
+ "revokeGrant",
209
+ "tokens",
210
+ "createToken",
211
+ "revokeToken",
206
212
  "syncImport",
207
213
  "syncReceipt",
208
214
  "syncThread",
209
215
  "syncFind",
210
216
  "syncCopies",
211
- "syncRoots",
212
217
  "inboxPush",
213
218
  "inboxNext",
214
219
  "inboxAck",
215
- "inbox",
216
- "syncCode",
217
- "syncAccount",
218
- "syncUnlink"
220
+ "inbox"
219
221
  ]);
220
222
  /**
221
223
  * A caller's handle as a profile on the board this one uses: `ada`, `ada-lovelace` for
@@ -1,5 +1,5 @@
1
- import { r as createHttp } from "./backend-http-BPaNYLWj.mjs";
2
- import { i as environmentProfile, n as boardUrl, r as connect } from "./node-D8Rtg1su.mjs";
1
+ import { r as createHttp } from "./backend-http-CvUKOn-m.mjs";
2
+ import { i as environmentProfile, n as boardUrl, r as connect } from "./node-BgeGcwX0.mjs";
3
3
  //#region src/backend-http/index.ts
4
4
  const environment = {
5
5
  url: boardUrl,
@@ -1,4 +1,4 @@
1
- import { n as HttpOptions, t as HttpBackend } from "./backend-http-3PoBYQoo.mjs";
1
+ import { n as HttpOptions, t as HttpBackend } from "./backend-http-BRrRbjRx.mjs";
2
2
  //#region src/backend-http/index.default.d.ts
3
3
  /**
4
4
  * The board at `url`, which keeps the log. Outside Node there's no environment to find it or a
@@ -1,2 +1,2 @@
1
- import { t as http } from "./index.default-DhkgpfR2.mjs";
1
+ import { t as http } from "./index.default-BUcwDaAe.mjs";
2
2
  export { http };
@@ -1,4 +1,4 @@
1
- import { n as HttpOptions, t as HttpBackend } from "./backend-http-3PoBYQoo.mjs";
1
+ import { n as HttpOptions, t as HttpBackend } from "./backend-http-BRrRbjRx.mjs";
2
2
  //#region src/backend-http/index.d.ts
3
3
  /**
4
4
  * The board at `url`, which keeps the log: this board uses it as this deployment. Without a
@@ -1,2 +1,2 @@
1
- import { t as http } from "./backend-http-16SbvnAK.mjs";
1
+ import { t as http } from "./backend-http-D8mUzuKQ.mjs";
2
2
  export { http };
@@ -1,6 +1,6 @@
1
- import { t as HttpError } from "./errors-C_5rB8Iz.mjs";
2
- import { c as loginHanded, d as vercelProjectFile, i as environmentProfile, t as asYou, u as vercelLogin } from "./node-D8Rtg1su.mjs";
3
- import { t as createVercel } from "./backend-vercel-C4Kee2-K.mjs";
1
+ import { t as HttpError } from "./errors-CJXhhzvT.mjs";
2
+ import { c as loginHanded, d as vercelProjectFile, i as environmentProfile, t as asYou, u as vercelLogin } from "./node-BgeGcwX0.mjs";
3
+ import { t as createVercel } from "./backend-vercel-CmY9yZ9m.mjs";
4
4
  import { readFile } from "node:fs/promises";
5
5
  import { decodeJwt } from "jose";
6
6
  import { getVercelOidcToken } from "@vercel/oidc";
@@ -1,6 +1,6 @@
1
- import { t as Actor, x as Attachment } from "./folds-8wRRXjAt.mjs";
2
- import { A as InboxItem, Ct as SyncCopiesView, D as IdentityView, Et as SyncFindView, H as MessageView, It as ThreadView, L as LinkedAccount, Lt as ThreadsPage, Mt as SyncThreadView, Pt as SyncedView, S as EventsPage, U as MessagesPage, Ut as UploadTicket, V as Me, b as Discovery, ft as SourceJoin, ht as SourceRead, k as InboxEntry, o as ProfileOption, q as PersonView, st as ScheduleView, tt as RegistrationView, v as ChannelView, xt as SyncCodeView, z as MatchView } from "./client-CjAatpV4.mjs";
3
- import { i as Caller, n as BackendRoute, r as BoardBinding } from "./backend-n3hajfrD.mjs";
1
+ import { t as Actor, x as Attachment } from "./folds-DLUzfibJ.mjs";
2
+ import { At as ThreadsPage, B as MatchView, C as EventsPage, Dt as SyncedView, Et as SyncThreadView, Ft as TokenView, H as Me, M as InboxItem, U as MessageView, W as MessagesPage, dt as SourceJoin, j as InboxEntry, k as GrantView, kt as ThreadView, mt as SourceRead, o as ProfileOption, st as ScheduleView, tt as RegistrationView, v as ChannelView, vt as SyncCopiesView, x as Discovery, xt as SyncFindView, zt as UploadTicket } from "./client-COfYrgfV.mjs";
3
+ import { i as Caller, n as BackendRoute, r as BoardBinding } from "./backend-Bob-5CM7.mjs";
4
4
  //#region src/server/backend-vercel.d.ts
5
5
  type VercelOptions = {
6
6
  /** The team whose board it is: its ID (`team_…`) or its slug. In Node, by default your deployment's, or `VERCEL_ORG_ID`. */
@@ -47,17 +47,18 @@ declare function createVercel(options: VercelOptions, environment: VercelEnviron
47
47
  channels: ChannelView[];
48
48
  cursor: string;
49
49
  }>;
50
+ createChannel: (caller: Caller, input: {
51
+ path: string;
52
+ }, signal: AbortSignal) => Promise<{
53
+ channel: ChannelView;
54
+ created: boolean;
55
+ }>;
50
56
  actors: (caller: Caller, input: {
51
57
  [x: string]: never;
52
58
  }, signal: AbortSignal) => Promise<{
53
- actors: (Actor & {
54
- person?: PersonView;
55
- })[];
59
+ actors: Actor[];
56
60
  cursor: string;
57
61
  }>;
58
- identity: (caller: Caller, input: {
59
- [x: string]: never;
60
- }, signal: AbortSignal) => Promise<IdentityView>;
61
62
  messages: (caller: Caller, input: {
62
63
  channel?: string | undefined;
63
64
  re?: string | undefined;
@@ -170,6 +171,45 @@ declare function createVercel(options: VercelOptions, environment: VercelEnviron
170
171
  schedule: ScheduleView;
171
172
  canceled: boolean;
172
173
  }>;
174
+ grants: (caller: Caller, input: {
175
+ [x: string]: never;
176
+ }, signal: AbortSignal) => Promise<{
177
+ grants: GrantView[];
178
+ }>;
179
+ createGrant: (caller: Caller, input: {
180
+ issuer: string;
181
+ claims: Record<string, string | string[]>;
182
+ can?: "all" | string[] | Record<string, "all" | string[]> | undefined;
183
+ }, signal: AbortSignal) => Promise<{
184
+ grant: GrantView;
185
+ created: boolean;
186
+ }>;
187
+ revokeGrant: (caller: Caller, input: {
188
+ id: string;
189
+ }, signal: AbortSignal) => Promise<{
190
+ revoked: boolean;
191
+ }>;
192
+ tokens: (caller: Caller, input: {
193
+ [x: string]: never;
194
+ }, signal: AbortSignal) => Promise<{
195
+ tokens: TokenView[];
196
+ }>;
197
+ createToken: (caller: Caller, input: {
198
+ name: string;
199
+ can?: "all" | string[] | Record<string, "all" | string[]> | undefined;
200
+ profile?: string | undefined;
201
+ avatar?: string | undefined;
202
+ session?: string | undefined;
203
+ expires?: string | undefined;
204
+ }, signal: AbortSignal) => Promise<{
205
+ token: TokenView;
206
+ secret: string;
207
+ }>;
208
+ revokeToken: (caller: Caller, input: {
209
+ id: string;
210
+ }, signal: AbortSignal) => Promise<{
211
+ revoked: boolean;
212
+ }>;
173
213
  upload: (caller: Caller, input: {
174
214
  data: Uint8Array;
175
215
  name: string | null;
@@ -207,7 +247,6 @@ declare function createVercel(options: VercelOptions, environment: VercelEnviron
207
247
  sync?: {
208
248
  key: string;
209
249
  platform: string;
210
- signIn: boolean;
211
250
  }[] | undefined;
212
251
  url?: string | null | undefined;
213
252
  path?: null | undefined;
@@ -220,7 +259,6 @@ declare function createVercel(options: VercelOptions, environment: VercelEnviron
220
259
  sync?: {
221
260
  key: string;
222
261
  platform: string;
223
- signIn: boolean;
224
262
  }[] | undefined;
225
263
  url?: null | undefined;
226
264
  path: string;
@@ -444,7 +482,6 @@ declare function createVercel(options: VercelOptions, environment: VercelEnviron
444
482
  external: {
445
483
  thread: string;
446
484
  message: string;
447
- asUser?: true | undefined;
448
485
  };
449
486
  files?: string[] | null | undefined;
450
487
  } | {
@@ -471,22 +508,13 @@ declare function createVercel(options: VercelOptions, environment: VercelEnviron
471
508
  thread: string;
472
509
  }, signal: AbortSignal) => Promise<SyncThreadView>;
473
510
  syncFind: (caller: Caller, input: {
474
- code?: string | undefined;
475
511
  post?: string | undefined;
476
512
  thread?: string | undefined;
477
513
  message?: string | undefined;
478
- account?: string | undefined;
479
- person?: string | undefined;
480
514
  }, signal: AbortSignal) => Promise<SyncFindView>;
481
515
  syncCopies: (caller: Caller, input: {
482
516
  message: string[];
483
517
  }, signal: AbortSignal) => Promise<SyncCopiesView>;
484
- syncRoots: (caller: Caller, input: {
485
- by: string;
486
- since: number;
487
- }, signal: AbortSignal) => Promise<{
488
- roots: MessageView[];
489
- }>;
490
518
  inboxPush: (caller: Caller, input: {
491
519
  key: string;
492
520
  } & {
@@ -632,30 +660,6 @@ declare function createVercel(options: VercelOptions, environment: VercelEnviron
632
660
  }, signal: AbortSignal) => Promise<{
633
661
  events: InboxEntry[];
634
662
  }>;
635
- syncCode: (caller: Caller, input: {
636
- sync: string;
637
- }, signal: AbortSignal) => Promise<SyncCodeView>;
638
- syncAccount: (caller: Caller, input: {
639
- sync: string;
640
- account: {
641
- id: string;
642
- handle: string;
643
- name: string;
644
- isBot: boolean;
645
- avatar: string | null;
646
- };
647
- code: string;
648
- message?: string | undefined;
649
- method?: "code" | "consent" | undefined;
650
- }, signal: AbortSignal) => Promise<{
651
- person: string;
652
- link: LinkedAccount;
653
- }>;
654
- syncUnlink: (caller: Caller, input: {
655
- account: string;
656
- }, signal: AbortSignal) => Promise<{
657
- ok: true;
658
- }>;
659
663
  routes: BackendRoute[];
660
664
  keeps: boolean;
661
665
  sendsSchedulesHere: boolean;
@@ -1,10 +1,10 @@
1
1
  import { r as IMPORT_BYTES_MAX } from "./files-SniSmeEr.mjs";
2
2
  import { _ as RemoteWatcherId } from "./schemas-DBmUO6pr.mjs";
3
- import { a as METHODS, d as VERSION, k as RegisterBody, n as compileWatcher, t as canonicalWatchers } from "./watchers-hash-B_5b0-ZG.mjs";
4
- import { a as forbidden, f as duration, o as json, r as badRequest, s as notFound, t as HttpError } from "./errors-C_5rB8Iz.mjs";
3
+ import { A as RegisterBody, a as METHODS, d as VERSION, n as compileWatcher, t as canonicalWatchers } from "./watchers-hash-BjwlnGD9.mjs";
4
+ import { a as forbidden, f as duration, o as json, r as badRequest, s as notFound, t as HttpError } from "./errors-CJXhhzvT.mjs";
5
5
  import { o as sha256, r as derivedId } from "./wait-until-Dw4XrIDQ.mjs";
6
- import { a as wakePath, i as registrant, n as callerProfile, t as PROJECTS_OWN } from "./backend-http-BPaNYLWj.mjs";
7
- import { o as mediaType, r as fileName } from "./blob-DQK5prXT.mjs";
6
+ import { a as wakePath, i as registrant, n as callerProfile, t as PROJECTS_OWN } from "./backend-http-CvUKOn-m.mjs";
7
+ import { o as mediaType, r as fileName } from "./blob-WbB2DJKn.mjs";
8
8
  //#region src/server/backend-vercel.ts
9
9
  const PROFILE = /^[A-Za-z][A-Za-z0-9-]{0,31}$/;
10
10
  const SESSION = /^[A-Za-z0-9_.:-]{1,128}$/;
@@ -191,10 +191,13 @@ function createVercel(options, environment) {
191
191
  if (!found) throw new HttpError(502, "remote_error", `Vercel's API names a channel it doesn't list: ${id}`);
192
192
  return found;
193
193
  }
194
- /** A channel to post in, made the first time something posts to it, as on any board. */
195
- async function channelToPost(who, name) {
194
+ /** The channel by `name`, made if it isn't there: `created` says whether this made it. */
195
+ async function ensureChannel(who, name) {
196
196
  const found = await channelNamed(who, name);
197
- if (found) return found;
197
+ if (found) return {
198
+ channel: found,
199
+ created: false
200
+ };
198
201
  try {
199
202
  const { channel } = await api(who, "POST", await onBoard(who, "/channels"), { body: {
200
203
  operationId: operationId(),
@@ -202,15 +205,23 @@ function createVercel(options, environment) {
202
205
  } });
203
206
  channels = null;
204
207
  named.set(name, channel);
205
- return channel;
208
+ return {
209
+ channel,
210
+ created: true
211
+ };
206
212
  } catch (error) {
207
213
  if (error instanceof HttpError && error.code === "channel_name_taken") {
208
214
  const made = await channelNamed(who, name);
209
- if (made) return made;
215
+ if (made) return {
216
+ channel: made,
217
+ created: false
218
+ };
210
219
  }
211
220
  throw error;
212
221
  }
213
222
  }
223
+ /** A channel to post in, made the first time something posts to it, as on any board. */
224
+ const channelToPost = async (who, name) => (await ensureChannel(who, name)).channel;
214
225
  /** The channels a filter names that `access` reads: one, a channel and those under it (`dev/`), or every one. */
215
226
  async function channelsFor(who, filter, access) {
216
227
  const readable = (channel) => access === null || access.readable(channel.name);
@@ -1072,18 +1083,24 @@ function createVercel(options, environment) {
1072
1083
  },
1073
1084
  async channels(caller) {
1074
1085
  return {
1075
- channels: (await channelsFor(whoOf(caller), void 0, accessOf(caller))).map((channel) => ({
1076
- path: channel.name,
1077
- lastIndex: 0,
1078
- messages: 0,
1079
- threads: 0
1080
- })),
1086
+ channels: (await channelsFor(whoOf(caller), void 0, accessOf(caller))).map((channel) => ({ path: channel.name })).sort((a, b) => a.path.localeCompare(b.path)),
1081
1087
  cursor: cursorOf({
1082
1088
  t: Date.now(),
1083
1089
  feeds: {}
1084
1090
  })
1085
1091
  };
1086
1092
  },
1093
+ async createChannel(caller, { path }) {
1094
+ checkCaller("createChannel", caller);
1095
+ const access = accessOf(caller);
1096
+ need(access, "read", path);
1097
+ need(access, "post", path);
1098
+ const { created } = await ensureChannel(whoOf(caller), path);
1099
+ return {
1100
+ channel: { path },
1101
+ created
1102
+ };
1103
+ },
1087
1104
  async actors(caller, _input, signal) {
1088
1105
  const who = whoOf(caller);
1089
1106
  const listed = (await all(who, await onBoard(who, "/actors"), "actors", {}, signal)).map((actor) => ({
@@ -1416,6 +1433,54 @@ function createVercel(options, environment) {
1416
1433
  });
1417
1434
  return { ok: true };
1418
1435
  },
1436
+ async grants(caller, _input, signal) {
1437
+ checkCaller("grants", caller);
1438
+ const who = whoOf(caller);
1439
+ return api(who, "GET", await onBoard(who, "/grants"), signal ? { signal } : {});
1440
+ },
1441
+ async createGrant(caller, input, signal) {
1442
+ checkCaller("createGrant", caller);
1443
+ const who = whoOf(caller);
1444
+ return api(who, "POST", await onBoard(who, "/grants"), {
1445
+ body: {
1446
+ operationId: operationId(),
1447
+ ...input
1448
+ },
1449
+ ...signal ? { signal } : {}
1450
+ });
1451
+ },
1452
+ async revokeGrant(caller, { id }, signal) {
1453
+ checkCaller("revokeGrant", caller);
1454
+ const who = whoOf(caller);
1455
+ return api(who, "POST", await onBoard(who, `/grants/${encodeURIComponent(id)}/revoke`), {
1456
+ body: { operationId: operationId() },
1457
+ ...signal ? { signal } : {}
1458
+ });
1459
+ },
1460
+ async tokens(caller, _input, signal) {
1461
+ checkCaller("tokens", caller);
1462
+ const who = whoOf(caller);
1463
+ return api(who, "GET", await onBoard(who, "/tokens"), signal ? { signal } : {});
1464
+ },
1465
+ async createToken(caller, input, signal) {
1466
+ checkCaller("createToken", caller);
1467
+ const who = whoOf(caller);
1468
+ return api(who, "POST", await onBoard(who, "/tokens"), {
1469
+ body: {
1470
+ operationId: operationId(),
1471
+ ...input
1472
+ },
1473
+ ...signal ? { signal } : {}
1474
+ });
1475
+ },
1476
+ async revokeToken(caller, { id }, signal) {
1477
+ checkCaller("revokeToken", caller);
1478
+ const who = whoOf(caller);
1479
+ return api(who, "POST", await onBoard(who, `/tokens/${encodeURIComponent(id)}/revoke`), {
1480
+ body: { operationId: operationId() },
1481
+ ...signal ? { signal } : {}
1482
+ });
1483
+ },
1419
1484
  async schedule(caller, input, signal) {
1420
1485
  if (input.attachments?.length) throw notSupported("files on scheduled messages");
1421
1486
  const who = whoOf(caller);
@@ -1,4 +1,4 @@
1
- import { n as VercelOptions, t as VercelBackend } from "./backend-vercel-qznuDxnN.mjs";
1
+ import { n as VercelOptions, t as VercelBackend } from "./backend-vercel-BaSEUdwg.mjs";
2
2
  //#region src/backend-vercel/index.default.d.ts
3
3
  /**
4
4
  * Your team's board, in Vercel's API. Outside Node there's no environment to find credentials or
@@ -1,4 +1,4 @@
1
- import { t as createVercel } from "./backend-vercel-C4Kee2-K.mjs";
1
+ import { t as createVercel } from "./backend-vercel-CmY9yZ9m.mjs";
2
2
  //#region src/backend-vercel/index.default.ts
3
3
  /**
4
4
  * Your team's board, in Vercel's API. Outside Node there's no environment to find credentials or
@@ -1,4 +1,4 @@
1
- import { n as VercelOptions, t as VercelBackend } from "./backend-vercel-qznuDxnN.mjs";
1
+ import { n as VercelOptions, t as VercelBackend } from "./backend-vercel-BaSEUdwg.mjs";
2
2
  //#region src/backend-vercel/index.d.ts
3
3
  /** Where `token` comes from, in words: what `vb whoami` says. */
4
4
  export declare function credentialSource(): string;
@@ -1,2 +1,2 @@
1
- import { n as handTeam, r as vercel, t as credentialSource } from "./backend-vercel-Kd8nvW5A.mjs";
1
+ import { n as handTeam, r as vercel, t as credentialSource } from "./backend-vercel-Ba8JDtqW.mjs";
2
2
  export { credentialSource, handTeam, vercel };
@@ -1,5 +1,5 @@
1
- import "./folds-8wRRXjAt.mjs";
2
- import "./errors-87TVtXeb.mjs";
1
+ import "./folds-DLUzfibJ.mjs";
2
+ import "./errors-2vGs49Db.mjs";
3
3
  //#region src/server/blob.d.ts
4
4
  /**
5
5
  * Where attachments' bytes live. The board writes each file once, under a key