Skip to content

Commit

Permalink
V3.0.0 (#285)
Browse files Browse the repository at this point in the history
* [#271]: Update `getAvatarImageByID` to include `contentType` in return type (#281)

* [#271]: initial template added

* [#271]: lint fix

* [#271]: fixes added

* [#271]: getAvatarImageByID updated for version2

* [#271]: test project name updated

* NodeJS 10 version life was ended

* JWT and OAuth auths removed (#284)

* JWT and OAuth auths removed

* XOR3 added

* unit tests fixed

* build fixed

* Deprecation stuff removed (#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 (#286)

* parameters types improvements

* parameters types improvements

* build fix

* parameters types improvements

* CHANGELOG.md updated
  • Loading branch information
MrRefactoring committed Oct 15, 2023
1 parent 6b764e1 commit 7d8bffb
Show file tree
Hide file tree
Showing 747 changed files with 1,728 additions and 8,339 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: self-hosted
strategy:
matrix:
node-version: [16.x, 18.x]
node-version: [18.x, 20.x]
steps:
- name: Checkout sources
uses: actions/checkout@v4
Expand All @@ -26,7 +26,7 @@ jobs:
runs-on: self-hosted
strategy:
matrix:
node-version: [16.x, 18.x]
node-version: [18.x, 20.x]
steps:
- name: Linting
run: npm run lint
Expand All @@ -39,7 +39,7 @@ jobs:
runs-on: self-hosted
strategy:
matrix:
node-version: [16.x, 18.x]
node-version: [18.x, 20.x]
steps:
- name: Running unit tests
run: npm run test:unit
Expand All @@ -53,7 +53,7 @@ jobs:
strategy:
max-parallel: 1
matrix:
node-version: [16.x, 18.x]
node-version: [18.x, 20.x]
steps:
- name: Creating `.env` file
run: |
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Use Node.js 16.x.x
- name: Use Node.js 18.x.x
uses: actions/setup-node@v3
with:
node-version: 18
Expand Down Expand Up @@ -52,11 +52,8 @@ jobs:
run: npm run test:integration

publish:
name: Publish
name: Package publish
needs:
- build
- lint
- test_unit
- test_integration
runs-on: self-hosted
steps:
Expand All @@ -67,6 +64,8 @@ jobs:

publish-docs:
name: Docs publish
needs:
- test_integration
runs-on: self-hosted
steps:
- name: Checkout code
Expand All @@ -85,6 +84,10 @@ jobs:
- name: Generate docs
run: npm run doc

- name: Extract version
id: pkg
run: echo "::set-output name=version::$(node -p "require('./package.json').version")"

- name: Checkout docs branch
uses: actions/checkout@v4
with:
Expand All @@ -100,5 +103,5 @@ jobs:
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git add .
git commit -m "Update documentation"
git commit -m "Update documentation for version v${{ steps.pkg.outputs.version }}"
git push
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Jira.js changelog

### 3.0.0

#### **Breaking Changes:**
- **Avatar Endpoints Updates:**
- Methods `avatar.getAvatarImageByID`, `getAvatarImageByType`, and `getAvatarImageByOwner` have an updated return type. Avatars will now be returned as binary data.
- `storeAvatar` endpoint has been fixed. It now both accepts and sends the `avatar` property.

- **Authentication Changes:**
- Removed OAuth and JWT authentication. This might be reintroduced with proper testing support in the future.

- **API Clean-Up:**
- Deprecated and unused components from Agile, ServiceDesk, Version2, and Version3 APIs have been removed.

#### **Enhancements:**
- Improved browser capability.
- Enhanced parameter typings.

### 2.20.1

- [#277](https://github.com/MrRefactoring/jira.js/issues/277) newErrorHandling provides additional error codes.
Expand Down
94 changes: 1 addition & 93 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@ Usability, consistency, and performance are key focuses of jira.js, and it also

- [Installation](#installation)
- [Documentation](#documentation)
- [Deprecation warnings](#deprecation-warnings)
- [Usage](#usage)
- [Authentication](#authentication)
- [Basic](#basic-authentication)
- [OAuth](#oauth)
- [OAuth 2.0](#oauth-20)
- [JWT](#jwt)
- [Personal access token](#personal-access-token)
- [Example and using algorithm](#example-and-using-algorithm)
- [Decreasing Webpack bundle size](#decreasing-webpack-bundle-size)
Expand All @@ -34,7 +31,7 @@ Usability, consistency, and performance are key focuses of jira.js, and it also

## Installation

**Node.js 10.0.0 or newer is required.**
**Node.js 18.0.0 or newer is required.**

Install with the npm:

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

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

## Deprecation warnings

1. Deprecation warning: New error handling mechanism added. Please use `newErrorHandling: true` in config
> 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:
> ```ts
> const client = new Version3Client({
> host: '...',
> newErrorHandling: true, // This flag enable new error handling.
> });
>
> // Examples
>
> /** Old error handling **/
>
> const client = new Version3Client({ host: '...' });
>
> client.issues.createIssue();
>
> // Output:
> // {
> // code: 'ERR_BAD_REQUEST',
> // config: { a lot of stuff here },
> // request: { a lot of stuff here },
> // response: {
> // a lot of stuff here
> // data: {
> // errorMessages: [],
> // errors: { project: 'Specify a valid project ID or key' }
> // },
> // a lot of stuff here
> // },
> // a lot of stuff here
> // }
>
> /** New error handling **/
>
> const client = new Version3Client({ host: '...', newErrorHandling: true });
>
> client.issues.createIssue();
>
> // Output:
> // {
> // code: 'ERR_BAD_REQUEST',
> // status: 400,
> // errorMessages: [],
> // errors: { project: 'Specify a valid project ID or key' }
> // }
> ```
## Usage

#### Authentication
Expand Down Expand Up @@ -144,24 +91,6 @@ const client = new Version3Client({
});
```

##### [OAuth](https://developer.atlassian.com/cloud/jira/platform/jira-rest-api-oauth-authentication/)

```typescript
import { Version3Client } from 'jira.js';

const client = new Version3Client({
host: 'https://your-domain.atlassian.net',
authentication: {
oauth: {
consumerKey: 'your consumer key',
consumerSecret: '-----BEGIN RSA PRIVATE KEY-----\n" + "some private key\n" + "-----END RSA PRIVATE KEY-----',
accessToken: 'your access token',
tokenSecret: 'your token secret',
},
},
});
```

##### [OAuth 2.0](https://developer.atlassian.com/cloud/jira/platform/oauth-2-3lo-apps/)

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.
Expand All @@ -181,23 +110,6 @@ const client = new Version3Client({
});
```

##### [JWT](https://developer.atlassian.com/cloud/jira/platform/understanding-jwt-for-connect-apps/)

```typescript
import { Version3Client } from 'jira.js';

const client = new Version3Client({
host: 'https://your-domain.atlassian.net',
authentication: {
jwt: {
issuer: 'ISSUER',
secret: 'shhhh',
expiryTimeSeconds: 180,
},
},
});
```

##### [Personal access token](https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html)

```typescript
Expand Down Expand Up @@ -231,7 +143,6 @@ const client = new Version3Client({
apiToken,
},
},
newErrorHandling: true,
});

async function main() {
Expand Down Expand Up @@ -310,9 +221,7 @@ Available groups:
- [filterSharing](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-filter-sharing/#api-group-filter-sharing)
- [groupAndUserPicker](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-group-and-user-picker/#api-group-group-and-user-picker)
- [groups](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-groups/#api-group-groups)
- [instanceInformation](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-instance-information/#api-group-instance-information)
- [issues](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issues/#api-group-issues)
- [issueAdjustmentsApps](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-adjustments--apps-/#api-group-issue-adjustments--apps-)
- [issueAttachments](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-attachments/#api-group-issue-attachments)
- [issueComments](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-comments/#api-group-issue-comments)
- [issueCustomFieldConfigurationApps](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-custom-field-configuration--apps-/#api-group-issue-custom-field-configuration--apps-)
Expand Down Expand Up @@ -403,7 +312,6 @@ Available groups:
- [groups](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-groups/#api-group-groups)
- [instanceInformation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-instance-information/#api-group-instance-information)
- [issues](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-group-issues)
- [issueAdjustmentsApps](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-adjustments--apps-/#api-group-issue-adjustments--apps-)
- [issueAttachments](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-attachments/#api-group-issue-attachments)
- [issueComments](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-group-issue-comments)
- [issueCustomFieldConfigurationApps](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-custom-field-configuration--apps-/#api-group-issue-custom-field-configuration--apps-)
Expand Down
25 changes: 17 additions & 8 deletions examples/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"license": "MIT",
"devDependencies": {
"@types/node": "^20.8.2",
"@types/node": "^20.8.6",
"ts-node": "^10.9.1",
"typescript": "^5.2.2"
},
Expand Down
11 changes: 5 additions & 6 deletions examples/src/addFixVersion.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
import {Version3Client} from "jira.js";
import { apiToken, email, host } from "./credentials";
import {createIssue} from "./utils";
import { createIssue } from './utils';
import { Version3Client } from 'jira.js';
import { apiToken, email, host } from './credentials';

async function addFixVersion() {
const client = new Version3Client({
host,
authentication: {
basic: { email, apiToken },
},
newErrorHandling: true,
});

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

const fix = await client.issueProperties.setIssueProperty({
issueIdOrKey,
propertyKey: "fixVersion",
propertyKey: 'fixVersion',
// @ts-ignore
propertyValue: "N/a",
propertyValue: 'N/a',
});

console.log(fix);
Expand Down
9 changes: 4 additions & 5 deletions examples/src/addWorklog.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { createIssue } from "./utils";
import { Version3Client } from "jira.js";
import { apiToken, email, host } from "./credentials";
import { createIssue } from './utils';
import { Version3Client } from 'jira.js';
import { apiToken, email, host } from './credentials';

async function addWorklog() {
const client = new Version3Client({
host,
authentication: {
basic: { email, apiToken },
},
newErrorHandling: true,
});

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

console.log(`Worklog successfully added for Issue Id: ${worklog.issueId}`)
console.log(`Worklog successfully added for Issue Id: ${worklog.issueId}`);
}

addWorklog().catch(e => {
Expand Down
Loading

0 comments on commit 7d8bffb

Please sign in to comment.