All checks were successful
Deploy Development / deploy (push) Successful in 47s
Test Suite / pytest-backend (push) Successful in 42s
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 18s
Test Suite / playwright-smoke (push) Successful in 12s
Co-authored-by: Cursor <cursoragent@cursor.com>
30 lines
879 B
JavaScript
30 lines
879 B
JavaScript
import { apiFetch } from './client.js'
|
|
|
|
/**
|
|
* @param {{ actor_type?: string, include_inactive?: boolean, q?: string }} [params]
|
|
*/
|
|
export function listActors(params = {}) {
|
|
const search = new URLSearchParams()
|
|
if (params.actor_type) search.set('actor_type', params.actor_type)
|
|
if (params.include_inactive) search.set('include_inactive', 'true')
|
|
if (params.q) search.set('q', params.q)
|
|
const qs = search.toString()
|
|
return apiFetch(`/api/actors${qs ? `?${qs}` : ''}`)
|
|
}
|
|
|
|
export function getActor(id) {
|
|
return apiFetch(`/api/actors/${id}`)
|
|
}
|
|
|
|
/** Fallback wenn Actor Directory nicht erreichbar (AP0.6-Kompatibilität). */
|
|
export function actorsFromContext(context) {
|
|
if (!context?.actor?.id) return []
|
|
return [
|
|
{
|
|
id: context.actor.id,
|
|
name: context.display_name || 'Aktueller Actor',
|
|
actor_type: context.actor.type || 'human',
|
|
},
|
|
]
|
|
}
|