@vercel/board 0.53.0 → 0.54.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/dist/{access-Pcar1gwx.mjs → access-HzqFpgL_.mjs} +1 -1
- package/dist/access.d.mts +3 -3
- package/dist/access.mjs +5 -5
- package/dist/{actors-XKUrjOfO.mjs → actors-D-u6bitG.mjs} +2 -2
- package/dist/{auth-C2CxMl2p.mjs → auth-D9ycDQK0.mjs} +34 -12
- package/dist/{auth-BoYunD5t.d.mts → auth-ULldUvir.d.mts} +8 -2
- package/dist/{backend-DJobr4nr.d.mts → backend-BHN6GTjB.d.mts} +8 -7
- package/dist/backend-local.d.mts +1 -1
- package/dist/backend-local.mjs +1 -1
- package/dist/{chat-provider-BSHlV2lw.d.mts → chat-provider-F7UqWVZK.d.mts} +2 -2
- package/dist/cli-commands.d.mts +1 -1
- package/dist/cli-commands.mjs +1 -1
- package/dist/cli-embedded.d.mts +2 -2
- package/dist/cli-embedded.mjs +2 -2
- package/dist/cli.mjs +6 -6
- package/dist/{client-oYThy3CR.d.mts → client-CFHunEFn.d.mts} +8 -2
- package/dist/{commands-B_gbi2sU.mjs → commands-D8HctFGJ.mjs} +15 -10
- package/dist/{commands-B6pgzwTI.d.mts → commands-DLPIX7Jw.d.mts} +3 -1
- package/dist/{conformance-Cz1Elmgj.mjs → conformance-BNiLcKra.mjs} +34 -4
- package/dist/conformance.d.mts +3 -4
- package/dist/conformance.mjs +1 -1
- package/dist/{engine-506f7GEM.mjs → engine-C8wCzkw-.mjs} +2 -2
- package/dist/{routes-GF5ukHYX.mjs → errors-DDfXnZ2b.mjs} +875 -4
- package/dist/{exports-CF_nUsT5.d.mts → exports-BBmjHyCB.d.mts} +4 -4
- package/dist/{exports-CBukc8T3.mjs → exports-D6Q99t_O.mjs} +144 -88
- package/dist/{index-CM2u0wGd.d.mts → index-Ce3SDZ3Y.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 +88 -88
- package/dist/inspect/engine.js +3 -3
- package/dist/{inspect-PQsEgXRQ.mjs → inspect-Cb1Sj8QV.mjs} +2 -2
- package/dist/inspect-DeY883DA.mjs +2 -0
- package/dist/inspect.d.mts +1 -1
- package/dist/inspect.mjs +1 -1
- package/dist/{local-CwcmqEoa.mjs → local-BtzF9fRs.mjs} +10 -10
- package/dist/{main-gNAS2WbP.mjs → main-Dicvkp6D.mjs} +360 -100
- package/dist/{middleware-DXiwepsR.mjs → middleware-BY4qqIh3.mjs} +1 -1
- package/dist/{provider-WjdBsRLR.d.mts → provider-DgGp4Zej.d.mts} +2 -2
- package/dist/{routes-BpvyXQwv.d.mts → routes-DNmQSOvQ.d.mts} +16 -1
- package/dist/{serve-Ci5KT11x.mjs → serve-BMOtQEiQ.mjs} +6 -6
- package/dist/{server-XsbC50nY.mjs → server--J1DfQjI.mjs} +68 -11
- package/dist/{serving-C6Ao7i-7.mjs → serving-C1mhZQqH.mjs} +1 -1
- package/dist/{shell-BiCBL1w_.mjs → shell-DsDyOFd1.mjs} +1 -1
- 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.d.mts +2 -2
- package/dist/{task-batch-nqYGszDJ.mjs → task-batch-BviIruES.mjs} +4 -5
- package/dist/{tokens-tulRtEWx.mjs → tokens-B3gXkQCs.mjs} +2 -2
- package/dist/{version-CBjh_ogp.mjs → version-1isUFDyU.mjs} +1 -1
- package/docs/01-board/01-mounting.md +8 -6
- package/docs/01-board/03-identity.md +1 -1
- package/docs/01-board/05-reading.md +34 -7
- package/docs/01-board/09-access.md +11 -2
- package/docs/01-board/11-tasks.md +5 -3
- package/docs/01-quickstart.md +19 -5
- package/docs/03-guides/03-ci.md +71 -43
- package/docs/03-guides/04-triage.md +4 -4
- package/docs/04-reference/01-cli.md +30 -22
- package/docs/04-reference/02-board.md +8 -4
- package/docs/04-reference/03-http.md +14 -5
- package/docs/04-reference/05-conformance.md +1 -1
- package/docs/index.md +7 -5
- package/package.json +2 -2
- package/dist/errors-Cv0TGBt5.mjs +0 -857
- package/dist/inspect-SEaGzhvh.mjs +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./auth-
|
|
3
|
-
import "./backend-
|
|
4
|
-
import { g as TaskInBatch, n as BoardError } from "./client-
|
|
1
|
+
import { ut as MessageView } from "./routes-DNmQSOvQ.mjs";
|
|
2
|
+
import "./auth-ULldUvir.mjs";
|
|
3
|
+
import "./backend-BHN6GTjB.mjs";
|
|
4
|
+
import { g as TaskInBatch, n as BoardError } from "./client-CFHunEFn.mjs";
|
|
5
5
|
//#region src/client/chunks.d.ts
|
|
6
6
|
/** What `createTasksInChunks` makes tasks with: a handle, or anything with its `tasks.createMany`. */
|
|
7
7
|
type TaskBatches = {
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { d as mediaType, i as ATTACHMENT_BYTES_MAX, n as formatProfileHeader, o as IMPORT_BYTES_MAX } from "./profile-header-O8wC8yk8.mjs";
|
|
2
2
|
import { T as TASK_LABEL, b as RemoteWatcherId, y as RESERVED_LABEL_PREFIX } from "./schemas-CUSTEFIy.mjs";
|
|
3
|
-
import { $ as
|
|
4
|
-
import {
|
|
5
|
-
import { _ as sha256, a as waitUntil, c as platformProfile, d as userIdOf, m as derivedId, o as actorParts, r as runMiddleware, s as importedHandle, t as DroppedError, u as underPrincipal } from "./middleware-DXiwepsR.mjs";
|
|
3
|
+
import { $ as SchedulesQuery, A as CreatedTasksQuery, B as InboxPushBody, C as ClaimReadyTaskBody, D as CreateGrantsBody, E as CreateChannelBody, F as FailTaskBody, G as PostBody, H as LabelBody, J as RegisterBody, K as ReactBody, L as GrantBody, M as EditBody, N as EventsQuery, O as CreateTaskBody, P as ExplainQuery, Q as ScheduleBody, R as InboxAckBody, S as ChannelsQuery, T as CompleteTaskBody, U as LinkedQuery, V as InboxQuery, W as MatchesQuery, X as RenewTaskBody, Y as ReleaseTaskBody, Z as RevokeGrantBody, _ as ActorsQuery, a as duplicateId, at as SyncFindQuery, b as CancelTaskBody, c as notFound, ct as TaskNeedsBody, d as unauthorized, dt as ThreadsQuery, et as SchemaBody, f as BoardError, ft as TypingBody, g as AckBody, h as eventsState, ht as routes, i as batchTooLarge, it as SyncCopiesQuery, j as DeleteBody, k as CreateTasksBody, lt as TasksQuery, m as duration, mt as UploadStartBody, n as RejectedError, nt as SourceReadQuery, o as forbidden, ot as SyncImportBody, p as createBoardClient, pt as UpdateGrantBody, q as Ref, r as badRequest, rt as SyncBody, s as json, st as SyncReceiptBody, t as HttpError, tt as SourceJoinBody, u as toErrorResponse, ut as ThreadQuery, v as AssignTaskBody, w as ClaimTaskBody, x as ChannelMessagesQuery, y as BlockTaskBody, z as InboxNextQuery } from "./errors-DDfXnZ2b.mjs";
|
|
4
|
+
import { _ as sha256, a as waitUntil, c as platformProfile, d as userIdOf, m as derivedId, o as actorParts, r as runMiddleware, s as importedHandle, t as DroppedError, u as underPrincipal } from "./middleware-BY4qqIh3.mjs";
|
|
6
5
|
import { n as blocksIn, r as findBlocks } from "./blocks-CVoBC7ur.mjs";
|
|
7
6
|
import { a as replaceMentions, i as mentionTerms, o as settleMentions, r as mentionTerm, t as extractMentions } from "./mentions-CnWt9Z5b.mjs";
|
|
8
|
-
import { t as VERSION } from "./version-
|
|
9
|
-
import { a as canText, c as compileAccess, d as parsePattern, n as InvalidCan, r as PERMISSIONS, t as FULL_ACCESS, u as parseCan } from "./access-
|
|
10
|
-
import { _ as SYNC, a as runMatch, d as openapi, f as queryObject, g as uploadName, h as carried, i as canonicalWatchers, l as METHODS, m as readJson, n as SYNC_ACTOR, o as compileWatcher, p as readCapped, r as syncTarget, t as batchPlan, u as createRouter } from "./task-batch-
|
|
11
|
-
import { C as verifiedIssuers, D as explainGrants, d as createAuthority, f as fromTokens, m as hostPrincipal, o as VERCEL_ISSUER, p as grantIssuers, t as DEFAULT_CAN$1, v as namesByLogin, w as verifiesTokens } from "./auth-
|
|
12
|
-
import { a as resolveActor, o as viaOf, r as claimsOf, t as KNOWN_AGENTS } from "./actors-
|
|
7
|
+
import { t as VERSION } from "./version-1isUFDyU.mjs";
|
|
8
|
+
import { a as canText, c as compileAccess, d as parsePattern, n as InvalidCan, r as PERMISSIONS, t as FULL_ACCESS, u as parseCan } from "./access-HzqFpgL_.mjs";
|
|
9
|
+
import { _ as SYNC, a as runMatch, d as openapi, f as queryObject, g as uploadName, h as carried, i as canonicalWatchers, l as METHODS, m as readJson, n as SYNC_ACTOR, o as compileWatcher, p as readCapped, r as syncTarget, t as batchPlan, u as createRouter } from "./task-batch-BviIruES.mjs";
|
|
10
|
+
import { C as verifiedIssuers, D as explainGrants, d as createAuthority, f as fromTokens, m as hostPrincipal, o as VERCEL_ISSUER, p as grantIssuers, t as DEFAULT_CAN$1, v as namesByLogin, w as verifiesTokens } from "./auth-D9ycDQK0.mjs";
|
|
11
|
+
import { a as resolveActor, o as viaOf, r as claimsOf, t as KNOWN_AGENTS } from "./actors-D-u6bitG.mjs";
|
|
13
12
|
import { t as checkValue } from "./data-values-CoTP0SQG.mjs";
|
|
14
13
|
//#region src/server/registrant.ts
|
|
15
14
|
/** Registering again this soon after the same registration only repeats it. */
|
|
@@ -438,6 +437,10 @@ function boardPolicy(reach) {
|
|
|
438
437
|
//#endregion
|
|
439
438
|
//#region src/server/backend-vercel.ts
|
|
440
439
|
const PROFILE = /^[A-Za-z][A-Za-z0-9-]{0,31}$/;
|
|
440
|
+
/** A GitHub repository as `owner/name`. */
|
|
441
|
+
const REPOSITORY = /^[A-Za-z0-9-]{1,39}\/[A-Za-z0-9._-]{1,100}$/;
|
|
442
|
+
/** A word of a hint's command as a shell reads it back: a board's name can hold anything but a `/`. */
|
|
443
|
+
const shellWord = (word) => /^[\w@%+=:,.-]+$/.test(word) ? word : `'${word.replace(/'/g, `'\\''`)}'`;
|
|
441
444
|
/**
|
|
442
445
|
* What `vb` on this board calls in Vercel's API for what a sandboxed agent does, by method and path
|
|
443
446
|
* under `/boards/<id>`: reading, posting and replying, editing and deleting its own, reacting and
|
|
@@ -611,6 +614,12 @@ const CLIENT_ID = /^[A-Za-z0-9_.:-]{1,128}$/;
|
|
|
611
614
|
const MESSAGE_ID = /^msg_([0-9a-f-]{36})_([1-9]\d*)$/;
|
|
612
615
|
/** Whether `value` is a message ID Vercel's API hands out (`msg_<thread>_<n>`): the CLI takes one as a message, even where a channel has its name. */
|
|
613
616
|
const isApiMessageId = (value) => MESSAGE_ID.test(value);
|
|
617
|
+
const THREAD_ID = /^thr_([0-9a-f-]{36})$/;
|
|
618
|
+
/** A thread ID Vercel's API hands out (`thr_<thread>`, a message's `thread`) as its root's message ID, or null for one that isn't. */
|
|
619
|
+
const apiThreadRoot = (value) => {
|
|
620
|
+
const found = THREAD_ID.exec(value);
|
|
621
|
+
return found ? `msg_${found[1]}_1` : null;
|
|
622
|
+
};
|
|
614
623
|
/** A cursor this backend made: a time, then the position it names, in base 36. */
|
|
615
624
|
const CURSOR = /^([0-9a-z]+)(?:\.([0-9a-z]+))?$/;
|
|
616
625
|
/** The API's own cursor for one channel, which its message list and feed share, and any process resumes. */
|
|
@@ -729,9 +738,20 @@ function retryWait(attempt, retryAfter) {
|
|
|
729
738
|
return Math.min(asked, RETRY_MS * 2 ** attempt * (1 + Math.random()));
|
|
730
739
|
}
|
|
731
740
|
/**
|
|
741
|
+
* What the API's 429 asks for: its whole window. It limits requests a minute with a bucket that refills all the
|
|
742
|
+
* time (a request a tenth of a second at 600 a minute), and says when it's full again: `Retry-After` is 60 and
|
|
743
|
+
* `x-ratelimit-reset` a minute from now whatever's left. A wait under this is the API's own, and is taken.
|
|
744
|
+
*/
|
|
745
|
+
const WHOLE_WINDOW_S = 59;
|
|
746
|
+
/** The most a put-off request is told to wait, where the API says only its whole window. */
|
|
747
|
+
const THROTTLED_WAIT_MAX_S = 15;
|
|
748
|
+
/**
|
|
732
749
|
* A 429 the API still answered after `retries` tries again in `ms`: how many requests a minute it
|
|
733
|
-
* takes (`x-ratelimit-limit`), from whom, and when
|
|
734
|
-
* (`x-ratelimit-reset`, in Unix seconds)
|
|
750
|
+
* takes (`x-ratelimit-limit`), from whom, and when it's worth sending again. That's what `Retry-After`
|
|
751
|
+
* (or `x-ratelimit-reset`, in Unix seconds) asks when it's under the whole window. Otherwise it's the next
|
|
752
|
+
* wait the retries would have taken, a second doubling each time, up to `THROTTLED_WAIT_MAX_S`: the limit
|
|
753
|
+
* gives a request back every tenth of a second at 600 a minute, so what's kept it off this long is everyone
|
|
754
|
+
* else on the login taking them first, and a try a few seconds later usually gets through.
|
|
735
755
|
*/
|
|
736
756
|
function throttled(response, code, retries, ms) {
|
|
737
757
|
const header = (name) => {
|
|
@@ -740,11 +760,12 @@ function throttled(response, code, retries, ms) {
|
|
|
740
760
|
};
|
|
741
761
|
const reset = header("x-ratelimit-reset");
|
|
742
762
|
const untilReset = reset !== void 0 ? reset - Math.floor(Date.now() / 1e3) : void 0;
|
|
743
|
-
const
|
|
763
|
+
const asked = untilReset !== void 0 && untilReset > 0 && untilReset <= 3600 ? untilReset : header("retry-after");
|
|
744
764
|
const limit = header("x-ratelimit-limit");
|
|
765
|
+
const retryAfter = asked !== void 0 && asked < WHOLE_WINDOW_S ? Math.max(1, asked) : Math.min(THROTTLED_WAIT_MAX_S, RETRY_MS / 1e3 * 2 ** retries);
|
|
745
766
|
const tried = retries > 0 ? `rate-limited ${retries + 1} tries in ${Math.max(1, Math.round(ms / 1e3))}s` : "rate-limited it";
|
|
746
767
|
const takes = limit !== void 0 ? `takes ${limit} requests a minute` : "limits requests";
|
|
747
|
-
return new HttpError(429, code, `Vercel's API ${tried}. It ${takes} per login or token, for all its agents and profiles together
|
|
768
|
+
return new HttpError(429, code, `Vercel's API ${tried}. It ${takes} per login or token, for all its agents and profiles together, and refills as the minute goes: a try a few seconds later usually gets through.`, { retryAfter });
|
|
748
769
|
}
|
|
749
770
|
/** `ms` passing, or `signal` stopping it first. */
|
|
750
771
|
const pause = (ms, signal) => ms <= 0 || signal?.aborted ? Promise.resolve() : new Promise((resolve) => {
|
|
@@ -828,12 +849,18 @@ function locate(id) {
|
|
|
828
849
|
sequence: Number(found[2])
|
|
829
850
|
} : null;
|
|
830
851
|
}
|
|
831
|
-
/**
|
|
832
|
-
|
|
852
|
+
/**
|
|
853
|
+
* The principal `actor` acts through, as board names it: `vercel:user:<id>`, `vercel:app:<id>`,
|
|
854
|
+
* `vercel:project:<id>:<env>`, and a workflow (`github:repo:<id>`, `oidc:<issuer>:<sub>`) as the
|
|
855
|
+
* actor's ID has it, its issuer encoded as the API encodes it.
|
|
856
|
+
*/
|
|
857
|
+
function principalId(actor) {
|
|
858
|
+
const { principal } = actor;
|
|
833
859
|
if (principal.type === "external") return principal.id;
|
|
834
860
|
if (principal.type === "user") return `vercel:user:${principal.userId}`;
|
|
835
861
|
if (principal.type === "app") return `vercel:app:${principal.clientId}`;
|
|
836
|
-
return `vercel:project:${principal.projectId}:${principal.environment}`;
|
|
862
|
+
if (principal.type === "project") return `vercel:project:${principal.projectId}:${principal.environment}`;
|
|
863
|
+
return actorParts(actor.id).principal;
|
|
837
864
|
}
|
|
838
865
|
/** A principal from a board actor ID, `vercel:project:prj_1:preview+slack:user:U1` say, or null for one the API doesn't name. */
|
|
839
866
|
function principalFrom(actor) {
|
|
@@ -854,6 +881,8 @@ function principalFrom(actor) {
|
|
|
854
881
|
};
|
|
855
882
|
return null;
|
|
856
883
|
}
|
|
884
|
+
/** Whether an actor ID names someone the API names: one `principalFrom` reads, or a workflow (`github:repo:<id>`, `oidc:<issuer>:<sub>`). */
|
|
885
|
+
const namedByApi = (actor) => principalFrom(actor) !== null || /^(github:repo|oidc):/.test(actorParts(actor).principal);
|
|
857
886
|
/**
|
|
858
887
|
* Who an actor with a profile acts through, as board shows it: a project by its name (`project`, as the
|
|
859
888
|
* actors list names it), or the one the API's view gives it, or its ID, in its environment; a person by
|
|
@@ -945,11 +974,19 @@ function shownHandle(id, view, names) {
|
|
|
945
974
|
}
|
|
946
975
|
/** Who goes by `handle` in a read of the actors list: as the API names them, or as board shows them. */
|
|
947
976
|
const goingBy = (views, names, handle) => [...views].filter(([id, view]) => view.handle.toLowerCase() === handle || shownHandle(id, view, names).toLowerCase() === handle).map(([id]) => id);
|
|
948
|
-
/**
|
|
949
|
-
|
|
977
|
+
/**
|
|
978
|
+
* A short name for anyone the API doesn't name: a person or an app by the start of their ID, a GitHub
|
|
979
|
+
* Actions run by its repository (`owner/name`), and another issuer's caller by its subject, as the API cuts it.
|
|
980
|
+
*/
|
|
981
|
+
function shortName(principal) {
|
|
982
|
+
if (principal.type === "user") return `user-${principal.userId.slice(0, 6).toLowerCase()}`;
|
|
983
|
+
if (principal.type === "app") return `app-${principal.clientId.slice(0, 6).toLowerCase()}`;
|
|
984
|
+
if (principal.type === "github") return principal.repository;
|
|
985
|
+
return principal.subject.slice(0, 128);
|
|
986
|
+
}
|
|
950
987
|
const authorOf = (actor) => ({
|
|
951
988
|
actor: actor.id,
|
|
952
|
-
principal: principalId(actor
|
|
989
|
+
principal: principalId(actor),
|
|
953
990
|
profile: actor.profile?.name ?? null
|
|
954
991
|
});
|
|
955
992
|
/** Who cancels a schedule when no one did: the API, once its creator can no longer post it, as a local board's scheduler. */
|
|
@@ -1090,6 +1127,11 @@ function createVercel(options, environment) {
|
|
|
1090
1127
|
});
|
|
1091
1128
|
} catch (error) {
|
|
1092
1129
|
if (error instanceof HttpError || error instanceof Error && error.name === "AbortError") throw error;
|
|
1130
|
+
if (attempt < RETRIES && repeatable && !init.signal?.aborted) {
|
|
1131
|
+
await pause(retryWait(attempt, null), init.signal);
|
|
1132
|
+
init.signal?.throwIfAborted();
|
|
1133
|
+
continue;
|
|
1134
|
+
}
|
|
1093
1135
|
throw new HttpError(502, "unreachable", `Vercel's API didn't answer: ${error instanceof Error ? error.message : String(error)}`);
|
|
1094
1136
|
}
|
|
1095
1137
|
if (response.status === 304 && kept) {
|
|
@@ -1174,7 +1216,8 @@ function createVercel(options, environment) {
|
|
|
1174
1216
|
if (!/^[^/]{1,64}$/.test(name)) throw new HttpError(400, "invalid_board_name", `${JSON.stringify(given)} isn't a board's name: one is 1 to 64 characters with no /.`, { origin: "handle" });
|
|
1175
1217
|
const { boards } = await api(who, "GET", "/boards", { query: { name } });
|
|
1176
1218
|
if (boards[0]) return boards[0].id;
|
|
1177
|
-
const
|
|
1219
|
+
const me = await self(who);
|
|
1220
|
+
const { principal } = me.actor;
|
|
1178
1221
|
if (binding?.ensure === false) throw new HttpError(404, "no_board", `no board named ${name} on this team, or none you can see.`, {
|
|
1179
1222
|
hint: "Check the name, or make it: leave out ensure: false",
|
|
1180
1223
|
origin: "handle"
|
|
@@ -1186,7 +1229,7 @@ function createVercel(options, environment) {
|
|
|
1186
1229
|
} });
|
|
1187
1230
|
return made.id;
|
|
1188
1231
|
} catch (error) {
|
|
1189
|
-
if (error instanceof HttpError && error.code === "board_not_granted") throw notLetIn(name, principal);
|
|
1232
|
+
if (error instanceof HttpError && error.code === "board_not_granted") throw notLetIn(name, principal, me.teamId);
|
|
1190
1233
|
if (error instanceof HttpError && error.code === "board_name_taken") throw new HttpError(409, "board_name_taken", `the board name ${name} is taken.`, {
|
|
1191
1234
|
hint: "Pick another name, or ask whoever can see it for access.",
|
|
1192
1235
|
origin: "handle"
|
|
@@ -1197,15 +1240,28 @@ function createVercel(options, environment) {
|
|
|
1197
1240
|
/**
|
|
1198
1241
|
* A project a board's grants don't let in, the one `name`s or the team's (null): they were narrowed,
|
|
1199
1242
|
* since every project on the team gets in by default. Its way out is the grant that lets it back in,
|
|
1200
|
-
* naming the project by ID, since `/me` carries no name
|
|
1243
|
+
* naming the project by ID, since `/me` carries no name, and the team, so it can't land on the
|
|
1244
|
+
* board of whichever team the person who runs it is linked to.
|
|
1201
1245
|
*/
|
|
1202
|
-
const notLetIn = (name, principal) => {
|
|
1246
|
+
const notLetIn = (name, principal, team) => {
|
|
1203
1247
|
const board = name === null ? "the team's board" : `board ${name}`;
|
|
1248
|
+
const on = `${name === null ? "" : ` --name ${shellWord(name)}`} --scope ${shellWord(team)}`;
|
|
1249
|
+
if (principal.type === "github" || principal.type === "oidc") {
|
|
1250
|
+
const repository = principal.type === "github" && REPOSITORY.test(principal.repository) ? principal.repository : null;
|
|
1251
|
+
if (repository === null) return new HttpError(403, "board_not_granted", `this workflow has no access to ${board}.`, {
|
|
1252
|
+
hint: "Someone who manages the board can grant it.",
|
|
1253
|
+
origin: "handle"
|
|
1254
|
+
});
|
|
1255
|
+
return new HttpError(403, "board_not_granted", `this workflow has no access to ${board} (${repository}).`, {
|
|
1256
|
+
hint: `Grant it: vb grants create --github ${repository}${on} --can '*=read,post,react,label'`,
|
|
1257
|
+
origin: "handle"
|
|
1258
|
+
});
|
|
1259
|
+
}
|
|
1204
1260
|
if (principal.type !== "project") return new HttpError(403, "board_not_granted", `this project has no access to ${board}.`, {
|
|
1205
1261
|
hint: "Someone who manages the board can grant it.",
|
|
1206
1262
|
origin: "handle"
|
|
1207
1263
|
});
|
|
1208
|
-
const grant = `vb grants create --project ${principal.projectId} --environment ${principal.environment}${
|
|
1264
|
+
const grant = `vb grants create --project ${principal.projectId} --environment ${principal.environment}${on} --can '*=read,post,react,label'`;
|
|
1209
1265
|
return new HttpError(403, "board_not_granted", `this project has no access to ${board} (${principal.projectId}, ${principal.environment}).`, {
|
|
1210
1266
|
hint: `Grant it: ${grant}`,
|
|
1211
1267
|
origin: "handle"
|
|
@@ -1220,8 +1276,9 @@ function createVercel(options, environment) {
|
|
|
1220
1276
|
*/
|
|
1221
1277
|
const boardId = (who) => (board ??= options.board ? Promise.resolve(options.board) : boardName() ? boardNamed(who, boardName()) : api(who, "GET", "/boards").then(async ({ defaultBoardId }) => {
|
|
1222
1278
|
if (defaultBoardId) return defaultBoardId;
|
|
1223
|
-
const
|
|
1224
|
-
|
|
1279
|
+
const me = await self(who);
|
|
1280
|
+
const { principal } = me.actor;
|
|
1281
|
+
if (principal.type === "project" || principal.type === "github" || principal.type === "oidc") throw notLetIn(null, principal, me.teamId);
|
|
1225
1282
|
const { board: made } = await api(who, "POST", "/boards/default", { body: { operationId: operationId() } });
|
|
1226
1283
|
return made.id;
|
|
1227
1284
|
})).catch((error) => {
|
|
@@ -2073,7 +2130,7 @@ function createVercel(options, environment) {
|
|
|
2073
2130
|
}
|
|
2074
2131
|
for (const id of ids) named.add(id);
|
|
2075
2132
|
}
|
|
2076
|
-
return (actor) => named.has(actor.id) || named.has(principalId(actor
|
|
2133
|
+
return (actor) => named.has(actor.id) || named.has(principalId(actor)) || actor.profile !== void 0 && !actor.profile.platform && named.has(actor.profile.name);
|
|
2077
2134
|
}
|
|
2078
2135
|
/**
|
|
2079
2136
|
* Which messages `--source` names, as `fromOf` shows where they came from: `board`, a key bare for this caller's own
|
|
@@ -2113,7 +2170,7 @@ function createVercel(options, environment) {
|
|
|
2113
2170
|
prefixes = [value.includes(":") ? `${value}+` : `${mentionTerm(value)}/`];
|
|
2114
2171
|
}
|
|
2115
2172
|
const named = (term) => terms.includes(term) || prefixes.some((prefix) => term.startsWith(prefix));
|
|
2116
|
-
const ids = (text) => value === "me" || value.includes(":") ? [] : mentionTerms(text).filter(
|
|
2173
|
+
const ids = (text) => value === "me" || value.includes(":") ? [] : mentionTerms(text).filter(namedByApi);
|
|
2117
2174
|
/**
|
|
2118
2175
|
* The handle an ID goes by as the actors list shows it, which is what a `@handle` settles from: the API's own
|
|
2119
2176
|
* (`pong/claude`), a deployment by its project's name. None for an ID the API names no one by: a handle made up
|
|
@@ -2161,6 +2218,8 @@ function createVercel(options, environment) {
|
|
|
2161
2218
|
}
|
|
2162
2219
|
/** Whether the API lists threads with their first and newest messages (`include=messages`): until it refuses the parameter, it's asked. */
|
|
2163
2220
|
let threadsWithMessages = true;
|
|
2221
|
+
/** Whether the API lists tasks with their newest messages (`include=messages`): until it refuses the parameter, it's asked. */
|
|
2222
|
+
let tasksWithMessages = true;
|
|
2164
2223
|
/** Whether the API takes how many threads a page holds (`limit`): until it refuses the parameter, it's asked. */
|
|
2165
2224
|
let threadsByLimit = true;
|
|
2166
2225
|
/** Whether a page of threads was answered, so what the thread list takes is known: until one is, reads of it wait for the first. */
|
|
@@ -2302,11 +2361,13 @@ function createVercel(options, environment) {
|
|
|
2302
2361
|
* or read by reference from an API that lists threads without them, then every author on the page is asked for
|
|
2303
2362
|
* together, before any is named.
|
|
2304
2363
|
*/
|
|
2364
|
+
/** A thread's first message and its newest, or null without replies: as its thread list brought them, or read by reference. */
|
|
2365
|
+
function endsOf(who, thread, signal) {
|
|
2366
|
+
const replied = thread.lastMessage !== void 0 && thread.lastMessage.sequence > 1;
|
|
2367
|
+
return Promise.all([thread.rootMessage ?? messageById(who, idAt(thread.id, 1), signal).then((found) => found.message), !replied ? null : thread.latestMessage ?? messageById(who, thread.lastMessage.id, signal).then((found) => found.message)]);
|
|
2368
|
+
}
|
|
2305
2369
|
async function summaries(who, page, signal) {
|
|
2306
|
-
const read = await Promise.all(page.map(({ thread }) =>
|
|
2307
|
-
const replied = thread.lastMessage !== void 0 && thread.lastMessage.sequence > 1;
|
|
2308
|
-
return Promise.all([thread.rootMessage ?? messageById(who, idAt(thread.id, 1), signal).then((found) => found.message), !replied ? null : thread.latestMessage ?? messageById(who, thread.lastMessage.id, signal).then((found) => found.message)]);
|
|
2309
|
-
}));
|
|
2370
|
+
const read = await Promise.all(page.map(({ thread, ends }) => ends ?? endsOf(who, thread, signal)));
|
|
2310
2371
|
naming(who, read.flatMap(([root, last]) => [root.createdBy, ...last ? [last.createdBy] : []]));
|
|
2311
2372
|
return Promise.all(page.map(async ({ thread, channel }, i) => {
|
|
2312
2373
|
const [root, last] = read[i];
|
|
@@ -2325,7 +2386,7 @@ function createVercel(options, environment) {
|
|
|
2325
2386
|
throw error;
|
|
2326
2387
|
});
|
|
2327
2388
|
/** The actor `who` writes as: the credentials' principal, and its profile, as the API names it. */
|
|
2328
|
-
const actorOf = async (who) => `${principalId((await self(who)).actor
|
|
2389
|
+
const actorOf = async (who) => `${principalId((await self(who)).actor)}${who.profile ? `+${who.profile.name.toLowerCase()}` : ""}`;
|
|
2329
2390
|
/**
|
|
2330
2391
|
* Refuses a handle narrowed with `as(profile, { can })` a source: the platform's app reads and
|
|
2331
2392
|
* joins what it can, not what the caller can, so it's this deployment's sync's job, as on a board
|
|
@@ -3210,7 +3271,7 @@ function createVercel(options, environment) {
|
|
|
3210
3271
|
const keys = body.from === null ? [.../* @__PURE__ */ new Set([body.author.id.split(":")[0], ...(binding?.sync ?? []).map((entry) => entry.key)])] : [body.from];
|
|
3211
3272
|
const ours = (actor) => keys.some((key) => actor.startsWith(`${key}:`));
|
|
3212
3273
|
if (!keys.some((key) => body.text.includes(`@[${key}:`))) return body.text;
|
|
3213
|
-
const owner = principalId((await self(who)).actor
|
|
3274
|
+
const owner = principalId((await self(who)).actor);
|
|
3214
3275
|
const named = replaceMentions(body.text, (token) => token.kind === "actor" && ours(token.actor) ? `@[${owner}+${token.actor}]` : null);
|
|
3215
3276
|
return named.length > 1e4 ? body.text : named;
|
|
3216
3277
|
}
|
|
@@ -3280,22 +3341,6 @@ function createVercel(options, environment) {
|
|
|
3280
3341
|
}
|
|
3281
3342
|
/** A sync key's inbox, under the board. */
|
|
3282
3343
|
const inboxPath = (who, key, rest = "") => onBoard(who, `/sync/inbox/${encodeURIComponent(key)}${rest}`);
|
|
3283
|
-
/** A grant Vercel's API won't keep: one naming a GitHub run or an OIDC issuer, which an app stands in for. */
|
|
3284
|
-
const grantRefused = (error) => {
|
|
3285
|
-
if (error instanceof HttpError && error.code === "unsupported_principal") throw new HttpError(400, "unsupported_principal", "Vercel's board takes no GitHub or OIDC principals in a grant.", {
|
|
3286
|
-
hint: "Grant an app that an OIDC exchange policy issues tokens for: --app <slug>.",
|
|
3287
|
-
origin: "handle"
|
|
3288
|
-
});
|
|
3289
|
-
throw error;
|
|
3290
|
-
};
|
|
3291
|
-
/** An explain Vercel's API won't answer: for a GitHub run or an OIDC issuer, which no grant there names. */
|
|
3292
|
-
const explainRefused = (error) => {
|
|
3293
|
-
if (error instanceof HttpError && error.code === "unsupported_principal") throw new HttpError(400, "unsupported_principal", "Vercel's board explains no GitHub or OIDC caller: no grant names one.", {
|
|
3294
|
-
hint: "Explain the app an OIDC exchange policy issues tokens for: --app <slug>.",
|
|
3295
|
-
origin: "handle"
|
|
3296
|
-
});
|
|
3297
|
-
throw error;
|
|
3298
|
-
};
|
|
3299
3344
|
/**
|
|
3300
3345
|
* What the API refused of a task, as a board says it: its codes with a board's statuses, and a
|
|
3301
3346
|
* thread that isn't there as the message it is here. A lost claim keeps the API's word for why, in
|
|
@@ -3358,6 +3403,7 @@ function createVercel(options, environment) {
|
|
|
3358
3403
|
messageCount: task.messageCount,
|
|
3359
3404
|
lastActivityAt: task.lastActivityAt,
|
|
3360
3405
|
...task.lastMessage ? { lastMessage: task.lastMessage } : {},
|
|
3406
|
+
...task.latestMessage ? { latestMessage: task.latestMessage } : {},
|
|
3361
3407
|
createdAt: task.message.createdAt,
|
|
3362
3408
|
createdBy: task.message.createdBy,
|
|
3363
3409
|
rootMessage: firstOf(task)
|
|
@@ -3620,7 +3666,7 @@ function createVercel(options, environment) {
|
|
|
3620
3666
|
const via = found.actor.profile && principal.type !== "external" ? { via: viaFor(principal, named, project) } : {};
|
|
3621
3667
|
return {
|
|
3622
3668
|
actor: found.actor.id,
|
|
3623
|
-
principal: principalId(found.actor
|
|
3669
|
+
principal: principalId(found.actor),
|
|
3624
3670
|
kind: shown.kind,
|
|
3625
3671
|
handle: shown.handle,
|
|
3626
3672
|
name: shown.name,
|
|
@@ -3653,9 +3699,11 @@ function createVercel(options, environment) {
|
|
|
3653
3699
|
created
|
|
3654
3700
|
};
|
|
3655
3701
|
},
|
|
3656
|
-
async actors(caller,
|
|
3702
|
+
async actors(caller, { id: only }, signal) {
|
|
3657
3703
|
const who = whoOf(caller);
|
|
3658
|
-
const
|
|
3704
|
+
const wanted = only ? [...new Set(only)] : null;
|
|
3705
|
+
const named = wanted && namesById ? await Promise.all(wanted.map((id) => byId(who, id, true))) : null;
|
|
3706
|
+
const views = named && !named.includes(null) ? named.filter((view) => view !== void 0 && view !== null) : (await all(who, await onBoard(who, "/actors"), "actors", {}, signal)).filter((view) => !wanted || wanted.includes(view.id));
|
|
3659
3707
|
const names = projectNamesOf(views.map((view) => [view.id, view]));
|
|
3660
3708
|
return {
|
|
3661
3709
|
actors: views.map((actor) => {
|
|
@@ -3703,14 +3751,11 @@ function createVercel(options, environment) {
|
|
|
3703
3751
|
},
|
|
3704
3752
|
async threads(caller, query, signal) {
|
|
3705
3753
|
const who = whoOf(caller);
|
|
3706
|
-
const unindexed = [
|
|
3707
|
-
query.by !== void 0 && "author",
|
|
3708
|
-
query.mentions !== void 0 && "mention",
|
|
3709
|
-
query.text !== void 0 && "text",
|
|
3710
|
-
query.from !== void 0 && "source"
|
|
3711
|
-
].filter((name) => name !== false);
|
|
3754
|
+
const unindexed = [query.by !== void 0 && "author", query.from !== void 0 && "source"].filter((name) => name !== false);
|
|
3712
3755
|
if (unindexed.length > 0) throw notSupported(`reading threads by ${unindexed.join(", ")}`, "they keep no search index. Read one channel's threads, or one thread, and look through what it answers");
|
|
3713
3756
|
if (query.re === void 0 && (query.channel === void 0 || query.channel.endsWith("/"))) throw notSupported(query.channel === void 0 ? "reading every channel at once" : `reading every channel under ${query.channel} at once`, "name one channel, and read the others one at a time. The channel list has their names");
|
|
3757
|
+
const looked = [query.mentions !== void 0 && "mention", query.text !== void 0 && "text"].filter((name) => name !== false);
|
|
3758
|
+
if (looked.length > 0 && (query.re !== void 0 || query.label?.length || query.after !== void 0)) throw notSupported(`reading threads by ${looked.join(", ")} ${query.re !== void 0 ? "in one thread" : query.label?.length ? "and a label" : "after a cursor"}`, "they keep no search index, so they look through one page of a channel's threads, and page back with `before`. Read one thread whole, or wait for what's new");
|
|
3714
3759
|
const after = query.after !== void 0 ? await timeOf(who, query.after) : void 0;
|
|
3715
3760
|
const limit = query.limit ?? 50;
|
|
3716
3761
|
const pick = (found) => {
|
|
@@ -3719,6 +3764,7 @@ function createVercel(options, environment) {
|
|
|
3719
3764
|
};
|
|
3720
3765
|
if (query.re === void 0 && !query.label?.length && after === void 0) {
|
|
3721
3766
|
const name = query.channel;
|
|
3767
|
+
const narrow = looked.length > 0 ? await narrowOf(who, { mentions: query.mentions }) : void 0;
|
|
3722
3768
|
const read = await inNamed(who, name, async (channel) => {
|
|
3723
3769
|
const feed = await head(who, channel);
|
|
3724
3770
|
const found = await threadsBefore(who, channel, query.before, limit, signal);
|
|
@@ -3746,14 +3792,31 @@ function createVercel(options, environment) {
|
|
|
3746
3792
|
channel: { name },
|
|
3747
3793
|
at: thread.lastActivityAt
|
|
3748
3794
|
})).reverse();
|
|
3749
|
-
|
|
3795
|
+
const cursor = cursorOf({
|
|
3796
|
+
t: page.reduce((max, { at }) => Math.max(max, at), 0),
|
|
3797
|
+
feeds: id === void 0 ? {} : { [id]: read.feed }
|
|
3798
|
+
});
|
|
3799
|
+
if (!narrow) return {
|
|
3750
3800
|
threads: await summaries(who, page, signal),
|
|
3751
|
-
cursor
|
|
3752
|
-
t: page.reduce((max, { at }) => Math.max(max, at), 0),
|
|
3753
|
-
feeds: id === void 0 ? {} : { [id]: read.feed }
|
|
3754
|
-
}),
|
|
3801
|
+
cursor,
|
|
3755
3802
|
older: read.found.older
|
|
3756
3803
|
};
|
|
3804
|
+
const ends = await Promise.all(page.map(({ thread }) => endsOf(who, thread, signal)));
|
|
3805
|
+
narrow.mentions?.ahead(ends.flatMap(([root, last]) => [root.text, ...last ? [last.text] : []]));
|
|
3806
|
+
const filters = {
|
|
3807
|
+
mentions: query.mentions,
|
|
3808
|
+
text: query.text
|
|
3809
|
+
};
|
|
3810
|
+
const matched = await Promise.all(page.map(async ({ thread }, i) => (await Promise.all(ends[i].filter((end) => end !== null).map((end) => matches(filters, end, thread, narrow)))).some(Boolean)));
|
|
3811
|
+
return {
|
|
3812
|
+
threads: await summaries(who, page.flatMap((shown, i) => matched[i] ? [{
|
|
3813
|
+
...shown,
|
|
3814
|
+
ends: ends[i]
|
|
3815
|
+
}] : []), signal),
|
|
3816
|
+
cursor,
|
|
3817
|
+
older: read.found.older,
|
|
3818
|
+
scanned: page.length
|
|
3819
|
+
};
|
|
3757
3820
|
}
|
|
3758
3821
|
if (query.before !== void 0) throw new HttpError(400, "invalid_request", "before: this board pages one channel's threads, with no filters");
|
|
3759
3822
|
if (query.re !== void 0) {
|
|
@@ -3915,10 +3978,11 @@ function createVercel(options, environment) {
|
|
|
3915
3978
|
if (landed?.thread.id === thread.id) return { message: await view(who, landed.message, channel.name) };
|
|
3916
3979
|
throw badRequest(`after: ${input.after} isn't in ${input.re}'s thread`, "invalid_after");
|
|
3917
3980
|
}
|
|
3918
|
-
|
|
3981
|
+
made = await api(who, "POST", await onBoard(who, `/threads/${encodeURIComponent(thread.id)}/messages`), {
|
|
3919
3982
|
body: {
|
|
3920
3983
|
operationId: operationId(),
|
|
3921
3984
|
text: input.text,
|
|
3985
|
+
...input.labels && Object.keys(input.labels).length ? { labels: input.labels } : {},
|
|
3922
3986
|
...to.sequence > 1 ? { replyTo: to.sequence } : {},
|
|
3923
3987
|
...clientId ? { clientId } : {},
|
|
3924
3988
|
...input.attachments?.length ? { attachments: input.attachments } : {},
|
|
@@ -3930,21 +3994,6 @@ function createVercel(options, environment) {
|
|
|
3930
3994
|
if (error instanceof HttpError && error.code === "newer_message") throw new HttpError(409, "newer_message", `a message came after ${input.after}`);
|
|
3931
3995
|
throw error;
|
|
3932
3996
|
});
|
|
3933
|
-
if (input.labels && Object.keys(input.labels).length) {
|
|
3934
|
-
const labeled = await api(who, "POST", await onBoard(who, `/threads/${encodeURIComponent(thread.id)}/messages/${reply.message.sequence}/labels`), {
|
|
3935
|
-
body: {
|
|
3936
|
-
operationId: operationId(),
|
|
3937
|
-
set: input.labels
|
|
3938
|
-
},
|
|
3939
|
-
signal
|
|
3940
|
-
});
|
|
3941
|
-
reply.message = {
|
|
3942
|
-
...reply.message,
|
|
3943
|
-
...labeled.meta.labels ? { labels: labeled.meta.labels } : {},
|
|
3944
|
-
version: labeled.meta.version
|
|
3945
|
-
};
|
|
3946
|
-
}
|
|
3947
|
-
made = reply;
|
|
3948
3997
|
}
|
|
3949
3998
|
channelName = await landedIn(who, made.thread.channelId, channelName, clientId);
|
|
3950
3999
|
return { message: await view(who, "text" in made.message ? made.message : await sent(who, made.message, input), channelName) };
|
|
@@ -4024,7 +4073,7 @@ function createVercel(options, environment) {
|
|
|
4024
4073
|
...input
|
|
4025
4074
|
},
|
|
4026
4075
|
...signal ? { signal } : {}
|
|
4027
|
-
})
|
|
4076
|
+
});
|
|
4028
4077
|
return { grant: grantFrom(grant) };
|
|
4029
4078
|
},
|
|
4030
4079
|
async createGrants(caller, input, signal) {
|
|
@@ -4035,7 +4084,7 @@ function createVercel(options, environment) {
|
|
|
4035
4084
|
...input
|
|
4036
4085
|
},
|
|
4037
4086
|
...signal ? { signal } : {}
|
|
4038
|
-
})
|
|
4087
|
+
});
|
|
4039
4088
|
return { grants: grants.map(grantFrom) };
|
|
4040
4089
|
},
|
|
4041
4090
|
async updateGrant(caller, { id, ...change }, signal) {
|
|
@@ -4046,7 +4095,7 @@ function createVercel(options, environment) {
|
|
|
4046
4095
|
...change
|
|
4047
4096
|
},
|
|
4048
4097
|
...signal ? { signal } : {}
|
|
4049
|
-
})
|
|
4098
|
+
});
|
|
4050
4099
|
return { grant: grantFrom(grant) };
|
|
4051
4100
|
},
|
|
4052
4101
|
async explain(caller, { claim, ...query }, signal) {
|
|
@@ -4054,7 +4103,7 @@ function createVercel(options, environment) {
|
|
|
4054
4103
|
const params = new URLSearchParams();
|
|
4055
4104
|
for (const [name, value] of Object.entries(query)) if (value !== void 0) params.set(name, value);
|
|
4056
4105
|
for (const pair of claim ?? []) params.append("claim", pair);
|
|
4057
|
-
const explained = await api(who, "GET", await onBoard(who, `/grants/explain?${params}`), signal ? { signal } : {})
|
|
4106
|
+
const explained = await api(who, "GET", await onBoard(who, `/grants/explain?${params}`), signal ? { signal } : {});
|
|
4058
4107
|
return {
|
|
4059
4108
|
...explained,
|
|
4060
4109
|
grants: explained.grants.map(grantFrom)
|
|
@@ -4203,16 +4252,23 @@ function createVercel(options, environment) {
|
|
|
4203
4252
|
const found = [];
|
|
4204
4253
|
let from = after !== void 0 ? { after } : {};
|
|
4205
4254
|
while (query.latest || found.length < limit) {
|
|
4255
|
+
const including = tasksWithMessages && !query.latest;
|
|
4206
4256
|
const page = await api(who, "GET", path, {
|
|
4207
4257
|
version: 2,
|
|
4208
4258
|
query: {
|
|
4209
4259
|
...asked,
|
|
4210
|
-
...from
|
|
4260
|
+
...from,
|
|
4261
|
+
...including ? { include: "messages" } : {}
|
|
4211
4262
|
},
|
|
4212
4263
|
signal
|
|
4213
4264
|
}).catch((error) => {
|
|
4265
|
+
if (including && unknownParameter(error, "include")) {
|
|
4266
|
+
tasksWithMessages = false;
|
|
4267
|
+
return null;
|
|
4268
|
+
}
|
|
4214
4269
|
throw taskRefusal(error);
|
|
4215
4270
|
});
|
|
4271
|
+
if (!page) continue;
|
|
4216
4272
|
for (const task of page.tasks) if ((query.latest || found.length < limit) && matching(task)) found.push(task);
|
|
4217
4273
|
if (!page.cursor) break;
|
|
4218
4274
|
from = { cursor: page.cursor };
|
|
@@ -4272,7 +4328,7 @@ function createVercel(options, environment) {
|
|
|
4272
4328
|
root = await view(who, firstOf(made.task), await landedIn(who, made.task.channelId, input.channel, clientId));
|
|
4273
4329
|
} else {
|
|
4274
4330
|
const { actor } = await self(who);
|
|
4275
|
-
task = askedTask(principalId(actor
|
|
4331
|
+
task = askedTask(principalId(actor), await actorOf(who), input);
|
|
4276
4332
|
root = await view(who, {
|
|
4277
4333
|
...await sent(who, {
|
|
4278
4334
|
id: idAt(made.task.id, 1),
|
|
@@ -4346,7 +4402,7 @@ function createVercel(options, environment) {
|
|
|
4346
4402
|
const { actor } = await self(who);
|
|
4347
4403
|
const stood = {
|
|
4348
4404
|
state: needs.length ? "waiting" : "ready",
|
|
4349
|
-
owner: principalId(actor
|
|
4405
|
+
owner: principalId(actor),
|
|
4350
4406
|
by: await actorOf(who),
|
|
4351
4407
|
for: asked.for ?? null,
|
|
4352
4408
|
needs,
|
|
@@ -5089,7 +5145,7 @@ async function inputOf(name, request, url, params) {
|
|
|
5089
5145
|
case "discovery":
|
|
5090
5146
|
case "me":
|
|
5091
5147
|
case "channels": return ChannelsQuery.parse(queryObject(url));
|
|
5092
|
-
case "actors":
|
|
5148
|
+
case "actors": return ActorsQuery.parse(queryObject(url));
|
|
5093
5149
|
case "watchers":
|
|
5094
5150
|
case "grants":
|
|
5095
5151
|
case "schemas": return {};
|
|
@@ -6744,4 +6800,4 @@ async function createTasksInChunks(board, channel, tasks, options = {}) {
|
|
|
6744
6800
|
return created;
|
|
6745
6801
|
}
|
|
6746
6802
|
//#endregion
|
|
6747
|
-
export { isBoardName as a,
|
|
6803
|
+
export { isBoardName as a, createVercel as c, withoutToken as d, tailWatchers as f, hostCheckedBy as i, isApiMessageId as l, createTasksInChunks as n, stoppedBy as o, deployedOnVercel as p, createBoard as r, apiThreadRoot as s, TasksInChunksError as t, PROTOCOL_ROUTES as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { f as Board, p as BoardOptions } from "./backend-
|
|
2
|
-
import "./exports-
|
|
1
|
+
import { f as Board, p as BoardOptions } from "./backend-BHN6GTjB.mjs";
|
|
2
|
+
import "./exports-BBmjHyCB.mjs";
|
|
3
3
|
//#region src/server/index.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* The handle on a board. Without a `backend`, it's Vercel's board for your team, the one `name`
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { i as Claims, r as CallerRequest } from "./auth-
|
|
3
|
-
import { C as Method, D as SandboxPolicy, E as SandboxMatcher, O as SandboxPolicyOptions, S as HttpError, T as SandboxMatch, _ as Middleware, a as Identity, b as WritePatch, c as SelfCaller, d as AsOptions, f as Board, g as DroppedError, h as WatcherContext, i as Caller, k as SandboxRule, l as Subscription, m as Watcher, n as BackendRoute, o as InboxDelivery, p as BoardOptions, r as BoardBinding, s as ProtocolMethods, t as Backend, u as VerifiedCaller, v as MiddlewareContext, w as Protocol, x as WriteSource, y as Write } from "./backend-
|
|
4
|
-
import { C as MentionedActor, S as Mentioned, _ as TaskOptions, a as EventsOptions, b as Written, c as Filters, d as PostOptions, f as ProfileOption, g as TaskInBatch, h as ScheduleTiming, l as HeldTask, m as ScheduleOptions, n as BoardError, o as EventsState, p as ReplyOptions, r as ClaimedTask, s as ExplainPrincipal, u as NewTaskOptions, v as UploadInput, x as duration, y as WaitOptions } from "./client-
|
|
5
|
-
import { n as TasksInChunksError, r as createTasksInChunks, t as TaskBatches } from "./exports-
|
|
1
|
+
import { $ as InboxNextQuery, $t as SyncThreadView, A as CreateTasksInput, At as ScheduleInput, B as Explanation, Bt as SourceMessage, C as ClaimTaskBody, Ct as ReleaseTaskBody, D as CreateTaskBody, Dt as RouteName, E as CreateGrantsBody, Et as RevokeGrantBody, F as EditBody, Ft as SchemaBody, G as GrantCan, Gt as SyncCopiesView, H as FiltersInput, Ht as SourceReadQuery, I as EventsPage, It as SchemaInput, J as GrantWriteOptions, Jt as SyncFindView, K as GrantInput, Kt as SyncFindInput, L as EventsQuery, Lt as SchemaView, M as DeleteBody, Mt as SchedulesQuery, N as Discovery, Nt as SchedulesQueryInput, O as CreateTaskInput, Ot as ScheduleBody, P as EVENTS_LAST_MAX, Pt as SchedulesQueryOutput, Q as InboxItem, Qt as SyncReceiptInput, R as EventsQueryInput, Rt as SourceJoin, S as ClaimReadyTaskInput, Sn as routes, St as RegistrationView, T as CreateChannelBody, Tt as ResolvedSyncTarget, U as GRANT_BATCH_MAX, Un as Attachment, Ut as SyncBody, V as FailTaskBody, Vt as SourceRead, W as GrantBody, Wt as SyncCopiesQuery, X as InboxAckBody, Xt as SyncImportInput, Y as INBOX_EVENT_ID_MAX, Yt as SyncImportBody, Z as InboxEntry, Zt as SyncReceiptBody, _ as ChannelView, _n as TypingResult, _t as REGISTERED_WATCHERS_MAX, a as ActorsQueryInput, an as TaskView, at as LinkView, b as ChannelsQueryInput, bn as UploadStartBody, bt as RegisterBody, c as BlockTaskBody, cn as TasksQueryInput, ct as MatchesQuery, d as CHANNELS_LIMIT_DEFAULT, dn as ThreadSummaryView, dt as MessagesPage, en as SyncedView, et as InboxPushBody, f as CHANNELS_LIMIT_MAX, fn as ThreadView, ft as ParsedFilters, g as ChannelMessagesQueryInput, gn as TypingBody, gt as PrincipalView, h as ChannelMessagesQuery, hn as ThreadsQueryInput, ht as PrincipalInput, i as ActorsQuery, in as TaskNeedsBody, it as LabelBody, j as CreatedTasksQuery, jt as ScheduleView, k as CreateTasksBody, kt as ScheduleBodyOutput, l as BlockView, ln as ThreadQuery, lt as Me, m as CancelTaskBody, mn as ThreadsQuery, mt as PostInput, n as AckBody, nn as THREADS_LIMIT_MAX, nt as LABEL_CONDITIONS_MAX, o as ApiError, on as TasksPage, ot as LinkedQuery, p as CanAt, pn as ThreadsPage, pt as PostBody, q as GrantView, qt as SyncFindQuery, r as ActorView, rn as TaskClaim, rt as LEASE_DEFAULT_S, s as AssignTaskBody, sn as TasksQuery, st as MatchView, t as ACTORS_BY_ID_MAX, tn as THREADS_LIMIT_DEFAULT, tt as InboxQuery, u as BoardEventView, un as ThreadQueryInput, ut as MessageView, v as ChannelsPage, vn as UpdateGrantBody, vt as ReactBody, w as CompleteTaskBody, wt as RenewTaskBody, x as ClaimReadyTaskBody, xn as UploadTicket, xt as RegisterInput, y as ChannelsQuery, yn as UpdateGrantInput, yt as Ref, z as ExplainQuery, zt as SourceJoinBody } from "./routes-DNmQSOvQ.mjs";
|
|
2
|
+
import { i as Claims, r as CallerRequest } from "./auth-ULldUvir.mjs";
|
|
3
|
+
import { C as Method, D as SandboxPolicy, E as SandboxMatcher, O as SandboxPolicyOptions, S as HttpError, T as SandboxMatch, _ as Middleware, a as Identity, b as WritePatch, c as SelfCaller, d as AsOptions, f as Board, g as DroppedError, h as WatcherContext, i as Caller, k as SandboxRule, l as Subscription, m as Watcher, n as BackendRoute, o as InboxDelivery, p as BoardOptions, r as BoardBinding, s as ProtocolMethods, t as Backend, u as VerifiedCaller, v as MiddlewareContext, w as Protocol, x as WriteSource, y as Write } from "./backend-BHN6GTjB.mjs";
|
|
4
|
+
import { C as MentionedActor, S as Mentioned, _ as TaskOptions, a as EventsOptions, b as Written, c as Filters, d as PostOptions, f as ProfileOption, g as TaskInBatch, h as ScheduleTiming, l as HeldTask, m as ScheduleOptions, n as BoardError, o as EventsState, p as ReplyOptions, r as ClaimedTask, s as ExplainPrincipal, u as NewTaskOptions, v as UploadInput, x as duration, y as WaitOptions } from "./client-CFHunEFn.mjs";
|
|
5
|
+
import { n as TasksInChunksError, r as createTasksInChunks, t as TaskBatches } from "./exports-BBmjHyCB.mjs";
|
|
6
6
|
import { n as block } from "./blocks-DGvh2alZ.mjs";
|
|
7
7
|
//#region src/server/index.default.d.ts
|
|
8
8
|
/**
|
|
@@ -13,4 +13,4 @@ import { n as block } from "./blocks-DGvh2alZ.mjs";
|
|
|
13
13
|
*/
|
|
14
14
|
export declare function board(options?: BoardOptions): Board;
|
|
15
15
|
//#endregion
|
|
16
|
-
export { type AckBody, type ActorView, type ApiError, type AsOptions, type AssignTaskBody, type Attachment, type Backend, type BackendRoute, type BlockTaskBody, type BlockView, type Board, type BoardBinding, BoardError, type BoardEventView, type BoardOptions, type CHANNELS_LIMIT_DEFAULT, type CHANNELS_LIMIT_MAX, type Caller, type CallerRequest, type CanAt, type CancelTaskBody, type ChannelMessagesQuery, type ChannelMessagesQueryInput, type ChannelView, type ChannelsPage, type ChannelsQuery, type ChannelsQueryInput, type ClaimReadyTaskBody, type ClaimReadyTaskInput, type ClaimTaskBody, type ClaimedTask, type Claims, type CompleteTaskBody, type CreateChannelBody, type CreateGrantsBody, type CreateTaskBody, type CreateTaskInput, type CreateTasksBody, type CreateTasksInput, type CreatedTasksQuery, type DeleteBody, type Discovery, DroppedError, type EVENTS_LAST_MAX, type EditBody, type EventsOptions, type EventsPage, type EventsQuery, type EventsQueryInput, type EventsState, type ExplainPrincipal, type ExplainQuery, type Explanation, type FailTaskBody, type Filters, type FiltersInput, type GRANT_BATCH_MAX, type GrantBody, type GrantCan, type GrantInput, type GrantView, type GrantWriteOptions, type HeldTask, HttpError, type INBOX_EVENT_ID_MAX, type Identity, type InboxAckBody, type InboxDelivery, type InboxEntry, type InboxItem, type InboxNextQuery, type InboxPushBody, type InboxQuery, type LABEL_CONDITIONS_MAX, type LEASE_DEFAULT_S, type LabelBody, type LinkView, type LinkedQuery, type MatchView, type MatchesQuery, type Me, type Mentioned, type MentionedActor, type MessageView, type MessagesPage, type Method, type Middleware, type MiddlewareContext, type NewTaskOptions, type ParsedFilters, type PostBody, type PostInput, type PostOptions, type PrincipalInput, type PrincipalView, type ProfileOption, type Protocol, type ProtocolMethods, type REGISTERED_WATCHERS_MAX, type ReactBody, type Ref, type RegisterBody, type RegisterInput, type RegistrationView, type ReleaseTaskBody, type RenewTaskBody, type ReplyOptions, type ResolvedSyncTarget, type RevokeGrantBody, type RouteName, type SandboxMatch, type SandboxMatcher, type SandboxPolicy, type SandboxPolicyOptions, type SandboxRule, type ScheduleBody, type ScheduleBodyOutput, type ScheduleInput, type ScheduleOptions, type ScheduleTiming, type ScheduleView, type SchedulesQuery, type SchedulesQueryInput, type SchedulesQueryOutput, type SchemaBody, type SchemaInput, type SchemaView, type SelfCaller, type SourceJoin, type SourceJoinBody, type SourceMessage, type SourceRead, type SourceReadQuery, type Subscription, type SyncBody, type SyncCopiesQuery, type SyncCopiesView, type SyncFindInput, type SyncFindQuery, type SyncFindView, type SyncImportBody, type SyncImportInput, type SyncReceiptBody, type SyncReceiptInput, type SyncThreadView, type SyncedView, type THREADS_LIMIT_DEFAULT, type THREADS_LIMIT_MAX, type TaskBatches, type TaskClaim, type TaskInBatch, type TaskNeedsBody, type TaskOptions, type TaskView, TasksInChunksError, type TasksPage, type TasksQuery, type TasksQueryInput, type ThreadQuery, type ThreadQueryInput, type ThreadSummaryView, type ThreadView, type ThreadsPage, type ThreadsQuery, type ThreadsQueryInput, type TypingBody, type TypingResult, type UpdateGrantBody, type UpdateGrantInput, type UploadInput, type UploadStartBody, type UploadTicket, type VerifiedCaller, type WaitOptions, type Watcher, type WatcherContext, type Write, type WritePatch, type WriteSource, type Written, block, createTasksInChunks, duration, type routes };
|
|
16
|
+
export { type ACTORS_BY_ID_MAX, type AckBody, type ActorView, type ActorsQuery, type ActorsQueryInput, type ApiError, type AsOptions, type AssignTaskBody, type Attachment, type Backend, type BackendRoute, type BlockTaskBody, type BlockView, type Board, type BoardBinding, BoardError, type BoardEventView, type BoardOptions, type CHANNELS_LIMIT_DEFAULT, type CHANNELS_LIMIT_MAX, type Caller, type CallerRequest, type CanAt, type CancelTaskBody, type ChannelMessagesQuery, type ChannelMessagesQueryInput, type ChannelView, type ChannelsPage, type ChannelsQuery, type ChannelsQueryInput, type ClaimReadyTaskBody, type ClaimReadyTaskInput, type ClaimTaskBody, type ClaimedTask, type Claims, type CompleteTaskBody, type CreateChannelBody, type CreateGrantsBody, type CreateTaskBody, type CreateTaskInput, type CreateTasksBody, type CreateTasksInput, type CreatedTasksQuery, type DeleteBody, type Discovery, DroppedError, type EVENTS_LAST_MAX, type EditBody, type EventsOptions, type EventsPage, type EventsQuery, type EventsQueryInput, type EventsState, type ExplainPrincipal, type ExplainQuery, type Explanation, type FailTaskBody, type Filters, type FiltersInput, type GRANT_BATCH_MAX, type GrantBody, type GrantCan, type GrantInput, type GrantView, type GrantWriteOptions, type HeldTask, HttpError, type INBOX_EVENT_ID_MAX, type Identity, type InboxAckBody, type InboxDelivery, type InboxEntry, type InboxItem, type InboxNextQuery, type InboxPushBody, type InboxQuery, type LABEL_CONDITIONS_MAX, type LEASE_DEFAULT_S, type LabelBody, type LinkView, type LinkedQuery, type MatchView, type MatchesQuery, type Me, type Mentioned, type MentionedActor, type MessageView, type MessagesPage, type Method, type Middleware, type MiddlewareContext, type NewTaskOptions, type ParsedFilters, type PostBody, type PostInput, type PostOptions, type PrincipalInput, type PrincipalView, type ProfileOption, type Protocol, type ProtocolMethods, type REGISTERED_WATCHERS_MAX, type ReactBody, type Ref, type RegisterBody, type RegisterInput, type RegistrationView, type ReleaseTaskBody, type RenewTaskBody, type ReplyOptions, type ResolvedSyncTarget, type RevokeGrantBody, type RouteName, type SandboxMatch, type SandboxMatcher, type SandboxPolicy, type SandboxPolicyOptions, type SandboxRule, type ScheduleBody, type ScheduleBodyOutput, type ScheduleInput, type ScheduleOptions, type ScheduleTiming, type ScheduleView, type SchedulesQuery, type SchedulesQueryInput, type SchedulesQueryOutput, type SchemaBody, type SchemaInput, type SchemaView, type SelfCaller, type SourceJoin, type SourceJoinBody, type SourceMessage, type SourceRead, type SourceReadQuery, type Subscription, type SyncBody, type SyncCopiesQuery, type SyncCopiesView, type SyncFindInput, type SyncFindQuery, type SyncFindView, type SyncImportBody, type SyncImportInput, type SyncReceiptBody, type SyncReceiptInput, type SyncThreadView, type SyncedView, type THREADS_LIMIT_DEFAULT, type THREADS_LIMIT_MAX, type TaskBatches, type TaskClaim, type TaskInBatch, type TaskNeedsBody, type TaskOptions, type TaskView, TasksInChunksError, type TasksPage, type TasksQuery, type TasksQueryInput, type ThreadQuery, type ThreadQueryInput, type ThreadSummaryView, type ThreadView, type ThreadsPage, type ThreadsQuery, type ThreadsQueryInput, type TypingBody, type TypingResult, type UpdateGrantBody, type UpdateGrantInput, type UploadInput, type UploadStartBody, type UploadTicket, type VerifiedCaller, type WaitOptions, type Watcher, type WatcherContext, type Write, type WritePatch, type WriteSource, type Written, block, createTasksInChunks, duration, type routes };
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { f as BoardError, m as duration, t as HttpError } from "./errors-
|
|
2
|
-
import { t as DroppedError } from "./middleware-
|
|
1
|
+
import { f as BoardError, m as duration, t as HttpError } from "./errors-DDfXnZ2b.mjs";
|
|
2
|
+
import { t as DroppedError } from "./middleware-BY4qqIh3.mjs";
|
|
3
3
|
import { t as block } from "./blocks-CVoBC7ur.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { c as createVercel, n as createTasksInChunks, r as createBoard, t as TasksInChunksError } from "./exports-D6Q99t_O.mjs";
|
|
5
5
|
//#region src/backend-vercel/index.default.ts
|
|
6
6
|
/**
|
|
7
7
|
* Your team's board, in Vercel's API. Outside Node there's no environment to find credentials or
|
|
@@ -24,7 +24,7 @@ function board(options = {}) {
|
|
|
24
24
|
if (!fetch) throw new Error("board: pass a fetch that sends credentials Vercel's API takes, or a backend: outside Node there's no environment to find them in");
|
|
25
25
|
return vercel({ fetch });
|
|
26
26
|
},
|
|
27
|
-
sync: () => import("./engine-
|
|
27
|
+
sync: () => import("./engine-C8wCzkw-.mjs"),
|
|
28
28
|
serving: null,
|
|
29
29
|
sandbox: null
|
|
30
30
|
});
|