import { createApiSimulator } from '@x12i/api-simulator'; export const simulator = createApiSimulator({ apis: [ { id: 'objects-api', basePath: '/api/v1', data: { childRows: [ { id: 'child-001', name: 'First child', parentId: '{{request.params.parentId}}' }, { id: 'child-002', name: 'Second child', parentId: '{{request.params.parentId}}' } ] }, endpoints: [ { id: 'service-health', method: 'GET', path: '/health', behavior: { type: 'fixed', response: { body: { status: 'ok', service: 'objects-simulator' } } } }, { id: 'list-children', method: 'GET', path: '/parents/:parentId/children', behavior: { type: 'relative', response: { body: { parentId: '{{request.params.parentId}}', items: '{{data.childRows}}' } } } }, { id: 'calculate-child-score', method: 'POST', path: '/parents/:parentId/score', behavior: { type: 'simulation', handler: ({ request }) => { const body = request.body as { signals?: number[] }; const signals = body.signals ?? []; return { body: { parentId: request.params.parentId, score: signals.reduce((sum, value) => sum + value, 0) } }; } } } ] } ] });