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: v5.0.0 #340

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
11 changes: 6 additions & 5 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
parser: "@typescript-eslint/parser"
parser: '@typescript-eslint/parser'
extends:
- airbnb-base
- prettier
parserOptions:
ecmaVersion: 2018
project: ./tsconfig.lint.json
Expand All @@ -10,7 +11,7 @@ env:
node: true
browser: true
rules:
"@typescript-eslint/lines-between-class-members": off
'@typescript-eslint/lines-between-class-members': off
arrow-parens:
- error
- as-needed
Expand All @@ -37,7 +38,7 @@ rules:
padding-line-between-statements:
- error
- blankLine: always
prev: "*"
prev: '*'
next:
- block
- block-like
Expand All @@ -59,7 +60,7 @@ rules:
- import
- let
- var
next: "*"
next: '*'
- blankLine: any
prev:
- const
Expand All @@ -86,5 +87,5 @@ rules:
- export
settings:
import/parsers:
"@typescript-eslint/parser":
'@typescript-eslint/parser':
- .ts
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
.idea/
.vscode/
node_modules/
out/
dist/
docs/
coverage/

pnpm-lock.yaml
yarn.lock
yarn-error.log
.DS_Store
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Jira.js changelog

### 5.0.0

todo
- createClient function was removed

### 4.0.3

- **Bug Fix:** Fixed an issue with the `Users.createUser` method by adding the required `products` property. Thanks to [Appelberg-s](https://github.com/Appelberg-s) for the [fix](https://github.com/MrRefactoring/jira.js/commit/362918093c20036049db334743e2a0f5f41cbcd4#diff-6960050bc2a3d9ffad9eb5e307145969dc4a38eb5434eebf39da545fd18e01b7R12).
Expand Down Expand Up @@ -276,7 +281,7 @@ Version 3: maxContentLength was increased for attachments upload. Thanks to [Rea
- `excludeId` property added to `findGroups` method in `Groups`.
- `orderBy`, `expand` and `queryString` properties added to `getAllIssueTypeSchemes` method in `IssueTypeSchemes`.
- `queryString`, `orderBy` and `expand` properties added to `getIssueTypeScreenSchemes` method in `IssueTypeScreenSchemes`.
- `sanitiseJqlQueries` method added to `JQL`.
- `sanitiseJqlQueries` method added to `Jql`.
- `excludeInactiveUsers` property added to `getProjectRole` method in `ProjectRoles`.
- `queryString`, `scope` and `orderBy` properties added to `getScreens` method in `Screens`.
- `expand`, `queryString` and `orderBy` properties added to `getScreenSchemes` method in `ScreenSchemes`.
Expand Down
3 changes: 2 additions & 1 deletion examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
},
"dependencies": {
"jira.js": "latest"
}
},
"type": "module"
}
29 changes: 29 additions & 0 deletions examples/src/addFixVersion.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Version3Client } from 'jira.js';
import { createIssue } from './utils/index.js';
import { apiToken, email, host } from './credentials.js';

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

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

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

console.log(fix);
}

addFixVersion().catch(e => {
console.error(e);

throw new Error(e.errorMessages?.join(' '));
});
29 changes: 0 additions & 29 deletions examples/src/addFixVersion.ts

This file was deleted.

30 changes: 30 additions & 0 deletions examples/src/addWorklog.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Version3Client } from 'jira.js';
import { createIssue } from './utils/index.js';
import { apiToken, email, host } from './credentials.js';

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

// Used to reduce the amount of code that is not directly related to creating a worklog
const { id: issueIdOrKey } = await createIssue(client);

// The main part responsible for creating the worklog
const worklog = await client.issueWorklogs.addWorklog({
issueIdOrKey, // Required
comment: 'My first worklog', // Not requited
timeSpentSeconds: 60, // Required one of `timeSpentSeconds` or `timeSpent`
});

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

addWorklog().catch(e => {
console.error(e);

throw new Error(e.errorMessages.join(' '));
});
30 changes: 0 additions & 30 deletions examples/src/addWorklog.ts

This file was deleted.

52 changes: 52 additions & 0 deletions examples/src/basic.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { Version3Client } from 'jira.js';
import { apiToken, email, host } from './credentials.js';

const client = new Version3Client({
host,
authentication: {
basic: { email, apiToken },
},
});

async function main() {
const { values: projects } = await client.projects.searchProjects();

if (projects.length) {
const project = projects[0];

const { id } = await client.issues.createIssue({
fields: {
summary: 'My first issue',
issuetype: {
name: 'Task',
},
project: {
key: project.key,
},
},
});

const issue = await client.issues.getIssue({ issueIdOrKey: id });

console.log(`Issue '${issue.fields.summary}' was successfully added to '${project.name}' project.`);
} else {
const myself = await client.myself.getCurrentUser();

const { id } = await client.projects.createProject({
key: 'PROJECT',
name: 'My Project',
leadAccountId: myself.accountId,
projectTypeKey: 'software',
});

const project = await client.projects.getProject({ projectIdOrKey: id.toString() });

console.log(`Project '${project.name}' was successfully created.`);
}
}

main().catch(e => {
console.error(e);

throw new Error(JSON.stringify(e));
});
53 changes: 0 additions & 53 deletions examples/src/basic.ts

This file was deleted.

File renamed without changes.
44 changes: 44 additions & 0 deletions examples/src/getAllWorklogs.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { Version3Client } from 'jira.js';
import type { Worklog } from 'jira.js/out/version3/models';
import { apiToken, email, host } from './credentials.js';
import { addWorklog, createIssue } from './utils/index.js';

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

// Used to reduce the amount of code that is not directly related to getting a worklogs
const issue = await createIssue(client);

// Let's add some worklogs
await addWorklog(client, issue);
await addWorklog(client, issue);
await addWorklog(client, issue);

// The main part responsible for getting the worklogs
const worklogs: Worklog[] = [];

let offset = 0;
let total = 0;

do {
// eslint-disable-next-line no-await-in-loop
const worklogsPaginated = await client.issueWorklogs.getIssueWorklog({ issueIdOrKey: issue.key, startAt: offset });

offset += worklogsPaginated.worklogs.length;
total = worklogsPaginated.total;
worklogs.push(...worklogsPaginated.worklogs);
} while (offset < total);

console.log(`Received ${worklogs.length} worklogs.`);
}

getAllWorklogs().catch(e => {
console.error(e);

throw new Error(e.errorMessages.join(' '));
});
Loading
Loading