26 lines
810 B
TypeScript
26 lines
810 B
TypeScript
|
|
/**
|
||
|
|
* GET /api/rmm/scripts
|
||
|
|
*
|
||
|
|
* Returns the script library catalog (id, name, description, target_type,
|
||
|
|
* expected_runtime_seconds, version). Bodies are not returned — they live
|
||
|
|
* in the repo and are only sent to Datto RMM, never to clients.
|
||
|
|
*/
|
||
|
|
|
||
|
|
import { NextRequest, NextResponse } from 'next/server';
|
||
|
|
import { requireAuth } from '@/lib/auth-utils';
|
||
|
|
import { listScripts } from '@/lib/services/rmm/scripts';
|
||
|
|
|
||
|
|
export async function GET(_request: NextRequest) {
|
||
|
|
const { error } = await requireAuth();
|
||
|
|
if (error) return error;
|
||
|
|
const scripts = listScripts().map((s) => ({
|
||
|
|
id: s.id,
|
||
|
|
name: s.name,
|
||
|
|
description: s.description,
|
||
|
|
target_type: s.target_type,
|
||
|
|
expected_runtime_seconds: s.expected_runtime_seconds,
|
||
|
|
version: s.version,
|
||
|
|
}));
|
||
|
|
return NextResponse.json({ scripts });
|
||
|
|
}
|