@backstage/integration 1.2.0 → 1.2.1-next.2

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,23 @@
1
1
  # @backstage/integration
2
2
 
3
+ ## 1.2.1-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - e37c71b5a4: Updated to support deployments of Azure DevOps Server under TFS or similar sub path
8
+
9
+ ## 1.2.1-next.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 8f7b1835df: Updated dependency `msw` to `^0.41.0`.
14
+
15
+ ## 1.2.1-next.0
16
+
17
+ ### Patch Changes
18
+
19
+ - 72dfcbc8bf: Gerrit Integration: Handle absolute paths in `resolveUrl` properly.
20
+
3
21
  ## 1.2.0
4
22
 
5
23
  ### Minor Changes
package/dist/index.cjs.js CHANGED
@@ -196,6 +196,10 @@ const _AzureUrl = class {
196
196
  owner = parts[1];
197
197
  project = parts[2];
198
198
  repo = parts[4];
199
+ } else if (parts[4] === "_git") {
200
+ owner = `${parts[1]}/${parts[2]}`;
201
+ project = parts[3];
202
+ repo = parts[5];
199
203
  }
200
204
  if (!owner || !project || !repo) {
201
205
  throw new Error("Azure URL must point to a git repository");
@@ -804,43 +808,6 @@ function readGerritIntegrationConfigs(configs) {
804
808
  return configs.map(readGerritIntegrationConfig);
805
809
  }
806
810
 
807
- const _GerritIntegration = class {
808
- constructor(integrationConfig) {
809
- this.integrationConfig = integrationConfig;
810
- }
811
- get type() {
812
- return "gerrit";
813
- }
814
- get title() {
815
- return this.integrationConfig.host;
816
- }
817
- get config() {
818
- return this.integrationConfig;
819
- }
820
- resolveUrl(options) {
821
- const { url, base, lineNumber } = options;
822
- let updated;
823
- if (url) {
824
- updated = new URL(url, base);
825
- } else {
826
- updated = new URL(base);
827
- }
828
- if (lineNumber) {
829
- updated.hash = lineNumber.toString();
830
- }
831
- return updated.toString();
832
- }
833
- resolveEditUrl(url) {
834
- return url;
835
- }
836
- };
837
- let GerritIntegration = _GerritIntegration;
838
- GerritIntegration.factory = ({ config }) => {
839
- var _a;
840
- const configs = readGerritIntegrationConfigs((_a = config.getOptionalConfigArray("integrations.gerrit")) != null ? _a : []);
841
- return basicIntegrations(configs.map((c) => new _GerritIntegration(c)), (i) => i.config.host);
842
- };
843
-
844
811
  const GERRIT_BODY_PREFIX = ")]}'";
845
812
  function parseGerritGitilesUrl(config, url) {
846
813
  const urlPath = url.replace(config.gitilesBaseUrl, "");
@@ -862,6 +829,9 @@ function parseGerritGitilesUrl(config, url) {
862
829
  project
863
830
  };
864
831
  }
832
+ function builldGerritGitilesUrl(config, project, branch, filePath) {
833
+ return `${config.gitilesBaseUrl}/${project}/+/refs/heads/${branch}/${lodash.trimStart(filePath, "/")}`;
834
+ }
865
835
  function getAuthenticationPrefix(config) {
866
836
  return config.password ? "/a/" : "/";
867
837
  }
@@ -903,6 +873,47 @@ async function parseGerritJsonResponse(response) {
903
873
  throw new Error(`Gerrit JSON body prefix missing. Found: ${responseBody.slice(0, 10)}`);
904
874
  }
905
875
 
876
+ const _GerritIntegration = class {
877
+ constructor(integrationConfig) {
878
+ this.integrationConfig = integrationConfig;
879
+ }
880
+ get type() {
881
+ return "gerrit";
882
+ }
883
+ get title() {
884
+ return this.integrationConfig.host;
885
+ }
886
+ get config() {
887
+ return this.integrationConfig;
888
+ }
889
+ resolveUrl(options) {
890
+ const { url, base, lineNumber } = options;
891
+ let updated;
892
+ if (url.startsWith("/")) {
893
+ const { branch, project } = parseGerritGitilesUrl(this.config, base);
894
+ return builldGerritGitilesUrl(this.config, project, branch, url);
895
+ }
896
+ if (url) {
897
+ updated = new URL(url, base);
898
+ } else {
899
+ updated = new URL(base);
900
+ }
901
+ if (lineNumber) {
902
+ updated.hash = lineNumber.toString();
903
+ }
904
+ return updated.toString();
905
+ }
906
+ resolveEditUrl(url) {
907
+ return url;
908
+ }
909
+ };
910
+ let GerritIntegration = _GerritIntegration;
911
+ GerritIntegration.factory = ({ config }) => {
912
+ var _a;
913
+ const configs = readGerritIntegrationConfigs((_a = config.getOptionalConfigArray("integrations.gerrit")) != null ? _a : []);
914
+ return basicIntegrations(configs.map((c) => new _GerritIntegration(c)), (i) => i.config.host);
915
+ };
916
+
906
917
  const GITHUB_HOST = "github.com";
907
918
  const GITHUB_API_BASE_URL = "https://api.github.com";
908
919
  const GITHUB_RAW_BASE_URL = "https://raw.githubusercontent.com";