give the same treatment to catalog-backend too

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2021-11-24 19:24:33 +01:00
parent b055a6addc
commit 47619da24c
12 changed files with 34 additions and 21 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/integration': patch
---
Narrow the types returned by the request option functions, to only the specifics that they actually do return. The reason for this change is that a full `RequestInit` is unfortunate to return because it's different between `cross-fetch` and `node-fetch`.
+1
View File
@@ -3,6 +3,7 @@
'@backstage/plugin-auth-backend': patch
'@backstage/plugin-badges-backend': patch
'@backstage/plugin-bitrise': patch
'@backstage/plugin-catalog-backend': patch
'@backstage/plugin-catalog-backend-module-msgraph': patch
'@backstage/plugin-code-coverage-backend': patch
'@backstage/plugin-fossa': patch
+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: {
@@ -13,6 +13,7 @@ import { LocationSpec } from '@backstage/catalog-model';
import { Logger as Logger_2 } from 'winston';
import * as MicrosoftGraph from '@microsoft/microsoft-graph-types';
import * as msal from '@azure/msal-node';
import { Response as Response_2 } from 'node-fetch';
import { UserEntity } from '@backstage/catalog-model';
// Warning: (ae-missing-release-tag) "defaultGroupTransformer" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
@@ -88,11 +89,11 @@ export class MicrosoftGraphClient {
// Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@backstage/plugin-catalog-backend-module-msgraph" does not have an export "ODataQuery"
getUsers(query?: ODataQuery): AsyncIterable<MicrosoftGraph.User>;
// Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@backstage/plugin-catalog-backend-module-msgraph" does not have an export "ODataQuery"
requestApi(path: string, query?: ODataQuery): Promise<Response>;
requestApi(path: string, query?: ODataQuery): Promise<Response_2>;
// Warning: (ae-forgotten-export) The symbol "ODataQuery" needs to be exported by the entry point index.d.ts
// Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@backstage/plugin-catalog-backend-module-msgraph" does not have an export "ODataQuery"
requestCollection<T>(path: string, query?: ODataQuery): AsyncIterable<T>;
requestRaw(url: string): Promise<Response>;
requestRaw(url: string): Promise<Response_2>;
}
// Warning: (ae-missing-release-tag) "MicrosoftGraphOrgEntityProvider" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
+1 -1
View File
@@ -43,7 +43,6 @@
"aws-sdk": "^2.840.0",
"codeowners-utils": "^1.0.2",
"core-js": "^3.6.5",
"cross-fetch": "^3.0.6",
"express": "^4.17.1",
"express-promise-router": "^4.1.0",
"fast-json-stable-stringify": "^2.1.0",
@@ -53,6 +52,7 @@
"knex": "^0.95.1",
"lodash": "^4.17.21",
"luxon": "^2.0.2",
"node-fetch": "^2.6.1",
"p-limit": "^3.0.2",
"prom-client": "^13.2.0",
"uuid": "^8.0.0",
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import fetch from 'cross-fetch';
import fetch from 'node-fetch';
import {
AzureIntegrationConfig,
getAzureRequestOptions,
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import fetch from 'cross-fetch';
import fetch from 'node-fetch';
import {
BitbucketIntegrationConfig,
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import fetch from 'cross-fetch';
import fetch from 'node-fetch';
import {
getGitLabRequestOptions,
GitLabIntegrationConfig,