@vercel/board 0.48.0 → 0.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{access-C06pIr0M.mjs → access-B8DnrnHa.mjs} +29 -17
- package/dist/access.d.mts +2 -2
- package/dist/access.mjs +5 -5
- package/dist/{actors-Dkyg-oo0.mjs → actors-DewJKyqy.mjs} +4 -3
- package/dist/{auth-B9-wXQ-x.mjs → auth-CEU06Nyp.mjs} +2 -2
- package/dist/{auth-li3lKwJG.d.mts → auth-Z9-Khvvw.d.mts} +1 -1
- package/dist/{backend-UBP6HimX.d.mts → backend-BzCXxVZ-.d.mts} +19 -5
- package/dist/backend-local.d.mts +1 -1
- package/dist/backend-local.mjs +1 -1
- package/dist/{bots-CLKKMgYf.mjs → bots-CqPYxkqK.mjs} +15 -8
- package/dist/{chat-provider-kNWd6MQC.mjs → chat-provider-BS_fr61g.mjs} +2 -2
- package/dist/{chat-provider-iN0DFsSE.d.mts → chat-provider-DQ1GHm4o.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 +3 -3
- package/dist/cli.mjs +6 -6
- package/dist/client-C2T4eaXd.d.mts +544 -0
- package/dist/{commands-CJsOA-hf.d.mts → commands-Cm4sODIu.d.mts} +12 -8
- package/dist/{commands-Dk6_cHLS.mjs → commands-nN8WpvCe.mjs} +75 -58
- package/dist/{conformance-CDP8y2Zm.mjs → conformance-0xONNKcB.mjs} +102 -20
- package/dist/conformance.d.mts +1 -1
- package/dist/conformance.mjs +1 -1
- package/dist/{engine-B3Yd0OPc.mjs → engine-BH_nfJ3N.mjs} +10 -8
- package/dist/{errors-QhkdzI-o.mjs → errors-DwV7I0g4.mjs} +53 -174
- package/dist/{events-B-qyxNsJ.mjs → events-B76-4bNp.mjs} +2 -2
- package/dist/{exports-inhbjAWi.d.mts → exports-CKEK1fxf.d.mts} +4 -4
- package/dist/{exports-B5xOYHj_.mjs → exports-DLzyKwEp.mjs} +336 -82
- package/dist/{external-BuVTXT1R.mjs → external-BLI4W_-V.mjs} +1 -1
- package/dist/{index-B0Fnhvk7.d.mts → index-DxqSw8yd.d.mts} +2 -2
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +4 -4
- package/dist/index.node.d.mts +7 -7
- package/dist/index.node.mjs +4 -4
- package/dist/inspect/app.js +39 -39
- package/dist/inspect/engine.js +3 -3
- package/dist/inspect-B2ImmOvw.mjs +272 -0
- package/dist/inspect-DnRQUmP8.mjs +2 -0
- package/dist/inspect.d.mts +17 -0
- package/dist/inspect.mjs +196 -0
- package/dist/{local-CKMP4xH3.mjs → local-DPpSEq2_.mjs} +132 -50
- package/dist/{main-DZZQEFVl.mjs → main-CqX7JqzE.mjs} +217 -49
- package/dist/{memory-CMm-Fk_A.mjs → memory-DzqkXIB-.mjs} +2 -2
- package/dist/{middleware-CT6vMNUc.mjs → middleware-ysFm2S4v.mjs} +2 -2
- package/dist/{page-D-OzDOAX.mjs → page-7KWSGxyC.mjs} +12 -2
- package/dist/page-CN77B014.mjs +2 -0
- package/dist/profile-header-Cj0Cb1cf.mjs +163 -0
- package/dist/{provider-DC3WHUXo.d.mts → provider-Dwb_9mnu.d.mts} +3 -529
- package/dist/{routes-CjA6Mp4D.d.mts → routes-B6SEA9yw.d.mts} +130 -4
- package/dist/{routes-ABXf3CKq.mjs → routes-qS92xz8U.mjs} +33 -7
- package/dist/{schemas-7VFdomFB.mjs → schemas-TeVe4Udh.mjs} +4 -2
- package/dist/{serve-DBJTP0xd.mjs → serve-CYr4RwRM.mjs} +5 -5
- package/dist/{server-DmlyIzMj.mjs → server-V7qyVUiJ.mjs} +11 -9
- package/dist/{serving-BNdiReQT.mjs → serving-BzNxlnDV.mjs} +1 -1
- package/dist/{inspect-CAz9PGLf.mjs → shell-BLHZoP-x.mjs} +25 -274
- package/dist/{sql-IEbO5vXs.mjs → sql-DIKQd5Me.mjs} +2 -2
- package/dist/{sqlite-CVG8XKHm.mjs → sqlite-BF9kBDh1.mjs} +2 -2
- package/dist/{sqlite-db-BJjPQYx4.mjs → sqlite-db-CSYwiZ4E.mjs} +1 -1
- package/dist/sync-chat-sdk.d.mts +2 -2
- package/dist/sync-chat-sdk.mjs +2 -2
- package/dist/sync-github.d.mts +2 -2
- package/dist/sync-github.mjs +2 -2
- package/dist/sync-linear.d.mts +3 -3
- package/dist/sync-linear.mjs +2 -2
- package/dist/sync-slack.d.mts +3 -3
- package/dist/sync-slack.mjs +12 -8
- package/dist/sync.d.mts +2 -2
- package/dist/sync.mjs +2 -2
- package/dist/{task-batch-CmKvTLSu.mjs → task-batch-CujTLmTB.mjs} +10 -11
- package/dist/{tokens-BCp4EWTQ.mjs → tokens-BmCDAT4N.mjs} +2 -2
- package/dist/version-BCoWGLEW.mjs +5 -0
- package/docs/01-board/01-mounting.md +8 -0
- package/docs/01-board/04-messages.md +6 -2
- package/docs/01-board/05-reading.md +17 -2
- package/docs/01-board/09-access.md +40 -6
- package/docs/01-board/11-tasks.md +3 -3
- package/docs/03-guides/02-inspector.md +31 -0
- package/docs/04-reference/01-cli.md +81 -32
- package/docs/04-reference/02-board.md +14 -3
- package/docs/04-reference/03-http.md +5 -3
- package/docs/04-reference/05-conformance.md +7 -0
- package/package.json +5 -1
- package/dist/inspect-CNECs4UG.mjs +0 -2
- package/dist/page-Dr9Aqlej.mjs +0 -2
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as authorView, D as TaskNote, E as TaskHoldKind, M as storable, T as TASK_NOTE_MAX, _ as OPEN_TASK_STATES, a as CAN_MAX, b as SeenActorKind, c as EDITED_HOLD, d as LabelKey, g as MessageText, h as MessageId, i as Author, j as platformAvatar, k as actorKind, l as Emoji, n as Attachment, o as CHANNEL_PATTERN_MAX, p as Labels, s as ChannelPath, t as ActorId, u as Handle, w as TASK_LABEL, y as RemoteWatcherId } from "./schemas-
|
|
3
|
-
import { a as Link, i as ExternalTarget, n as ExternalEvent, o as Origin } from "./external-
|
|
4
|
-
import "./routes-
|
|
5
|
-
import { a as
|
|
1
|
+
import { a as DIRECT_UPLOAD_BYTES_MAX, i as ATTACHMENT_BYTES_MAX, l as mediaType, o as IMPORT_BYTES_MAX, s as fileName } from "./profile-header-Cj0Cb1cf.mjs";
|
|
2
|
+
import { A as authorView, D as TaskNote, E as TaskHoldKind, M as storable, T as TASK_NOTE_MAX, _ as OPEN_TASK_STATES, a as CAN_MAX, b as SeenActorKind, c as EDITED_HOLD, d as LabelKey, g as MessageText, h as MessageId, i as Author, j as platformAvatar, k as actorKind, l as Emoji, n as Attachment, o as CHANNEL_PATTERN_MAX, p as Labels, s as ChannelPath, t as ActorId, u as Handle, w as TASK_LABEL, y as RemoteWatcherId } from "./schemas-TeVe4Udh.mjs";
|
|
3
|
+
import { a as Link, i as ExternalTarget, n as ExternalEvent, o as Origin } from "./external-BLI4W_-V.mjs";
|
|
4
|
+
import "./routes-qS92xz8U.mjs";
|
|
5
|
+
import { a as duplicateId, c as notFound, f as BoardError, i as batchTooLarge, l as textTooLong, m as duration, o as forbidden$1, r as badRequest, t as HttpError, u as toErrorResponse } from "./errors-DwV7I0g4.mjs";
|
|
6
|
+
import { a as waitUntil, c as platformProfile, d as userIdOf, h as isKeyIdOf, l as shownName, m as derivedId, n as MIDDLEWARE_ACTOR, o as actorParts, s as importedHandle, t as DroppedError } from "./middleware-ysFm2S4v.mjs";
|
|
6
7
|
import { a as SCHEMA_DESCRIPTION_MAX, c as canonical, d as parseSchemaId, f as schemaId, i as BUILT_IN_SCHEMAS, l as checkDefinition, n as blocksIn, o as SCHEMA_NAME, s as SCHEMA_VERSION_MAX, u as isBuiltInName } from "./blocks-CVoBC7ur.mjs";
|
|
7
8
|
import { a as replaceMentions, i as mentionTerms, n as isEmail, r as mentionTerm, t as extractMentions } from "./mentions-CnWt9Z5b.mjs";
|
|
8
|
-
import {
|
|
9
|
-
import { c as compileAccess, i as authorize, o as checkGrantChange, t as FULL_ACCESS, u as parseCan } from "./access-
|
|
10
|
-
import {
|
|
9
|
+
import { t as VERSION } from "./version-BCoWGLEW.mjs";
|
|
10
|
+
import { c as compileAccess, i as authorize, o as checkGrantChange, t as FULL_ACCESS, u as parseCan } from "./access-B8DnrnHa.mjs";
|
|
11
|
+
import { a as runMatch, h as SYNC, i as canonicalWatchers, l as METHODS, n as SYNC_ACTOR, o as compileWatcher, r as syncTarget, s as hasCriteria, t as batchPlan } from "./task-batch-CujTLmTB.mjs";
|
|
12
|
+
import { T as wroteAs, b as removes, c as checkCan, g as joined, h as issuerName, l as checkGrant, n as GITHUB_ISSUER, p as grantIssuers, s as authenticates, u as checkPrincipal, w as workflowPath } from "./auth-CEU06Nyp.mjs";
|
|
11
13
|
import { n as setOwn, t as own } from "./own-OwgPWdmh.mjs";
|
|
12
|
-
import { i as ownedActor, n as actorSeen, o as viaOf } from "./actors-
|
|
14
|
+
import { i as ownedActor, n as actorSeen, o as viaOf } from "./actors-DewJKyqy.mjs";
|
|
13
15
|
import { C as sessionClearedError, a as SOCKET_TIMINGS, c as drainSettledHooks, d as nullProtoRecord, f as runtimeConsumerFactory, g as A2Error, h as stateTailReaders, i as RESERVED_PARTICIPANT_IDS, l as failedPreviousAttempt, m as serverInternals, n as POLL_TIMINGS, o as STATE_CACHE, p as runtimeConsumers, r as PRESENCE_TIMINGS, s as STREAM_TIMINGS, t as DRAIN_TIMINGS, u as markSchedulerSendFailure, v as NonRetriableError, x as isSessionCleared, y as asStoreUnavailable } from "./internal-CvsrprnU-CEPOUpAv.mjs";
|
|
14
16
|
import { i as streamActivities, n as defaultSleep, t as createStreamActivity } from "./store-polling-BZt2Rf3D-oh3aU_An.mjs";
|
|
15
|
-
import { a as foldActors, i as concernedMessageId, o as foldMessages, s as iso, t as TABLES_CONSUMER } from "./sql-
|
|
17
|
+
import { a as foldActors, i as concernedMessageId, o as foldMessages, s as iso, t as TABLES_CONSUMER } from "./sql-DIKQd5Me.mjs";
|
|
16
18
|
import { z } from "zod";
|
|
17
19
|
import { createHash, randomBytes, timingSafeEqual } from "node:crypto";
|
|
18
20
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
@@ -6117,17 +6119,44 @@ async function changerAccess({ principal }, grants, accessIn) {
|
|
|
6117
6119
|
own
|
|
6118
6120
|
};
|
|
6119
6121
|
}
|
|
6122
|
+
const NO_ACCESS = compileAccess([]);
|
|
6120
6123
|
/**
|
|
6121
|
-
*
|
|
6122
|
-
* `
|
|
6123
|
-
*
|
|
6124
|
-
* involves a stored grant names its patterns only to whoever may list the grants.
|
|
6124
|
+
* What `identity`'s grant write is judged by on `before`, the grants it appends to: null for an
|
|
6125
|
+
* owner no `x-board-can` narrows. With `left`, the grants as the write would leave them, a lockout
|
|
6126
|
+
* is judged too: a caller that says `lockMeOut` passes none.
|
|
6125
6127
|
*/
|
|
6126
|
-
async function
|
|
6128
|
+
async function standingOf(identity, before, accessIn, left) {
|
|
6127
6129
|
const access = await changerAccess(identity, before, accessIn);
|
|
6128
|
-
if (access === null) return;
|
|
6129
|
-
const
|
|
6130
|
+
if (access === null || left === void 0) return access;
|
|
6131
|
+
const { principal } = identity;
|
|
6132
|
+
if (isOwner(principal)) return {
|
|
6133
|
+
...access,
|
|
6134
|
+
then: access
|
|
6135
|
+
};
|
|
6136
|
+
const [caller, own] = await Promise.all([accessIn(principal, left), accessIn(principal, withoutEveryone(left))]);
|
|
6137
|
+
return {
|
|
6130
6138
|
...access,
|
|
6139
|
+
then: {
|
|
6140
|
+
caller: caller ?? NO_ACCESS,
|
|
6141
|
+
own: own ?? NO_ACCESS
|
|
6142
|
+
}
|
|
6143
|
+
};
|
|
6144
|
+
}
|
|
6145
|
+
const THIS_GRANT = {
|
|
6146
|
+
what: "this grant",
|
|
6147
|
+
doing: "this grant"
|
|
6148
|
+
};
|
|
6149
|
+
/**
|
|
6150
|
+
* A refusal unless `standing` may change grants so, with `after` as they'd be:
|
|
6151
|
+
* `checkGrantChange`'s rule, which Vercel's API runs too. `changed` is a grant made or widened,
|
|
6152
|
+
* `revoked` one revoked, removed from, or updated, as it was. What the caller may not do is a 403;
|
|
6153
|
+
* what it may, and couldn't take back, a 409 `grant_lockout`. A refusal that involves a stored
|
|
6154
|
+
* grant names its patterns only to whoever may list the grants.
|
|
6155
|
+
*/
|
|
6156
|
+
function judge(identity, standing, change, after, { what, doing } = THIS_GRANT) {
|
|
6157
|
+
if (standing === null) return;
|
|
6158
|
+
const refused = checkGrantChange({
|
|
6159
|
+
...standing,
|
|
6131
6160
|
after,
|
|
6132
6161
|
...change
|
|
6133
6162
|
});
|
|
@@ -6135,17 +6164,29 @@ async function mayGrant(identity, change, before, after, accessIn, what = "this
|
|
|
6135
6164
|
if (change.revoked && !lists(identity)) throw unreachable(what);
|
|
6136
6165
|
throw forbidden$1(`${change.revoked ? `this token can't ${what}: it` : what} reaches ${refused.pattern}, where you can't manage grants`);
|
|
6137
6166
|
}
|
|
6167
|
+
if (refused?.reason === "lockout") {
|
|
6168
|
+
const where = change.revoked && !lists(identity) ? "where it reaches" : `in ${refused.pattern}`;
|
|
6169
|
+
throw new HttpError(409, "grant_lockout", `${doing} would leave you unable to manage grants ${where}`, { hint: "Name yourself with manage there, in a grant made before it or in the same write. Or send lockMeOut to go ahead: only someone who still manages grants there could change it then." });
|
|
6170
|
+
}
|
|
6138
6171
|
if (refused) throw forbidden$1(`you can't let anyone in: everyone gets ${refused.permission} in ${refused.pattern}, which you can't`);
|
|
6139
6172
|
}
|
|
6173
|
+
/** `judge`, for a write that asks once: on `before`, the grants it appends to, and for a lockout, on `left`. */
|
|
6174
|
+
async function mayGrant(identity, change, before, after, accessIn, named = THIS_GRANT, left) {
|
|
6175
|
+
judge(identity, await standingOf(identity, before, accessIn, left), change, after, named);
|
|
6176
|
+
}
|
|
6140
6177
|
/** An oidc principal: naming one makes the board fetch its issuer's keys, so it takes manage everywhere. */
|
|
6141
6178
|
const namesIssuer = (principals) => principals.some((principal) => principal.kind === "oidc");
|
|
6179
|
+
const ISSUER = {
|
|
6180
|
+
what: "naming an oidc issuer",
|
|
6181
|
+
doing: "naming an oidc issuer"
|
|
6182
|
+
};
|
|
6142
6183
|
/**
|
|
6143
6184
|
* The event that makes `input`'s change to a grant in `state`, or why it can't: manage at its
|
|
6144
6185
|
* patterns, and to add principals or set `can`, what making it would take, and manage everywhere to
|
|
6145
6186
|
* name an oidc issuer. A removal goes by who a principal is; an add joins one the grant names
|
|
6146
6187
|
* already. `issuers` are the ones the board's rules trust.
|
|
6147
6188
|
*/
|
|
6148
|
-
async function updated(identity, state, { id, add, remove, can }, issuers, accessIn, team, logins) {
|
|
6189
|
+
async function updated(identity, state, { id, add, remove, can, lockMeOut }, issuers, accessIn, team, logins) {
|
|
6149
6190
|
const index = indexOf(id);
|
|
6150
6191
|
const row = index === null ? void 0 : state.grants[index];
|
|
6151
6192
|
if (!row) {
|
|
@@ -6153,7 +6194,11 @@ async function updated(identity, state, { id, add, remove, can }, issuers, acces
|
|
|
6153
6194
|
throw notFound(`grant not found: ${id}`, "grant_not_found");
|
|
6154
6195
|
}
|
|
6155
6196
|
const before = Object.values(state.grants).map(storedGrant);
|
|
6156
|
-
|
|
6197
|
+
const named = {
|
|
6198
|
+
what: `update ${id}`,
|
|
6199
|
+
doing: `updating ${id}`
|
|
6200
|
+
};
|
|
6201
|
+
await mayGrant(identity, { revoked: row }, before, before.filter((other) => other.id !== storedGrant(row).id), accessIn, named);
|
|
6157
6202
|
const others = grantIssuers(Object.values(state.grants).filter((other) => other.id !== row.id).map(storedGrant));
|
|
6158
6203
|
let principals = [...row.principals];
|
|
6159
6204
|
for (const input of remove ?? []) {
|
|
@@ -6175,15 +6220,16 @@ async function updated(identity, state, { id, add, remove, can }, issuers, acces
|
|
|
6175
6220
|
if (principals.length === 0) throw badRequest(`that leaves ${id} naming no one: revoke it instead`, "grant_empty");
|
|
6176
6221
|
if (principals.length > 32) throw badRequest("a grant names at most 32 principals", "invalid_grant");
|
|
6177
6222
|
const next = can === void 0 ? row.can : checkCan(can);
|
|
6178
|
-
const after = [...
|
|
6223
|
+
const after = [...before.filter((other) => other.id !== storedGrant(row).id), {
|
|
6224
|
+
id: storedGrant(row).id,
|
|
6179
6225
|
principals,
|
|
6180
6226
|
can: next
|
|
6181
6227
|
}];
|
|
6182
6228
|
await mayGrant(identity, {
|
|
6183
6229
|
revoked: row,
|
|
6184
6230
|
...add !== void 0 || can !== void 0 ? { changed: { can: next } } : {}
|
|
6185
|
-
}, before, after, accessIn,
|
|
6186
|
-
if (namesIssuer(principals.filter((principal) => !row.principals.includes(principal)))) await mayGrant(identity, { changed: { can: { "*": "all" } } }, before, after, accessIn,
|
|
6231
|
+
}, before, after, accessIn, named, lockMeOut ? void 0 : after);
|
|
6232
|
+
if (namesIssuer(principals.filter((principal) => !row.principals.includes(principal)))) await mayGrant(identity, { changed: { can: { "*": "all" } } }, before, after, accessIn, ISSUER);
|
|
6187
6233
|
return {
|
|
6188
6234
|
type: "grant.updated",
|
|
6189
6235
|
payload: {
|
|
@@ -6209,35 +6255,66 @@ function createTrust(options) {
|
|
|
6209
6255
|
const read = async () => (await session.state(accessReducer)).state;
|
|
6210
6256
|
/** The grants as they are now, and the index a conditional write holds them at. */
|
|
6211
6257
|
const latest = () => session.state(accessReducer, { through: "latest" });
|
|
6258
|
+
const trust = { async grants() {
|
|
6259
|
+
return Object.values((await read()).grants).map(storedGrant);
|
|
6260
|
+
} };
|
|
6261
|
+
/**
|
|
6262
|
+
* Makes `bodies`' grants in one append, all or none, in the order given. Each is judged on the
|
|
6263
|
+
* grants as they are when it lands (another write in between makes it look again), admission and
|
|
6264
|
+
* a lockout with all of them made: so a lock and the grant that keeps its maker in pass
|
|
6265
|
+
* together, whichever comes first.
|
|
6266
|
+
*/
|
|
6267
|
+
async function create(identity, bodies, lockMeOut) {
|
|
6268
|
+
const team = await options.team();
|
|
6269
|
+
const rows = await whileHeadMoves(async () => {
|
|
6270
|
+
const { state, index } = await latest();
|
|
6271
|
+
const before = Object.values(state.grants).map(storedGrant);
|
|
6272
|
+
const made = [];
|
|
6273
|
+
for (const body of bodies) made.push({
|
|
6274
|
+
id: grantId(state.nextGrant + made.length),
|
|
6275
|
+
...checkGrant(body, grantIssuers([...before, ...made]), team, logins())
|
|
6276
|
+
});
|
|
6277
|
+
const after = [...before, ...made];
|
|
6278
|
+
const standing = await standingOf(identity, before, accessIn, lockMeOut ? void 0 : after);
|
|
6279
|
+
made.forEach((grant, at) => {
|
|
6280
|
+
const named = made.length === 1 ? THIS_GRANT : {
|
|
6281
|
+
what: `grant ${at + 1} of ${made.length}`,
|
|
6282
|
+
doing: `grant ${at + 1} of ${made.length}`
|
|
6283
|
+
};
|
|
6284
|
+
judge(identity, standing, { changed: grant }, after, named);
|
|
6285
|
+
if (namesIssuer(grant.principals)) judge(identity, standing && {
|
|
6286
|
+
caller: standing.caller,
|
|
6287
|
+
own: standing.own
|
|
6288
|
+
}, { changed: { can: { "*": "all" } } }, after, ISSUER);
|
|
6289
|
+
});
|
|
6290
|
+
return session.append.ifLastIndex(index, ...made.map((grant) => ({
|
|
6291
|
+
type: "grant.created",
|
|
6292
|
+
payload: {
|
|
6293
|
+
principals: grant.principals,
|
|
6294
|
+
can: grant.can,
|
|
6295
|
+
by: identity.actor.id
|
|
6296
|
+
}
|
|
6297
|
+
})));
|
|
6298
|
+
});
|
|
6299
|
+
const { grants } = await read();
|
|
6300
|
+
return rows.map((row) => {
|
|
6301
|
+
const made = Object.values(grants).find((grant) => grant.event === row.index);
|
|
6302
|
+
if (!made) throw new Error("a grant was made but its log has no record of it");
|
|
6303
|
+
return grantView(made);
|
|
6304
|
+
});
|
|
6305
|
+
}
|
|
6212
6306
|
return {
|
|
6213
|
-
trust
|
|
6214
|
-
return Object.values((await read()).grants).map(storedGrant);
|
|
6215
|
-
} },
|
|
6307
|
+
trust,
|
|
6216
6308
|
async grants(identity) {
|
|
6217
6309
|
mayList(identity, "list grants");
|
|
6218
6310
|
return { grants: Object.values((await read()).grants).sort((a, b) => a.id - b.id).map(grantView) };
|
|
6219
6311
|
},
|
|
6220
|
-
async createGrant(identity, body) {
|
|
6221
|
-
const
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
const after = [...before, checked];
|
|
6227
|
-
await mayGrant(identity, { changed: checked }, before, after, accessIn);
|
|
6228
|
-
if (namesIssuer(checked.principals)) await mayGrant(identity, { changed: { can: { "*": "all" } } }, before, after, accessIn, "naming an oidc issuer");
|
|
6229
|
-
return session.append.ifLastIndex(index, {
|
|
6230
|
-
type: "grant.created",
|
|
6231
|
-
payload: {
|
|
6232
|
-
principals: checked.principals,
|
|
6233
|
-
can: checked.can,
|
|
6234
|
-
by: identity.actor.id
|
|
6235
|
-
}
|
|
6236
|
-
});
|
|
6237
|
-
});
|
|
6238
|
-
const made = row && Object.values((await read()).grants).find((grant) => grant.event === row.index);
|
|
6239
|
-
if (!made) throw new Error("a grant was made but its log has no record of it");
|
|
6240
|
-
return { grant: grantView(made) };
|
|
6312
|
+
async createGrant(identity, { lockMeOut, ...body }) {
|
|
6313
|
+
const [grant] = await create(identity, [body], lockMeOut);
|
|
6314
|
+
return { grant };
|
|
6315
|
+
},
|
|
6316
|
+
async createGrants(identity, { grants, lockMeOut }) {
|
|
6317
|
+
return { grants: await create(identity, grants, lockMeOut) };
|
|
6241
6318
|
},
|
|
6242
6319
|
async updateGrant(identity, input) {
|
|
6243
6320
|
const team = await options.team();
|
|
@@ -6285,7 +6362,7 @@ function createTrust(options) {
|
|
|
6285
6362
|
can: decided.permissions
|
|
6286
6363
|
};
|
|
6287
6364
|
},
|
|
6288
|
-
async revokeGrant(identity, { id }) {
|
|
6365
|
+
async revokeGrant(identity, { id, lockMeOut }) {
|
|
6289
6366
|
return whileHeadMoves(async () => {
|
|
6290
6367
|
const { state, index } = await latest();
|
|
6291
6368
|
const at = indexOf(id);
|
|
@@ -6295,7 +6372,11 @@ function createTrust(options) {
|
|
|
6295
6372
|
return { revoked: false };
|
|
6296
6373
|
}
|
|
6297
6374
|
const before = Object.values(state.grants).map(storedGrant);
|
|
6298
|
-
|
|
6375
|
+
const after = before.filter((other) => other.id !== storedGrant(row).id);
|
|
6376
|
+
await mayGrant(identity, { revoked: row }, before, after, accessIn, {
|
|
6377
|
+
what: `revoke ${id}`,
|
|
6378
|
+
doing: `revoking ${id}`
|
|
6379
|
+
}, lockMeOut ? void 0 : after);
|
|
6299
6380
|
await session.append.ifLastIndex(index, {
|
|
6300
6381
|
type: "grant.deleted",
|
|
6301
6382
|
payload: {
|
|
@@ -9490,6 +9571,7 @@ function build(options, binding) {
|
|
|
9490
9571
|
},
|
|
9491
9572
|
grants: async (caller) => access.grants(await identityOf(caller)),
|
|
9492
9573
|
createGrant: async (caller, body) => access.createGrant(await identityOf(caller), body),
|
|
9574
|
+
createGrants: async (caller, body) => access.createGrants(await identityOf(caller), body),
|
|
9493
9575
|
updateGrant: async (caller, input) => access.updateGrant(await identityOf(caller), input),
|
|
9494
9576
|
explain: async (caller, query) => access.explain(await identityOf(caller), query),
|
|
9495
9577
|
revokeGrant: async (caller, input) => access.revokeGrant(await identityOf(caller), input),
|
|
@@ -10388,10 +10470,10 @@ function local(options = {}) {
|
|
|
10388
10470
|
opening ??= (async () => {
|
|
10389
10471
|
const file = localFile(bound.name);
|
|
10390
10472
|
let store;
|
|
10391
|
-
if (options.memory) store = (await import("./memory-
|
|
10473
|
+
if (options.memory) store = (await import("./memory-DzqkXIB-.mjs")).memory();
|
|
10392
10474
|
else {
|
|
10393
10475
|
const { mkdir } = await import("node:fs/promises");
|
|
10394
|
-
const { sqlite } = await import("./sqlite-
|
|
10476
|
+
const { sqlite } = await import("./sqlite-BF9kBDh1.mjs");
|
|
10395
10477
|
const path = join(dir, `${file}.db`);
|
|
10396
10478
|
try {
|
|
10397
10479
|
await mkdir(dir, {
|