@rbaileysr/zephyr-managed-api 1.1.0 → 1.2.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/README.md +145 -12
- package/dist/README.md +145 -12
- package/dist/groups/Private.d.ts +178 -5
- package/dist/groups/Private.d.ts.map +1 -1
- package/dist/groups/Private.js +554 -7
- package/dist/index.js +2 -2
- package/dist/package.json +2 -10
- package/dist/types.d.ts +97 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -10
package/README.md
CHANGED
|
@@ -344,7 +344,11 @@ The Managed API is organized into the following groups:
|
|
|
344
344
|
|
|
345
345
|
- `getContextJwt(userEmail, apiToken, jiraInstanceUrl)` - Get Jira Context JWT token (required for private API calls)
|
|
346
346
|
- `createCustomField(userEmail, apiToken, jiraInstanceUrl, category, request)` - Create custom fields for test cases, test plans, test runs, or test steps
|
|
347
|
-
- `createTestCaseVersion(userEmail, apiToken, jiraInstanceUrl,
|
|
347
|
+
- `createTestCaseVersion(userEmail, apiToken, jiraInstanceUrl, request)` - Create a new test case version
|
|
348
|
+
- `createTestCaseComment(userEmail, apiToken, jiraInstanceUrl, request)` - Create a comment on a test case
|
|
349
|
+
- `getTestCaseAttachments(userEmail, apiToken, jiraInstanceUrl, request)` - Get all attachments for a test case
|
|
350
|
+
- `downloadAttachment(userEmail, apiToken, jiraInstanceUrl, request)` - Download an attachment file into memory
|
|
351
|
+
- `createAttachment(userEmail, apiToken, jiraInstanceUrl, request)` - Upload an attachment to a test case
|
|
348
352
|
|
|
349
353
|
## Authentication
|
|
350
354
|
|
|
@@ -483,26 +487,131 @@ const selectField = await api.Private.createCustomField(
|
|
|
483
487
|
Create a new version of an existing test case. **Note:** When a new version is created, the `testCaseId` changes for that test case.
|
|
484
488
|
|
|
485
489
|
```typescript
|
|
486
|
-
//
|
|
487
|
-
const testCase = await api.TestCase.getTestCase({ testCaseKey: 'PROJ-T1' });
|
|
488
|
-
const testCaseId = testCase.id; // Numeric ID, not the key
|
|
489
|
-
|
|
490
|
-
// Create a new version
|
|
490
|
+
// Create a new version (test case ID is looked up automatically from key)
|
|
491
491
|
const newVersion = await api.Private.createTestCaseVersion(
|
|
492
492
|
'user@example.com',
|
|
493
493
|
'jira-api-token',
|
|
494
494
|
'https://your-instance.atlassian.net',
|
|
495
|
-
|
|
496
|
-
|
|
495
|
+
{
|
|
496
|
+
testCaseKey: 'PROJ-T1', // Uses key, looks up ID automatically
|
|
497
|
+
projectId: 10017 // Numeric project ID
|
|
498
|
+
}
|
|
497
499
|
);
|
|
500
|
+
// Returns: { id: 286693656, key: "ZEP-T18" }
|
|
498
501
|
```
|
|
499
502
|
|
|
500
503
|
**Important Notes:**
|
|
501
|
-
- The `
|
|
502
|
-
-
|
|
504
|
+
- The method accepts `testCaseKey` and automatically looks up the numeric ID
|
|
505
|
+
- The `projectId` must be numeric, not the project key
|
|
503
506
|
- If a new version already exists, the API will return a 409 Conflict error
|
|
504
507
|
- The test case ID changes after creating a new version
|
|
505
508
|
|
|
509
|
+
### Create Test Case Comment
|
|
510
|
+
|
|
511
|
+
Add a comment to an existing test case.
|
|
512
|
+
|
|
513
|
+
```typescript
|
|
514
|
+
const comment = await api.Private.createTestCaseComment(
|
|
515
|
+
'user@example.com',
|
|
516
|
+
'jira-api-token',
|
|
517
|
+
'https://your-instance.atlassian.net',
|
|
518
|
+
{
|
|
519
|
+
testCaseKey: 'PROJ-T1', // Uses key, looks up ID automatically
|
|
520
|
+
projectId: 10233, // Numeric project ID
|
|
521
|
+
body: 'This is a test comment', // Comment text
|
|
522
|
+
createdBy: '5d6fdc98dc6e480dbc021aae' // Atlassian account ID
|
|
523
|
+
}
|
|
524
|
+
);
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
### Get Test Case Attachments
|
|
528
|
+
|
|
529
|
+
Retrieve all attachment details for a test case, including signed S3 URLs for downloading.
|
|
530
|
+
|
|
531
|
+
```typescript
|
|
532
|
+
const attachments = await api.Private.getTestCaseAttachments(
|
|
533
|
+
'user@example.com',
|
|
534
|
+
'jira-api-token',
|
|
535
|
+
'https://your-instance.atlassian.net',
|
|
536
|
+
{
|
|
537
|
+
testCaseKey: 'PROJ-T1',
|
|
538
|
+
projectId: 10233
|
|
539
|
+
}
|
|
540
|
+
);
|
|
541
|
+
|
|
542
|
+
console.log(`Found ${attachments.attachments.length} attachments`);
|
|
543
|
+
attachments.attachments.forEach(att => {
|
|
544
|
+
console.log(`- ${att.name} (${att.fileSize} bytes, ${att.mimeType})`);
|
|
545
|
+
console.log(` ID: ${att.id}`);
|
|
546
|
+
console.log(` URL: ${att.url}`);
|
|
547
|
+
});
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
**Response Structure:**
|
|
551
|
+
Each attachment includes:
|
|
552
|
+
- `id` - Attachment UUID
|
|
553
|
+
- `name` - File name
|
|
554
|
+
- `mimeType` - MIME type (e.g., 'image/jpeg', 'application/pdf')
|
|
555
|
+
- `fileSize` - File size in bytes
|
|
556
|
+
- `url` - Signed S3 URL for downloading (expires after ~90 minutes)
|
|
557
|
+
- `createdOn` - Creation timestamp
|
|
558
|
+
- `userKey` - Atlassian account ID of the uploader
|
|
559
|
+
- `s3Key` - S3 storage key
|
|
560
|
+
|
|
561
|
+
### Download Attachment
|
|
562
|
+
|
|
563
|
+
Download an attachment file into memory. This method automatically gets a fresh signed URL and downloads the file.
|
|
564
|
+
|
|
565
|
+
```typescript
|
|
566
|
+
const fileBlob = await api.Private.downloadAttachment(
|
|
567
|
+
'user@example.com',
|
|
568
|
+
'jira-api-token',
|
|
569
|
+
'https://your-instance.atlassian.net',
|
|
570
|
+
{
|
|
571
|
+
testCaseKey: 'PROJ-T1',
|
|
572
|
+
projectId: 10233,
|
|
573
|
+
attachmentId: 'c3f14125-638f-47f9-9211-12a9777c09e7' // Attachment UUID
|
|
574
|
+
}
|
|
575
|
+
);
|
|
576
|
+
|
|
577
|
+
// Use the blob (e.g., save to Record Storage, upload elsewhere, etc.)
|
|
578
|
+
console.log(`Downloaded file: ${fileBlob.size} bytes, type: ${fileBlob.type}`);
|
|
579
|
+
|
|
580
|
+
// Example: Convert to ArrayBuffer if needed
|
|
581
|
+
const arrayBuffer = await fileBlob.arrayBuffer();
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
**Important Notes:**
|
|
585
|
+
- The method automatically gets a fresh signed URL to ensure it hasn't expired
|
|
586
|
+
- Returns a `Blob` object that can be used directly or converted to `ArrayBuffer`
|
|
587
|
+
- The signed URLs from `getTestCaseAttachments` expire after ~90 minutes, but `downloadAttachment` always gets a fresh URL
|
|
588
|
+
|
|
589
|
+
### Upload Attachment
|
|
590
|
+
|
|
591
|
+
Upload a file attachment to a test case.
|
|
592
|
+
|
|
593
|
+
```typescript
|
|
594
|
+
const file = new Blob(['file content'], { type: 'text/plain' });
|
|
595
|
+
|
|
596
|
+
const attachment = await api.Private.createAttachment(
|
|
597
|
+
'user@example.com',
|
|
598
|
+
'jira-api-token',
|
|
599
|
+
'https://your-instance.atlassian.net',
|
|
600
|
+
{
|
|
601
|
+
testCaseKey: 'PROJ-T1', // Uses key, looks up ID automatically
|
|
602
|
+
projectId: 10233, // Numeric project ID
|
|
603
|
+
file: file, // Blob or ArrayBuffer
|
|
604
|
+
fileName: 'test-file.txt',
|
|
605
|
+
userAccountId: '5d6fdc98dc6e480dbc021aae' // Atlassian account ID
|
|
606
|
+
}
|
|
607
|
+
);
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
**Important Notes:**
|
|
611
|
+
- The method handles the complete upload flow: getting S3 credentials, uploading to S3, and saving metadata
|
|
612
|
+
- Supports both `Blob` and `ArrayBuffer` file types
|
|
613
|
+
- MIME type is automatically detected from file name extension
|
|
614
|
+
|
|
506
615
|
### Error Handling for Private API
|
|
507
616
|
|
|
508
617
|
Private API methods use the same error types as the public API:
|
|
@@ -834,13 +943,37 @@ For issues, questions, or contributions, please refer to the project repository
|
|
|
834
943
|
|
|
835
944
|
## Changelog
|
|
836
945
|
|
|
946
|
+
### 1.2.1
|
|
947
|
+
|
|
948
|
+
- **Fixed**: UUID generation for attachment uploads - replaced `crypto.randomUUID()` with custom implementation compatible with ScriptRunner Connect runtime
|
|
949
|
+
- **Improved**: UUID generation now uses `crypto.getRandomValues()` which is available in ScriptRunner Connect's web standards runtime
|
|
950
|
+
|
|
951
|
+
### 1.2.0
|
|
952
|
+
|
|
953
|
+
- **Added**: Private API group with support for unofficial Zephyr endpoints
|
|
954
|
+
- `getContextJwt()` - Retrieve Jira Context JWT token for private API authentication
|
|
955
|
+
- `createCustomField()` - Create custom fields for test cases, test plans, test runs, and test steps
|
|
956
|
+
- `createTestCaseVersion()` - Create new test case versions (accepts testCaseKey and looks up ID automatically)
|
|
957
|
+
- `createTestCaseComment()` - Create comments on test cases
|
|
958
|
+
- `getTestCaseAttachments()` - Get all attachment details for a test case with signed S3 URLs
|
|
959
|
+
- `downloadAttachment()` - Download attachment files into memory with automatic fresh URL retrieval
|
|
960
|
+
- `createAttachment()` - Upload file attachments to test cases (complete S3 upload flow)
|
|
961
|
+
- **Added**: Type definitions for private API requests and responses
|
|
962
|
+
- **Changed**: `createTestCaseVersion()` now uses interface structure and automatically looks up test case ID from key
|
|
963
|
+
- **Warning**: Private API methods are not officially supported and may change without notice
|
|
964
|
+
|
|
837
965
|
### 1.1.0
|
|
838
966
|
|
|
839
967
|
- **Added**: Private API group with support for unofficial Zephyr endpoints
|
|
840
968
|
- `getContextJwt()` - Retrieve Jira Context JWT token for private API authentication
|
|
841
969
|
- `createCustomField()` - Create custom fields for test cases, test plans, test runs, and test steps
|
|
842
|
-
- `createTestCaseVersion()` - Create new test case versions
|
|
843
|
-
-
|
|
970
|
+
- `createTestCaseVersion()` - Create new test case versions (accepts testCaseKey and looks up ID automatically)
|
|
971
|
+
- `createTestCaseComment()` - Create comments on test cases
|
|
972
|
+
- `getTestCaseAttachments()` - Get all attachment details for a test case with signed S3 URLs
|
|
973
|
+
- `downloadAttachment()` - Download attachment files into memory with automatic fresh URL retrieval
|
|
974
|
+
- `createAttachment()` - Upload file attachments to test cases (complete S3 upload flow)
|
|
975
|
+
- **Added**: Type definitions for private API requests and responses
|
|
976
|
+
- **Changed**: `createTestCaseVersion()` now uses interface structure and automatically looks up test case ID from key
|
|
844
977
|
- **Warning**: Private API methods are not officially supported and may change without notice
|
|
845
978
|
|
|
846
979
|
### 1.0.1
|
package/dist/README.md
CHANGED
|
@@ -344,7 +344,11 @@ The Managed API is organized into the following groups:
|
|
|
344
344
|
|
|
345
345
|
- `getContextJwt(userEmail, apiToken, jiraInstanceUrl)` - Get Jira Context JWT token (required for private API calls)
|
|
346
346
|
- `createCustomField(userEmail, apiToken, jiraInstanceUrl, category, request)` - Create custom fields for test cases, test plans, test runs, or test steps
|
|
347
|
-
- `createTestCaseVersion(userEmail, apiToken, jiraInstanceUrl,
|
|
347
|
+
- `createTestCaseVersion(userEmail, apiToken, jiraInstanceUrl, request)` - Create a new test case version
|
|
348
|
+
- `createTestCaseComment(userEmail, apiToken, jiraInstanceUrl, request)` - Create a comment on a test case
|
|
349
|
+
- `getTestCaseAttachments(userEmail, apiToken, jiraInstanceUrl, request)` - Get all attachments for a test case
|
|
350
|
+
- `downloadAttachment(userEmail, apiToken, jiraInstanceUrl, request)` - Download an attachment file into memory
|
|
351
|
+
- `createAttachment(userEmail, apiToken, jiraInstanceUrl, request)` - Upload an attachment to a test case
|
|
348
352
|
|
|
349
353
|
## Authentication
|
|
350
354
|
|
|
@@ -483,26 +487,131 @@ const selectField = await api.Private.createCustomField(
|
|
|
483
487
|
Create a new version of an existing test case. **Note:** When a new version is created, the `testCaseId` changes for that test case.
|
|
484
488
|
|
|
485
489
|
```typescript
|
|
486
|
-
//
|
|
487
|
-
const testCase = await api.TestCase.getTestCase({ testCaseKey: 'PROJ-T1' });
|
|
488
|
-
const testCaseId = testCase.id; // Numeric ID, not the key
|
|
489
|
-
|
|
490
|
-
// Create a new version
|
|
490
|
+
// Create a new version (test case ID is looked up automatically from key)
|
|
491
491
|
const newVersion = await api.Private.createTestCaseVersion(
|
|
492
492
|
'user@example.com',
|
|
493
493
|
'jira-api-token',
|
|
494
494
|
'https://your-instance.atlassian.net',
|
|
495
|
-
|
|
496
|
-
|
|
495
|
+
{
|
|
496
|
+
testCaseKey: 'PROJ-T1', // Uses key, looks up ID automatically
|
|
497
|
+
projectId: 10017 // Numeric project ID
|
|
498
|
+
}
|
|
497
499
|
);
|
|
500
|
+
// Returns: { id: 286693656, key: "ZEP-T18" }
|
|
498
501
|
```
|
|
499
502
|
|
|
500
503
|
**Important Notes:**
|
|
501
|
-
- The `
|
|
502
|
-
-
|
|
504
|
+
- The method accepts `testCaseKey` and automatically looks up the numeric ID
|
|
505
|
+
- The `projectId` must be numeric, not the project key
|
|
503
506
|
- If a new version already exists, the API will return a 409 Conflict error
|
|
504
507
|
- The test case ID changes after creating a new version
|
|
505
508
|
|
|
509
|
+
### Create Test Case Comment
|
|
510
|
+
|
|
511
|
+
Add a comment to an existing test case.
|
|
512
|
+
|
|
513
|
+
```typescript
|
|
514
|
+
const comment = await api.Private.createTestCaseComment(
|
|
515
|
+
'user@example.com',
|
|
516
|
+
'jira-api-token',
|
|
517
|
+
'https://your-instance.atlassian.net',
|
|
518
|
+
{
|
|
519
|
+
testCaseKey: 'PROJ-T1', // Uses key, looks up ID automatically
|
|
520
|
+
projectId: 10233, // Numeric project ID
|
|
521
|
+
body: 'This is a test comment', // Comment text
|
|
522
|
+
createdBy: '5d6fdc98dc6e480dbc021aae' // Atlassian account ID
|
|
523
|
+
}
|
|
524
|
+
);
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
### Get Test Case Attachments
|
|
528
|
+
|
|
529
|
+
Retrieve all attachment details for a test case, including signed S3 URLs for downloading.
|
|
530
|
+
|
|
531
|
+
```typescript
|
|
532
|
+
const attachments = await api.Private.getTestCaseAttachments(
|
|
533
|
+
'user@example.com',
|
|
534
|
+
'jira-api-token',
|
|
535
|
+
'https://your-instance.atlassian.net',
|
|
536
|
+
{
|
|
537
|
+
testCaseKey: 'PROJ-T1',
|
|
538
|
+
projectId: 10233
|
|
539
|
+
}
|
|
540
|
+
);
|
|
541
|
+
|
|
542
|
+
console.log(`Found ${attachments.attachments.length} attachments`);
|
|
543
|
+
attachments.attachments.forEach(att => {
|
|
544
|
+
console.log(`- ${att.name} (${att.fileSize} bytes, ${att.mimeType})`);
|
|
545
|
+
console.log(` ID: ${att.id}`);
|
|
546
|
+
console.log(` URL: ${att.url}`);
|
|
547
|
+
});
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
**Response Structure:**
|
|
551
|
+
Each attachment includes:
|
|
552
|
+
- `id` - Attachment UUID
|
|
553
|
+
- `name` - File name
|
|
554
|
+
- `mimeType` - MIME type (e.g., 'image/jpeg', 'application/pdf')
|
|
555
|
+
- `fileSize` - File size in bytes
|
|
556
|
+
- `url` - Signed S3 URL for downloading (expires after ~90 minutes)
|
|
557
|
+
- `createdOn` - Creation timestamp
|
|
558
|
+
- `userKey` - Atlassian account ID of the uploader
|
|
559
|
+
- `s3Key` - S3 storage key
|
|
560
|
+
|
|
561
|
+
### Download Attachment
|
|
562
|
+
|
|
563
|
+
Download an attachment file into memory. This method automatically gets a fresh signed URL and downloads the file.
|
|
564
|
+
|
|
565
|
+
```typescript
|
|
566
|
+
const fileBlob = await api.Private.downloadAttachment(
|
|
567
|
+
'user@example.com',
|
|
568
|
+
'jira-api-token',
|
|
569
|
+
'https://your-instance.atlassian.net',
|
|
570
|
+
{
|
|
571
|
+
testCaseKey: 'PROJ-T1',
|
|
572
|
+
projectId: 10233,
|
|
573
|
+
attachmentId: 'c3f14125-638f-47f9-9211-12a9777c09e7' // Attachment UUID
|
|
574
|
+
}
|
|
575
|
+
);
|
|
576
|
+
|
|
577
|
+
// Use the blob (e.g., save to Record Storage, upload elsewhere, etc.)
|
|
578
|
+
console.log(`Downloaded file: ${fileBlob.size} bytes, type: ${fileBlob.type}`);
|
|
579
|
+
|
|
580
|
+
// Example: Convert to ArrayBuffer if needed
|
|
581
|
+
const arrayBuffer = await fileBlob.arrayBuffer();
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
**Important Notes:**
|
|
585
|
+
- The method automatically gets a fresh signed URL to ensure it hasn't expired
|
|
586
|
+
- Returns a `Blob` object that can be used directly or converted to `ArrayBuffer`
|
|
587
|
+
- The signed URLs from `getTestCaseAttachments` expire after ~90 minutes, but `downloadAttachment` always gets a fresh URL
|
|
588
|
+
|
|
589
|
+
### Upload Attachment
|
|
590
|
+
|
|
591
|
+
Upload a file attachment to a test case.
|
|
592
|
+
|
|
593
|
+
```typescript
|
|
594
|
+
const file = new Blob(['file content'], { type: 'text/plain' });
|
|
595
|
+
|
|
596
|
+
const attachment = await api.Private.createAttachment(
|
|
597
|
+
'user@example.com',
|
|
598
|
+
'jira-api-token',
|
|
599
|
+
'https://your-instance.atlassian.net',
|
|
600
|
+
{
|
|
601
|
+
testCaseKey: 'PROJ-T1', // Uses key, looks up ID automatically
|
|
602
|
+
projectId: 10233, // Numeric project ID
|
|
603
|
+
file: file, // Blob or ArrayBuffer
|
|
604
|
+
fileName: 'test-file.txt',
|
|
605
|
+
userAccountId: '5d6fdc98dc6e480dbc021aae' // Atlassian account ID
|
|
606
|
+
}
|
|
607
|
+
);
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
**Important Notes:**
|
|
611
|
+
- The method handles the complete upload flow: getting S3 credentials, uploading to S3, and saving metadata
|
|
612
|
+
- Supports both `Blob` and `ArrayBuffer` file types
|
|
613
|
+
- MIME type is automatically detected from file name extension
|
|
614
|
+
|
|
506
615
|
### Error Handling for Private API
|
|
507
616
|
|
|
508
617
|
Private API methods use the same error types as the public API:
|
|
@@ -834,13 +943,37 @@ For issues, questions, or contributions, please refer to the project repository
|
|
|
834
943
|
|
|
835
944
|
## Changelog
|
|
836
945
|
|
|
946
|
+
### 1.2.1
|
|
947
|
+
|
|
948
|
+
- **Fixed**: UUID generation for attachment uploads - replaced `crypto.randomUUID()` with custom implementation compatible with ScriptRunner Connect runtime
|
|
949
|
+
- **Improved**: UUID generation now uses `crypto.getRandomValues()` which is available in ScriptRunner Connect's web standards runtime
|
|
950
|
+
|
|
951
|
+
### 1.2.0
|
|
952
|
+
|
|
953
|
+
- **Added**: Private API group with support for unofficial Zephyr endpoints
|
|
954
|
+
- `getContextJwt()` - Retrieve Jira Context JWT token for private API authentication
|
|
955
|
+
- `createCustomField()` - Create custom fields for test cases, test plans, test runs, and test steps
|
|
956
|
+
- `createTestCaseVersion()` - Create new test case versions (accepts testCaseKey and looks up ID automatically)
|
|
957
|
+
- `createTestCaseComment()` - Create comments on test cases
|
|
958
|
+
- `getTestCaseAttachments()` - Get all attachment details for a test case with signed S3 URLs
|
|
959
|
+
- `downloadAttachment()` - Download attachment files into memory with automatic fresh URL retrieval
|
|
960
|
+
- `createAttachment()` - Upload file attachments to test cases (complete S3 upload flow)
|
|
961
|
+
- **Added**: Type definitions for private API requests and responses
|
|
962
|
+
- **Changed**: `createTestCaseVersion()` now uses interface structure and automatically looks up test case ID from key
|
|
963
|
+
- **Warning**: Private API methods are not officially supported and may change without notice
|
|
964
|
+
|
|
837
965
|
### 1.1.0
|
|
838
966
|
|
|
839
967
|
- **Added**: Private API group with support for unofficial Zephyr endpoints
|
|
840
968
|
- `getContextJwt()` - Retrieve Jira Context JWT token for private API authentication
|
|
841
969
|
- `createCustomField()` - Create custom fields for test cases, test plans, test runs, and test steps
|
|
842
|
-
- `createTestCaseVersion()` - Create new test case versions
|
|
843
|
-
-
|
|
970
|
+
- `createTestCaseVersion()` - Create new test case versions (accepts testCaseKey and looks up ID automatically)
|
|
971
|
+
- `createTestCaseComment()` - Create comments on test cases
|
|
972
|
+
- `getTestCaseAttachments()` - Get all attachment details for a test case with signed S3 URLs
|
|
973
|
+
- `downloadAttachment()` - Download attachment files into memory with automatic fresh URL retrieval
|
|
974
|
+
- `createAttachment()` - Upload file attachments to test cases (complete S3 upload flow)
|
|
975
|
+
- **Added**: Type definitions for private API requests and responses
|
|
976
|
+
- **Changed**: `createTestCaseVersion()` now uses interface structure and automatically looks up test case ID from key
|
|
844
977
|
- **Warning**: Private API methods are not officially supported and may change without notice
|
|
845
978
|
|
|
846
979
|
### 1.0.1
|
package/dist/groups/Private.d.ts
CHANGED
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
*
|
|
15
15
|
* Use these functions at your own risk. They may break with future Zephyr updates.
|
|
16
16
|
*/
|
|
17
|
-
import type { CreatePrivateCustomFieldRequest, PrivateCustomFieldCategory } from '../types';
|
|
17
|
+
import type { CreatePrivateCustomFieldRequest, PrivateCustomFieldCategory, CreateTestCaseVersionRequest, CreateTestCaseVersionResponse, CreateAttachmentRequest, CreateTestCaseCommentRequest, CreateTestCaseCommentResponse, GetTestCaseAttachmentsRequest, GetTestCaseAttachmentsResponse, DownloadAttachmentRequest } from '../types';
|
|
18
|
+
import type { ZephyrApiConnection } from '../index';
|
|
18
19
|
/**
|
|
19
20
|
* Private API group for accessing Zephyr's private/unofficial endpoints
|
|
20
21
|
*
|
|
@@ -26,6 +27,12 @@ export declare class PrivateGroup {
|
|
|
26
27
|
* Base URL for Zephyr private API endpoints
|
|
27
28
|
*/
|
|
28
29
|
private readonly privateApiBaseUrl;
|
|
30
|
+
/**
|
|
31
|
+
* Optional API connection for accessing public API (e.g., to look up test case IDs from keys)
|
|
32
|
+
*/
|
|
33
|
+
private readonly apiConnection?;
|
|
34
|
+
private readonly testCaseGroup?;
|
|
35
|
+
constructor(apiConnection?: ZephyrApiConnection);
|
|
29
36
|
/**
|
|
30
37
|
* Get Jira Context JWT token
|
|
31
38
|
*
|
|
@@ -75,15 +82,181 @@ export declare class PrivateGroup {
|
|
|
75
82
|
* @param userEmail - Jira user email address
|
|
76
83
|
* @param apiToken - Jira API token
|
|
77
84
|
* @param jiraInstanceUrl - Full Jira instance URL (e.g., 'https://your-instance.atlassian.net')
|
|
78
|
-
* @param
|
|
79
|
-
* @param
|
|
80
|
-
* @
|
|
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
|
|
81
89
|
* @throws {BadRequestError} If the request is invalid
|
|
82
90
|
* @throws {UnauthorizedError} If authentication fails
|
|
83
91
|
* @throws {ForbiddenError} If the user doesn't have permission
|
|
84
92
|
* @throws {NotFoundError} If the test case is not found
|
|
85
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
|
|
95
|
+
*/
|
|
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
|
|
86
259
|
*/
|
|
87
|
-
|
|
260
|
+
createAttachment(userEmail: string, apiToken: string, jiraInstanceUrl: string, request: CreateAttachmentRequest): Promise<unknown>;
|
|
88
261
|
}
|
|
89
262
|
//# 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,
|
|
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"}
|