@vercel/board 0.56.1 → 0.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{access-HzqFpgL_.mjs → access-CIj7v_Dr.mjs} +1 -1
- package/dist/access.d.mts +2 -2
- package/dist/access.mjs +4 -4
- package/dist/{actors-D-u6bitG.mjs → actors-DVDTqjm7.mjs} +2 -2
- package/dist/{auth-D9ycDQK0.mjs → auth-BDWGvFWl.mjs} +2 -2
- package/dist/{auth-ULldUvir.d.mts → auth-C0Mla9OU.d.mts} +1 -1
- package/dist/{backend-BHN6GTjB.d.mts → backend-BuqwQbb4.d.mts} +6 -22
- package/dist/backend-local.d.mts +1 -1
- package/dist/backend-local.mjs +1 -1
- package/dist/backend-postgres/blob-vercel.d.mts +8 -0
- package/dist/backend-postgres/blob-vercel.mjs +81 -0
- package/dist/backend-postgres/scheduler-vercel.d.mts +2 -0
- package/dist/backend-postgres/scheduler-vercel.mjs +2 -0
- package/dist/backend-postgres.d.mts +74 -0
- package/dist/backend-postgres.mjs +3229 -0
- package/dist/blob-DjS53D1A.d.mts +35 -0
- package/dist/{chat-provider-F7UqWVZK.d.mts → chat-provider-CpYdXEpI.d.mts} +2 -2
- package/dist/cli-embedded.d.mts +2 -2
- package/dist/cli-embedded.mjs +2 -2
- package/dist/cli.mjs +5 -5
- package/dist/{client-CFHunEFn.d.mts → client-B0DGOt7P.d.mts} +1 -1
- package/dist/{conformance-BNiLcKra.mjs → conformance-FiQ68adg.mjs} +2 -2
- package/dist/conformance.d.mts +1 -1
- package/dist/conformance.mjs +1 -1
- package/dist/{engine-C8wCzkw-.mjs → engine-B_CjnE3G.mjs} +3 -3
- package/dist/{errors-DDfXnZ2b.mjs → errors-BfMR39F0.mjs} +60 -17
- package/dist/errors-DBZtbfph.d.mts +19 -0
- package/dist/{exports-BBmjHyCB.d.mts → exports-BvJTIorX.d.mts} +5 -4
- package/dist/{exports-DSX-CI5c.mjs → exports-x-ioAfbp.mjs} +23 -14
- package/dist/{index-Ce3SDZ3Y.d.mts → index-DuibwQf9.d.mts} +2 -2
- package/dist/index.d.mts +6 -5
- package/dist/index.mjs +4 -4
- package/dist/index.node.d.mts +7 -6
- package/dist/index.node.mjs +4 -4
- package/dist/inspect/app.js +35 -35
- package/dist/{inspect-C-vDnB_n.mjs → inspect-BFnDSdsq.mjs} +2 -2
- package/dist/inspect-BuNsu2z6.mjs +2 -0
- package/dist/inspect.d.mts +1 -1
- package/dist/inspect.mjs +1 -1
- package/dist/{internal-CvsrprnU-CEPOUpAv.mjs → internal-CvsrprnU-DhZF6sZK.mjs} +43 -1
- package/dist/{local-B5aZcAwj.mjs → local-Bt1-jA9A.mjs} +129 -3956
- package/dist/local-Gp8pqHSu.mjs +98 -0
- package/dist/{main-DSlpMoBN.mjs → main-Du-mKQZn.mjs} +93 -13
- package/dist/{memory-wmUDblhm.mjs → memory-74hyK6eH.mjs} +3 -3
- package/dist/{mentions-CnWt9Z5b.mjs → mentions-DBGmqkr2.mjs} +5 -1
- package/dist/{middleware-BY4qqIh3.mjs → middleware-bIABV895.mjs} +1 -1
- package/dist/{provider-DgGp4Zej.d.mts → provider-BNVyVKtH.d.mts} +2 -2
- package/dist/{routes-DNmQSOvQ.d.mts → routes-CSnxZyyb.d.mts} +2 -2
- package/dist/{serve-CI3kvpx_.mjs → serve-xOoxwq7T.mjs} +6 -6
- package/dist/{server-55vryxAl.mjs → server-BSexF7Bk.mjs} +8 -8
- package/dist/server-DX7mM6nm-Cq1xPyqJ.mjs +3769 -0
- package/dist/{serving-C1mhZQqH.mjs → serving-ByD4TOOU.mjs} +1 -1
- package/dist/{shell-7nGyF--f.mjs → shell-0nWQEqh3.mjs} +5 -1
- package/dist/{sql-D0MqINA6.mjs → sql-CvBbb5Ui.mjs} +33 -22
- package/dist/{sqlite-Dj2ZEtgy.mjs → sqlite-DtfrT_EP.mjs} +3 -3
- package/dist/{sqlite-db-DjbTlUwN.mjs → sqlite-db-DSVlzQjv.mjs} +2 -2
- package/dist/store-N8PXxDAS-DWWgv-Vz.mjs +5 -0
- package/dist/{store-N8PXxDAS-BdL4Sq-f.mjs → store-codec-pAG2oPgQ-DbEYfF5Y.mjs} +2 -6
- package/dist/{store-memory-CKQVEzXN.mjs → store-memory-DOMraCLN.mjs} +3 -2
- package/dist/store-memory-XNDFHASI.mjs +2 -0
- package/dist/{store-polling-BZt2Rf3D-oh3aU_An.mjs → store-polling-BZt2Rf3D-nlZUQLz2.mjs} +1 -1
- package/dist/store-sqlite-Cs8dH9EX.mjs +2 -0
- package/dist/{store-sqlite-D6fIszST.mjs → store-sqlite-DUdQnX_6.mjs} +4 -3
- package/dist/sync-chat-sdk.d.mts +2 -2
- package/dist/sync-github.d.mts +2 -2
- package/dist/sync-linear.d.mts +3 -3
- package/dist/sync-slack.d.mts +3 -3
- package/dist/sync-slack.mjs +1 -1
- package/dist/sync.d.mts +2 -2
- package/dist/{task-batch-iecHMssy.mjs → task-batch-DgyfK9qx.mjs} +3 -3
- package/dist/{tokens-B3gXkQCs.mjs → tokens-_1X8JNLT.mjs} +2 -2
- package/dist/vercel-B5FM4uS8.d.mts +21 -0
- package/dist/vercel-BUb8II-P.mjs +305 -0
- package/dist/{version-gbihG3ui.mjs → version-CZT5WmZs.mjs} +1 -1
- package/docs/01-board/01-mounting.md +1 -0
- package/docs/01-board/12-postgres.md +222 -0
- package/docs/03-guides/02-inspector.md +33 -0
- package/docs/03-guides/07-build-a-ui.md +8 -4
- package/docs/04-reference/03-http.md +1 -1
- package/docs/index.md +4 -1
- package/package.json +31 -2
- package/sql/postgres/schema.sql +389 -0
- package/dist/inspect-CJ8osLQ-.mjs +0 -2
- package/dist/store-memory-OdGsc-t_.mjs +0 -2
- package/dist/store-sqlite-CTxAVCcz.mjs +0 -2
|
@@ -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-
|
|
2
|
+
import { o as forbidden } from "./errors-BfMR39F0.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-
|
|
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-
|
|
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-
|
|
3
|
-
import { D as explainGrants, O as grantAccess, k as subPrefix, t as DEFAULT_CAN } from "./auth-
|
|
4
|
-
import { a as resolveActor } from "./actors-
|
|
5
|
-
import { t as oidcTokens } from "./tokens-
|
|
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-CIj7v_Dr.mjs";
|
|
3
|
+
import { D as explainGrants, O as grantAccess, k as subPrefix, t as DEFAULT_CAN } from "./auth-BDWGvFWl.mjs";
|
|
4
|
+
import { a as resolveActor } from "./actors-DVDTqjm7.mjs";
|
|
5
|
+
import { t as oidcTokens } from "./tokens-_1X8JNLT.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-
|
|
4
|
-
import { u as parseCan } from "./access-
|
|
3
|
+
import { r as badRequest } from "./errors-BfMR39F0.mjs";
|
|
4
|
+
import { u as parseCan } from "./access-CIj7v_Dr.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-
|
|
2
|
-
import { c as compileAccess, l as decide, p as writtenCan, s as combine, t as FULL_ACCESS, u as parseCan } from "./access-
|
|
1
|
+
import { d as unauthorized, o as forbidden, r as badRequest, t as HttpError } from "./errors-BfMR39F0.mjs";
|
|
2
|
+
import { c as compileAccess, l as decide, p as writtenCan, s as combine, t as FULL_ACCESS, u as parseCan } from "./access-CIj7v_Dr.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-
|
|
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-
|
|
2
|
-
import { l as Known, o as Granted, p as StoredGrant, t as Authenticate } from "./auth-
|
|
3
|
-
import { S as Mentioned, f as ProfileOption,
|
|
4
|
-
import {
|
|
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 {
|
|
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 };
|
package/dist/backend-local.d.mts
CHANGED
package/dist/backend-local.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as local } from "./local-
|
|
1
|
+
import { t as local } from "./local-Gp8pqHSu.mjs";
|
|
2
2
|
export { local };
|
|
@@ -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,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 };
|