@qase/mcp-server 1.1.8 → 2.0.1
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 +38 -0
- package/README.md +75 -542
- package/build/auth/client-context.d.ts +12 -0
- package/build/auth/client-context.d.ts.map +1 -0
- package/build/auth/client-context.js +12 -0
- package/build/auth/client-context.js.map +1 -0
- package/build/auth/jwks-verifier.d.ts +15 -0
- package/build/auth/jwks-verifier.d.ts.map +1 -0
- package/build/auth/jwks-verifier.js +31 -0
- package/build/auth/jwks-verifier.js.map +1 -0
- package/build/auth/mcp-guard.d.ts +15 -0
- package/build/auth/mcp-guard.d.ts.map +1 -0
- package/build/auth/mcp-guard.js +44 -0
- package/build/auth/mcp-guard.js.map +1 -0
- package/build/auth/oauth-config.d.ts +40 -0
- package/build/auth/oauth-config.d.ts.map +1 -0
- package/build/auth/oauth-config.js +34 -0
- package/build/auth/oauth-config.js.map +1 -0
- package/build/auth/proxy-provider.d.ts +31 -0
- package/build/auth/proxy-provider.d.ts.map +1 -0
- package/build/auth/proxy-provider.js +87 -0
- package/build/auth/proxy-provider.js.map +1 -0
- package/build/auth/token-type.d.ts +7 -0
- package/build/auth/token-type.d.ts.map +1 -0
- package/build/auth/token-type.js +10 -0
- package/build/auth/token-type.js.map +1 -0
- package/build/cache/circuit-breaker.d.ts +33 -0
- package/build/cache/circuit-breaker.d.ts.map +1 -0
- package/build/cache/circuit-breaker.js +68 -0
- package/build/cache/circuit-breaker.js.map +1 -0
- package/build/cache/index.d.ts +24 -0
- package/build/cache/index.d.ts.map +1 -0
- package/build/cache/index.js +86 -0
- package/build/cache/index.js.map +1 -0
- package/build/cache/keys.d.ts +25 -0
- package/build/cache/keys.d.ts.map +1 -0
- package/build/cache/keys.js +36 -0
- package/build/cache/keys.js.map +1 -0
- package/build/cache/layered.d.ts +31 -0
- package/build/cache/layered.d.ts.map +1 -0
- package/build/cache/layered.js +88 -0
- package/build/cache/layered.js.map +1 -0
- package/build/cache/memory.d.ts +32 -0
- package/build/cache/memory.d.ts.map +1 -0
- package/build/cache/memory.js +108 -0
- package/build/cache/memory.js.map +1 -0
- package/build/cache/metrics.d.ts +31 -0
- package/build/cache/metrics.d.ts.map +1 -0
- package/build/cache/metrics.js +95 -0
- package/build/cache/metrics.js.map +1 -0
- package/build/cache/prom-format.d.ts +7 -0
- package/build/cache/prom-format.d.ts.map +1 -0
- package/build/cache/prom-format.js +16 -0
- package/build/cache/prom-format.js.map +1 -0
- package/build/cache/redis-bus.d.ts +29 -0
- package/build/cache/redis-bus.d.ts.map +1 -0
- package/build/cache/redis-bus.js +50 -0
- package/build/cache/redis-bus.js.map +1 -0
- package/build/cache/redis.d.ts +32 -0
- package/build/cache/redis.d.ts.map +1 -0
- package/build/cache/redis.js +89 -0
- package/build/cache/redis.js.map +1 -0
- package/build/cache/types.d.ts +38 -0
- package/build/cache/types.d.ts.map +1 -0
- package/build/cache/types.js +2 -0
- package/build/cache/types.js.map +1 -0
- package/build/client/index.d.ts +10 -3
- package/build/client/index.d.ts.map +1 -1
- package/build/client/index.js +75 -50
- package/build/client/index.js.map +1 -1
- package/build/http/agent.d.ts +16 -0
- package/build/http/agent.d.ts.map +1 -0
- package/build/http/agent.js +16 -0
- package/build/http/agent.js.map +1 -0
- package/build/http/dedupe.d.ts +14 -0
- package/build/http/dedupe.d.ts.map +1 -0
- package/build/http/dedupe.js +69 -0
- package/build/http/dedupe.js.map +1 -0
- package/build/http/index.d.ts +6 -0
- package/build/http/index.d.ts.map +1 -0
- package/build/http/index.js +4 -0
- package/build/http/index.js.map +1 -0
- package/build/http/retry.d.ts +18 -0
- package/build/http/retry.d.ts.map +1 -0
- package/build/http/retry.js +52 -0
- package/build/http/retry.js.map +1 -0
- package/build/index.d.ts +1 -18
- package/build/index.d.ts.map +1 -1
- package/build/index.js +95 -63
- package/build/index.js.map +1 -1
- package/build/operations-v2/composites/ci-report.d.ts +2 -0
- package/build/operations-v2/composites/ci-report.d.ts.map +1 -0
- package/build/operations-v2/composites/ci-report.js +99 -0
- package/build/operations-v2/composites/ci-report.js.map +1 -0
- package/build/operations-v2/composites/regression-run.d.ts +2 -0
- package/build/operations-v2/composites/regression-run.d.ts.map +1 -0
- package/build/operations-v2/composites/regression-run.js +81 -0
- package/build/operations-v2/composites/regression-run.js.map +1 -0
- package/build/operations-v2/composites/triage-defect.d.ts +2 -0
- package/build/operations-v2/composites/triage-defect.d.ts.map +1 -0
- package/build/operations-v2/composites/triage-defect.js +67 -0
- package/build/operations-v2/composites/triage-defect.js.map +1 -0
- package/build/operations-v2/escape/api.d.ts +2 -0
- package/build/operations-v2/escape/api.d.ts.map +1 -0
- package/build/operations-v2/escape/api.js +34 -0
- package/build/operations-v2/escape/api.js.map +1 -0
- package/build/operations-v2/index.d.ts +21 -0
- package/build/operations-v2/index.d.ts.map +1 -0
- package/build/operations-v2/index.js +27 -0
- package/build/operations-v2/index.js.map +1 -0
- package/build/operations-v2/meta/discover.d.ts +9 -0
- package/build/operations-v2/meta/discover.d.ts.map +1 -0
- package/build/operations-v2/meta/discover.js +79 -0
- package/build/operations-v2/meta/discover.js.map +1 -0
- package/build/{operations/search.d.ts → operations-v2/qql/index.d.ts} +1 -1
- package/build/operations-v2/qql/index.d.ts.map +1 -0
- package/build/{operations/search.js → operations-v2/qql/index.js} +34 -9
- package/build/operations-v2/qql/index.js.map +1 -0
- package/build/operations-v2/read/get.d.ts +2 -0
- package/build/operations-v2/read/get.d.ts.map +1 -0
- package/build/operations-v2/read/get.js +115 -0
- package/build/operations-v2/read/get.js.map +1 -0
- package/build/operations-v2/read/project-context.d.ts +2 -0
- package/build/operations-v2/read/project-context.d.ts.map +1 -0
- package/build/operations-v2/read/project-context.js +102 -0
- package/build/operations-v2/read/project-context.js.map +1 -0
- package/build/operations-v2/write/attachments.d.ts +2 -0
- package/build/operations-v2/write/attachments.d.ts.map +1 -0
- package/build/operations-v2/write/attachments.js +58 -0
- package/build/operations-v2/write/attachments.js.map +1 -0
- package/build/operations-v2/write/case-fields.d.ts +206 -0
- package/build/operations-v2/write/case-fields.d.ts.map +1 -0
- package/build/operations-v2/write/case-fields.js +79 -0
- package/build/operations-v2/write/case-fields.js.map +1 -0
- package/build/operations-v2/write/cases-bulk.d.ts +2 -0
- package/build/operations-v2/write/cases-bulk.d.ts.map +1 -0
- package/build/operations-v2/write/cases-bulk.js +54 -0
- package/build/operations-v2/write/cases-bulk.js.map +1 -0
- package/build/operations-v2/write/cases.d.ts +2 -0
- package/build/operations-v2/write/cases.d.ts.map +1 -0
- package/build/operations-v2/write/cases.js +52 -0
- package/build/operations-v2/write/cases.js.map +1 -0
- package/build/operations-v2/write/defects.d.ts +2 -0
- package/build/operations-v2/write/defects.d.ts.map +1 -0
- package/build/operations-v2/write/defects.js +81 -0
- package/build/operations-v2/write/defects.js.map +1 -0
- package/build/operations-v2/write/environments.d.ts +2 -0
- package/build/operations-v2/write/environments.d.ts.map +1 -0
- package/build/operations-v2/write/environments.js +56 -0
- package/build/operations-v2/write/environments.js.map +1 -0
- package/build/operations-v2/write/external-issues.d.ts +2 -0
- package/build/operations-v2/write/external-issues.d.ts.map +1 -0
- package/build/operations-v2/write/external-issues.js +96 -0
- package/build/operations-v2/write/external-issues.js.map +1 -0
- package/build/operations-v2/write/milestones.d.ts +2 -0
- package/build/operations-v2/write/milestones.d.ts.map +1 -0
- package/build/operations-v2/write/milestones.js +56 -0
- package/build/operations-v2/write/milestones.js.map +1 -0
- package/build/operations-v2/write/plans.d.ts +2 -0
- package/build/operations-v2/write/plans.d.ts.map +1 -0
- package/build/operations-v2/write/plans.js +55 -0
- package/build/operations-v2/write/plans.js.map +1 -0
- package/build/operations-v2/write/results.d.ts +2 -0
- package/build/operations-v2/write/results.d.ts.map +1 -0
- package/build/operations-v2/write/results.js +72 -0
- package/build/operations-v2/write/results.js.map +1 -0
- package/build/operations-v2/write/runs.d.ts +2 -0
- package/build/operations-v2/write/runs.d.ts.map +1 -0
- package/build/operations-v2/write/runs.js +84 -0
- package/build/operations-v2/write/runs.js.map +1 -0
- package/build/operations-v2/write/shared-steps.d.ts +2 -0
- package/build/operations-v2/write/shared-steps.d.ts.map +1 -0
- package/build/operations-v2/write/shared-steps.js +60 -0
- package/build/operations-v2/write/shared-steps.js.map +1 -0
- package/build/operations-v2/write/suites.d.ts +2 -0
- package/build/operations-v2/write/suites.d.ts.map +1 -0
- package/build/operations-v2/write/suites.js +63 -0
- package/build/operations-v2/write/suites.js.map +1 -0
- package/build/prompts/index.d.ts +31 -0
- package/build/prompts/index.d.ts.map +1 -0
- package/build/prompts/index.js +229 -0
- package/build/prompts/index.js.map +1 -0
- package/build/transports/sse.d.ts.map +1 -1
- package/build/transports/sse.js +6 -0
- package/build/transports/sse.js.map +1 -1
- package/build/transports/streamableHttp.d.ts +6 -1
- package/build/transports/streamableHttp.d.ts.map +1 -1
- package/build/transports/streamableHttp.js +128 -16
- package/build/transports/streamableHttp.js.map +1 -1
- package/build/utils/auth-context.d.ts +8 -0
- package/build/utils/auth-context.d.ts.map +1 -1
- package/build/utils/auth-context.js +18 -0
- package/build/utils/auth-context.js.map +1 -1
- package/build/utils/case-enums.d.ts +5 -3
- package/build/utils/case-enums.d.ts.map +1 -1
- package/build/utils/case-enums.js +77 -59
- package/build/utils/case-enums.js.map +1 -1
- package/build/utils/output-schemas.d.ts +16 -0
- package/build/utils/output-schemas.d.ts.map +1 -0
- package/build/utils/output-schemas.js +82 -0
- package/build/utils/output-schemas.js.map +1 -0
- package/build/utils/registry.d.ts +42 -9
- package/build/utils/registry.d.ts.map +1 -1
- package/build/utils/registry.js +64 -11
- package/build/utils/registry.js.map +1 -1
- package/build/utils/response-shape.d.ts +23 -0
- package/build/utils/response-shape.d.ts.map +1 -0
- package/build/utils/response-shape.js +73 -0
- package/build/utils/response-shape.js.map +1 -0
- package/build/utils/rich-response.d.ts +58 -0
- package/build/utils/rich-response.d.ts.map +1 -0
- package/build/utils/rich-response.js +93 -0
- package/build/utils/rich-response.js.map +1 -0
- package/build/utils/server-context.d.ts +65 -0
- package/build/utils/server-context.d.ts.map +1 -0
- package/build/utils/server-context.js +67 -0
- package/build/utils/server-context.js.map +1 -0
- package/build/version.d.ts +1 -1
- package/build/version.js +1 -1
- package/docs/connect.md +81 -0
- package/docs/migration.md +351 -0
- package/docs/self-run.md +270 -0
- package/docs/tools.md +111 -0
- package/docs/troubleshooting.md +144 -0
- package/package.json +11 -2
- package/server.json +8 -2
- package/build/operations/attachments.d.ts +0 -8
- package/build/operations/attachments.d.ts.map +0 -1
- package/build/operations/attachments.js +0 -146
- package/build/operations/attachments.js.map +0 -1
- package/build/operations/authors.d.ts +0 -8
- package/build/operations/authors.d.ts.map +0 -1
- package/build/operations/authors.js +0 -70
- package/build/operations/authors.js.map +0 -1
- package/build/operations/cases.d.ts +0 -8
- package/build/operations/cases.d.ts.map +0 -1
- package/build/operations/cases.js +0 -370
- package/build/operations/cases.js.map +0 -1
- package/build/operations/configurations.d.ts +0 -10
- package/build/operations/configurations.d.ts.map +0 -1
- package/build/operations/configurations.js +0 -125
- package/build/operations/configurations.js.map +0 -1
- package/build/operations/custom-fields.d.ts +0 -8
- package/build/operations/custom-fields.d.ts.map +0 -1
- package/build/operations/custom-fields.js +0 -172
- package/build/operations/custom-fields.js.map +0 -1
- package/build/operations/defects.d.ts +0 -8
- package/build/operations/defects.d.ts.map +0 -1
- package/build/operations/defects.js +0 -256
- package/build/operations/defects.js.map +0 -1
- package/build/operations/environments.d.ts +0 -8
- package/build/operations/environments.d.ts.map +0 -1
- package/build/operations/environments.js +0 -154
- package/build/operations/environments.js.map +0 -1
- package/build/operations/milestones.d.ts +0 -8
- package/build/operations/milestones.d.ts.map +0 -1
- package/build/operations/milestones.js +0 -155
- package/build/operations/milestones.js.map +0 -1
- package/build/operations/plans.d.ts +0 -8
- package/build/operations/plans.d.ts.map +0 -1
- package/build/operations/plans.js +0 -158
- package/build/operations/plans.js.map +0 -1
- package/build/operations/projects.d.ts +0 -8
- package/build/operations/projects.d.ts.map +0 -1
- package/build/operations/projects.js +0 -192
- package/build/operations/projects.js.map +0 -1
- package/build/operations/results.d.ts +0 -8
- package/build/operations/results.d.ts.map +0 -1
- package/build/operations/results.js +0 -214
- package/build/operations/results.js.map +0 -1
- package/build/operations/runs.d.ts +0 -8
- package/build/operations/runs.d.ts.map +0 -1
- package/build/operations/runs.js +0 -224
- package/build/operations/runs.js.map +0 -1
- package/build/operations/search.d.ts.map +0 -1
- package/build/operations/search.js.map +0 -1
- package/build/operations/shared-parameters.d.ts +0 -10
- package/build/operations/shared-parameters.d.ts.map +0 -1
- package/build/operations/shared-parameters.js +0 -93
- package/build/operations/shared-parameters.js.map +0 -1
- package/build/operations/shared-steps.d.ts +0 -8
- package/build/operations/shared-steps.d.ts.map +0 -1
- package/build/operations/shared-steps.js +0 -160
- package/build/operations/shared-steps.js.map +0 -1
- package/build/operations/suites.d.ts +0 -8
- package/build/operations/suites.d.ts.map +0 -1
- package/build/operations/suites.js +0 -169
- package/build/operations/suites.js.map +0 -1
- package/build/operations/system-fields.d.ts +0 -10
- package/build/operations/system-fields.d.ts.map +0 -1
- package/build/operations/system-fields.js +0 -47
- package/build/operations/system-fields.js.map +0 -1
- package/build/operations/users.d.ts +0 -10
- package/build/operations/users.d.ts.map +0 -1
- package/build/operations/users.js +0 -78
- package/build/operations/users.js.map +0 -1
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared test case field definitions.
|
|
3
|
+
*
|
|
4
|
+
* `qase_case_upsert` and `qase_case_bulk_create` accept the same case body, so
|
|
5
|
+
* the schema and the automation mapping live here instead of being duplicated
|
|
6
|
+
* — a new case field only has to be added once.
|
|
7
|
+
*/
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
export declare const TestStepSchema: z.ZodObject<{
|
|
10
|
+
steps: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
11
|
+
action: z.ZodOptional<z.ZodString>;
|
|
12
|
+
expected_result: z.ZodOptional<z.ZodString>;
|
|
13
|
+
data: z.ZodOptional<z.ZodString>;
|
|
14
|
+
value: z.ZodOptional<z.ZodString>;
|
|
15
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
16
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
17
|
+
action: z.ZodOptional<z.ZodString>;
|
|
18
|
+
expected_result: z.ZodOptional<z.ZodString>;
|
|
19
|
+
data: z.ZodOptional<z.ZodString>;
|
|
20
|
+
value: z.ZodOptional<z.ZodString>;
|
|
21
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
22
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
23
|
+
action: z.ZodOptional<z.ZodString>;
|
|
24
|
+
expected_result: z.ZodOptional<z.ZodString>;
|
|
25
|
+
data: z.ZodOptional<z.ZodString>;
|
|
26
|
+
value: z.ZodOptional<z.ZodString>;
|
|
27
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
28
|
+
}, z.ZodTypeAny, "passthrough">>, "many">>;
|
|
29
|
+
action: z.ZodOptional<z.ZodString>;
|
|
30
|
+
expected_result: z.ZodOptional<z.ZodString>;
|
|
31
|
+
data: z.ZodOptional<z.ZodString>;
|
|
32
|
+
value: z.ZodOptional<z.ZodString>;
|
|
33
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
value?: string | undefined;
|
|
36
|
+
data?: string | undefined;
|
|
37
|
+
action?: string | undefined;
|
|
38
|
+
expected_result?: string | undefined;
|
|
39
|
+
attachments?: string[] | undefined;
|
|
40
|
+
steps?: z.objectOutputType<{
|
|
41
|
+
action: z.ZodOptional<z.ZodString>;
|
|
42
|
+
expected_result: z.ZodOptional<z.ZodString>;
|
|
43
|
+
data: z.ZodOptional<z.ZodString>;
|
|
44
|
+
value: z.ZodOptional<z.ZodString>;
|
|
45
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
46
|
+
}, z.ZodTypeAny, "passthrough">[] | undefined;
|
|
47
|
+
}, {
|
|
48
|
+
value?: string | undefined;
|
|
49
|
+
data?: string | undefined;
|
|
50
|
+
action?: string | undefined;
|
|
51
|
+
expected_result?: string | undefined;
|
|
52
|
+
attachments?: string[] | undefined;
|
|
53
|
+
steps?: z.objectInputType<{
|
|
54
|
+
action: z.ZodOptional<z.ZodString>;
|
|
55
|
+
expected_result: z.ZodOptional<z.ZodString>;
|
|
56
|
+
data: z.ZodOptional<z.ZodString>;
|
|
57
|
+
value: z.ZodOptional<z.ZodString>;
|
|
58
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
59
|
+
}, z.ZodTypeAny, "passthrough">[] | undefined;
|
|
60
|
+
}>;
|
|
61
|
+
export declare const CaseFieldsSchema: z.ZodObject<{
|
|
62
|
+
title: z.ZodString;
|
|
63
|
+
description: z.ZodOptional<z.ZodString>;
|
|
64
|
+
preconditions: z.ZodOptional<z.ZodString>;
|
|
65
|
+
postconditions: z.ZodOptional<z.ZodString>;
|
|
66
|
+
severity: z.ZodOptional<z.ZodString>;
|
|
67
|
+
priority: z.ZodOptional<z.ZodString>;
|
|
68
|
+
type: z.ZodOptional<z.ZodString>;
|
|
69
|
+
layer: z.ZodOptional<z.ZodString>;
|
|
70
|
+
behavior: z.ZodOptional<z.ZodString>;
|
|
71
|
+
automation: z.ZodOptional<z.ZodString>;
|
|
72
|
+
status: z.ZodOptional<z.ZodString>;
|
|
73
|
+
is_flaky: z.ZodOptional<z.ZodBoolean>;
|
|
74
|
+
suite_id: z.ZodOptional<z.ZodNumber>;
|
|
75
|
+
milestone_id: z.ZodOptional<z.ZodNumber>;
|
|
76
|
+
steps: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
77
|
+
steps: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
78
|
+
action: z.ZodOptional<z.ZodString>;
|
|
79
|
+
expected_result: z.ZodOptional<z.ZodString>;
|
|
80
|
+
data: z.ZodOptional<z.ZodString>;
|
|
81
|
+
value: z.ZodOptional<z.ZodString>;
|
|
82
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
83
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
84
|
+
action: z.ZodOptional<z.ZodString>;
|
|
85
|
+
expected_result: z.ZodOptional<z.ZodString>;
|
|
86
|
+
data: z.ZodOptional<z.ZodString>;
|
|
87
|
+
value: z.ZodOptional<z.ZodString>;
|
|
88
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
89
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
90
|
+
action: z.ZodOptional<z.ZodString>;
|
|
91
|
+
expected_result: z.ZodOptional<z.ZodString>;
|
|
92
|
+
data: z.ZodOptional<z.ZodString>;
|
|
93
|
+
value: z.ZodOptional<z.ZodString>;
|
|
94
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
95
|
+
}, z.ZodTypeAny, "passthrough">>, "many">>;
|
|
96
|
+
action: z.ZodOptional<z.ZodString>;
|
|
97
|
+
expected_result: z.ZodOptional<z.ZodString>;
|
|
98
|
+
data: z.ZodOptional<z.ZodString>;
|
|
99
|
+
value: z.ZodOptional<z.ZodString>;
|
|
100
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
101
|
+
}, "strip", z.ZodTypeAny, {
|
|
102
|
+
value?: string | undefined;
|
|
103
|
+
data?: string | undefined;
|
|
104
|
+
action?: string | undefined;
|
|
105
|
+
expected_result?: string | undefined;
|
|
106
|
+
attachments?: string[] | undefined;
|
|
107
|
+
steps?: z.objectOutputType<{
|
|
108
|
+
action: z.ZodOptional<z.ZodString>;
|
|
109
|
+
expected_result: z.ZodOptional<z.ZodString>;
|
|
110
|
+
data: z.ZodOptional<z.ZodString>;
|
|
111
|
+
value: z.ZodOptional<z.ZodString>;
|
|
112
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
113
|
+
}, z.ZodTypeAny, "passthrough">[] | undefined;
|
|
114
|
+
}, {
|
|
115
|
+
value?: string | undefined;
|
|
116
|
+
data?: string | undefined;
|
|
117
|
+
action?: string | undefined;
|
|
118
|
+
expected_result?: string | undefined;
|
|
119
|
+
attachments?: string[] | undefined;
|
|
120
|
+
steps?: z.objectInputType<{
|
|
121
|
+
action: z.ZodOptional<z.ZodString>;
|
|
122
|
+
expected_result: z.ZodOptional<z.ZodString>;
|
|
123
|
+
data: z.ZodOptional<z.ZodString>;
|
|
124
|
+
value: z.ZodOptional<z.ZodString>;
|
|
125
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
126
|
+
}, z.ZodTypeAny, "passthrough">[] | undefined;
|
|
127
|
+
}>, "many">>;
|
|
128
|
+
steps_type: z.ZodOptional<z.ZodEnum<["classic", "gherkin"]>>;
|
|
129
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
130
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
131
|
+
custom_field: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
132
|
+
}, "strip", z.ZodTypeAny, {
|
|
133
|
+
title: string;
|
|
134
|
+
type?: string | undefined;
|
|
135
|
+
status?: string | undefined;
|
|
136
|
+
description?: string | undefined;
|
|
137
|
+
priority?: string | undefined;
|
|
138
|
+
custom_field?: Record<string, any> | undefined;
|
|
139
|
+
behavior?: string | undefined;
|
|
140
|
+
severity?: string | undefined;
|
|
141
|
+
layer?: string | undefined;
|
|
142
|
+
automation?: string | undefined;
|
|
143
|
+
attachments?: string[] | undefined;
|
|
144
|
+
steps?: {
|
|
145
|
+
value?: string | undefined;
|
|
146
|
+
data?: string | undefined;
|
|
147
|
+
action?: string | undefined;
|
|
148
|
+
expected_result?: string | undefined;
|
|
149
|
+
attachments?: string[] | undefined;
|
|
150
|
+
steps?: z.objectOutputType<{
|
|
151
|
+
action: z.ZodOptional<z.ZodString>;
|
|
152
|
+
expected_result: z.ZodOptional<z.ZodString>;
|
|
153
|
+
data: z.ZodOptional<z.ZodString>;
|
|
154
|
+
value: z.ZodOptional<z.ZodString>;
|
|
155
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
156
|
+
}, z.ZodTypeAny, "passthrough">[] | undefined;
|
|
157
|
+
}[] | undefined;
|
|
158
|
+
preconditions?: string | undefined;
|
|
159
|
+
postconditions?: string | undefined;
|
|
160
|
+
is_flaky?: boolean | undefined;
|
|
161
|
+
suite_id?: number | undefined;
|
|
162
|
+
milestone_id?: number | undefined;
|
|
163
|
+
steps_type?: "classic" | "gherkin" | undefined;
|
|
164
|
+
tags?: string[] | undefined;
|
|
165
|
+
}, {
|
|
166
|
+
title: string;
|
|
167
|
+
type?: string | undefined;
|
|
168
|
+
status?: string | undefined;
|
|
169
|
+
description?: string | undefined;
|
|
170
|
+
priority?: string | undefined;
|
|
171
|
+
custom_field?: Record<string, any> | undefined;
|
|
172
|
+
behavior?: string | undefined;
|
|
173
|
+
severity?: string | undefined;
|
|
174
|
+
layer?: string | undefined;
|
|
175
|
+
automation?: string | undefined;
|
|
176
|
+
attachments?: string[] | undefined;
|
|
177
|
+
steps?: {
|
|
178
|
+
value?: string | undefined;
|
|
179
|
+
data?: string | undefined;
|
|
180
|
+
action?: string | undefined;
|
|
181
|
+
expected_result?: string | undefined;
|
|
182
|
+
attachments?: string[] | undefined;
|
|
183
|
+
steps?: z.objectInputType<{
|
|
184
|
+
action: z.ZodOptional<z.ZodString>;
|
|
185
|
+
expected_result: z.ZodOptional<z.ZodString>;
|
|
186
|
+
data: z.ZodOptional<z.ZodString>;
|
|
187
|
+
value: z.ZodOptional<z.ZodString>;
|
|
188
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
189
|
+
}, z.ZodTypeAny, "passthrough">[] | undefined;
|
|
190
|
+
}[] | undefined;
|
|
191
|
+
preconditions?: string | undefined;
|
|
192
|
+
postconditions?: string | undefined;
|
|
193
|
+
is_flaky?: boolean | undefined;
|
|
194
|
+
suite_id?: number | undefined;
|
|
195
|
+
milestone_id?: number | undefined;
|
|
196
|
+
steps_type?: "classic" | "gherkin" | undefined;
|
|
197
|
+
tags?: string[] | undefined;
|
|
198
|
+
}>;
|
|
199
|
+
/**
|
|
200
|
+
* Map the user-facing `automation` enum (0=Manual, 1=To be automated,
|
|
201
|
+
* 2=Automated) to the current API contract (`isManual` + `isToBeAutomated`).
|
|
202
|
+
* The legacy `automation` field is deprecated in qase-api-client and dropped
|
|
203
|
+
* from the outbound payload.
|
|
204
|
+
*/
|
|
205
|
+
export declare function applyAutomationMapping(caseData: Record<string, unknown>): Record<string, unknown>;
|
|
206
|
+
//# sourceMappingURL=case-fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"case-fields.d.ts","sourceRoot":"","sources":["../../../src/operations-v2/write/case-fields.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMzB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4B3B,CAAC;AAEH;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA0BjG"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared test case field definitions.
|
|
3
|
+
*
|
|
4
|
+
* `qase_case_upsert` and `qase_case_bulk_create` accept the same case body, so
|
|
5
|
+
* the schema and the automation mapping live here instead of being duplicated
|
|
6
|
+
* — a new case field only has to be added once.
|
|
7
|
+
*/
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
const stepFields = {
|
|
10
|
+
action: z.string().optional().describe('Step action (classic steps)'),
|
|
11
|
+
expected_result: z.string().optional().describe('Expected result'),
|
|
12
|
+
data: z.string().optional().describe('Test data'),
|
|
13
|
+
value: z.string().optional().describe('Gherkin scenario text (when steps_type is "gherkin")'),
|
|
14
|
+
attachments: z.array(z.string()).optional().describe('Attachment hashes'),
|
|
15
|
+
};
|
|
16
|
+
export const TestStepSchema = z.object({
|
|
17
|
+
...stepFields,
|
|
18
|
+
steps: z
|
|
19
|
+
.array(z.object(stepFields).passthrough())
|
|
20
|
+
.optional()
|
|
21
|
+
.describe('Nested substeps. Same structure as parent steps, supports further nesting.'),
|
|
22
|
+
});
|
|
23
|
+
export const CaseFieldsSchema = z.object({
|
|
24
|
+
title: z.string().min(1).max(255).describe('Test case title'),
|
|
25
|
+
description: z.string().optional(),
|
|
26
|
+
preconditions: z.string().optional(),
|
|
27
|
+
postconditions: z.string().optional(),
|
|
28
|
+
severity: z.string().optional().describe('Severity label or numeric ID'),
|
|
29
|
+
priority: z
|
|
30
|
+
.string()
|
|
31
|
+
.optional()
|
|
32
|
+
.describe('Priority label or numeric ID (0=not set, 1=high, 2=medium, 3=low)'),
|
|
33
|
+
type: z.string().optional().describe('Type label or numeric ID'),
|
|
34
|
+
layer: z.string().optional().describe('Layer label or numeric ID'),
|
|
35
|
+
behavior: z.string().optional().describe('Behavior label or numeric ID'),
|
|
36
|
+
automation: z
|
|
37
|
+
.string()
|
|
38
|
+
.optional()
|
|
39
|
+
.describe('Automation status (label, slug, or numeric ID: 0=Manual / is-not-automated, 1=To be automated, 2=Automated)'),
|
|
40
|
+
status: z.string().optional().describe('Status label or numeric ID'),
|
|
41
|
+
is_flaky: z.boolean().optional(),
|
|
42
|
+
suite_id: z.number().int().positive().optional(),
|
|
43
|
+
milestone_id: z.number().int().positive().optional(),
|
|
44
|
+
steps: z.array(TestStepSchema).optional(),
|
|
45
|
+
steps_type: z.enum(['classic', 'gherkin']).optional(),
|
|
46
|
+
tags: z.array(z.string()).optional(),
|
|
47
|
+
attachments: z.array(z.string()).optional(),
|
|
48
|
+
custom_field: z.record(z.any()).optional(),
|
|
49
|
+
});
|
|
50
|
+
/**
|
|
51
|
+
* Map the user-facing `automation` enum (0=Manual, 1=To be automated,
|
|
52
|
+
* 2=Automated) to the current API contract (`isManual` + `isToBeAutomated`).
|
|
53
|
+
* The legacy `automation` field is deprecated in qase-api-client and dropped
|
|
54
|
+
* from the outbound payload.
|
|
55
|
+
*/
|
|
56
|
+
export function applyAutomationMapping(caseData) {
|
|
57
|
+
const automationId = caseData.automation;
|
|
58
|
+
if (typeof automationId !== 'number') {
|
|
59
|
+
return caseData;
|
|
60
|
+
}
|
|
61
|
+
const { automation: _drop, ...rest } = caseData;
|
|
62
|
+
const mapped = rest;
|
|
63
|
+
switch (automationId) {
|
|
64
|
+
case 2: // Automated
|
|
65
|
+
mapped.isManual = 0;
|
|
66
|
+
break;
|
|
67
|
+
case 1: // To be automated
|
|
68
|
+
mapped.isManual = 1;
|
|
69
|
+
mapped.isToBeAutomated = 1;
|
|
70
|
+
break;
|
|
71
|
+
case 0: // Manual
|
|
72
|
+
default:
|
|
73
|
+
mapped.isManual = 1;
|
|
74
|
+
mapped.isToBeAutomated = 0;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
return mapped;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=case-fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"case-fields.js","sourceRoot":"","sources":["../../../src/operations-v2/write/case-fields.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAA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EAAE;IAC3C,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE;CAC3C,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,QAAiC;IACtE,MAAM,YAAY,GAAG,QAAQ,CAAC,UAAU,CAAC;IAEzC,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;QACrC,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,CAAC;IAChD,MAAM,MAAM,GAA4B,IAAI,CAAC;IAE7C,QAAQ,YAAY,EAAE,CAAC;QACrB,KAAK,CAAC,EAAE,YAAY;YAClB,MAAM,CAAC,QAAQ,GAAG,CAAC,CAAC;YACpB,MAAM;QACR,KAAK,CAAC,EAAE,kBAAkB;YACxB,MAAM,CAAC,QAAQ,GAAG,CAAC,CAAC;YACpB,MAAM,CAAC,eAAe,GAAG,CAAC,CAAC;YAC3B,MAAM;QACR,KAAK,CAAC,CAAC,CAAC,SAAS;QACjB;YACE,MAAM,CAAC,QAAQ,GAAG,CAAC,CAAC;YACpB,MAAM,CAAC,eAAe,GAAG,CAAC,CAAC;YAC3B,MAAM;IACV,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cases-bulk.d.ts","sourceRoot":"","sources":["../../../src/operations-v2/write/cases-bulk.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { getApiClient } from '../../client/index.js';
|
|
3
|
+
import { toolRegistry, CreateAnnotation } from '../../utils/registry.js';
|
|
4
|
+
import { toResultAsync, createToolError } from '../../utils/errors.js';
|
|
5
|
+
import { ProjectCodeSchema } from '../../utils/validation.js';
|
|
6
|
+
import { normalizeCaseEnums } from '../../utils/case-enums.js';
|
|
7
|
+
import { CaseFieldsSchema, applyAutomationMapping } from './case-fields.js';
|
|
8
|
+
const CONTEXT = 'bulk case creation';
|
|
9
|
+
/** Qase creates the whole batch in one transaction; 100 keeps the request sane. */
|
|
10
|
+
const MAX_CASES = 100;
|
|
11
|
+
const Schema = z.object({
|
|
12
|
+
code: ProjectCodeSchema,
|
|
13
|
+
cases: z
|
|
14
|
+
.array(CaseFieldsSchema)
|
|
15
|
+
.min(1)
|
|
16
|
+
.max(MAX_CASES, `A single call creates at most ${MAX_CASES} test cases — split larger batches.`)
|
|
17
|
+
.describe(`Test cases to create, 1 to ${MAX_CASES} per call`),
|
|
18
|
+
});
|
|
19
|
+
async function handler(rawArgs) {
|
|
20
|
+
// Tool handlers get raw MCP arguments — validate here so a malformed call
|
|
21
|
+
// returns a readable error instead of a TypeError from deeper in the code.
|
|
22
|
+
const parsed = Schema.safeParse(rawArgs);
|
|
23
|
+
if (!parsed.success) {
|
|
24
|
+
const details = parsed.error.issues
|
|
25
|
+
.map((issue) => `${issue.path.join('.') || 'arguments'}: ${issue.message}`)
|
|
26
|
+
.join('; ');
|
|
27
|
+
throw createToolError(`Invalid arguments — ${details}`, CONTEXT);
|
|
28
|
+
}
|
|
29
|
+
const { code, cases } = parsed.data;
|
|
30
|
+
// Same enum handling as qase_case_upsert, so "high" and "blocker" work here
|
|
31
|
+
// too. System fields are cached, so this does not fan out into N API calls.
|
|
32
|
+
const normalized = await Promise.all(cases.map(async (testCase) => applyAutomationMapping(await normalizeCaseEnums(testCase))));
|
|
33
|
+
const client = getApiClient();
|
|
34
|
+
const result = await toResultAsync(client.cases.bulk(code, { cases: normalized }));
|
|
35
|
+
return result.match((r) => {
|
|
36
|
+
const ids = r.data.result?.ids ?? [];
|
|
37
|
+
return { created: ids.length, ids };
|
|
38
|
+
}, (e) => {
|
|
39
|
+
throw createToolError(e, CONTEXT);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
toolRegistry.register({
|
|
43
|
+
name: 'qase_case_bulk_create',
|
|
44
|
+
description: `Create up to ${MAX_CASES} test cases in a single request. Use this instead of calling ` +
|
|
45
|
+
'`qase_case_upsert` repeatedly when importing or generating several cases at once. ' +
|
|
46
|
+
'Enum fields (priority, severity, type, etc.) accept both labels ("high", "blocker") and ' +
|
|
47
|
+
'numeric IDs. Creates only — use `qase_case_upsert` with an `id` to update an existing case. ' +
|
|
48
|
+
'Returns the IDs of the created cases in the order they were submitted.',
|
|
49
|
+
schema: Schema,
|
|
50
|
+
handler,
|
|
51
|
+
annotations: CreateAnnotation,
|
|
52
|
+
visibility: 'discoverable',
|
|
53
|
+
});
|
|
54
|
+
//# sourceMappingURL=cases-bulk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cases-bulk.js","sourceRoot":"","sources":["../../../src/operations-v2/write/cases-bulk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE5E,MAAM,OAAO,GAAG,oBAAoB,CAAC;AAErC,mFAAmF;AACnF,MAAM,SAAS,GAAG,GAAG,CAAC;AAEtB,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IACtB,IAAI,EAAE,iBAAiB;IACvB,KAAK,EAAE,CAAC;SACL,KAAK,CAAC,gBAAgB,CAAC;SACvB,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,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C/C,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC;IACtC,CAAC,EACD,CAAC,CAAC,EAAE,EAAE;QACJ,MAAM,eAAe,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IACpC,CAAC,CACF,CAAC;AACJ,CAAC;AAED,YAAY,CAAC,QAAQ,CAAC;IACpB,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EACT,gBAAgB,SAAS,+DAA+D;QACxF,oFAAoF;QACpF,0FAA0F;QAC1F,8FAA8F;QAC9F,wEAAwE;IAC1E,MAAM,EAAE,MAAM;IACd,OAAO;IACP,WAAW,EAAE,gBAAgB;IAC7B,UAAU,EAAE,cAAc;CAC3B,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cases.d.ts","sourceRoot":"","sources":["../../../src/operations-v2/write/cases.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { getApiClient } from '../../client/index.js';
|
|
3
|
+
import { toolRegistry, CreateAnnotation, DeleteAnnotation } from '../../utils/registry.js';
|
|
4
|
+
import { toResultAsync, createToolError } from '../../utils/errors.js';
|
|
5
|
+
import { ProjectCodeSchema, IdSchema } from '../../utils/validation.js';
|
|
6
|
+
import { normalizeCaseEnums } from '../../utils/case-enums.js';
|
|
7
|
+
import { CaseFieldsSchema, applyAutomationMapping } from './case-fields.js';
|
|
8
|
+
const UpsertSchema = z.object({
|
|
9
|
+
code: ProjectCodeSchema,
|
|
10
|
+
id: IdSchema.optional().describe('Case ID — if provided, updates the case; if omitted, creates a new one'),
|
|
11
|
+
...CaseFieldsSchema.shape,
|
|
12
|
+
});
|
|
13
|
+
const DeleteSchema = z.object({
|
|
14
|
+
code: ProjectCodeSchema,
|
|
15
|
+
id: IdSchema,
|
|
16
|
+
});
|
|
17
|
+
async function upsert(args) {
|
|
18
|
+
const client = getApiClient();
|
|
19
|
+
const { code, id, ...data } = args;
|
|
20
|
+
const normalized = applyAutomationMapping(await normalizeCaseEnums(data));
|
|
21
|
+
const result = await toResultAsync(id
|
|
22
|
+
? client.cases.updateCase(code, id, normalized)
|
|
23
|
+
: client.cases.createCase(code, normalized));
|
|
24
|
+
return result.match((r) => r.data.result, (e) => {
|
|
25
|
+
throw createToolError(e, 'case operation');
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
async function del(args) {
|
|
29
|
+
const client = getApiClient();
|
|
30
|
+
const result = await toResultAsync(client.cases.deleteCase(args.code, args.id));
|
|
31
|
+
return result.match(() => ({ success: true, id: args.id }), (e) => {
|
|
32
|
+
throw createToolError(e, 'case operation');
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
toolRegistry.register({
|
|
36
|
+
name: 'qase_case_upsert',
|
|
37
|
+
description: 'Create or update a test case. If `id` is provided, updates the existing case; ' +
|
|
38
|
+
'if omitted, creates a new one. Enum fields (priority, severity, type, etc.) accept ' +
|
|
39
|
+
'both labels ("high", "blocker") and numeric IDs — the server normalizes automatically.',
|
|
40
|
+
schema: UpsertSchema,
|
|
41
|
+
handler: upsert,
|
|
42
|
+
annotations: CreateAnnotation,
|
|
43
|
+
});
|
|
44
|
+
toolRegistry.register({
|
|
45
|
+
name: 'qase_case_delete',
|
|
46
|
+
description: 'Delete a test case by project code and case ID.',
|
|
47
|
+
schema: DeleteSchema,
|
|
48
|
+
handler: del,
|
|
49
|
+
annotations: DeleteAnnotation,
|
|
50
|
+
visibility: 'discoverable',
|
|
51
|
+
});
|
|
52
|
+
//# sourceMappingURL=cases.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cases.js","sourceRoot":"","sources":["../../../src/operations-v2/write/cases.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,YAA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;QACJ,MAAM,eAAe,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC;IAC7C,CAAC,CACF,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,GAAG,CAAC,IAAkC;IACnD,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAC9B,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IAChF,OAAO,MAAM,CAAC,KAAK,CACjB,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,EACtC,CAAC,CAAC,EAAE,EAAE;QACJ,MAAM,eAAe,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC;IAC7C,CAAC,CACF,CAAC;AACJ,CAAC;AAED,YAAY,CAAC,QAAQ,CAAC;IACpB,IAAI,EAAE,kBAAkB;IACxB,WAAW,EACT,gFAAgF;QAChF,qFAAqF;QACrF,wFAAwF;IAC1F,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,MAAM;IACf,WAAW,EAAE,gBAAgB;CAC9B,CAAC,CAAC;AAEH,YAAY,CAAC,QAAQ,CAAC;IACpB,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,iDAAiD;IAC9D,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,GAAG;IACZ,WAAW,EAAE,gBAAgB;IAC7B,UAAU,EAAE,cAAc;CAC3B,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defects.d.ts","sourceRoot":"","sources":["../../../src/operations-v2/write/defects.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { getApiClient } from '../../client/index.js';
|
|
3
|
+
import { toolRegistry, CreateAnnotation, DeleteAnnotation } from '../../utils/registry.js';
|
|
4
|
+
import { toResultAsync, createToolError } from '../../utils/errors.js';
|
|
5
|
+
import { ProjectCodeSchema, IdSchema } from '../../utils/validation.js';
|
|
6
|
+
const DefectFieldsSchema = z.object({
|
|
7
|
+
title: z.string().min(1).max(255).describe('Defect title'),
|
|
8
|
+
actual_result: z.string().optional(),
|
|
9
|
+
severity: z
|
|
10
|
+
.enum(['undefined', 'blocker', 'critical', 'major', 'normal', 'minor', 'trivial'])
|
|
11
|
+
.optional(),
|
|
12
|
+
status: z
|
|
13
|
+
.enum(['open', 'in_progress', 'resolved', 'invalid'])
|
|
14
|
+
.optional()
|
|
15
|
+
.describe('Set to "resolved" to resolve the defect'),
|
|
16
|
+
tags: z.array(z.string()).optional(),
|
|
17
|
+
attachments: z.array(z.string()).optional(),
|
|
18
|
+
custom_field: z.record(z.any()).optional(),
|
|
19
|
+
});
|
|
20
|
+
const UpsertSchema = z.object({
|
|
21
|
+
code: ProjectCodeSchema,
|
|
22
|
+
id: IdSchema.optional().describe('Defect ID — if provided, updates; if omitted, creates'),
|
|
23
|
+
...DefectFieldsSchema.shape,
|
|
24
|
+
});
|
|
25
|
+
const DeleteSchema = z.object({
|
|
26
|
+
code: ProjectCodeSchema,
|
|
27
|
+
id: IdSchema,
|
|
28
|
+
});
|
|
29
|
+
async function upsert(args) {
|
|
30
|
+
const client = getApiClient();
|
|
31
|
+
const { code, id, status, ...data } = args;
|
|
32
|
+
if (id) {
|
|
33
|
+
// Update path: handle status changes
|
|
34
|
+
if (status === 'resolved') {
|
|
35
|
+
const res = await toResultAsync(client.defects.resolveDefect(code, id));
|
|
36
|
+
return res.match((r) => r.data.result ?? { success: true, id, status: 'resolved' }, (e) => {
|
|
37
|
+
throw createToolError(e, 'defect operation');
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
if (status) {
|
|
41
|
+
const res = await toResultAsync(client.defects.updateDefectStatus(code, id, { status }));
|
|
42
|
+
return res.match(() => ({ success: true, id, status }), (e) => {
|
|
43
|
+
throw createToolError(e, 'defect operation');
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
const res = await toResultAsync(client.defects.updateDefect(code, id, data));
|
|
47
|
+
return res.match((r) => r.data.result, (e) => {
|
|
48
|
+
throw createToolError(e, 'defect operation');
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
// Create path
|
|
52
|
+
const createData = { ...data, ...(status && { status }) };
|
|
53
|
+
const res = await toResultAsync(client.defects.createDefect(code, createData));
|
|
54
|
+
return res.match((r) => r.data.result, (e) => {
|
|
55
|
+
throw createToolError(e, 'defect operation');
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
async function del(args) {
|
|
59
|
+
const client = getApiClient();
|
|
60
|
+
const result = await toResultAsync(client.defects.deleteDefect(args.code, args.id));
|
|
61
|
+
return result.match(() => ({ success: true, id: args.id }), (e) => {
|
|
62
|
+
throw createToolError(e, 'defect operation');
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
toolRegistry.register({
|
|
66
|
+
name: 'qase_defect_upsert',
|
|
67
|
+
description: 'Create or update a defect. If `id` is provided, updates (including status changes and resolve). ' +
|
|
68
|
+
'If omitted, creates a new defect. Set `status: "resolved"` to resolve an existing defect.',
|
|
69
|
+
schema: UpsertSchema,
|
|
70
|
+
handler: upsert,
|
|
71
|
+
annotations: CreateAnnotation,
|
|
72
|
+
});
|
|
73
|
+
toolRegistry.register({
|
|
74
|
+
name: 'qase_defect_delete',
|
|
75
|
+
description: 'Delete a defect by project code and defect ID.',
|
|
76
|
+
schema: DeleteSchema,
|
|
77
|
+
handler: del,
|
|
78
|
+
annotations: DeleteAnnotation,
|
|
79
|
+
visibility: 'discoverable',
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=defects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defects.js","sourceRoot":"","sources":["../../../src/operations-v2/write/defects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,M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E,EAAE;QACJ,MAAM,eAAe,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC;IAC/C,CAAC,CACF,CAAC;AACJ,CAAC;AAED,YAAY,CAAC,QAAQ,CAAC;IACpB,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EACT,kGAAkG;QAClG,2FAA2F;IAC7F,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,MAAM;IACf,WAAW,EAAE,gBAAgB;CAC9B,CAAC,CAAC;AAEH,YAAY,CAAC,QAAQ,CAAC;IACpB,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,gDAAgD;IAC7D,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,GAAG;IACZ,WAAW,EAAE,gBAAgB;IAC7B,UAAU,EAAE,cAAc;CAC3B,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environments.d.ts","sourceRoot":"","sources":["../../../src/operations-v2/write/environments.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { getApiClient } from '../../client/index.js';
|
|
3
|
+
import { toolRegistry, CreateAnnotation, DeleteAnnotation } from '../../utils/registry.js';
|
|
4
|
+
import { toResultAsync, createToolError } from '../../utils/errors.js';
|
|
5
|
+
import { ProjectCodeSchema, IdSchema } from '../../utils/validation.js';
|
|
6
|
+
const UpsertSchema = z.object({
|
|
7
|
+
code: ProjectCodeSchema,
|
|
8
|
+
id: IdSchema.optional().describe('Environment ID — if provided, updates; if omitted, creates'),
|
|
9
|
+
title: z.string().min(1).max(255).describe('Environment title'),
|
|
10
|
+
description: z.string().optional(),
|
|
11
|
+
slug: z.string().optional().describe('URL-friendly identifier'),
|
|
12
|
+
host: z.string().optional().describe('Environment host/URL'),
|
|
13
|
+
});
|
|
14
|
+
const DeleteSchema = z.object({
|
|
15
|
+
code: ProjectCodeSchema,
|
|
16
|
+
id: IdSchema,
|
|
17
|
+
});
|
|
18
|
+
async function upsert(args) {
|
|
19
|
+
const client = getApiClient();
|
|
20
|
+
const { code, id, ...data } = args;
|
|
21
|
+
if (id) {
|
|
22
|
+
const result = await toResultAsync(client.environment.updateEnvironment(code, id, data));
|
|
23
|
+
return result.match(() => ({ success: true, id }), (e) => {
|
|
24
|
+
throw createToolError(e, 'environment operation');
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
const result = await toResultAsync(client.environment.createEnvironment(code, data));
|
|
28
|
+
return result.match((r) => r.data.result, (e) => {
|
|
29
|
+
throw createToolError(e, 'environment operation');
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
async function del(args) {
|
|
33
|
+
const client = getApiClient();
|
|
34
|
+
const result = await toResultAsync(client.environment.deleteEnvironment(args.code, args.id));
|
|
35
|
+
return result.match(() => ({ success: true, id: args.id }), (e) => {
|
|
36
|
+
throw createToolError(e, 'environment operation');
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
toolRegistry.register({
|
|
40
|
+
name: 'qase_environment_upsert',
|
|
41
|
+
description: 'Create or update a test environment. If `id` is provided, updates the existing environment; ' +
|
|
42
|
+
'if omitted, creates a new one.',
|
|
43
|
+
schema: UpsertSchema,
|
|
44
|
+
handler: upsert,
|
|
45
|
+
annotations: CreateAnnotation,
|
|
46
|
+
visibility: 'discoverable',
|
|
47
|
+
});
|
|
48
|
+
toolRegistry.register({
|
|
49
|
+
name: 'qase_environment_delete',
|
|
50
|
+
description: 'Delete a test environment by project code and environment ID.',
|
|
51
|
+
schema: DeleteSchema,
|
|
52
|
+
handler: del,
|
|
53
|
+
annotations: DeleteAnnotation,
|
|
54
|
+
visibility: 'discoverable',
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=environments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environments.js","sourceRoot":"","sources":["../../../src/operations-v2/write/environments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK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