@backstage/integration 1.2.0-next.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,51 @@
1
1
  # @backstage/integration
2
2
 
3
+ ## 1.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - e295ce87de: added the possibility to handle raw Gitlab URLs with nested namespaces
8
+ - 6673babab9: Gerrit UrlReader: Implemented `readTree`
9
+ - 1b4e1e2306: Split `bitbucket` integration into `bitbucketCloud` and `bitbucketServer`
10
+ (backwards compatible).
11
+
12
+ In order to migrate to the new integration configs,
13
+ move your configs from `integrations.bitbucket`
14
+ to `integrations.bitbucketCloud` or `integrations.bitbucketServer`.
15
+
16
+ Migration example:
17
+
18
+ **Before:**
19
+
20
+ ```yaml
21
+ integrations:
22
+ bitbucket:
23
+ - host: bitbucket.org
24
+ username: bitbucket_user
25
+ appPassword: app-password
26
+ - host: bitbucket-server.company.com
27
+ token: my-token
28
+ ```
29
+
30
+ **After:**
31
+
32
+ ```yaml
33
+ integrations:
34
+ bitbucketCloud:
35
+ - username: bitbucket_user
36
+ appPassword: app-password
37
+ bitbucketServer:
38
+ - host: bitbucket-server.company.com
39
+ token: my-token
40
+ ```
41
+
42
+ - 566407bf8a: Gerrit Integration: Added the `getGerritProjectsApiUrl` function
43
+
44
+ ### Patch Changes
45
+
46
+ - Updated dependencies
47
+ - @backstage/config@1.0.1
48
+
3
49
  ## 1.2.0-next.1
4
50
 
5
51
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -8,6 +8,7 @@ var fetch = require('cross-fetch');
8
8
  var authApp = require('@octokit/auth-app');
9
9
  var rest = require('@octokit/rest');
10
10
  var luxon = require('luxon');
11
+ var errors = require('@backstage/errors');
11
12
 
12
13
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
14
 
@@ -1234,14 +1235,20 @@ function getGitLabRequestOptions(config) {
1234
1235
  function buildRawUrl(target) {
1235
1236
  try {
1236
1237
  const url = new URL(target);
1237
- const [empty, userOrOrg, repoName, blobKeyword, ...restOfPath] = url.pathname.split("/");
1238
- if (empty !== "" || userOrOrg === "" || repoName === "" || blobKeyword !== "blob" || !restOfPath.join("/").match(/\.(yaml|yml)$/)) {
1239
- throw new Error("Wrong GitLab URL");
1238
+ const splitPath = url.pathname.split("/").filter(Boolean);
1239
+ const blobIndex = splitPath.indexOf("blob", 2);
1240
+ if (blobIndex < 2 || blobIndex === splitPath.length - 1) {
1241
+ throw new errors.InputError("Wrong GitLab URL");
1240
1242
  }
1241
- url.pathname = [empty, userOrOrg, repoName, "raw", ...restOfPath].join("/");
1243
+ const repoPath = splitPath.slice(0, blobIndex);
1244
+ const restOfPath = splitPath.slice(blobIndex + 1);
1245
+ if (!restOfPath.join("/").match(/\.(yaml|yml)$/)) {
1246
+ throw new errors.InputError("Wrong GitLab URL");
1247
+ }
1248
+ url.pathname = [...repoPath, "raw", ...restOfPath].join("/");
1242
1249
  return url;
1243
1250
  } catch (e) {
1244
- throw new Error(`Incorrect url: ${target}, ${e}`);
1251
+ throw new errors.InputError(`Incorrect url: ${target}, ${e}`);
1245
1252
  }
1246
1253
  }
1247
1254
  function buildProjectUrl(target, projectID) {