@elisra-devops/docgen-data-provider 1.67.0 → 1.68.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/README.md +50 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,39 +1,65 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @elisra-devops/docgen-data-provider
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/@elisra-devops/docgen-data-provider)
|
|
4
|
+
[](./LICENSE)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
Azure DevOps data provider used by DocGen to fetch work items, Git, Pipelines and Test data via the Azure DevOps REST APIs.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
## Installation
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
```bash
|
|
11
|
+
npm i @elisra-devops/docgen-data-provider
|
|
12
|
+
```
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
- **git** - a module for retriving git related data, for example: commit detailes, branches etc.
|
|
14
|
-
- **pipelines** - a module for retriving pipelines data, for example: pipline history, pipline details etc.
|
|
15
|
-
- **tests** - a module for retriving tests data, for example:testplans list, test steps etc.
|
|
16
|
-
- **tickets** - a module for retriving tickets data, for example: open tickets, tickets list by query results etc.
|
|
14
|
+
## Authentication
|
|
17
15
|
|
|
18
|
-
|
|
16
|
+
Pass a token string to the constructor:
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
```
|
|
18
|
+
- **Azure DevOps PAT** (most common): pass the PAT as-is.
|
|
19
|
+
- **Bearer token** (e.g. AAD/OIDC): pass as `bearer:<token>` or `bearer <token>` to send `Authorization: Bearer …`.
|
|
23
20
|
|
|
24
|
-
|
|
21
|
+
`orgUrl` should be your organization base URL, typically `https://dev.azure.com/<org>/` (note the trailing slash).
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import DgDataProviderAzureDevOps from '@elisra-devops/docgen-data-provider';
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
token
|
|
32
|
-
);
|
|
33
|
-
let gitDataProvider = await dgDataProviderAzureDevOps.getGitDataProvider();
|
|
28
|
+
const orgUrl = 'https://dev.azure.com/<org>/';
|
|
29
|
+
const token = process.env.AZDO_TOKEN!; // PAT, or: `bearer:<access-token>`
|
|
34
30
|
|
|
31
|
+
const provider = new DgDataProviderAzureDevOps(orgUrl, token, undefined, process.env.JFROG_TOKEN);
|
|
35
32
|
|
|
33
|
+
const mgmt = await provider.getMangementDataProvider();
|
|
34
|
+
const projects = await mgmt.GetProjects();
|
|
36
35
|
|
|
36
|
+
const tickets = await provider.getTicketsDataProvider();
|
|
37
|
+
const workItem = await tickets.GetWorkItem('<project>', '123');
|
|
37
38
|
```
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
## Modules
|
|
41
|
+
|
|
42
|
+
The default export is `DgDataProviderAzureDevOps`, which creates module-specific providers:
|
|
43
|
+
|
|
44
|
+
- `getMangementDataProvider()` – org/project helpers (projects, profile, connection data).
|
|
45
|
+
- `getTicketsDataProvider()` – work items + WIQL queries + attachments/images + shared-query helpers.
|
|
46
|
+
- `getGitDataProvider()` – repos/branches/tags/files/commits/PRs + linked work items in ranges.
|
|
47
|
+
- `getPipelinesDataProvider()` – pipeline runs, artifacts, releases, “previous run” lookup, trigger builds.
|
|
48
|
+
- `getTestDataProvider()` – test plans/suites/cases/points/runs + parses test steps (including shared steps).
|
|
49
|
+
- `getResultDataProvider()` – test result summaries (group/summary/detailed) and “test reporter” output.
|
|
50
|
+
- `getJfrogDataProvider()` – JFrog build URL lookup (requires `jfrogToken` in the constructor).
|
|
51
|
+
|
|
52
|
+
## Notable APIs (by module)
|
|
53
|
+
|
|
54
|
+
- `MangementDataProvider`: `GetProjects()`, `GetProjectByName()`, `CheckOrgUrlValidity()`
|
|
55
|
+
- `TicketsDataProvider`: `GetWorkItem()`, `GetQueryResultsFromWiql()`, `GetSharedQueries()`, `CreateNewWorkItem()`, `UpdateWorkItem()`
|
|
56
|
+
- `GitDataProvider`: `GetTeamProjectGitReposList()`, `GetFileFromGitRepo()`, `GetCommitsInCommitRange()`, `CreatePullRequestComment()`
|
|
57
|
+
- `PipelinesDataProvider`: `GetPipelineRunHistory()`, `getPipelineRunDetails()`, `GetArtifactByBuildId()`, `TriggerBuildById()`
|
|
58
|
+
- `TestDataProvider`: `GetTestPlans()`, `GetTestSuitesByPlan()`, `GetTestCasesBySuites()`, `CreateTestRun()`, `UploadTestAttachment()`
|
|
59
|
+
- `ResultDataProvider`: `getCombinedResultsSummary()`, `getTestReporterResults()`
|
|
60
|
+
|
|
61
|
+
## Notes
|
|
62
|
+
|
|
63
|
+
- This library uses `axios` and retries some transient failures (timeouts/429/5xx).
|
|
64
|
+
- `TicketsDataProvider.GetSharedQueries()` supports doc-type specific query layouts (e.g. `std`, `str`, `svd`, `srs`, `test-reporter`) and falls back to the provided root path when a dedicated folder is missing.
|
|
65
|
+
- In Node.js, the HTTP client is configured with `rejectUnauthorized: false` in `src/helpers/tfs.ts`, which may be required for some internal setups but is a security tradeoff.
|