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

Return types improvements and createIssue bug fixed #116

Merged
merged 9 commits into from
Apr 28, 2021
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Jira.js changelog

### 2.1.1

- Typings improved
- Fixed [bug](https://github.com/MrRefactoring/jira.js/issues/117) with typings in createIssue

### 2.1.0

- Typings improved
Expand Down
160 changes: 77 additions & 83 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jira.js",
"version": "2.1.0",
"version": "2.1.1",
"description": "jira.js is a powerful Node.JS/Browser module that allows you to interact with the Jira API very easily",
"main": "out/index.js",
"types": "out/index.d.ts",
Expand Down Expand Up @@ -42,21 +42,21 @@
},
"devDependencies": {
"@types/express": "4.17.11",
"@types/jest": "^26.0.22",
"@types/node": "^14.14.41",
"@types/jest": "^26.0.23",
"@types/node": "^15.0.1",
"@types/oauth": "^0.9.1",
"@types/sinon": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",
"dotenv": "^8.2.0",
"eslint": "^7.24.0",
"eslint": "^7.25.0",
"eslint-config-airbnb-typescript": "^12.3.1",
"eslint-import-resolver-typescript": "^2.4.0",
"eslint-plugin-import": "^2.22.1",
"jest": "^26.6.3",
"sinon": "^10.0.0",
"ts-jest": "^26.5.5",
"typedoc": "^0.20.35",
"typedoc": "^0.20.36",
"typescript": "^4.2.4"
},
"dependencies": {
Expand Down
12 changes: 6 additions & 6 deletions src/agile/board.ts
Original file line number Diff line number Diff line change
Expand Up @@ -664,12 +664,12 @@ export class Board {
/**
* Returns all sprints from a board, for a given board ID. This only includes sprints that the user has permission to view.
*/
async getAllSprints<T = unknown>(parameters: Parameters.GetAllSprints, callback: Callback<T>): Promise<void>;
async getAllSprints<T = Paginated<Models.SprintBean[]>>(parameters: Parameters.GetAllSprints, callback: Callback<T>): Promise<void>;
/**
* Returns all sprints from a board, for a given board ID. This only includes sprints that the user has permission to view.
*/
async getAllSprints<T = unknown>(parameters: Parameters.GetAllSprints, callback?: never): Promise<T>;
async getAllSprints<T = unknown>(parameters: Parameters.GetAllSprints, callback?: Callback<T>): Promise<void | T> {
async getAllSprints<T = Paginated<Models.SprintBean[]>>(parameters: Parameters.GetAllSprints, callback?: never): Promise<T>;
async getAllSprints<T = Paginated<Models.SprintBean[]>>(parameters: Parameters.GetAllSprints, callback?: Callback<T>): Promise<void | T> {
const config = {
url: `/agile/1.0/board/${parameters.boardId}/sprint`,
method: 'GET',
Expand Down Expand Up @@ -717,14 +717,14 @@ export class Board {
* Note, if the user does not have permission to view the board, no versions will be returned at all.
* Returned versions are ordered by the name of the project from which they belong and then by sequence defined by user.
*/
async getAllVersions<T = unknown>(parameters: Parameters.GetAllVersions, callback: Callback<T>): Promise<void>;
async getAllVersions<T = Paginated<Models.Version>>(parameters: Parameters.GetAllVersions, callback: Callback<T>): Promise<void>;
/**
* Returns all versions from a board, for a given board ID. This only includes versions that the user has permission to view.
* Note, if the user does not have permission to view the board, no versions will be returned at all.
* Returned versions are ordered by the name of the project from which they belong and then by sequence defined by user.
*/
async getAllVersions<T = unknown>(parameters: Parameters.GetAllVersions, callback?: never): Promise<T>;
async getAllVersions<T = unknown>(parameters: Parameters.GetAllVersions, callback?: Callback<T>): Promise<void | T> {
async getAllVersions<T = Paginated<Models.Version>>(parameters: Parameters.GetAllVersions, callback?: never): Promise<T>;
async getAllVersions<T = Paginated<Models.Version>>(parameters: Parameters.GetAllVersions, callback?: Callback<T>): Promise<void | T> {
const config = {
url: `/agile/1.0/board/${parameters.boardId}/version`,
method: 'GET',
Expand Down
3 changes: 2 additions & 1 deletion src/agile/deployments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { Callback } from '../callback';
import { RequestConfig } from '../requestConfig';

export class Deployments {
constructor(private client: Client) { }
constructor(private client: Client) {
}

/**
* Update / insert deployment data.
Expand Down
33 changes: 20 additions & 13 deletions src/agile/developmentInformation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import { Callback } from '../callback';
import { RequestConfig } from '../requestConfig';

export class DevelopmentInformation {
constructor(private client: Client) { }
constructor(private client: Client) {
}

/**
* Stores development information provided in the request to make it available when viewing issues in Jira. Existing repository and entity data for the same ID will be replaced if the updateSequenceId of existing data is less than the incoming data. Submissions are performed asynchronously. Submitted data will eventually be available in Jira; most updates are available within a short period of time, but may take some time during peak load and/or maintenance times. */
* Stores development information provided in the request to make it available when viewing issues in Jira. Existing repository and entity data for the same ID will be replaced if the updateSequenceId of existing data is less than the incoming data. Submissions are performed asynchronously. Submitted data will eventually be available in Jira; most updates are available within a short period of time, but may take some time during peak load and/or maintenance times. */
async storeDevelopmentInformation<T = Models.StoreDevelopmentInformation>(parameters: Parameters.StoreDevelopmentInformation, callback: Callback<T>): Promise<void>;
/**
* Stores development information provided in the request to make it available when viewing issues in Jira. Existing repository and entity data for the same ID will be replaced if the updateSequenceId of existing data is less than the incoming data. Submissions are performed asynchronously. Submitted data will eventually be available in Jira; most updates are available within a short period of time, but may take some time during peak load and/or maintenance times. */
* Stores development information provided in the request to make it available when viewing issues in Jira. Existing repository and entity data for the same ID will be replaced if the updateSequenceId of existing data is less than the incoming data. Submissions are performed asynchronously. Submitted data will eventually be available in Jira; most updates are available within a short period of time, but may take some time during peak load and/or maintenance times. */
async storeDevelopmentInformation<T = Models.StoreDevelopmentInformation>(parameters: Parameters.StoreDevelopmentInformation, callback?: never): Promise<T>;
async storeDevelopmentInformation<T = Models.StoreDevelopmentInformation>(parameters: Parameters.StoreDevelopmentInformation, callback?: Callback<T>): Promise<void | T> {
const config = {
Expand All @@ -26,11 +28,12 @@ export class DevelopmentInformation {

return this.client.sendRequest(config, callback, { methodName: 'storeDevelopmentInformation' });
}

/**
* For the specified repository ID, retrieves the repository and the most recent 400 development information entities. The result will be what is currently stored, ignoring any pending updates or deletes. */
* For the specified repository ID, retrieves the repository and the most recent 400 development information entities. The result will be what is currently stored, ignoring any pending updates or deletes. */
async getRepository<T = Models.GetRepository>(parameters: Parameters.GetRepository, callback: Callback<T>): Promise<void>;
/**
* For the specified repository ID, retrieves the repository and the most recent 400 development information entities. The result will be what is currently stored, ignoring any pending updates or deletes. */
* For the specified repository ID, retrieves the repository and the most recent 400 development information entities. The result will be what is currently stored, ignoring any pending updates or deletes. */
async getRepository<T = Models.GetRepository>(parameters: Parameters.GetRepository, callback?: never): Promise<T>;
async getRepository<T = Models.GetRepository>(parameters: Parameters.GetRepository, callback?: Callback<T>): Promise<void | T> {
const config = {
Expand All @@ -40,11 +43,12 @@ export class DevelopmentInformation {

return this.client.sendRequest(config, callback, { methodName: 'getRepository' });
}

/**
* Deletes the repository data stored by the given ID and all related development information entities. Deletion is performed asynchronously. */
* Deletes the repository data stored by the given ID and all related development information entities. Deletion is performed asynchronously. */
async deleteRepository<T = unknown>(parameters: Parameters.DeleteRepository, callback: Callback<T>): Promise<void>;
/**
* Deletes the repository data stored by the given ID and all related development information entities. Deletion is performed asynchronously. */
* Deletes the repository data stored by the given ID and all related development information entities. Deletion is performed asynchronously. */
async deleteRepository<T = unknown>(parameters: Parameters.DeleteRepository, callback?: never): Promise<T>;
async deleteRepository<T = unknown>(parameters: Parameters.DeleteRepository, callback?: Callback<T>): Promise<void | T> {
const config = {
Expand All @@ -57,11 +61,12 @@ export class DevelopmentInformation {

return this.client.sendRequest(config, callback, { methodName: 'deleteRepository' });
}

/**
* Deletes development information entities which have all the provided properties. Entities will be deleted that match ALL of the properties (i.e. treated as an AND). For example if request is `DELETE bulk?accountId=123&projectId=ABC` entities which have properties `accountId=123` and `projectId=ABC` will be deleted. Special property `_updateSequenceId` can be used to delete all entities with updateSequenceId less or equal than the value specified. In addition to the optional `_updateSequenceId`, one or more query params must be supplied to specify properties to delete by. Deletion is performed asynchronously: specified entities will eventually be removed from Jira. */
* Deletes development information entities which have all the provided properties. Entities will be deleted that match ALL of the properties (i.e. treated as an AND). For example if request is `DELETE bulk?accountId=123&projectId=ABC` entities which have properties `accountId=123` and `projectId=ABC` will be deleted. Special property `_updateSequenceId` can be used to delete all entities with updateSequenceId less or equal than the value specified. In addition to the optional `_updateSequenceId`, one or more query params must be supplied to specify properties to delete by. Deletion is performed asynchronously: specified entities will eventually be removed from Jira. */
async deleteByProperties<T = unknown>(parameters: Parameters.DeleteByProperties, callback: Callback<T>): Promise<void>;
/**
* Deletes development information entities which have all the provided properties. Entities will be deleted that match ALL of the properties (i.e. treated as an AND). For example if request is `DELETE bulk?accountId=123&projectId=ABC` entities which have properties `accountId=123` and `projectId=ABC` will be deleted. Special property `_updateSequenceId` can be used to delete all entities with updateSequenceId less or equal than the value specified. In addition to the optional `_updateSequenceId`, one or more query params must be supplied to specify properties to delete by. Deletion is performed asynchronously: specified entities will eventually be removed from Jira. */
* Deletes development information entities which have all the provided properties. Entities will be deleted that match ALL of the properties (i.e. treated as an AND). For example if request is `DELETE bulk?accountId=123&projectId=ABC` entities which have properties `accountId=123` and `projectId=ABC` will be deleted. Special property `_updateSequenceId` can be used to delete all entities with updateSequenceId less or equal than the value specified. In addition to the optional `_updateSequenceId`, one or more query params must be supplied to specify properties to delete by. Deletion is performed asynchronously: specified entities will eventually be removed from Jira. */
async deleteByProperties<T = unknown>(parameters: Parameters.DeleteByProperties, callback?: never): Promise<T>;
async deleteByProperties<T = unknown>(parameters: Parameters.DeleteByProperties, callback?: Callback<T>): Promise<void | T> {
const config = {
Expand All @@ -74,11 +79,12 @@ export class DevelopmentInformation {

return this.client.sendRequest(config, callback, { methodName: 'deleteByProperties' });
}

/**
* Checks if development information which have all the provided properties exists. For example, if request is `GET existsByProperties?accountId=123&projectId=ABC` then result will be positive only if there is at least one entity or repository with both properties `accountId=123` and `projectId=ABC`. Special property `_updateSequenceId` can be used to filter all entities with updateSequenceId less or equal than the value specified. In addition to the optional `_updateSequenceId`, one or more query params must be supplied to specify properties to search by. */
* Checks if development information which have all the provided properties exists. For example, if request is `GET existsByProperties?accountId=123&projectId=ABC` then result will be positive only if there is at least one entity or repository with both properties `accountId=123` and `projectId=ABC`. Special property `_updateSequenceId` can be used to filter all entities with updateSequenceId less or equal than the value specified. In addition to the optional `_updateSequenceId`, one or more query params must be supplied to specify properties to search by. */
async existsByProperties<T = Models.ExistsByProperties>(parameters: Parameters.ExistsByProperties, callback: Callback<T>): Promise<void>;
/**
* Checks if development information which have all the provided properties exists. For example, if request is `GET existsByProperties?accountId=123&projectId=ABC` then result will be positive only if there is at least one entity or repository with both properties `accountId=123` and `projectId=ABC`. Special property `_updateSequenceId` can be used to filter all entities with updateSequenceId less or equal than the value specified. In addition to the optional `_updateSequenceId`, one or more query params must be supplied to specify properties to search by. */
* Checks if development information which have all the provided properties exists. For example, if request is `GET existsByProperties?accountId=123&projectId=ABC` then result will be positive only if there is at least one entity or repository with both properties `accountId=123` and `projectId=ABC`. Special property `_updateSequenceId` can be used to filter all entities with updateSequenceId less or equal than the value specified. In addition to the optional `_updateSequenceId`, one or more query params must be supplied to specify properties to search by. */
async existsByProperties<T = Models.ExistsByProperties>(parameters: Parameters.ExistsByProperties, callback?: never): Promise<T>;
async existsByProperties<T = Models.ExistsByProperties>(parameters: Parameters.ExistsByProperties, callback?: Callback<T>): Promise<void | T> {
const config = {
Expand All @@ -91,11 +97,12 @@ export class DevelopmentInformation {

return this.client.sendRequest(config, callback, { methodName: 'existsByProperties' });
}

/**
* Deletes particular development information entity. Deletion is performed asynchronously. */
* Deletes particular development information entity. Deletion is performed asynchronously. */
async deleteEntity<T = unknown>(parameters: Parameters.DeleteEntity, callback: Callback<T>): Promise<void>;
/**
* Deletes particular development information entity. Deletion is performed asynchronously. */
* Deletes particular development information entity. Deletion is performed asynchronously. */
async deleteEntity<T = unknown>(parameters: Parameters.DeleteEntity, callback?: never): Promise<T>;
async deleteEntity<T = unknown>(parameters: Parameters.DeleteEntity, callback?: Callback<T>): Promise<void | T> {
const config = {
Expand Down
3 changes: 2 additions & 1 deletion src/agile/epic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { Callback } from '../callback';
import { RequestConfig } from '../requestConfig';

export class Epic {
constructor(private client: Client) { }
constructor(private client: Client) {
}

/**
* Returns all issues that do not belong to any epic.
Expand Down
3 changes: 2 additions & 1 deletion src/agile/featureFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { Callback } from '../callback';
import { RequestConfig } from '../requestConfig';

export class FeatureFlags {
constructor(private client: Client) { }
constructor(private client: Client) {
}

/**
* Update / insert Feature Flag data.
Expand Down
3 changes: 2 additions & 1 deletion src/agile/issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { Callback } from '../callback';
import { RequestConfig } from '../requestConfig';

export class Issue {
constructor(private client: Client) { }
constructor(private client: Client) {
}

/**
* Moves (ranks) issues before or after a given issue. At most 50 issues may be ranked at once.
Expand Down
Loading