docs: update AI Studio design token audits
Refresh design token inventory files to reflect the latest UI sizing and layout configurations from the sandbox prototype.
This commit is contained in:
1 parent
50449e96ad
commit
d39d9f92f9
139 files changed
+10982
-6
No files matched your search
@@ -0,0 +1,49 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { DataBufferEngine } from '@/core/data/buffer';
|
||||
import { SDKManager } from '@/core/sdk/sdkManager';
|
||||
import { SecurityEngine } from '@/core/Security/security';
|
||||
|
||||
export async function GET(req: NextRequest) {
|
||||
try {
|
||||
const { searchParams } = new URL(req.url);
|
||||
const clientId = searchParams.get('clientId') || undefined;
|
||||
const limit = Number(searchParams.get('limit')) || 50;
|
||||
|
||||
const events = DataBufferEngine.getRecentEvents(limit, clientId);
|
||||
return NextResponse.json({ events, count: events.length });
|
||||
} catch (err: unknown) {
|
||||
const message = err instanceof Error ? err.message : 'Events retrieval failed';
|
||||
return NextResponse.json({ error: message }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
export async function POST(req: NextRequest) {
|
||||
try {
|
||||
const body = await req.json();
|
||||
const clientId = body.clientId || 'py_telemetry_agent_01';
|
||||
const eventId = body.eventId || `evt_${Date.now()}_${Math.random().toString(36).substring(2, 7)}`;
|
||||
const timestamp = body.timestamp || new Date().toISOString();
|
||||
const data = body.data || { sample: 'Realtime event via DataStack API', rand: Math.random() };
|
||||
|
||||
// Validate security
|
||||
const val = SecurityEngine.validateEvent(clientId, eventId, data, 200);
|
||||
if (!val.allowed) {
|
||||
return NextResponse.json({ error: val.reason }, { status: 429 });
|
||||
}
|
||||
|
||||
const event = {
|
||||
clientId,
|
||||
eventId,
|
||||
timestamp,
|
||||
payload: typeof data === 'string' ? data : JSON.stringify(data),
|
||||
};
|
||||
|
||||
DataBufferEngine.push(event);
|
||||
SDKManager.incrementEventCount(clientId, 1);
|
||||
|
||||
return NextResponse.json({ success: true, event });
|
||||
} catch (err: unknown) {
|
||||
const message = err instanceof Error ? err.message : 'Event simulation failed';
|
||||
return NextResponse.json({ error: message }, { status: 500 });
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user