import type { HTTPMethods , RouteShorthandOptions } from 'fastify' ; const httpMethods = [ 'DELETE' , 'GET' , 'HEAD' , 'PATCH' , 'POST' , 'PUT' , 'OPTIONS' ] ; function requestMethodFactory ( methods , url , options ? ) { return function ( target , propertyKey ) : void { const method = typeof methods === 'string' || ( Array . isArray ( methods ) && methods . length > 0 ) ? methods : httpMethods ; Reflect . defineMetadata ( 'fastify-resty:handler' , { url , method , ... options } , target , propertyKey ) ; if ( Reflect . hasMetadata ( 'fastify-resty:handlers' , target ) ) { const handlers = Reflect . getMetadata ( 'fastify-resty:handlers' , target ) ; handlers . add ( propertyKey . toString ( ) ) ; } else { Reflect . defineMetadata ( 'fastify-resty:handlers' , new Set ( [ propertyKey ] ) , target ) ; } } ; } export function GET ( route , options ? ) { return requestMethodFactory ( 'GET' , route , options ) ; } export function HEAD ( route , options ? ) { return requestMethodFactory ( 'HEAD' , route , options ) ; } export function PATCH ( route , options ? ) { return requestMethodFactory ( 'PATCH' , route , options ) ; } export function POST ( route , options ? ) { return requestMethodFactory ( 'POST' , route , options ) ; } export function PUT ( route , options ? ) { return requestMethodFactory ( 'PUT' , route , options ) ; } export function OPTIONS ( route , options ? ) { return requestMethodFactory ( 'OPTIONS' , route , options ) ; } export function DELETE ( route , options ? ) { return requestMethodFactory ( 'DELETE' , route , options ) ; } export function ALL ( route , methods ? , options ? ) { return requestMethodFactory ( methods , route , options ) ; }