import { tryParsePutTagRequest , handleTagManifestRequest } from "./tag_manifest" ; if ( typeof addEventListener === 'function' ) { addEventListener ( 'fetch' , ( e ) : void => { const fe = e as FetchEvent ; fe . respondWith ( proxyRequest ( fe . request ) ) ; } ) ; } async function proxyRequest ( r ) { const url = new URL ( r . url ) ; if ( ! isRegistryRequest ( r ) ) { return fetch ( `https://friendly-goldstine-7897fc.netlify.com/${ url . pathname }` ) ; } if ( isCatalogRequest ( r ) ) { return new Response ( null , { status : 401 , } ) ; } return fetch ( r ) ; } function isRegistryRequest ( r ) { const url = new URL ( r . url ) ; return url . pathname . startsWith ( `/v2` ) ; } function isCatalogRequest ( r ) { const url = new URL ( r . url ) ; return url . pathname . endsWith ( `v2/_catalog` ) ; } interface FetchEvent extends Event { request : Request ; respondWith ( r ) : Promise < Response > ; }