@backstage-community/plugin-azure-devops 0.11.0 → 0.12.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,11 @@
1
1
  # @backstage-community/plugin-azure-devops
2
2
 
3
+ ## 0.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 1e8ea62: Export function `getAnnotationValuesFromEntity`
8
+
3
9
  ## 0.11.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -183,4 +183,14 @@ declare class AzureDevOpsClient implements AzureDevOpsApi {
183
183
  private get;
184
184
  }
185
185
 
186
- export { type AllFilter, type AssignedToTeamFilter, type AssignedToTeamsFilter, type AssignedToUserFilter, type AzureDevOpsApi, AzureDevOpsClient, AzurePullRequestsIcon, AzurePullRequestsPage, type BaseFilter, type CreatedByTeamFilter, type CreatedByTeamsFilter, type CreatedByUserFilter, EntityAzureGitTagsContent, EntityAzurePipelinesContent, EntityAzurePullRequestsContent, EntityAzureReadmeCard, type Filter, FilterType, type PullRequestColumnConfig, type PullRequestFilter, azureDevOpsApiRef, azureDevOpsPlugin, isAzureDevOpsAvailable, isAzurePipelinesAvailable };
186
+ /** @public **/
187
+ declare function getAnnotationValuesFromEntity(entity: Entity): {
188
+ project: string;
189
+ repo?: string;
190
+ definition?: string;
191
+ host?: string;
192
+ org?: string;
193
+ readmePath?: string;
194
+ };
195
+
196
+ export { type AllFilter, type AssignedToTeamFilter, type AssignedToTeamsFilter, type AssignedToUserFilter, type AzureDevOpsApi, AzureDevOpsClient, AzurePullRequestsIcon, AzurePullRequestsPage, type BaseFilter, type CreatedByTeamFilter, type CreatedByTeamsFilter, type CreatedByUserFilter, EntityAzureGitTagsContent, EntityAzurePipelinesContent, EntityAzurePullRequestsContent, EntityAzureReadmeCard, type Filter, FilterType, type PullRequestColumnConfig, type PullRequestFilter, azureDevOpsApiRef, azureDevOpsPlugin, getAnnotationValuesFromEntity, isAzureDevOpsAvailable, isAzurePipelinesAvailable };
package/dist/index.esm.js CHANGED
@@ -2,9 +2,9 @@ export { AzurePullRequestsPage, EntityAzureGitTagsContent, EntityAzurePipelinesC
2
2
  export { AzurePullRequestsIcon } from './components/AzurePullRequestsIcon/AzurePullRequestsIcon.esm.js';
3
3
  export { azureDevOpsApiRef } from './api/AzureDevOpsApi.esm.js';
4
4
  export { AzureDevOpsClient } from './api/AzureDevOpsClient.esm.js';
5
- import './components/PullRequestsPage/PullRequestsPage.esm.js';
6
- export { FilterType } from './components/PullRequestsPage/lib/filters/types.esm.js';
7
5
  import 'luxon';
8
6
  import 'humanize-duration';
9
- import '@backstage-community/plugin-azure-devops-common';
7
+ export { getAnnotationValuesFromEntity } from './utils/getAnnotationValuesFromEntity.esm.js';
8
+ import './components/PullRequestsPage/PullRequestsPage.esm.js';
9
+ export { FilterType } from './components/PullRequestsPage/lib/filters/types.esm.js';
10
10
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getAnnotationValuesFromEntity.esm.js","sources":["../../src/utils/getAnnotationValuesFromEntity.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Entity } from '@backstage/catalog-model';\nimport {\n AZURE_DEVOPS_PROJECT_ANNOTATION,\n AZURE_DEVOPS_BUILD_DEFINITION_ANNOTATION,\n AZURE_DEVOPS_README_ANNOTATION,\n AZURE_DEVOPS_REPO_ANNOTATION,\n AZURE_DEVOPS_HOST_ORG_ANNOTATION,\n} from '@backstage-community/plugin-azure-devops-common';\n\nexport function getAnnotationValuesFromEntity(entity: Entity): {\n project: string;\n repo?: string;\n definition?: string;\n host?: string;\n org?: string;\n readmePath?: string;\n} {\n const hostOrg = getHostOrg(entity.metadata.annotations);\n const projectRepo = getProjectRepo(entity.metadata.annotations);\n const project =\n entity.metadata.annotations?.[AZURE_DEVOPS_PROJECT_ANNOTATION];\n const definition =\n entity.metadata.annotations?.[AZURE_DEVOPS_BUILD_DEFINITION_ANNOTATION];\n const readmePath =\n entity.metadata.annotations?.[AZURE_DEVOPS_README_ANNOTATION];\n\n if (definition) {\n if (project) {\n return {\n project,\n definition,\n readmePath: readmePath,\n ...hostOrg,\n };\n }\n if (projectRepo.project) {\n return {\n project: projectRepo.project,\n repo: projectRepo.repo,\n definition,\n readmePath: readmePath,\n ...hostOrg,\n };\n }\n throw new Error(\n `Value for annotation \"${AZURE_DEVOPS_PROJECT_ANNOTATION}\" was not found`,\n );\n } else {\n if (projectRepo.project) {\n return {\n project: projectRepo.project,\n repo: projectRepo.repo,\n readmePath: readmePath,\n ...hostOrg,\n };\n }\n\n if (project) {\n throw new Error(\n `Value for annotation \"${AZURE_DEVOPS_BUILD_DEFINITION_ANNOTATION}\" was not found`,\n );\n }\n }\n\n throw new Error('Expected \"dev.azure.com\" annotations were not found');\n}\n\nfunction getProjectRepo(annotations?: Record<string, string>): {\n project?: string;\n repo?: string;\n} {\n const annotation = annotations?.[AZURE_DEVOPS_REPO_ANNOTATION];\n if (!annotation) {\n return { project: undefined, repo: undefined };\n }\n\n if (annotation.split('/').length === 2) {\n const [project, repo] = annotation.split('/');\n if (project && repo) {\n return { project, repo };\n }\n }\n\n throw new Error(\n `Invalid value for annotation \"${AZURE_DEVOPS_REPO_ANNOTATION}\"; expected format is: <project-name>/<repo-name>, found: \"${annotation}\"`,\n );\n}\n\nfunction getHostOrg(annotations?: Record<string, string>): {\n host?: string;\n org?: string;\n} {\n const annotation = annotations?.[AZURE_DEVOPS_HOST_ORG_ANNOTATION];\n if (!annotation) {\n return { host: undefined, org: undefined };\n }\n\n const segments = annotation.split('/');\n if (segments.length === 2) {\n const [host, org] = segments;\n if (host && org) {\n return { host, org };\n }\n } else if (segments.length === 3) {\n const [host, subpath, org] = segments;\n return { host: `${host}/${subpath}`, org };\n }\n\n throw new Error(\n `Invalid value for annotation \"${AZURE_DEVOPS_HOST_ORG_ANNOTATION}\"; expected format is: <host-name>/<organization-name>, found: \"${annotation}\"`,\n );\n}\n"],"names":[],"mappings":";;AAyBO,SAAS,8BAA8B,MAO5C,EAAA;AACA,EAAA,MAAM,OAAU,GAAA,UAAA,CAAW,MAAO,CAAA,QAAA,CAAS,WAAW,CAAA;AACtD,EAAA,MAAM,WAAc,GAAA,cAAA,CAAe,MAAO,CAAA,QAAA,CAAS,WAAW,CAAA;AAC9D,EAAA,MAAM,OACJ,GAAA,MAAA,CAAO,QAAS,CAAA,WAAA,GAAc,+BAA+B,CAAA;AAC/D,EAAA,MAAM,UACJ,GAAA,MAAA,CAAO,QAAS,CAAA,WAAA,GAAc,wCAAwC,CAAA;AACxE,EAAA,MAAM,UACJ,GAAA,MAAA,CAAO,QAAS,CAAA,WAAA,GAAc,8BAA8B,CAAA;AAE9D,EAAA,IAAI,UAAY,EAAA;AACd,IAAA,IAAI,OAAS,EAAA;AACX,MAAO,OAAA;AAAA,QACL,OAAA;AAAA,QACA,UAAA;AAAA,QACA,UAAA;AAAA,QACA,GAAG;AAAA,OACL;AAAA;AAEF,IAAA,IAAI,YAAY,OAAS,EAAA;AACvB,MAAO,OAAA;AAAA,QACL,SAAS,WAAY,CAAA,OAAA;AAAA,QACrB,MAAM,WAAY,CAAA,IAAA;AAAA,QAClB,UAAA;AAAA,QACA,UAAA;AAAA,QACA,GAAG;AAAA,OACL;AAAA;AAEF,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,yBAAyB,+BAA+B,CAAA,eAAA;AAAA,KAC1D;AAAA,GACK,MAAA;AACL,IAAA,IAAI,YAAY,OAAS,EAAA;AACvB,MAAO,OAAA;AAAA,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,GAAG,CAAI,GAAA,QAAA;AACpB,IAAA,IAAI,QAAQ,GAAK,EAAA;AACf,MAAO,OAAA,EAAE,MAAM,GAAI,EAAA;AAAA;AACrB,GACF,MAAA,IAAW,QAAS,CAAA,MAAA,KAAW,CAAG,EAAA;AAChC,IAAA,MAAM,CAAC,IAAA,EAAM,OAAS,EAAA,GAAG,CAAI,GAAA,QAAA;AAC7B,IAAA,OAAO,EAAE,IAAM,EAAA,CAAA,EAAG,IAAI,CAAI,CAAA,EAAA,OAAO,IAAI,GAAI,EAAA;AAAA;AAG3C,EAAA,MAAM,IAAI,KAAA;AAAA,IACR,CAAA,8BAAA,EAAiC,gCAAgC,CAAA,gEAAA,EAAmE,UAAU,CAAA,CAAA;AAAA,GAChJ;AACF;;;;"}
1
+ {"version":3,"file":"getAnnotationValuesFromEntity.esm.js","sources":["../../src/utils/getAnnotationValuesFromEntity.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Entity } from '@backstage/catalog-model';\nimport {\n AZURE_DEVOPS_PROJECT_ANNOTATION,\n AZURE_DEVOPS_BUILD_DEFINITION_ANNOTATION,\n AZURE_DEVOPS_README_ANNOTATION,\n AZURE_DEVOPS_REPO_ANNOTATION,\n AZURE_DEVOPS_HOST_ORG_ANNOTATION,\n} from '@backstage-community/plugin-azure-devops-common';\n\n/** @public **/\nexport function getAnnotationValuesFromEntity(entity: Entity): {\n project: string;\n repo?: string;\n definition?: string;\n host?: string;\n org?: string;\n readmePath?: string;\n} {\n const hostOrg = getHostOrg(entity.metadata.annotations);\n const projectRepo = getProjectRepo(entity.metadata.annotations);\n const project =\n entity.metadata.annotations?.[AZURE_DEVOPS_PROJECT_ANNOTATION];\n const definition =\n entity.metadata.annotations?.[AZURE_DEVOPS_BUILD_DEFINITION_ANNOTATION];\n const readmePath =\n entity.metadata.annotations?.[AZURE_DEVOPS_README_ANNOTATION];\n\n if (definition) {\n if (project) {\n return {\n project,\n definition,\n readmePath: readmePath,\n ...hostOrg,\n };\n }\n if (projectRepo.project) {\n return {\n project: projectRepo.project,\n repo: projectRepo.repo,\n definition,\n readmePath: readmePath,\n ...hostOrg,\n };\n }\n throw new Error(\n `Value for annotation \"${AZURE_DEVOPS_PROJECT_ANNOTATION}\" was not found`,\n );\n } else {\n if (projectRepo.project) {\n return {\n project: projectRepo.project,\n repo: projectRepo.repo,\n readmePath: readmePath,\n ...hostOrg,\n };\n }\n\n if (project) {\n throw new Error(\n `Value for annotation \"${AZURE_DEVOPS_BUILD_DEFINITION_ANNOTATION}\" was not found`,\n );\n }\n }\n\n throw new Error('Expected \"dev.azure.com\" annotations were not found');\n}\n\nfunction getProjectRepo(annotations?: Record<string, string>): {\n project?: string;\n repo?: string;\n} {\n const annotation = annotations?.[AZURE_DEVOPS_REPO_ANNOTATION];\n if (!annotation) {\n return { project: undefined, repo: undefined };\n }\n\n if (annotation.split('/').length === 2) {\n const [project, repo] = annotation.split('/');\n if (project && repo) {\n return { project, repo };\n }\n }\n\n throw new Error(\n `Invalid value for annotation \"${AZURE_DEVOPS_REPO_ANNOTATION}\"; expected format is: <project-name>/<repo-name>, found: \"${annotation}\"`,\n );\n}\n\nfunction getHostOrg(annotations?: Record<string, string>): {\n host?: string;\n org?: string;\n} {\n const annotation = annotations?.[AZURE_DEVOPS_HOST_ORG_ANNOTATION];\n if (!annotation) {\n return { host: undefined, org: undefined };\n }\n\n const segments = annotation.split('/');\n if (segments.length === 2) {\n const [host, org] = segments;\n if (host && org) {\n return { host, org };\n }\n } else if (segments.length === 3) {\n const [host, subpath, org] = segments;\n return { host: `${host}/${subpath}`, org };\n }\n\n throw new Error(\n `Invalid value for annotation \"${AZURE_DEVOPS_HOST_ORG_ANNOTATION}\"; expected format is: <host-name>/<organization-name>, found: \"${annotation}\"`,\n );\n}\n"],"names":[],"mappings":";;AA0BO,SAAS,8BAA8B,MAO5C,EAAA;AACA,EAAA,MAAM,OAAU,GAAA,UAAA,CAAW,MAAO,CAAA,QAAA,CAAS,WAAW,CAAA;AACtD,EAAA,MAAM,WAAc,GAAA,cAAA,CAAe,MAAO,CAAA,QAAA,CAAS,WAAW,CAAA;AAC9D,EAAA,MAAM,OACJ,GAAA,MAAA,CAAO,QAAS,CAAA,WAAA,GAAc,+BAA+B,CAAA;AAC/D,EAAA,MAAM,UACJ,GAAA,MAAA,CAAO,QAAS,CAAA,WAAA,GAAc,wCAAwC,CAAA;AACxE,EAAA,MAAM,UACJ,GAAA,MAAA,CAAO,QAAS,CAAA,WAAA,GAAc,8BAA8B,CAAA;AAE9D,EAAA,IAAI,UAAY,EAAA;AACd,IAAA,IAAI,OAAS,EAAA;AACX,MAAO,OAAA;AAAA,QACL,OAAA;AAAA,QACA,UAAA;AAAA,QACA,UAAA;AAAA,QACA,GAAG;AAAA,OACL;AAAA;AAEF,IAAA,IAAI,YAAY,OAAS,EAAA;AACvB,MAAO,OAAA;AAAA,QACL,SAAS,WAAY,CAAA,OAAA;AAAA,QACrB,MAAM,WAAY,CAAA,IAAA;AAAA,QAClB,UAAA;AAAA,QACA,UAAA;AAAA,QACA,GAAG;AAAA,OACL;AAAA;AAEF,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,yBAAyB,+BAA+B,CAAA,eAAA;AAAA,KAC1D;AAAA,GACK,MAAA;AACL,IAAA,IAAI,YAAY,OAAS,EAAA;AACvB,MAAO,OAAA;AAAA,QACL,SAAS,WAAY,CAAA,OAAA;AAAA,QACrB,MAAM,WAAY,CAAA,IAAA;AAAA,QAClB,UAAA;AAAA,QACA,GAAG;AAAA,OACL;AAAA;AAGF,IAAA,IAAI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AAS,CAAA,MAAA,KAAW,CAAG,EAAA;AAChC,IAAA,MAAM,CAAC,IAAA,EAAM,OAAS,EAAA,GAAG,CAAI,GAAA,QAAA;AAC7B,IAAA,OAAO,EAAE,IAAM,EAAA,CAAA,EAAG,IAAI,CAAI,CAAA,EAAA,OAAO,IAAI,GAAI,EAAA;AAAA;AAG3C,EAAA,MAAM,IAAI,KAAA;AAAA,IACR,CAAA,8BAAA,EAAiC,gCAAgC,CAAA,gEAAA,EAAmE,UAAU,CAAA,CAAA;AAAA,GAChJ;AACF;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage-community/plugin-azure-devops",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "backstage": {
5
5
  "role": "frontend-plugin",
6
6
  "pluginId": "azure-devops",