@rbaileysr/zephyr-managed-api 1.2.1 → 1.2.9

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 (38) hide show
  1. package/README.md +204 -879
  2. package/dist/README.md +204 -879
  3. package/dist/error-strategy.d.ts.map +1 -1
  4. package/dist/groups/All.d.ts.map +1 -1
  5. package/dist/groups/Automation.d.ts.map +1 -1
  6. package/dist/groups/Folder.d.ts.map +1 -1
  7. package/dist/groups/IssueLink.d.ts.map +1 -1
  8. package/dist/groups/Private/PrivateAttachments.d.ts +697 -0
  9. package/dist/groups/Private/PrivateAttachments.d.ts.map +1 -0
  10. package/dist/groups/Private/PrivateAttachments.js +2146 -0
  11. package/dist/groups/Private/PrivateAuthentication.d.ts +29 -0
  12. package/dist/groups/Private/PrivateAuthentication.d.ts.map +1 -0
  13. package/dist/groups/Private/PrivateAuthentication.js +24 -0
  14. package/dist/groups/Private/PrivateBase.d.ts +32 -0
  15. package/dist/groups/Private/PrivateBase.d.ts.map +1 -0
  16. package/dist/groups/Private/PrivateBase.js +77 -0
  17. package/dist/groups/Private/PrivateComments.d.ts +149 -0
  18. package/dist/groups/Private/PrivateComments.d.ts.map +1 -0
  19. package/dist/groups/Private/PrivateComments.js +493 -0
  20. package/dist/groups/Private/PrivateCustomFields.d.ts +54 -0
  21. package/dist/groups/Private/PrivateCustomFields.d.ts.map +1 -0
  22. package/dist/groups/Private/PrivateCustomFields.js +150 -0
  23. package/dist/groups/Private/PrivateVersions.d.ts +38 -0
  24. package/dist/groups/Private/PrivateVersions.d.ts.map +1 -0
  25. package/dist/groups/Private/PrivateVersions.js +99 -0
  26. package/dist/groups/Private.d.ts +18 -240
  27. package/dist/groups/Private.d.ts.map +1 -1
  28. package/dist/groups/Private.js +13 -756
  29. package/dist/groups/TestCase.d.ts.map +1 -1
  30. package/dist/groups/TestCycle.d.ts.map +1 -1
  31. package/dist/groups/TestExecution.d.ts.map +1 -1
  32. package/dist/groups/TestPlan.d.ts.map +1 -1
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/package.json +1 -1
  35. package/dist/types.d.ts +340 -4
  36. package/dist/types.d.ts.map +1 -1
  37. package/dist/utils.d.ts.map +1 -1
  38. package/package.json +1 -1
@@ -0,0 +1,150 @@
1
+ /*!
2
+ * Copyright Adaptavist 2025 (c) All rights reserved
3
+ */
4
+ import { PrivateBase } from './PrivateBase';
5
+ import { BadRequestError, UnauthorizedError, ForbiddenError, NotFoundError, ServerError, UnexpectedError, } from '../../utils';
6
+ export class PrivateCustomFields extends PrivateBase {
7
+ constructor(apiConnection) {
8
+ super(apiConnection);
9
+ }
10
+ /**
11
+ * Create a custom field using private API
12
+ *
13
+ * Creates a custom field for the specified entity type (test case, test plan, test run, test step, or test execution).
14
+ *
15
+ * ⚠️ WARNING: This uses a private Zephyr API endpoint that is not officially supported.
16
+ * The endpoint may change or be removed at any time without notice.
17
+ *
18
+ * @param credentials - Private API credentials
19
+ * @param category - Entity type for the custom field (TEST_CASE, TEST_PLAN, TEST_RUN, TEST_STEP, or TEST_EXECUTION)
20
+ * @param request - Custom field creation request
21
+ * @returns The created custom field response
22
+ * @throws {BadRequestError} If the request is invalid
23
+ * @throws {UnauthorizedError} If authentication fails
24
+ * @throws {ForbiddenError} If the user doesn't have permission
25
+ * @throws {ServerError} If the server returns an error
26
+ */
27
+ async createCustomField(credentials, category, request) {
28
+ // Get Context JWT
29
+ const contextJwt = await this.getContextJwt(credentials);
30
+ // Determine endpoint based on category
31
+ const endpointMap = {
32
+ TEST_CASE: 'customfield/testcase',
33
+ TEST_PLAN: 'customfield/testplan',
34
+ TEST_RUN: 'customfield/testrun',
35
+ TEST_STEP: 'customfield/teststep',
36
+ TEST_EXECUTION: 'customfield/testexecution',
37
+ };
38
+ const url = `${this.privateApiBaseUrl}/${endpointMap[category]}`;
39
+ const headers = {
40
+ 'Content-Type': 'application/json',
41
+ authorization: `JWT ${contextJwt}`,
42
+ 'jira-project-id': String(request.projectId),
43
+ };
44
+ try {
45
+ const response = await fetch(url, {
46
+ method: 'POST',
47
+ headers,
48
+ body: JSON.stringify(request),
49
+ });
50
+ if (!response.ok) {
51
+ if (response.status === 400) {
52
+ const errorText = await response.text().catch(() => 'Bad Request');
53
+ throw new BadRequestError(`Failed to create custom field: ${errorText}`, response.statusText);
54
+ }
55
+ if (response.status === 401) {
56
+ throw new UnauthorizedError('Authentication failed. Please check your credentials.');
57
+ }
58
+ if (response.status === 403) {
59
+ throw new ForbiddenError('You do not have permission to create custom fields in this project.');
60
+ }
61
+ if (response.status === 404) {
62
+ throw new NotFoundError('Project or resource not found.');
63
+ }
64
+ throw new ServerError(`Failed to create custom field. Status: ${response.status}`, response.status, response.statusText);
65
+ }
66
+ return await response.json();
67
+ }
68
+ catch (error) {
69
+ if (error instanceof BadRequestError ||
70
+ error instanceof UnauthorizedError ||
71
+ error instanceof ForbiddenError ||
72
+ error instanceof NotFoundError ||
73
+ error instanceof ServerError) {
74
+ throw error;
75
+ }
76
+ throw new UnexpectedError('Unexpected error while creating custom field', error);
77
+ }
78
+ }
79
+ /**
80
+ * Get custom fields for a specific entity type using private API
81
+ *
82
+ * Retrieves all custom fields configured for the specified entity type (test case, test plan, test run, test step, or test execution) in a project.
83
+ *
84
+ * ⚠️ WARNING: This uses a private Zephyr API endpoint that is not officially supported.
85
+ * The endpoint may change or be removed at any time without notice.
86
+ *
87
+ * @param credentials - Private API credentials
88
+ * @param category - Entity type for the custom fields (TEST_CASE, TEST_PLAN, TEST_RUN, TEST_STEP, or TEST_EXECUTION)
89
+ * @param request - Get custom fields request
90
+ * @param request.projectId - Jira project ID (numeric, not the project key)
91
+ * @returns Array of custom field definitions
92
+ * @throws {BadRequestError} If the request is invalid
93
+ * @throws {UnauthorizedError} If authentication fails
94
+ * @throws {ForbiddenError} If the user doesn't have permission
95
+ * @throws {NotFoundError} If the project is not found
96
+ * @throws {ServerError} If the server returns an error
97
+ */
98
+ async getCustomFields(credentials, category, request) {
99
+ // Get Context JWT
100
+ const contextJwt = await this.getContextJwt(credentials);
101
+ // Determine endpoint based on category
102
+ // Note: API uses "testrun" in URL even though category is "TEST_RUN"
103
+ const endpointMap = {
104
+ TEST_CASE: 'testcase',
105
+ TEST_PLAN: 'testplan',
106
+ TEST_RUN: 'testrun', // API uses "testrun" in URL
107
+ TEST_STEP: 'teststep',
108
+ TEST_EXECUTION: 'testexecution',
109
+ };
110
+ const url = `${this.privateApiBaseUrl}/project/${request.projectId}/customfields/${endpointMap[category]}?projectId=${request.projectId}`;
111
+ const headers = {
112
+ accept: 'application/json',
113
+ authorization: `JWT ${contextJwt}`,
114
+ 'jira-project-id': String(request.projectId),
115
+ };
116
+ try {
117
+ const response = await fetch(url, {
118
+ method: 'GET',
119
+ headers,
120
+ });
121
+ if (!response.ok) {
122
+ if (response.status === 400) {
123
+ const errorText = await response.text().catch(() => 'Bad Request');
124
+ throw new BadRequestError(`Failed to get custom fields: ${errorText}`, response.statusText);
125
+ }
126
+ if (response.status === 401) {
127
+ throw new UnauthorizedError('Authentication failed. Please check your credentials.');
128
+ }
129
+ if (response.status === 403) {
130
+ throw new ForbiddenError('You do not have permission to view custom fields in this project.');
131
+ }
132
+ if (response.status === 404) {
133
+ throw new NotFoundError('Project not found.');
134
+ }
135
+ throw new ServerError(`Failed to get custom fields. Status: ${response.status}`, response.status, response.statusText);
136
+ }
137
+ return (await response.json());
138
+ }
139
+ catch (error) {
140
+ if (error instanceof BadRequestError ||
141
+ error instanceof UnauthorizedError ||
142
+ error instanceof ForbiddenError ||
143
+ error instanceof NotFoundError ||
144
+ error instanceof ServerError) {
145
+ throw error;
146
+ }
147
+ throw new UnexpectedError('Unexpected error while getting custom fields', error);
148
+ }
149
+ }
150
+ }
@@ -0,0 +1,38 @@
1
+ /*!
2
+ * Copyright Adaptavist 2025 (c) All rights reserved
3
+ */
4
+ /**
5
+ * Private API Versions sub-group
6
+ * Handles test case version creation
7
+ *
8
+ * ⚠️ WARNING: These methods use private APIs that are not officially supported.
9
+ */
10
+ import type { PrivateApiCredentials, CreateTestCaseVersionRequest, CreateTestCaseVersionResponse } from '../../types';
11
+ import { PrivateBase } from './PrivateBase';
12
+ import type { ZephyrApiConnection } from '../../index';
13
+ export declare class PrivateVersions extends PrivateBase {
14
+ constructor(apiConnection?: ZephyrApiConnection);
15
+ /**
16
+ * Create a new test case version using private API
17
+ *
18
+ * Creates a new version of an existing test case. Note that when a new version
19
+ * is created, the testCaseId changes for that test case.
20
+ *
21
+ * ⚠️ WARNING: This uses a private Zephyr API endpoint that is not officially supported.
22
+ * The endpoint may change or be removed at any time without notice.
23
+ *
24
+ * @param credentials - Private API credentials
25
+ * @param request - Test case version creation request
26
+ * @param request.testCaseKey - Test case key (e.g., 'PROJ-T1'). The numeric ID will be looked up automatically if Zephyr Connector is available.
27
+ * @param request.projectId - Jira project ID (numeric, not the project key)
28
+ * @returns The created version response with id and key
29
+ * @throws {BadRequestError} If the request is invalid
30
+ * @throws {UnauthorizedError} If authentication fails
31
+ * @throws {ForbiddenError} If the user doesn't have permission
32
+ * @throws {NotFoundError} If the test case is not found
33
+ * @throws {ServerError} If the server returns an error (including 409 Conflict if version already exists)
34
+ * @throws {UnexpectedError} If test case ID cannot be looked up from key and Zephyr Connector is not available
35
+ */
36
+ createTestCaseVersion(credentials: PrivateApiCredentials, request: CreateTestCaseVersionRequest): Promise<CreateTestCaseVersionResponse>;
37
+ }
38
+ //# sourceMappingURL=PrivateVersions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrivateVersions.d.ts","sourceRoot":"","sources":["../../../groups/Private/PrivateVersions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AACtH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAS5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,qBAAa,eAAgB,SAAQ,WAAW;gBACnC,aAAa,CAAC,EAAE,mBAAmB;IAI/C;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,qBAAqB,CAC1B,WAAW,EAAE,qBAAqB,EAClC,OAAO,EAAE,4BAA4B,GACnC,OAAO,CAAC,6BAA6B,CAAC;CAuFzC"}
@@ -0,0 +1,99 @@
1
+ /*!
2
+ * Copyright Adaptavist 2025 (c) All rights reserved
3
+ */
4
+ import { PrivateBase } from './PrivateBase';
5
+ import { BadRequestError, UnauthorizedError, ForbiddenError, NotFoundError, ServerError, UnexpectedError, } from '../../utils';
6
+ export class PrivateVersions extends PrivateBase {
7
+ constructor(apiConnection) {
8
+ super(apiConnection);
9
+ }
10
+ /**
11
+ * Create a new test case version using private API
12
+ *
13
+ * Creates a new version of an existing test case. Note that when a new version
14
+ * is created, the testCaseId changes for that test case.
15
+ *
16
+ * ⚠️ WARNING: This uses a private Zephyr API endpoint that is not officially supported.
17
+ * The endpoint may change or be removed at any time without notice.
18
+ *
19
+ * @param credentials - Private API credentials
20
+ * @param request - Test case version creation request
21
+ * @param request.testCaseKey - Test case key (e.g., 'PROJ-T1'). The numeric ID will be looked up automatically if Zephyr Connector is available.
22
+ * @param request.projectId - Jira project ID (numeric, not the project key)
23
+ * @returns The created version response with id and key
24
+ * @throws {BadRequestError} If the request is invalid
25
+ * @throws {UnauthorizedError} If authentication fails
26
+ * @throws {ForbiddenError} If the user doesn't have permission
27
+ * @throws {NotFoundError} If the test case is not found
28
+ * @throws {ServerError} If the server returns an error (including 409 Conflict if version already exists)
29
+ * @throws {UnexpectedError} If test case ID cannot be looked up from key and Zephyr Connector is not available
30
+ */
31
+ async createTestCaseVersion(credentials, request) {
32
+ // Get test case ID from key if we have API connection
33
+ let testCaseId;
34
+ if (this.testCaseGroup) {
35
+ try {
36
+ const testCase = await this.testCaseGroup.getTestCase({ testCaseKey: request.testCaseKey });
37
+ if (!testCase) {
38
+ throw new NotFoundError(`Test case with key '${request.testCaseKey}' not found.`);
39
+ }
40
+ testCaseId = testCase.id;
41
+ }
42
+ catch (error) {
43
+ if (error instanceof NotFoundError) {
44
+ throw new NotFoundError(`Test case with key '${request.testCaseKey}' not found.`);
45
+ }
46
+ throw new UnexpectedError(`Failed to look up test case ID from key '${request.testCaseKey}'. Ensure Zephyr Connector is configured.`, error);
47
+ }
48
+ }
49
+ else {
50
+ throw new UnexpectedError('Cannot look up test case ID from key. This method requires Zephyr Connector to be configured. Use createZephyrApi() with an API Connection.');
51
+ }
52
+ // Get Context JWT
53
+ const contextJwt = await this.getContextJwt(credentials);
54
+ const url = `${this.privateApiBaseUrl}/testcase/${testCaseId}/newversion`;
55
+ const headers = {
56
+ 'Content-Type': 'application/json',
57
+ authorization: `JWT ${contextJwt}`,
58
+ 'jira-project-id': String(request.projectId),
59
+ };
60
+ try {
61
+ const response = await fetch(url, {
62
+ method: 'POST',
63
+ headers,
64
+ body: JSON.stringify({}), // Empty body as per documentation
65
+ });
66
+ if (!response.ok) {
67
+ if (response.status === 400) {
68
+ const errorText = await response.text().catch(() => 'Bad Request');
69
+ throw new BadRequestError(`Failed to create test case version: ${errorText}`, response.statusText);
70
+ }
71
+ if (response.status === 401) {
72
+ throw new UnauthorizedError('Authentication failed. Please check your credentials.');
73
+ }
74
+ if (response.status === 403) {
75
+ throw new ForbiddenError('You do not have permission to create test case versions in this project.');
76
+ }
77
+ if (response.status === 404) {
78
+ throw new NotFoundError('Test case not found.');
79
+ }
80
+ if (response.status === 409) {
81
+ throw new ServerError('Conflict: A new version already exists for this test case.', response.status, response.statusText);
82
+ }
83
+ throw new ServerError(`Failed to create test case version. Status: ${response.status}`, response.status, response.statusText);
84
+ }
85
+ return (await response.json());
86
+ }
87
+ catch (error) {
88
+ if (error instanceof BadRequestError ||
89
+ error instanceof UnauthorizedError ||
90
+ error instanceof ForbiddenError ||
91
+ error instanceof NotFoundError ||
92
+ error instanceof ServerError ||
93
+ error instanceof UnexpectedError) {
94
+ throw error;
95
+ }
96
+ throw new UnexpectedError('Unexpected error while creating test case version', error);
97
+ }
98
+ }
99
+ }
@@ -1,262 +1,40 @@
1
1
  /*!
2
2
  * Copyright Adaptavist 2025 (c) All rights reserved
3
3
  */
4
- /**
5
- * Private API group
6
- *
7
- * ⚠️ WARNING: These functions use Zephyr's private/unofficial API endpoints.
8
- *
9
- * These endpoints are:
10
- * - Not officially supported by SmartBear
11
- * - Not part of the public API documentation
12
- * - Subject to change at any time without notice
13
- * - Not covered by Standard Support
14
- *
15
- * Use these functions at your own risk. They may break with future Zephyr updates.
16
- */
17
- import type { CreatePrivateCustomFieldRequest, PrivateCustomFieldCategory, CreateTestCaseVersionRequest, CreateTestCaseVersionResponse, CreateAttachmentRequest, CreateTestCaseCommentRequest, CreateTestCaseCommentResponse, GetTestCaseAttachmentsRequest, GetTestCaseAttachmentsResponse, DownloadAttachmentRequest } from '../types';
18
4
  import type { ZephyrApiConnection } from '../index';
5
+ import { PrivateBase } from './Private/PrivateBase';
6
+ import { PrivateComments } from './Private/PrivateComments';
7
+ import { PrivateCustomFields } from './Private/PrivateCustomFields';
8
+ import { PrivateVersions } from './Private/PrivateVersions';
9
+ import { PrivateAttachments } from './Private/PrivateAttachments';
10
+ import { PrivateAuthentication } from './Private/PrivateAuthentication';
19
11
  /**
20
12
  * Private API group for accessing Zephyr's private/unofficial endpoints
21
13
  *
22
14
  * ⚠️ WARNING: These methods use private APIs that are not officially supported.
23
15
  * They may change or break at any time without notice.
24
16
  */
25
- export declare class PrivateGroup {
17
+ export declare class PrivateGroup extends PrivateBase {
26
18
  /**
27
- * Base URL for Zephyr private API endpoints
19
+ * Authentication sub-group - Get Jira Context JWT token
28
20
  */
29
- private readonly privateApiBaseUrl;
21
+ readonly Authentication: PrivateAuthentication;
30
22
  /**
31
- * Optional API connection for accessing public API (e.g., to look up test case IDs from keys)
23
+ * Comments sub-group - Get and create comments for test cases, test cycles, and test plans
32
24
  */
33
- private readonly apiConnection?;
34
- private readonly testCaseGroup?;
35
- constructor(apiConnection?: ZephyrApiConnection);
25
+ readonly Comments: PrivateComments;
36
26
  /**
37
- * Get Jira Context JWT token
38
- *
39
- * Retrieves a short-lived JWT token (15 minutes) from Jira that is required
40
- * for private Zephyr API endpoints. This token may need to be refreshed
41
- * during long operations.
42
- *
43
- * ⚠️ WARNING: This uses a private Jira endpoint and may change without notice.
44
- *
45
- * @param userEmail - Jira user email address
46
- * @param apiToken - Jira API token
47
- * @param jiraInstanceUrl - Full Jira instance URL (e.g., 'https://your-instance.atlassian.net')
48
- * @returns The Context JWT token string
49
- * @throws {UnauthorizedError} If authentication fails
50
- * @throws {UnexpectedError} If the JWT cannot be extracted from the response
27
+ * CustomFields sub-group - Create and get custom fields
51
28
  */
52
- getContextJwt(userEmail: string, apiToken: string, jiraInstanceUrl: string): Promise<string>;
29
+ readonly CustomFields: PrivateCustomFields;
53
30
  /**
54
- * Create a custom field using private API
55
- *
56
- * Creates a custom field for the specified entity type (test case, test plan, test run, or test step).
57
- *
58
- * ⚠️ WARNING: This uses a private Zephyr API endpoint that is not officially supported.
59
- * The endpoint may change or be removed at any time without notice.
60
- *
61
- * @param userEmail - Jira user email address
62
- * @param apiToken - Jira API token
63
- * @param jiraInstanceUrl - Full Jira instance URL (e.g., 'https://your-instance.atlassian.net')
64
- * @param category - Entity type for the custom field (TEST_CASE, TEST_PLAN, TEST_RUN, or TEST_STEP)
65
- * @param request - Custom field creation request
66
- * @returns The created custom field response
67
- * @throws {BadRequestError} If the request is invalid
68
- * @throws {UnauthorizedError} If authentication fails
69
- * @throws {ForbiddenError} If the user doesn't have permission
70
- * @throws {ServerError} If the server returns an error
31
+ * Versions sub-group - Create test case versions
71
32
  */
72
- createCustomField(userEmail: string, apiToken: string, jiraInstanceUrl: string, category: PrivateCustomFieldCategory, request: CreatePrivateCustomFieldRequest): Promise<unknown>;
33
+ readonly Versions: PrivateVersions;
73
34
  /**
74
- * Create a new test case version using private API
75
- *
76
- * Creates a new version of an existing test case. Note that when a new version
77
- * is created, the testCaseId changes for that test case.
78
- *
79
- * ⚠️ WARNING: This uses a private Zephyr API endpoint that is not officially supported.
80
- * The endpoint may change or be removed at any time without notice.
81
- *
82
- * @param userEmail - Jira user email address
83
- * @param apiToken - Jira API token
84
- * @param jiraInstanceUrl - Full Jira instance URL (e.g., 'https://your-instance.atlassian.net')
85
- * @param request - Test case version creation request
86
- * @param request.testCaseKey - Test case key (e.g., 'PROJ-T1'). The numeric ID will be looked up automatically if Zephyr Connector is available.
87
- * @param request.projectId - Jira project ID (numeric, not the project key)
88
- * @returns The created version response with id and key
89
- * @throws {BadRequestError} If the request is invalid
90
- * @throws {UnauthorizedError} If authentication fails
91
- * @throws {ForbiddenError} If the user doesn't have permission
92
- * @throws {NotFoundError} If the test case is not found
93
- * @throws {ServerError} If the server returns an error (including 409 Conflict if version already exists)
94
- * @throws {UnexpectedError} If test case ID cannot be looked up from key and Zephyr Connector is not available
35
+ * Attachments sub-group - Get, download, and create attachments
95
36
  */
96
- createTestCaseVersion(userEmail: string, apiToken: string, jiraInstanceUrl: string, request: CreateTestCaseVersionRequest): Promise<CreateTestCaseVersionResponse>;
97
- /**
98
- * Get upload details for attachment upload
99
- *
100
- * Retrieves S3 upload credentials and configuration needed to upload an attachment.
101
- *
102
- * ⚠️ WARNING: This uses a private Zephyr API endpoint that is not officially supported.
103
- * The endpoint may change or be removed at any time without notice.
104
- *
105
- * @param contextJwt - Jira Context JWT token
106
- * @returns Upload details including S3 bucket URL, credentials, and policy
107
- * @throws {UnauthorizedError} If authentication fails
108
- * @throws {ServerError} If the server returns an error
109
- */
110
- private getUploadDetails;
111
- /**
112
- * Upload file to S3
113
- *
114
- * Uploads a file to S3 using the credentials from upload details.
115
- *
116
- * @param upload - Upload details from getUploadDetails
117
- * @param projectId - Jira project ID
118
- * @param testCaseId - Numeric test case ID
119
- * @param userAccountId - Atlassian account ID
120
- * @param file - File to upload (Blob or ArrayBuffer)
121
- * @param fileName - Name of the file
122
- * @returns S3 upload information
123
- * @throws {UnexpectedError} If upload fails
124
- */
125
- private uploadToS3;
126
- /**
127
- * Save attachment metadata
128
- *
129
- * Saves metadata for an uploaded attachment.
130
- *
131
- * @param contextJwt - Jira Context JWT token
132
- * @param projectId - Jira project ID
133
- * @param testCaseId - Numeric test case ID
134
- * @param userAccountId - Atlassian account ID
135
- * @param s3Key - S3 key from upload
136
- * @param fileName - File name
137
- * @param mimeType - MIME type
138
- * @param fileSize - File size in bytes
139
- * @returns Attachment metadata response
140
- * @throws {BadRequestError} If the request is invalid
141
- * @throws {UnauthorizedError} If authentication fails
142
- * @throws {ServerError} If the server returns an error
143
- */
144
- private saveAttachmentMetadata;
145
- /**
146
- * Create a comment on a test case using private API
147
- *
148
- * Adds a comment to an existing test case. The comment will be associated with
149
- * the specified user account ID.
150
- *
151
- * ⚠️ WARNING: This uses a private Zephyr API endpoint that is not officially supported.
152
- * The endpoint may change or be removed at any time without notice.
153
- *
154
- * @param userEmail - Jira user email address
155
- * @param apiToken - Jira API token
156
- * @param jiraInstanceUrl - Full Jira instance URL (e.g., 'https://your-instance.atlassian.net')
157
- * @param request - Comment creation request
158
- * @param request.testCaseKey - Test case key (e.g., 'PROJ-T1'). The numeric ID will be looked up automatically if Zephyr Connector is available.
159
- * @param request.projectId - Jira project ID (numeric, not the project key)
160
- * @param request.body - Comment text/body
161
- * @param request.createdBy - Atlassian account ID of the user creating the comment (e.g., '5d6fdc98dc6e480dbc021aae')
162
- * @returns Comment creation response
163
- * @throws {BadRequestError} If the request is invalid
164
- * @throws {UnauthorizedError} If authentication fails
165
- * @throws {ForbiddenError} If the user doesn't have permission
166
- * @throws {NotFoundError} If the test case is not found
167
- * @throws {ServerError} If the server returns an error
168
- * @throws {UnexpectedError} If test case ID cannot be looked up from key and Zephyr Connector is not available
169
- */
170
- createTestCaseComment(userEmail: string, apiToken: string, jiraInstanceUrl: string, request: CreateTestCaseCommentRequest): Promise<CreateTestCaseCommentResponse>;
171
- /**
172
- * Get attachments for a test case using private API
173
- *
174
- * Retrieves all attachment details for a test case, including signed S3 URLs
175
- * for downloading the attachments.
176
- *
177
- * ⚠️ WARNING: This uses a private Zephyr API endpoint that is not officially supported.
178
- * The endpoint may change or be removed at any time without notice.
179
- *
180
- * @param userEmail - Jira user email address
181
- * @param apiToken - Jira API token
182
- * @param jiraInstanceUrl - Full Jira instance URL (e.g., 'https://your-instance.atlassian.net')
183
- * @param request - Get attachments request
184
- * @param request.testCaseKey - Test case key (e.g., 'PROJ-T1'). The numeric ID will be looked up automatically if Zephyr Connector is available.
185
- * @param request.projectId - Jira project ID (numeric, not the project key)
186
- * @returns Test case attachments response with array of attachment details
187
- * @throws {BadRequestError} If the request is invalid
188
- * @throws {UnauthorizedError} If authentication fails
189
- * @throws {ForbiddenError} If the user doesn't have permission
190
- * @throws {NotFoundError} If the test case is not found
191
- * @throws {ServerError} If the server returns an error
192
- * @throws {UnexpectedError} If test case ID cannot be looked up from key and Zephyr Connector is not available
193
- */
194
- getTestCaseAttachments(userEmail: string, apiToken: string, jiraInstanceUrl: string, request: GetTestCaseAttachmentsRequest): Promise<GetTestCaseAttachmentsResponse>;
195
- /**
196
- * Download an attachment from a test case using private API
197
- *
198
- * Downloads an attachment file into memory. This method:
199
- * 1. Gets fresh attachment details (including a fresh signed S3 URL)
200
- * 2. Downloads the file from the signed URL
201
- * 3. Returns the file as a Blob
202
- *
203
- * ⚠️ WARNING: This uses private Zephyr API endpoints that are not officially supported.
204
- * The endpoints may change or be removed at any time without notice.
205
- *
206
- * @param userEmail - Jira user email address
207
- * @param apiToken - Jira API token
208
- * @param jiraInstanceUrl - Full Jira instance URL (e.g., 'https://your-instance.atlassian.net')
209
- * @param request - Download attachment request
210
- * @param request.testCaseKey - Test case key (e.g., 'PROJ-T1'). The numeric ID will be looked up automatically if Zephyr Connector is available.
211
- * @param request.projectId - Jira project ID (numeric, not the project key)
212
- * @param request.attachmentId - Attachment ID (UUID string, e.g., 'c3f14125-638f-47f9-9211-12a9777c09e7')
213
- * @returns Blob containing the attachment file data
214
- * @throws {BadRequestError} If the request is invalid
215
- * @throws {UnauthorizedError} If authentication fails
216
- * @throws {ForbiddenError} If the user doesn't have permission
217
- * @throws {NotFoundError} If the test case or attachment is not found
218
- * @throws {ServerError} If the server returns an error
219
- * @throws {UnexpectedError} If test case ID cannot be looked up from key and Zephyr Connector is not available, or if download fails
220
- */
221
- downloadAttachment(userEmail: string, apiToken: string, jiraInstanceUrl: string, request: DownloadAttachmentRequest): Promise<Blob>;
222
- /**
223
- * Generate a UUID v4 (compatible with ScriptRunner Connect runtime)
224
- *
225
- * Uses crypto.getRandomValues() which is available in web standards
226
- */
227
- private generateUUID;
228
- /**
229
- * Get MIME type from file name
230
- */
231
- private getMimeType;
232
- /**
233
- * Create an attachment for a test case using private API
234
- *
235
- * Uploads a file attachment to a test case. This involves:
236
- * 1. Getting upload details (S3 credentials)
237
- * 2. Uploading the file to S3
238
- * 3. Saving attachment metadata
239
- *
240
- * ⚠️ WARNING: This uses private Zephyr API endpoints that are not officially supported.
241
- * The endpoints may change or be removed at any time without notice.
242
- *
243
- * @param userEmail - Jira user email address
244
- * @param apiToken - Jira API token
245
- * @param jiraInstanceUrl - Full Jira instance URL (e.g., 'https://your-instance.atlassian.net')
246
- * @param request - Attachment creation request
247
- * @param request.testCaseKey - Test case key (e.g., 'PROJ-T1'). The numeric ID will be looked up automatically if Zephyr Connector is available.
248
- * @param request.projectId - Jira project ID (numeric, not the project key)
249
- * @param request.file - File to upload (Blob or ArrayBuffer)
250
- * @param request.fileName - Name of the file
251
- * @param request.userAccountId - Atlassian account ID (e.g., '5d6fdc98dc6e480dbc021aae')
252
- * @returns Attachment metadata response
253
- * @throws {BadRequestError} If the request is invalid
254
- * @throws {UnauthorizedError} If authentication fails
255
- * @throws {ForbiddenError} If the user doesn't have permission
256
- * @throws {NotFoundError} If the test case is not found
257
- * @throws {ServerError} If the server returns an error
258
- * @throws {UnexpectedError} If test case ID cannot be looked up from key and Zephyr Connector is not available
259
- */
260
- createAttachment(userEmail: string, apiToken: string, jiraInstanceUrl: string, request: CreateAttachmentRequest): Promise<unknown>;
37
+ readonly Attachments: PrivateAttachments;
38
+ constructor(apiConnection?: ZephyrApiConnection);
261
39
  }
262
40
  //# sourceMappingURL=Private.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Private.d.ts","sourceRoot":"","sources":["../../groups/Private.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EACX,+BAA+B,EAC/B,0BAA0B,EAC1B,4BAA4B,EAC5B,6BAA6B,EAG7B,uBAAuB,EACvB,4BAA4B,EAC5B,6BAA6B,EAC7B,6BAA6B,EAC7B,8BAA8B,EAE9B,yBAAyB,EACzB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAWpD;;;;;GAKG;AACH,qBAAa,YAAY;IACxB;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA2D;IAE7F;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAsB;IACrD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAgB;gBAEnC,aAAa,CAAC,EAAE,mBAAmB;IAO/C;;;;;;;;;;;;;;;OAeG;IACG,aAAa,CAClB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,GACrB,OAAO,CAAC,MAAM,CAAC;IAuElB;;;;;;;;;;;;;;;;;;OAkBG;IACG,iBAAiB,CACtB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,0BAA0B,EACpC,OAAO,EAAE,+BAA+B,GACtC,OAAO,CAAC,OAAO,CAAC;IA8DnB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACG,qBAAqB,CAC1B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,4BAA4B,GACnC,OAAO,CAAC,6BAA6B,CAAC;IAsFzC;;;;;;;;;;;;OAYG;YACW,gBAAgB;IAiC9B;;;;;;;;;;;;;OAaG;YACW,UAAU;IAsExB;;;;;;;;;;;;;;;;;OAiBG;YACW,sBAAsB;IAgEpC;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACG,qBAAqB,CAC1B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,4BAA4B,GACnC,OAAO,CAAC,6BAA6B,CAAC;IAoFzC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACG,sBAAsB,CAC3B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,6BAA6B,GACpC,OAAO,CAAC,8BAA8B,CAAC;IA8E1C;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACG,kBAAkB,CACvB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,yBAAyB,GAChC,OAAO,CAAC,IAAI,CAAC;IAwDhB;;;;OAIG;IACH,OAAO,CAAC,YAAY;IAwBpB;;OAEG;IACH,OAAO,CAAC,WAAW;IAkBnB;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACG,gBAAgB,CACrB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,uBAAuB,GAC9B,OAAO,CAAC,OAAO,CAAC;CAqDnB"}
1
+ {"version":3,"file":"Private.d.ts","sourceRoot":"","sources":["../../groups/Private.ts"],"names":[],"mappings":"AAAA;;GAEG;AA6DH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AASxE;;;;;GAKG;AACH,qBAAa,YAAa,SAAQ,WAAW;IAC5C;;OAEG;IACH,SAAgB,cAAc,EAAE,qBAAqB,CAAC;IAEtD;;OAEG;IACH,SAAgB,QAAQ,EAAE,eAAe,CAAC;IAE1C;;OAEG;IACH,SAAgB,YAAY,EAAE,mBAAmB,CAAC;IAElD;;OAEG;IACH,SAAgB,QAAQ,EAAE,eAAe,CAAC;IAE1C;;OAEG;IACH,SAAgB,WAAW,EAAE,kBAAkB,CAAC;gBAEpC,aAAa,CAAC,EAAE,mBAAmB;CAS/C"}