@vercel/board 0.38.0 → 0.40.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 (85) hide show
  1. package/README.md +5 -3
  2. package/dist/{access-CVkjSfxj.mjs → access-Bl_k_Hpa.mjs} +1 -1
  3. package/dist/access.d.mts +2 -2
  4. package/dist/access.mjs +4 -4
  5. package/dist/{actors-kfMejhaw.mjs → actors-yBRWTpt5.mjs} +38 -53
  6. package/dist/{auth-B3bBYOqf.mjs → auth-C8URZHLx.mjs} +2 -2
  7. package/dist/{auth-BXLCkeB0.d.mts → auth-DtmZzlHm.d.mts} +5 -2
  8. package/dist/{backend-BkQlF1LQ.d.mts → backend-BW5NbBsp.d.mts} +37 -11
  9. package/dist/backend-local.d.mts +1 -1
  10. package/dist/backend-local.mjs +1 -1
  11. package/dist/blocks-CVoBC7ur.mjs +402 -0
  12. package/dist/blocks-DGvh2alZ.d.mts +33 -0
  13. package/dist/{chat-provider-DyNy5xdC.d.mts → chat-provider-Bbb9JguG.d.mts} +2 -2
  14. package/dist/cli-commands.d.mts +1 -1
  15. package/dist/cli-commands.mjs +1 -1
  16. package/dist/cli-embedded.d.mts +2 -2
  17. package/dist/cli-embedded.mjs +3 -3
  18. package/dist/cli.mjs +5 -5
  19. package/dist/{commands-B5d-lmNN.d.mts → commands-BJLocuXj.d.mts} +10 -0
  20. package/dist/{commands-BLS7erNu.mjs → commands-D6VWegVY.mjs} +88 -8
  21. package/dist/{conformance-qJF96jZI.mjs → conformance-BWhZ0k8T.mjs} +256 -13
  22. package/dist/conformance.d.mts +4 -3
  23. package/dist/conformance.mjs +1 -1
  24. package/dist/data-values-C-Cq80hz.mjs +176 -0
  25. package/dist/digest-D32GV_mX.mjs +4 -0
  26. package/dist/{engine-eUgO5jTM.mjs → engine-Djif8XVk.mjs} +191 -77
  27. package/dist/{errors-rYDxZEuN.mjs → errors-CNRJqUuL.mjs} +16 -14
  28. package/dist/{exports-BsfcChdp.mjs → exports-C2OWIbLU.mjs} +639 -258
  29. package/dist/exports-FyRBIAMs.d.mts +4 -0
  30. package/dist/{index-DpVyZa9b.d.mts → index-Cuxbz_E0.d.mts} +2 -2
  31. package/dist/index.d.mts +7 -6
  32. package/dist/index.mjs +6 -5
  33. package/dist/index.node.d.mts +7 -6
  34. package/dist/index.node.mjs +5 -4
  35. package/dist/inspect/app.js +110 -109
  36. package/dist/inspect/engine.js +5 -5
  37. package/dist/inspect-CLy6FrOZ.mjs +2 -0
  38. package/dist/{inspect-DtCbBtOW.mjs → inspect-cGcP8ZO9.mjs} +4 -4
  39. package/dist/{local-Bo3XzEKB.mjs → local-CsleYuyM.mjs} +664 -752
  40. package/dist/{main-0nvLgajF.mjs → main-D97xuqWZ.mjs} +177 -59
  41. package/dist/{memory-DkoqhxIH.mjs → memory-BvVoglGv.mjs} +2 -2
  42. package/dist/{mentions-CB6ShY4R.mjs → mentions-CT2bN5eP.mjs} +17 -3
  43. package/dist/{middleware-CPqAuRtp.mjs → middleware-BF9vnPPS.mjs} +70 -2
  44. package/dist/{targets-B4Uikw0J.mjs → origin-DLCmrwmE.mjs} +47 -39
  45. package/dist/{page-UsfvSIWc.mjs → page-6BTCZWGY.mjs} +2 -2
  46. package/dist/page-BnY8FhPn.mjs +2 -0
  47. package/dist/{provider-D5yVFisj.d.mts → provider-YqkF1E2k.d.mts} +23 -13
  48. package/dist/{routes-BffuaoTX.d.mts → routes-CAjd5ARa.d.mts} +101 -25
  49. package/dist/schemas.d.mts +37 -0
  50. package/dist/schemas.mjs +3 -0
  51. package/dist/{serve-D7I3KisQ.mjs → serve-Cs-e0Jke.mjs} +4 -4
  52. package/dist/{server-Cc3nYq3H.mjs → server-CIfMdIt3.mjs} +43 -98
  53. package/dist/{serving-DJMcG0dT.mjs → serving-B4l0nLng.mjs} +1 -1
  54. package/dist/{sql-l3ysn4O5.mjs → sql-Bv-RQu8n.mjs} +73 -10
  55. package/dist/{sqlite-CAwNHbQD.mjs → sqlite-D4mkYihG.mjs} +2 -2
  56. package/dist/{sqlite-db-cm5yhrD-.mjs → sqlite-db-BraLvHtf.mjs} +1 -1
  57. package/dist/sync-chat-sdk.d.mts +2 -2
  58. package/dist/sync-github.d.mts +2 -2
  59. package/dist/sync-linear.d.mts +3 -3
  60. package/dist/sync-slack.d.mts +14 -8
  61. package/dist/sync-slack.mjs +42 -15
  62. package/dist/sync.d.mts +2 -2
  63. package/dist/{tokens-DA9ipsZ-.mjs → tokens-CrrXAVGz.mjs} +2 -2
  64. package/docs/01-board/01-mounting.md +7 -5
  65. package/docs/01-board/03-identity.md +71 -39
  66. package/docs/01-board/04-messages.md +58 -1
  67. package/docs/01-board/05-reading.md +3 -3
  68. package/docs/01-board/06-watchers.md +10 -14
  69. package/docs/01-board/07-schedules.md +2 -4
  70. package/docs/01-board/08-middleware.md +1 -1
  71. package/docs/01-board/09-access.md +25 -22
  72. package/docs/02-sync/01-overview.md +72 -7
  73. package/docs/02-sync/02-functions.md +11 -6
  74. package/docs/02-sync/03-slack.md +40 -16
  75. package/docs/02-sync/06-providers.md +9 -4
  76. package/docs/04-reference/01-cli.md +110 -18
  77. package/docs/04-reference/02-board.md +63 -10
  78. package/docs/04-reference/03-http.md +157 -31
  79. package/docs/04-reference/05-conformance.md +13 -6
  80. package/docs/index.md +1 -1
  81. package/package.json +5 -1
  82. package/dist/digest-DAxy9Ula.mjs +0 -4
  83. package/dist/exports-BJ3wmEMY.d.mts +0 -4
  84. package/dist/inspect-5mkjJYMS.mjs +0 -2
  85. package/dist/page-R0RoE_gM.mjs +0 -2
@@ -0,0 +1,402 @@
1
+ //#region src/contract/data-schemas.ts
2
+ /** How big a definition gets: its JSON, its nodes (each `enum` and `const` value counts), its subschemas, and its depth. */
3
+ const SCHEMA_BYTES_MAX = 32768;
4
+ const SCHEMA_DESCRIPTION_MAX = 2e3;
5
+ const SCHEMA_VERSION_MAX = 99999;
6
+ const NAME = `[a-z][a-z0-9._-]{0,79}`;
7
+ /** A schema's name: lowercase letters, numbers, and `._-`, starting with a letter. */
8
+ const SCHEMA_NAME = new RegExp(`^${NAME}$`);
9
+ const SCHEMA_ID = new RegExp(`^(${NAME})@([1-9][0-9]{0,4})$`);
10
+ /** `sandbox` and 1 as `sandbox@1`: what names a schema version everywhere. */
11
+ const schemaId = (name, version) => `${name}@${version}`;
12
+ /** `sandbox@1` as its name and version, or null for anything else. */
13
+ function parseSchemaId(id) {
14
+ const found = SCHEMA_ID.exec(id);
15
+ return found ? {
16
+ name: found[1],
17
+ version: Number(found[2])
18
+ } : null;
19
+ }
20
+ const commitSha = {
21
+ type: "string",
22
+ pattern: "^(?:[0-9a-f]{40}|[0-9a-f]{64})$",
23
+ description: "Full lowercase commit SHA"
24
+ };
25
+ /**
26
+ * The schemas every board has, as Vercel's API has them: their names are reserved, so no one
27
+ * registers a version of one. They may use what a registered schema can't (`pattern`): they're the
28
+ * board's own, and never change.
29
+ */
30
+ const BUILT_IN_SCHEMAS = [{
31
+ name: "git-commit",
32
+ version: 1,
33
+ description: "A Git commit, by its full SHA and the first line of its message.",
34
+ schema: {
35
+ type: "object",
36
+ additionalProperties: false,
37
+ required: ["sha", "title"],
38
+ properties: {
39
+ sha: commitSha,
40
+ title: {
41
+ type: "string",
42
+ minLength: 1,
43
+ maxLength: 1024
44
+ }
45
+ }
46
+ }
47
+ }, {
48
+ name: "vercel-deployment",
49
+ version: 1,
50
+ description: "A Vercel deployment, by its URL and optionally the commit it was built from.",
51
+ schema: {
52
+ type: "object",
53
+ additionalProperties: false,
54
+ required: ["url"],
55
+ properties: {
56
+ url: {
57
+ type: "string",
58
+ format: "uri",
59
+ pattern: "^https://",
60
+ maxLength: 2048
61
+ },
62
+ gitSha: commitSha
63
+ }
64
+ }
65
+ }];
66
+ /** Whether `name` is a built-in schema's: no one registers a version of it. */
67
+ const isBuiltInName = (name) => BUILT_IN_SCHEMAS.some((schema) => schema.name === name);
68
+ const TYPES = /* @__PURE__ */ new Set([
69
+ "object",
70
+ "array",
71
+ "string",
72
+ "number",
73
+ "integer",
74
+ "boolean",
75
+ "null"
76
+ ]);
77
+ /** The formats a string can name. */
78
+ const SCHEMA_FORMATS = [
79
+ "date-time",
80
+ "date",
81
+ "time",
82
+ "email",
83
+ "uri",
84
+ "uuid",
85
+ "hostname",
86
+ "ipv4",
87
+ "ipv6"
88
+ ];
89
+ const FORMATS = new Set(SCHEMA_FORMATS);
90
+ const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
91
+ /** A schema inside a schema: an object of keywords, or `true` or `false`. */
92
+ const isSubschema = (value) => isObject(value) || typeof value === "boolean";
93
+ const count = (value) => typeof value === "number" && Number.isInteger(value) && value >= 0;
94
+ const finite = (value) => typeof value === "number" && Number.isFinite(value);
95
+ const text = (value) => typeof value === "string";
96
+ const distinct = (values) => new Set(values).size === values.length;
97
+ /**
98
+ * Every keyword a definition may use, and what its value has to be: structural ones only. No `$ref`,
99
+ * `pattern`, or anything else that runs code or follows a reference, and no `uniqueItems`, which
100
+ * compares every pair of items.
101
+ */
102
+ const KEYWORDS = {
103
+ $schema: {
104
+ takes: "a string",
105
+ ok: text
106
+ },
107
+ title: {
108
+ takes: "a string",
109
+ ok: text
110
+ },
111
+ description: {
112
+ takes: "a string",
113
+ ok: text
114
+ },
115
+ type: {
116
+ takes: "object, array, string, number, integer, boolean, or null, or a list of them",
117
+ ok: (value) => TYPES.has(value) || Array.isArray(value) && value.length > 0 && value.every((one) => TYPES.has(one)) && distinct(value)
118
+ },
119
+ properties: {
120
+ takes: "an object of schemas, by property",
121
+ ok: (value) => isObject(value) && Object.values(value).every(isSubschema)
122
+ },
123
+ required: {
124
+ takes: "a list of property names, each once",
125
+ ok: (value) => Array.isArray(value) && value.every(text) && distinct(value)
126
+ },
127
+ additionalProperties: {
128
+ takes: "a schema, or true or false",
129
+ ok: isSubschema
130
+ },
131
+ items: {
132
+ takes: "one schema for every item",
133
+ ok: isSubschema
134
+ },
135
+ minItems: {
136
+ takes: "a whole number, 0 or more",
137
+ ok: count
138
+ },
139
+ maxItems: {
140
+ takes: "a whole number, 0 or more",
141
+ ok: count
142
+ },
143
+ minLength: {
144
+ takes: "a whole number, 0 or more",
145
+ ok: count
146
+ },
147
+ maxLength: {
148
+ takes: "a whole number, 0 or more",
149
+ ok: count
150
+ },
151
+ minimum: {
152
+ takes: "a number",
153
+ ok: finite
154
+ },
155
+ maximum: {
156
+ takes: "a number",
157
+ ok: finite
158
+ },
159
+ exclusiveMinimum: {
160
+ takes: "a number",
161
+ ok: finite
162
+ },
163
+ exclusiveMaximum: {
164
+ takes: "a number",
165
+ ok: finite
166
+ },
167
+ multipleOf: {
168
+ takes: "a number above 0",
169
+ ok: (value) => finite(value) && value > 0
170
+ },
171
+ enum: {
172
+ takes: "a list of at least one value",
173
+ ok: (value) => Array.isArray(value) && value.length > 0
174
+ },
175
+ const: {
176
+ takes: "any value",
177
+ ok: () => true
178
+ },
179
+ oneOf: {
180
+ takes: "a list of at least one schema",
181
+ ok: (value) => Array.isArray(value) && value.length > 0 && value.every(isSubschema)
182
+ },
183
+ anyOf: {
184
+ takes: "a list of at least one schema",
185
+ ok: (value) => Array.isArray(value) && value.length > 0 && value.every(isSubschema)
186
+ },
187
+ allOf: {
188
+ takes: "a list of at least one schema",
189
+ ok: (value) => Array.isArray(value) && value.length > 0 && value.every(isSubschema)
190
+ },
191
+ not: {
192
+ takes: "a schema",
193
+ ok: isSubschema
194
+ },
195
+ format: {
196
+ takes: `one of ${SCHEMA_FORMATS.join(", ")}`,
197
+ ok: (value) => FORMATS.has(value)
198
+ }
199
+ };
200
+ /** Whether the board can keep `value`: text with no NUL character and no lone surrogate. */
201
+ const keepable = (value) => !value.includes("\0") && value.isWellFormed();
202
+ var Problem = class extends Error {};
203
+ /**
204
+ * Why `schema` can't be registered, or null when it can: it describes an object, stays small, and
205
+ * uses only the structural keywords, each with a value that means something. Checking a value
206
+ * against one then costs the value's size times the schema's, and both are bounded.
207
+ */
208
+ function checkDefinition(schema) {
209
+ if (!isObject(schema) || schema.type !== "object") return "a schema describes a JSON object: give it \"type\": \"object\"";
210
+ if (new TextEncoder().encode(JSON.stringify(schema)).length > 32768) return `a schema is at most ${SCHEMA_BYTES_MAX} bytes of JSON`;
211
+ let nodes = 0;
212
+ let subschemas = 0;
213
+ const counted = (depth) => {
214
+ if (++nodes > 512 || depth > 16) throw new Problem(`a schema has at most 512 nodes and 16 levels`);
215
+ };
216
+ const kept = (value) => {
217
+ if (typeof value === "string" && !keepable(value)) throw new Problem("a schema has a NUL character or a lone surrogate in its text");
218
+ };
219
+ const data = (value, depth) => {
220
+ counted(depth);
221
+ kept(value);
222
+ if (typeof value !== "object" || value === null) return;
223
+ for (const [key, child] of Object.entries(value)) {
224
+ kept(key);
225
+ data(child, depth + 1);
226
+ }
227
+ };
228
+ const visit = (value, depth, at, properties) => {
229
+ counted(depth);
230
+ kept(value);
231
+ if (typeof value !== "object" || value === null) return;
232
+ if (Array.isArray(value)) {
233
+ value.forEach((item, index) => visit(item, depth + 1, `${at}/${index}`, false));
234
+ return;
235
+ }
236
+ if (properties) {
237
+ for (const [name, child] of Object.entries(value)) {
238
+ kept(name);
239
+ visit(child, depth + 1, `${at}/${name}`, false);
240
+ }
241
+ return;
242
+ }
243
+ if (++subschemas > 64) throw new Problem(`a schema has at most 64 subschemas`);
244
+ for (const [keyword, child] of Object.entries(value)) {
245
+ const rule = Object.hasOwn(KEYWORDS, keyword) ? KEYWORDS[keyword] : void 0;
246
+ if (!rule) throw new Problem(`schemas don't take "${keyword}"${at ? ` (at ${at})` : ""}: no references, patterns, uniqueItems, or keywords of your own`);
247
+ if (!rule.ok(child)) throw new Problem(`"${keyword}"${at ? ` at ${at}` : ""} takes ${rule.takes}`);
248
+ if (keyword === "enum" || keyword === "const") data(child, depth + 1);
249
+ else visit(child, depth + 1, `${at}/${keyword}`, keyword === "properties");
250
+ }
251
+ };
252
+ try {
253
+ visit(schema, 0, "", false);
254
+ } catch (error) {
255
+ if (error instanceof Problem) return error.message;
256
+ throw error;
257
+ }
258
+ return null;
259
+ }
260
+ /** `value` as JSON with every object's keys in order: two definitions that say the same are the same text. */
261
+ function canonical(value) {
262
+ return JSON.stringify(value, (_key, child) => isObject(child) ? Object.fromEntries(Object.entries(child).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0)) : child);
263
+ }
264
+ //#endregion
265
+ //#region src/contract/blocks.ts
266
+ const OPENING = /^( {0,3})(`{3,}|~{3,})(.*)$/;
267
+ const BLOCK_INFO = /^json#(\S*)/;
268
+ const QUOTED = /^ {0,3}>[ \t]?/;
269
+ const ITEM = /^ {0,3}(?:[-*+]|\d{1,9}[.)])(?: {1,4}|\t|$)/;
270
+ const INTERRUPTS = /^ {0,3}(?:#{1,6}(?:[ \t]|$)|([-*_])(?:[ \t]*\1){2,}[ \t]*$|<)/;
271
+ /** The fence `line` opens, if it opens one. A backtick fence's info string has no backtick in it: that's inline code. */
272
+ function opens(line) {
273
+ const found = OPENING.exec(line);
274
+ return found && !(found[2][0] === "`" && found[3].includes("`")) ? {
275
+ fence: found[2],
276
+ info: found[3].trim()
277
+ } : null;
278
+ }
279
+ /** Whether `line` closes `open`: the same character, at least as many, and nothing after but spaces. */
280
+ function closes(line, open) {
281
+ const found = /^ {0,3}(`{3,}|~{3,})[ \t]*$/.exec(line);
282
+ return found !== null && found[1][0] === open.fence[0] && found[1].length >= open.fence.length;
283
+ }
284
+ /** What a block's source holds: its data, or why it has none. */
285
+ function read(id, source) {
286
+ const named = parseSchemaId(id);
287
+ if (!named) return { problem: `${id || "json#"} names no schema: one is name@version, like sandbox@1` };
288
+ let parsed;
289
+ try {
290
+ parsed = JSON.parse(source);
291
+ } catch {
292
+ return {
293
+ ...named,
294
+ problem: `the ${id} block isn't JSON`
295
+ };
296
+ }
297
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return {
298
+ ...named,
299
+ problem: `the ${id} block isn't a JSON object`
300
+ };
301
+ return {
302
+ ...named,
303
+ data: parsed
304
+ };
305
+ }
306
+ /**
307
+ * The blocks in `text`, in order: each code fence at the top level whose info string is
308
+ * `json#<name>@<version>`. A fence inside another fence is that fence's text, and one in a quote or
309
+ * a list item is its container's and ends with it, so a message can show a block, or quote one,
310
+ * without posting it again, and none of them hides a block that follows. One with a `problem` has
311
+ * no `data`.
312
+ */
313
+ function findBlocks(text) {
314
+ const blocks = [];
315
+ let open = null;
316
+ let container = null;
317
+ let item = 0;
318
+ let nested = null;
319
+ let paragraph = false;
320
+ let at = 0;
321
+ const emit = (to, sourceEnd, end, unclosed = false) => {
322
+ const id = BLOCK_INFO.exec(to.info)?.[1];
323
+ if (id === void 0) return;
324
+ const source = text.slice(to.content, Math.max(to.content, sourceEnd));
325
+ blocks.push({
326
+ id,
327
+ source,
328
+ ...unclosed ? {
329
+ ...parseSchemaId(id) ?? {},
330
+ problem: `the ${id} block's fence never closes`
331
+ } : read(id, source),
332
+ start: to.start,
333
+ end
334
+ });
335
+ };
336
+ /** Whether `line` is plain text: what a paragraph is made of, and what continues one. */
337
+ const plain = (line) => line.trim() !== "" && opens(line) === null && !QUOTED.test(line) && !ITEM.test(line) && !INTERRUPTS.test(line);
338
+ /** `line` as the container it's in sees it, or null for a line at the top level. */
339
+ const within = (line) => {
340
+ const quoted = QUOTED.exec(line);
341
+ if (quoted) {
342
+ if (container !== "quote") nested = null;
343
+ container = "quote";
344
+ return line.slice(quoted[0].length);
345
+ }
346
+ if (container === "item" && (line.trim() === "" || line.length - line.trimStart().length >= item)) return line.slice(Math.min(item, line.length));
347
+ if (container !== null && paragraph && nested === null && plain(line)) return line;
348
+ const started = ITEM.exec(line);
349
+ nested = null;
350
+ container = started ? "item" : null;
351
+ if (!started) return null;
352
+ item = started[0].length === line.length ? line.length + 1 : started[0].length;
353
+ return line.slice(item);
354
+ };
355
+ while (at <= text.length) {
356
+ const newline = text.indexOf("\n", at);
357
+ const end = newline === -1 ? text.length : newline;
358
+ const line = text.slice(at, end).replace(/\r$/, "");
359
+ if (open) {
360
+ if (closes(line, open)) {
361
+ emit(open, at - 1, at + line.length);
362
+ open = null;
363
+ }
364
+ } else {
365
+ const inner = within(line);
366
+ if (inner === null) {
367
+ const found = opens(line);
368
+ if (found) open = {
369
+ ...found,
370
+ start: at,
371
+ content: Math.min(text.length, end + 1)
372
+ };
373
+ } else if (nested) {
374
+ if (closes(inner, nested)) nested = null;
375
+ } else nested = opens(inner);
376
+ paragraph = inner !== null && nested === null && plain(inner);
377
+ }
378
+ if (newline === -1) break;
379
+ at = newline + 1;
380
+ }
381
+ if (open) emit(open, text.length, text.length, true);
382
+ return blocks;
383
+ }
384
+ /** The blocks `text` holds, as a view lists them: each fence that names a schema and holds a JSON object. */
385
+ function blocksIn(text) {
386
+ if (!text.includes("json#")) return [];
387
+ return findBlocks(text).flatMap(({ name, version, data }) => name !== void 0 && version !== void 0 && data !== void 0 ? [{
388
+ schema: name,
389
+ version,
390
+ data
391
+ }] : []);
392
+ }
393
+ /**
394
+ * A block as text: `data` in a fence that names schema `id`. Alone, it's a message that is only
395
+ * its data; among prose, a message that says something and carries data.
396
+ */
397
+ function block(id, data) {
398
+ if (!parseSchemaId(id)) throw new TypeError(`${id} names no schema: one is name@version, like sandbox@1`);
399
+ return `\`\`\`json#${id}\n${JSON.stringify(data, null, 2)}\n\`\`\``;
400
+ }
401
+ //#endregion
402
+ export { SCHEMA_DESCRIPTION_MAX as a, canonical as c, parseSchemaId as d, schemaId as f, BUILT_IN_SCHEMAS as i, checkDefinition as l, blocksIn as n, SCHEMA_NAME as o, findBlocks as r, SCHEMA_VERSION_MAX as s, block as t, isBuiltInName as u };
@@ -0,0 +1,33 @@
1
+ //#region src/contract/blocks.d.ts
2
+ /** A fence in a message's text that names a schema, and what it holds. */
3
+ type FoundBlock = {
4
+ /** The schema as its fence names it: `sandbox@1`, or whatever follows `json#` when that names none. */
5
+ id: string;
6
+ /** Its name and version, when `id` is one. */
7
+ name?: string;
8
+ version?: number;
9
+ /** What's between its fences, as written. */
10
+ source: string;
11
+ /** Its data, when the source is a JSON object. */
12
+ data?: Record<string, unknown>;
13
+ /** Why it has no data: its ID names no schema, its JSON doesn't parse or isn't an object, or its fence never closes. */
14
+ problem?: string;
15
+ /** Where it is in the text: from the start of its opening fence's line to the end of its closing fence. */
16
+ start: number;
17
+ end: number;
18
+ };
19
+ /**
20
+ * The blocks in `text`, in order: each code fence at the top level whose info string is
21
+ * `json#<name>@<version>`. A fence inside another fence is that fence's text, and one in a quote or
22
+ * a list item is its container's and ends with it, so a message can show a block, or quote one,
23
+ * without posting it again, and none of them hides a block that follows. One with a `problem` has
24
+ * no `data`.
25
+ */
26
+ declare function findBlocks(text: string): FoundBlock[];
27
+ /**
28
+ * A block as text: `data` in a fence that names schema `id`. Alone, it's a message that is only
29
+ * its data; among prose, a message that says something and carries data.
30
+ */
31
+ declare function block(id: string, data: Record<string, unknown>): string;
32
+ //#endregion
33
+ export { block as n, findBlocks as r, FoundBlock as t };
@@ -1,5 +1,5 @@
1
- import { $t as Actor, an as ExternalAuthor, cn as ExternalLink, it as SourceJoin, sn as ExternalFile, st as SourceRead } from "./routes-BffuaoTX.mjs";
2
- import { T as ProviderEvent, a as ProviderOptions, c as ReceivedEvent, d as ResolvedTarget, g as SyncFn, i as ProviderFile, k as SyncRoot, n as FileDelivery, o as ProviderPost, p as SyncProvider, r as ProviderDelivery, s as Receive, t as FetchedLink } from "./provider-D5yVFisj.mjs";
1
+ import { ct as SourceJoin, dn as ExternalFile, dt as SourceRead, fn as ExternalLink, ln as ExternalAuthor, rn as Actor } from "./routes-CAjd5ARa.mjs";
2
+ import { A as SyncRoot, E as ProviderEvent, _ as SyncFn, a as ProviderOptions, c as Receive, f as ResolvedTarget, i as ProviderFile, l as ReceivedEvent, m as SyncProvider, n as FileDelivery, o as ProviderPost, r as ProviderDelivery, t as FetchedLink } from "./provider-YqkF1E2k.mjs";
3
3
  import { Adapter, Author, FileUpload, Message, ReactionEvent, StateAdapter } from "chat";
4
4
  //#region src/sync/chat-provider.d.ts
5
5
  type ChatInput = {
@@ -1,2 +1,2 @@
1
- import { a as OptionName, c as globalOptions, d as options, f as usage, i as CliOption, l as groups, n as CliCommand, o as commands, r as CliExample, s as filters, t as CliArgument, u as option } from "./commands-B5d-lmNN.mjs";
1
+ import { a as OptionName, c as globalOptions, d as options, f as usage, i as CliOption, l as groups, n as CliCommand, o as commands, r as CliExample, s as filters, t as CliArgument, u as option } from "./commands-BJLocuXj.mjs";
2
2
  export { CliArgument, CliCommand, CliExample, CliOption, OptionName, commands, filters, globalOptions, groups, option, options, usage };
@@ -1,2 +1,2 @@
1
- import { a as option, i as groups, n as filters, o as options, r as globalOptions, s as usage, t as commands } from "./commands-BLS7erNu.mjs";
1
+ import { a as option, i as groups, n as filters, o as options, r as globalOptions, s as usage, t as commands } from "./commands-D6VWegVY.mjs";
2
2
  export { commands, filters, globalOptions, groups, option, options, usage };
@@ -1,5 +1,5 @@
1
- import { d as Board } from "./backend-BkQlF1LQ.mjs";
2
- import "./index-DpVyZa9b.mjs";
1
+ import { d as Board } from "./backend-BW5NbBsp.mjs";
2
+ import "./index-Cuxbz_E0.mjs";
3
3
  //#region src/cli/failure.d.ts
4
4
  /**
5
5
  * What kind of failure it is, which fixes the exit code: 2 for `usage` and `missing_input`, 130
@@ -1,6 +1,6 @@
1
- import { g as VERSION } from "./targets-B4Uikw0J.mjs";
2
- import { a as commandLine, c as failureLines, i as mainWith, l as formatFailure, n as commandWord, o as exitCode, r as main, s as failureDocument, t as Failed } from "./main-0nvLgajF.mjs";
3
- import { t as PAGE_SHA256 } from "./digest-DAxy9Ula.mjs";
1
+ import { h as VERSION } from "./origin-DLCmrwmE.mjs";
2
+ import { a as commandLine, c as failureLines, i as mainWith, l as formatFailure, n as commandWord, o as exitCode, r as main, s as failureDocument, t as Failed } from "./main-D97xuqWZ.mjs";
3
+ import { t as PAGE_SHA256 } from "./digest-D32GV_mX.mjs";
4
4
  //#region src/cli/embedded.ts
5
5
  /**
6
6
  * The inspector's page as this version of board's npm package has it, for an app that bundles
package/dist/cli.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { a as option } from "./commands-BLS7erNu.mjs";
3
- import { f as projectDir } from "./server-Cc3nYq3H.mjs";
4
- import { r as main } from "./main-0nvLgajF.mjs";
5
- import { n as stopped, r as startInspector } from "./inspect-DtCbBtOW.mjs";
2
+ import { a as option } from "./commands-D6VWegVY.mjs";
3
+ import { f as projectDir } from "./server-CIfMdIt3.mjs";
4
+ import { r as main } from "./main-D97xuqWZ.mjs";
5
+ import { n as stopped, r as startInspector } from "./inspect-cGcP8ZO9.mjs";
6
6
  import { appendFile, readFile } from "node:fs/promises";
7
7
  import { join } from "node:path";
8
8
  //#region src/cli/local.ts
@@ -36,7 +36,7 @@ const local = { serve: {
36
36
  if (args.length > 0) throw usage("serve takes no arguments: pass its port with --port, and its directory with --dir.");
37
37
  const port = portFlag();
38
38
  const root = projectDir();
39
- const { localHandle, serveLocal } = await import("./serve-D7I3KisQ.mjs");
39
+ const { localHandle, serveLocal } = await import("./serve-Cs-e0Jke.mjs");
40
40
  const handle = flags.handle ?? process.env.BOARD_HANDLE;
41
41
  const local = await serveLocal({
42
42
  dir: flags.dir ?? join(root, ".board"),
@@ -448,6 +448,16 @@ declare const options: {
448
448
  readonly value: 'duration';
449
449
  readonly description: 'how long it lives (default: 30d, at most 90d; 1d and 7d on Vercel\'s board)';
450
450
  };
451
+ readonly schema: {
452
+ readonly type: 'string';
453
+ readonly value: 'json|@file';
454
+ readonly description: 'its JSON Schema: inline, @<file>, or - for stdin';
455
+ };
456
+ readonly description: {
457
+ readonly type: 'string';
458
+ readonly value: 'text';
459
+ readonly description: 'what it holds, in a sentence';
460
+ };
451
461
  readonly port: {
452
462
  readonly type: 'string';
453
463
  readonly value: 'N';
@@ -400,6 +400,16 @@ const options = {
400
400
  value: "duration",
401
401
  description: "how long it lives (default: 30d, at most 90d; 1d and 7d on Vercel's board)"
402
402
  },
403
+ schema: {
404
+ type: "string",
405
+ value: "json|@file",
406
+ description: "its JSON Schema: inline, @<file>, or - for stdin"
407
+ },
408
+ description: {
409
+ type: "string",
410
+ value: "text",
411
+ description: "what it holds, in a sentence"
412
+ },
403
413
  port: {
404
414
  type: "string",
405
415
  value: "N",
@@ -742,6 +752,62 @@ const commands = [
742
752
  }]
743
753
  }]
744
754
  },
755
+ {
756
+ group: "the board",
757
+ name: "schemas",
758
+ description: "schemas for structured data: versions that never change",
759
+ arguments: [],
760
+ options: [],
761
+ runsWithoutSubcommand: true,
762
+ examples: [{
763
+ name: "list the schemas",
764
+ value: "schemas"
765
+ }],
766
+ subcommands: [
767
+ {
768
+ name: "list",
769
+ default: true,
770
+ description: "the built-in schemas, then the board's own",
771
+ arguments: [],
772
+ options: [],
773
+ examples: [{
774
+ name: "list the schemas",
775
+ value: "schemas list"
776
+ }]
777
+ },
778
+ {
779
+ name: "inspect",
780
+ description: "one version, with its JSON Schema",
781
+ arguments: [{
782
+ name: "schema",
783
+ required: true,
784
+ description: "its ID, as schemas shows it (sandbox@1)"
785
+ }],
786
+ options: [],
787
+ examples: [{
788
+ name: "see what a sandbox event holds",
789
+ value: "schemas inspect sandbox@1"
790
+ }]
791
+ },
792
+ {
793
+ name: "create",
794
+ description: "register a version, for good: the same definition again changes nothing",
795
+ arguments: [{
796
+ name: "schema",
797
+ required: true,
798
+ description: "its name and version, such as sandbox@1"
799
+ }],
800
+ options: [option("schema"), option("description")],
801
+ examples: [{
802
+ name: "register a version from a file",
803
+ value: "schemas create sandbox@1 --schema @sandbox.schema.json --description 'What a sandbox did.'"
804
+ }, {
805
+ name: "or inline",
806
+ value: `schemas create ping@1 --schema '{"type":"object","required":["at"],"properties":{"at":{"type":"string","format":"date-time"}}}'`
807
+ }]
808
+ }
809
+ ]
810
+ },
745
811
  {
746
812
  group: "the board",
747
813
  name: "actors",
@@ -791,19 +857,27 @@ const commands = [
791
857
  options: [
792
858
  option("label", "label it", "k=v"),
793
859
  option("text-file"),
860
+ option("schema", "the text is JSON for this schema, such as sandbox@1", "schema"),
794
861
  option("attach"),
795
862
  option("sync"),
796
863
  option("no-sync"),
797
864
  option("idempotency-key"),
798
865
  option("after", AFTER)
799
866
  ],
800
- examples: [{
801
- name: "start a thread",
802
- value: "post dev \"deploys are green again\""
803
- }, {
804
- name: "start a labeled thread",
805
- value: "post dev \"checkout times out\" --label kind=bug"
806
- }]
867
+ examples: [
868
+ {
869
+ name: "start a thread",
870
+ value: "post dev \"deploys are green again\""
871
+ },
872
+ {
873
+ name: "start a labeled thread",
874
+ value: "post dev \"checkout times out\" --label kind=bug"
875
+ },
876
+ {
877
+ name: "post data that matches a schema",
878
+ value: `post deploys --schema sandbox@1 '{"id":"sbx-123","action":"started"}'`
879
+ }
880
+ ]
807
881
  },
808
882
  {
809
883
  group: "messages",
@@ -813,6 +887,7 @@ const commands = [
813
887
  options: [
814
888
  option("label", "label it", "k=v"),
815
889
  option("text-file"),
890
+ option("schema", "the text is JSON for this schema, such as sandbox@1", "schema"),
816
891
  option("attach"),
817
892
  option("idempotency-key"),
818
893
  option("no-sync"),
@@ -851,6 +926,7 @@ const commands = [
851
926
  option("times"),
852
927
  option("label", "label it", "k=v"),
853
928
  option("text-file"),
929
+ option("schema", "the text is JSON for this schema, such as sandbox@1", "schema"),
854
930
  option("attach"),
855
931
  option("no-sync")
856
932
  ],
@@ -905,7 +981,11 @@ const commands = [
905
981
  required: false,
906
982
  description: "its new text: - reads it from stdin, and it may be left out when you --text-file"
907
983
  }],
908
- options: [option("text-file"), option("if-revision")],
984
+ options: [
985
+ option("text-file"),
986
+ option("schema", "the text is JSON for this schema, such as sandbox@1", "schema"),
987
+ option("if-revision")
988
+ ],
909
989
  examples: [{
910
990
  name: "fix a typo",
911
991
  value: "edit 812 \"deploys are green again\""