New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@backstage/integration

Package Overview
Dependencies
Maintainers
4
Versions
984
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@backstage/integration - npm Package Compare versions

Comparing version 0.0.0-nightly-202011152214 to 0.0.0-nightly-2020111622153

5

CHANGELOG.md
# @backstage/integration
## 0.0.0-nightly-202011152214
## 0.0.0-nightly-2020111622153
### Patch Changes
- 41e8cff: Validate that integration config contains a valid host
- d7bb7bf: Implement readTree on BitBucketUrlReader and getBitbucketDownloadUrl
- d7bb7bf: Validate that integration config contains a valid host

@@ -9,0 +10,0 @@ ## 0.1.3

@@ -131,2 +131,42 @@ 'use strict';

async function getBitbucketDefaultBranch(url, config2) {
const {name: repoName, owner: project, resource} = parseGitUrl__default['default'](url);
const isHosted = resource === "bitbucket.org";
const branchUrl = isHosted ? `${config2.apiBaseUrl}/repositories/${project}/${repoName}` : `${config2.apiBaseUrl}/projects/${project}/repos/${repoName}/branches/default`;
const response = await fetch__default['default'](branchUrl, getBitbucketRequestOptions(config2));
if (!response.ok) {
const message = `Failed to retrieve default branch from ${branchUrl}, ${response.status} ${response.statusText}`;
throw new Error(message);
}
let defaultBranch;
if (isHosted) {
const repoInfo = await response.json();
defaultBranch = repoInfo.mainbranch.name;
} else {
const {displayId} = await response.json();
defaultBranch = displayId;
}
if (!defaultBranch) {
throw new Error(`Failed to read default branch from ${branchUrl}`);
}
return defaultBranch;
}
async function getBitbucketDownloadUrl(url, config2) {
const {
name: repoName,
owner: project,
ref,
protocol,
resource,
filepath
} = parseGitUrl__default['default'](url);
const isHosted = resource === "bitbucket.org";
let branch = ref;
if (!branch) {
branch = await getBitbucketDefaultBranch(url, config2);
}
const path = filepath ? `&path=${encodeURIComponent(filepath)}` : "";
const archiveUrl = isHosted ? `${protocol}://${resource}/${project}/${repoName}/get/${branch}.zip` : `${config2.apiBaseUrl}/projects/${project}/repos/${repoName}/archive?format=zip&at=${branch}&prefix=${project}-${repoName}${path}`;
return archiveUrl;
}
function getBitbucketFileFetchUrl(url, config2) {

@@ -427,2 +467,4 @@ try {

exports.getAzureRequestOptions = getAzureRequestOptions;
exports.getBitbucketDefaultBranch = getBitbucketDefaultBranch;
exports.getBitbucketDownloadUrl = getBitbucketDownloadUrl;
exports.getBitbucketFileFetchUrl = getBitbucketFileFetchUrl;

@@ -429,0 +471,0 @@ exports.getBitbucketRequestOptions = getBitbucketRequestOptions;

17

dist/index.d.ts

@@ -111,2 +111,17 @@ import { Config } from '@backstage/config';

/**
* Given a URL pointing to a path on a provider, returns the default branch.
*
* @param url A URL pointing to a path
* @param config The relevant provider config
*/
declare function getBitbucketDefaultBranch(url: string, config: BitbucketIntegrationConfig): Promise<string>;
/**
* Given a URL pointing to a path on a provider, returns a URL that is suitable
* for downloading the subtree.
*
* @param url A URL pointing to a path
* @param config The relevant provider config
*/
declare function getBitbucketDownloadUrl(url: string, config: BitbucketIntegrationConfig): Promise<string>;
/**
* Given a URL pointing to a file on a provider, returns a URL that is suitable

@@ -292,2 +307,2 @@ * for fetching the contents of the data.

export { AzureIntegrationConfig, BitbucketIntegrationConfig, GitHubIntegrationConfig, GitLabIntegrationConfig, ScmIntegration, ScmIntegrationRegistry, ScmIntegrations, getAzureDownloadUrl, getAzureFileFetchUrl, getAzureRequestOptions, getBitbucketFileFetchUrl, getBitbucketRequestOptions, getGitHubFileFetchUrl, getGitHubRequestOptions, getGitLabFileFetchUrl, getGitLabRequestOptions, readAzureIntegrationConfig, readAzureIntegrationConfigs, readBitbucketIntegrationConfig, readBitbucketIntegrationConfigs, readGitHubIntegrationConfig, readGitHubIntegrationConfigs, readGitLabIntegrationConfig, readGitLabIntegrationConfigs };
export { AzureIntegrationConfig, BitbucketIntegrationConfig, GitHubIntegrationConfig, GitLabIntegrationConfig, ScmIntegration, ScmIntegrationRegistry, ScmIntegrations, getAzureDownloadUrl, getAzureFileFetchUrl, getAzureRequestOptions, getBitbucketDefaultBranch, getBitbucketDownloadUrl, getBitbucketFileFetchUrl, getBitbucketRequestOptions, getGitHubFileFetchUrl, getGitHubRequestOptions, getGitLabFileFetchUrl, getGitLabRequestOptions, readAzureIntegrationConfig, readAzureIntegrationConfigs, readBitbucketIntegrationConfig, readBitbucketIntegrationConfigs, readGitHubIntegrationConfig, readGitHubIntegrationConfigs, readGitLabIntegrationConfig, readGitLabIntegrationConfigs };

@@ -122,2 +122,42 @@ import parseGitUrl from 'git-url-parse';

async function getBitbucketDefaultBranch(url, config2) {
const {name: repoName, owner: project, resource} = parseGitUrl(url);
const isHosted = resource === "bitbucket.org";
const branchUrl = isHosted ? `${config2.apiBaseUrl}/repositories/${project}/${repoName}` : `${config2.apiBaseUrl}/projects/${project}/repos/${repoName}/branches/default`;
const response = await fetch(branchUrl, getBitbucketRequestOptions(config2));
if (!response.ok) {
const message = `Failed to retrieve default branch from ${branchUrl}, ${response.status} ${response.statusText}`;
throw new Error(message);
}
let defaultBranch;
if (isHosted) {
const repoInfo = await response.json();
defaultBranch = repoInfo.mainbranch.name;
} else {
const {displayId} = await response.json();
defaultBranch = displayId;
}
if (!defaultBranch) {
throw new Error(`Failed to read default branch from ${branchUrl}`);
}
return defaultBranch;
}
async function getBitbucketDownloadUrl(url, config2) {
const {
name: repoName,
owner: project,
ref,
protocol,
resource,
filepath
} = parseGitUrl(url);
const isHosted = resource === "bitbucket.org";
let branch = ref;
if (!branch) {
branch = await getBitbucketDefaultBranch(url, config2);
}
const path = filepath ? `&path=${encodeURIComponent(filepath)}` : "";
const archiveUrl = isHosted ? `${protocol}://${resource}/${project}/${repoName}/get/${branch}.zip` : `${config2.apiBaseUrl}/projects/${project}/repos/${repoName}/archive?format=zip&at=${branch}&prefix=${project}-${repoName}${path}`;
return archiveUrl;
}
function getBitbucketFileFetchUrl(url, config2) {

@@ -414,3 +454,3 @@ try {

export { ScmIntegrations, getAzureDownloadUrl, getAzureFileFetchUrl, getAzureRequestOptions, getBitbucketFileFetchUrl, getBitbucketRequestOptions, getGitHubFileFetchUrl, getGitHubRequestOptions, getGitLabFileFetchUrl, getGitLabRequestOptions, readAzureIntegrationConfig, readAzureIntegrationConfigs, readBitbucketIntegrationConfig, readBitbucketIntegrationConfigs, readGitHubIntegrationConfig, readGitHubIntegrationConfigs, readGitLabIntegrationConfig, readGitLabIntegrationConfigs };
export { ScmIntegrations, getAzureDownloadUrl, getAzureFileFetchUrl, getAzureRequestOptions, getBitbucketDefaultBranch, getBitbucketDownloadUrl, getBitbucketFileFetchUrl, getBitbucketRequestOptions, getGitHubFileFetchUrl, getGitHubRequestOptions, getGitLabFileFetchUrl, getGitLabRequestOptions, readAzureIntegrationConfig, readAzureIntegrationConfigs, readBitbucketIntegrationConfig, readBitbucketIntegrationConfigs, readGitHubIntegrationConfig, readGitHubIntegrationConfigs, readGitLabIntegrationConfig, readGitLabIntegrationConfigs };
//# sourceMappingURL=index.esm.js.map
{
"name": "@backstage/integration",
"version": "0.0.0-nightly-202011152214",
"version": "0.0.0-nightly-2020111622153",
"main": "dist/index.cjs.js",

@@ -34,6 +34,7 @@ "types": "dist/index.d.ts",

"cross-fetch": "^3.0.6",
"git-url-parse": "^11.4.0"
"git-url-parse": "^11.4.3"
},
"devDependencies": {
"@backstage/cli": "^0.0.0-nightly-202011152214",
"@backstage/cli": "^0.0.0-nightly-2020111622153",
"@backstage/test-utils": "^0.1.5",
"@types/jest": "^26.0.7",

@@ -40,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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc