@elisra-devops/docgen-data-provider 0.4.6 → 0.4.13

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.
Files changed (68) hide show
  1. package/.github/sonar-project.properties +4 -4
  2. package/.github/workflows/ci.yml +21 -21
  3. package/.github/workflows/release.yml +45 -40
  4. package/LICENSE +21 -21
  5. package/README.md +39 -38
  6. package/bin/helpers/helper.d.ts +37 -0
  7. package/bin/helpers/helper.js +83 -0
  8. package/bin/helpers/helper.js.map +1 -0
  9. package/bin/helpers/tfs.d.ts +5 -0
  10. package/bin/helpers/tfs.js +100 -0
  11. package/bin/helpers/tfs.js.map +1 -0
  12. package/bin/index.d.ts +16 -0
  13. package/bin/index.js +53 -0
  14. package/bin/index.js.map +1 -0
  15. package/bin/models/tfs-data.d.ts +86 -0
  16. package/bin/models/tfs-data.js +63 -0
  17. package/bin/models/tfs-data.js.map +1 -0
  18. package/bin/modules/GitDataProvider.d.ts +26 -0
  19. package/bin/modules/GitDataProvider.js +301 -0
  20. package/bin/modules/GitDataProvider.js.map +1 -0
  21. package/bin/modules/MangementDataProvider.d.ts +9 -0
  22. package/bin/modules/MangementDataProvider.js +62 -0
  23. package/bin/modules/MangementDataProvider.js.map +1 -0
  24. package/bin/modules/PipelinesDataProvider.d.ts +13 -0
  25. package/bin/modules/PipelinesDataProvider.js +103 -0
  26. package/bin/modules/PipelinesDataProvider.js.map +1 -0
  27. package/bin/modules/TestDataProvider.d.ts +24 -0
  28. package/bin/modules/TestDataProvider.js +294 -0
  29. package/bin/modules/TestDataProvider.js.map +1 -0
  30. package/bin/modules/TicketsDataProvider.d.ts +26 -0
  31. package/bin/modules/TicketsDataProvider.js +385 -0
  32. package/bin/modules/TicketsDataProvider.js.map +1 -0
  33. package/bin/modules/test/gitDataProvider.test.d.ts +1 -0
  34. package/bin/modules/test/gitDataProvider.test.js +138 -0
  35. package/bin/modules/test/gitDataProvider.test.js.map +1 -0
  36. package/bin/modules/test/managmentDataProvider.test.d.ts +1 -0
  37. package/bin/modules/test/managmentDataProvider.test.js +40 -0
  38. package/bin/modules/test/managmentDataProvider.test.js.map +1 -0
  39. package/bin/modules/test/pipelineDataProvider.test.d.ts +1 -0
  40. package/bin/modules/test/pipelineDataProvider.test.js +62 -0
  41. package/bin/modules/test/pipelineDataProvider.test.js.map +1 -0
  42. package/bin/modules/test/testDataProvider.test.d.ts +1 -0
  43. package/bin/modules/test/testDataProvider.test.js +103 -0
  44. package/bin/modules/test/testDataProvider.test.js.map +1 -0
  45. package/bin/modules/test/ticketsDataProvider.test.d.ts +1 -0
  46. package/bin/modules/test/ticketsDataProvider.test.js +103 -0
  47. package/bin/modules/test/ticketsDataProvider.test.js.map +1 -0
  48. package/bin/utils/logger.d.ts +3 -0
  49. package/bin/utils/logger.js +33 -0
  50. package/bin/utils/logger.js.map +1 -0
  51. package/enviroment.d.ts +12 -12
  52. package/package.json +53 -53
  53. package/src/helpers/helper.ts +117 -117
  54. package/src/helpers/tfs.ts +92 -92
  55. package/src/index.ts +36 -36
  56. package/src/models/tfs-data.ts +136 -136
  57. package/src/modules/GitDataProvider.ts +446 -446
  58. package/src/modules/MangementDataProvider.ts +59 -59
  59. package/src/modules/PipelinesDataProvider.ts +142 -142
  60. package/src/modules/TestDataProvider.ts +423 -423
  61. package/src/modules/TicketsDataProvider.ts +435 -435
  62. package/src/modules/test/gitDataProvider.test.ts +207 -207
  63. package/src/modules/test/managmentDataProvider.test.ts +33 -33
  64. package/src/modules/test/pipelineDataProvider.test.ts +79 -79
  65. package/src/modules/test/testDataProvider.test.ts +139 -139
  66. package/src/modules/test/ticketsDataProvider.test.ts +138 -138
  67. package/src/utils/logger.ts +37 -37
  68. package/tsconfig.json +27 -27
@@ -1,59 +1,59 @@
1
- import { TFSServices } from "../helpers/tfs";
2
- import logger from "../utils/logger";
3
-
4
- export default class MangementDataProvider {
5
- orgUrl: string = "";
6
- token: string = "";
7
-
8
- constructor(orgUrl: string, token: string) {
9
- this.orgUrl = orgUrl;
10
- this.token = token;
11
- }
12
-
13
- async GetCllectionLinkTypes() {
14
- let url: string = `${this.orgUrl}_apis/wit/workitemrelationtypes`;
15
- let res: any = await TFSServices.getItemContent(
16
- url,
17
- this.token,
18
- "get",
19
- null,
20
- null
21
- );
22
- return res;
23
- }
24
-
25
- //get all projects
26
- async GetProjects(): Promise<any> {
27
- let projectUrl: string = `${this.orgUrl}_apis/projects?$top=1000`;
28
- let projects: any = await TFSServices.getItemContent(
29
- projectUrl,
30
- this.token
31
- );
32
- return projects;
33
- }
34
-
35
- // get project by name return project object
36
- async GetProjectByName(
37
- projectName: string
38
- ): Promise<any> {
39
- try {
40
- let projects: any = await this.GetProjects();
41
- for (let i = 0; i < projects.value.length; i++) {
42
- if (projects.value[i].name === projectName) return projects.value[i];
43
- }
44
- return {};
45
- } catch (err) {
46
- console.log(err);
47
- return {};
48
- }
49
- }
50
-
51
- // get project by id return project object
52
- async GetProjectByID(
53
- projectID: string
54
- ): Promise<any> {
55
- let projectUrl: string = `${this.orgUrl}_apis/projects/${projectID}`;
56
- let project: any = await TFSServices.getItemContent(projectUrl, this.token);
57
- return project;
58
- }
59
- }
1
+ import { TFSServices } from "../helpers/tfs";
2
+ import logger from "../utils/logger";
3
+
4
+ export default class MangementDataProvider {
5
+ orgUrl: string = "";
6
+ token: string = "";
7
+
8
+ constructor(orgUrl: string, token: string) {
9
+ this.orgUrl = orgUrl;
10
+ this.token = token;
11
+ }
12
+
13
+ async GetCllectionLinkTypes() {
14
+ let url: string = `${this.orgUrl}_apis/wit/workitemrelationtypes`;
15
+ let res: any = await TFSServices.getItemContent(
16
+ url,
17
+ this.token,
18
+ "get",
19
+ null,
20
+ null
21
+ );
22
+ return res;
23
+ }
24
+
25
+ //get all projects
26
+ async GetProjects(): Promise<any> {
27
+ let projectUrl: string = `${this.orgUrl}_apis/projects?$top=1000`;
28
+ let projects: any = await TFSServices.getItemContent(
29
+ projectUrl,
30
+ this.token
31
+ );
32
+ return projects;
33
+ }
34
+
35
+ // get project by name return project object
36
+ async GetProjectByName(
37
+ projectName: string
38
+ ): Promise<any> {
39
+ try {
40
+ let projects: any = await this.GetProjects();
41
+ for (let i = 0; i < projects.value.length; i++) {
42
+ if (projects.value[i].name === projectName) return projects.value[i];
43
+ }
44
+ return {};
45
+ } catch (err) {
46
+ console.log(err);
47
+ return {};
48
+ }
49
+ }
50
+
51
+ // get project by id return project object
52
+ async GetProjectByID(
53
+ projectID: string
54
+ ): Promise<any> {
55
+ let projectUrl: string = `${this.orgUrl}_apis/projects/${projectID}`;
56
+ let project: any = await TFSServices.getItemContent(projectUrl, this.token);
57
+ return project;
58
+ }
59
+ }
@@ -1,142 +1,142 @@
1
- import { TFSServices } from "../helpers/tfs";
2
-
3
- import logger from "../utils/logger";
4
-
5
- export default class PipelinesDataProvider {
6
- orgUrl: string = "";
7
- token: string = "";
8
-
9
- constructor(orgUrl: string, token: string) {
10
- this.orgUrl = orgUrl;
11
- this.token = token;
12
- }
13
-
14
- async getPipelineFromPipelineId(projectName: string, buildId: number) {
15
- let url = `${this.orgUrl}${projectName}/_apis/build/builds/${buildId}`;
16
- return TFSServices.getItemContent(url, this.token, "get");
17
- } //GetCommitForPipeline
18
-
19
- async TriggerBuildById(
20
- projectName: string,
21
- buildDefanitionId: string,
22
- parameter: any
23
- ) {
24
- let data = {
25
- definition: {
26
- id: buildDefanitionId,
27
- },
28
- parameters: parameter, //'{"Test":"123"}'
29
- };
30
- logger.info(JSON.stringify(data));
31
- let url = `${this.orgUrl}${projectName}/_apis/build/builds?api-version=5.0`;
32
- let res = await TFSServices.postRequest(
33
- url,
34
- this.token,
35
- "post",
36
- data,
37
- null
38
- );
39
- return res;
40
- }
41
-
42
- async GetArtifactByBuildId(
43
- projectName: string,
44
- buildId: string,
45
- artifactName: string
46
- ): Promise<any> {
47
- try {
48
- logger.info(
49
- `Get artifactory from project ${projectName},BuildId ${buildId} artifact name ${artifactName}`
50
- );
51
- logger.info(`Check if build ${buildId} have artifact`);
52
- let url = `${this.orgUrl}${projectName}/_apis/build/builds/${buildId}/artifacts`;
53
- let response = await TFSServices.getItemContent(
54
- url,
55
- this.token,
56
- "Get",
57
- null,
58
- null
59
- );
60
- if (response.count == 0) {
61
- logger.info(`No artifact for build ${buildId} was published `);
62
- return response;
63
- }
64
- url = `${this.orgUrl}${projectName}/_apis/build/builds/${buildId}/artifacts?artifactName=${artifactName}`;
65
- let res = await TFSServices.getItemContent(
66
- url,
67
- this.token,
68
- "Get",
69
- null,
70
- null
71
- );
72
- logger.info(`Url for download :${res.resource.downloadUrl}`);
73
- let result = await TFSServices.downloadZipFile(
74
- res.resource.downloadUrl,
75
- this.token
76
- );
77
- return result;
78
- } catch (err) {
79
- logger.error(`Error : ${err}`);
80
- throw new Error(String(err));
81
- }
82
- }
83
-
84
- async GetReleaseByReleaseId(
85
- projectName: string,
86
- releaseId: number
87
- ): Promise<any> {
88
- let url = `${this.orgUrl}${projectName}/_apis/release/releases/${releaseId}`;
89
- url = url.replace("dev.azure.com", "vsrm.dev.azure.com");
90
- return TFSServices.getItemContent(url, this.token, "get", null, null);
91
- }
92
-
93
- async GetPipelineRunHistory(projectName: string, pipelineId: string) {
94
- let url: string = `${this.orgUrl}${projectName}/_apis/pipelines/${pipelineId}/runs`;
95
- let res: any = await TFSServices.getItemContent(
96
- url,
97
- this.token,
98
- "get",
99
- null,
100
- null
101
- );
102
- return res;
103
- }
104
-
105
- async GetReleaseHistory(projectName: string, definitionId: string) {
106
- let url: string = `${this.orgUrl}${projectName}/_apis/release/releases?definitionId=${definitionId}&$top=2000`;
107
- url = url.replace("dev.azure.com", "vsrm.dev.azure.com");
108
- let res: any = await TFSServices.getItemContent(
109
- url,
110
- this.token,
111
- "get",
112
- null,
113
- null
114
- );
115
- return res;
116
- }
117
-
118
- async GetAllPipelines(projectName: string) {
119
- let url: string = `${this.orgUrl}${projectName}/_apis/pipelines?$top=2000`;
120
- let res: any = await TFSServices.getItemContent(
121
- url,
122
- this.token,
123
- "get",
124
- null,
125
- null
126
- );
127
- return res;
128
- }
129
-
130
- async GetAllReleaseDefenitions(projectName: string) {
131
- let url: string = `${this.orgUrl}${projectName}/_apis/release/definitions?$top=2000`;
132
- url = url.replace("dev.azure.com", "vsrm.dev.azure.com");
133
- let res: any = await TFSServices.getItemContent(
134
- url,
135
- this.token,
136
- "get",
137
- null,
138
- null
139
- );
140
- return res;
141
- }
142
- }
1
+ import { TFSServices } from "../helpers/tfs";
2
+
3
+ import logger from "../utils/logger";
4
+
5
+ export default class PipelinesDataProvider {
6
+ orgUrl: string = "";
7
+ token: string = "";
8
+
9
+ constructor(orgUrl: string, token: string) {
10
+ this.orgUrl = orgUrl;
11
+ this.token = token;
12
+ }
13
+
14
+ async getPipelineFromPipelineId(projectName: string, buildId: number) {
15
+ let url = `${this.orgUrl}${projectName}/_apis/build/builds/${buildId}`;
16
+ return TFSServices.getItemContent(url, this.token, "get");
17
+ } //GetCommitForPipeline
18
+
19
+ async TriggerBuildById(
20
+ projectName: string,
21
+ buildDefanitionId: string,
22
+ parameter: any
23
+ ) {
24
+ let data = {
25
+ definition: {
26
+ id: buildDefanitionId,
27
+ },
28
+ parameters: parameter, //'{"Test":"123"}'
29
+ };
30
+ logger.info(JSON.stringify(data));
31
+ let url = `${this.orgUrl}${projectName}/_apis/build/builds?api-version=5.0`;
32
+ let res = await TFSServices.postRequest(
33
+ url,
34
+ this.token,
35
+ "post",
36
+ data,
37
+ null
38
+ );
39
+ return res;
40
+ }
41
+
42
+ async GetArtifactByBuildId(
43
+ projectName: string,
44
+ buildId: string,
45
+ artifactName: string
46
+ ): Promise<any> {
47
+ try {
48
+ logger.info(
49
+ `Get artifactory from project ${projectName},BuildId ${buildId} artifact name ${artifactName}`
50
+ );
51
+ logger.info(`Check if build ${buildId} have artifact`);
52
+ let url = `${this.orgUrl}${projectName}/_apis/build/builds/${buildId}/artifacts`;
53
+ let response = await TFSServices.getItemContent(
54
+ url,
55
+ this.token,
56
+ "Get",
57
+ null,
58
+ null
59
+ );
60
+ if (response.count == 0) {
61
+ logger.info(`No artifact for build ${buildId} was published `);
62
+ return response;
63
+ }
64
+ url = `${this.orgUrl}${projectName}/_apis/build/builds/${buildId}/artifacts?artifactName=${artifactName}`;
65
+ let res = await TFSServices.getItemContent(
66
+ url,
67
+ this.token,
68
+ "Get",
69
+ null,
70
+ null
71
+ );
72
+ logger.info(`Url for download :${res.resource.downloadUrl}`);
73
+ let result = await TFSServices.downloadZipFile(
74
+ res.resource.downloadUrl,
75
+ this.token
76
+ );
77
+ return result;
78
+ } catch (err) {
79
+ logger.error(`Error : ${err}`);
80
+ throw new Error(String(err));
81
+ }
82
+ }
83
+
84
+ async GetReleaseByReleaseId(
85
+ projectName: string,
86
+ releaseId: number
87
+ ): Promise<any> {
88
+ let url = `${this.orgUrl}${projectName}/_apis/release/releases/${releaseId}`;
89
+ url = url.replace("dev.azure.com", "vsrm.dev.azure.com");
90
+ return TFSServices.getItemContent(url, this.token, "get", null, null);
91
+ }
92
+
93
+ async GetPipelineRunHistory(projectName: string, pipelineId: string) {
94
+ let url: string = `${this.orgUrl}${projectName}/_apis/pipelines/${pipelineId}/runs`;
95
+ let res: any = await TFSServices.getItemContent(
96
+ url,
97
+ this.token,
98
+ "get",
99
+ null,
100
+ null
101
+ );
102
+ return res;
103
+ }
104
+
105
+ async GetReleaseHistory(projectName: string, definitionId: string) {
106
+ let url: string = `${this.orgUrl}${projectName}/_apis/release/releases?definitionId=${definitionId}&$top=2000`;
107
+ url = url.replace("dev.azure.com", "vsrm.dev.azure.com");
108
+ let res: any = await TFSServices.getItemContent(
109
+ url,
110
+ this.token,
111
+ "get",
112
+ null,
113
+ null
114
+ );
115
+ return res;
116
+ }
117
+
118
+ async GetAllPipelines(projectName: string) {
119
+ let url: string = `${this.orgUrl}${projectName}/_apis/pipelines?$top=2000`;
120
+ let res: any = await TFSServices.getItemContent(
121
+ url,
122
+ this.token,
123
+ "get",
124
+ null,
125
+ null
126
+ );
127
+ return res;
128
+ }
129
+
130
+ async GetAllReleaseDefenitions(projectName: string) {
131
+ let url: string = `${this.orgUrl}${projectName}/_apis/release/definitions?$top=2000`;
132
+ url = url.replace("dev.azure.com", "vsrm.dev.azure.com");
133
+ let res: any = await TFSServices.getItemContent(
134
+ url,
135
+ this.token,
136
+ "get",
137
+ null,
138
+ null
139
+ );
140
+ return res;
141
+ }
142
+ }