11import { Hub } from "@sentry/node" ;
22import axios from "axios" ;
33import FormData from "form-data" ;
4- import { Options } from "../types " ;
4+ import { InternalOptions } from "../options-mapping " ;
55import { captureMinimalError } from "./telemetry" ;
66
77const API_PATH = "api/0" ;
88const USER_AGENT = `sentry-bundler-plugin/${ __PACKAGE_VERSION__ } ` ;
99
1010const sentryApiAxiosInstance = ( {
1111 authToken,
12- customHeaders ,
13- } : Required < Pick < Options , "authToken" > > & Pick < Options , "customHeaders " > ) =>
12+ customHeader ,
13+ } : Required < Pick < InternalOptions , "authToken" > > & Pick < InternalOptions , "customHeader " > ) =>
1414 axios . create ( {
15- headers : { ...customHeaders , "User-Agent" : USER_AGENT , Authorization : `Bearer ${ authToken } ` } ,
15+ headers : { ...customHeader , "User-Agent" : USER_AGENT , Authorization : `Bearer ${ authToken } ` } ,
1616 } ) ;
1717
1818export async function createRelease ( {
@@ -22,15 +22,15 @@ export async function createRelease({
2222 authToken,
2323 sentryUrl,
2424 sentryHub,
25- customHeaders ,
25+ customHeader ,
2626} : {
2727 release : string ;
2828 project : string ;
2929 org : string ;
3030 authToken : string ;
3131 sentryUrl : string ;
3232 sentryHub : Hub ;
33- customHeaders ? : Record < string , string > ;
33+ customHeader : Record < string , string > ;
3434} ) : Promise < void > {
3535 const requestUrl = `${ sentryUrl } ${ API_PATH } /organizations/${ org } /releases/` ;
3636
@@ -42,7 +42,7 @@ export async function createRelease({
4242 } ;
4343
4444 try {
45- await sentryApiAxiosInstance ( { authToken, customHeaders } ) . post ( requestUrl , releasePayload , {
45+ await sentryApiAxiosInstance ( { authToken, customHeader } ) . post ( requestUrl , releasePayload , {
4646 headers : { Authorization : `Bearer ${ authToken } ` } ,
4747 } ) ;
4848 } catch ( e ) {
@@ -58,20 +58,20 @@ export async function deleteAllReleaseArtifacts({
5858 authToken,
5959 sentryUrl,
6060 sentryHub,
61- customHeaders ,
61+ customHeader ,
6262} : {
6363 org : string ;
6464 release : string ;
6565 sentryUrl : string ;
6666 authToken : string ;
6767 project : string ;
6868 sentryHub : Hub ;
69- customHeaders ? : Record < string , string > ;
69+ customHeader : Record < string , string > ;
7070} ) : Promise < void > {
7171 const requestUrl = `${ sentryUrl } ${ API_PATH } /projects/${ org } /${ project } /files/source-maps/?name=${ release } ` ;
7272
7373 try {
74- await sentryApiAxiosInstance ( { authToken, customHeaders } ) . delete ( requestUrl , {
74+ await sentryApiAxiosInstance ( { authToken, customHeader } ) . delete ( requestUrl , {
7575 headers : {
7676 Authorization : `Bearer ${ authToken } ` ,
7777 } ,
@@ -89,15 +89,15 @@ export async function updateRelease({
8989 sentryUrl,
9090 project,
9191 sentryHub,
92- customHeaders ,
92+ customHeader ,
9393} : {
9494 release : string ;
9595 org : string ;
9696 authToken : string ;
9797 sentryUrl : string ;
9898 project : string ;
9999 sentryHub : Hub ;
100- customHeaders ? : Record < string , string > ;
100+ customHeader : Record < string , string > ;
101101} ) : Promise < void > {
102102 const requestUrl = `${ sentryUrl } ${ API_PATH } /projects/${ org } /${ project } /releases/${ release } /` ;
103103
@@ -106,7 +106,7 @@ export async function updateRelease({
106106 } ;
107107
108108 try {
109- await sentryApiAxiosInstance ( { authToken, customHeaders } ) . put ( requestUrl , releasePayload , {
109+ await sentryApiAxiosInstance ( { authToken, customHeader } ) . put ( requestUrl , releasePayload , {
110110 headers : { Authorization : `Bearer ${ authToken } ` } ,
111111 } ) ;
112112 } catch ( e ) {
@@ -124,7 +124,7 @@ export async function uploadReleaseFile({
124124 filename,
125125 fileContent,
126126 sentryHub,
127- customHeaders ,
127+ customHeader ,
128128} : {
129129 org : string ;
130130 release : string ;
@@ -134,7 +134,7 @@ export async function uploadReleaseFile({
134134 filename : string ;
135135 fileContent : string ;
136136 sentryHub : Hub ;
137- customHeaders ? : Record < string , string > ;
137+ customHeader : Record < string , string > ;
138138} ) {
139139 const requestUrl = `${ sentryUrl } ${ API_PATH } /projects/${ org } /${ project } /releases/${ release } /files/` ;
140140
@@ -143,7 +143,7 @@ export async function uploadReleaseFile({
143143 form . append ( "file" , Buffer . from ( fileContent , "utf-8" ) , { filename } ) ;
144144
145145 try {
146- await sentryApiAxiosInstance ( { authToken, customHeaders } ) . post ( requestUrl , form , {
146+ await sentryApiAxiosInstance ( { authToken, customHeader } ) . post ( requestUrl , form , {
147147 headers : {
148148 Authorization : `Bearer ${ authToken } ` ,
149149 "Content-Type" : "multipart/form-data" ,
0 commit comments