style: format server and shared with prettier

A mechanical prettier --write over server/src, server/tests, server/scripts
and shared/src with the workspaces' .prettierrc; nothing but layout and
import order changes, and every file keeps the same set of imports. shared
is formatted throughout and its format baseline is empty. The server
baseline keeps the 35 files that Prettier would grow past their lint:size
limit (they need a split first, which is not a formatting change), and the
generated entity files stay as their generator writes them.
This commit is contained in:
Maurice
2026-10-10 21:23:37 +02:00
parent f4e518b2df
commit 724c88c201
1978 changed files with 78448 additions and 39347 deletions
@@ -5,11 +5,12 @@
* 2. supervisor.deliverEvent only invokes plugins that are active, hold
* 'events:subscribe', AND subscribed to the event (or '*').
*/
import { describe, it, expect, afterEach } from 'vitest';
import { PluginSupervisor } from '../../../src/nest/plugins/supervisor/plugin-supervisor';
import { broadcast } from '../../../src/nest/realtime/ws-state';
import { setPluginEventSink } from '../../../src/plugin-event-sink';
import { describe, it, expect, afterEach } from 'vitest';
function makeSupervisor(): PluginSupervisor {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return new PluginSupervisor((() => ({})) as any, {}, {});
@@ -24,12 +25,15 @@ describe('supervisor.deliverEvent gating', () => {
const s = makeSupervisor();
put(s, 'sub', 'active', ['place:created'], ['events:subscribe']);
put(s, 'star', 'active', ['*'], ['events:subscribe']);
put(s, 'nogrant', 'active', ['place:created'], ['db:own']); // subscribed but no grant
put(s, 'nogrant', 'active', ['place:created'], ['db:own']); // subscribed but no grant
put(s, 'otherEvent', 'active', ['day:updated'], ['events:subscribe']); // different event
put(s, 'notactive', 'starting', ['place:created'], ['events:subscribe']);
const calls: Array<[string, string, Record<string, unknown>]> = [];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(s as any).invoke = (id: string, method: string, params: Record<string, unknown>) => { calls.push([id, method, params]); return Promise.resolve(); };
(s as any).invoke = (id: string, method: string, params: Record<string, unknown>) => {
calls.push([id, method, params]);
return Promise.resolve();
};
s.deliverEvent(7, 'place:created');
expect(calls.map((c) => c[0]).sort()).toEqual(['star', 'sub']);
@@ -42,7 +46,10 @@ describe('supervisor.deliverEvent gating', () => {
put(s, 'sub', 'active', ['reservation:created'], ['events:subscribe']);
const calls: Array<[string, string, Record<string, unknown>, { actingUserId?: number }]> = [];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(s as any).invoke = (id: string, method: string, params: Record<string, unknown>, opts: any) => { calls.push([id, method, params, opts]); return Promise.resolve(); };
(s as any).invoke = (id: string, method: string, params: Record<string, unknown>, opts: any) => {
calls.push([id, method, params, opts]);
return Promise.resolve();
};
s.deliverEvent(7, 'reservation:created', { entity: 'reservation', entityId: 40 });
expect(calls[0][2]).toEqual({ event: 'reservation:created', tripId: 7, entity: 'reservation', entityId: 40 });
@@ -57,7 +64,10 @@ describe('supervisor.deliverEvent gating', () => {
put(s, 'wronggrant', 'active', ['*'], ['events:subscribe', 'db:read:costs']);
const calls: Array<[string, Record<string, unknown>]> = [];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(s as any).invoke = (id: string, _m: string, params: Record<string, unknown>) => { calls.push([id, params]); return Promise.resolve(); };
(s as any).invoke = (id: string, _m: string, params: Record<string, unknown>) => {
calls.push([id, params]);
return Promise.resolve();
};
const snapshot = { id: 3, trip_id: 7, day_number: 1, title: 'Kyoto' };
s.deliverEvent(7, 'day:updated', { entity: 'day', entityId: 3, snapshot });
@@ -76,7 +86,10 @@ describe('supervisor.deliverEvent gating', () => {
put(s, 'trips', 'active', ['*'], ['events:subscribe', 'db:read:trips']);
const calls: Array<[string, Record<string, unknown>]> = [];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(s as any).invoke = (id: string, _m: string, params: Record<string, unknown>) => { calls.push([id, params]); return Promise.resolve(); };
(s as any).invoke = (id: string, _m: string, params: Record<string, unknown>) => {
calls.push([id, params]);
return Promise.resolve();
};
s.deliverEvent(7, 'budget:created', { entity: 'budget', entityId: 8, snapshot: { id: 8, name: 'Hotel' } });
const byId = Object.fromEntries(calls);
@@ -101,10 +114,12 @@ describe('websocket broadcast → plugin event sink', () => {
const seen: Array<{ tripId: number; event: string; meta: unknown }> = [];
setPluginEventSink((tripId, event, meta) => seen.push({ tripId, event, meta }));
broadcast(42, 'reservation:updated', { reservation: { id: 40, title: 'Flight', status: 'confirmed' } });
expect(seen).toEqual([{
tripId: 42,
event: 'reservation:updated',
meta: { entity: 'reservation', entityId: 40, snapshot: { id: 40, title: 'Flight', status: 'confirmed' } },
}]);
expect(seen).toEqual([
{
tripId: 42,
event: 'reservation:updated',
meta: { entity: 'reservation', entityId: 40, snapshot: { id: 40, title: 'Flight', status: 'confirmed' } },
},
]);
});
});