Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v4.0.4 #342

Merged
merged 4 commits into from
Jan 4, 2025
Merged

Release v4.0.4 #342

merged 4 commits into from
Jan 4, 2025

Conversation

MrRefactoring
Copy link
Owner

@MrRefactoring MrRefactoring commented Jan 3, 2025

  • Enable Importing Specific Clients Without Pulling in Dependencies for All Clients #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 for reporting the issue and proposing a fix.

  • TypeError: form_data_1.default is not a constructor when adding attachment  #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 for reporting the issue and Matyáš Kroupa for implementing the fix.

  • 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.

  • 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.

    Examples:

    👎 Before:

    const client = new Version2Client() || new Version3Client() || new ServiceDeskClient();
    
    const attachment = await client.issueAttachments.addAttachment({
        issueIdOrKey: issue.key,
        attachment: {
            filename: 'issueAttachments.test.ts',
            file: fs.readFileSync('./tests/integration/version2/issueAttachments.test.ts'),
        },
    });
    
    console.log(attachment[0].mimeType); // Will be 'video/mp2t'

    👍 Now:

    const client = new Version2Client() || new Version3Client() || new ServiceDeskClient();
    
    const attachment = await client.issueAttachments.addAttachment({
        issueIdOrKey: issue.key,
        attachment: {
            filename: 'issueAttachments.test.ts',
            file: fs.readFileSync('./tests/integration/version2/issueAttachments.test.ts'),
            mimeType: 'application/typescript',
        },
    });
    
    console.log(attachment[0].mimeType); // Will be 'application/typescript'

…port (#341)

* #327: Package `form-data` replaced to `formdata-node` for add esm support

* #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.

* #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 MrRefactoring added this to the v4.0.4 milestone Jan 3, 2025
- 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.
@MrRefactoring MrRefactoring marked this pull request as ready for review January 4, 2025 01:05
krouma and others added 2 commits January 4, 2025 23:06
The newer library better supports modules and is written in TypeScript.
The FormData interface is a drop-in replacement except for getHeaders(),
but that didn't do anything useful, so it can be dropped.

Closes #327

Signed-off-by: Matyáš Kroupa <[email protected]>
Co-authored-by: Matyáš Kroupa <[email protected]>
Co-authored-by: Vladislav Tupikin <[email protected]>
@MrRefactoring MrRefactoring merged commit 4a3bef0 into master Jan 4, 2025
8 checks passed
@MrRefactoring MrRefactoring deleted the release/v4.0.4 branch January 4, 2025 22:11
@MrRefactoring MrRefactoring restored the release/v4.0.4 branch January 4, 2025 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants