@vercel/board 0.56.1 → 0.57.1

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 (96) hide show
  1. package/README.md +1 -1
  2. package/dist/{access-HzqFpgL_.mjs → access-CZ419Vho.mjs} +1 -1
  3. package/dist/access.d.mts +2 -2
  4. package/dist/access.mjs +4 -4
  5. package/dist/{actors-D-u6bitG.mjs → actors-CXMWplob.mjs} +2 -2
  6. package/dist/{auth-D9ycDQK0.mjs → auth-AwZJQpCO.mjs} +2 -2
  7. package/dist/{auth-ULldUvir.d.mts → auth-C0Mla9OU.d.mts} +1 -1
  8. package/dist/{backend-BHN6GTjB.d.mts → backend-BuqwQbb4.d.mts} +6 -22
  9. package/dist/backend-local.d.mts +1 -1
  10. package/dist/backend-local.mjs +1 -1
  11. package/dist/backend-postgres/blob-vercel.d.mts +8 -0
  12. package/dist/backend-postgres/blob-vercel.mjs +81 -0
  13. package/dist/backend-postgres/scheduler-vercel.d.mts +2 -0
  14. package/dist/backend-postgres/scheduler-vercel.mjs +2 -0
  15. package/dist/backend-postgres.d.mts +74 -0
  16. package/dist/backend-postgres.mjs +3229 -0
  17. package/dist/blob-DjS53D1A.d.mts +35 -0
  18. package/dist/{chat-provider-F7UqWVZK.d.mts → chat-provider-CpYdXEpI.d.mts} +2 -2
  19. package/dist/cli-commands.d.mts +1 -1
  20. package/dist/cli-commands.mjs +1 -1
  21. package/dist/cli-embedded.d.mts +2 -2
  22. package/dist/cli-embedded.mjs +2 -2
  23. package/dist/cli.mjs +6 -6
  24. package/dist/{client-CFHunEFn.d.mts → client-B0DGOt7P.d.mts} +1 -1
  25. package/dist/{commands-DLPIX7Jw.d.mts → commands-Dcm4_pc1.d.mts} +3 -3
  26. package/dist/{commands-7FY_8p92.mjs → commands-DeYAQUcP.mjs} +10 -5
  27. package/dist/{conformance-BNiLcKra.mjs → conformance-EtEq22w1.mjs} +2 -2
  28. package/dist/conformance.d.mts +1 -1
  29. package/dist/conformance.mjs +1 -1
  30. package/dist/{engine-C8wCzkw-.mjs → engine-CfVTyEeo.mjs} +3 -3
  31. package/dist/errors-DBZtbfph.d.mts +19 -0
  32. package/dist/{errors-DDfXnZ2b.mjs → errors-DjatfYjl.mjs} +220 -18
  33. package/dist/{exports-DSX-CI5c.mjs → exports-B_UGnrnN.mjs} +187 -62
  34. package/dist/{exports-BBmjHyCB.d.mts → exports-BvJTIorX.d.mts} +5 -4
  35. package/dist/{index-Ce3SDZ3Y.d.mts → index-DuibwQf9.d.mts} +2 -2
  36. package/dist/index.d.mts +6 -5
  37. package/dist/index.mjs +4 -4
  38. package/dist/index.node.d.mts +7 -6
  39. package/dist/index.node.mjs +4 -4
  40. package/dist/inspect/app.js +126 -146
  41. package/dist/inspect/engine.js +3 -3
  42. package/dist/inspect/sheet-presentation.js +1 -0
  43. package/dist/{inspect-C-vDnB_n.mjs → inspect-DfJzHFiE.mjs} +2 -2
  44. package/dist/inspect-H1MISWwN.mjs +2 -0
  45. package/dist/inspect.d.mts +1 -1
  46. package/dist/inspect.mjs +1 -1
  47. package/dist/{internal-CvsrprnU-CEPOUpAv.mjs → internal-CvsrprnU-DhZF6sZK.mjs} +43 -1
  48. package/dist/local-BiG1WJk0.mjs +98 -0
  49. package/dist/{local-B5aZcAwj.mjs → local-D2i5sxuY.mjs} +141 -3957
  50. package/dist/{main-DSlpMoBN.mjs → main-Bbqg3Unf.mjs} +167 -38
  51. package/dist/{memory-wmUDblhm.mjs → memory-BmsyKyHu.mjs} +3 -3
  52. package/dist/{mentions-CnWt9Z5b.mjs → mentions-DBGmqkr2.mjs} +5 -1
  53. package/dist/{middleware-BY4qqIh3.mjs → middleware-D2AGrGj7.mjs} +2 -32
  54. package/dist/{provider-DgGp4Zej.d.mts → provider-BNVyVKtH.d.mts} +2 -2
  55. package/dist/{routes-DNmQSOvQ.d.mts → routes-CSnxZyyb.d.mts} +2 -2
  56. package/dist/{serve-CI3kvpx_.mjs → serve-D06-DMej.mjs} +6 -6
  57. package/dist/{server-55vryxAl.mjs → server-BXbcS-n9.mjs} +27 -12
  58. package/dist/server-DX7mM6nm-Cq1xPyqJ.mjs +3769 -0
  59. package/dist/{serving-C1mhZQqH.mjs → serving-B2BNr4PR.mjs} +1 -1
  60. package/dist/{shell-7nGyF--f.mjs → shell-C8EowDEz.mjs} +15 -7
  61. package/dist/{sql-D0MqINA6.mjs → sql-CvBbb5Ui.mjs} +33 -22
  62. package/dist/{sqlite-Dj2ZEtgy.mjs → sqlite-B9ZLSDUT.mjs} +3 -3
  63. package/dist/{sqlite-db-DjbTlUwN.mjs → sqlite-db-DawFxCk6.mjs} +22 -7
  64. package/dist/store-N8PXxDAS-DWWgv-Vz.mjs +5 -0
  65. package/dist/{store-N8PXxDAS-BdL4Sq-f.mjs → store-codec-pAG2oPgQ-DbEYfF5Y.mjs} +2 -6
  66. package/dist/{store-memory-CKQVEzXN.mjs → store-memory-DOMraCLN.mjs} +3 -2
  67. package/dist/store-memory-XNDFHASI.mjs +2 -0
  68. package/dist/{store-polling-BZt2Rf3D-oh3aU_An.mjs → store-polling-BZt2Rf3D-nlZUQLz2.mjs} +1 -1
  69. package/dist/store-sqlite-Cs8dH9EX.mjs +2 -0
  70. package/dist/{store-sqlite-D6fIszST.mjs → store-sqlite-DUdQnX_6.mjs} +4 -3
  71. package/dist/sync-chat-sdk.d.mts +2 -2
  72. package/dist/sync-github.d.mts +2 -2
  73. package/dist/sync-linear.d.mts +3 -3
  74. package/dist/sync-slack.d.mts +3 -3
  75. package/dist/sync-slack.mjs +1 -1
  76. package/dist/sync.d.mts +2 -2
  77. package/dist/{task-batch-iecHMssy.mjs → task-batch-YMVr_c5R.mjs} +4 -4
  78. package/dist/{tokens-B3gXkQCs.mjs → tokens-CaEPmiG1.mjs} +2 -2
  79. package/dist/vercel-B5FM4uS8.d.mts +21 -0
  80. package/dist/vercel-BUb8II-P.mjs +305 -0
  81. package/dist/{version-gbihG3ui.mjs → version-BRR9FkLa.mjs} +1 -1
  82. package/docs/01-board/01-mounting.md +10 -0
  83. package/docs/01-board/05-reading.md +2 -1
  84. package/docs/01-board/09-access.md +8 -4
  85. package/docs/01-board/11-tasks.md +1 -1
  86. package/docs/01-board/12-postgres.md +222 -0
  87. package/docs/03-guides/02-inspector.md +34 -1
  88. package/docs/03-guides/07-build-a-ui.md +8 -4
  89. package/docs/04-reference/01-cli.md +1 -1
  90. package/docs/04-reference/03-http.md +2 -1
  91. package/docs/index.md +4 -1
  92. package/package.json +32 -3
  93. package/sql/postgres/schema.sql +389 -0
  94. package/dist/inspect-CJ8osLQ-.mjs +0 -2
  95. package/dist/store-memory-OdGsc-t_.mjs +0 -2
  96. package/dist/store-sqlite-CTxAVCcz.mjs +0 -2
package/README.md CHANGED
@@ -6,7 +6,7 @@ threads, a live tail, watchers, and two-way sync with Slack, GitHub, and Linear.
6
6
  accounts: people are who their `vercel login` says they are, and deployments and CI runs are
7
7
  who their platform's OIDC token says.
8
8
 
9
- **[Docs](https://vercel.com/docs/board)** · **[Getting started prompt](https://vercel.com/message-board-onboarding.md)**, to hand your coding agent
9
+ **[Docs](https://vercel.com/docs/board)** · **[Getting started prompt](https://vercel.com/board-getting-started.md)**, to hand your coding agent
10
10
 
11
11
  ```bash
12
12
  npm i @vercel/board
@@ -1,5 +1,5 @@
1
1
  import { a as CAN_MAX, s as ChannelPath } from "./schemas-CUSTEFIy.mjs";
2
- import { o as forbidden } from "./errors-DDfXnZ2b.mjs";
2
+ import { o as forbidden } from "./errors-DjatfYjl.mjs";
3
3
  //#region src/server/access.ts
4
4
  /**
5
5
  * What a principal may do in a channel. `read` covers messages, threads,
package/dist/access.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { An as GrantChangeRefusal, Bn as union, Cn as Access, Dn as FULL_ACCESS, En as ChannelPattern, Fn as Permission, Gn as CAN_MAX, Ln as checkGrantChange, Mn as InvalidCan, On as Grant, Pn as PERMISSIONS, Rn as compileAccess, Tn as Can, Vn as Actor, Wn as Author, jn as GrantShape, kn as GrantChange, wn as AccessSummary, zn as parseCan } from "./routes-DNmQSOvQ.mjs";
2
- import { _ as GrantFacts, a as DEFAULT_CAN, b as grantAccess, c as IssuerConfig, d as Principal, f as PrincipalKind, g as GrantExplanation, h as DecidingGrant, i as Claims, l as Known, m as Caller, n as AuthenticateContext, r as CallerRequest, s as HostPrincipal, t as Authenticate, u as OidcTokensOptions, v as GrantSource, x as subPrefix, y as explainGrants } from "./auth-ULldUvir.mjs";
1
+ import { An as GrantChangeRefusal, Bn as union, Cn as Access, Dn as FULL_ACCESS, En as ChannelPattern, Fn as Permission, Gn as CAN_MAX, Ln as checkGrantChange, Mn as InvalidCan, On as Grant, Pn as PERMISSIONS, Rn as compileAccess, Tn as Can, Vn as Actor, Wn as Author, jn as GrantShape, kn as GrantChange, wn as AccessSummary, zn as parseCan } from "./routes-CSnxZyyb.mjs";
2
+ import { _ as GrantFacts, a as DEFAULT_CAN, b as grantAccess, c as IssuerConfig, d as Principal, f as PrincipalKind, g as GrantExplanation, h as DecidingGrant, i as Claims, l as Known, m as Caller, n as AuthenticateContext, r as CallerRequest, s as HostPrincipal, t as Authenticate, u as OidcTokensOptions, v as GrantSource, x as subPrefix, y as explainGrants } from "./auth-C0Mla9OU.mjs";
3
3
  //#region src/server/tokens.d.ts
4
4
  /**
5
5
  * The OIDC tokens made out to this board: a request's bearer token, from Vercel (people and
package/dist/access.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { a as CAN_MAX } from "./schemas-CUSTEFIy.mjs";
2
- import { c as compileAccess, f as union, n as InvalidCan, o as checkGrantChange, r as PERMISSIONS, t as FULL_ACCESS, u as parseCan } from "./access-HzqFpgL_.mjs";
3
- import { D as explainGrants, O as grantAccess, k as subPrefix, t as DEFAULT_CAN } from "./auth-D9ycDQK0.mjs";
4
- import { a as resolveActor } from "./actors-D-u6bitG.mjs";
5
- import { t as oidcTokens } from "./tokens-B3gXkQCs.mjs";
2
+ import { c as compileAccess, f as union, n as InvalidCan, o as checkGrantChange, r as PERMISSIONS, t as FULL_ACCESS, u as parseCan } from "./access-CZ419Vho.mjs";
3
+ import { D as explainGrants, O as grantAccess, k as subPrefix, t as DEFAULT_CAN } from "./auth-AwZJQpCO.mjs";
4
+ import { a as resolveActor } from "./actors-CXMWplob.mjs";
5
+ import { t as oidcTokens } from "./tokens-CaEPmiG1.mjs";
6
6
  export { CAN_MAX, DEFAULT_CAN, FULL_ACCESS, InvalidCan, PERMISSIONS, checkGrantChange, compileAccess, explainGrants, grantAccess, oidcTokens, parseCan, resolveActor, subPrefix, union };
@@ -1,7 +1,7 @@
1
1
  import { r as parseProfileHeader } from "./profile-header-O8wC8yk8.mjs";
2
2
  import { P as toStorable } from "./schemas-CUSTEFIy.mjs";
3
- import { r as badRequest } from "./errors-DDfXnZ2b.mjs";
4
- import { u as parseCan } from "./access-HzqFpgL_.mjs";
3
+ import { r as badRequest } from "./errors-DjatfYjl.mjs";
4
+ import { u as parseCan } from "./access-CZ419Vho.mjs";
5
5
  import { t as own } from "./own-OwgPWdmh.mjs";
6
6
  //#region src/server/actors.ts
7
7
  /** Agents whose marks the board serves at `/avatars/<name>`, for a caller to pass as an avatar. */
@@ -1,5 +1,5 @@
1
- import { d as unauthorized, o as forbidden, r as badRequest, t as HttpError } from "./errors-DDfXnZ2b.mjs";
2
- import { c as compileAccess, l as decide, p as writtenCan, s as combine, t as FULL_ACCESS, u as parseCan } from "./access-HzqFpgL_.mjs";
1
+ import { d as unauthorized, o as forbidden, r as badRequest, t as HttpError } from "./errors-DjatfYjl.mjs";
2
+ import { c as compileAccess, l as decide, p as writtenCan, s as combine, t as FULL_ACCESS, u as parseCan } from "./access-CZ419Vho.mjs";
3
3
  //#region src/server/grants.ts
4
4
  /**
5
5
  * How close `principal` is to the caller, or null when it doesn't name it: `principal` for its own
@@ -1,4 +1,4 @@
1
- import { Cn as Access, Fn as Permission, In as WrittenCan, Nn as Level, Tn as Can } from "./routes-DNmQSOvQ.mjs";
1
+ import { Cn as Access, Fn as Permission, In as WrittenCan, Nn as Level, Tn as Can } from "./routes-CSnxZyyb.mjs";
2
2
  import { JWTVerifyGetKey } from "jose";
3
3
  //#region src/server/grants.d.ts
4
4
  /** Who asks, as a verified token says, in the terms grants name them by. */
@@ -1,7 +1,8 @@
1
- import { $ as InboxNextQuery, $t as SyncThreadView, B as Explanation, C as ClaimTaskBody, Cn as Access, Ct as ReleaseTaskBody, D as CreateTaskBody, E as CreateGrantsBody, Et as RevokeGrantBody, F as EditBody, Fn as Permission, Ft as SchemaBody, Gt as SyncCopiesView, Ht as SourceReadQuery, I as EventsPage, Jn as ExternalEvent, Jt as SyncFindView, Kn as Labels, L as EventsQuery, Lt as SchemaView, M as DeleteBody, Mt as SchedulesQuery, N as Discovery, Nn as Level, Ot as ScheduleBody, Q as InboxItem, Rt as SourceJoin, St as RegistrationView, T as CreateChannelBody, Tn as Can, Un as Attachment, V as FailTaskBody, Vn as Actor, Vt as SourceRead, W as GrantBody, Wn as Author, Wt as SyncCopiesQuery, X as InboxAckBody, Yt as SyncImportBody, Z as InboxEntry, Zt as SyncReceiptBody, _ as ChannelView, bn as UploadStartBody, bt as RegisterBody, c as BlockTaskBody, ct as MatchesQuery, dt as MessagesPage, en as SyncedView, et as InboxPushBody, fn as ThreadView, gn as TypingBody, h as ChannelMessagesQuery, i as ActorsQuery, in as TaskNeedsBody, it as LabelBody, j as CreatedTasksQuery, jt as ScheduleView, k as CreateTasksBody, ln as ThreadQuery, lt as Me, m as CancelTaskBody, mn as ThreadsQuery, n as AckBody, on as TasksPage, ot as LinkedQuery, pn as ThreadsPage, pt as PostBody, q as GrantView, qt as SyncFindQuery, r as ActorView, rn as TaskClaim, s as AssignTaskBody, sn as TasksQuery, st as MatchView, tt as InboxQuery, u as BoardEventView, ut as MessageView, v as ChannelsPage, vn as UpdateGrantBody, vt as ReactBody, w as CompleteTaskBody, wt as RenewTaskBody, x as ClaimReadyTaskBody, xn as UploadTicket, y as ChannelsQuery, z as ExplainQuery, zt as SourceJoinBody } from "./routes-DNmQSOvQ.mjs";
2
- import { l as Known, o as Granted, p as StoredGrant, t as Authenticate } from "./auth-ULldUvir.mjs";
3
- import { S as Mentioned, f as ProfileOption, i as ErrorOrigin, t as BoardClient } from "./client-CFHunEFn.mjs";
4
- import { m as SyncProvider } from "./provider-DgGp4Zej.mjs";
1
+ import { $ as InboxNextQuery, $t as SyncThreadView, B as Explanation, C as ClaimTaskBody, Cn as Access, Ct as ReleaseTaskBody, D as CreateTaskBody, E as CreateGrantsBody, Et as RevokeGrantBody, F as EditBody, Fn as Permission, Ft as SchemaBody, Gt as SyncCopiesView, Ht as SourceReadQuery, I as EventsPage, Jn as ExternalEvent, Jt as SyncFindView, Kn as Labels, L as EventsQuery, Lt as SchemaView, M as DeleteBody, Mt as SchedulesQuery, N as Discovery, Nn as Level, Ot as ScheduleBody, Q as InboxItem, Rt as SourceJoin, St as RegistrationView, T as CreateChannelBody, Tn as Can, Un as Attachment, V as FailTaskBody, Vn as Actor, Vt as SourceRead, W as GrantBody, Wn as Author, Wt as SyncCopiesQuery, X as InboxAckBody, Yt as SyncImportBody, Z as InboxEntry, Zt as SyncReceiptBody, _ as ChannelView, bn as UploadStartBody, bt as RegisterBody, c as BlockTaskBody, ct as MatchesQuery, dt as MessagesPage, en as SyncedView, et as InboxPushBody, fn as ThreadView, gn as TypingBody, h as ChannelMessagesQuery, i as ActorsQuery, in as TaskNeedsBody, it as LabelBody, j as CreatedTasksQuery, jt as ScheduleView, k as CreateTasksBody, ln as ThreadQuery, lt as Me, m as CancelTaskBody, mn as ThreadsQuery, n as AckBody, on as TasksPage, ot as LinkedQuery, pn as ThreadsPage, pt as PostBody, q as GrantView, qt as SyncFindQuery, r as ActorView, rn as TaskClaim, s as AssignTaskBody, sn as TasksQuery, st as MatchView, tt as InboxQuery, u as BoardEventView, ut as MessageView, v as ChannelsPage, vn as UpdateGrantBody, vt as ReactBody, w as CompleteTaskBody, wt as RenewTaskBody, x as ClaimReadyTaskBody, xn as UploadTicket, y as ChannelsQuery, z as ExplainQuery, zt as SourceJoinBody } from "./routes-CSnxZyyb.mjs";
2
+ import { l as Known, o as Granted, p as StoredGrant, t as Authenticate } from "./auth-C0Mla9OU.mjs";
3
+ import { S as Mentioned, f as ProfileOption, t as BoardClient } from "./client-B0DGOt7P.mjs";
4
+ import { t as HttpError } from "./errors-DBZtbfph.mjs";
5
+ import { m as SyncProvider } from "./provider-BNVyVKtH.mjs";
5
6
  import { z } from "zod";
6
7
  //#region src/server/sandbox.d.ts
7
8
  /** How a rule matches a value: a regular expression (RE2), or the value exactly. */
@@ -562,23 +563,6 @@ type Protocol = {
562
563
  };
563
564
  type Method = keyof Protocol;
564
565
  //#endregion
565
- //#region src/server/errors.d.ts
566
- declare class HttpError extends Error {
567
- readonly status: number;
568
- readonly code: string;
569
- /** What fixes it, when there's one (`BoardError`'s `hint`). */
570
- readonly hint: string | undefined;
571
- /** `handle` for a handle's own error on its way through: everything else is the board's. */
572
- readonly origin: ErrorOrigin;
573
- /** For a 429, how many seconds until it's worth sending again, when that's known: the response's `Retry-After`. */
574
- readonly retryAfter: number | undefined;
575
- constructor(status: number, code: string, message: string, options?: {
576
- hint?: string;
577
- origin?: ErrorOrigin;
578
- retryAfter?: number;
579
- });
580
- }
581
- //#endregion
582
566
  //#region src/server/middleware.d.ts
583
567
  /** Where a write came from, as the middleware sees it. */
584
568
  type WriteSource =
@@ -1057,4 +1041,4 @@ interface Backend extends ProtocolMethods {
1057
1041
  bind(board: BoardBinding): void;
1058
1042
  }
1059
1043
  //#endregion
1060
- export { Method as C, SandboxPolicy as D, SandboxMatcher as E, SandboxPolicyOptions as O, HttpError as S, SandboxMatch as T, Middleware as _, Identity as a, WritePatch as b, SelfCaller as c, AsOptions as d, Board as f, DroppedError as g, WatcherContext as h, Caller as i, SandboxRule as k, Subscription as l, Watcher as m, BackendRoute as n, InboxDelivery as o, BoardOptions as p, BoardBinding as r, ProtocolMethods as s, Backend as t, VerifiedCaller as u, MiddlewareContext as v, Protocol as w, WriteSource as x, Write as y };
1044
+ export { Protocol as C, SandboxPolicyOptions as D, SandboxPolicy as E, SandboxRule as O, Method as S, SandboxMatcher as T, Middleware as _, Identity as a, WritePatch as b, SelfCaller as c, AsOptions as d, Board as f, DroppedError as g, WatcherContext as h, Caller as i, Subscription as l, Watcher as m, BackendRoute as n, InboxDelivery as o, BoardOptions as p, BoardBinding as r, ProtocolMethods as s, Backend as t, VerifiedCaller as u, MiddlewareContext as v, SandboxMatch as w, WriteSource as x, Write as y };
@@ -1,4 +1,4 @@
1
- import { t as Backend } from "./backend-BHN6GTjB.mjs";
1
+ import { t as Backend } from "./backend-BuqwQbb4.mjs";
2
2
  //#region src/server/local.d.ts
3
3
  type LocalOptions = {
4
4
  /**
@@ -1,2 +1,2 @@
1
- import { t as local } from "./local-B5aZcAwj.mjs";
1
+ import { t as local } from "./local-BiG1WJk0.mjs";
2
2
  export { local };
@@ -0,0 +1,8 @@
1
+ import { t as BlobStore } from "../blob-DjS53D1A.mjs";
2
+ //#region src/blob/vercel.d.ts
3
+ export declare function vercelBlob(options?: {
4
+ token?: string;
5
+ storeId?: string;
6
+ prefix?: string;
7
+ }): BlobStore;
8
+ //#endregion
@@ -0,0 +1,81 @@
1
+ import { BlobNotFoundError, get, head, issueSignedToken, presignUrl, put } from "@vercel/blob";
2
+ //#region src/blob/vercel.ts
3
+ /**
4
+ * Attachments in a private Vercel Blob store. Connect one to the board's
5
+ * project; the SDK finds it through `BLOB_READ_WRITE_TOKEN`, or the project's
6
+ * OIDC token and `BLOB_STORE_ID`. Files are private: the board serves them to
7
+ * callers it verified, and the store never hands them out. Direct uploads, for
8
+ * files over 4 MB, `PUT` to a URL the store presigns for one pathname, which
9
+ * takes at most the file's size and never overwrites.
10
+ */
11
+ /** The Blob API version `@vercel/blob` speaks, which a presigned `PUT` names. */
12
+ const BLOB_API_VERSION = "12";
13
+ function vercelBlob(options = {}) {
14
+ const auth = {
15
+ ...options.token ? { token: options.token } : {},
16
+ ...options.storeId ? { storeId: options.storeId } : {}
17
+ };
18
+ const prefix = options.prefix ? `${options.prefix.replace(/^\/+|\/+$/g, "")}/` : "";
19
+ return {
20
+ async put(key, data, contentType) {
21
+ await put(prefix + key, Buffer.from(data.buffer, data.byteOffset, data.byteLength), {
22
+ ...auth,
23
+ access: "private",
24
+ contentType,
25
+ addRandomSuffix: false
26
+ });
27
+ },
28
+ async get(key) {
29
+ const found = await get(prefix + key, {
30
+ ...auth,
31
+ access: "private",
32
+ ...key.endsWith(".json") ? { useCache: false } : {}
33
+ });
34
+ if (!found || found.statusCode !== 200) return null;
35
+ return {
36
+ data: found.stream,
37
+ contentType: found.blob.contentType
38
+ };
39
+ },
40
+ async uploadUrl(key, { contentType, maxBytes, expiresAt }) {
41
+ const pathname = prefix + key;
42
+ const validUntil = expiresAt.getTime();
43
+ const signed = await issueSignedToken({
44
+ ...auth,
45
+ pathname,
46
+ operations: ["put"],
47
+ validUntil,
48
+ allowedContentTypes: [contentType],
49
+ maximumSizeInBytes: maxBytes
50
+ });
51
+ const { presignedUrl } = await presignUrl(signed, {
52
+ operation: "put",
53
+ access: "private",
54
+ pathname,
55
+ validUntil,
56
+ allowedContentTypes: [contentType],
57
+ maximumSizeInBytes: maxBytes,
58
+ allowOverwrite: false,
59
+ addRandomSuffix: false
60
+ });
61
+ return {
62
+ url: presignedUrl,
63
+ headers: {
64
+ "x-api-version": BLOB_API_VERSION,
65
+ "x-vercel-blob-access": "private",
66
+ "x-content-type": contentType
67
+ }
68
+ };
69
+ },
70
+ async head(key) {
71
+ try {
72
+ return { size: (await head(prefix + key, auth)).size };
73
+ } catch (error) {
74
+ if (error instanceof BlobNotFoundError) return null;
75
+ throw error;
76
+ }
77
+ }
78
+ };
79
+ }
80
+ //#endregion
81
+ export { vercelBlob };
@@ -0,0 +1,2 @@
1
+ import { n as VercelQueuesOptions, r as vercelQueues } from "../vercel-B5FM4uS8.mjs";
2
+ export { type VercelQueuesOptions, vercelQueues };
@@ -0,0 +1,2 @@
1
+ import { r as vercelQueues } from "../vercel-BUb8II-P.mjs";
2
+ export { vercelQueues };
@@ -0,0 +1,74 @@
1
+ import "./routes-CSnxZyyb.mjs";
2
+ import { t as Backend } from "./backend-BuqwQbb4.mjs";
3
+ import { t as BlobStore } from "./blob-DjS53D1A.mjs";
4
+ import { t as Scheduler } from "./vercel-B5FM4uS8.mjs";
5
+ //#region src/store/postgres-db.d.ts
6
+ /** What the tables need of a `pg` Pool, or of anything shaped like one. */
7
+ type PgQueryable = {
8
+ query(text: string, values?: unknown[]): Promise<{
9
+ rows: Record<string, unknown>[];
10
+ rowCount?: number | null;
11
+ }>;
12
+ };
13
+ type PgPool = PgQueryable & {
14
+ connect(): Promise<PgQueryable & {
15
+ release(): void;
16
+ }>;
17
+ end(): Promise<void>;
18
+ };
19
+ //#endregion
20
+ //#region src/server/postgres.d.ts
21
+ type PostgresOptions = {
22
+ /**
23
+ * The database, as a connection string: `DATABASE_URL`, or else `POSTGRES_URL`, by default, which
24
+ * a Postgres database connected to a Vercel project sets. Leave it out when you pass `pool`.
25
+ */
26
+ connectionString?: string;
27
+ /** A `pg` Pool you made, for a password from a callback, say. The board uses it and leaves it open. */
28
+ pool?: PgPool;
29
+ /** Connections the pool it makes may open. Default 10. */
30
+ max?: number;
31
+ /**
32
+ * What runs the board's timers: scheduled messages, leases running out, and watchers' and sync's
33
+ * retries. `vercelQueues()` from `@vercel/board/backend-postgres/scheduler-vercel`, mounted as
34
+ * `POST` in a route of its own. Default: timers in this process.
35
+ */
36
+ scheduler?: Scheduler;
37
+ /**
38
+ * Apply the package's `sql/postgres/schema.sql` on the first call when the database doesn't have
39
+ * this release's: on a new database, and after an upgrade that changed it. Default false: apply
40
+ * it yourself, before the deploy.
41
+ */
42
+ autoMigrate?: boolean;
43
+ /**
44
+ * Where attachments' bytes live: `vercelBlob()` from `@vercel/board/backend-postgres/blob-vercel`,
45
+ * or any `BlobStore`. A store that signs
46
+ * uploads (`uploadUrl` and `head`) takes files up to 100 MB; one that doesn't, up to 4 MB.
47
+ */
48
+ blob: BlobStore;
49
+ };
50
+ /** A board on Postgres. `close()` stops its timers and ends the pool it made. */
51
+ type PostgresBackend = Backend & {
52
+ /**
53
+ * The version of `schema.sql` the database records (`applied`, null when it has none) and this
54
+ * release's (`current`), for a page that says whether to migrate: a version only goes up, so
55
+ * `applied < current` is behind, and `applied > current` is a later release's, which this one
56
+ * reads and writes as it is. Doesn't open the board.
57
+ */
58
+ tables(): Promise<{
59
+ applied: number | null;
60
+ current: number;
61
+ }>;
62
+ /** Applies this release's `schema.sql` when the database is behind it, as `autoMigrate` does, under the same lock. */
63
+ migrate(): Promise<void>;
64
+ /** Stops its timers, and ends the pool if it made it. What's still to send stays in the database. */
65
+ close(): Promise<void>;
66
+ };
67
+ /**
68
+ * A board on Postgres (`npm i pg`): its log and its tables in one database, which any number of
69
+ * instances share, and its files in `blob`. Apply `sql/postgres/schema.sql` from the package first. It keeps one
70
+ * board, whatever `board({ name })` says.
71
+ */
72
+ export declare function postgres(options: PostgresOptions): PostgresBackend;
73
+ //#endregion
74
+ export type { BlobStore, PostgresBackend, PostgresOptions, Scheduler };