Merge pull request #8233 from backstage/freben/less-cross

🧹  Align on usage of `cross-fetch` vs `node-fetch` in frontend vs backend packages
This commit is contained in:
Fredrik Adelöw
2021-11-26 10:15:50 +01:00
committed by GitHub
34 changed files with 74 additions and 68 deletions
+2 -2
View File
@@ -41,10 +41,10 @@
"json-schema": "^0.4.0",
"json-schema-merge-allof": "^0.8.1",
"json-schema-traverse": "^1.0.0",
"node-fetch": "^2.6.1",
"typescript-json-schema": "^0.51.0",
"yaml": "^1.9.2",
"yup": "^0.32.9",
"node-fetch": "2.6.5"
"yup": "^0.32.9"
},
"devDependencies": {
"@types/jest": "^26.0.7",
+12 -6
View File
@@ -112,7 +112,9 @@ export function getAzureFileFetchUrl(url: string): string;
export function getAzureRequestOptions(
config: AzureIntegrationConfig,
additionalHeaders?: Record<string, string>,
): RequestInit;
): {
headers: Record<string, string>;
};
// @public
export function getBitbucketDefaultBranch(
@@ -135,7 +137,9 @@ export function getBitbucketFileFetchUrl(
// @public
export function getBitbucketRequestOptions(
config: BitbucketIntegrationConfig,
): RequestInit;
): {
headers: Record<string, string>;
};
// @public
export function getGitHubFileFetchUrl(
@@ -148,7 +152,9 @@ export function getGitHubFileFetchUrl(
export function getGitHubRequestOptions(
config: GitHubIntegrationConfig,
credentials: GithubCredentials,
): RequestInit;
): {
headers: Record<string, string>;
};
// @public
export function getGitLabFileFetchUrl(
@@ -157,9 +163,9 @@ export function getGitLabFileFetchUrl(
): Promise<string>;
// @public
export function getGitLabRequestOptions(
config: GitLabIntegrationConfig,
): RequestInit;
export function getGitLabRequestOptions(config: GitLabIntegrationConfig): {
headers: Record<string, string>;
};
// @public
export type GithubAppConfig = {
+2 -2
View File
@@ -64,8 +64,8 @@ export function getAzureCommitsUrl(url: string): string {
export function getAzureRequestOptions(
config: AzureIntegrationConfig,
additionalHeaders?: Record<string, string>,
): RequestInit {
const headers: HeadersInit = additionalHeaders
): { headers: Record<string, string> } {
const headers: Record<string, string> = additionalHeaders
? { ...additionalHeaders }
: {};
+2 -2
View File
@@ -158,8 +158,8 @@ export function getBitbucketFileFetchUrl(
*/
export function getBitbucketRequestOptions(
config: BitbucketIntegrationConfig,
): RequestInit {
const headers: HeadersInit = {};
): { headers: Record<string, string> } {
const headers: Record<string, string> = {};
if (config.token) {
headers.Authorization = `Bearer ${config.token}`;
+2 -2
View File
@@ -73,8 +73,8 @@ export function getGitHubFileFetchUrl(
export function getGitHubRequestOptions(
config: GitHubIntegrationConfig,
credentials: GithubCredentials,
): RequestInit {
const headers: HeadersInit = {};
): { headers: Record<string, string> } {
const headers: Record<string, string> = {};
if (chooseEndpoint(config, credentials) === 'api') {
headers.Accept = 'application/vnd.github.v3.raw';
+3 -3
View File
@@ -54,9 +54,9 @@ export async function getGitLabFileFetchUrl(
* @param config - The relevant provider config
* @public
*/
export function getGitLabRequestOptions(
config: GitLabIntegrationConfig,
): RequestInit {
export function getGitLabRequestOptions(config: GitLabIntegrationConfig): {
headers: Record<string, string>;
} {
const { token = '' } = config;
return {
headers: {