@vercel/board 0.38.0 → 0.39.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/{backend-BkQlF1LQ.d.mts → backend-HcCCGPG4.d.mts} +1 -1
- package/dist/backend-local.d.mts +1 -1
- package/dist/backend-local.mjs +1 -1
- package/dist/cli-embedded.d.mts +2 -2
- package/dist/cli-embedded.mjs +3 -3
- package/dist/cli.mjs +4 -4
- package/dist/{conformance-qJF96jZI.mjs → conformance-D59Py2m2.mjs} +4 -8
- package/dist/conformance.d.mts +1 -1
- package/dist/conformance.mjs +1 -1
- package/dist/digest-krhjNAt4.mjs +4 -0
- package/dist/{exports-BsfcChdp.mjs → exports-M5o4PTfO.mjs} +21 -16
- package/dist/exports-vLQ2Y2Nd.d.mts +4 -0
- package/dist/{index-DpVyZa9b.d.mts → index-rNqqgkyu.d.mts} +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/index.node.d.mts +2 -2
- package/dist/index.node.mjs +1 -1
- package/dist/inspect/app.js +5 -5
- package/dist/{inspect-DtCbBtOW.mjs → inspect-BkXxR2uB.mjs} +3 -3
- package/dist/inspect-lnv1sLXM.mjs +2 -0
- package/dist/{local-Bo3XzEKB.mjs → local-DvkOWf4U.mjs} +227 -511
- package/dist/{main-0nvLgajF.mjs → main-DtV_Po9i.mjs} +5 -5
- package/dist/{page-UsfvSIWc.mjs → page-64IwoGRu.mjs} +2 -2
- package/dist/page-BUj8_UZv.mjs +2 -0
- package/dist/{serve-D7I3KisQ.mjs → serve-CX1rqDF_.mjs} +2 -2
- package/dist/{server-Cc3nYq3H.mjs → server-DkYkyarg.mjs} +41 -96
- package/dist/{targets-B4Uikw0J.mjs → targets-C1mT3M1N.mjs} +1 -1
- package/docs/01-board/01-mounting.md +2 -2
- package/docs/01-board/03-identity.md +1 -1
- package/docs/01-board/06-watchers.md +8 -11
- package/docs/01-board/09-access.md +1 -1
- package/docs/02-sync/01-overview.md +2 -5
- package/docs/04-reference/03-http.md +3 -3
- package/package.json +1 -1
- package/dist/digest-DAxy9Ula.mjs +0 -4
- package/dist/exports-BJ3wmEMY.d.mts +0 -4
- package/dist/inspect-5mkjJYMS.mjs +0 -2
- package/dist/page-R0RoE_gM.mjs +0 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { _ as fileSize, m as DIRECT_UPLOAD_BYTES_MAX, u as BoardError } from "./errors-rYDxZEuN.mjs";
|
|
2
2
|
import { f as MESSAGE_TEXT_MAX, r as AttachmentId } from "./schemas-AZkxk06N.mjs";
|
|
3
|
-
import { c as withMentions, g as VERSION } from "./targets-
|
|
3
|
+
import { c as withMentions, g as VERSION } from "./targets-C1mT3M1N.mjs";
|
|
4
4
|
import { n as displayEmoji, r as normalizeEmoji } from "./emoji-CTLpvH-A.mjs";
|
|
5
5
|
import { r as PERMISSIONS, u as parseCan } from "./access-CVkjSfxj.mjs";
|
|
6
|
-
import { i as isApiMessageId, n as isBoardName } from "./exports-
|
|
6
|
+
import { i as isApiMessageId, n as isBoardName } from "./exports-M5o4PTfO.mjs";
|
|
7
7
|
import { i as groups, n as filters$1, o as options, r as globalOptions, s as usage$1, t as commands } from "./commands-BLS7erNu.mjs";
|
|
8
|
-
import { a as vercel, c as connect, i as handTeam, l as handFetch, n as credentialSource, o as http, p as vercelProjectFile, r as credentialed, s as boardUrl, t as board, u as handLogin } from "./server-
|
|
9
|
-
import { t as conformance } from "./conformance-
|
|
8
|
+
import { a as vercel, c as connect, i as handTeam, l as handFetch, n as credentialSource, o as http, p as vercelProjectFile, r as credentialed, s as boardUrl, t as board, u as handLogin } from "./server-DkYkyarg.mjs";
|
|
9
|
+
import { t as conformance } from "./conformance-D59Py2m2.mjs";
|
|
10
10
|
import { t as displayText } from "./bots-CGkO76qH.mjs";
|
|
11
11
|
import { spawn } from "node:child_process";
|
|
12
12
|
import { readFile, stat, writeFile } from "node:fs/promises";
|
|
@@ -2410,7 +2410,7 @@ async function run(command, args) {
|
|
|
2410
2410
|
else out(formatEvent(event));
|
|
2411
2411
|
return 0;
|
|
2412
2412
|
}
|
|
2413
|
-
case "inspect": return (await import("./inspect-
|
|
2413
|
+
case "inspect": return (await import("./inspect-lnv1sLXM.mjs")).inspect(context());
|
|
2414
2414
|
default: {
|
|
2415
2415
|
const own = app.commands[command];
|
|
2416
2416
|
if (own) return own.run(args, context());
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./digest-
|
|
1
|
+
import "./digest-krhjNAt4.mjs";
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
import { readFile } from "node:fs/promises";
|
|
4
4
|
//#region src/inspect/page.ts
|
|
@@ -22,7 +22,7 @@ function files() {
|
|
|
22
22
|
async function page() {
|
|
23
23
|
for (const file of files()) {
|
|
24
24
|
const script = await readFile(file, "utf8").catch(() => null);
|
|
25
|
-
if (script !== null && createHash("sha256").update(script).digest("hex") === "
|
|
25
|
+
if (script !== null && createHash("sha256").update(script).digest("hex") === "831fda9c440268389bdc650983308eeab1265b2f09035633f6f9d7a229636cc5") return script;
|
|
26
26
|
}
|
|
27
27
|
return null;
|
|
28
28
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { u as BoardError } from "./errors-rYDxZEuN.mjs";
|
|
2
|
-
import { d as localTokenFile, t as board } from "./server-
|
|
2
|
+
import { d as localTokenFile, t as board } from "./server-DkYkyarg.mjs";
|
|
3
3
|
import { t as oidcTokens } from "./tokens-DA9ipsZ-.mjs";
|
|
4
|
-
import { t as local } from "./local-
|
|
4
|
+
import { t as local } from "./local-DvkOWf4U.mjs";
|
|
5
5
|
import { mkdir, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
6
6
|
import { userInfo } from "node:os";
|
|
7
7
|
import { dirname, join, resolve } from "node:path";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { d as createBoardClient,
|
|
1
|
+
import { d as createBoardClient, t as HttpError, u as BoardError } from "./errors-rYDxZEuN.mjs";
|
|
2
2
|
import "./schemas-AZkxk06N.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { l as keyId, o as DERIVED_ID
|
|
5
|
-
import { a as
|
|
3
|
+
import { X as routes, l as METHODS, o as compileWatcher } from "./targets-C1mT3M1N.mjs";
|
|
4
|
+
import { l as keyId, o as DERIVED_ID } from "./middleware-CPqAuRtp.mjs";
|
|
5
|
+
import { a as tailWatchers, o as deployedOnVercel, r as createVercel, t as createBoard } from "./exports-M5o4PTfO.mjs";
|
|
6
6
|
import { execFile } from "node:child_process";
|
|
7
7
|
import { createHash } from "node:crypto";
|
|
8
8
|
import { mkdir, readFile, readdir, stat, unlink, writeFile } from "node:fs/promises";
|
|
@@ -749,12 +749,8 @@ function createHttp(url, options, environment) {
|
|
|
749
749
|
const remote = (url ?? environment.url()).replace(/\/+$/, "");
|
|
750
750
|
const doFetch = options.fetch ?? environment?.fetch(remote) ?? ((input, init) => globalThis.fetch(input, init));
|
|
751
751
|
let binding = null;
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
let sync = [];
|
|
755
|
-
let hash = null;
|
|
756
|
-
/** What every wake-up carries, so the board it uses can tell it's stale. */
|
|
757
|
-
const watchersHash = () => hash ??= sha256(canonicalWatchers(specs, sync)).then((hex) => hex.slice(0, 32));
|
|
752
|
+
/** This board's watchers, compiled: they run here, as tails of the board it uses. */
|
|
753
|
+
const tails = {};
|
|
758
754
|
const bound = () => {
|
|
759
755
|
if (!binding) throw new Error("http: this backend isn't serving a board yet: pass it to board({ backend })");
|
|
760
756
|
return binding;
|
|
@@ -867,10 +863,9 @@ function createHttp(url, options, environment) {
|
|
|
867
863
|
}
|
|
868
864
|
/** A protocol method, called on the board it uses, as `caller`. */
|
|
869
865
|
async function remoteCall(method, caller, input, signal) {
|
|
870
|
-
|
|
871
|
-
if ("identity" in caller) throw new HttpError(404, "not_found", `this board uses ${remote}, and answers
|
|
866
|
+
start();
|
|
867
|
+
if ("identity" in caller) throw new HttpError(404, "not_found", `this board uses ${remote}, and answers nothing itself`);
|
|
872
868
|
const client = clientOf(caller);
|
|
873
|
-
if ("self" in caller && caller.origin.via?.kind === "engine") await registering;
|
|
874
869
|
if ((method === "post" || method === "posted") && "self" in caller && typeof input.id === "string" && DERIVED_ID.test(input.id)) input = {
|
|
875
870
|
...input,
|
|
876
871
|
id: await ownKey(input.id).catch(rethrow)
|
|
@@ -882,104 +877,54 @@ function createHttp(url, options, environment) {
|
|
|
882
877
|
...Object.fromEntries(METHODS.map((method) => [method, (caller, input, signal) => remoteCall(method, caller, input, signal)])),
|
|
883
878
|
async discovery() {
|
|
884
879
|
return discovery();
|
|
885
|
-
},
|
|
886
|
-
async readSource(caller, input, signal) {
|
|
887
|
-
if ("self" in caller && bound().sync.some((entry) => entry.key === input.key)) return bound().readSource(input.key, input.target, input.limit ?? 50, input.after ?? null);
|
|
888
|
-
return remoteCall("readSource", caller, input, signal);
|
|
889
|
-
},
|
|
890
|
-
async joinSource(caller, input, signal) {
|
|
891
|
-
if ("self" in caller && bound().sync.some((entry) => entry.key === input.key)) return bound().joinSource(input.key, input.target);
|
|
892
|
-
return remoteCall("joinSource", caller, input, signal);
|
|
893
|
-
},
|
|
894
|
-
async synced(caller, input, signal) {
|
|
895
|
-
const { targets } = await remoteCall("synced", caller, input, signal);
|
|
896
|
-
return { targets: await Promise.all(targets.map(async (row) => ({
|
|
897
|
-
...row,
|
|
898
|
-
url: row.url ?? (row.thread !== null && row.message !== null ? await bound().linkOf(row.key, row.thread, row.message) : null)
|
|
899
|
-
}))) };
|
|
900
|
-
},
|
|
901
|
-
async linked(caller, input, signal) {
|
|
902
|
-
const missing = () => new HttpError(404, "message_not_found", "no message on this board for that link");
|
|
903
|
-
const first = async () => {
|
|
904
|
-
for (const { platform, thread, message } of bound().locate(input.url)) for (const entry of bound().sync.filter((candidate) => candidate.platform === platform)) {
|
|
905
|
-
const at = await own.syncFind({
|
|
906
|
-
thread: `${entry.key}:${thread}`,
|
|
907
|
-
...message !== null ? { message } : {}
|
|
908
|
-
}, { signal }).catch(rethrow);
|
|
909
|
-
const found = message !== null ? at.message : at.thread === null ? null : (await own.syncThread(at.thread).catch(rethrow)).root;
|
|
910
|
-
if (found !== null) return found;
|
|
911
|
-
}
|
|
912
|
-
return null;
|
|
913
|
-
};
|
|
914
|
-
const id = await first();
|
|
915
|
-
if (id === null) return remoteCall("linked", caller, input, signal);
|
|
916
|
-
try {
|
|
917
|
-
return await methods.message(caller, { id }, signal);
|
|
918
|
-
} catch (error) {
|
|
919
|
-
if (error instanceof HttpError && error.status === 404) throw missing();
|
|
920
|
-
throw error;
|
|
921
|
-
}
|
|
922
|
-
},
|
|
923
|
-
async typing(caller, input, signal) {
|
|
924
|
-
const { targets } = await remoteCall("typing", caller, input, signal);
|
|
925
|
-
if (!("self" in caller) || bound().sync.length === 0) return { targets };
|
|
926
|
-
const { message, replies } = await methods.message(caller, { id: input.id }, signal);
|
|
927
|
-
const here = await bound().typing([message, ...replies], input.status).catch((error) => {
|
|
928
|
-
console.warn("[board] skipped typing where this board syncs:", describe(error));
|
|
929
|
-
return [];
|
|
930
|
-
});
|
|
931
|
-
return { targets: [...targets, ...here] };
|
|
932
880
|
}
|
|
933
881
|
};
|
|
882
|
+
let running = null;
|
|
883
|
+
/** Whether they won't run, or won't again: on Vercel, or once closed. */
|
|
884
|
+
let stopped = false;
|
|
934
885
|
/**
|
|
935
|
-
*
|
|
936
|
-
*
|
|
886
|
+
* On first use, this board's watchers start following the board it uses, in this process, as
|
|
887
|
+
* `vb tail` does. Nothing wakes a board on http(). A deployment's function doesn't outlive its
|
|
888
|
+
* request, so on Vercel none run.
|
|
937
889
|
*/
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
890
|
+
function start() {
|
|
891
|
+
if (running || stopped || Object.keys(tails).length === 0) return;
|
|
892
|
+
if (deployedOnVercel()) {
|
|
893
|
+
stopped = true;
|
|
894
|
+
console.error(`[board] watchers on a board that uses ${remote} run only in a process that stays up: on Vercel, none run`);
|
|
895
|
+
return;
|
|
896
|
+
}
|
|
897
|
+
running = tailWatchers({
|
|
898
|
+
watchers: tails,
|
|
899
|
+
events: async (query, signal) => (await call(own, "events", query, signal)).json(),
|
|
900
|
+
actorOf: async (id) => (await asProfile(id).me().catch(rethrow)).actor,
|
|
901
|
+
run: (id, event, meta) => bound().run(id, event, meta)
|
|
902
|
+
});
|
|
903
|
+
running.start();
|
|
941
904
|
}
|
|
942
|
-
const runner = registrant({
|
|
943
|
-
remote,
|
|
944
|
-
registry: {
|
|
945
|
-
register: (where) => own.register({
|
|
946
|
-
...where,
|
|
947
|
-
watch: specs,
|
|
948
|
-
...sync.length > 0 ? { sync } : {}
|
|
949
|
-
}),
|
|
950
|
-
matches: (query) => own.matches(query),
|
|
951
|
-
ack: (id, body) => own.ack(id, body)
|
|
952
|
-
},
|
|
953
|
-
wakeAt,
|
|
954
|
-
binding: bound,
|
|
955
|
-
hash: watchersHash,
|
|
956
|
-
hasWork: () => Object.keys(specs).length > 0 || sync.length > 0,
|
|
957
|
-
rethrow,
|
|
958
|
-
registerFor: async (caller, request) => json(await methods.register(caller, RegisterBody.parse(await request.json()), request.signal))
|
|
959
|
-
});
|
|
960
|
-
const start = runner.start;
|
|
961
905
|
return {
|
|
962
906
|
...methods,
|
|
963
|
-
routes:
|
|
907
|
+
routes: [],
|
|
964
908
|
keeps: false,
|
|
965
909
|
bind(next) {
|
|
966
910
|
if (binding) throw new Error("http: this backend already serves a board: create one http() per board()");
|
|
967
911
|
for (const [id, spec] of Object.entries(next.subscriptions)) {
|
|
968
|
-
if (spec.kind === "sync") {
|
|
969
|
-
if (id === "@sync") sync = next.sync.map((entry) => ({ ...entry }));
|
|
970
|
-
continue;
|
|
971
|
-
}
|
|
912
|
+
if (spec.kind === "sync") throw new Error(`http: sync doesn't run on a board that uses ${remote}: sync from that board's own config`);
|
|
972
913
|
if (!PROFILE.test(id)) throw new Error(`watch ${id}: ${PROFILE_RULE}`);
|
|
973
|
-
compileWatcher(id, spec);
|
|
974
|
-
|
|
914
|
+
const { filters, all } = compileWatcher(id, spec);
|
|
915
|
+
tails[id] = {
|
|
916
|
+
filters,
|
|
917
|
+
all
|
|
918
|
+
};
|
|
975
919
|
}
|
|
976
|
-
hash = null;
|
|
977
920
|
binding = next;
|
|
978
921
|
},
|
|
979
|
-
/**
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
922
|
+
/** Stops its watchers' tails. */
|
|
923
|
+
close: () => {
|
|
924
|
+
stopped = true;
|
|
925
|
+
running?.close();
|
|
926
|
+
running = null;
|
|
927
|
+
}
|
|
983
928
|
};
|
|
984
929
|
}
|
|
985
930
|
//#endregion
|
|
@@ -762,7 +762,7 @@ const routes = {
|
|
|
762
762
|
};
|
|
763
763
|
//#endregion
|
|
764
764
|
//#region src/version.ts
|
|
765
|
-
const VERSION = "0.
|
|
765
|
+
const VERSION = "0.39.0";
|
|
766
766
|
//#endregion
|
|
767
767
|
//#region src/server/backend.ts
|
|
768
768
|
/** The subscription sync's outbound runs on, in `BoardBinding.subscriptions`. No watcher's ID starts with `@`. */
|
|
@@ -315,7 +315,7 @@ What a backend has:
|
|
|
315
315
|
| --- | --- |
|
|
316
316
|
| `discovery`, `me`, `messages`, `post`, … | One method per protocol route, `(caller, input, signal)`, named for it: the [HTTP reference](../04-reference/03-http.md#routes) lists them, and the `Protocol` type from `@vercel/board` says what each takes and answers |
|
|
317
317
|
| `routes` | Routes of its own beside the protocol: `{ method, path, handle(request, { caller, param }) }`. One at a protocol route's path takes its place. `board()` verifies nothing for them: `caller` is null for a request, or the handle's own when its call reaches one |
|
|
318
|
-
| `keeps` | Whether the board lives here. `true` serves its callers: the board's people, its own deployments, and whoever grants and board tokens let in. `false
|
|
318
|
+
| `keeps` | Whether the board lives here. `true` serves its callers: the board's people, its own deployments, and whoever grants and board tokens let in. `false` serves no requests: on Vercel's board, only wake-ups and webhooks, and at `BOARD_URL`, nothing |
|
|
319
319
|
| `trust` | Its [grants](./09-access.md#grants) and [board tokens](./09-access.md#tokens), for a backend that keeps them: `grants()`, `token(hash)`, and `live(id)`. `board()` checks each request against them as they are then. Without it, they let no one in |
|
|
320
320
|
| `bind(binding)` | Called once, when `board()` is created, before any request. It does no I/O. `binding.name` and `binding.team` are `board({ name, team })`'s, or null |
|
|
321
321
|
|
|
@@ -462,7 +462,7 @@ curl https://www.example.com/api/board
|
|
|
462
462
|
`board()` knows its project from `VERCEL_PROJECT_ID` on Vercel, or
|
|
463
463
|
`.vercel/project.json` locally. Run `vercel link` in the app once, so a local
|
|
464
464
|
board can verify the development tokens people send it. A route with no
|
|
465
|
-
backend answers no discovery: it serves only wake-ups and webhooks.
|
|
465
|
+
backend answers no discovery: it serves only wake-ups and webhooks, and with `BOARD_URL` set, nothing.
|
|
466
466
|
|
|
467
467
|
The CLI doesn't take discovery's word for it. It mints a person's token only
|
|
468
468
|
for the project Vercel says the board's host is a deployment of, so a board
|
|
@@ -14,7 +14,7 @@ a host can recognize its own credentials too: see
|
|
|
14
14
|
|
|
15
15
|
Only a few routes take no token: discovery, the built-in avatars, the OpenAPI
|
|
16
16
|
document, and `/webhooks/:key`, which the platform's adapter authenticates instead. A
|
|
17
|
-
route whose watchers
|
|
17
|
+
route whose watchers Vercel's board runs also answers
|
|
18
18
|
`POST /wake` without one: a wake-up only says to pull.
|
|
19
19
|
|
|
20
20
|
## Where tokens come from
|
|
@@ -165,8 +165,10 @@ Where the match happens depends on the board:
|
|
|
165
165
|
boards can't match mentions yet. Sync doesn't run. A tail needs a process
|
|
166
166
|
that stays up, so on a Vercel deployment, watchers need its own OIDC token:
|
|
167
167
|
with `BOARD_TOKEN` or `VERCEL_TOKEN`, none run there.
|
|
168
|
-
- **With `BOARD_URL` set,**
|
|
169
|
-
|
|
168
|
+
- **With `BOARD_URL` set,** each watcher runs in this process as a tail of the
|
|
169
|
+
board at that URL, from the board's first use, and sees what this
|
|
170
|
+
deployment may read there. Nothing wakes it, so on a Vercel deployment none
|
|
171
|
+
run.
|
|
170
172
|
- **On [`local()`](./10-local.md),** everything happens in this process. Each
|
|
171
173
|
event is matched against every watcher on its thread's lane, and `run`
|
|
172
174
|
happens on that lane too.
|
|
@@ -233,12 +235,7 @@ matches the tails, and the route at the top of this page runs `run`:
|
|
|
233
235
|
numbers, and hyphens. Its posts get IDs derived from the match, so a
|
|
234
236
|
retried `run` doesn't post twice.
|
|
235
237
|
|
|
236
|
-
With `BOARD_URL` set,
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
left public (Standard Protection), or a Deployment Protection Exception for
|
|
241
|
-
the domain it registers. A wake-up reveals nothing and is trusted for
|
|
242
|
-
nothing: it only makes this board pull with its own credentials.
|
|
243
|
-
- **A board without an `https` URL pulls on its own** from its first use,
|
|
244
|
-
each pull held open until something matches: a dev server, say.
|
|
238
|
+
With `BOARD_URL` set, nothing registers and nothing wakes this board: each
|
|
239
|
+
watcher runs here as a tail of the board at that URL, as above, writing as
|
|
240
|
+
this deployment with the watcher's ID as its profile. A tail needs a process
|
|
241
|
+
that stays up, so on a Vercel deployment none run.
|
|
@@ -11,7 +11,7 @@ Vercel's board says who may use it in Vercel's API: the team's people, and the
|
|
|
11
11
|
projects it grants the board to (see
|
|
12
12
|
[A board by its name](./01-mounting.md#a-board-by-its-name)). A route on
|
|
13
13
|
Vercel's board, or on the board at `BOARD_URL`, serves no callers of its own:
|
|
14
|
-
it answers only wake-ups and webhooks.
|
|
14
|
+
on Vercel's it answers only wake-ups and webhooks, and at `BOARD_URL` nothing.
|
|
15
15
|
|
|
16
16
|
Every caller is an OIDC principal. `board()` verifies it with its
|
|
17
17
|
`authenticate` (see [Identity](./03-identity.md)), works out what it may do,
|
|
@@ -29,11 +29,8 @@ it works the same on Vercel's board, on `local()`, and on a
|
|
|
29
29
|
|
|
30
30
|
### With `BOARD_URL` set
|
|
31
31
|
|
|
32
|
-
`board()` with `BOARD_URL` set
|
|
33
|
-
|
|
34
|
-
there as this deployment. That board must let this deployment `sync` in those
|
|
35
|
-
channels, and each sync entry's key must be one its own sync doesn't have:
|
|
36
|
-
registering a key it has answers 409 `sync_key_taken`.
|
|
32
|
+
Sync runs where the board's log is. `board()` with `BOARD_URL` set and `sync`
|
|
33
|
+
throws: configure sync on the board at that URL, or on Vercel's board.
|
|
37
34
|
|
|
38
35
|
## Configure it
|
|
39
36
|
|
|
@@ -49,7 +49,7 @@ These routes take no token:
|
|
|
49
49
|
| `GET /avatars/:name` | built-in agent avatars |
|
|
50
50
|
| `GET /openapi.json` | the API's schema |
|
|
51
51
|
| `POST /webhooks/:key` | platforms can't send a board token; the sync adapter verifies the request |
|
|
52
|
-
| `POST /wake` | on a deployment whose watchers
|
|
52
|
+
| `POST /wake` | on a deployment whose watchers Vercel's board matches: something matched, and it pulls what with its own credentials |
|
|
53
53
|
|
|
54
54
|
### Request headers
|
|
55
55
|
|
|
@@ -128,11 +128,11 @@ a refused write it can read answers 403. `GET /me` returns the caller's
|
|
|
128
128
|
| POST | `/tokens` | `{ name, can?, profile?, avatar?, session?, expires? }`: mint a token acting as you. Answers `{ token, secret }`, the only time the secret shows |
|
|
129
129
|
| POST | `/tokens/:id/revoke` | Revoke one of yours, or anyone's with `manage` in every channel: it and every token minted with it stop. Answers `{ revoked }`, false for one that's gone, never was, or isn't yours, alike |
|
|
130
130
|
| GET | `/events` | The event feed. See [Event feed](#event-feed) |
|
|
131
|
-
| POST | `/watchers` | `{
|
|
131
|
+
| POST | `/watchers` | `{ watch, sync? }` or `{ path, branch?, watch, sync? }`: registers the caller's watchers (at most 32, each `{ tail, when? }`), its sync entries, and where to wake it, replacing its last registration. Without a `path` the caller pulls its matches. A `url` answers 501 `no_wake_by_url` on a `local()` board, which wakes nothing, and 400 on Vercel's board. On a board whose discovery says `wake_by_path`, a `path` on the caller's own Vercel project, which the board finds from the caller's token and wakes through its Deployment Protection: production's best domain, or with `branch`, a preview's latest ready deployment of that branch (403 `not_a_project` for a caller that isn't a Vercel project, 501 `no_wake_by_path` on a board that can't). Needs `read` somewhere, and `sync` somewhere for sync entries. Answers the registration, `{ owner, url: null, watch, sync, hash }`, or `{ owner, url: null, path, branch?, watch, sync, hash }`. On a deployment's board on Vercel's, it takes no token and registers that board's own watchers with Vercel's API |
|
|
132
132
|
| GET | `/watchers` | `{ watchers }`: the caller's registration, or every one for `manage` in every channel |
|
|
133
133
|
| GET | `/watchers/matches` | `{ matches }`: the caller's matches it can run now, one thread at a time and in order, each `{ id, watcher, thread, lease, attempt, event }` and leased to it for 5 minutes. Query: `limit` (10 by default, at most 50), `wait` (seconds to hold for one, at most 25). 404 `no_registration` without a registration |
|
|
134
134
|
| POST | `/watchers/matches/:id/ack` | `{ lease, error?, skip? }`: done, an error to try again after a wait (after 5 tries it's `watch.failed`), or `skip` to drop it. 404 `no_match`, 409 `stale_lease` for a lease that ran out |
|
|
135
|
-
| POST | `/wake` | On a deployment whose watchers
|
|
135
|
+
| POST | `/wake` | On a deployment whose watchers Vercel's board matches (no token): it has matches to pull. Answers `{ ran }` once they've run, or 202 after 2 seconds while they keep running |
|
|
136
136
|
| GET | `/inbox/:key` | `{ events }`: raw platform events for a sync entry, newest first. Query: `channel`, `limit` (50 by default, at most 500). With `sync` in every channel, the board's own and every registered sync's; a sync elsewhere sees what it pushed |
|
|
137
137
|
| GET | `/sources/:key/read` | Read a platform channel, thread, or permalink without syncing it. Query: `target`, `limit` (50 by default, at most 200). The board reads it with entry `key`'s app, through the sync it runs, and needs `manage` in every channel; a board that runs no entry `key` answers 404 `not_synced_here` |
|
|
138
138
|
| POST | `/sources/:key/join` | Add entry `key`'s app to a public channel so `/sources/:key/read` can read it. Body: `{ target }`, a channel (`#name`, an ID) or a link into it. Answers `{ channel, name, joined }`, `joined: false` when the app was already in. Only where the entry opted in (`slack({ join: true })`), 403 `join_disabled` otherwise; private and Slack Connect channels are never joined. Needs `manage` in every channel; a board that runs no entry `key` answers 404 `not_synced_here` |
|
package/package.json
CHANGED
package/dist/digest-DAxy9Ula.mjs
DELETED
package/dist/page-R0RoE_gM.mjs
DELETED