@vercel/board 0.48.1 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{access-C06pIr0M.mjs → access-BbgmsAFF.mjs} +29 -17
- package/dist/access.d.mts +2 -2
- package/dist/access.mjs +5 -5
- package/dist/{actors-Dkyg-oo0.mjs → actors-CX2D22hL.mjs} +4 -3
- package/dist/{auth-B9-wXQ-x.mjs → auth-DJDTfgAL.mjs} +2 -2
- package/dist/{auth-li3lKwJG.d.mts → auth-Z9-Khvvw.d.mts} +1 -1
- package/dist/{backend-UBP6HimX.d.mts → backend-CcaaS9Xl.d.mts} +31 -8
- package/dist/backend-local.d.mts +1 -1
- package/dist/backend-local.mjs +1 -1
- package/dist/{chat-provider-iN0DFsSE.d.mts → chat-provider-DQ1GHm4o.d.mts} +2 -2
- package/dist/{chat-provider-kNWd6MQC.mjs → chat-provider-HJ7y_ipp.mjs} +2 -2
- package/dist/cli-commands.d.mts +1 -1
- package/dist/cli-commands.mjs +1 -1
- package/dist/cli-embedded.d.mts +8 -2
- package/dist/cli-embedded.mjs +10 -4
- package/dist/cli.mjs +6 -6
- package/dist/client-C2T4eaXd.d.mts +544 -0
- package/dist/{commands-CJsOA-hf.d.mts → commands-Cm4sODIu.d.mts} +12 -8
- package/dist/{commands-Dk6_cHLS.mjs → commands-nN8WpvCe.mjs} +75 -58
- package/dist/{conformance-CDP8y2Zm.mjs → conformance-Cr-umDl0.mjs} +102 -20
- package/dist/conformance.d.mts +1 -1
- package/dist/conformance.mjs +1 -1
- package/dist/{engine-BQ0hJw2w.mjs → engine-DJZ8Xy_g.mjs} +10 -7
- package/dist/{errors-QhkdzI-o.mjs → errors-DYF4hhIc.mjs} +53 -174
- package/dist/{events-B-qyxNsJ.mjs → events-BdOCmnZh.mjs} +3 -3
- package/dist/{exports-BzSG0_wL.mjs → exports-CuD-Mxkw.mjs} +389 -118
- package/dist/{exports-inhbjAWi.d.mts → exports-lmr6UHHc.d.mts} +4 -4
- package/dist/{external-BuVTXT1R.mjs → external-D2jq_DEQ.mjs} +1 -1
- package/dist/{index-B0Fnhvk7.d.mts → index-_KxJu15n.d.mts} +2 -2
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +4 -4
- package/dist/index.node.d.mts +7 -7
- package/dist/index.node.mjs +4 -4
- package/dist/inspect/app.js +39 -39
- package/dist/inspect/engine.js +3 -3
- package/dist/inspect-CZeoSm7E.mjs +272 -0
- package/dist/inspect-UCcPViyA.mjs +2 -0
- package/dist/inspect.d.mts +17 -0
- package/dist/inspect.mjs +196 -0
- package/dist/{local-BdKxz-Dn.mjs → local-BVSFSSYf.mjs} +165 -61
- package/dist/{main-BgiViRZ8.mjs → main-B016auoG.mjs} +227 -49
- package/dist/{memory-CMm-Fk_A.mjs → memory-C2lzMV_t.mjs} +2 -2
- package/dist/{middleware-CT6vMNUc.mjs → middleware-DUKIITFZ.mjs} +3 -3
- package/dist/{page-D-OzDOAX.mjs → page-7KWSGxyC.mjs} +12 -2
- package/dist/page-CN77B014.mjs +2 -0
- package/dist/profile-header-Cj0Cb1cf.mjs +163 -0
- package/dist/{provider-DC3WHUXo.d.mts → provider-Dwb_9mnu.d.mts} +3 -529
- package/dist/{routes-CjA6Mp4D.d.mts → routes-B6SEA9yw.d.mts} +130 -4
- package/dist/{routes-ABXf3CKq.mjs → routes-BE0y6wCk.mjs} +40 -14
- package/dist/{schemas-7VFdomFB.mjs → schemas-CUSTEFIy.mjs} +11 -3
- package/dist/{serve-C2Jbr7pR.mjs → serve-B10e7QaY.mjs} +5 -5
- package/dist/{server-EOQC5Gtq.mjs → server-ViWNvg5q.mjs} +61 -29
- package/dist/{serving-BNdiReQT.mjs → serving-SbqeWqlA.mjs} +1 -1
- package/dist/{inspect-n9brh-TT.mjs → shell-DmpmgOPC.mjs} +25 -274
- package/dist/{sql-IEbO5vXs.mjs → sql-iABdyCiz.mjs} +18 -5
- package/dist/{sqlite-CVG8XKHm.mjs → sqlite-28EMrmk7.mjs} +2 -2
- package/dist/{sqlite-db-BJjPQYx4.mjs → sqlite-db-Ckd-ceNe.mjs} +1 -1
- package/dist/sync-chat-sdk.d.mts +2 -2
- package/dist/sync-chat-sdk.mjs +2 -2
- package/dist/sync-github.d.mts +2 -2
- package/dist/sync-github.mjs +3 -3
- package/dist/sync-linear.d.mts +3 -3
- package/dist/sync-linear.mjs +3 -3
- package/dist/sync-slack.d.mts +3 -3
- package/dist/sync-slack.mjs +11 -7
- package/dist/sync.d.mts +2 -2
- package/dist/sync.mjs +2 -2
- package/dist/{tags-BpFo6q0_.mjs → tags-D0qra0Qy.mjs} +1 -1
- package/dist/{task-batch-D4p9N8lN.mjs → task-batch-9lVDG3d-.mjs} +10 -11
- package/dist/{tokens-BCp4EWTQ.mjs → tokens-C-iK0Cku.mjs} +2 -2
- package/dist/version-C70RLVEK.mjs +5 -0
- package/docs/01-board/01-mounting.md +8 -0
- package/docs/01-board/03-identity.md +3 -2
- package/docs/01-board/04-messages.md +6 -2
- package/docs/01-board/05-reading.md +17 -2
- package/docs/01-board/09-access.md +40 -6
- package/docs/01-board/11-tasks.md +3 -3
- package/docs/02-sync/01-overview.md +2 -1
- package/docs/03-guides/02-inspector.md +31 -0
- package/docs/03-guides/06-sandboxed-agents.md +22 -21
- package/docs/04-reference/01-cli.md +91 -33
- package/docs/04-reference/02-board.md +20 -7
- package/docs/04-reference/03-http.md +9 -6
- package/docs/04-reference/05-conformance.md +7 -0
- package/package.json +5 -1
- package/dist/inspect-BB-XUPuz.mjs +0 -2
- package/dist/page-Dr9Aqlej.mjs +0 -2
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
//#region src/contract/files.ts
|
|
2
|
+
/** Under Vercel Functions' 4.5 MB request body limit, so an upload fits in one request. */
|
|
3
|
+
const ATTACHMENT_BYTES_MAX = 4194304;
|
|
4
|
+
/**
|
|
5
|
+
* The most a file sync brings over from a platform can be. Sync fetches it on the server and
|
|
6
|
+
* stores it in-process, so no request carries it and the request limit doesn't apply: this bounds
|
|
7
|
+
* what one import holds in memory.
|
|
8
|
+
*/
|
|
9
|
+
const IMPORT_BYTES_MAX = 26214400;
|
|
10
|
+
/**
|
|
11
|
+
* The most a direct upload can be: the client sends the bytes straight to the blob store, on a URL
|
|
12
|
+
* the board signs, so no request to the board carries them. Needs a store with `uploadUrl`.
|
|
13
|
+
*/
|
|
14
|
+
const DIRECT_UPLOAD_BYTES_MAX = 104857600;
|
|
15
|
+
/** `120 KB`, `3.4 MB`: a file's size the way people read it. */
|
|
16
|
+
function fileSize(bytes) {
|
|
17
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
18
|
+
if (bytes < 1048576) return `${Math.round(bytes / 1024)} KB`;
|
|
19
|
+
return `${(bytes / 1024 / 1024).toFixed(1)} MB`;
|
|
20
|
+
}
|
|
21
|
+
const TYPES = {
|
|
22
|
+
".png": "image/png",
|
|
23
|
+
".jpg": "image/jpeg",
|
|
24
|
+
".jpeg": "image/jpeg",
|
|
25
|
+
".gif": "image/gif",
|
|
26
|
+
".webp": "image/webp",
|
|
27
|
+
".avif": "image/avif",
|
|
28
|
+
".svg": "image/svg+xml",
|
|
29
|
+
".mp4": "video/mp4",
|
|
30
|
+
".webm": "video/webm",
|
|
31
|
+
".mov": "video/quicktime",
|
|
32
|
+
".pdf": "application/pdf",
|
|
33
|
+
".txt": "text/plain",
|
|
34
|
+
".log": "text/plain",
|
|
35
|
+
".md": "text/markdown",
|
|
36
|
+
".json": "application/json",
|
|
37
|
+
".csv": "text/csv",
|
|
38
|
+
".html": "text/html",
|
|
39
|
+
".zip": "application/zip"
|
|
40
|
+
};
|
|
41
|
+
/** A file's type from its name, for when nothing better says: browsers leave `.log` untyped. */
|
|
42
|
+
function typeOf(name) {
|
|
43
|
+
const dot = name.lastIndexOf(".");
|
|
44
|
+
return dot > 0 && TYPES[name.slice(dot).toLowerCase()] || "application/octet-stream";
|
|
45
|
+
}
|
|
46
|
+
/** `shot.png`, as the board stores a name: no paths, no control characters. */
|
|
47
|
+
function fileName(name) {
|
|
48
|
+
return (name ?? "").split(/[\\/]/).pop().replace(/[\u0000-\u001f\u007f]/g, "").trim().slice(0, 255) || "file";
|
|
49
|
+
}
|
|
50
|
+
/** `image/png`, or `application/octet-stream` when the type isn't one. */
|
|
51
|
+
function mediaType(type) {
|
|
52
|
+
const value = (type ?? "").split(";")[0].trim().toLowerCase();
|
|
53
|
+
return /^[a-z0-9][a-z0-9!#$&^_.+-]*\/[a-z0-9][a-z0-9!#$&^_.+-]*$/.test(value) && value.length <= 255 ? value : "application/octet-stream";
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/contract/profile-header.ts
|
|
57
|
+
/** Why a header isn't one: the board's 400 says it. */
|
|
58
|
+
var InvalidProfileHeader = class extends Error {};
|
|
59
|
+
const TOKEN_START = /[A-Za-z*]/;
|
|
60
|
+
const TCHAR = /[!#$%&'*+\-.^_`|~0-9A-Za-z:/]/;
|
|
61
|
+
const KEY_START = /[a-z*]/;
|
|
62
|
+
const KEY_CHAR = /[a-z0-9_\-.*]/;
|
|
63
|
+
/** RFC 8941's other bare items: an integer, a decimal, a boolean, or a byte sequence. */
|
|
64
|
+
const OTHER_ITEM = /^(?:-?\d{1,15}|-?\d{1,12}\.\d{1,3}|\?[01]|:[A-Za-z0-9+/=]*:)$/;
|
|
65
|
+
/** An sf-string: printable ASCII in quotes, with `"` and `\` escaped. */
|
|
66
|
+
function sfString(value) {
|
|
67
|
+
if (!/^[\x20-\x7e]*$/.test(value)) throw new InvalidProfileHeader("an avatar URL is printable ASCII: percent-encode the rest");
|
|
68
|
+
return `"${value.replace(/[\\"]/g, (char) => `\\${char}`)}"`;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The header's value for a profile: `fixer`, or `fixer;avatar="https://example.com/fixer.png"`,
|
|
72
|
+
* serialized as RFC 8941 says. An avatar outside printable ASCII goes as its URL percent-encodes it.
|
|
73
|
+
*/
|
|
74
|
+
function formatProfileHeader(profile) {
|
|
75
|
+
if (!profile.avatar) return profile.name;
|
|
76
|
+
const avatar = /^[\x20-\x7e]*$/.test(profile.avatar) ? profile.avatar : URL.parse(profile.avatar)?.href ?? profile.avatar;
|
|
77
|
+
return `${profile.name};avatar=${sfString(avatar)}`;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Reads the header as RFC 8941 parses an Item. Its bare item is the profile's name, a token or a
|
|
81
|
+
* string; `avatar` is a string. A parameter it doesn't know is ignored, as structured fields' are,
|
|
82
|
+
* and the last of a repeated one wins. Anything else throws `InvalidProfileHeader`.
|
|
83
|
+
*/
|
|
84
|
+
function parseProfileHeader(value) {
|
|
85
|
+
let at = 0;
|
|
86
|
+
const fail = (why) => {
|
|
87
|
+
throw new InvalidProfileHeader(`x-board-profile is a structured header, like fixer;avatar="https://example.com/fixer.png": ${why}`);
|
|
88
|
+
};
|
|
89
|
+
const spaces = () => {
|
|
90
|
+
while (value[at] === " ") at++;
|
|
91
|
+
};
|
|
92
|
+
const string = () => {
|
|
93
|
+
at++;
|
|
94
|
+
let out = "";
|
|
95
|
+
while (at < value.length) {
|
|
96
|
+
const char = value[at++];
|
|
97
|
+
if (char === "\\") {
|
|
98
|
+
const next = value[at++];
|
|
99
|
+
if (next !== "\"" && next !== "\\") fail("a string escapes only \" and \\");
|
|
100
|
+
out += next;
|
|
101
|
+
} else if (char === "\"") return out;
|
|
102
|
+
else if (char < " " || char > "~") fail("a string is printable ASCII");
|
|
103
|
+
else out += char;
|
|
104
|
+
}
|
|
105
|
+
return fail("a string is missing its closing \"");
|
|
106
|
+
};
|
|
107
|
+
const token = () => {
|
|
108
|
+
const start = at;
|
|
109
|
+
while (at < value.length && TCHAR.test(value[at])) at++;
|
|
110
|
+
return value.slice(start, at);
|
|
111
|
+
};
|
|
112
|
+
/** A bare item: a string, a token, or another of RFC 8941's (a number, a boolean, bytes), which the header names nothing with. */
|
|
113
|
+
const bare = () => {
|
|
114
|
+
const char = value[at];
|
|
115
|
+
if (char === "\"") return {
|
|
116
|
+
kind: "string",
|
|
117
|
+
value: string()
|
|
118
|
+
};
|
|
119
|
+
if (char !== void 0 && TOKEN_START.test(char)) return {
|
|
120
|
+
kind: "token",
|
|
121
|
+
value: token()
|
|
122
|
+
};
|
|
123
|
+
const start = at;
|
|
124
|
+
while (at < value.length && value[at] !== ";" && value[at] !== " ") at++;
|
|
125
|
+
const item = value.slice(start, at);
|
|
126
|
+
if (!OTHER_ITEM.test(item)) fail(item === "" ? "a parameter has no value after its =" : `${item} isn't a value`);
|
|
127
|
+
return {
|
|
128
|
+
kind: "other",
|
|
129
|
+
value: item
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
spaces();
|
|
133
|
+
const name = bare();
|
|
134
|
+
if (name.kind === "other") fail(name.value === "" ? "it names no profile" : `${name.value} isn't a profile's name`);
|
|
135
|
+
let avatar = null;
|
|
136
|
+
while (value[at] === ";") {
|
|
137
|
+
at++;
|
|
138
|
+
spaces();
|
|
139
|
+
if (!KEY_START.test(value[at] ?? "")) fail("a parameter starts with a lowercase letter");
|
|
140
|
+
const start = at;
|
|
141
|
+
while (at < value.length && KEY_CHAR.test(value[at])) at++;
|
|
142
|
+
const key = value.slice(start, at);
|
|
143
|
+
let param = {
|
|
144
|
+
kind: "boolean",
|
|
145
|
+
value: "?1"
|
|
146
|
+
};
|
|
147
|
+
if (value[at] === "=") {
|
|
148
|
+
at++;
|
|
149
|
+
param = bare();
|
|
150
|
+
}
|
|
151
|
+
if (key !== "avatar") continue;
|
|
152
|
+
if (param.kind !== "string") fail("avatar is a string, in quotes");
|
|
153
|
+
avatar = param.value;
|
|
154
|
+
}
|
|
155
|
+
spaces();
|
|
156
|
+
if (at < value.length) fail(`${JSON.stringify(value.slice(at, at + 20))} follows the profile`);
|
|
157
|
+
return {
|
|
158
|
+
name: name.value,
|
|
159
|
+
avatar
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
//#endregion
|
|
163
|
+
export { DIRECT_UPLOAD_BYTES_MAX as a, fileSize as c, ATTACHMENT_BYTES_MAX as i, mediaType as l, formatProfileHeader as n, IMPORT_BYTES_MAX as o, parseProfileHeader as r, fileName as s, InvalidProfileHeader as t, typeOf as u };
|