Skip to content

Release v4.0.4

Compare
Choose a tag to compare
@github-actions github-actions released this 04 Jan 22:55
· 2 commits to master since this release
4a3bef0
  • #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.

  • #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'