Skip to content

Commit 7d8bffb

Browse files
* [MrRefactoring#271]: Update `getAvatarImageByID` to include `contentType` in return type (MrRefactoring#281) * [MrRefactoring#271]: initial template added * [MrRefactoring#271]: lint fix * [MrRefactoring#271]: fixes added * [MrRefactoring#271]: getAvatarImageByID updated for version2 * [MrRefactoring#271]: test project name updated * NodeJS 10 version life was ended * JWT and OAuth auths removed (MrRefactoring#284) * JWT and OAuth auths removed * XOR3 added * unit tests fixed * build fixed * Deprecation stuff removed (MrRefactoring#283) * agile deprecation stuff removed * version2 deprecation stuff removed * test fixes * version3 deprecated properties removed * no-namespaces rule applied * integration tests fixes * old stuff removed * newErrorHandling removed * avatar api updates (MrRefactoring#286) * parameters types improvements * parameters types improvements * build fix * parameters types improvements * CHANGELOG.md updated
1 parent 6b764e1 commit 7d8bffb

File tree

747 files changed

+1728
-8339
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

747 files changed

+1728
-8339
lines changed

.github/workflows/ci.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: self-hosted
88
strategy:
99
matrix:
10-
node-version: [16.x, 18.x]
10+
node-version: [18.x, 20.x]
1111
steps:
1212
- name: Checkout sources
1313
uses: actions/checkout@v4
@@ -26,7 +26,7 @@ jobs:
2626
runs-on: self-hosted
2727
strategy:
2828
matrix:
29-
node-version: [16.x, 18.x]
29+
node-version: [18.x, 20.x]
3030
steps:
3131
- name: Linting
3232
run: npm run lint
@@ -39,7 +39,7 @@ jobs:
3939
runs-on: self-hosted
4040
strategy:
4141
matrix:
42-
node-version: [16.x, 18.x]
42+
node-version: [18.x, 20.x]
4343
steps:
4444
- name: Running unit tests
4545
run: npm run test:unit
@@ -53,7 +53,7 @@ jobs:
5353
strategy:
5454
max-parallel: 1
5555
matrix:
56-
node-version: [16.x, 18.x]
56+
node-version: [18.x, 20.x]
5757
steps:
5858
- name: Creating `.env` file
5959
run: |

.github/workflows/publish.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
steps:
99
- name: Checkout sources
1010
uses: actions/checkout@v4
11-
- name: Use Node.js 16.x.x
11+
- name: Use Node.js 18.x.x
1212
uses: actions/setup-node@v3
1313
with:
1414
node-version: 18
@@ -52,11 +52,8 @@ jobs:
5252
run: npm run test:integration
5353

5454
publish:
55-
name: Publish
55+
name: Package publish
5656
needs:
57-
- build
58-
- lint
59-
- test_unit
6057
- test_integration
6158
runs-on: self-hosted
6259
steps:
@@ -67,6 +64,8 @@ jobs:
6764

6865
publish-docs:
6966
name: Docs publish
67+
needs:
68+
- test_integration
7069
runs-on: self-hosted
7170
steps:
7271
- name: Checkout code
@@ -85,6 +84,10 @@ jobs:
8584
- name: Generate docs
8685
run: npm run doc
8786

87+
- name: Extract version
88+
id: pkg
89+
run: echo "::set-output name=version::$(node -p "require('./package.json').version")"
90+
8891
- name: Checkout docs branch
8992
uses: actions/checkout@v4
9093
with:
@@ -100,5 +103,5 @@ jobs:
100103
git config user.name "GitHub Actions"
101104
git config user.email "actions@github.com"
102105
git add .
103-
git commit -m "Update documentation"
106+
git commit -m "Update documentation for version v${{ steps.pkg.outputs.version }}"
104107
git push

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# Jira.js changelog
22

3+
### 3.0.0
4+
5+
#### **Breaking Changes:**
6+
- **Avatar Endpoints Updates:**
7+
- Methods `avatar.getAvatarImageByID`, `getAvatarImageByType`, and `getAvatarImageByOwner` have an updated return type. Avatars will now be returned as binary data.
8+
- `storeAvatar` endpoint has been fixed. It now both accepts and sends the `avatar` property.
9+
10+
- **Authentication Changes:**
11+
- Removed OAuth and JWT authentication. This might be reintroduced with proper testing support in the future.
12+
13+
- **API Clean-Up:**
14+
- Deprecated and unused components from Agile, ServiceDesk, Version2, and Version3 APIs have been removed.
15+
16+
#### **Enhancements:**
17+
- Improved browser capability.
18+
- Enhanced parameter typings.
19+
320
### 2.20.1
421

522
- [#277](https://github.com/MrRefactoring/jira.js/issues/277) newErrorHandling provides additional error codes.

README.md

Lines changed: 1 addition & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,10 @@ Usability, consistency, and performance are key focuses of jira.js, and it also
1919

2020
- [Installation](#installation)
2121
- [Documentation](#documentation)
22-
- [Deprecation warnings](#deprecation-warnings)
2322
- [Usage](#usage)
2423
- [Authentication](#authentication)
2524
- [Basic](#basic-authentication)
26-
- [OAuth](#oauth)
2725
- [OAuth 2.0](#oauth-20)
28-
- [JWT](#jwt)
2926
- [Personal access token](#personal-access-token)
3027
- [Example and using algorithm](#example-and-using-algorithm)
3128
- [Decreasing Webpack bundle size](#decreasing-webpack-bundle-size)
@@ -34,7 +31,7 @@ Usability, consistency, and performance are key focuses of jira.js, and it also
3431

3532
## Installation
3633

37-
**Node.js 10.0.0 or newer is required.**
34+
**Node.js 18.0.0 or newer is required.**
3835

3936
Install with the npm:
4037

@@ -52,56 +49,6 @@ yarn add jira.js
5249

5350
You can find the documentation [here](https://mrrefactoring.github.io/jira.js/).
5451

55-
## Deprecation warnings
56-
57-
1. Deprecation warning: New error handling mechanism added. Please use `newErrorHandling: true` in config
58-
> We are using a new error handling mechanism (instead throwing raw axios error will be showed API response). For enable it, make following changes in your config:
59-
> ```ts
60-
> const client = new Version3Client({
61-
> host: '...',
62-
> newErrorHandling: true, // This flag enable new error handling.
63-
> });
64-
>
65-
> // Examples
66-
>
67-
> /** Old error handling **/
68-
>
69-
> const client = new Version3Client({ host: '...' });
70-
>
71-
> client.issues.createIssue();
72-
>
73-
> // Output:
74-
> // {
75-
> // code: 'ERR_BAD_REQUEST',
76-
> // config: { a lot of stuff here },
77-
> // request: { a lot of stuff here },
78-
> // response: {
79-
> // a lot of stuff here
80-
> // data: {
81-
> // errorMessages: [],
82-
> // errors: { project: 'Specify a valid project ID or key' }
83-
> // },
84-
> // a lot of stuff here
85-
> // },
86-
> // a lot of stuff here
87-
> // }
88-
>
89-
> /** New error handling **/
90-
>
91-
> const client = new Version3Client({ host: '...', newErrorHandling: true });
92-
>
93-
> client.issues.createIssue();
94-
>
95-
> // Output:
96-
> // {
97-
> // code: 'ERR_BAD_REQUEST',
98-
> // status: 400,
99-
> // errorMessages: [],
100-
> // errors: { project: 'Specify a valid project ID or key' }
101-
> // }
102-
> ```
103-
104-
10552
## Usage
10653

10754
#### Authentication
@@ -144,24 +91,6 @@ const client = new Version3Client({
14491
});
14592
```
14693

147-
##### [OAuth](https://developer.atlassian.com/cloud/jira/platform/jira-rest-api-oauth-authentication/)
148-
149-
```typescript
150-
import { Version3Client } from 'jira.js';
151-
152-
const client = new Version3Client({
153-
host: 'https://your-domain.atlassian.net',
154-
authentication: {
155-
oauth: {
156-
consumerKey: 'your consumer key',
157-
consumerSecret: '-----BEGIN RSA PRIVATE KEY-----\n" + "some private key\n" + "-----END RSA PRIVATE KEY-----',
158-
accessToken: 'your access token',
159-
tokenSecret: 'your token secret',
160-
},
161-
},
162-
});
163-
```
164-
16594
##### [OAuth 2.0](https://developer.atlassian.com/cloud/jira/platform/oauth-2-3lo-apps/)
16695

16796
Only the authorization token is currently supported. To release it, you need to read the [documentation](https://developer.atlassian.com/cloud/jira/platform/oauth-2-3lo-apps/) and write your own code to get the token.
@@ -181,23 +110,6 @@ const client = new Version3Client({
181110
});
182111
```
183112

184-
##### [JWT](https://developer.atlassian.com/cloud/jira/platform/understanding-jwt-for-connect-apps/)
185-
186-
```typescript
187-
import { Version3Client } from 'jira.js';
188-
189-
const client = new Version3Client({
190-
host: 'https://your-domain.atlassian.net',
191-
authentication: {
192-
jwt: {
193-
issuer: 'ISSUER',
194-
secret: 'shhhh',
195-
expiryTimeSeconds: 180,
196-
},
197-
},
198-
});
199-
```
200-
201113
##### [Personal access token](https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html)
202114

203115
```typescript
@@ -231,7 +143,6 @@ const client = new Version3Client({
231143
apiToken,
232144
},
233145
},
234-
newErrorHandling: true,
235146
});
236147

237148
async function main() {
@@ -310,9 +221,7 @@ Available groups:
310221
- [filterSharing](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-filter-sharing/#api-group-filter-sharing)
311222
- [groupAndUserPicker](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-group-and-user-picker/#api-group-group-and-user-picker)
312223
- [groups](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-groups/#api-group-groups)
313-
- [instanceInformation](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-instance-information/#api-group-instance-information)
314224
- [issues](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issues/#api-group-issues)
315-
- [issueAdjustmentsApps](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-adjustments--apps-/#api-group-issue-adjustments--apps-)
316225
- [issueAttachments](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-attachments/#api-group-issue-attachments)
317226
- [issueComments](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-comments/#api-group-issue-comments)
318227
- [issueCustomFieldConfigurationApps](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-custom-field-configuration--apps-/#api-group-issue-custom-field-configuration--apps-)
@@ -403,7 +312,6 @@ Available groups:
403312
- [groups](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-groups/#api-group-groups)
404313
- [instanceInformation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-instance-information/#api-group-instance-information)
405314
- [issues](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-group-issues)
406-
- [issueAdjustmentsApps](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-adjustments--apps-/#api-group-issue-adjustments--apps-)
407315
- [issueAttachments](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-attachments/#api-group-issue-attachments)
408316
- [issueComments](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-group-issue-comments)
409317
- [issueCustomFieldConfigurationApps](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-custom-field-configuration--apps-/#api-group-issue-custom-field-configuration--apps-)

examples/package-lock.json

Lines changed: 17 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
"license": "MIT",
1414
"devDependencies": {
15-
"@types/node": "^20.8.2",
15+
"@types/node": "^20.8.6",
1616
"ts-node": "^10.9.1",
1717
"typescript": "^5.2.2"
1818
},

examples/src/addFixVersion.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1-
import {Version3Client} from "jira.js";
2-
import { apiToken, email, host } from "./credentials";
3-
import {createIssue} from "./utils";
1+
import { createIssue } from './utils';
2+
import { Version3Client } from 'jira.js';
3+
import { apiToken, email, host } from './credentials';
44

55
async function addFixVersion() {
66
const client = new Version3Client({
77
host,
88
authentication: {
99
basic: { email, apiToken },
1010
},
11-
newErrorHandling: true,
1211
});
1312

1413
const { id: issueIdOrKey } = await createIssue(client);
1514

1615
const fix = await client.issueProperties.setIssueProperty({
1716
issueIdOrKey,
18-
propertyKey: "fixVersion",
17+
propertyKey: 'fixVersion',
1918
// @ts-ignore
20-
propertyValue: "N/a",
19+
propertyValue: 'N/a',
2120
});
2221

2322
console.log(fix);

examples/src/addWorklog.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
import { createIssue } from "./utils";
2-
import { Version3Client } from "jira.js";
3-
import { apiToken, email, host } from "./credentials";
1+
import { createIssue } from './utils';
2+
import { Version3Client } from 'jira.js';
3+
import { apiToken, email, host } from './credentials';
44

55
async function addWorklog() {
66
const client = new Version3Client({
77
host,
88
authentication: {
99
basic: { email, apiToken },
1010
},
11-
newErrorHandling: true,
1211
});
1312

1413
// Used to reduce the amount of code that is not directly related to creating a worklog
@@ -21,7 +20,7 @@ async function addWorklog() {
2120
timeSpentSeconds: 60, // Required one of `timeSpentSeconds` or `timeSpent`
2221
});
2322

24-
console.log(`Worklog successfully added for Issue Id: ${worklog.issueId}`)
23+
console.log(`Worklog successfully added for Issue Id: ${worklog.issueId}`);
2524
}
2625

2726
addWorklog().catch(e => {

0 commit comments

Comments
 (0)