@backstage/integration
Advanced tools
Comparing version 0.0.0-nightly-2020111021742 to 0.0.0-nightly-2020111221837
# @backstage/integration | ||
## 0.0.0-nightly-2020111021742 | ||
## 0.0.0-nightly-2020111221837 | ||
### Patch Changes | ||
- 6c40a1e: Move the core url and auth logic to integration for the four major providers | ||
- 6c40a1e: Add the basics of cross-integration concerns | ||
- ae9ed59: Validate that integration config contains a valid host | ||
## 0.1.3 | ||
### Patch Changes | ||
- 38e24db00: Move the core url and auth logic to integration for the four major providers | ||
- b8ecf6f48: Add the basics of cross-integration concerns | ||
- Updated dependencies [e3bd9fc2f] | ||
- Updated dependencies [e3bd9fc2f] | ||
- @backstage/config@0.1.2 | ||
## 0.1.2 | ||
@@ -11,0 +20,0 @@ |
@@ -13,2 +13,8 @@ 'use strict'; | ||
function isValidHost(url) { | ||
const check = new URL("http://example.com"); | ||
check.host = url; | ||
return check.host === url; | ||
} | ||
const AZURE_HOST = "dev.azure.com"; | ||
@@ -19,2 +25,5 @@ function readAzureIntegrationConfig(config2) { | ||
const token = config2.getOptionalString("token"); | ||
if (!isValidHost(host)) { | ||
throw new Error(`Invalid Azure integration config, '${host}' is not a valid host`); | ||
} | ||
return {host, token}; | ||
@@ -97,2 +106,5 @@ } | ||
const appPassword = config2.getOptionalString("appPassword"); | ||
if (!isValidHost(host)) { | ||
throw new Error(`Invalid Bitbucket integration config, '${host}' is not a valid host`); | ||
} | ||
if (apiBaseUrl) { | ||
@@ -162,2 +174,5 @@ apiBaseUrl = apiBaseUrl.replace(/\/+$/, ""); | ||
const token = config2.getOptionalString("token"); | ||
if (!isValidHost(host)) { | ||
throw new Error(`Invalid GitHub integration config, '${host}' is not a valid host`); | ||
} | ||
if (apiBaseUrl) { | ||
@@ -224,2 +239,5 @@ apiBaseUrl = apiBaseUrl.replace(/\/+$/, ""); | ||
const token = config2.getOptionalString("token"); | ||
if (!isValidHost(host)) { | ||
throw new Error(`Invalid GitLab integration config, '${host}' is not a valid host`); | ||
} | ||
return {host, token}; | ||
@@ -226,0 +244,0 @@ } |
import parseGitUrl from 'git-url-parse'; | ||
import fetch from 'cross-fetch'; | ||
function isValidHost(url) { | ||
const check = new URL("http://example.com"); | ||
check.host = url; | ||
return check.host === url; | ||
} | ||
const AZURE_HOST = "dev.azure.com"; | ||
@@ -9,2 +15,5 @@ function readAzureIntegrationConfig(config2) { | ||
const token = config2.getOptionalString("token"); | ||
if (!isValidHost(host)) { | ||
throw new Error(`Invalid Azure integration config, '${host}' is not a valid host`); | ||
} | ||
return {host, token}; | ||
@@ -87,2 +96,5 @@ } | ||
const appPassword = config2.getOptionalString("appPassword"); | ||
if (!isValidHost(host)) { | ||
throw new Error(`Invalid Bitbucket integration config, '${host}' is not a valid host`); | ||
} | ||
if (apiBaseUrl) { | ||
@@ -152,2 +164,5 @@ apiBaseUrl = apiBaseUrl.replace(/\/+$/, ""); | ||
const token = config2.getOptionalString("token"); | ||
if (!isValidHost(host)) { | ||
throw new Error(`Invalid GitHub integration config, '${host}' is not a valid host`); | ||
} | ||
if (apiBaseUrl) { | ||
@@ -214,2 +229,5 @@ apiBaseUrl = apiBaseUrl.replace(/\/+$/, ""); | ||
const token = config2.getOptionalString("token"); | ||
if (!isValidHost(host)) { | ||
throw new Error(`Invalid GitLab integration config, '${host}' is not a valid host`); | ||
} | ||
return {host, token}; | ||
@@ -216,0 +234,0 @@ } |
{ | ||
"name": "@backstage/integration", | ||
"version": "0.0.0-nightly-2020111021742", | ||
"version": "0.0.0-nightly-2020111221837", | ||
"main": "dist/index.cjs.js", | ||
@@ -32,3 +32,3 @@ "types": "dist/index.d.ts", | ||
"dependencies": { | ||
"@backstage/config": "^0.1.1", | ||
"@backstage/config": "^0.1.2", | ||
"cross-fetch": "^3.0.6", | ||
@@ -38,3 +38,3 @@ "git-url-parse": "^11.4.0" | ||
"devDependencies": { | ||
"@backstage/cli": "^0.0.0-nightly-2020111021742", | ||
"@backstage/cli": "^0.4.1", | ||
"@types/jest": "^26.0.7", | ||
@@ -41,0 +41,0 @@ "msw": "^0.21.2" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
122263
1144
Updated@backstage/config@^0.1.2