Skip to content

Commit

Permalink
CHANGELOG updated
Browse files Browse the repository at this point in the history
  • Loading branch information
MrRefactoring committed Jan 7, 2025
1 parent b8b0020 commit f3ba853
Show file tree
Hide file tree
Showing 17 changed files with 95 additions and 76 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ parserOptions:
project: ./tsconfig.lint.json
plugins:
- import
- '@typescript-eslint'
env:
node: true
browser: true
rules:
"@typescript-eslint/lines-between-class-members": off
'@typescript-eslint/no-unnecessary-condition': [ 'error', { allowConstantLoopConditions: false } ]
arrow-parens:
- error
- as-needed
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Jira.js changelog

### 4.1.0

- **General Improvements:** Enhanced JSDoc documentation across the project for better clarity and developer experience.
- **Fix:** Updated the following methods in `Version2Client` and `Version3Client` to make the `parameters` argument mandatory (as it should have been initially):
- `IssueFieldConfigurations.createFieldConfiguration`
- `IssueFieldConfigurations.createFieldConfigurationScheme`
- `IssueLinks.linkIssues`
- `IssueTypeSchemes.createIssueTypeScheme`
- `IssueTypeSchemes.assignIssueTypeSchemeToProject`
- `IssueTypeScreenSchemes.createIssueTypeScreenScheme`
- `JQL.parseJqlQueries`
- `TimeTracking.setSharedTimeTrackingConfiguration`
- `WorkflowSchemeProjectAssociations.assignSchemeToProject`
- **Improvement:** Changed the return type of `ProjectKeyAndNameValidation.getValidProjectKey` and `ProjectKeyAndNameValidation.getValidProjectName` from `unknown` to `string` for improved type safety and usability.

### 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.
Expand Down
7 changes: 4 additions & 3 deletions examples/src/credentials.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export const host = 'https://jira-js.atlassian.net/';
export const email = '[email protected]';
export const apiToken = 'ATATT3xFfGF0CQo3Ed8gqWxZmT2nlOEinQZJkp7hVY-ynttVtAsRwGF5JYD1vBcSu0i3RNfilR_RbksRFBxU33tsWTi7R5ontSouy0mwNqPhTazoZiVm5ah3_Emcy9g7-KB0rW7XTm5uLHeCdUW9X-Fv1jqWUHjtrOgCr4pXtcV6DmJPyBLa3Jg=582DE538';
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
export const host = '';
export const email = '';
export const apiToken = '';

if (!host) {
throw new Error('Please specify host');
Expand Down
4 changes: 2 additions & 2 deletions src/clients/baseClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ export class BaseClient implements Client {
code: e.code,
message: e.message,
data: e.response.data,
status: e.response?.status,
statusText: e.response?.statusText,
status: e.response.status,
statusText: e.response.statusText,
},
e.response.status,
{ cause: e },
Expand Down
1 change: 1 addition & 0 deletions src/clients/httpException.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export class HttpException extends Error {
return (response as Record<string, any>).message;
}

// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (this.constructor) {
return this.constructor.name.match(/[A-Z][a-z]+|[0-9]+/g)?.join(' ') ?? 'Error';
}
Expand Down
4 changes: 2 additions & 2 deletions src/version2/filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export class Filters {
url: '/rest/api/2/filter',
method: 'POST',
params: {
expand: parameters?.expand,
overrideSharePermissions: parameters?.overrideSharePermissions,
expand: parameters.expand,
overrideSharePermissions: parameters.overrideSharePermissions,
},
data: {
description: parameters.description,
Expand Down
8 changes: 4 additions & 4 deletions src/version2/groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ export class Groups {
url: '/rest/api/2/group',
method: 'DELETE',
params: {
groupname: parameters?.groupname,
groupId: parameters?.groupId,
swapGroup: parameters?.swapGroup,
swapGroupId: parameters?.swapGroupId,
groupname: parameters.groupname,
groupId: parameters.groupId,
swapGroup: parameters.swapGroup,
swapGroupId: parameters.swapGroupId,
},
};

Expand Down
20 changes: 10 additions & 10 deletions src/version2/issueFieldConfigurations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class IssueFieldConfigurations {
* _Administer Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
async createFieldConfiguration<T = Models.FieldConfiguration>(
parameters: Parameters.CreateFieldConfiguration | undefined,
parameters: Parameters.CreateFieldConfiguration,
callback: Callback<T>,
): Promise<void>;
/**
Expand All @@ -85,19 +85,19 @@ export class IssueFieldConfigurations {
* _Administer Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
async createFieldConfiguration<T = Models.FieldConfiguration>(
parameters?: Parameters.CreateFieldConfiguration,
parameters: Parameters.CreateFieldConfiguration,
callback?: never,
): Promise<T>;
async createFieldConfiguration<T = Models.FieldConfiguration>(
parameters?: Parameters.CreateFieldConfiguration,
parameters: Parameters.CreateFieldConfiguration,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: '/rest/api/2/fieldconfiguration',
method: 'POST',
data: {
name: parameters?.name,
description: parameters?.description,
name: parameters.name,
description: parameters.description,
},
};

Expand Down Expand Up @@ -327,7 +327,7 @@ export class IssueFieldConfigurations {
* _Administer Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
async createFieldConfigurationScheme<T = Models.FieldConfigurationScheme>(
parameters: Parameters.CreateFieldConfigurationScheme | undefined,
parameters: Parameters.CreateFieldConfigurationScheme,
callback: Callback<T>,
): Promise<void>;
/**
Expand All @@ -339,19 +339,19 @@ export class IssueFieldConfigurations {
* _Administer Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
async createFieldConfigurationScheme<T = Models.FieldConfigurationScheme>(
parameters?: Parameters.CreateFieldConfigurationScheme,
parameters: Parameters.CreateFieldConfigurationScheme,
callback?: never,
): Promise<T>;
async createFieldConfigurationScheme<T = Models.FieldConfigurationScheme>(
parameters?: Parameters.CreateFieldConfigurationScheme,
parameters: Parameters.CreateFieldConfigurationScheme,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: '/rest/api/2/fieldconfigurationscheme',
method: 'POST',
data: {
name: parameters?.name,
description: parameters?.description,
name: parameters.name,
description: parameters.description,
},
};

Expand Down
24 changes: 12 additions & 12 deletions src/version2/issueTypeSchemes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class IssueTypeSchemes {
* _Administer Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
async createIssueTypeScheme<T = Models.IssueTypeSchemeID>(
parameters: Parameters.CreateIssueTypeScheme | undefined,
parameters: Parameters.CreateIssueTypeScheme,
callback: Callback<T>,
): Promise<void>;
/**
Expand All @@ -70,21 +70,21 @@ export class IssueTypeSchemes {
* _Administer Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
async createIssueTypeScheme<T = Models.IssueTypeSchemeID>(
parameters?: Parameters.CreateIssueTypeScheme,
parameters: Parameters.CreateIssueTypeScheme,
callback?: never,
): Promise<T>;
async createIssueTypeScheme<T = Models.IssueTypeSchemeID>(
parameters?: Parameters.CreateIssueTypeScheme,
parameters: Parameters.CreateIssueTypeScheme,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: '/rest/api/2/issuetypescheme',
method: 'POST',
data: {
name: parameters?.name,
description: parameters?.description,
defaultIssueTypeId: parameters?.defaultIssueTypeId,
issueTypeIds: parameters?.issueTypeIds,
name: parameters.name,
description: parameters.description,
defaultIssueTypeId: parameters.defaultIssueTypeId,
issueTypeIds: parameters.issueTypeIds,
},
};

Expand Down Expand Up @@ -189,7 +189,7 @@ export class IssueTypeSchemes {
* _Administer Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
async assignIssueTypeSchemeToProject<T = void>(
parameters: Parameters.AssignIssueTypeSchemeToProject | undefined,
parameters: Parameters.AssignIssueTypeSchemeToProject,
callback: Callback<T>,
): Promise<void>;
/**
Expand All @@ -204,19 +204,19 @@ export class IssueTypeSchemes {
* _Administer Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
async assignIssueTypeSchemeToProject<T = void>(
parameters?: Parameters.AssignIssueTypeSchemeToProject,
parameters: Parameters.AssignIssueTypeSchemeToProject,
callback?: never,
): Promise<T>;
async assignIssueTypeSchemeToProject<T = void>(
parameters?: Parameters.AssignIssueTypeSchemeToProject,
parameters: Parameters.AssignIssueTypeSchemeToProject,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: '/rest/api/2/issuetypescheme/project',
method: 'PUT',
data: {
issueTypeSchemeId: parameters?.issueTypeSchemeId,
projectId: parameters?.projectId,
issueTypeSchemeId: parameters.issueTypeSchemeId,
projectId: parameters.projectId,
},
};

Expand Down
12 changes: 6 additions & 6 deletions src/version2/issueTypeScreenSchemes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class IssueTypeScreenSchemes {
* _Administer Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
async createIssueTypeScreenScheme<T = Models.IssueTypeScreenSchemeId>(
parameters: Parameters.CreateIssueTypeScreenScheme | undefined,
parameters: Parameters.CreateIssueTypeScreenScheme,
callback: Callback<T>,
): Promise<void>;
/**
Expand All @@ -70,20 +70,20 @@ export class IssueTypeScreenSchemes {
* _Administer Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
async createIssueTypeScreenScheme<T = Models.IssueTypeScreenSchemeId>(
parameters?: Parameters.CreateIssueTypeScreenScheme,
parameters: Parameters.CreateIssueTypeScreenScheme,
callback?: never,
): Promise<T>;
async createIssueTypeScreenScheme<T = Models.IssueTypeScreenSchemeId>(
parameters?: Parameters.CreateIssueTypeScreenScheme,
parameters: Parameters.CreateIssueTypeScreenScheme,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: '/rest/api/2/issuetypescreenscheme',
method: 'POST',
data: {
name: parameters?.name,
description: parameters?.description,
issueTypeMappings: parameters?.issueTypeMappings,
name: parameters.name,
description: parameters.description,
issueTypeMappings: parameters.issueTypeMappings,
},
};

Expand Down
10 changes: 5 additions & 5 deletions src/version2/jQL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export class JQL {
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:** None.
*/
async parseJqlQueries<T = Models.ParsedJqlQueries>(
parameters: Parameters.ParseJqlQueries | undefined,
parameters: Parameters.ParseJqlQueries,
callback: Callback<T>,
): Promise<void>;
/**
Expand All @@ -183,21 +183,21 @@ export class JQL {
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:** None.
*/
async parseJqlQueries<T = Models.ParsedJqlQueries>(
parameters?: Parameters.ParseJqlQueries,
parameters: Parameters.ParseJqlQueries,
callback?: never,
): Promise<T>;
async parseJqlQueries<T = Models.ParsedJqlQueries>(
parameters?: Parameters.ParseJqlQueries,
parameters: Parameters.ParseJqlQueries,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: '/rest/api/2/jql/parse',
method: 'POST',
params: {
validation: parameters?.validation,
validation: parameters.validation,
},
data: {
queries: parameters?.queries,
queries: parameters.queries,
},
};

Expand Down
14 changes: 7 additions & 7 deletions src/version2/timeTracking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export class TimeTracking {
* _Administer Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
async setSharedTimeTrackingConfiguration<T = Models.TimeTrackingConfiguration>(
parameters: Parameters.SetSharedTimeTrackingConfiguration | undefined,
parameters: Parameters.SetSharedTimeTrackingConfiguration,
callback: Callback<T>,
): Promise<void>;
/**
Expand All @@ -146,21 +146,21 @@ export class TimeTracking {
* _Administer Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
async setSharedTimeTrackingConfiguration<T = Models.TimeTrackingConfiguration>(
parameters?: Parameters.SetSharedTimeTrackingConfiguration,
parameters: Parameters.SetSharedTimeTrackingConfiguration,
callback?: never,
): Promise<T>;
async setSharedTimeTrackingConfiguration<T = Models.TimeTrackingConfiguration>(
parameters?: Parameters.SetSharedTimeTrackingConfiguration,
parameters: Parameters.SetSharedTimeTrackingConfiguration,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: '/rest/api/2/configuration/timetracking/options',
method: 'PUT',
data: {
workingHoursPerDay: parameters?.workingHoursPerDay,
workingDaysPerWeek: parameters?.workingDaysPerWeek,
timeFormat: parameters?.timeFormat,
defaultUnit: parameters?.defaultUnit,
workingHoursPerDay: parameters.workingHoursPerDay,
workingDaysPerWeek: parameters.workingDaysPerWeek,
timeFormat: parameters.timeFormat,
defaultUnit: parameters.defaultUnit,
},
};

Expand Down
10 changes: 5 additions & 5 deletions src/version2/workflowSchemeProjectAssociations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class WorkflowSchemeProjectAssociations {
* _Administer Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
async assignSchemeToProject<T = void>(
parameters: Parameters.AssignSchemeToProject | undefined,
parameters: Parameters.AssignSchemeToProject,
callback: Callback<T>,
): Promise<void>;
/**
Expand All @@ -72,17 +72,17 @@ export class WorkflowSchemeProjectAssociations {
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:**
* _Administer Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
async assignSchemeToProject<T = void>(parameters?: Parameters.AssignSchemeToProject, callback?: never): Promise<T>;
async assignSchemeToProject<T = void>(parameters: Parameters.AssignSchemeToProject, callback?: never): Promise<T>;
async assignSchemeToProject<T = void>(
parameters?: Parameters.AssignSchemeToProject,
parameters: Parameters.AssignSchemeToProject,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: '/rest/api/2/workflowscheme/project',
method: 'PUT',
data: {
workflowSchemeId: parameters?.workflowSchemeId,
projectId: parameters?.projectId,
workflowSchemeId: parameters.workflowSchemeId,
projectId: parameters.projectId,
},
};

Expand Down
10 changes: 5 additions & 5 deletions src/version3/issueTypeSchemes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export class IssueTypeSchemes {
* _Administer Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
async assignIssueTypeSchemeToProject<T = void>(
parameters: Parameters.AssignIssueTypeSchemeToProject | undefined,
parameters: Parameters.AssignIssueTypeSchemeToProject,
callback: Callback<T>,
): Promise<void>;
/**
Expand All @@ -204,19 +204,19 @@ export class IssueTypeSchemes {
* _Administer Jira_ [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
async assignIssueTypeSchemeToProject<T = void>(
parameters?: Parameters.AssignIssueTypeSchemeToProject,
parameters: Parameters.AssignIssueTypeSchemeToProject,
callback?: never,
): Promise<T>;
async assignIssueTypeSchemeToProject<T = void>(
parameters?: Parameters.AssignIssueTypeSchemeToProject,
parameters: Parameters.AssignIssueTypeSchemeToProject,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: '/rest/api/3/issuetypescheme/project',
method: 'PUT',
data: {
issueTypeSchemeId: parameters?.issueTypeSchemeId,
projectId: parameters?.projectId,
issueTypeSchemeId: parameters.issueTypeSchemeId,
projectId: parameters.projectId,
},
};

Expand Down
Loading

0 comments on commit f3ba853

Please sign in to comment.