Skip to content

Commit

Permalink
v4.0.5 (#345)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrRefactoring authored Jan 6, 2025
1 parent 4a3bef0 commit c41d3b9
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 109 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Jira.js changelog

### 4.0.5

- **#344:** Replaced the `mime-types` library with `mime` to ensure browser compatibility, as `mime-types` relies on the `path` module from Node.js. Thanks to [kang](https://github.com/kang8) for [reporting the issue](https://github.com/MrRefactoring/jira.js/issues/344) and proposing the fix.

### 4.0.4

- **#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.
Expand Down
203 changes: 105 additions & 98 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jira.js",
"version": "4.0.4",
"version": "4.0.5",
"description": "A comprehensive JavaScript/TypeScript library designed for both Node.JS and browsers, facilitating seamless interaction with the Atlassian Jira API.",
"main": "out/index.js",
"types": "out/index.d.ts",
Expand Down Expand Up @@ -53,8 +53,7 @@
"code:formatting": "npm run replace:all && npm run prettier && npm run lint:fix"
},
"devDependencies": {
"@types/mime-types": "^2.1.4",
"@types/node": "^18.19.69",
"@types/node": "^18.19.70",
"@types/sinon": "^17.0.3",
"@typescript-eslint/eslint-plugin": "^8.19.0",
"@typescript-eslint/parser": "^8.19.0",
Expand All @@ -74,7 +73,7 @@
"dependencies": {
"axios": "^1.7.9",
"formdata-node": "^6.0.3",
"mime-types": "^2.1.35",
"mime": "^4.0.6",
"tslib": "^2.8.1"
}
}
5 changes: 3 additions & 2 deletions src/serviceDesk/serviceDesk.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { FormData, File } from 'formdata-node';
import * as mime from 'mime-types';
import * as Models from './models';
import * as Parameters from './parameters';
import { Callback } from '../callback';
Expand Down Expand Up @@ -117,8 +116,10 @@ export class ServiceDesk {
const formData = new FormData();
const attachments = Array.isArray(parameters.attachment) ? parameters.attachment : [parameters.attachment];

const { default: mime } = await import('mime');

attachments.forEach(attachment => {
const mimeType = attachment.mimeType ?? (mime.lookup(attachment.filename) || undefined);
const mimeType = attachment.mimeType ?? (mime.getType(attachment.filename) || undefined);
const file = Buffer.isBuffer(attachment.file)
? new File([attachment.file], attachment.filename, { type: mimeType })
: attachment.file;
Expand Down
5 changes: 3 additions & 2 deletions src/version2/issueAttachments.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { FormData, File } from 'formdata-node';
import * as mime from 'mime-types';
import * as Models from './models';
import * as Parameters from './parameters';
import { Callback } from '../callback';
Expand Down Expand Up @@ -426,8 +425,10 @@ export class IssueAttachments {
const formData = new FormData();
const attachments = Array.isArray(parameters.attachment) ? parameters.attachment : [parameters.attachment];

const { default: mime } = await import('mime');

attachments.forEach(attachment => {
const mimeType = attachment.mimeType ?? (mime.lookup(attachment.filename) || undefined);
const mimeType = attachment.mimeType ?? (mime.getType(attachment.filename) || undefined);
const file = Buffer.isBuffer(attachment.file)
? new File([attachment.file], attachment.filename, { type: mimeType })
: attachment.file;
Expand Down
5 changes: 3 additions & 2 deletions src/version3/issueAttachments.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { FormData, File } from 'formdata-node';
import * as mime from 'mime-types';
import * as Models from './models';
import * as Parameters from './parameters';
import { Callback } from '../callback';
Expand Down Expand Up @@ -426,8 +425,10 @@ export class IssueAttachments {
const formData = new FormData();
const attachments = Array.isArray(parameters.attachment) ? parameters.attachment : [parameters.attachment];

const { default: mime } = await import('mime');

attachments.forEach(attachment => {
const mimeType = attachment.mimeType ?? (mime.lookup(attachment.filename) || undefined);
const mimeType = attachment.mimeType ?? (mime.getType(attachment.filename) || undefined);
const file = Buffer.isBuffer(attachment.file)
? new File([attachment.file], attachment.filename, { type: mimeType })
: attachment.file;
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"compilerOptions": {
"target": "ES6",
"outDir": "out",
"module": "CommonJS",
"module": "NodeNext",
"skipLibCheck": true,
"lib": [
"ES2018",
"DOM"
Expand Down

0 comments on commit c41d3b9

Please sign in to comment.