Skip to content

Commit f50dfd4

Browse files
committed
fix: format error.
1 parent 7bf896e commit f50dfd4

13 files changed

Lines changed: 167 additions & 112 deletions

File tree

infrastructure/control-panel/src/lib/components/charts/GroupContributionDonut.svelte

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
<script lang="ts">
22
import { LayerCake, Svg } from 'layercake';
3-
import {
4-
GROUP_NO_SENDER_BUCKET_KEY,
5-
type GroupSenderRow
6-
} from '$lib/services/evaultService';
3+
import { GROUP_NO_SENDER_BUCKET_KEY, type GroupSenderRow } from '$lib/services/evaultService';
74
import GroupDonutArcs from './GroupDonutArcs.svelte';
85
96
interface Props {
@@ -127,16 +124,19 @@
127124
{#if s.evaultPageId}
128125
<a
129126
href="/evaults/{encodeURIComponent(s.evaultPageId)}"
130-
class="text-blue-600 hover:underline">{s.label}</a>
127+
class="text-blue-600 hover:underline">{s.label}</a
128+
>
131129
{:else}
132130
{s.label}
133131
{/if}
134132
</div>
135133
<div class="truncate font-mono text-xs text-gray-500">{s.sub}</div>
136134
</div>
137135
<div class="shrink-0 text-right text-gray-700 tabular-nums">
138-
<a href={messagesListHref(s.bucketKey)} class="text-blue-600 hover:underline"
139-
>{s.value}</a>
136+
<a
137+
href={messagesListHref(s.bucketKey)}
138+
class="text-blue-600 hover:underline">{s.value}</a
139+
>
140140
<span class="text-gray-400">({pct}%)</span>
141141
</div>
142142
</li>

infrastructure/control-panel/src/lib/components/charts/GroupDonutArcs.svelte

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
const sliceHref = (bucketKey: string) =>
2929
`/groups/${encodeURIComponent(groupEvaultId)}/messages?bucket=${encodeURIComponent(bucketKey)}`;
3030
31-
const pieLayout = pie<DonutSlice>().value((d) => d.value).sort(null);
31+
const pieLayout = pie<DonutSlice>()
32+
.value((d) => d.value)
33+
.sort(null);
3234
</script>
3335

3436
<g transform="translate({$width / 2},{$height / 2})">
@@ -42,10 +44,11 @@
4244
{#if d}
4345
<a
4446
href={sliceHref(a.data.bucketKey)}
45-
class="cursor-pointer outline-none transition-opacity hover:opacity-90 focus-visible:opacity-90"
47+
class="cursor-pointer transition-opacity outline-none hover:opacity-90 focus-visible:opacity-90"
4648
>
4749
<path {d} fill={a.data.color} stroke="#fff" stroke-width="1.5" class="outline-none">
48-
<title>{a.data.label} — {a.data.sub}: {a.data.value} messages (open list)</title>
50+
<title>{a.data.label} — {a.data.sub}: {a.data.value} messages (open list)</title
51+
>
4952
</path>
5053
</a>
5154
{/if}

infrastructure/control-panel/src/lib/server/evault.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ class EvaultService {
177177
}
178178
});
179179

180-
const allEdges: Array<{ node: { id: string; parsed: Record<string, unknown> | null } }> = [];
180+
const allEdges: Array<{ node: { id: string; parsed: Record<string, unknown> | null } }> =
181+
[];
181182
let afterCursor: string | null = null;
182183

183184
do {

infrastructure/control-panel/src/lib/server/group-message-buckets.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ export function normalizeW3id(s: string): string {
88
return s.trim().replace(/^@+/u, '').toLowerCase();
99
}
1010

11-
const UUID_RE =
12-
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
11+
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
1312

1413
export function isLikelyUuid(s: string): boolean {
1514
return UUID_RE.test(s.trim());
@@ -63,10 +62,7 @@ export function buildRegistryEnameLookup(vaults: RegistryVault[]): Map<string, s
6362
return map;
6463
}
6564

66-
function firstNonEmptyStringField(
67-
parsed: Record<string, unknown>,
68-
keys: string[]
69-
): string | null {
65+
function firstNonEmptyStringField(parsed: Record<string, unknown>, keys: string[]): string | null {
7066
for (const k of keys) {
7167
const v = parsed[k];
7268
if (typeof v === 'string' && v.trim().length > 0) {
@@ -77,7 +73,9 @@ function firstNonEmptyStringField(
7773
}
7874

7975
/** Raw sender id from payload (UUID / legacy), not used as the aggregation key when registry resolves. */
80-
export function rawMessageSenderId(parsed: Record<string, unknown> | null | undefined): string | null {
76+
export function rawMessageSenderId(
77+
parsed: Record<string, unknown> | null | undefined
78+
): string | null {
8179
if (!parsed || typeof parsed !== 'object') {
8280
return null;
8381
}
@@ -149,7 +147,9 @@ export function senderBucketKey(
149147
return NO_SENDER_BUCKET;
150148
}
151149

152-
export function previewMessageBody(parsed: Record<string, unknown> | undefined): string | undefined {
150+
export function previewMessageBody(
151+
parsed: Record<string, unknown> | undefined
152+
): string | undefined {
153153
if (!parsed) {
154154
return undefined;
155155
}
@@ -208,9 +208,7 @@ export function findSenderVaultForBucket(
208208
}
209209
}
210210

211-
return (
212-
vaults.find((x) => x.ename === trimmed || x.ename.toLowerCase() === lower) ?? null
213-
);
211+
return vaults.find((x) => x.ename === trimmed || x.ename.toLowerCase() === lower) ?? null;
214212
}
215213

216214
/** Segment for `/evaults/[id]` — matches client list `id === evault || ename`. */

infrastructure/control-panel/src/lib/server/group-sender-resolve.server.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ function collectLookupKeys(...parts: (string | null | undefined)[]): string[] {
124124
export function userRegistryRowsForProbe(rows: RegistryEvaultRow[]): RegistryEvaultRow[] {
125125
return rows.filter(
126126
(r) =>
127-
r.type === 'user' &&
128-
!(typeof r.name === 'string' && /platform$/i.test(r.name.trim()))
127+
r.type === 'user' && !(typeof r.name === 'string' && /platform$/i.test(r.name.trim()))
129128
);
130129
}
131130

@@ -231,10 +230,7 @@ async function resolveSenderDisplayName(
231230
return bucketKey;
232231
}
233232

234-
function firstNonEmptyStringField(
235-
parsed: Record<string, unknown>,
236-
keys: string[]
237-
): string | null {
233+
function firstNonEmptyStringField(parsed: Record<string, unknown>, keys: string[]): string | null {
238234
for (const k of keys) {
239235
const v = parsed[k];
240236
if (typeof v === 'string' && v.trim().length > 0) {
@@ -244,7 +240,9 @@ function firstNonEmptyStringField(
244240
return null;
245241
}
246242

247-
export function displayHintFromMessage(parsed: Record<string, unknown> | null | undefined): string | null {
243+
export function displayHintFromMessage(
244+
parsed: Record<string, unknown> | null | undefined
245+
): string | null {
248246
if (!parsed || typeof parsed !== 'object') {
249247
return null;
250248
}
@@ -315,9 +313,9 @@ export async function resolveSenderRowFields(
315313
const v = findSenderVaultForBucket(bucketKey, registryEnameLookup, allVaults);
316314
const peeledBucket = unwrapRelationIdDeep(bucketKey.trim());
317315
const enameFromPeel = peeledBucket
318-
? registryEnameLookup.get(peeledBucket) ??
316+
? (registryEnameLookup.get(peeledBucket) ??
319317
registryEnameLookup.get(peeledBucket.toLowerCase()) ??
320-
registryEnameLookup.get(normalizeW3id(peeledBucket))
318+
registryEnameLookup.get(normalizeW3id(peeledBucket)))
321319
: undefined;
322320
const enameCol =
323321
v?.ename?.trim() ??

infrastructure/control-panel/src/lib/services/cacheService.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ class CacheService {
2323
private db: any | null = null;
2424
private isInitialized = false;
2525
/** Server-only: MetaEnvelope id (message sender global id) → resolved display name; reduces cross-vault probes. */
26-
private senderProfileDisplayByGlobalId = new Map<string, { value: string; expiresAt: number }>();
26+
private senderProfileDisplayByGlobalId = new Map<
27+
string,
28+
{ value: string; expiresAt: number }
29+
>();
2730

2831
constructor() {
2932
// Only initialize on the server side

infrastructure/control-panel/src/lib/services/evaultService.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,11 @@ export class EVaultService {
216216
*/
217217
static async getBindingDocuments(
218218
evaultId: string
219-
): Promise<{ documents: BindingDocument[]; socialConnections: SocialConnection[]; eName: string }> {
219+
): Promise<{
220+
documents: BindingDocument[];
221+
socialConnections: SocialConnection[];
222+
eName: string;
223+
}> {
220224
try {
221225
const response = await fetch(
222226
`/api/evaults/${encodeURIComponent(evaultId)}/binding-documents`

infrastructure/control-panel/src/routes/+page.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,8 @@
466466
</script>
467467

468468
{#snippet ENameWithType(value: unknown)}
469-
{@const item = (value as { ename?: string; type?: 'user' | 'group' | 'unknown' } | null) ??
470-
null}
469+
{@const item =
470+
(value as { ename?: string; type?: 'user' | 'group' | 'unknown' } | null) ?? null}
471471
{@const ename = item?.ename || 'N/A'}
472472
{@const type = item?.type ?? 'unknown'}
473473
<div class="flex items-center gap-2 whitespace-nowrap">

infrastructure/control-panel/src/routes/api/evaults/[evaultId]/group-insights/+server.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ type SenderRow = {
7373
evaultPageId: string | null;
7474
};
7575

76-
async function mapInChunks<T, R>(items: T[], chunkSize: number, fn: (item: T) => Promise<R>): Promise<R[]> {
76+
async function mapInChunks<T, R>(
77+
items: T[],
78+
chunkSize: number,
79+
fn: (item: T) => Promise<R>
80+
): Promise<R[]> {
7781
const out: R[] = [];
7882
for (let i = 0; i < items.length; i += chunkSize) {
7983
const chunk = items.slice(i, i + chunkSize);
@@ -166,8 +170,7 @@ export const GET: RequestHandler = async ({ params, url }) => {
166170
if (!manifest) {
167171
return json(
168172
{
169-
error:
170-
'Could not load group manifest from this vault (not a group eVault, unreachable, or auth failed).'
173+
error: 'Could not load group manifest from this vault (not a group eVault, unreachable, or auth failed).'
171174
},
172175
{ status: 400 }
173176
);
@@ -230,7 +233,10 @@ export const GET: RequestHandler = async ({ params, url }) => {
230233
chatId: parsed?.chatId ?? null,
231234
isSystemMessage: parsed?.isSystemMessage ?? null,
232235
preview: previewMessageBody(parsed),
233-
parsedKeys: parsed && typeof parsed === 'object' ? Object.keys(parsed).sort() : []
236+
parsedKeys:
237+
parsed && typeof parsed === 'object'
238+
? Object.keys(parsed).sort()
239+
: []
234240
})
235241
);
236242
}

infrastructure/control-panel/src/routes/api/evaults/[evaultId]/group-messages/+server.ts

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -99,21 +99,24 @@ export const GET: RequestHandler = async ({ params, url }) => {
9999
const hintByBucket = new Map<string, Map<string, number>>();
100100
const userRowsForProbe = userRegistryRowsForProbe(registryRows);
101101
const probeRequestCache = new Map<string, string | null>();
102-
const { displayName: senderDisplayName, ename: senderEname } = await resolveSenderRowFields({
103-
bucketKey: filterBucket,
104-
allVaults,
105-
registryEnameLookup,
106-
token,
107-
dashboardNameByKey,
108-
hintByBucket,
109-
userRowsForProbe,
110-
probeRequestCache
111-
});
102+
const { displayName: senderDisplayName, ename: senderEname } = await resolveSenderRowFields(
103+
{
104+
bucketKey: filterBucket,
105+
allVaults,
106+
registryEnameLookup,
107+
token,
108+
dashboardNameByKey,
109+
hintByBucket,
110+
userRowsForProbe,
111+
probeRequestCache
112+
}
113+
);
112114

113115
const manifest = await fetchGroupManifestOrFallbackParsed(vault, token);
114-
const manifestRec = manifest && typeof manifest === 'object' && !Array.isArray(manifest)
115-
? (manifest as Record<string, unknown>)
116-
: null;
116+
const manifestRec =
117+
manifest && typeof manifest === 'object' && !Array.isArray(manifest)
118+
? (manifest as Record<string, unknown>)
119+
: null;
117120
const groupDisplayNameRaw = manifestRec?.name;
118121
const groupDisplayName =
119122
typeof groupDisplayNameRaw === 'string' && groupDisplayNameRaw.trim()

0 commit comments

Comments
 (0)