testit-api-client 1.0.6 → 1.0.8

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 (48) hide show
  1. package/README.md +7 -7
  2. package/dist/client.d.ts +24 -0
  3. package/dist/client.js +174 -0
  4. package/dist/index.d.ts +2 -0
  5. package/dist/index.js +18 -0
  6. package/dist/types/attachment.d.ts +14 -0
  7. package/dist/types/attachment.js +2 -0
  8. package/dist/types/autotest.d.ts +98 -0
  9. package/dist/types/autotest.js +2 -0
  10. package/dist/types/autotestResults.d.ts +22 -0
  11. package/dist/types/autotestResults.js +2 -0
  12. package/dist/types/autotestStep.d.ts +5 -0
  13. package/dist/types/autotestStep.js +2 -0
  14. package/dist/types/capabilities.d.ts +1 -0
  15. package/dist/types/capabilities.js +2 -0
  16. package/dist/types/client.d.ts +16 -0
  17. package/dist/types/client.js +2 -0
  18. package/dist/types/config.d.ts +11 -0
  19. package/dist/types/config.js +2 -0
  20. package/dist/types/configuration.d.ts +16 -0
  21. package/dist/types/configuration.js +2 -0
  22. package/dist/types/index.d.ts +18 -0
  23. package/dist/types/index.js +34 -0
  24. package/dist/types/label.d.ts +7 -0
  25. package/dist/types/label.js +2 -0
  26. package/dist/types/link.d.ts +24 -0
  27. package/dist/types/link.js +2 -0
  28. package/dist/types/outcome.d.ts +1 -0
  29. package/dist/types/outcome.js +2 -0
  30. package/dist/types/parameters.d.ts +1 -0
  31. package/dist/types/parameters.js +2 -0
  32. package/dist/types/properties.d.ts +1 -0
  33. package/dist/types/properties.js +2 -0
  34. package/dist/types/stepResults.d.ts +14 -0
  35. package/dist/types/stepResults.js +2 -0
  36. package/dist/types/tag.d.ts +3 -0
  37. package/dist/types/tag.js +2 -0
  38. package/dist/types/testPoint.d.ts +9 -0
  39. package/dist/types/testPoint.js +2 -0
  40. package/dist/types/testResult.d.ts +31 -0
  41. package/dist/types/testResult.js +2 -0
  42. package/dist/types/testRun.d.ts +20 -0
  43. package/dist/types/testRun.js +2 -0
  44. package/dist/types/workItem.d.ts +3 -0
  45. package/dist/types/workItem.js +2 -0
  46. package/dist/validation.d.ts +2 -0
  47. package/dist/validation.js +16 -0
  48. package/package.json +3 -3
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # TestGear TMS API client for JavaScript
2
- ![TestGear](https://raw.githubusercontent.com/testgear-tms/api-client-js/main/images/banner.png)
1
+ # Test IT TMS API client for JavaScript
2
+ ![Test IT](https://raw.githubusercontent.com/testit-tms/api-client-js/master/images/banner.png)
3
3
 
4
4
  # Getting Started
5
5
 
6
6
  ## Installation
7
7
  ```
8
- npm install testgear-api-client
8
+ npm install testit-api-client
9
9
  ```
10
10
 
11
11
  # Usage
@@ -23,7 +23,7 @@ const client = new Client({
23
23
  });
24
24
  ```
25
25
 
26
- After configuration is done you can access different clients from `Client` object and then use methods to control TestGear.
26
+ After configuration is done you can access different clients from `Client` object and then use methods to control Test IT.
27
27
 
28
28
  ## Examples
29
29
  ```ts
@@ -40,12 +40,12 @@ await client.completeTestRun(testRunId);
40
40
 
41
41
  You can help to develop the project. Any contributions are **greatly appreciated**.
42
42
 
43
- * If you have suggestions for adding or removing projects, feel free to [open an issue](https://github.com/testgear-tms/api-client-js/issues/new) to discuss it, or directly create a pull request after you edit the *README.md* file with necessary changes.
43
+ * If you have suggestions for adding or removing projects, feel free to [open an issue](https://github.com/testit-tms/api-client-js/issues/new) to discuss it, or directly create a pull request after you edit the *README.md* file with necessary changes.
44
44
  * Please make sure you check your spelling and grammar.
45
45
  * Create individual PR for each suggestion.
46
- * Please also read through the [Code Of Conduct](https://github.com/testgear-tms/api-client-js/blob/master/CODE_OF_CONDUCT.md) before posting your first idea as well.
46
+ * Please also read through the [Code Of Conduct](https://github.com/testit-tms/api-client-js/blob/master/CODE_OF_CONDUCT.md) before posting your first idea as well.
47
47
 
48
48
  # License
49
49
 
50
- Distributed under the Apache-2.0 License. See [LICENSE](https://github.com/testgear-tms/api-client-js/blob/master/LICENSE.md) for more information.
50
+ Distributed under the Apache-2.0 License. See [LICENSE](https://github.com/testit-tms/api-client-js/blob/master/LICENSE.md) for more information.
51
51
 
@@ -0,0 +1,24 @@
1
+ import { Attachment, Autotest, AutotestPost, AutotestPut, AutotestQuery, AutotestResultsForTestRun, ClientConfig, ClientConfigWithFile, IClient, TestRunGet, TestRunPost, WorkItemId } from './types';
2
+ export declare class Client implements IClient {
3
+ private readonly axios;
4
+ private config;
5
+ private readonly request;
6
+ constructor(config: Partial<ClientConfigWithFile>);
7
+ checkConnection(): Promise<void>;
8
+ getAutotest(query: AutotestQuery): Promise<Autotest[]>;
9
+ createAutotest(autotest: AutotestPost): Promise<Autotest>;
10
+ updateAutotest(autotest: AutotestPut): Promise<void>;
11
+ linkToWorkItem(autotestId: string, workItem: WorkItemId): Promise<void>;
12
+ getTestRun(testRunId: string): TestRunGet;
13
+ getTestRunById(testRunId: string): Promise<TestRunGet>;
14
+ createTestRun(testRun: TestRunPost): Promise<TestRunGet>;
15
+ startTestRun(testRunId: string): Promise<void>;
16
+ loadTestRunResults(testRunId: string, results: AutotestResultsForTestRun[]): Promise<string[]>;
17
+ completeTestRun(testRunId: string): Promise<void>;
18
+ getConfig(): ClientConfig;
19
+ loadAttachment(filePath: string): Promise<Attachment>;
20
+ private readCliConfig;
21
+ private readEnvConfig;
22
+ private readConfigFile;
23
+ static mergeConfig(oldConfig: Partial<ClientConfig>, newConfig: Partial<ClientConfig>): Partial<ClientConfig>;
24
+ }
package/dist/client.js ADDED
@@ -0,0 +1,174 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.Client = void 0;
18
+ const axios_1 = __importDefault(require("axios"));
19
+ const minimist_1 = __importDefault(require("minimist"));
20
+ const fs_1 = require("fs");
21
+ const form_data_1 = __importDefault(require("form-data"));
22
+ const path_1 = require("path");
23
+ const validation_1 = require("./validation");
24
+ // TODO: implement via the base client
25
+ var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
26
+ class Client {
27
+ constructor(config) {
28
+ const { configFile } = config, restConfig = __rest(config, ["configFile"]);
29
+ let finalConfig = restConfig;
30
+ if (configFile) {
31
+ finalConfig = Client.mergeConfig(finalConfig, this.readConfigFile(configFile));
32
+ }
33
+ finalConfig = Client.mergeConfig(finalConfig, this.readEnvConfig());
34
+ finalConfig = Client.mergeConfig(finalConfig, this.readCliConfig());
35
+ this.config = (0, validation_1.validateConfig)(config);
36
+ const baseURL = new URL('/api/v2', this.config.url).toString();
37
+ this.axios = axios_1.default.create({
38
+ baseURL,
39
+ headers: {
40
+ Authorization: `PrivateToken ${this.config.privateToken}`,
41
+ },
42
+ });
43
+ // TODO: implement via the base client
44
+ this.request = new XMLHttpRequest();
45
+ }
46
+ async checkConnection() {
47
+ try {
48
+ await axios_1.default.get(new URL('version.json', this.config.url).toString());
49
+ }
50
+ catch (err) {
51
+ throw new Error('Cannot connect to TMS');
52
+ }
53
+ }
54
+ // TODO: add query object
55
+ async getAutotest(query) {
56
+ const params = new URLSearchParams();
57
+ Object.keys(query).forEach((key) => {
58
+ const value = query[key];
59
+ if (value === undefined) {
60
+ return;
61
+ }
62
+ if (Array.isArray(value)) {
63
+ value.forEach((v) => params.append(key, v));
64
+ }
65
+ else {
66
+ params.append(key, value.toString());
67
+ }
68
+ });
69
+ return this.axios
70
+ .get(`/autoTests?${params.toString()}`)
71
+ .then((res) => res.data);
72
+ }
73
+ async createAutotest(autotest) {
74
+ return this.axios.post('/autoTests', autotest).then((res) => res.data);
75
+ }
76
+ async updateAutotest(autotest) {
77
+ return this.axios.put('/autoTests', autotest);
78
+ }
79
+ async linkToWorkItem(autotestId, workItem) {
80
+ return this.axios.post(`/autoTests/${autotestId}/workItems`, workItem);
81
+ }
82
+ // TODO: implement via the base client
83
+ getTestRun(testRunId) {
84
+ const baseURL = new URL('/api/v2', this.config.url).toString();
85
+ this.request.open("GET", `${baseURL}/testRuns/${testRunId}`, false);
86
+ this.request.setRequestHeader('Authorization', `PrivateToken ${this.config.privateToken}`);
87
+ this.request.send(null);
88
+ return JSON.parse(this.request.responseText);
89
+ }
90
+ async getTestRunById(testRunId) {
91
+ return this.axios
92
+ .get(`/testRuns/${testRunId}`)
93
+ .then((res) => res.data);
94
+ }
95
+ async createTestRun(testRun) {
96
+ return this.axios
97
+ .post('/testRuns', testRun)
98
+ .then((res) => res.data);
99
+ }
100
+ async startTestRun(testRunId) {
101
+ return this.axios.post(`/testRuns/${testRunId}/start`);
102
+ }
103
+ async loadTestRunResults(testRunId, results) {
104
+ return await this.axios
105
+ .post(`/testRuns/${testRunId}/testResults`, results)
106
+ .then((res) => res.data);
107
+ }
108
+ async completeTestRun(testRunId) {
109
+ return this.axios.post(`/testRuns/${testRunId}/complete`);
110
+ }
111
+ getConfig() {
112
+ return this.config;
113
+ }
114
+ async loadAttachment(filePath) {
115
+ const form = new form_data_1.default();
116
+ form.append('file', (0, fs_1.readFileSync)(filePath), (0, path_1.basename)(filePath));
117
+ return this.axios
118
+ .post('/Attachments', form, {
119
+ headers: form.getHeaders(),
120
+ })
121
+ .then((res) => res.data);
122
+ }
123
+ readCliConfig() {
124
+ const args = (0, minimist_1.default)(process.argv.slice(2));
125
+ let config = {};
126
+ if (args['tmsConfig']) {
127
+ config = this.readConfigFile(args['tmsConfig']);
128
+ }
129
+ return Client.mergeConfig(config, {
130
+ url: args['tmsUrl'],
131
+ privateToken: args['tmsPrivateToken'],
132
+ projectId: args['tmsProjectId'],
133
+ configurationId: args['tmsConfigurationId'],
134
+ testRunId: args['tmsTestRunId'],
135
+ automaticCreationTestCases: args['tmsAutomaticCreationTestCases'],
136
+ });
137
+ }
138
+ readEnvConfig() {
139
+ let config = {};
140
+ if (process.env['TMS_CONFIG_FILE']) {
141
+ config = this.readConfigFile(process.env['TMS_CONFIG_FILE']);
142
+ }
143
+ return Client.mergeConfig(config, {
144
+ url: process.env['TMS_URL'],
145
+ privateToken: process.env['TMS_PRIVATE_TOKEN'],
146
+ projectId: process.env['TMS_PROJECT_ID'],
147
+ configurationId: process.env['TMS_CONFIGURATION_ID'],
148
+ testRunId: process.env['TMS_TEST_RUN_ID'],
149
+ automaticCreationTestCases: process.env['TMS_CREATION_TEST_CASES'] === 'true',
150
+ });
151
+ }
152
+ readConfigFile(path) {
153
+ if (!(0, fs_1.existsSync)(path)) {
154
+ throw new Error('Config file not found');
155
+ }
156
+ const config = JSON.parse((0, fs_1.readFileSync)(path, { encoding: 'utf8' }));
157
+ if (config.privateToken) {
158
+ console.warn('Private token is in config file, it is not secure');
159
+ }
160
+ return config;
161
+ }
162
+ static mergeConfig(oldConfig, newConfig) {
163
+ var _a, _b, _c, _d, _e, _f, _g;
164
+ return {
165
+ url: (_a = newConfig.url) !== null && _a !== void 0 ? _a : oldConfig.url,
166
+ privateToken: (_b = newConfig.privateToken) !== null && _b !== void 0 ? _b : oldConfig.privateToken,
167
+ projectId: (_c = newConfig.projectId) !== null && _c !== void 0 ? _c : oldConfig.projectId,
168
+ configurationId: (_d = newConfig.configurationId) !== null && _d !== void 0 ? _d : oldConfig.configurationId,
169
+ testRunId: (_e = newConfig.testRunId) !== null && _e !== void 0 ? _e : oldConfig.testRunId,
170
+ automaticCreationTestCases: (_g = (_f = newConfig.automaticCreationTestCases) !== null && _f !== void 0 ? _f : oldConfig.automaticCreationTestCases) !== null && _g !== void 0 ? _g : false,
171
+ };
172
+ }
173
+ }
174
+ exports.Client = Client;
@@ -0,0 +1,2 @@
1
+ export * from './client';
2
+ export * from './types';
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client"), exports);
18
+ __exportStar(require("./types"), exports);
@@ -0,0 +1,14 @@
1
+ export interface AttachmentPut {
2
+ id: string;
3
+ }
4
+ export interface Attachment {
5
+ fileId: string;
6
+ type: string;
7
+ size: number;
8
+ name: string;
9
+ createDate?: string;
10
+ modifiedDate?: string;
11
+ createdById?: string;
12
+ modifiedById?: string;
13
+ id?: string;
14
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,98 @@
1
+ import { LabelPost, LabelShort } from './label';
2
+ import { Link, LinkPost, LinkPut } from './link';
3
+ import { AutotestStep } from './autotestStep';
4
+ export interface AutotestPost {
5
+ globalId?: number;
6
+ isDeleted?: boolean;
7
+ id?: string;
8
+ createdDate?: string;
9
+ modifiedDate?: string;
10
+ createdById?: string;
11
+ modifiedById?: string;
12
+ mustBeApproved?: boolean;
13
+ externalId: string;
14
+ links?: LinkPost[];
15
+ projectId: string;
16
+ name: string;
17
+ namespace?: string;
18
+ classname?: string;
19
+ steps?: AutotestStep[];
20
+ setup?: AutotestStep[];
21
+ teardown?: AutotestStep[];
22
+ title?: string;
23
+ description?: string;
24
+ labels?: LabelPost[];
25
+ shouldCreateWorkItem?: boolean;
26
+ }
27
+ export interface AutotestPut {
28
+ id?: string;
29
+ externalId: string;
30
+ links?: LinkPost[];
31
+ projectId: string;
32
+ name: string;
33
+ namespace?: string;
34
+ classname?: string;
35
+ steps?: AutotestStep[];
36
+ setup?: AutotestStep[];
37
+ teardown?: AutotestStep[];
38
+ title?: string;
39
+ description?: string;
40
+ labels?: LabelPost[];
41
+ }
42
+ export interface Autotest {
43
+ globalId?: number;
44
+ isDeleted?: boolean;
45
+ id?: string;
46
+ createdDate?: string;
47
+ modifiedDate?: string;
48
+ createdById?: string;
49
+ modifiedById?: string;
50
+ mustBeApproved?: boolean;
51
+ externalId: string;
52
+ links?: LinkPut[];
53
+ projectId: string;
54
+ name: string;
55
+ namespace?: string;
56
+ classname?: string;
57
+ steps?: AutotestStep[];
58
+ setup?: AutotestStep[];
59
+ teardown?: AutotestStep[];
60
+ title?: string;
61
+ description?: string;
62
+ labels?: LabelPost[];
63
+ }
64
+ export interface AutotestGet {
65
+ externalId?: string;
66
+ links?: Link[];
67
+ projectId?: string;
68
+ name?: string;
69
+ namespace?: string;
70
+ classname?: string;
71
+ steps?: AutotestStep[];
72
+ setup?: AutotestStep[];
73
+ teardown: AutotestStep[];
74
+ global?: number;
75
+ createdDate?: string;
76
+ modifiedDate?: string;
77
+ createdById?: string;
78
+ modifiedById?: string;
79
+ labels?: LabelShort[];
80
+ id?: string;
81
+ isDeleted?: boolean;
82
+ }
83
+ export interface AutotestQuery {
84
+ projectId?: string;
85
+ externalId?: string;
86
+ globalId?: number;
87
+ namespace?: string;
88
+ isNamespaceNull?: boolean;
89
+ classname?: string;
90
+ isClassnameNull?: boolean;
91
+ isDeleted?: boolean;
92
+ labels?: string[];
93
+ skip?: number;
94
+ take?: number;
95
+ orderBy?: string;
96
+ searchField?: string;
97
+ searchValue?: string;
98
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,22 @@
1
+ import { AttachmentPut } from './attachment';
2
+ import { LinkPost } from './link';
3
+ import { OutcomeType } from './outcome';
4
+ import { Parameters } from './parameters';
5
+ import { AttachmentPutModelAutotestStepResults } from './stepResults';
6
+ export interface AutotestResultsForTestRun {
7
+ configurationId: string;
8
+ links?: LinkPost[];
9
+ failureReasonName?: string;
10
+ autotestExternalId: string;
11
+ outcome: OutcomeType;
12
+ message?: string;
13
+ traces?: string;
14
+ startedOn?: string;
15
+ completedOn?: string;
16
+ duration?: number;
17
+ attachments?: AttachmentPut[];
18
+ parameters?: Parameters;
19
+ stepResults?: AttachmentPutModelAutotestStepResults[];
20
+ setupResults?: AttachmentPutModelAutotestStepResults[];
21
+ teardownResults?: AttachmentPutModelAutotestStepResults[];
22
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ export interface AutotestStep {
2
+ title: string;
3
+ description?: string;
4
+ steps?: AutotestStep[];
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export type Capabilities = Record<string, string>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,16 @@
1
+ import { Attachment, Autotest, AutotestPost, AutotestPut, AutotestQuery, AutotestResultsForTestRun, ClientConfig, TestRunGet, TestRunPost, WorkItemId } from '.';
2
+ export interface IClient {
3
+ checkConnection(): Promise<void>;
4
+ getAutotest(query: AutotestQuery): Promise<Autotest[]>;
5
+ createAutotest(autotest: AutotestPost): Promise<Autotest>;
6
+ updateAutotest(autotest: AutotestPut): Promise<void>;
7
+ linkToWorkItem(autotestId: string, workItem: WorkItemId): Promise<void>;
8
+ getTestRun(testRunId: string): TestRunGet;
9
+ getTestRunById(testRunId: string): Promise<TestRunGet>;
10
+ createTestRun(testRun: TestRunPost): Promise<TestRunGet>;
11
+ startTestRun(testRunId: string): Promise<void>;
12
+ loadTestRunResults(testRunId: string, results: AutotestResultsForTestRun[]): Promise<string[]>;
13
+ completeTestRun(testRunId: string): Promise<void>;
14
+ getConfig(): ClientConfig;
15
+ loadAttachment(fileName: string): Promise<Attachment>;
16
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ export interface ClientConfig {
2
+ url: string;
3
+ privateToken: string;
4
+ projectId: string;
5
+ configurationId: string;
6
+ testRunId?: string;
7
+ automaticCreationTestCases?: boolean;
8
+ }
9
+ export interface ClientConfigWithFile extends ClientConfig {
10
+ configFile?: string;
11
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,16 @@
1
+ import { Capabilities } from './capabilities';
2
+ export interface Configuration {
3
+ description?: string;
4
+ isActive?: boolean;
5
+ capabilities: Capabilities;
6
+ projectId?: string;
7
+ isDefault?: boolean;
8
+ name?: string;
9
+ createdDate?: string;
10
+ modifiedDate?: string;
11
+ createdById?: string;
12
+ modifiedById?: string;
13
+ globalId?: number;
14
+ id?: number;
15
+ isDeleted?: boolean;
16
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,18 @@
1
+ export * from './attachment';
2
+ export * from './autotest';
3
+ export * from './autotestResults';
4
+ export * from './autotestStep';
5
+ export * from './capabilities';
6
+ export * from './client';
7
+ export * from './config';
8
+ export * from './configuration';
9
+ export * from './label';
10
+ export * from './link';
11
+ export * from './outcome';
12
+ export * from './parameters';
13
+ export * from './properties';
14
+ export * from './stepResults';
15
+ export * from './tag';
16
+ export * from './testResult';
17
+ export * from './testRun';
18
+ export * from './workItem';
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./attachment"), exports);
18
+ __exportStar(require("./autotest"), exports);
19
+ __exportStar(require("./autotestResults"), exports);
20
+ __exportStar(require("./autotestStep"), exports);
21
+ __exportStar(require("./capabilities"), exports);
22
+ __exportStar(require("./client"), exports);
23
+ __exportStar(require("./config"), exports);
24
+ __exportStar(require("./configuration"), exports);
25
+ __exportStar(require("./label"), exports);
26
+ __exportStar(require("./link"), exports);
27
+ __exportStar(require("./outcome"), exports);
28
+ __exportStar(require("./parameters"), exports);
29
+ __exportStar(require("./properties"), exports);
30
+ __exportStar(require("./stepResults"), exports);
31
+ __exportStar(require("./tag"), exports);
32
+ __exportStar(require("./testResult"), exports);
33
+ __exportStar(require("./testRun"), exports);
34
+ __exportStar(require("./workItem"), exports);
@@ -0,0 +1,7 @@
1
+ export interface LabelShort {
2
+ globalId?: number;
3
+ name: string;
4
+ }
5
+ export interface LabelPost {
6
+ name: string;
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,24 @@
1
+ export type LinkType = 'Related' | 'BlockedBy' | 'Defect' | 'Issue' | 'Requirement' | 'Repository';
2
+ export interface LinkPost {
3
+ title?: string;
4
+ url: string;
5
+ description?: string;
6
+ type?: LinkType;
7
+ hasInfo?: boolean;
8
+ }
9
+ export interface LinkPut {
10
+ id?: string;
11
+ title?: string;
12
+ url: string;
13
+ description?: string;
14
+ type?: LinkType;
15
+ hasInfo?: boolean;
16
+ }
17
+ export interface Link {
18
+ id?: string;
19
+ title?: string;
20
+ url: string;
21
+ description?: string;
22
+ type?: LinkType;
23
+ hasInfo?: boolean;
24
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export type OutcomeType = 'Passed' | 'Failed' | 'Pending' | 'Blocked' | 'Skipped';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export type Parameters = Record<string, string>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export type Properties = Record<string, string>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,14 @@
1
+ import { AttachmentPut } from './attachment';
2
+ import { OutcomeType } from './outcome';
3
+ import { Parameters } from './parameters';
4
+ export interface AttachmentPutModelAutotestStepResults {
5
+ title?: string;
6
+ description?: string;
7
+ startedOn?: string;
8
+ completedOn?: string;
9
+ duration?: number;
10
+ outcome?: OutcomeType;
11
+ stepResults?: AttachmentPutModelAutotestStepResults[];
12
+ attachments?: AttachmentPut[];
13
+ parameters?: Parameters;
14
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export interface TagShort {
2
+ name: string;
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ export interface TestPointShort {
2
+ testSuiteId?: string;
3
+ id?: string;
4
+ testerId?: string;
5
+ workItemId?: string;
6
+ configurationId?: string;
7
+ status?: string;
8
+ lastTestResultId?: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,31 @@
1
+ import { Attachment } from './attachment';
2
+ import { AutotestGet } from './autotest';
3
+ import { Configuration } from './configuration';
4
+ import { Link } from './link';
5
+ import { OutcomeType } from './outcome';
6
+ import { Parameters } from './parameters';
7
+ import { Properties } from './properties';
8
+ import { TestPointShort } from './testPoint';
9
+ export interface TestResultGet {
10
+ configuration?: Configuration;
11
+ autoTest?: AutotestGet;
12
+ is?: string;
13
+ configurationId?: string;
14
+ workItemVersionId?: string;
15
+ autoTestId?: string;
16
+ message?: string;
17
+ traces?: string;
18
+ startedOn?: string;
19
+ completedOn?: string;
20
+ runByUserId?: string;
21
+ stoppedByUserId?: string;
22
+ testPointId?: string;
23
+ testPoint?: TestPointShort;
24
+ testRunId?: string;
25
+ outcome?: OutcomeType;
26
+ comment?: string;
27
+ links?: Link[];
28
+ attachments?: Attachment[];
29
+ parameters?: Parameters;
30
+ properties?: Properties;
31
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,20 @@
1
+ import { TestResultGet } from './testResult';
2
+ export type TestRunStateType = 'NotStarted' | 'InProgress' | 'Stopped' | 'Completed';
3
+ export interface TestRunPost {
4
+ projectId: string;
5
+ name?: string;
6
+ }
7
+ export interface TestRunGet {
8
+ startedOn?: string;
9
+ completedOn?: string;
10
+ stateName?: TestRunStateType;
11
+ projectId?: string;
12
+ testPlanId?: string;
13
+ testResults?: TestResultGet[];
14
+ createdDate?: string;
15
+ modifiedDate?: string;
16
+ createById?: string;
17
+ modifiedById?: string;
18
+ id: string;
19
+ name: string;
20
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export interface WorkItemId {
2
+ id: string;
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ import { ClientConfig } from '.';
2
+ export declare function validateConfig(config: Partial<ClientConfig>): ClientConfig;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateConfig = void 0;
4
+ const zod_1 = require("zod");
5
+ const configSchema = zod_1.z.object({
6
+ configurationId: zod_1.z.string().uuid(),
7
+ privateToken: zod_1.z.string(),
8
+ projectId: zod_1.z.string().uuid(),
9
+ url: zod_1.z.string().url(),
10
+ testRunId: zod_1.z.string().uuid().optional(),
11
+ automaticCreationTestCases: zod_1.z.boolean().optional(),
12
+ });
13
+ function validateConfig(config) {
14
+ return configSchema.parse(config);
15
+ }
16
+ exports.validateConfig = validateConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testit-api-client",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "Client provides methods for communication with TMS API.",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -31,8 +31,8 @@
31
31
  "form-data": "^4.0.0",
32
32
  "minimist": "^1.2.5",
33
33
  "querystring": "^0.2.1",
34
- "zod": "^3.11.6",
35
- "xmlhttprequest": "^1.8.0"
34
+ "xmlhttprequest": "^1.8.0",
35
+ "zod": "^3.11.6"
36
36
  },
37
37
  "files": [
38
38
  "dist"