@dichovsky/testrail-api-client 1.0.0 → 2.1.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 +22 -0
- package/dist/cli/auth.d.ts +21 -0
- package/dist/cli/auth.js +16 -0
- package/dist/cli/body.d.ts +42 -0
- package/dist/cli/body.js +89 -0
- package/dist/cli/dispatch.d.ts +16 -0
- package/dist/cli/dispatch.js +87 -0
- package/dist/cli/handler-context.d.ts +43 -0
- package/dist/cli/handler-context.js +2 -0
- package/dist/cli/handlers/case-write.d.ts +4 -0
- package/dist/cli/handlers/case-write.js +26 -0
- package/dist/cli/handlers/case.d.ts +4 -0
- package/dist/cli/handlers/case.js +11 -0
- package/dist/cli/handlers/milestone.d.ts +4 -0
- package/dist/cli/handlers/milestone.js +15 -0
- package/dist/cli/handlers/project.d.ts +4 -0
- package/dist/cli/handlers/project.js +11 -0
- package/dist/cli/handlers/result-write.d.ts +4 -0
- package/dist/cli/handlers/result-write.js +40 -0
- package/dist/cli/handlers/result.d.ts +3 -0
- package/dist/cli/handlers/result.js +11 -0
- package/dist/cli/handlers/run-write.d.ts +10 -0
- package/dist/cli/handlers/run-write.js +29 -0
- package/dist/cli/handlers/run.d.ts +4 -0
- package/dist/cli/handlers/run.js +15 -0
- package/dist/cli/handlers/suite.d.ts +4 -0
- package/dist/cli/handlers/suite.js +10 -0
- package/dist/cli/handlers/user.d.ts +4 -0
- package/dist/cli/handlers/user.js +11 -0
- package/dist/cli/ids.d.ts +6 -0
- package/dist/cli/ids.js +20 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.js +198 -0
- package/dist/cli/install-skill.d.ts +35 -0
- package/dist/cli/install-skill.js +71 -0
- package/dist/cli/metadata.d.ts +37 -0
- package/dist/cli/metadata.js +151 -0
- package/dist/cli/output.d.ts +28 -0
- package/dist/cli/output.js +84 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +1 -266
- package/dist/client-core.d.ts +16 -7
- package/dist/client-core.js +153 -27
- package/dist/client.d.ts +274 -118
- package/dist/client.js +404 -463
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +1 -0
- package/dist/errors.d.ts +11 -9
- package/dist/errors.js +12 -8
- package/dist/index.d.ts +4 -2
- package/dist/index.js +2 -1
- package/dist/modules/attachments.d.ts +19 -0
- package/dist/modules/attachments.js +64 -0
- package/dist/modules/cases.d.ts +13 -0
- package/dist/modules/cases.js +58 -0
- package/dist/modules/configurations.d.ts +14 -0
- package/dist/modules/configurations.js +37 -0
- package/dist/modules/datasets.d.ts +12 -0
- package/dist/modules/datasets.js +28 -0
- package/dist/modules/metadata.d.ts +14 -0
- package/dist/modules/metadata.js +31 -0
- package/dist/modules/milestones.d.ts +12 -0
- package/dist/modules/milestones.js +36 -0
- package/dist/modules/plans.d.ts +16 -0
- package/dist/modules/plans.js +59 -0
- package/dist/modules/projects.d.ts +36 -0
- package/dist/modules/projects.js +55 -0
- package/dist/modules/reports.d.ts +9 -0
- package/dist/modules/reports.js +16 -0
- package/dist/modules/results.d.ts +14 -0
- package/dist/modules/results.js +69 -0
- package/dist/modules/runs.d.ts +14 -0
- package/dist/modules/runs.js +57 -0
- package/dist/modules/sections.d.ts +16 -0
- package/dist/modules/sections.js +37 -0
- package/dist/modules/sharedSteps.d.ts +12 -0
- package/dist/modules/sharedSteps.js +28 -0
- package/dist/modules/suites.d.ts +37 -0
- package/dist/modules/suites.js +54 -0
- package/dist/modules/tests.d.ts +9 -0
- package/dist/modules/tests.js +25 -0
- package/dist/modules/users.d.ts +18 -0
- package/dist/modules/users.js +62 -0
- package/dist/modules/variables.d.ts +11 -0
- package/dist/modules/variables.js +24 -0
- package/dist/schemas.d.ts +544 -0
- package/dist/schemas.js +419 -0
- package/dist/types.d.ts +1 -55
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +4 -0
- package/package.json +23 -15
- package/skill/SKILL.md +395 -0
- package/src/cli/auth.ts +37 -0
- package/src/cli/body.ts +100 -0
- package/src/cli/dispatch.ts +91 -0
- package/src/cli/handler-context.ts +46 -0
- package/src/cli/handlers/case-write.ts +26 -0
- package/src/cli/handlers/case.ts +13 -0
- package/src/cli/handlers/milestone.ts +19 -0
- package/src/cli/handlers/project.ts +13 -0
- package/src/cli/handlers/result-write.ts +40 -0
- package/src/cli/handlers/result.ts +14 -0
- package/src/cli/handlers/run-write.ts +30 -0
- package/src/cli/handlers/run.ts +19 -0
- package/src/cli/handlers/suite.ts +12 -0
- package/src/cli/handlers/user.ts +13 -0
- package/src/cli/ids.ts +20 -0
- package/src/cli/index.ts +224 -0
- package/src/cli/install-skill.ts +89 -0
- package/src/cli/metadata.ts +194 -0
- package/src/cli/output.ts +96 -0
- package/src/cli.ts +1 -286
- package/src/client-core.ts +183 -67
- package/src/client.ts +414 -483
- package/src/constants.ts +1 -0
- package/src/errors.ts +18 -11
- package/src/index.ts +50 -8
- package/src/modules/attachments.ts +125 -0
- package/src/modules/cases.ts +78 -0
- package/src/modules/configurations.ts +68 -0
- package/src/modules/datasets.ts +44 -0
- package/src/modules/metadata.ts +63 -0
- package/src/modules/milestones.ts +54 -0
- package/src/modules/plans.ts +89 -0
- package/src/modules/projects.ts +67 -0
- package/src/modules/reports.ts +23 -0
- package/src/modules/results.ts +90 -0
- package/src/modules/runs.ts +70 -0
- package/src/modules/sections.ts +55 -0
- package/src/modules/sharedSteps.ts +44 -0
- package/src/modules/suites.ts +67 -0
- package/src/modules/tests.ts +28 -0
- package/src/modules/users.ts +87 -0
- package/src/modules/variables.ts +36 -0
- package/src/schemas.ts +551 -0
- package/src/types.ts +11 -60
- package/src/utils.ts +5 -0
package/dist/schemas.js
ADDED
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const zObject = (shape) => z.object(shape).passthrough();
|
|
3
|
+
/**
|
|
4
|
+
* Core schemas for common TestRail API structures.
|
|
5
|
+
* These are used to validate API responses and provide static type inference via `z.infer`.
|
|
6
|
+
*/
|
|
7
|
+
// ── Common & Foundational Schemas ─────────────────────────────────────────────
|
|
8
|
+
export const PaginationSchema = zObject({
|
|
9
|
+
limit: z.number().optional(),
|
|
10
|
+
offset: z.number().optional(),
|
|
11
|
+
});
|
|
12
|
+
export const TestRailConfigSchema = zObject({
|
|
13
|
+
baseUrl: z.string().url(),
|
|
14
|
+
email: z.string().email(),
|
|
15
|
+
apiKey: z.string().min(1),
|
|
16
|
+
timeout: z.number().optional(),
|
|
17
|
+
maxRetries: z.number().int().nonnegative().optional(),
|
|
18
|
+
enableCache: z.boolean().optional(),
|
|
19
|
+
cacheTtl: z.number().int().positive().optional(),
|
|
20
|
+
cacheCleanupInterval: z.number().int().positive().optional(),
|
|
21
|
+
maxCacheSize: z.number().int().positive().optional(),
|
|
22
|
+
rateLimiter: zObject({
|
|
23
|
+
maxRequests: z.number().int().positive(),
|
|
24
|
+
windowMs: z.number().int().positive(),
|
|
25
|
+
}).optional(),
|
|
26
|
+
allowInsecure: z.boolean().optional(),
|
|
27
|
+
allowPrivateHosts: z.boolean().optional(),
|
|
28
|
+
});
|
|
29
|
+
// ── Identity & User Schemas ───────────────────────────────────────────────────
|
|
30
|
+
export const UserSchema = zObject({
|
|
31
|
+
id: z.number(),
|
|
32
|
+
name: z.string(),
|
|
33
|
+
email: z.string().email(),
|
|
34
|
+
is_active: z.boolean(),
|
|
35
|
+
role_id: z.number().optional(),
|
|
36
|
+
role: z.string().optional(),
|
|
37
|
+
});
|
|
38
|
+
export const RoleSchema = zObject({
|
|
39
|
+
id: z.number(),
|
|
40
|
+
name: z.string(),
|
|
41
|
+
is_default: z.boolean(),
|
|
42
|
+
});
|
|
43
|
+
export const GroupSchema = zObject({
|
|
44
|
+
id: z.number(),
|
|
45
|
+
name: z.string(),
|
|
46
|
+
user_ids: z.array(z.number()).optional(),
|
|
47
|
+
});
|
|
48
|
+
// ── Project & Suite Schemas ────────────────────────────────────────────────────
|
|
49
|
+
export const ProjectSchema = zObject({
|
|
50
|
+
id: z.number(),
|
|
51
|
+
name: z.string(),
|
|
52
|
+
announcement: z.string().optional(),
|
|
53
|
+
show_announcement: z.boolean().optional(),
|
|
54
|
+
is_completed: z.boolean().optional(),
|
|
55
|
+
completed_on: z.number().optional(),
|
|
56
|
+
suite_mode: z.number(),
|
|
57
|
+
url: z.string(),
|
|
58
|
+
});
|
|
59
|
+
export const SuiteSchema = zObject({
|
|
60
|
+
id: z.number(),
|
|
61
|
+
name: z.string(),
|
|
62
|
+
description: z.string().optional(),
|
|
63
|
+
project_id: z.number(),
|
|
64
|
+
is_master: z.boolean().optional(),
|
|
65
|
+
is_baseline: z.boolean().optional(),
|
|
66
|
+
is_completed: z.boolean().optional(),
|
|
67
|
+
completed_on: z.number().optional(),
|
|
68
|
+
url: z.string(),
|
|
69
|
+
});
|
|
70
|
+
// ── Case & Section Schemas ─────────────────────────────────────────────────────
|
|
71
|
+
export const CaseSchema = zObject({
|
|
72
|
+
id: z.number(),
|
|
73
|
+
title: z.string(),
|
|
74
|
+
section_id: z.number(),
|
|
75
|
+
template_id: z.number().optional(),
|
|
76
|
+
type_id: z.number().optional(),
|
|
77
|
+
priority_id: z.number().optional(),
|
|
78
|
+
milestone_id: z.number().optional(),
|
|
79
|
+
refs: z.string().optional(),
|
|
80
|
+
created_by: z.number(),
|
|
81
|
+
created_on: z.number(),
|
|
82
|
+
updated_by: z.number(),
|
|
83
|
+
updated_on: z.number(),
|
|
84
|
+
estimate: z.string().optional(),
|
|
85
|
+
estimate_forecast: z.string().optional(),
|
|
86
|
+
suite_id: z.number(),
|
|
87
|
+
display_order: z.number().optional(),
|
|
88
|
+
is_deleted: z.number().optional(),
|
|
89
|
+
custom_fields: z.record(z.string(), z.unknown()).optional(),
|
|
90
|
+
});
|
|
91
|
+
export const SectionSchema = zObject({
|
|
92
|
+
id: z.number(),
|
|
93
|
+
suite_id: z.number(),
|
|
94
|
+
name: z.string(),
|
|
95
|
+
description: z.string().optional(),
|
|
96
|
+
parent_id: z.number().optional(),
|
|
97
|
+
display_order: z.number(),
|
|
98
|
+
depth: z.number(),
|
|
99
|
+
});
|
|
100
|
+
// ── Run Schema (forward declaration needed for PlanEntry) ─────────────────────
|
|
101
|
+
export const RunSchema = zObject({
|
|
102
|
+
id: z.number(),
|
|
103
|
+
suite_id: z.number(),
|
|
104
|
+
name: z.string(),
|
|
105
|
+
description: z.string().optional(),
|
|
106
|
+
milestone_id: z.number().optional(),
|
|
107
|
+
assignedto_id: z.number().optional(),
|
|
108
|
+
include_all: z.boolean(),
|
|
109
|
+
is_completed: z.boolean(),
|
|
110
|
+
completed_on: z.number().optional(),
|
|
111
|
+
config: z.string().optional(),
|
|
112
|
+
config_ids: z.array(z.number()).optional(),
|
|
113
|
+
passed_count: z.number(),
|
|
114
|
+
blocked_count: z.number(),
|
|
115
|
+
untested_count: z.number(),
|
|
116
|
+
retest_count: z.number(),
|
|
117
|
+
failed_count: z.number(),
|
|
118
|
+
custom_status1_count: z.number().optional(),
|
|
119
|
+
custom_status2_count: z.number().optional(),
|
|
120
|
+
custom_status3_count: z.number().optional(),
|
|
121
|
+
custom_status4_count: z.number().optional(),
|
|
122
|
+
custom_status5_count: z.number().optional(),
|
|
123
|
+
custom_status6_count: z.number().optional(),
|
|
124
|
+
custom_status7_count: z.number().optional(),
|
|
125
|
+
project_id: z.number(),
|
|
126
|
+
plan_id: z.number().optional(),
|
|
127
|
+
created_on: z.number(),
|
|
128
|
+
created_by: z.number(),
|
|
129
|
+
refs: z.string().optional(),
|
|
130
|
+
url: z.string(),
|
|
131
|
+
});
|
|
132
|
+
// ── Plan Entry & Plan Schemas ─────────────────────────────────────────────────
|
|
133
|
+
export const PlanEntrySchema = zObject({
|
|
134
|
+
id: z.string(),
|
|
135
|
+
suite_id: z.number(),
|
|
136
|
+
name: z.string(),
|
|
137
|
+
description: z.string().optional(),
|
|
138
|
+
assignedto_id: z.number().optional(),
|
|
139
|
+
include_all: z.boolean(),
|
|
140
|
+
case_ids: z.array(z.number()).optional(),
|
|
141
|
+
config_ids: z.array(z.number()).optional(),
|
|
142
|
+
runs: z.array(RunSchema),
|
|
143
|
+
});
|
|
144
|
+
export const PlanSchema = zObject({
|
|
145
|
+
id: z.number(),
|
|
146
|
+
name: z.string(),
|
|
147
|
+
description: z.string().optional(),
|
|
148
|
+
milestone_id: z.number().optional(),
|
|
149
|
+
assignedto_id: z.number().optional(),
|
|
150
|
+
is_completed: z.boolean(),
|
|
151
|
+
completed_on: z.number().optional(),
|
|
152
|
+
passed_count: z.number(),
|
|
153
|
+
blocked_count: z.number(),
|
|
154
|
+
untested_count: z.number(),
|
|
155
|
+
retest_count: z.number(),
|
|
156
|
+
failed_count: z.number(),
|
|
157
|
+
custom_status1_count: z.number().optional(),
|
|
158
|
+
custom_status2_count: z.number().optional(),
|
|
159
|
+
custom_status3_count: z.number().optional(),
|
|
160
|
+
custom_status4_count: z.number().optional(),
|
|
161
|
+
custom_status5_count: z.number().optional(),
|
|
162
|
+
custom_status6_count: z.number().optional(),
|
|
163
|
+
custom_status7_count: z.number().optional(),
|
|
164
|
+
project_id: z.number(),
|
|
165
|
+
created_on: z.number(),
|
|
166
|
+
created_by: z.number(),
|
|
167
|
+
url: z.string(),
|
|
168
|
+
entries: z.array(PlanEntrySchema).optional(),
|
|
169
|
+
});
|
|
170
|
+
// ── Test & Result Schemas ─────────────────────────────────────────────────────
|
|
171
|
+
export const TestSchema = zObject({
|
|
172
|
+
id: z.number(),
|
|
173
|
+
case_id: z.number(),
|
|
174
|
+
status_id: z.number(),
|
|
175
|
+
assignedto_id: z.number().optional(),
|
|
176
|
+
run_id: z.number(),
|
|
177
|
+
title: z.string(),
|
|
178
|
+
template_id: z.number().optional(),
|
|
179
|
+
type_id: z.number().optional(),
|
|
180
|
+
priority_id: z.number().optional(),
|
|
181
|
+
estimate: z.string().optional(),
|
|
182
|
+
estimate_forecast: z.string().optional(),
|
|
183
|
+
refs: z.string().optional(),
|
|
184
|
+
milestone_id: z.number().optional(),
|
|
185
|
+
custom_fields: z.record(z.string(), z.unknown()).optional(),
|
|
186
|
+
});
|
|
187
|
+
export const ResultSchema = zObject({
|
|
188
|
+
id: z.number().optional(),
|
|
189
|
+
test_id: z.number().optional(),
|
|
190
|
+
status_id: z.number(),
|
|
191
|
+
comment: z.string().optional(),
|
|
192
|
+
version: z.string().optional(),
|
|
193
|
+
elapsed: z.string().optional(),
|
|
194
|
+
defects: z.string().optional(),
|
|
195
|
+
assignedto_id: z.number().optional(),
|
|
196
|
+
created_by: z.number().optional(),
|
|
197
|
+
created_on: z.number().optional(),
|
|
198
|
+
custom_fields: z.record(z.string(), z.unknown()).optional(),
|
|
199
|
+
});
|
|
200
|
+
// ── Milestone Schema ──────────────────────────────────────────────────────────
|
|
201
|
+
export const MilestoneSchema = zObject({
|
|
202
|
+
id: z.number(),
|
|
203
|
+
name: z.string(),
|
|
204
|
+
description: z.string().optional(),
|
|
205
|
+
start_on: z.number().optional(),
|
|
206
|
+
started_on: z.number().optional(),
|
|
207
|
+
is_completed: z.boolean(),
|
|
208
|
+
completed_on: z.number().optional(),
|
|
209
|
+
due_on: z.number().optional(),
|
|
210
|
+
project_id: z.number(),
|
|
211
|
+
parent_id: z.number().optional(),
|
|
212
|
+
refs: z.string().optional(),
|
|
213
|
+
url: z.string(),
|
|
214
|
+
// Sub-milestones are typed as unknown[] to avoid a recursive schema definition.
|
|
215
|
+
milestones: z.array(z.unknown()).optional(),
|
|
216
|
+
});
|
|
217
|
+
// ── Status & Priority Schemas ──────────────────────────────────────────────────
|
|
218
|
+
export const StatusSchema = zObject({
|
|
219
|
+
id: z.number(),
|
|
220
|
+
name: z.string(),
|
|
221
|
+
label: z.string(),
|
|
222
|
+
color_dark: z.number(),
|
|
223
|
+
color_medium: z.number(),
|
|
224
|
+
color_bright: z.number(),
|
|
225
|
+
is_system: z.boolean(),
|
|
226
|
+
is_untested: z.boolean(),
|
|
227
|
+
is_final: z.boolean(),
|
|
228
|
+
});
|
|
229
|
+
export const PrioritySchema = zObject({
|
|
230
|
+
id: z.number(),
|
|
231
|
+
name: z.string(),
|
|
232
|
+
short_name: z.string(),
|
|
233
|
+
is_default: z.boolean(),
|
|
234
|
+
priority: z.number(),
|
|
235
|
+
});
|
|
236
|
+
// ── Field Config Schemas ──────────────────────────────────────────────────────
|
|
237
|
+
const FieldConfigOptionsSchema = zObject({
|
|
238
|
+
is_required: z.boolean(),
|
|
239
|
+
default_value: z.string(),
|
|
240
|
+
items: z.string().optional(),
|
|
241
|
+
format: z.string().optional(),
|
|
242
|
+
rows: z.string().optional(),
|
|
243
|
+
});
|
|
244
|
+
const FieldConfigContextSchema = zObject({
|
|
245
|
+
is_global: z.boolean(),
|
|
246
|
+
project_ids: z.array(z.number()),
|
|
247
|
+
});
|
|
248
|
+
export const CaseFieldConfigSchema = zObject({
|
|
249
|
+
context: FieldConfigContextSchema,
|
|
250
|
+
options: FieldConfigOptionsSchema,
|
|
251
|
+
});
|
|
252
|
+
export const CaseFieldSchema = zObject({
|
|
253
|
+
id: z.number(),
|
|
254
|
+
system_name: z.string(),
|
|
255
|
+
label: z.string(),
|
|
256
|
+
name: z.string(),
|
|
257
|
+
type_id: z.number(),
|
|
258
|
+
display_order: z.number(),
|
|
259
|
+
configs: z.array(CaseFieldConfigSchema),
|
|
260
|
+
is_active: z.boolean(),
|
|
261
|
+
include_all: z.boolean(),
|
|
262
|
+
template_ids: z.array(z.number()),
|
|
263
|
+
description: z.string().optional(),
|
|
264
|
+
});
|
|
265
|
+
export const ResultFieldConfigSchema = zObject({
|
|
266
|
+
context: FieldConfigContextSchema,
|
|
267
|
+
options: FieldConfigOptionsSchema,
|
|
268
|
+
});
|
|
269
|
+
export const ResultFieldSchema = zObject({
|
|
270
|
+
id: z.number(),
|
|
271
|
+
system_name: z.string(),
|
|
272
|
+
label: z.string(),
|
|
273
|
+
name: z.string(),
|
|
274
|
+
type_id: z.number(),
|
|
275
|
+
display_order: z.number(),
|
|
276
|
+
configs: z.array(ResultFieldConfigSchema),
|
|
277
|
+
is_active: z.boolean(),
|
|
278
|
+
include_all: z.boolean(),
|
|
279
|
+
template_ids: z.array(z.number()),
|
|
280
|
+
description: z.string().optional(),
|
|
281
|
+
});
|
|
282
|
+
// ── Case Type & Template Schemas ──────────────────────────────────────────────
|
|
283
|
+
export const CaseTypeSchema = zObject({
|
|
284
|
+
id: z.number(),
|
|
285
|
+
name: z.string(),
|
|
286
|
+
is_default: z.boolean(),
|
|
287
|
+
});
|
|
288
|
+
export const TemplateSchema = zObject({
|
|
289
|
+
id: z.number(),
|
|
290
|
+
name: z.string(),
|
|
291
|
+
is_default: z.boolean(),
|
|
292
|
+
});
|
|
293
|
+
// ── Configuration Schemas ─────────────────────────────────────────────────────
|
|
294
|
+
export const ConfigurationSchema = zObject({
|
|
295
|
+
id: z.number(),
|
|
296
|
+
name: z.string(),
|
|
297
|
+
group_id: z.number(),
|
|
298
|
+
});
|
|
299
|
+
export const ConfigurationGroupSchema = zObject({
|
|
300
|
+
id: z.number(),
|
|
301
|
+
name: z.string(),
|
|
302
|
+
project_id: z.number(),
|
|
303
|
+
configs: z.array(ConfigurationSchema),
|
|
304
|
+
});
|
|
305
|
+
// ── Attachment Schema ─────────────────────────────────────────────────────────
|
|
306
|
+
export const AttachmentSchema = zObject({
|
|
307
|
+
attachment_id: z.number(),
|
|
308
|
+
name: z.string(),
|
|
309
|
+
filename: z.string().optional(),
|
|
310
|
+
size: z.number().optional(),
|
|
311
|
+
created_on: z.number().optional(),
|
|
312
|
+
created_by: z.number().optional(),
|
|
313
|
+
entity_id: z.number().optional(),
|
|
314
|
+
});
|
|
315
|
+
// ── Shared Steps Schema ───────────────────────────────────────────────────────
|
|
316
|
+
export const SharedStepSchema = zObject({
|
|
317
|
+
id: z.number(),
|
|
318
|
+
title: z.string(),
|
|
319
|
+
project_id: z.number().optional(),
|
|
320
|
+
case_ids: z.array(z.number()).optional(),
|
|
321
|
+
created_on: z.number().optional(),
|
|
322
|
+
created_by: z.number().optional(),
|
|
323
|
+
updated_on: z.number().optional(),
|
|
324
|
+
updated_by: z.number().optional(),
|
|
325
|
+
custom_steps_separated: z.array(z.record(z.string(), z.unknown())).optional(),
|
|
326
|
+
});
|
|
327
|
+
// ── Variable & Dataset Schemas ────────────────────────────────────────────────
|
|
328
|
+
export const VariableSchema = zObject({
|
|
329
|
+
id: z.number(),
|
|
330
|
+
name: z.string(),
|
|
331
|
+
});
|
|
332
|
+
export const DatasetSchema = zObject({
|
|
333
|
+
id: z.number(),
|
|
334
|
+
name: z.string(),
|
|
335
|
+
project_id: z.number().optional(),
|
|
336
|
+
created_on: z.number().optional(),
|
|
337
|
+
created_by: z.number().optional(),
|
|
338
|
+
});
|
|
339
|
+
// ── Report Schemas ────────────────────────────────────────────────────────────
|
|
340
|
+
export const ReportSchema = zObject({
|
|
341
|
+
id: z.number(),
|
|
342
|
+
name: z.string(),
|
|
343
|
+
description: z.string().optional(),
|
|
344
|
+
is_shared: z.boolean().optional(),
|
|
345
|
+
});
|
|
346
|
+
export const ReportResultSchema = zObject({
|
|
347
|
+
report_url: z.string(),
|
|
348
|
+
user_report_url: z.string().optional(),
|
|
349
|
+
});
|
|
350
|
+
// ── Write Payload Schemas ─────────────────────────────────────────────────────
|
|
351
|
+
// Source-of-truth schemas for POST bodies sent by the TestRail client. Each is
|
|
352
|
+
// `.passthrough()` via `zObject`, so TestRail's user-configured `custom_*`
|
|
353
|
+
// fields (or any other forward-compatible extension) pass through unchanged.
|
|
354
|
+
// TypeScript payload types are derived via `z.infer` and exported alongside
|
|
355
|
+
// each schema; no separate handwritten interface lives in `src/types.ts`.
|
|
356
|
+
export const AddCasePayloadSchema = zObject({
|
|
357
|
+
title: z.string(),
|
|
358
|
+
template_id: z.number().optional(),
|
|
359
|
+
type_id: z.number().optional(),
|
|
360
|
+
priority_id: z.number().optional(),
|
|
361
|
+
estimate: z.string().optional(),
|
|
362
|
+
milestone_id: z.number().optional(),
|
|
363
|
+
refs: z.string().optional(),
|
|
364
|
+
custom_fields: z.record(z.string(), z.unknown()).optional(),
|
|
365
|
+
});
|
|
366
|
+
export const UpdateCasePayloadSchema = zObject({
|
|
367
|
+
title: z.string().optional(),
|
|
368
|
+
template_id: z.number().optional(),
|
|
369
|
+
type_id: z.number().optional(),
|
|
370
|
+
priority_id: z.number().optional(),
|
|
371
|
+
estimate: z.string().optional(),
|
|
372
|
+
milestone_id: z.number().optional(),
|
|
373
|
+
refs: z.string().optional(),
|
|
374
|
+
custom_fields: z.record(z.string(), z.unknown()).optional(),
|
|
375
|
+
});
|
|
376
|
+
export const AddRunPayloadSchema = zObject({
|
|
377
|
+
name: z.string(),
|
|
378
|
+
suite_id: z.number().optional(),
|
|
379
|
+
description: z.string().optional(),
|
|
380
|
+
milestone_id: z.number().optional(),
|
|
381
|
+
assignedto_id: z.number().optional(),
|
|
382
|
+
include_all: z.boolean().optional(),
|
|
383
|
+
case_ids: z.array(z.number()).optional(),
|
|
384
|
+
refs: z.string().optional(),
|
|
385
|
+
});
|
|
386
|
+
export const UpdateRunPayloadSchema = zObject({
|
|
387
|
+
name: z.string().optional(),
|
|
388
|
+
description: z.string().optional(),
|
|
389
|
+
milestone_id: z.number().optional(),
|
|
390
|
+
assignedto_id: z.number().optional(),
|
|
391
|
+
include_all: z.boolean().optional(),
|
|
392
|
+
case_ids: z.array(z.number()).optional(),
|
|
393
|
+
refs: z.string().optional(),
|
|
394
|
+
});
|
|
395
|
+
export const AddResultPayloadSchema = zObject({
|
|
396
|
+
status_id: z.number(),
|
|
397
|
+
comment: z.string().optional(),
|
|
398
|
+
version: z.string().optional(),
|
|
399
|
+
elapsed: z.string().optional(),
|
|
400
|
+
defects: z.string().optional(),
|
|
401
|
+
assignedto_id: z.number().optional(),
|
|
402
|
+
custom_fields: z.record(z.string(), z.unknown()).optional(),
|
|
403
|
+
});
|
|
404
|
+
// Inlined rather than `.extend(AddResultPayloadSchema)` so the passthrough()
|
|
405
|
+
// behavior is unambiguous and the inferred type stays a plain object literal.
|
|
406
|
+
export const AddResultForCasePayloadSchema = zObject({
|
|
407
|
+
case_id: z.number(),
|
|
408
|
+
status_id: z.number(),
|
|
409
|
+
comment: z.string().optional(),
|
|
410
|
+
version: z.string().optional(),
|
|
411
|
+
elapsed: z.string().optional(),
|
|
412
|
+
defects: z.string().optional(),
|
|
413
|
+
assignedto_id: z.number().optional(),
|
|
414
|
+
custom_fields: z.record(z.string(), z.unknown()).optional(),
|
|
415
|
+
});
|
|
416
|
+
export const AddResultsForCasesPayloadSchema = zObject({
|
|
417
|
+
results: z.array(AddResultForCasePayloadSchema),
|
|
418
|
+
});
|
|
419
|
+
//# sourceMappingURL=schemas.js.map
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AddRunPayload } from './schemas.js';
|
|
1
2
|
/**
|
|
2
3
|
* TestRail API client configuration options
|
|
3
4
|
*/
|
|
@@ -237,26 +238,6 @@ export interface Priority {
|
|
|
237
238
|
is_default: boolean;
|
|
238
239
|
priority: number;
|
|
239
240
|
}
|
|
240
|
-
export interface AddCasePayload {
|
|
241
|
-
title: string;
|
|
242
|
-
template_id?: number;
|
|
243
|
-
type_id?: number;
|
|
244
|
-
priority_id?: number;
|
|
245
|
-
estimate?: string;
|
|
246
|
-
milestone_id?: number;
|
|
247
|
-
refs?: string;
|
|
248
|
-
custom_fields?: Record<string, unknown>;
|
|
249
|
-
}
|
|
250
|
-
export interface UpdateCasePayload {
|
|
251
|
-
title?: string;
|
|
252
|
-
template_id?: number;
|
|
253
|
-
type_id?: number;
|
|
254
|
-
priority_id?: number;
|
|
255
|
-
estimate?: string;
|
|
256
|
-
milestone_id?: number;
|
|
257
|
-
refs?: string;
|
|
258
|
-
custom_fields?: Record<string, unknown>;
|
|
259
|
-
}
|
|
260
241
|
/**
|
|
261
242
|
* Filter options for `getCases()`.
|
|
262
243
|
* All date filters accept Unix timestamps (seconds since epoch).
|
|
@@ -319,41 +300,6 @@ export interface UpdatePlanEntryPayload {
|
|
|
319
300
|
config_ids?: number[];
|
|
320
301
|
runs?: AddRunPayload[];
|
|
321
302
|
}
|
|
322
|
-
export interface AddRunPayload {
|
|
323
|
-
suite_id?: number;
|
|
324
|
-
name: string;
|
|
325
|
-
description?: string;
|
|
326
|
-
milestone_id?: number;
|
|
327
|
-
assignedto_id?: number;
|
|
328
|
-
include_all?: boolean;
|
|
329
|
-
case_ids?: number[];
|
|
330
|
-
refs?: string;
|
|
331
|
-
}
|
|
332
|
-
export interface UpdateRunPayload {
|
|
333
|
-
name?: string;
|
|
334
|
-
description?: string;
|
|
335
|
-
milestone_id?: number;
|
|
336
|
-
assignedto_id?: number;
|
|
337
|
-
include_all?: boolean;
|
|
338
|
-
case_ids?: number[];
|
|
339
|
-
refs?: string;
|
|
340
|
-
}
|
|
341
|
-
export interface AddResultPayload {
|
|
342
|
-
/** e.g., 1=Passed */
|
|
343
|
-
status_id: number;
|
|
344
|
-
comment?: string;
|
|
345
|
-
version?: string;
|
|
346
|
-
elapsed?: string;
|
|
347
|
-
defects?: string;
|
|
348
|
-
assignedto_id?: number;
|
|
349
|
-
custom_fields?: Record<string, unknown>;
|
|
350
|
-
}
|
|
351
|
-
export interface AddResultsForCasesPayload {
|
|
352
|
-
results: AddResultForCasePayload[];
|
|
353
|
-
}
|
|
354
|
-
export interface AddResultForCasePayload extends AddResultPayload {
|
|
355
|
-
case_id: number;
|
|
356
|
-
}
|
|
357
303
|
export interface AddSectionPayload {
|
|
358
304
|
name: string;
|
|
359
305
|
suite_id?: number;
|
package/dist/utils.d.ts
CHANGED
|
@@ -2,4 +2,6 @@
|
|
|
2
2
|
export declare function base64Encode(str: string): string;
|
|
3
3
|
/** Resolves after `ms` milliseconds. */
|
|
4
4
|
export declare function sleep(ms: number): Promise<void>;
|
|
5
|
+
/** Serializes numeric ID filters for TestRail list endpoints. */
|
|
6
|
+
export declare function serializeIdList(ids?: number[]): string | undefined;
|
|
5
7
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.js
CHANGED
|
@@ -10,4 +10,8 @@ export function base64Encode(str) {
|
|
|
10
10
|
export function sleep(ms) {
|
|
11
11
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
12
12
|
}
|
|
13
|
+
/** Serializes numeric ID filters for TestRail list endpoints. */
|
|
14
|
+
export function serializeIdList(ids) {
|
|
15
|
+
return ids !== undefined && ids.length > 0 ? ids.join(',') : undefined;
|
|
16
|
+
}
|
|
13
17
|
//# sourceMappingURL=utils.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dichovsky/testrail-api-client",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "TypeScript API client for TestRail",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"testrail",
|
|
@@ -18,9 +18,6 @@
|
|
|
18
18
|
"url": "git+https://github.com/dichovsky/testrail-api-client.git"
|
|
19
19
|
},
|
|
20
20
|
"license": "MIT",
|
|
21
|
-
"publishConfig": {
|
|
22
|
-
"access": "public"
|
|
23
|
-
},
|
|
24
21
|
"author": "Igor Magdich",
|
|
25
22
|
"type": "module",
|
|
26
23
|
"exports": {
|
|
@@ -42,35 +39,46 @@
|
|
|
42
39
|
"files": [
|
|
43
40
|
"dist",
|
|
44
41
|
"src",
|
|
42
|
+
"skill",
|
|
45
43
|
"README.md",
|
|
46
44
|
"LICENSE"
|
|
47
45
|
],
|
|
48
46
|
"scripts": {
|
|
49
|
-
"build": "rm -rf dist && tsc",
|
|
47
|
+
"build": "rm -rf dist && tsc -p tsconfig.prod.json",
|
|
50
48
|
"clean:maps": "find dist -name '*.map' -delete",
|
|
51
49
|
"codemap": "node scripts/generate-codemap.js",
|
|
50
|
+
"codemap:check": "node scripts/generate-codemap.js --check",
|
|
52
51
|
"format": "prettier --write .",
|
|
53
52
|
"format:check": "prettier --check .",
|
|
54
53
|
"lint": "eslint .",
|
|
55
|
-
"prepublishOnly": "npm run typecheck && npm run lint && npm test && npm run
|
|
54
|
+
"prepublishOnly": "npm run typecheck && npm run lint && npm test && npm run skill && npm run skill:check && npm run clean:maps",
|
|
55
|
+
"pretest": "npm run typecheck && npm run lint && npm run format:check && npm run codemap:check",
|
|
56
|
+
"skill": "npm run build && node scripts/generate-skill.js",
|
|
57
|
+
"skill:check": "git diff --exit-code skill/SKILL.md",
|
|
56
58
|
"test": "vitest run",
|
|
57
59
|
"test:coverage": "vitest run --coverage",
|
|
58
60
|
"test:fast": "vitest run --reporter=dot --no-coverage",
|
|
59
61
|
"test:watch": "vitest",
|
|
60
|
-
"typecheck": "tsc
|
|
62
|
+
"typecheck": "tsc"
|
|
63
|
+
},
|
|
64
|
+
"dependencies": {
|
|
65
|
+
"zod": "^4.4.3"
|
|
61
66
|
},
|
|
62
67
|
"devDependencies": {
|
|
63
68
|
"@eslint/js": "^10.0.1",
|
|
64
|
-
"@types/node": "^25.
|
|
65
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
66
|
-
"@typescript-eslint/parser": "^8.
|
|
67
|
-
"@vitest/coverage-v8": "^4.1.
|
|
68
|
-
"eslint": "^10.
|
|
69
|
-
"prettier": "~3.8.
|
|
70
|
-
"typescript": "~6.0.
|
|
71
|
-
"vitest": "^4.1.
|
|
69
|
+
"@types/node": "^25.7.0",
|
|
70
|
+
"@typescript-eslint/eslint-plugin": "^8.59.3",
|
|
71
|
+
"@typescript-eslint/parser": "^8.59.3",
|
|
72
|
+
"@vitest/coverage-v8": "^4.1.6",
|
|
73
|
+
"eslint": "^10.3.0",
|
|
74
|
+
"prettier": "~3.8.3",
|
|
75
|
+
"typescript": "~6.0.3",
|
|
76
|
+
"vitest": "^4.1.6"
|
|
72
77
|
},
|
|
73
78
|
"engines": {
|
|
74
79
|
"node": "^20.19.0 || ^22.13.0 || >=24"
|
|
80
|
+
},
|
|
81
|
+
"publishConfig": {
|
|
82
|
+
"access": "public"
|
|
75
83
|
}
|
|
76
84
|
}
|