@vercel/board 0.41.0 → 0.42.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/dist/{access-C5HaO42b.mjs → access-BgBiaCyx.mjs} +1 -1
- package/dist/access.mjs +4 -4
- package/dist/{actors-nrOf7Y7z.mjs → actors-DkZsnMgA.mjs} +2 -2
- package/dist/{auth-DAlYi6TN.mjs → auth-Ft4AJptx.mjs} +2 -2
- package/dist/{backend-CYsTLxtP.d.mts → backend-DMrK55mU.d.mts} +22 -3
- package/dist/backend-local.d.mts +1 -1
- package/dist/backend-local.mjs +1 -1
- package/dist/cli-commands.d.mts +1 -1
- package/dist/cli-commands.mjs +1 -1
- package/dist/cli-embedded.d.mts +9 -4
- package/dist/cli-embedded.mjs +7 -5
- package/dist/cli.mjs +5 -5
- package/dist/{commands-CrEVjASe.d.mts → commands-BlM-ckFS.d.mts} +3 -3
- package/dist/{commands-QRD0U9AQ.mjs → commands-DeEJJw3i.mjs} +3 -3
- package/dist/{conformance-ClxEEZ9C.mjs → conformance-BORt5nky.mjs} +2 -2
- package/dist/conformance.d.mts +1 -1
- package/dist/conformance.mjs +1 -1
- package/dist/digest-dm54M2k8.mjs +4 -0
- package/dist/{engine-8BcNeckB.mjs → engine-BVHSH2Kn.mjs} +2 -2
- package/dist/{errors-DcQf5WeM.mjs → errors-DUzpDSrJ.mjs} +3 -0
- package/dist/exports-Bw_OYNRl.d.mts +4 -0
- package/dist/{exports-B6udRV_E.mjs → exports-kDMIgZVu.mjs} +133 -36
- package/dist/{index-fcpEFCTR.d.mts → index-CydxnBND.d.mts} +2 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +4 -4
- package/dist/index.node.d.mts +3 -3
- package/dist/index.node.mjs +3 -3
- package/dist/inspect/app.js +40 -40
- package/dist/inspect-CNW1rLWB.mjs +2 -0
- package/dist/{inspect-DPRoC_Gg.mjs → inspect-CqCXjtPI.mjs} +6 -6
- package/dist/{local-B9y4p6N7.mjs → local-DsJ14yqg.mjs} +23 -7
- package/dist/{main-S0A-c_kP.mjs → main-C4HVA8cc.mjs} +82 -13
- package/dist/{middleware-DHdrxmoc.mjs → middleware-0DUFrav-.mjs} +1 -1
- package/dist/{origin-B3m2lnZC.mjs → origin-Cuu8lW8n.mjs} +4 -4
- package/dist/page-BPTzCBeW.mjs +2 -0
- package/dist/{page-2jjHZmIW.mjs → page-CnjVt5w2.mjs} +2 -2
- package/dist/{serve-B15I2Ibf.mjs → serve-BmabgHV-.mjs} +4 -4
- package/dist/{server-DgpRZ4Nu.mjs → server-CKbE7eMT.mjs} +14 -14
- package/dist/{serving-CALKWs9K.mjs → serving-hcxzaCCO.mjs} +1 -1
- package/dist/{tokens-D7_ZIWpX.mjs → tokens-BSMpTPEe.mjs} +2 -2
- package/docs/01-board/09-access.md +4 -1
- package/docs/04-reference/01-cli.md +7 -5
- package/docs/04-reference/02-board.md +18 -2
- package/package.json +1 -1
- package/dist/digest-Dna1CGa_.mjs +0 -4
- package/dist/exports-C8zsIL1A.d.mts +0 -4
- package/dist/inspect-BsF3mYMY.mjs +0 -2
- package/dist/page-CAUe4GmQ.mjs +0 -2
package/dist/access.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as CAN_MAX } from "./schemas-DAzSsgWk.mjs";
|
|
2
|
-
import { c as compileAccess, f as union, n as InvalidCan, o as checkGrantChange, t as FULL_ACCESS, u as parseCan } from "./access-
|
|
3
|
-
import { C as explainGrants, t as DEFAULT_CAN, w as grantAccess } from "./auth-
|
|
4
|
-
import { a as resolveActor } from "./actors-
|
|
5
|
-
import { t as oidcTokens } from "./tokens-
|
|
2
|
+
import { c as compileAccess, f as union, n as InvalidCan, o as checkGrantChange, t as FULL_ACCESS, u as parseCan } from "./access-BgBiaCyx.mjs";
|
|
3
|
+
import { C as explainGrants, t as DEFAULT_CAN, w as grantAccess } from "./auth-Ft4AJptx.mjs";
|
|
4
|
+
import { a as resolveActor } from "./actors-DkZsnMgA.mjs";
|
|
5
|
+
import { t as oidcTokens } from "./tokens-BSMpTPEe.mjs";
|
|
6
6
|
export { CAN_MAX, DEFAULT_CAN, FULL_ACCESS, InvalidCan, checkGrantChange, compileAccess, explainGrants, grantAccess, oidcTokens, parseCan, resolveActor, union };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { m as parseProfileHeader, r as badRequest } from "./errors-
|
|
1
|
+
import { m as parseProfileHeader, r as badRequest } from "./errors-DUzpDSrJ.mjs";
|
|
2
2
|
import { x as toStorable } from "./schemas-DAzSsgWk.mjs";
|
|
3
|
-
import { u as parseCan } from "./access-
|
|
3
|
+
import { u as parseCan } from "./access-BgBiaCyx.mjs";
|
|
4
4
|
import { t as own } from "./own-OwgPWdmh.mjs";
|
|
5
5
|
//#region src/server/actors.ts
|
|
6
6
|
/** Agents whose marks the board serves at `/avatars/<name>`, for a caller to pass as an avatar. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as forbidden, l as unauthorized, r as badRequest, t as HttpError } from "./errors-
|
|
2
|
-
import { c as compileAccess, l as decide, p as writtenCan, s as combine, t as FULL_ACCESS, u as parseCan } from "./access-
|
|
1
|
+
import { a as forbidden, l as unauthorized, r as badRequest, t as HttpError } from "./errors-DUzpDSrJ.mjs";
|
|
2
|
+
import { c as compileAccess, l as decide, p as writtenCan, s as combine, t as FULL_ACCESS, u as parseCan } from "./access-BgBiaCyx.mjs";
|
|
3
3
|
//#region src/server/grants.ts
|
|
4
4
|
/**
|
|
5
5
|
* How close `principal` is to the caller, or null when it doesn't name it: `principal` for its own
|
|
@@ -633,9 +633,12 @@ type Board = BoardClient & {
|
|
|
633
633
|
fetch(request: Request): Promise<Response>;
|
|
634
634
|
/**
|
|
635
635
|
* The handle, acting with `profile`: `<principal>+<profile>` over HTTP, `board:client:<profile>`
|
|
636
|
-
* on `local()`. `null` acts as yourself, outside any agent session.
|
|
636
|
+
* on `local()`. `null` acts as yourself, outside any agent session. With `can`, the board holds
|
|
637
|
+
* every call it makes to that, as it holds a sandbox to its policy's `x-board-can`: an agent's tool
|
|
638
|
+
* that runs `vb()` on `team.as('fixer', { can: ['read', 'post'] })` can't read sync's inbox or
|
|
639
|
+
* change grants. A narrowed handle's own `as()` and `sandboxPolicy()` stay inside its `can`.
|
|
637
640
|
*/
|
|
638
|
-
as(profile: ProfileOption): Board;
|
|
641
|
+
as(profile: ProfileOption, options?: AsOptions): Board;
|
|
639
642
|
/**
|
|
640
643
|
* A Vercel Sandbox network policy that hands this board, and nothing else, to a sandboxed agent:
|
|
641
644
|
* `Sandbox.create({ networkPolicy })` takes it. The sandbox's proxy adds the credential (this
|
|
@@ -647,6 +650,16 @@ type Board = BoardClient & {
|
|
|
647
650
|
*/
|
|
648
651
|
sandboxPolicy(options?: SandboxPolicyOptions): Promise<SandboxPolicy>;
|
|
649
652
|
};
|
|
653
|
+
/** What `as()` takes beside the profile. */
|
|
654
|
+
type AsOptions = {
|
|
655
|
+
/**
|
|
656
|
+
* What the handle may do at most, as `x-board-can` narrows a request: a `can` (`{ 'dev/': ['read',
|
|
657
|
+
* 'post'] }`, `['read']`) or its header form (`dev/=read,post`). It only narrows what this
|
|
658
|
+
* deployment may do, and what the handle it's called on may: never sync's records, watchers'
|
|
659
|
+
* registrations, or what `manage` does unless it says so. Without one, the handle's own.
|
|
660
|
+
*/
|
|
661
|
+
can?: Can | string;
|
|
662
|
+
};
|
|
650
663
|
/** A board on a backend you pass, which says how it reaches the board itself. */
|
|
651
664
|
type BackendOptions = {
|
|
652
665
|
/**
|
|
@@ -702,6 +715,12 @@ type SelfCaller = {
|
|
|
702
715
|
* the profile `BOARD_PROFILE` names.
|
|
703
716
|
*/
|
|
704
717
|
profile?: ProfileOption;
|
|
718
|
+
/**
|
|
719
|
+
* What `as(profile, { can })` narrowed the handle to, as `x-board-can` writes it
|
|
720
|
+
* (`dev/=read,post`): each backend holds the call to it as a request narrowed with that header
|
|
721
|
+
* is, so it never widens. Absent on a handle nothing narrowed, and on the board's own code.
|
|
722
|
+
*/
|
|
723
|
+
can?: string;
|
|
705
724
|
origin: WriteOrigin;
|
|
706
725
|
};
|
|
707
726
|
/** Who's calling a backend's method: one board() verified, or this deployment's own code. Every method honors what it may do. */
|
|
@@ -872,4 +891,4 @@ interface Backend extends ProtocolMethods {
|
|
|
872
891
|
bind(board: BoardBinding): void;
|
|
873
892
|
}
|
|
874
893
|
//#endregion
|
|
875
|
-
export {
|
|
894
|
+
export { Method as C, SandboxPolicy as D, SandboxMatcher as E, SandboxPolicyOptions as O, HttpError as S, SandboxMatch as T, Middleware as _, Identity as a, WritePatch as b, SelfCaller as c, AsOptions as d, Board as f, DroppedError as g, WatcherContext as h, Caller as i, SandboxRule as k, Subscription as l, Watcher as m, BackendRoute as n, InboxDelivery as o, BoardOptions as p, BoardBinding as r, ProtocolMethods as s, Backend as t, VerifiedCaller as u, MiddlewareContext as v, Protocol as w, WriteSource as x, Write as y };
|
package/dist/backend-local.d.mts
CHANGED
package/dist/backend-local.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as local } from "./local-
|
|
1
|
+
import { t as local } from "./local-DsJ14yqg.mjs";
|
|
2
2
|
export { local };
|
package/dist/cli-commands.d.mts
CHANGED
|
@@ -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-
|
|
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-BlM-ckFS.mjs";
|
|
2
2
|
export { CliArgument, CliCommand, CliExample, CliOption, OptionName, commands, filters, globalOptions, groups, option, options, usage };
|
package/dist/cli-commands.mjs
CHANGED
|
@@ -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-
|
|
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-DeEJJw3i.mjs";
|
|
2
2
|
export { commands, filters, globalOptions, groups, option, options, usage };
|
package/dist/cli-embedded.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./index-
|
|
1
|
+
import { f as Board } from "./backend-DMrK55mU.mjs";
|
|
2
|
+
import "./index-CydxnBND.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
|
|
@@ -101,7 +101,11 @@ export type VbOptions = {
|
|
|
101
101
|
writeFile?: (path: string, data: Uint8Array) => Promise<void> | PromiseLike<void>;
|
|
102
102
|
/** The text `-` reads, as stdin would hold it. */
|
|
103
103
|
stdin?: string;
|
|
104
|
-
/**
|
|
104
|
+
/**
|
|
105
|
+
* Ends the command and its requests: `tail` and `wait` as Ctrl-C does (0), any other with a
|
|
106
|
+
* failure, 1 when it's `AbortSignal.timeout()`'s and 130 otherwise. A write it stopped may have
|
|
107
|
+
* landed. Every request ends, whether or not the backend heeds it, on a handle `board()` made.
|
|
108
|
+
*/
|
|
105
109
|
signal?: AbortSignal;
|
|
106
110
|
/** Commands this caller doesn't run, which answer 2: `['tail', 'wait']` for an agent's tool. */
|
|
107
111
|
refuse?: string[];
|
|
@@ -117,7 +121,8 @@ export type VbResult = {
|
|
|
117
121
|
* process, and returns what the CLI would print. `board` already says which board and who, so
|
|
118
122
|
* `--url` doesn't apply, and the commands about your machine (`whoami`, `identity`,
|
|
119
123
|
* `hooks`, `serve`, `inspect`) answer 2. Calls run one at a time, in order, so
|
|
120
|
-
* `tail` and `wait`, which hold the rest until they end, need `options.signal
|
|
124
|
+
* `tail` and `wait`, which hold the rest until they end, need `options.signal`; it bounds any
|
|
125
|
+
* other call too: `{ signal: AbortSignal.timeout(30_000) }`.
|
|
121
126
|
*/
|
|
122
127
|
export declare function vb(board: Board, argv: string[], options?: VbOptions): Promise<VbResult>;
|
|
123
128
|
//#endregion
|
package/dist/cli-embedded.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { h as VERSION } from "./origin-
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
1
|
+
import { h as VERSION } from "./origin-Cuu8lW8n.mjs";
|
|
2
|
+
import { r as stoppedBy } from "./exports-kDMIgZVu.mjs";
|
|
3
|
+
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-C4HVA8cc.mjs";
|
|
4
|
+
import { t as PAGE_SHA256 } from "./digest-dm54M2k8.mjs";
|
|
4
5
|
//#region src/cli/embedded.ts
|
|
5
6
|
/**
|
|
6
7
|
* The inspector's page as this version of board's npm package has it, for an app that bundles
|
|
@@ -67,7 +68,8 @@ let queue = Promise.resolve();
|
|
|
67
68
|
* process, and returns what the CLI would print. `board` already says which board and who, so
|
|
68
69
|
* `--url` doesn't apply, and the commands about your machine (`whoami`, `identity`,
|
|
69
70
|
* `hooks`, `serve`, `inspect`) answer 2. Calls run one at a time, in order, so
|
|
70
|
-
* `tail` and `wait`, which hold the rest until they end, need `options.signal
|
|
71
|
+
* `tail` and `wait`, which hold the rest until they end, need `options.signal`; it bounds any
|
|
72
|
+
* other call too: `{ signal: AbortSignal.timeout(30_000) }`.
|
|
71
73
|
*/
|
|
72
74
|
function vb(board, argv, options = {}) {
|
|
73
75
|
const word = commandWord(argv);
|
|
@@ -90,7 +92,7 @@ function vb(board, argv, options = {}) {
|
|
|
90
92
|
name: "board",
|
|
91
93
|
commands: {}
|
|
92
94
|
}, {
|
|
93
|
-
board,
|
|
95
|
+
board: options.signal && stoppedBy(board, options.signal) || board,
|
|
94
96
|
write: (chunk) => void (stdout += typeof chunk === "string" ? chunk : decoder.decode(chunk, { stream: true })),
|
|
95
97
|
error: (chunk) => void (stderr += chunk),
|
|
96
98
|
readFile: options.readFile ? async (path) => options.readFile(path) : lacking("--attach and --text-file can't read files", "readFile"),
|
package/dist/cli.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as option } from "./commands-
|
|
3
|
-
import { f as projectDir } from "./server-
|
|
4
|
-
import { r as main } from "./main-
|
|
5
|
-
import { n as stopped, r as startInspector } from "./inspect-
|
|
2
|
+
import { a as option } from "./commands-DeEJJw3i.mjs";
|
|
3
|
+
import { f as projectDir } from "./server-CKbE7eMT.mjs";
|
|
4
|
+
import { r as main } from "./main-C4HVA8cc.mjs";
|
|
5
|
+
import { n as stopped, r as startInspector } from "./inspect-CqCXjtPI.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 { serveLocal } = await import("./serve-
|
|
39
|
+
const { serveLocal } = await import("./serve-BmabgHV-.mjs");
|
|
40
40
|
const local = await serveLocal({
|
|
41
41
|
dir: flags.dir ?? join(root, ".board"),
|
|
42
42
|
...port !== void 0 ? { port } : {}
|
|
@@ -288,7 +288,7 @@ declare const options: {
|
|
|
288
288
|
readonly app: {
|
|
289
289
|
readonly type: 'string';
|
|
290
290
|
readonly multiple: true;
|
|
291
|
-
readonly value: '
|
|
291
|
+
readonly value: 'app';
|
|
292
292
|
readonly description: 'an app installed on the team';
|
|
293
293
|
};
|
|
294
294
|
readonly 'all-apps': {
|
|
@@ -365,7 +365,7 @@ declare const options: {
|
|
|
365
365
|
readonly 'add-app': {
|
|
366
366
|
readonly type: 'string';
|
|
367
367
|
readonly multiple: true;
|
|
368
|
-
readonly value: '
|
|
368
|
+
readonly value: 'app';
|
|
369
369
|
readonly description: 'add an app';
|
|
370
370
|
};
|
|
371
371
|
readonly 'add-all-apps': {
|
|
@@ -411,7 +411,7 @@ declare const options: {
|
|
|
411
411
|
readonly 'remove-app': {
|
|
412
412
|
readonly type: 'string';
|
|
413
413
|
readonly multiple: true;
|
|
414
|
-
readonly value: '
|
|
414
|
+
readonly value: 'app';
|
|
415
415
|
readonly description: 'remove an app';
|
|
416
416
|
};
|
|
417
417
|
readonly 'remove-all-apps': {
|
|
@@ -238,7 +238,7 @@ const options = {
|
|
|
238
238
|
app: {
|
|
239
239
|
type: "string",
|
|
240
240
|
multiple: true,
|
|
241
|
-
value: "
|
|
241
|
+
value: "app",
|
|
242
242
|
description: "an app installed on the team"
|
|
243
243
|
},
|
|
244
244
|
"all-apps": {
|
|
@@ -315,7 +315,7 @@ const options = {
|
|
|
315
315
|
"add-app": {
|
|
316
316
|
type: "string",
|
|
317
317
|
multiple: true,
|
|
318
|
-
value: "
|
|
318
|
+
value: "app",
|
|
319
319
|
description: "add an app"
|
|
320
320
|
},
|
|
321
321
|
"add-all-apps": {
|
|
@@ -361,7 +361,7 @@ const options = {
|
|
|
361
361
|
"remove-app": {
|
|
362
362
|
type: "string",
|
|
363
363
|
multiple: true,
|
|
364
|
-
value: "
|
|
364
|
+
value: "app",
|
|
365
365
|
description: "remove an app"
|
|
366
366
|
},
|
|
367
367
|
"remove-all-apps": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { u as BoardError } from "./errors-
|
|
1
|
+
import { u as BoardError } from "./errors-DUzpDSrJ.mjs";
|
|
2
2
|
import { c as canonical, t as block } from "./blocks-CVoBC7ur.mjs";
|
|
3
|
-
import { a as canText, c as compileAccess } from "./access-
|
|
3
|
+
import { a as canText, c as compileAccess } from "./access-BgBiaCyx.mjs";
|
|
4
4
|
//#region src/conformance/index.ts
|
|
5
5
|
var Mismatch = class extends Error {};
|
|
6
6
|
const show = (value) => JSON.stringify(value) ?? String(value);
|
package/dist/conformance.d.mts
CHANGED
package/dist/conformance.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as conformance } from "./conformance-
|
|
1
|
+
import { t as conformance } from "./conformance-BORt5nky.mjs";
|
|
2
2
|
export { conformance };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { _ as IMPORT_BYTES_MAX, h as ATTACHMENT_BYTES_MAX, r as badRequest, s as notFound, t as HttpError, x as typeOf, y as fileSize } from "./errors-
|
|
1
|
+
import { _ as IMPORT_BYTES_MAX, h as ATTACHMENT_BYTES_MAX, r as badRequest, s as notFound, t as HttpError, x as typeOf, y as fileSize } from "./errors-DUzpDSrJ.mjs";
|
|
2
2
|
import { f as MESSAGE_TEXT_MAX, o as ChannelPath, x as toStorable } from "./schemas-DAzSsgWk.mjs";
|
|
3
3
|
import { l as isThreadTarget, s as channelOf } from "./external-DymyhUzl.mjs";
|
|
4
4
|
import { t as canonicalEmoji } from "./emoji-CTLpvH-A.mjs";
|
|
5
|
-
import { a as waitUntil, c as platformProfile, f as viaText, i as afterRetry, l as shownName, m as derivedId, o as actorParts, t as DroppedError } from "./middleware-
|
|
5
|
+
import { a as waitUntil, c as platformProfile, f as viaText, i as afterRetry, l as shownName, m as derivedId, o as actorParts, t as DroppedError } from "./middleware-0DUFrav-.mjs";
|
|
6
6
|
import { a as replaceMentions, n as isEmail, t as extractMentions } from "./mentions-DfZGp3B-.mjs";
|
|
7
7
|
import { a as immutable, d as routesFor, l as UnreadableError, n as SyncOverrides, o as ReceivedEvent, s as ResolvedTarget, u as channelMissing } from "./events-BT8y_81j.mjs";
|
|
8
8
|
import { t as displayText } from "./bots-CGkO76qH.mjs";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { f as MESSAGE_TEXT_MAX } from "./schemas-DAzSsgWk.mjs";
|
|
1
2
|
import { r as normalizeEmoji } from "./emoji-CTLpvH-A.mjs";
|
|
2
3
|
import { ZodError } from "zod";
|
|
3
4
|
//#region src/contract/files.ts
|
|
@@ -697,6 +698,7 @@ const badRequest = (message, code = "invalid_request") => new HttpError(400, cod
|
|
|
697
698
|
const unauthorized = (message) => new HttpError(401, "unauthorized", message);
|
|
698
699
|
const forbidden = (message) => new HttpError(403, "forbidden", message);
|
|
699
700
|
const notFound = (message, code = "not_found") => new HttpError(404, code, message);
|
|
701
|
+
const textTooLong = () => new HttpError(400, "text_too_long", `A message's text is at most ${MESSAGE_TEXT_MAX.toLocaleString("en-US")} characters.`, { hint: "Put the long part in a file and attach it to a message, with a short summary as the text." });
|
|
700
702
|
const duplicateId = () => new HttpError(409, "duplicate_id", "that id was already used for a different write");
|
|
701
703
|
const json = (body, status = 200, headers) => new Response(JSON.stringify(body), {
|
|
702
704
|
status,
|
|
@@ -731,6 +733,7 @@ function toErrorResponse(error) {
|
|
|
731
733
|
}
|
|
732
734
|
if (error instanceof ZodError) {
|
|
733
735
|
const issue = error.issues[0] && reported(error.issues[0]);
|
|
736
|
+
if (issue?.code === "too_big" && issue.origin === "string" && issue.maximum === 1e4 && issue.path.length === 1 && issue.path[0] === "text") return toErrorResponse(textTooLong());
|
|
734
737
|
const path = issue?.path.length ? `${issue.path.join(".")}: ` : "";
|
|
735
738
|
return json({ error: {
|
|
736
739
|
code: "invalid_request",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { _ as IMPORT_BYTES_MAX, a as forbidden, b as mediaType, c as toErrorResponse, d as createBoardClient, f as duration, h as ATTACHMENT_BYTES_MAX, l as unauthorized, n as RejectedError, o as json, p as formatProfileHeader, r as badRequest, s as notFound, t as HttpError, u as BoardError, v as fileName } from "./errors-
|
|
1
|
+
import { _ as IMPORT_BYTES_MAX, a as forbidden, b as mediaType, c as toErrorResponse, d as createBoardClient, f as duration, h as ATTACHMENT_BYTES_MAX, l as unauthorized, n as RejectedError, o as json, p as formatProfileHeader, r as badRequest, s as notFound, t as HttpError, u as BoardError, v as fileName } from "./errors-DUzpDSrJ.mjs";
|
|
2
2
|
import { h as RemoteWatcherId } from "./schemas-DAzSsgWk.mjs";
|
|
3
3
|
import { f as schemaId, n as blocksIn, r as findBlocks } from "./blocks-CVoBC7ur.mjs";
|
|
4
|
-
import { A as MessagesQuery, B as SyncBody, C as InboxAckBody, D as LabelBody, E as InboxQuery, F as ScheduleBody, G as ThreadsQuery, H as SyncFindQuery, I as SchedulesQuery, J as UploadStartBody, K as TypingBody, L as SchemaBody, M as ReactBody, N as Ref, O as LinkedQuery, P as RegisterBody, R as SourceJoinBody, S as GrantBody, T as InboxPushBody, U as SyncImportBody, V as SyncCopiesQuery, W as SyncReceiptBody, Y as routes, _ as CreateChannelBody, a as compileWatcher, b as EventsQuery, c as METHODS, d as queryObject, f as readCapped, g as AckBody, h as VERSION, i as runMatch, j as PostBody, k as MatchesQuery, l as createRouter, m as SYNC, n as syncTarget, p as readJson, q as UpdateGrantBody, r as canonicalWatchers, t as SYNC_ACTOR, u as openapi, v as DeleteBody, w as InboxNextQuery, x as ExplainQuery, y as EditBody, z as SourceReadQuery } from "./origin-
|
|
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-
|
|
6
|
-
import { a as canText, c as compileAccess, d as parsePattern, n as InvalidCan, r as PERMISSIONS, u as parseCan } from "./access-
|
|
7
|
-
import { C as explainGrants, b as verifiesTokens, d as grantIssuers, f as hostPrincipal, i as VERCEL_ISSUER, l as createAuthority, t as DEFAULT_CAN$1, u as fromTokens, y as verifiedIssuers } from "./auth-
|
|
8
|
-
import { a as resolveActor, o as viaOf, r as claimsOf, t as KNOWN_AGENTS } from "./actors-
|
|
4
|
+
import { A as MessagesQuery, B as SyncBody, C as InboxAckBody, D as LabelBody, E as InboxQuery, F as ScheduleBody, G as ThreadsQuery, H as SyncFindQuery, I as SchedulesQuery, J as UploadStartBody, K as TypingBody, L as SchemaBody, M as ReactBody, N as Ref, O as LinkedQuery, P as RegisterBody, R as SourceJoinBody, S as GrantBody, T as InboxPushBody, U as SyncImportBody, V as SyncCopiesQuery, W as SyncReceiptBody, Y as routes, _ as CreateChannelBody, a as compileWatcher, b as EventsQuery, c as METHODS, d as queryObject, f as readCapped, g as AckBody, h as VERSION, i as runMatch, j as PostBody, k as MatchesQuery, l as createRouter, m as SYNC, n as syncTarget, p as readJson, q as UpdateGrantBody, r as canonicalWatchers, t as SYNC_ACTOR, u as openapi, v as DeleteBody, w as InboxNextQuery, x as ExplainQuery, y as EditBody, z as SourceReadQuery } from "./origin-Cuu8lW8n.mjs";
|
|
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-0DUFrav-.mjs";
|
|
6
|
+
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-BgBiaCyx.mjs";
|
|
7
|
+
import { C as explainGrants, b as verifiesTokens, d as grantIssuers, f as hostPrincipal, i as VERCEL_ISSUER, l as createAuthority, t as DEFAULT_CAN$1, u as fromTokens, y as verifiedIssuers } from "./auth-Ft4AJptx.mjs";
|
|
8
|
+
import { a as resolveActor, o as viaOf, r as claimsOf, t as KNOWN_AGENTS } from "./actors-DkZsnMgA.mjs";
|
|
9
9
|
import { t as checkValue } from "./data-values-C-Cq80hz.mjs";
|
|
10
10
|
//#region src/server/registrant.ts
|
|
11
11
|
/** Registering again this soon after the same registration only repeats it. */
|
|
@@ -935,7 +935,8 @@ function createVercel(options, environment) {
|
|
|
935
935
|
}
|
|
936
936
|
const headers = {
|
|
937
937
|
"content-type": "application/json",
|
|
938
|
-
...apiProfileHeaders(who.profile)
|
|
938
|
+
...apiProfileHeaders(who.profile),
|
|
939
|
+
...who.can !== void 0 ? { "x-board-can": who.can } : {}
|
|
939
940
|
};
|
|
940
941
|
const repeatable = method !== "POST" && method !== "PATCH" || typeof init.body?.operationId === "string";
|
|
941
942
|
for (let attempt = 0;; attempt++) {
|
|
@@ -1520,6 +1521,14 @@ function createVercel(options, environment) {
|
|
|
1520
1521
|
});
|
|
1521
1522
|
/** The actor `who` writes as: the credentials' principal, and its profile, as the API names it. */
|
|
1522
1523
|
const actorOf = async (who) => `${principalId((await self(who)).actor.principal)}${who.profile ? `+${who.profile.name.toLowerCase()}` : ""}`;
|
|
1524
|
+
/**
|
|
1525
|
+
* Refuses a handle narrowed with `as(profile, { can })` a source: the platform's app reads and
|
|
1526
|
+
* joins what it can, not what the caller can, so it's this deployment's sync's job, as on a board
|
|
1527
|
+
* of its own.
|
|
1528
|
+
*/
|
|
1529
|
+
function ownSources(caller, what) {
|
|
1530
|
+
if ("self" in caller && caller.can !== void 0) throw new HttpError(403, "forbidden", `this handle is narrowed with a can, so it can't ${what}: that's its project's sync's job`);
|
|
1531
|
+
}
|
|
1523
1532
|
/** Who a caller acts as there: its profile, beside this deployment's credentials. */
|
|
1524
1533
|
function whoOf(caller) {
|
|
1525
1534
|
if ("identity" in caller) throw servesNone();
|
|
@@ -1534,7 +1543,10 @@ function createVercel(options, environment) {
|
|
|
1534
1543
|
};
|
|
1535
1544
|
if (caller.origin.via?.kind === "client") {
|
|
1536
1545
|
const asked = "profile" in caller ? caller.profile : caller.self ?? void 0;
|
|
1537
|
-
return {
|
|
1546
|
+
return {
|
|
1547
|
+
profile: named(asked === void 0 ? environment?.profile() ?? null : asked),
|
|
1548
|
+
...caller.can !== void 0 ? { can: caller.can } : {}
|
|
1549
|
+
};
|
|
1538
1550
|
}
|
|
1539
1551
|
return { profile: named(caller.self ?? "client") };
|
|
1540
1552
|
}
|
|
@@ -2874,14 +2886,17 @@ function createVercel(options, environment) {
|
|
|
2874
2886
|
async typing(caller, { id, status }, signal) {
|
|
2875
2887
|
if (!binding || binding.sync.length === 0) return { targets: [] };
|
|
2876
2888
|
const { message, replies } = await methods.message(caller, { id }, signal);
|
|
2889
|
+
if ("self" in caller && caller.can !== void 0 && !compileAccess(parseCan(caller.can)).can("post", message.channel)) throw new HttpError(403, "forbidden", `this handle can't post in ${message.channel}`);
|
|
2877
2890
|
return { targets: await binding.typing([message, ...replies], status) };
|
|
2878
2891
|
},
|
|
2879
|
-
async readSource(
|
|
2892
|
+
async readSource(caller, { key, target, limit, after }) {
|
|
2880
2893
|
if (!binding?.sync.some((entry) => entry.key === key)) throw notFound(`this board doesn't run sync entry ${key}: read it where its sync runs`, "not_synced_here");
|
|
2894
|
+
ownSources(caller, "read a source");
|
|
2881
2895
|
return binding.readSource(key, target, limit ?? 50, after ?? null);
|
|
2882
2896
|
},
|
|
2883
|
-
async joinSource(
|
|
2897
|
+
async joinSource(caller, { key, target }) {
|
|
2884
2898
|
if (!binding?.sync.some((entry) => entry.key === key)) throw notFound(`this board doesn't run sync entry ${key}: join it where its sync runs`, "not_synced_here");
|
|
2899
|
+
ownSources(caller, "join a source");
|
|
2885
2900
|
return binding.joinSource(key, target);
|
|
2886
2901
|
},
|
|
2887
2902
|
async syncImport(caller, body, signal) {
|
|
@@ -3584,9 +3599,12 @@ async function createServe(context) {
|
|
|
3584
3599
|
* What a verified caller may do, as board()'s `access` said when it verified them: board() checks
|
|
3585
3600
|
* it before it does anything for them past calling the backend (a platform call, sync's own write,
|
|
3586
3601
|
* reading an upload, the middleware), so a caller it won't let in starts none of it. Null for this
|
|
3587
|
-
* deployment's own code, which may do everything
|
|
3602
|
+
* deployment's own code, which may do everything, unless `as(profile, { can })` narrowed its
|
|
3603
|
+
* handle: then what that `can` leaves it, as a request narrowed with x-board-can is checked.
|
|
3588
3604
|
*/
|
|
3589
|
-
const accessOf = (caller) => "identity" in caller ? caller.identity.principal.access : null;
|
|
3605
|
+
const accessOf = (caller) => "identity" in caller ? caller.identity.principal.access : caller.can !== void 0 ? FULL_ACCESS.narrow(parseCan(caller.can)) : null;
|
|
3606
|
+
/** Whether `caller` is narrowed with a `can`: a request's x-board-can, or a handle's from `as()`. */
|
|
3607
|
+
const narrowed = (caller) => "identity" in caller ? caller.identity.principal.scope !== void 0 : caller.can !== void 0;
|
|
3590
3608
|
/**
|
|
3591
3609
|
* Whether board() may work for a write of `caller`'s that lands in `channel`, or in the thread of
|
|
3592
3610
|
* message `re`, which it must read: `post` there. One it may not goes to the backend as it came,
|
|
@@ -3838,7 +3856,7 @@ async function createServe(context) {
|
|
|
3838
3856
|
};
|
|
3839
3857
|
if (middleware.length === 0 || caller.origin.via?.kind === "middleware" || body.op !== "post" && body.op !== "edit") return send(body);
|
|
3840
3858
|
const access = accessOf(caller);
|
|
3841
|
-
if (access && (!access.anywhere("sync") ||
|
|
3859
|
+
if (access && (!access.anywhere("sync") || narrowed(caller))) return send(body);
|
|
3842
3860
|
const dropped = async (commit) => {
|
|
3843
3861
|
try {
|
|
3844
3862
|
return await commit();
|
|
@@ -4296,6 +4314,59 @@ async function createServe(context) {
|
|
|
4296
4314
|
}
|
|
4297
4315
|
//#endregion
|
|
4298
4316
|
//#region src/server/board.ts
|
|
4317
|
+
/** A handle's own, with every request it makes ended by a signal: what `vb()` runs a command on. Global, so another copy of board finds it. */
|
|
4318
|
+
const STOPPED_BY = Symbol.for("@vercel/board/stopped-by");
|
|
4319
|
+
/**
|
|
4320
|
+
* `board`, with each request it makes ended by `signal`: the backend's call gets it, and the request
|
|
4321
|
+
* rejects with its reason when it fires, whether or not the backend heeds it. A request already
|
|
4322
|
+
* sent may still have done what it asked. Null for a handle board() didn't make.
|
|
4323
|
+
*/
|
|
4324
|
+
function stoppedBy(board, signal) {
|
|
4325
|
+
const own = board[STOPPED_BY];
|
|
4326
|
+
return typeof own === "function" ? own(signal) : null;
|
|
4327
|
+
}
|
|
4328
|
+
/** `response`, with a body that errors with `signal`'s reason once it fires: a download whose body stalls ends too. */
|
|
4329
|
+
function bounded(response, signal) {
|
|
4330
|
+
if (!response.ok || !response.body) return response;
|
|
4331
|
+
const reader = response.body.getReader();
|
|
4332
|
+
const body = new ReadableStream({
|
|
4333
|
+
start(controller) {
|
|
4334
|
+
const stop = () => {
|
|
4335
|
+
controller.error(signal.reason);
|
|
4336
|
+
reader.cancel(signal.reason).catch(() => {});
|
|
4337
|
+
};
|
|
4338
|
+
if (signal.aborted) stop();
|
|
4339
|
+
else signal.addEventListener("abort", stop, { once: true });
|
|
4340
|
+
},
|
|
4341
|
+
async pull(controller) {
|
|
4342
|
+
let read;
|
|
4343
|
+
try {
|
|
4344
|
+
read = await reader.read();
|
|
4345
|
+
} catch (error) {
|
|
4346
|
+
if (!signal.aborted) controller.error(error);
|
|
4347
|
+
return;
|
|
4348
|
+
}
|
|
4349
|
+
if (signal.aborted) return;
|
|
4350
|
+
if (read.done) controller.close();
|
|
4351
|
+
else controller.enqueue(read.value);
|
|
4352
|
+
},
|
|
4353
|
+
cancel: (reason) => reader.cancel(reason)
|
|
4354
|
+
});
|
|
4355
|
+
return new Response(body, {
|
|
4356
|
+
status: response.status,
|
|
4357
|
+
statusText: response.statusText,
|
|
4358
|
+
headers: response.headers
|
|
4359
|
+
});
|
|
4360
|
+
}
|
|
4361
|
+
/** `work`, or `signal`'s reason once it fires, whichever comes first. */
|
|
4362
|
+
function until(signal, work) {
|
|
4363
|
+
if (signal.aborted) return Promise.reject(signal.reason);
|
|
4364
|
+
return new Promise((resolve, reject) => {
|
|
4365
|
+
const stop = () => reject(signal.reason);
|
|
4366
|
+
signal.addEventListener("abort", stop, { once: true });
|
|
4367
|
+
work.then(resolve, reject).finally(() => signal.removeEventListener("abort", stop));
|
|
4368
|
+
});
|
|
4369
|
+
}
|
|
4299
4370
|
/** How long a handle's live events wait for the next, in seconds, before asking again. */
|
|
4300
4371
|
const EVENTS_WAIT_S = 25;
|
|
4301
4372
|
/** A profile's name, as the board takes one in `x-board-profile`. */
|
|
@@ -4346,12 +4417,24 @@ function createBoard(options, runtime) {
|
|
|
4346
4417
|
loading.catch(() => loading = null);
|
|
4347
4418
|
return loading;
|
|
4348
4419
|
}
|
|
4349
|
-
function clientAs(caller, trigger) {
|
|
4350
|
-
const
|
|
4420
|
+
function clientAs(caller, trigger, stop, writes = { made: 0 }) {
|
|
4421
|
+
const inject = async (request) => (await server()).inject(request, caller, trigger, writes);
|
|
4351
4422
|
return createBoardClient({
|
|
4352
4423
|
url: inProcess,
|
|
4353
4424
|
token: "in-process",
|
|
4354
|
-
fetch: (async (input, init) =>
|
|
4425
|
+
fetch: (async (input, init) => {
|
|
4426
|
+
if (!stop) return inject(new Request(input, init));
|
|
4427
|
+
const signal = init?.signal ? AbortSignal.any([init.signal, stop]) : stop;
|
|
4428
|
+
if (signal.aborted) throw signal.reason;
|
|
4429
|
+
return bounded(await until(signal, inject(new Request(input, {
|
|
4430
|
+
...init,
|
|
4431
|
+
signal
|
|
4432
|
+
}))), signal);
|
|
4433
|
+
}),
|
|
4434
|
+
...stop ? { storeFetch: ((input, init) => globalThis.fetch(input, {
|
|
4435
|
+
...init,
|
|
4436
|
+
signal: init?.signal ? AbortSignal.any([init.signal, stop]) : stop
|
|
4437
|
+
})) } : {}
|
|
4355
4438
|
});
|
|
4356
4439
|
}
|
|
4357
4440
|
const serve = async (request) => (await server()).dispatch(request, null);
|
|
@@ -4372,6 +4455,19 @@ function createBoard(options, runtime) {
|
|
|
4372
4455
|
routes: PROTOCOL_ROUTES
|
|
4373
4456
|
};
|
|
4374
4457
|
}
|
|
4458
|
+
/** `can`'s header text, read as the board reads one: a 400 `invalid_scope` for one it doesn't. */
|
|
4459
|
+
function canOf(can) {
|
|
4460
|
+
try {
|
|
4461
|
+
return canHeader(can);
|
|
4462
|
+
} catch (error) {
|
|
4463
|
+
if (error instanceof InvalidCan) throw new BoardError("invalid_scope", error.message, 400);
|
|
4464
|
+
throw error;
|
|
4465
|
+
}
|
|
4466
|
+
}
|
|
4467
|
+
/** What a handle narrowed to `held` (or nothing) may do once `can` narrows it too: never more than either. */
|
|
4468
|
+
const within = (held, can) => held === void 0 ? can : canText(compileAccess(parseCan(held)).narrow(parseCan(can)));
|
|
4469
|
+
/** The `can` a handle as `caller` holds: what `as(profile, { can })` gave it. */
|
|
4470
|
+
const heldBy = (caller) => "self" in caller ? caller.can : void 0;
|
|
4375
4471
|
/** The policy that hands this board to a sandbox, for a handle as `caller`. */
|
|
4376
4472
|
async function sandboxPolicy(caller, options = {}) {
|
|
4377
4473
|
const own = "profile" in caller ? caller.profile : null;
|
|
@@ -4379,16 +4475,9 @@ function createBoard(options, runtime) {
|
|
|
4379
4475
|
if (named === null) throw new BoardError("invalid_profile", "A sandbox writes as a profile of this deployment, and this names none: the sandbox could send its own, and write as any.", 400, { hint: "Name one: sandboxPolicy({ profile: { name } }), or team.as('<name>').sandboxPolicy()." });
|
|
4380
4476
|
if (!SANDBOX_PROFILE.test(named.name)) throw new BoardError("invalid_profile", `${named.name} isn't a profile's name: one starts with a letter and uses up to 32 letters, numbers, and hyphens.`, 400);
|
|
4381
4477
|
if (named.avatar !== void 0 && !avatarUrl(named.avatar)) throw new BoardError("invalid_profile", `${named.avatar} isn't an avatar: one is an https URL, or http on localhost.`, 400);
|
|
4382
|
-
let can;
|
|
4383
|
-
try {
|
|
4384
|
-
can = canHeader(options.can);
|
|
4385
|
-
} catch (error) {
|
|
4386
|
-
if (error instanceof InvalidCan) throw new BoardError("invalid_scope", error.message, 400);
|
|
4387
|
-
throw error;
|
|
4388
|
-
}
|
|
4389
4478
|
const input = {
|
|
4390
4479
|
profile: named,
|
|
4391
|
-
can,
|
|
4480
|
+
can: within(heldBy(caller), canOf(options.can)),
|
|
4392
4481
|
token: options.token
|
|
4393
4482
|
};
|
|
4394
4483
|
try {
|
|
@@ -4402,17 +4491,18 @@ function createBoard(options, runtime) {
|
|
|
4402
4491
|
}
|
|
4403
4492
|
}
|
|
4404
4493
|
/** A handle on `client`, which `as` gives other profiles of. */
|
|
4405
|
-
function handle(client, url, caller) {
|
|
4494
|
+
function handle(client, url, caller, trigger, stop, writes) {
|
|
4406
4495
|
const made = {
|
|
4407
4496
|
...client,
|
|
4408
4497
|
fetch: serve,
|
|
4409
|
-
as,
|
|
4498
|
+
as: asFrom(caller, stop),
|
|
4410
4499
|
sandboxPolicy: (options) => sandboxPolicy(caller, options)
|
|
4411
4500
|
};
|
|
4412
4501
|
if (url) Object.defineProperty(made, "url", {
|
|
4413
4502
|
get: url,
|
|
4414
4503
|
enumerable: true
|
|
4415
4504
|
});
|
|
4505
|
+
Object.defineProperty(made, STOPPED_BY, { value: (signal) => handleOf(caller, trigger, signal, writes) });
|
|
4416
4506
|
return made;
|
|
4417
4507
|
}
|
|
4418
4508
|
/**
|
|
@@ -4420,12 +4510,12 @@ function createBoard(options, runtime) {
|
|
|
4420
4510
|
* so a retry posts once and no request can take it first. A verified caller's are a backend's,
|
|
4421
4511
|
* derived already (a schedule's send's), so they go as they are.
|
|
4422
4512
|
*/
|
|
4423
|
-
function handleOf(caller, trigger) {
|
|
4424
|
-
const client = clientAs(caller, trigger);
|
|
4513
|
+
function handleOf(caller, trigger, stop, writes = { made: 0 }) {
|
|
4514
|
+
const client = clientAs(caller, trigger, stop, writes);
|
|
4425
4515
|
if ("identity" in caller) return handle({
|
|
4426
4516
|
...client,
|
|
4427
4517
|
events: (query, opts) => events(client, query, opts)
|
|
4428
|
-
}, () => ownUrl() ?? inProcess, caller);
|
|
4518
|
+
}, () => ownUrl() ?? inProcess, caller, trigger, stop, writes);
|
|
4429
4519
|
const via = caller.origin.via?.kind ?? "client";
|
|
4430
4520
|
const id = (given) => derivedId(`board-${via === "watcher" ? "watch" : via}`, caller.self ?? "", given);
|
|
4431
4521
|
const owned = async (input) => typeof input === "string" || input.id === void 0 ? input : {
|
|
@@ -4439,25 +4529,32 @@ function createBoard(options, runtime) {
|
|
|
4439
4529
|
posted: async (given) => client.posted(await id(given)),
|
|
4440
4530
|
request: (path, init = {}) => {
|
|
4441
4531
|
const { as: profile, ...rest } = init;
|
|
4442
|
-
return profile !== void 0 ?
|
|
4532
|
+
return profile !== void 0 ? asFrom(caller, stop)(profile).request(path, rest) : client.request(path, rest);
|
|
4443
4533
|
},
|
|
4444
4534
|
events: (query, opts) => events(client, query, opts)
|
|
4445
|
-
}, () => ownUrl() ?? inProcess, caller);
|
|
4535
|
+
}, () => ownUrl() ?? inProcess, caller, trigger, stop, writes);
|
|
4446
4536
|
}
|
|
4447
|
-
const profileCaller = (profile) => {
|
|
4537
|
+
const profileCaller = (profile, can) => {
|
|
4448
4538
|
const name = profile === null ? null : typeof profile === "string" ? profile : profile.name;
|
|
4449
4539
|
return {
|
|
4450
4540
|
self: name,
|
|
4451
4541
|
profile,
|
|
4542
|
+
...can !== void 0 ? { can } : {},
|
|
4452
4543
|
origin: { via: {
|
|
4453
4544
|
kind: "client",
|
|
4454
4545
|
name
|
|
4455
4546
|
} }
|
|
4456
4547
|
};
|
|
4457
4548
|
};
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4549
|
+
/**
|
|
4550
|
+
* `as()` on a handle as `caller`: another profile, held to what that handle holds, and to `can`
|
|
4551
|
+
* when it's given, and stopped by what stops that handle.
|
|
4552
|
+
*/
|
|
4553
|
+
const asFrom = (caller, stop) => (profile, options = {}) => {
|
|
4554
|
+
const held = heldBy(caller);
|
|
4555
|
+
const can = options.can === void 0 ? held : within(held, canOf(options.can));
|
|
4556
|
+
return handleOf(profileCaller(profile, can), null, stop);
|
|
4557
|
+
};
|
|
4461
4558
|
const context = {
|
|
4462
4559
|
options,
|
|
4463
4560
|
backend,
|
|
@@ -4555,4 +4652,4 @@ async function* events(client, query = {}, opts = {}) {
|
|
|
4555
4652
|
}
|
|
4556
4653
|
}
|
|
4557
4654
|
//#endregion
|
|
4558
|
-
export {
|
|
4655
|
+
export { isApiMessageId as a, tailWatchers as c, createVercel as i, deployedOnVercel as l, isBoardName as n, PROTOCOL_ROUTES as o, stoppedBy as r, withoutToken as s, createBoard as t };
|