import { BaseRequestPolicy , WebResource } from "@azure/storage-queue" ; export default class OPTIONSRequestPolicyFactory { private origin : string | undefined ; private requstMethod : string | undefined ; private requestHeaders : string | undefined ; constructor ( origin ? , requstMethod ? , requestHeaders ? ) { this . origin = origin ; this . requstMethod = requstMethod ; this . requestHeaders = requestHeaders ; } create ( nextPolicy , options ) { return new OPTIONSRequestPolicy ( nextPolicy , options , this . origin , this . requstMethod , this . requestHeaders ) ; } } class OPTIONSRequestPolicy extends BaseRequestPolicy { private origin : string | undefined ; private requstMethod : string | undefined ; private requestHeaders : string | undefined ; constructor ( nextPolicy , options , origin ? , requstMethod ? , requestHeaders ? ) { super ( nextPolicy , options ) ; this . origin = origin ; this . requstMethod = requstMethod ; this . requestHeaders = requestHeaders ; } async sendRequest ( request ) { request . method = "OPTIONS" ; request . headers . set ( "Origin" , `${ this . origin }` ) ; if ( this . origin !== undefined ) { request . headers . set ( "Origin" , `${ this . origin }` ) ; } if ( this . requstMethod !== undefined ) { request . headers . set ( "Access-Control-Request-Method" , `${ this . requstMethod }` ) ; } if ( this . requestHeaders !== undefined ) { request . headers . set ( "Access-Control-Request-Headers" , `${ this . requestHeaders }` ) ; } const response = await this . _nextPolicy . sendRequest ( request ) ; return response ; } }