Skip to content

Commit 4a3bef0

Browse files
Release v4.0.4 (MrRefactoring#342)
* MrRefactoring#327: Package `form-data` replaced to `formdata-node` for add esm support (MrRefactoring#341) * MrRefactoring#327: Package `form-data` replaced to `formdata-node` for add esm support * MrRefactoring#327: Add `Buffer` type support using `formdata-node` package - Implemented `Buffer` to `File` conversion for attachment uploads. - Added `attachment.mimeType` an optional property. - Added automatic MIME type detection based on file extensions. * MrRefactoring#327: Fixed the issue with the absence of the `File` class in Node.js v18.x.x by using `File` from `formdata-node`. - Enhanced documentation with TSDoc and examples for better clarity. * MrRefactoring#320: Fix tree shaking mechanism and remove circular dependencies (MrRefactoring#343) - Improved the tree shaking process to ensure unused code is properly eliminated across the entire library. - Refactored the codebase to resolve circular dependencies, improving tree shaking and maintainability.
1 parent df8e9d2 commit 4a3bef0

18 files changed

+695
-277
lines changed

CHANGELOG.md

+42
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,47 @@
11
# Jira.js changelog
22

3+
### 4.0.4
4+
5+
- **#320:** Resolved a tree-shaking issue where importing a single client would still include all clients in the output bundle when using bundlers. Now, only the required client code is included. Thanks to [Nao Yonashiro](https://github.com/orisano) for [reporting the issue](https://github.com/MrRefactoring/jira.js/issues/320) and proposing a fix.
6+
- **#327:** Replaced the `form-data` library with `formdata-node` to enable compatibility with `ESM` projects when adding attachments via the `issueAttachment.addAttachment` method. Thanks to [Paweł Król](https://github.com/xpawk) for [reporting the issue](https://github.com/MrRefactoring/jira.js/issues/327) and [Matyáš Kroupa](https://github.com/krouma) for implementing the fix.
7+
- **Improvement:** The type of the `projectIdOrKey` property was updated from `string` to `number | string` for project update operations. This enhancement improves type safety and flexibility when handling project identifiers.
8+
- **Enhancement:** Added a `mimeType` property to the `version2.issueAttachments.addAttachment`, `version3.issueAttachments.addAttachment`, and `serviceDesk.serviceDesk.attachTemporaryFile` methods. This allows specifying the file type. If `mimeType` is not provided, a default type is inferred from the filename.
9+
10+
#### Examples:
11+
12+
**👎 Before:**
13+
14+
```typescript
15+
const client = new Version2Client() || new Version3Client() || new ServiceDeskClient();
16+
17+
const attachment = await client.issueAttachments.addAttachment({
18+
issueIdOrKey: issue.key,
19+
attachment: {
20+
filename: 'issueAttachments.test.ts',
21+
file: fs.readFileSync('./tests/integration/version2/issueAttachments.test.ts'),
22+
},
23+
});
24+
25+
console.log(attachment[0].mimeType); // Will be 'video/mp2t'
26+
```
27+
28+
**👍 Now:**
29+
30+
```typescript
31+
const client = new Version2Client() || new Version3Client() || new ServiceDeskClient();
32+
33+
const attachment = await client.issueAttachments.addAttachment({
34+
issueIdOrKey: issue.key,
35+
attachment: {
36+
filename: 'issueAttachments.test.ts',
37+
file: fs.readFileSync('./tests/integration/version2/issueAttachments.test.ts'),
38+
mimeType: 'application/typescript',
39+
},
40+
});
41+
42+
console.log(attachment[0].mimeType); // Will be 'application/typescript'
43+
```
44+
345
### 4.0.3
446

547
- **Bug Fix:** Fixed an issue with the `Users.createUser` method by adding the required `products` property. Thanks to [Appelberg-s](https://github.com/Appelberg-s) for the [fix](https://github.com/MrRefactoring/jira.js/commit/362918093c20036049db334743e2a0f5f41cbcd4#diff-6960050bc2a3d9ffad9eb5e307145969dc4a38eb5434eebf39da545fd18e01b7R12).

0 commit comments

Comments
 (0)