@coffre/ui 0.4.1 → 0.4.2
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/chunks/{connected-apps-CUOyEZXR.js → connected-apps-D8Df97-F.js} +2 -2
- package/dist/chunks/{connected-apps-CUOyEZXR.js.map → connected-apps-D8Df97-F.js.map} +1 -1
- package/dist/chunks/{delete-place-CRX7ntE8.js → delete-place-LYN7z7xb.js} +3 -3
- package/dist/chunks/{delete-place-CRX7ntE8.js.map → delete-place-LYN7z7xb.js.map} +1 -1
- package/dist/chunks/{directory-CxxrnGUL.js → directory-v87HGjEn.js} +4 -4
- package/dist/chunks/{directory-CxxrnGUL.js.map → directory-v87HGjEn.js.map} +1 -1
- package/dist/chunks/{folders-DoBmCwOi.js → folders-CbGU0xOz.js} +2 -2
- package/dist/chunks/{folders-DoBmCwOi.js.map → folders-CbGU0xOz.js.map} +1 -1
- package/dist/chunks/{grants-CXcmhujY.js → grants-9kIV6uZ7.js} +5 -5
- package/dist/chunks/{grants-CXcmhujY.js.map → grants-9kIV6uZ7.js.map} +1 -1
- package/dist/chunks/{offboarding-6eAduCsM.js → offboarding-DdnmRV1f.js} +2 -2
- package/dist/chunks/{offboarding-6eAduCsM.js.map → offboarding-DdnmRV1f.js.map} +1 -1
- package/dist/chunks/{principal-page-B9R2zPlp.js → principal-page-BubEO6-b.js} +10 -10
- package/dist/chunks/{principal-page-B9R2zPlp.js.map → principal-page-BubEO6-b.js.map} +1 -1
- package/dist/chunks/{project-page-SRCtRe2g.js → project-page-C4cEaRFa.js} +2 -2
- package/dist/chunks/{project-page-SRCtRe2g.js.map → project-page-C4cEaRFa.js.map} +1 -1
- package/dist/chunks/{queries-DVR_i3rA.js → queries-Dew8mIeo.js} +3 -3
- package/dist/chunks/queries-Dew8mIeo.js.map +1 -0
- package/dist/chunks/{references-B6pLT1uQ.js → references-DPSYdWOk.js} +3 -3
- package/dist/chunks/{references-B6pLT1uQ.js.map → references-DPSYdWOk.js.map} +1 -1
- package/dist/chunks/{use-change-CZdI2MJG.js → use-change-C4bGRhHY.js} +2 -2
- package/dist/chunks/{use-change-CZdI2MJG.js.map → use-change-C4bGRhHY.js.map} +1 -1
- package/dist/chunks/{use-shell-rNKfGjdj.js → use-shell-Dkv89nW1.js} +2 -2
- package/dist/chunks/{use-shell-rNKfGjdj.js.map → use-shell-Dkv89nW1.js.map} +1 -1
- package/dist/chunks/{validation-D312_NLf.js → validation-DvPinn8V.js} +2 -2
- package/dist/chunks/{validation-D312_NLf.js.map → validation-DvPinn8V.js.map} +1 -1
- package/dist/index.d.ts +25 -6
- package/dist/index.js +36 -8
- package/dist/index.js.map +1 -1
- package/dist/pages/account.d.ts +13 -3
- package/dist/pages/account.js +165 -76
- package/dist/pages/account.js.map +1 -1
- package/dist/pages/audit.js +1 -1
- package/dist/pages/environment.js +9 -10
- package/dist/pages/environment.js.map +1 -1
- package/dist/pages/login.js +1 -1
- package/dist/pages/oauth-authorize.d.ts +2 -1
- package/dist/pages/oauth-authorize.js +12 -8
- package/dist/pages/oauth-authorize.js.map +1 -1
- package/dist/pages/project-access.js +7 -7
- package/dist/pages/project-environments.js +8 -8
- package/dist/pages/project-settings.js +6 -6
- package/dist/pages/project.js +2 -2
- package/dist/pages/projects.js +6 -6
- package/dist/pages/service-account.js +6 -6
- package/dist/pages/service-account.js.map +1 -1
- package/dist/pages/service-accounts.js +4 -4
- package/dist/pages/settings.js +2 -2
- package/dist/pages/unregistered.js +1 -1
- package/dist/pages/user.js +1 -1
- package/dist/pages/users.js +4 -4
- package/package.json +3 -3
- package/src/components/service-tokens.tsx +1 -1
- package/src/index.ts +4 -0
- package/src/lib/queries.ts +2 -2
- package/src/options.ts +41 -6
- package/src/pages/account.tsx +138 -60
- package/src/pages/environment.tsx +2 -2
- package/src/pages/oauth-authorize.tsx +10 -7
- package/src/parity.ts +4 -4
- package/src/register.ts +13 -3
- package/src/shared/models.ts +1 -1
- package/src/styles/globals.css +9 -4
- package/dist/chunks/queries-DVR_i3rA.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queries-DVR_i3rA.js","names":[],"sources":["../../src/lib/capabilities.ts","../../src/lib/queries.ts"],"sourcesContent":["import type { Me, Permission, ProjectSummary } from '../shared/models';\n\n/**\n * The small set of instance-wide decisions the shell has to make.\n *\n * Resource-specific controls still use the permissions returned for that\n * project or environment. These are only the capabilities whose affordances\n * live outside one resource page.\n */\nexport type UiCapabilities = {\n canManageGrants: boolean;\n canReadAudit: boolean;\n canCreateProject: boolean;\n};\n\nconst NONE: UiCapabilities = {\n canManageGrants: false,\n canReadAudit: false,\n canCreateProject: false,\n};\n\nexport function deriveUiCapabilities(\n me: Me | null,\n projects: readonly ProjectSummary[],\n): UiCapabilities {\n if (me === null) return NONE;\n\n const canManageInstance =\n me.instanceRole === 'owner' || me.instanceRole === 'root-admin';\n\n return {\n // Users and Tokens manage the instance directory, not project grants.\n // Project access managers keep their grant controls on each project page.\n canManageGrants: canManageInstance,\n canReadAudit: me.canReadAudit,\n // Project creation has no resource on which to hold a grant, so it follows\n // the instance-wide owner role (including configured root admins).\n canCreateProject: canManageInstance,\n };\n}\n\n/** Secret values are available only where the API reports secret.read. */\nexport function canRevealSecrets(permissions: readonly Permission[]): boolean {\n return permissions.includes('secret.read');\n}\n","import type { AuthInfo, CoffreClient, Member } from '@coffre/client';\nimport { QueryClient, queryOptions, type QueryKey } from '@tanstack/react-query';\n\nimport { deriveUiCapabilities } from './capabilities.ts';\nimport { memberRef, statusOf, uiResult } from './coffre.ts';\nimport type { DirectoryPrincipal, GrantRow, Me, ProjectSummary } from '../shared/models';\n\n/**\n * Every read the pages make, cached by TanStack Query: one cache per request\n * on the server, whose reads the page carries to the browser's, and one in the\n * browser for the whole visit.\n *\n * How fresh a page is. A read is reused for `FRESH_MS`, refetched when the\n * window regains focus, and refetched at once by any change made here, which\n * names what it touches (`affects`), so your own changes always show.\n * Someone else's change shows within that window. Nothing is decided on a\n * cached read: the server authorizes every call, so a stale screen can offer\n * an action the server then refuses, never grant one. The audit log and the\n * chain's verification are the exception, read fresh on every visit: their\n * whole point is to be current.\n */\nexport const FRESH_MS = 10_000;\n\nexport function createQueryClient(): QueryClient {\n return new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: FRESH_MS,\n refetchOnWindowFocus: true,\n // A read either answers or says why it cannot (`uiResult`), so a\n // throw is a fault, and asking again would only repeat it.\n retry: false,\n },\n },\n });\n}\n\ntype Place = { project: string; environment: string };\n\n/**\n * The keys, which `affects` names too. A project's keys start with it, so\n * one invalidation covers everything read under it.\n */\nexport const keys = {\n me: ['me'],\n auth: ['auth'],\n projects: ['projects'],\n grants: (project: string) => ['grants', project],\n secrets: ({ project, environment }: Place) => ['secrets', project, environment],\n references: (path: string) => ['references', path],\n missing: ({ project, environment }: Place) => ['missing', project, environment],\n directory: ['directory'],\n report: (member: string) => ['report', member],\n credentials: (member: string) => ['credentials', member],\n bindings: (member: string) => ['bindings', member],\n identities: ['identities'],\n sessions: ['sessions'],\n apps: ['apps'],\n audit: ['audit'],\n auditKeys: ['audit', 'keys'],\n} satisfies Record<string, QueryKey | ((...args: never[]) => QueryKey)>;\n\n/** One member's grants, as rows. */\nfunction grantRows(members: Member[]): GrantRow[] {\n return members.flatMap((member) =>\n member.grants.map((grant) => ({\n id: grant.id,\n principalType: member.principalType,\n principalId: member.principalId,\n role: grant.role,\n roleName: grant.roleName,\n permissions: grant.permissions,\n scope: grant.project === '*' ? ('every-project' as const) : grant.environment === null ? ('project' as const) : ('environment' as const),\n environmentSlug: grant.environment,\n expiresAt: grant.expiresAt,\n })),\n );\n}\n\nfunction listDirectory(client: CoffreClient) {\n return uiResult(async () => {\n const { members, removed } = await client.members.list();\n const principals: DirectoryPrincipal[] = members.map(\n ({ principalType, principalId, instanceRole, isRootAdmin, tampered, grants }) => ({\n principalType,\n principalId,\n instanceRole,\n isRootAdmin,\n tampered,\n grants: grants.map(({ project, environment }) => ({ project, environment })),\n }),\n );\n return { principals, removed };\n });\n}\n\nconst readProjects = (client: CoffreClient) => uiResult(() => client.projects.list());\n\n/** The projects you can see, or why they could not be listed. */\nexport type ProjectsResult = Awaited<ReturnType<typeof readProjects>>;\n\nexport type AuditSearch = { decision?: 'deny'; actorId?: string; detail?: '1' };\n\nexport const AUDIT_PAGE_SIZE = 200;\n\nexport const queries = {\n /** Who is looking; null when nobody is signed in. */\n me: (client: CoffreClient) =>\n queryOptions({\n queryKey: keys.me,\n queryFn: async (): Promise<Me | null> => {\n try {\n return await client.me();\n } catch (error) {\n if (statusOf(error) === 401) return null;\n throw error;\n }\n },\n }),\n\n /** How this instance signs people in. */\n auth: (client: CoffreClient) => queryOptions({ queryKey: keys.auth, queryFn: (): Promise<AuthInfo> => client.auth() }),\n\n /** The projects you can see, each with its distinct secret count. */\n projects: (client: CoffreClient) =>\n queryOptions({ queryKey: keys.projects, queryFn: () => readProjects(client) }),\n\n /** Who holds what in a project, for those who manage its access. */\n grants: (client: CoffreClient, project: string) =>\n queryOptions({\n queryKey: keys.grants(project),\n queryFn: () => uiResult(async () => ({ grants: grantRows((await client.members.list(project)).members) })),\n }),\n\n secrets: (client: CoffreClient, place: Place) =>\n queryOptions({\n queryKey: keys.secrets(place),\n queryFn: () => uiResult(() => client.secrets.list(`${place.project}/${place.environment}`)),\n }),\n\n /** What an environment lacks of its siblings' keys, those you read, and what its team dismissed. */\n missing: (client: CoffreClient, place: Place) =>\n queryOptions({\n queryKey: keys.missing(place),\n queryFn: () => uiResult(() => client.environments.missing(`${place.project}/${place.environment}`)),\n }),\n\n /** The live references into and out of a place, and who reads through them, for whoever manages its access. */\n references: (client: CoffreClient, path: string) =>\n queryOptions({\n queryKey: keys.references(path),\n queryFn: () => uiResult(() => client.references.list(path)),\n }),\n\n /**\n * Everyone in the directory, and who was removed. The API shows grant\n * managers the members of their projects; the directory pages stay the\n * owners' own, and asking for anyone else would only log a refusal, so\n * nobody else is asked.\n */\n directory: (client: CoffreClient, owner: boolean) =>\n queryOptions({\n queryKey: [...keys.directory, { owner }],\n queryFn: () =>\n owner\n ? listDirectory(client)\n : Promise.resolve({\n ok: false as const,\n error: 'Only owners can manage users and service accounts.',\n signedOut: false,\n }),\n }),\n\n /** What one member can reach and has seen; null for anyone but owners, who alone may ask. */\n report: (client: CoffreClient, member: string, owner: boolean) =>\n queryOptions({\n queryKey: [...keys.report(member), { owner }],\n queryFn: () =>\n owner\n ? uiResult(async () => {\n try {\n return { report: await client.members.get(member) };\n } catch (error) {\n // No such member is an answer, not a failure.\n if (statusOf(error) === 404) return { report: null };\n throw error;\n }\n })\n : Promise.resolve(null),\n }),\n\n /**\n * A token's credentials; null where they cannot be listed. Only owners\n * issue and see them, and only coffre's own sign-in issues any.\n */\n credentials: (client: CoffreClient, member: string, allowed: boolean) =>\n queryOptions({\n queryKey: [...keys.credentials(member), { allowed }],\n queryFn: () => (allowed ? uiResult(() => client.tokens.list(member)) : Promise.resolve(null)),\n }),\n\n /**\n * A token's trust bindings: the CI runs that may sign in as it. Null for\n * anyone but an owner, and where the deployment trusts no workloads\n * (`features.workloads`), so there is nothing to ask.\n */\n bindings: (client: CoffreClient, member: string, allowed: boolean) =>\n queryOptions({\n queryKey: [...keys.bindings(member), { allowed }],\n queryFn: () => (allowed ? uiResult(() => client.bindings.list(member)) : Promise.resolve(null)),\n }),\n\n /** The accounts you sign in with, under coffre's own sign-in. */\n identities: (client: CoffreClient) =>\n queryOptions({ queryKey: keys.identities, queryFn: () => uiResult(() => client.identities.list()) }),\n\n /** Where you are signed in, under coffre's own sign-in. */\n sessions: (client: CoffreClient) =>\n queryOptions({ queryKey: keys.sessions, queryFn: () => uiResult(() => client.sessions.list()) }),\n /** The MCP clients I connected, where the deployment serves MCP (`features.mcp`). */\n apps: (client: CoffreClient) =>\n queryOptions({ queryKey: keys.apps, queryFn: () => uiResult(() => client.apps.list()) }),\n\n /**\n * What the keys an operator keeps are checked against: the vault's ID and\n * the app key's fingerprint, no secret. Null for anyone but owners and root\n * admins, who alone may ask.\n */\n auditKeys: (client: CoffreClient, allowed: boolean) =>\n queryOptions({\n queryKey: [...keys.auditKeys, { allowed }],\n queryFn: () => (allowed ? uiResult(() => client.audit.keys()) : Promise.resolve(null)),\n }),\n\n /** A page of the log, as filtered: always read fresh. */\n auditEntries: (client: CoffreClient, search: AuditSearch) =>\n queryOptions({\n queryKey: [...keys.audit, 'entries', search],\n staleTime: 0,\n // Detail is left out by the server unless asked for, and counted.\n queryFn: () =>\n uiResult(() =>\n client.audit.list({\n limit: AUDIT_PAGE_SIZE,\n decision: search.decision,\n actor: search.actorId,\n detail: search.detail,\n }),\n ),\n }),\n\n /**\n * Whether the log holds: verified on every visit, and never waited for.\n * It re-reads the whole log, so it takes as long as the log is long; the\n * page shows the entries first and the verdict when it comes.\n */\n auditChain: (client: CoffreClient) =>\n queryOptions({ queryKey: [...keys.audit, 'chain'], staleTime: 0, queryFn: () => verifyChain(client) }),\n /** What deleting `market` or `market/prod` would take, asked afresh each time it is shown. */\n deletion: (client: CoffreClient, path: string) =>\n queryOptions({\n queryKey: ['deletion', path],\n staleTime: 0,\n gcTime: 0,\n queryFn: () =>\n uiResult(async () => {\n const { deletion } = path.includes('/')\n ? await client.environments.previewDelete(path)\n : await client.projects.previewDelete(path);\n return { deletion };\n }),\n }),\n};\n\n/**\n * Whether the log holds, or why that is not known. Verifying is for owners:\n * anyone else reads their projects' part of the log, and a part cannot be\n * checked as a chain, so for them it is a fact about the page, not a fault.\n */\nasync function verifyChain(client: CoffreClient) {\n try {\n const result = await client.audit.verify();\n return result.ok\n ? {\n integrity: 'intact' as const,\n through: result.through,\n entries: result.entries,\n checkpoint: result.checkpoint,\n pending: result.pending ?? 0,\n }\n : {\n integrity: 'broken' as const,\n through: result.through,\n failedAtSeq: result.failedAtSeq,\n author: result.author,\n reason: result.reason,\n };\n } catch (error) {\n const status = statusOf(error);\n if (status === 403) return { integrity: 'owners-only' as const };\n return {\n integrity: 'unknown' as const,\n problem: status === undefined ? 'the request never got an answer' : `the request failed with HTTP ${status}`,\n };\n }\n}\n\nexport type ChainResult = Awaited<ReturnType<typeof verifyChain>>;\n\n/**\n * Who is looking, how this instance signs people in, and the projects they\n * can see: what the shell needs on every screen. For someone signed out or\n * not yet a member the project list is refused, and they get the sign-in or\n * closed-door page.\n */\nexport function shellOf(\n auth: AuthInfo,\n me: Me | null,\n projects: ProjectsResult,\n) {\n const listed = projects.ok ? projects.projects : [];\n const member: Me | null = me?.registered === true ? me : null;\n return {\n auth,\n principal: me === null ? null : me.principal,\n instanceRole: member?.instanceRole ?? null,\n projects: listed,\n capabilities: deriveUiCapabilities(member, listed),\n registrationRequired: me !== null && !me.registered,\n /** A member the vault refuses: their record failed its integrity check. */\n accessTampered: me?.tampered === true,\n /** What the deployment's configuration turns on: MCP clients, and CI runs signing in by their ID tokens. */\n features: member?.features ?? { mcp: false, workloads: false },\n };\n}\n\nexport type Shell = ReturnType<typeof shellOf>;\n\n/**\n * The shell, as every loader reads it: from the cache while fresh, so a\n * child route never asks again for what the root has.\n */\nexport async function loadShell(queryClient: QueryClient, client: CoffreClient): Promise<Shell> {\n const [auth, me, projects] = await Promise.all([\n queryClient.fetchQuery(queries.auth(client)),\n queryClient.fetchQuery(queries.me(client)),\n queryClient.fetchQuery(queries.projects(client)),\n ]);\n return shellOf(auth, me, projects);\n}\n\n/**\n * One project and, when you manage its access, its grants. A project that is\n * not there for you fails with no message: the page words that itself.\n */\nexport function projectOf(projects: ProjectsResult, slug: string) {\n if (!projects.ok) return projects;\n const project = projects.projects.find((entry) => entry.slug === slug);\n if (project === undefined) return { ok: false as const, error: null };\n return { ok: true as const, project, managesAccess: project.permissions.includes('grant.manage') };\n}\n\n/** What a project page reads: the project list, and its grants when you manage them. */\nexport async function loadProject(queryClient: QueryClient, client: CoffreClient, slug: string) {\n const found = projectOf(await queryClient.fetchQuery(queries.projects(client)), slug);\n if (found.ok && found.managesAccess) await queryClient.fetchQuery(queries.grants(client, slug));\n}\n\n/** The directory pages' read: the directory, for owners. */\nexport async function loadDirectory(queryClient: QueryClient, client: CoffreClient) {\n const shell = await loadShell(queryClient, client);\n return queryClient.fetchQuery(queries.directory(client, shell.capabilities.canManageGrants));\n}\n\n/** The instance's settings: the directory's counts, and what its keys are checked against. */\nexport async function loadSettings(queryClient: QueryClient, client: CoffreClient) {\n const shell = await loadShell(queryClient, client);\n await Promise.all([\n loadDirectory(queryClient, client),\n queryClient.fetchQuery(queries.auditKeys(client, shell.capabilities.canManageGrants)),\n ]);\n}\n\n/**\n * The service accounts page: the directory, and each account's bindings and\n * tokens, read here as its own page reads them, so the list shows how each\n * signs in from the first paint and the browser asks for nothing that may be\n * refused (a deployment that trusts no workloads answers bindings with one).\n */\nexport async function loadServiceDirectory(queryClient: QueryClient, client: CoffreClient) {\n const shell = await loadShell(queryClient, client);\n const directory = await loadDirectory(queryClient, client);\n const allowed = shell.capabilities.canManageGrants && shell.auth.signin !== null;\n const trusts = shell.capabilities.canManageGrants && shell.features.workloads;\n if (!directory.ok || !allowed) return directory;\n await Promise.all(\n directory.principals\n .filter((principal) => principal.principalType === 'service')\n .flatMap((principal) => {\n const member = memberRef('service', principal.principalId);\n return [\n queryClient.fetchQuery(queries.credentials(client, member, allowed)),\n queryClient.fetchQuery(queries.bindings(client, member, trusts)),\n ];\n }),\n );\n return directory;\n}\n\n/** Who a user or service account is to the instance, its pages' header: null to anyone but an owner. */\nexport async function loadMember(queryClient: QueryClient, client: CoffreClient, member: string) {\n const shell = await loadShell(queryClient, client);\n return queryClient.fetchQuery(queries.report(client, member, shell.capabilities.canManageGrants));\n}\n\nexport type MemberReport = Awaited<ReturnType<typeof loadMember>>;\n\n/**\n * What a user's or service account's Access tab reads: the grants of every\n * project where you manage access. There is no \"grants of this member\"\n * call, so each project you manage is asked for its grants and the tab\n * keeps this member's. Projects where you do not hold grant.manage are\n * skipped rather than asked: the refusal would land in the audit log as a\n * denial in your name.\n */\nexport async function loadAccess(queryClient: QueryClient, client: CoffreClient) {\n const shell = await loadShell(queryClient, client);\n await Promise.all(managedProjects(shell.projects).map((project) => queryClient.fetchQuery(queries.grants(client, project.slug))));\n}\n\n/**\n * How a service account's page lets it sign in: bearer tokens under\n * coffre's own sign-in, trusted workloads where the deployment trusts them.\n * Null where it shows neither: to anyone but an owner, and for an account\n * that is not active, which can be issued nothing.\n */\nexport function signInWays(shell: Shell, report: MemberReport): { tokens: boolean; workloads: boolean } | null {\n const owner = shell.capabilities.canManageGrants;\n const ways = { tokens: owner && shell.auth.signin !== null, workloads: owner && shell.features.workloads };\n const active = report?.ok === true && report.report?.status === 'active';\n return active && (ways.tokens || ways.workloads) ? ways : null;\n}\n\nexport function managedProjects(projects: ProjectSummary[]): ProjectSummary[] {\n return projects.filter((project) => project.permissions.includes('grant.manage'));\n}\n\n/**\n * What each change touches, which `useAction` refetches when it lands. Every\n * change also lands in the audit log, which is always read fresh.\n */\nexport const affects = {\n /** A project or environment made, renamed or archived: the tree, and where you hold access. */\n places: (): QueryKey[] => [keys.projects, keys.me],\n /** Secrets written, renamed, restored or archived: the environment and the counts. */\n secrets: (place: Place): QueryKey[] => [keys.secrets(place), keys.projects, ['references'], ['missing']],\n /**\n * Someone's access in a project changed: its grants, their report, and, as\n * it may be your own, what you can see.\n */\n access: (project: string, member: string): QueryKey[] => [\n keys.grants(project),\n keys.report(member),\n keys.projects,\n keys.me,\n ],\n /**\n * Someone's access on every project changed: every project's grants, which\n * list it where it reaches, the list of them, their report, and what you\n * can see, as it may be your own.\n */\n everyProject: (member: string): QueryKey[] => [['grants'], keys.projects, keys.report(member), keys.me],\n /** Someone let in: the directory. */\n admission: (): QueryKey[] => [keys.directory],\n /**\n * An instance role changed: the directory, their report, and, as it may be\n * your own, what you can see and do.\n */\n role: (member: string): QueryKey[] => [keys.directory, keys.report(member), keys.me, keys.projects],\n /** Someone removed: the directory, their report, and every grant, which removal ends, those on every project too. */\n removal: (member: string): QueryKey[] => [keys.directory, keys.report(member), ['grants'], keys.projects],\n credentials: (member: string): QueryKey[] => [keys.credentials(member)],\n bindings: (member: string): QueryKey[] => [keys.bindings(member)],\n /** Unlinking an account also ends the sessions it signed in. */\n identities: (): QueryKey[] => [keys.identities, keys.sessions],\n sessions: (): QueryKey[] => [keys.sessions],\n apps: (): QueryKey[] => [keys.apps],\n};\n\n/**\n * Refetch what a change touched: at once where it is on screen, on next use\n * elsewhere. Every change lands in the audit log, so the log and its\n * verification are always among them.\n */\nexport async function refresh(queryClient: QueryClient, touched: QueryKey[]): Promise<void> {\n await Promise.all([...touched, keys.audit].map((queryKey) => queryClient.invalidateQueries({ queryKey })));\n}\n"],"mappings":";;;AAeA,IAAM,OAAuB;CAC3B,iBAAiB;CACjB,cAAc;CACd,kBAAkB;AACpB;AAEA,SAAgB,qBACd,IACA,UACgB;CAChB,IAAI,OAAO,MAAM,OAAO;CAExB,MAAM,oBACJ,GAAG,iBAAiB,WAAW,GAAG,iBAAiB;CAErD,OAAO;EAGL,iBAAiB;EACjB,cAAc,GAAG;EAGjB,kBAAkB;CACpB;AACF;;AAGA,SAAgB,iBAAiB,aAA6C;CAC5E,OAAO,YAAY,SAAS,aAAa;AAC3C;;;;;;;;;;;;;;;;;ACvBA,IAAa,WAAW;AAExB,SAAgB,oBAAiC;CAC/C,OAAO,IAAI,YAAY,EACrB,gBAAgB,EACd,SAAS;EACP,WAAW;EACX,sBAAsB;EAGtB,OAAO;CACT,EACF,EACF,CAAC;AACH;;;;;AAQA,IAAa,OAAO;CAClB,IAAI,CAAC,IAAI;CACT,MAAM,CAAC,MAAM;CACb,UAAU,CAAC,UAAU;CACrB,SAAS,YAAoB,CAAC,UAAU,OAAO;CAC/C,UAAU,EAAE,SAAS,kBAAyB;EAAC;EAAW;EAAS;CAAW;CAC9E,aAAa,SAAiB,CAAC,cAAc,IAAI;CACjD,UAAU,EAAE,SAAS,kBAAyB;EAAC;EAAW;EAAS;CAAW;CAC9E,WAAW,CAAC,WAAW;CACvB,SAAS,WAAmB,CAAC,UAAU,MAAM;CAC7C,cAAc,WAA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