@esm-js/jira.js
Version:
A comprehensive JavaScript/TypeScript library designed for both Node.JS and browsers, facilitating seamless interaction with the Atlassian Jira API.
1,571 lines (1,543 loc) • 543 kB
JavaScript
var __defProp = Object.defineProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
// src/agile/index.ts
var agile_exports = {};
__export(agile_exports, {
AgileClient: () => AgileClient,
AgileModels: () => models_exports,
AgileParameters: () => parameters_exports,
Backlog: () => Backlog,
Board: () => Board,
Builds: () => Builds,
Deployments: () => Deployments,
DevelopmentInformation: () => DevelopmentInformation,
DevopsComponents: () => DevopsComponents,
Epic: () => Epic,
FeatureFlags: () => FeatureFlags,
Issue: () => Issue,
Operations: () => Operations,
RemoteLinks: () => RemoteLinks,
SecurityInformation: () => SecurityInformation,
Sprint: () => Sprint
});
// src/agile/backlog.ts
var Backlog = class {
constructor(client) {
this.client = client;
}
async moveIssuesToBacklog(parameters, callback) {
const config = {
url: "/rest/agile/1.0/backlog/issue",
method: "POST",
data: {
issues: parameters.issues
}
};
return this.client.sendRequest(config, callback);
}
async moveIssuesToBacklogForBoard(parameters, callback) {
const config = {
url: `/rest/agile/1.0/backlog/${parameters.boardId}/issue`,
method: "POST",
data: {
issues: parameters.issues,
rankAfterIssue: parameters.rankAfterIssue,
rankBeforeIssue: parameters.rankBeforeIssue,
rankCustomFieldId: parameters.rankCustomFieldId
}
};
return this.client.sendRequest(config, callback);
}
};
// src/agile/board.ts
var Board = class {
constructor(client) {
this.client = client;
}
async getAllBoards(parameters, callback) {
const config = {
url: "/rest/agile/1.0/board",
method: "GET",
params: {
startAt: parameters?.startAt,
maxResults: parameters?.maxResults,
type: parameters?.type,
name: parameters?.name,
projectKeyOrId: parameters?.projectKeyOrId,
accountIdLocation: parameters?.accountIdLocation,
projectLocation: parameters?.projectLocation,
includePrivate: parameters?.includePrivate,
negateLocationFiltering: parameters?.negateLocationFiltering,
orderBy: parameters?.orderBy,
expand: parameters?.expand,
projectTypeLocation: parameters?.projectTypeLocation,
filterId: parameters?.filterId
}
};
return this.client.sendRequest(config, callback);
}
async createBoard(parameters, callback) {
const config = {
url: "/rest/agile/1.0/board",
method: "POST",
data: {
filterId: parameters.filterId,
location: parameters.location,
name: parameters.name,
type: parameters.type
}
};
return this.client.sendRequest(config, callback);
}
async getBoardByFilterId(parameters, callback) {
const config = {
url: `/rest/agile/1.0/board/filter/${parameters.filterId}`,
method: "GET",
params: {
startAt: parameters.startAt,
maxResults: parameters.maxResults
}
};
return this.client.sendRequest(config, callback);
}
async getBoard(parameters, callback) {
const config = {
url: `/rest/agile/1.0/board/${parameters.boardId}`,
method: "GET"
};
return this.client.sendRequest(config, callback);
}
async deleteBoard(parameters, callback) {
const config = {
url: `/rest/agile/1.0/board/${parameters.boardId}`,
method: "DELETE"
};
return this.client.sendRequest(config, callback);
}
async getIssuesForBacklog(parameters, callback) {
const config = {
url: `/rest/agile/1.0/board/${parameters.boardId}/backlog`,
method: "GET",
params: {
startAt: parameters.startAt,
maxResults: parameters.maxResults,
jql: parameters.jql,
validateQuery: parameters.validateQuery,
fields: parameters.fields,
expand: parameters.expand
}
};
return this.client.sendRequest(config, callback);
}
async getConfiguration(parameters, callback) {
const config = {
url: `/rest/agile/1.0/board/${parameters.boardId}/configuration`,
method: "GET"
};
return this.client.sendRequest(config, callback);
}
async getEpics(parameters, callback) {
const config = {
url: `/rest/agile/1.0/board/${parameters.boardId}/epic`,
method: "GET",
params: {
startAt: parameters.startAt,
maxResults: parameters.maxResults,
done: parameters.done
}
};
return this.client.sendRequest(config, callback);
}
async getIssuesWithoutEpicForBoard(parameters, callback) {
const config = {
url: `/rest/agile/1.0/board/${parameters.boardId}/epic/none/issue`,
method: "GET",
params: {
startAt: parameters.startAt,
maxResults: parameters.maxResults,
jql: parameters.jql,
validateQuery: parameters.validateQuery,
fields: parameters.fields,
expand: parameters.expand
}
};
return this.client.sendRequest(config, callback);
}
async getBoardIssuesForEpic(parameters, callback) {
const config = {
url: `/rest/agile/1.0/board/${parameters.boardId}/epic/${parameters.epicId}/issue`,
method: "GET",
params: {
startAt: parameters.startAt,
maxResults: parameters.maxResults,
jql: parameters.jql,
validateQuery: parameters.validateQuery,
fields: parameters.fields,
expand: parameters.expand
}
};
return this.client.sendRequest(config, callback);
}
async getFeaturesForBoard(parameters, callback) {
const config = {
url: `/rest/agile/1.0/board/${parameters.boardId}/features`,
method: "GET"
};
return this.client.sendRequest(config, callback);
}
async toggleFeatures(parameters, callback) {
const config = {
url: `/rest/agile/1.0/board/${parameters.boardId}/features`,
method: "PUT",
data: parameters.body
};
return this.client.sendRequest(config, callback);
}
async getIssuesForBoard(parameters, callback) {
const config = {
url: `/rest/agile/1.0/board/${parameters.boardId}/issue`,
method: "GET",
params: {
startAt: parameters.startAt,
maxResults: parameters.maxResults,
jql: parameters.jql,
validateQuery: parameters.validateQuery,
fields: parameters.fields,
expand: parameters.expand
}
};
return this.client.sendRequest(config, callback);
}
async moveIssuesToBoard(parameters, callback) {
const config = {
url: `/rest/agile/1.0/board/${parameters.boardId}/issue`,
method: "POST",
data: {
issues: parameters.issues,
rankAfterIssue: parameters.rankAfterIssue,
rankBeforeIssue: parameters.rankBeforeIssue,
rankCustomFieldId: parameters.rankCustomFieldId
}
};
return this.client.sendRequest(config, callback);
}
async getProjects(parameters, callback) {
const config = {
url: `/rest/agile/1.0/board/${parameters.boardId}/project`,
method: "GET",
params: {
startAt: parameters.startAt,
maxResults: parameters.maxResults
}
};
return this.client.sendRequest(config, callback);
}
async getProjectsFull(parameters, callback) {
const config = {
url: `/rest/agile/1.0/board/${parameters.boardId}/project/full`,
method: "GET"
};
return this.client.sendRequest(config, callback);
}
async getBoardPropertyKeys(parameters, callback) {
const config = {
url: `/rest/agile/1.0/board/${parameters.boardId}/properties`,
method: "GET"
};
return this.client.sendRequest(config, callback);
}
async getBoardProperty(parameters, callback) {
const config = {
url: `/rest/agile/1.0/board/${parameters.boardId}/properties/${parameters.propertyKey}`,
method: "GET"
};
return this.client.sendRequest(config, callback);
}
async setBoardProperty(parameters, callback) {
const config = {
url: `/rest/agile/1.0/board/${parameters.boardId}/properties/${parameters.propertyKey}`,
method: "PUT"
};
return this.client.sendRequest(config, callback);
}
async deleteBoardProperty(parameters, callback) {
const config = {
url: `/rest/agile/1.0/board/${parameters.boardId}/properties/${parameters.propertyKey}`,
method: "DELETE"
};
return this.client.sendRequest(config, callback);
}
async getAllQuickFilters(parameters, callback) {
const config = {
url: `/rest/agile/1.0/board/${parameters.boardId}/quickfilter`,
method: "GET",
params: {
startAt: parameters.startAt,
maxResults: parameters.maxResults
}
};
return this.client.sendRequest(config, callback);
}
async getQuickFilter(parameters, callback) {
const config = {
url: `/rest/agile/1.0/board/${parameters.boardId}/quickfilter/${parameters.quickFilterId}`,
method: "GET"
};
return this.client.sendRequest(config, callback);
}
async getReportsForBoard(parameters, callback) {
const config = {
url: `/rest/agile/1.0/board/${parameters.boardId}/reports`,
method: "GET"
};
return this.client.sendRequest(config, callback);
}
async getAllSprints(parameters, callback) {
const config = {
url: `/rest/agile/1.0/board/${parameters.boardId}/sprint`,
method: "GET",
params: {
startAt: parameters.startAt,
maxResults: parameters.maxResults,
state: parameters.state
}
};
return this.client.sendRequest(config, callback);
}
async getBoardIssuesForSprint(parameters, callback) {
const config = {
url: `/rest/agile/1.0/board/${parameters.boardId}/sprint/${parameters.sprintId}/issue`,
method: "GET",
params: {
startAt: parameters.startAt,
maxResults: parameters.maxResults,
jql: parameters.jql,
validateQuery: parameters.validateQuery,
fields: parameters.fields,
expand: parameters.expand
}
};
return this.client.sendRequest(config, callback);
}
async getAllVersions(parameters, callback) {
const config = {
url: `/rest/agile/1.0/board/${parameters.boardId}/version`,
method: "GET",
params: {
startAt: parameters.startAt,
maxResults: parameters.maxResults,
released: parameters.released
}
};
return this.client.sendRequest(config, callback);
}
};
// src/agile/builds.ts
var Builds = class {
constructor(client) {
this.client = client;
}
async submitBuilds(parameters, callback) {
const config = {
url: "/rest/builds/0.1/bulk",
method: "POST",
data: {
properties: parameters.properties,
builds: parameters.builds,
providerMetadata: parameters.providerMetadata
}
};
return this.client.sendRequest(config, callback);
}
async deleteBuildsByProperty(parameters, callback) {
const config = {
url: "/rest/builds/0.1/bulkByProperties",
method: "DELETE",
params: {
_updateSequenceNumber: parameters.updateSequenceNumber
}
};
return this.client.sendRequest(config, callback);
}
async getBuildByKey(parameters, callback) {
const config = {
url: `/rest/builds/0.1/pipelines/${parameters.pipelineId}/builds/${parameters.buildNumber}`,
method: "GET"
};
return this.client.sendRequest(config, callback);
}
async deleteBuildByKey(parameters, callback) {
const config = {
url: `/rest/builds/0.1/pipelines/${parameters.pipelineId}/builds/${parameters.buildNumber}`,
method: "DELETE",
params: {
_updateSequenceNumber: parameters.updateSequenceNumber
}
};
return this.client.sendRequest(config, callback);
}
};
// src/agile/deployments.ts
var Deployments = class {
constructor(client) {
this.client = client;
}
async submitDeployments(parameters, callback) {
const config = {
url: "/rest/deployments/0.1/bulk",
method: "POST",
data: {
properties: parameters.properties,
deployments: parameters.deployments,
providerMetadata: parameters.providerMetadata
}
};
return this.client.sendRequest(config, callback);
}
async deleteDeploymentsByProperty(parameters, callback) {
const config = {
url: "/rest/deployments/0.1/bulkByProperties",
method: "DELETE",
params: {
_updateSequenceNumber: parameters.updateSequenceNumber
}
};
return this.client.sendRequest(config, callback);
}
async getDeploymentByKey(parameters, callback) {
const config = {
url: `/rest/deployments/0.1/pipelines/${parameters.pipelineId}/environments/${parameters.environmentId}/deployments/${parameters.deploymentSequenceNumber}`,
method: "GET"
};
return this.client.sendRequest(config, callback);
}
async deleteDeploymentByKey(parameters, callback) {
const config = {
url: `/rest/deployments/0.1/pipelines/${parameters.pipelineId}/environments/${parameters.environmentId}/deployments/${parameters.deploymentSequenceNumber}`,
method: "DELETE",
params: {
_updateSequenceNumber: parameters.updateSequenceNumber
}
};
return this.client.sendRequest(config, callback);
}
async getDeploymentGatingStatusByKey(parameters, callback) {
const config = {
url: `/rest/deployments/0.1/pipelines/${parameters.pipelineId}/environments/${parameters.environmentId}/deployments/${parameters.deploymentSequenceNumber}/gating-status`,
method: "GET"
};
return this.client.sendRequest(config, callback);
}
};
// src/agile/developmentInformation.ts
var DevelopmentInformation = class {
constructor(client) {
this.client = client;
}
async storeDevelopmentInformation(parameters, callback) {
const config = {
url: "/rest/devinfo/0.10/bulk",
method: "POST",
data: {
repositories: parameters.repositories,
preventTransitions: parameters.preventTransitions,
operationType: parameters.operationType,
properties: parameters.properties,
providerMetadata: parameters.providerMetadata
}
};
return this.client.sendRequest(config, callback);
}
async getRepository(parameters, callback) {
const config = {
url: `/rest/devinfo/0.10/repository/${parameters.repositoryId}`,
method: "GET"
};
return this.client.sendRequest(config, callback);
}
async deleteRepository(parameters, callback) {
const config = {
url: `/rest/devinfo/0.10/repository/${parameters.repositoryId}`,
method: "DELETE",
params: {
_updateSequenceId: parameters.updateSequenceId
}
};
return this.client.sendRequest(config, callback);
}
async deleteByProperties(parameters, callback) {
const config = {
url: "/rest/devinfo/0.10/bulkByProperties",
method: "DELETE",
params: {
_updateSequenceId: parameters.updateSequenceId
}
};
return this.client.sendRequest(config, callback);
}
async existsByProperties(parameters, callback) {
const config = {
url: "/rest/devinfo/0.10/existsByProperties",
method: "GET",
params: {
_updateSequenceId: parameters.updateSequenceId
}
};
return this.client.sendRequest(config, callback);
}
async deleteEntity(parameters, callback) {
const config = {
url: `/rest/devinfo/0.10/repository/${parameters.repositoryId}/${parameters.entityType}/${parameters.entityId}`,
method: "DELETE",
params: {
_updateSequenceId: parameters.updateSequenceId
}
};
return this.client.sendRequest(config, callback);
}
};
// src/agile/devopsComponents.ts
var DevopsComponents = class {
constructor(client) {
this.client = client;
}
async submitComponents(parameters, callback) {
const config = {
url: "/rest/devopscomponents/1.0/bulk",
method: "POST",
data: {
properties: parameters.properties,
components: parameters.components,
providerMetadata: parameters.providerMetadata
}
};
return this.client.sendRequest(config, callback);
}
async deleteComponentsByProperty(parameters, callback) {
const config = {
url: "/rest/devopscomponents/1.0/bulkByProperties",
method: "DELETE",
params: parameters
};
return this.client.sendRequest(config, callback);
}
async getComponentById(parameters, callback) {
const config = {
url: `/rest/devopscomponents/1.0/${parameters.componentId}`,
method: "GET"
};
return this.client.sendRequest(config, callback);
}
async deleteComponentById(parameters, callback) {
const config = {
url: `/rest/devopscomponents/1.0/${parameters.componentId}`,
method: "DELETE"
};
return this.client.sendRequest(config, callback);
}
};
// src/agile/epic.ts
var Epic = class {
constructor(client) {
this.client = client;
}
async getIssuesWithoutEpic(parameters, callback) {
const config = {
url: "/rest/agile/1.0/epic/none/issue",
method: "GET",
params: {
startAt: parameters?.startAt,
maxResults: parameters?.maxResults,
jql: parameters?.jql,
validateQuery: parameters?.validateQuery,
fields: parameters?.fields,
expand: parameters?.expand
}
};
return this.client.sendRequest(config, callback);
}
async removeIssuesFromEpic(parameters, callback) {
const config = {
url: "/rest/agile/1.0/epic/none/issue",
method: "POST",
data: {
issues: parameters?.issues
}
};
return this.client.sendRequest(config, callback);
}
async getEpic(parameters, callback) {
const config = {
url: `/rest/agile/1.0/epic/${parameters.epicIdOrKey}`,
method: "GET"
};
return this.client.sendRequest(config, callback);
}
async partiallyUpdateEpic(parameters, callback) {
const config = {
url: `/rest/agile/1.0/epic/${parameters.epicIdOrKey}`,
method: "POST",
data: {
color: parameters.color,
done: parameters.done,
name: parameters.name,
summary: parameters.summary
}
};
return this.client.sendRequest(config, callback);
}
async getIssuesForEpic(parameters, callback) {
const config = {
url: `/rest/agile/1.0/epic/${parameters.epicIdOrKey}/issue`,
method: "GET",
params: {
startAt: parameters.startAt,
maxResults: parameters.maxResults,
jql: parameters.jql,
validateQuery: parameters.validateQuery,
fields: parameters.fields,
expand: parameters.expand
}
};
return this.client.sendRequest(config, callback);
}
async moveIssuesToEpic(parameters, callback) {
const config = {
url: `/rest/agile/1.0/epic/${parameters.epicIdOrKey}/issue`,
method: "POST",
data: {
issues: parameters.issues
}
};
return this.client.sendRequest(config, callback);
}
async rankEpics(parameters, callback) {
const config = {
url: `/rest/agile/1.0/epic/${parameters.epicIdOrKey}/rank`,
method: "PUT",
data: {
rankAfterEpic: parameters.rankAfterEpic,
rankBeforeEpic: parameters.rankBeforeEpic,
rankCustomFieldId: parameters.rankCustomFieldId
}
};
return this.client.sendRequest(config, callback);
}
};
// src/agile/featureFlags.ts
var FeatureFlags = class {
constructor(client) {
this.client = client;
}
async submitFeatureFlags(parameters, callback) {
const config = {
url: "/rest/featureflags/0.1/bulk",
method: "POST",
data: {
properties: parameters.properties,
flags: parameters.flags,
providerMetadata: parameters.providerMetadata
}
};
return this.client.sendRequest(config, callback);
}
async deleteFeatureFlagsByProperty(parameters, callback) {
const config = {
url: "/rest/featureflags/0.1/bulkByProperties",
method: "DELETE",
params: {
_updateSequenceId: parameters.updateSequenceId
}
};
return this.client.sendRequest(config, callback);
}
async getFeatureFlagById(parameters, callback) {
const config = {
url: `/rest/featureflags/0.1/flag/${parameters.featureFlagId}`,
method: "GET"
};
return this.client.sendRequest(config, callback);
}
async deleteFeatureFlagById(parameters, callback) {
const config = {
url: `/rest/featureflags/0.1/flag/${parameters.featureFlagId}`,
method: "DELETE",
params: {
_updateSequenceId: parameters.updateSequenceId
}
};
return this.client.sendRequest(config, callback);
}
};
// src/agile/issue.ts
var Issue = class {
constructor(client) {
this.client = client;
}
async rankIssues(parameters, callback) {
const config = {
url: "/rest/agile/1.0/issue/rank",
method: "PUT",
data: {
issues: parameters.issues,
rankAfterIssue: parameters.rankAfterIssue,
rankBeforeIssue: parameters.rankBeforeIssue,
rankCustomFieldId: parameters.rankCustomFieldId
}
};
return this.client.sendRequest(config, callback);
}
async getIssue(parameters, callback) {
const config = {
url: `/rest/agile/1.0/issue/${parameters.issueIdOrKey}`,
method: "GET",
params: {
fields: parameters.fields,
expand: parameters.expand,
updateHistory: parameters.updateHistory
}
};
return this.client.sendRequest(config, callback);
}
async getIssueEstimationForBoard(parameters, callback) {
const config = {
url: `/rest/agile/1.0/issue/${parameters.issueIdOrKey}/estimation`,
method: "GET",
params: {
boardId: parameters.boardId
}
};
return this.client.sendRequest(config, callback);
}
async estimateIssueForBoard(parameters, callback) {
const config = {
url: `/rest/agile/1.0/issue/${parameters.issueIdOrKey}/estimation`,
method: "PUT",
params: {
boardId: parameters.boardId
},
data: {
value: parameters.value
}
};
return this.client.sendRequest(config, callback);
}
};
// src/agile/operations.ts
var Operations = class {
constructor(client) {
this.client = client;
}
async submitOperationsWorkspaces(parameters, callback) {
const config = {
url: "/rest/operations/1.0/linkedWorkspaces/bulk",
method: "POST",
data: {
workspaceIds: parameters.workspaceIds
}
};
return this.client.sendRequest(config, callback);
}
async deleteWorkspaces(parameters, callback) {
const config = {
url: "/rest/operations/1.0/linkedWorkspaces/bulk",
method: "DELETE",
params: {
workspaceIds: parameters.workspaceIds.join(",")
}
};
return this.client.sendRequest(config, callback);
}
async getWorkspaces(parameters, callback) {
const config = {
url: "/rest/operations/1.0/linkedWorkspaces",
method: "GET",
params: {
workspaceId: parameters.workspaceId
}
};
return this.client.sendRequest(config, callback);
}
async submitEntity(parameters, callback) {
const config = {
url: "/rest/operations/1.0/bulk",
method: "POST",
data: parameters
};
return this.client.sendRequest(config, callback);
}
async deleteEntityByProperty(parameters, callback) {
const config = {
url: "/rest/operations/1.0/bulkByProperties",
method: "DELETE",
params: parameters
};
return this.client.sendRequest(config, callback);
}
async getIncidentById(parameters, callback) {
const config = {
url: `/rest/operations/1.0/incidents/${parameters.incidentId}`,
method: "GET"
};
return this.client.sendRequest(config, callback);
}
async deleteIncidentById(parameters, callback) {
const config = {
url: `/rest/operations/1.0/incidents/${parameters.incidentId}`,
method: "DELETE"
};
return this.client.sendRequest(config, callback);
}
async getReviewById(parameters, callback) {
const config = {
url: `/rest/operations/1.0/post-incident-reviews/${parameters.reviewId}`,
method: "GET"
};
return this.client.sendRequest(config, callback);
}
async deleteReviewById(parameters, callback) {
const config = {
url: `/rest/operations/1.0/post-incident-reviews/${parameters.reviewId}`,
method: "DELETE"
};
return this.client.sendRequest(config, callback);
}
};
// src/agile/remoteLinks.ts
var RemoteLinks = class {
constructor(client) {
this.client = client;
}
async submitRemoteLinks(parameters, callback) {
const config = {
url: "/rest/remotelinks/1.0/bulk",
method: "POST",
data: {
properties: parameters.properties,
remoteLinks: parameters.remoteLinks,
providerMetadata: parameters.providerMetadata
}
};
return this.client.sendRequest(config, callback);
}
async deleteRemoteLinksByProperty(parameters, callback) {
const config = {
url: "/rest/remotelinks/1.0/bulkByProperties",
method: "DELETE",
params: {
_updateSequenceNumber: parameters.updateSequenceNumber,
params: parameters.params
}
};
return this.client.sendRequest(config, callback);
}
async getRemoteLinkById(parameters, callback) {
const config = {
url: `/rest/remotelinks/1.0/remotelink/${parameters.remoteLinkId}`,
method: "GET"
};
return this.client.sendRequest(config, callback);
}
async deleteRemoteLinkById(parameters, callback) {
const config = {
url: `/rest/remotelinks/1.0/remotelink/${parameters.remoteLinkId}`,
method: "DELETE",
params: {
_updateSequenceNumber: parameters.updateSequenceNumber
}
};
return this.client.sendRequest(config, callback);
}
};
// src/agile/securityInformation.ts
var SecurityInformation = class {
constructor(client) {
this.client = client;
}
async submitWorkspaces(parameters, callback) {
const config = {
url: "/rest/security/1.0/linkedWorkspaces/bulk",
method: "POST",
data: {
workspaceIds: parameters.workspaceIds
}
};
return this.client.sendRequest(config, callback);
}
async deleteLinkedWorkspaces(parameters, callback) {
const config = {
url: "/rest/security/1.0/linkedWorkspaces/bulk",
method: "DELETE",
params: {
workspaceIds: parameters.workspaceIds
}
};
return this.client.sendRequest(config, callback);
}
async getLinkedWorkspaces(callback) {
const config = {
url: "/rest/security/1.0/linkedWorkspaces",
method: "GET"
};
return this.client.sendRequest(config, callback);
}
async getLinkedWorkspaceById(parameters, callback) {
const config = {
url: `/rest/security/1.0/linkedWorkspaces/${parameters.workspaceId}`,
method: "GET"
};
return this.client.sendRequest(config, callback);
}
async submitVulnerabilities(parameters, callback) {
const config = {
url: "/rest/security/1.0/bulk",
method: "POST",
data: {
operationType: parameters.operationType,
properties: parameters.properties,
vulnerabilities: parameters.vulnerabilities,
providerMetadata: parameters.providerMetadata
}
};
return this.client.sendRequest(config, callback);
}
async deleteVulnerabilitiesByProperty(parameters, callback) {
const config = {
url: "/rest/security/1.0/bulkByProperties",
method: "DELETE",
params: parameters
};
return this.client.sendRequest(config, callback);
}
async getVulnerabilityById(parameters, callback) {
const config = {
url: `/rest/security/1.0/vulnerability/${parameters.vulnerabilityId}`,
method: "GET"
};
return this.client.sendRequest(config, callback);
}
async deleteVulnerabilityById(parameters, callback) {
const config = {
url: `/rest/security/1.0/vulnerability/${parameters.vulnerabilityId}`,
method: "DELETE"
};
return this.client.sendRequest(config, callback);
}
};
// src/agile/sprint.ts
var Sprint = class {
constructor(client) {
this.client = client;
}
async createSprint(parameters, callback) {
const config = {
url: "/rest/agile/1.0/sprint",
method: "POST",
data: {
endDate: parameters.endDate,
goal: parameters.goal,
name: parameters.name,
originBoardId: parameters.originBoardId,
startDate: parameters.startDate
}
};
return this.client.sendRequest(config, callback);
}
async getSprint(parameters, callback) {
const config = {
url: `/rest/agile/1.0/sprint/${parameters.sprintId}`,
method: "GET"
};
return this.client.sendRequest(config, callback);
}
async partiallyUpdateSprint(parameters, callback) {
const config = {
url: `/rest/agile/1.0/sprint/${parameters.sprintId}`,
method: "POST",
data: {
completeDate: parameters.completeDate,
createdDate: parameters.createdDate,
endDate: parameters.endDate,
goal: parameters.goal,
id: parameters.id,
name: parameters.name,
originBoardId: parameters.originBoardId,
self: parameters.self,
startDate: parameters.startDate,
state: parameters.state
}
};
return this.client.sendRequest(config, callback);
}
async updateSprint(parameters, callback) {
const config = {
url: `/rest/agile/1.0/sprint/${parameters.sprintId}`,
method: "PUT",
data: {
completeDate: parameters.completeDate,
createdDate: parameters.createdDate,
endDate: parameters.endDate,
goal: parameters.goal,
id: parameters.id,
name: parameters.name,
originBoardId: parameters.originBoardId,
self: parameters.self,
startDate: parameters.startDate,
state: parameters.state
}
};
return this.client.sendRequest(config, callback);
}
async deleteSprint(parameters, callback) {
const config = {
url: `/rest/agile/1.0/sprint/${parameters.sprintId}`,
method: "DELETE"
};
return this.client.sendRequest(config, callback);
}
async getIssuesForSprint(parameters, callback) {
const config = {
url: `/rest/agile/1.0/sprint/${parameters.sprintId}/issue`,
method: "GET",
params: {
startAt: parameters.startAt,
maxResults: parameters.maxResults,
jql: parameters.jql,
validateQuery: parameters.validateQuery,
fields: parameters.fields,
expand: parameters.expand
}
};
return this.client.sendRequest(config, callback);
}
async moveIssuesToSprintAndRank(parameters, callback) {
const config = {
url: `/rest/agile/1.0/sprint/${parameters.sprintId}/issue`,
method: "POST",
data: {
issues: parameters.issues,
rankAfterIssue: parameters.rankAfterIssue,
rankBeforeIssue: parameters.rankBeforeIssue,
rankCustomFieldId: parameters.rankCustomFieldId
}
};
return this.client.sendRequest(config, callback);
}
async getPropertiesKeys(parameters, callback) {
const config = {
url: `/rest/agile/1.0/sprint/${parameters.sprintId}/properties`,
method: "GET"
};
return this.client.sendRequest(config, callback);
}
async getProperty(parameters, callback) {
const config = {
url: `/rest/agile/1.0/sprint/${parameters.sprintId}/properties/${parameters.propertyKey}`,
method: "GET"
};
return this.client.sendRequest(config, callback);
}
async setProperty(parameters, callback) {
const config = {
url: `/rest/agile/1.0/sprint/${parameters.sprintId}/properties/${parameters.propertyKey}`,
method: "PUT"
};
return this.client.sendRequest(config, callback);
}
async deleteProperty(parameters, callback) {
const config = {
url: `/rest/agile/1.0/sprint/${parameters.sprintId}/properties/${parameters.propertyKey}`,
method: "DELETE"
};
return this.client.sendRequest(config, callback);
}
async swapSprint(parameters, callback) {
const config = {
url: `/rest/agile/1.0/sprint/${parameters.sprintId}/swap`,
method: "POST",
data: {
sprintToSwapWith: parameters.sprintToSwapWith
}
};
return this.client.sendRequest(config, callback);
}
};
// src/agile/models/index.ts
var models_exports = {};
// src/agile/parameters/index.ts
var parameters_exports = {};
// src/clients/baseClient.ts
import axios from "axios";
// src/config.ts
import { z } from "zod";
var BasicAuthSchema = z.object({
email: z.string(),
apiToken: z.string()
}).strict();
var OAuth2Schema = z.object({
accessToken: z.string()
}).strict();
var MiddlewaresSchema = z.object({
onError: z.function().args(z.any()).returns(z.void()).optional(),
onResponse: z.function().args(z.any()).returns(z.void()).optional()
}).strict();
var ConfigSchema = z.object({
host: z.string().url(),
strictGDPR: z.boolean().optional(),
/** Adds `'X-Atlassian-Token': 'no-check'` to each request header */
noCheckAtlassianToken: z.boolean().optional(),
baseRequestConfig: z.any().optional(),
authentication: z.union([z.object({ basic: BasicAuthSchema }), z.object({ oauth2: OAuth2Schema })]).optional(),
middlewares: MiddlewaresSchema.optional()
}).strict();
// src/services/authenticationService/base64Encoder.ts
var base64Sequence = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var utf8Encode = (value) => {
value = value.replace(/\r\n/g, "\n");
let utftext = "";
for (let n = 0; n < value.length; n++) {
const c = value.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
} else if (c > 127 && c < 2048) {
utftext += String.fromCharCode(c >> 6 | 192);
utftext += String.fromCharCode(c & 63 | 128);
} else {
utftext += String.fromCharCode(c >> 12 | 224);
utftext += String.fromCharCode(c >> 6 & 63 | 128);
utftext += String.fromCharCode(c & 63 | 128);
}
}
return utftext;
};
var encode = (input) => {
let output = "";
let chr1;
let chr2;
let chr3;
let enc1;
let enc2;
let enc3;
let enc4;
let i = 0;
input = utf8Encode(input);
while (i < input.length) {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = (chr1 & 3) << 4 | chr2 >> 4;
enc3 = (chr2 & 15) << 2 | chr3 >> 6;
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
output += `${base64Sequence.charAt(enc1)}${base64Sequence.charAt(enc2)}${base64Sequence.charAt(
enc3
)}${base64Sequence.charAt(enc4)}`;
}
return output;
};
// src/services/authenticationService/authentications/createBasicAuthenticationToken.ts
function createBasicAuthenticationToken(authenticationData) {
const login = authenticationData.email;
const secret = authenticationData.apiToken;
const token = encode(`${login}:${secret}`);
return `Basic ${token}`;
}
// src/services/authenticationService/authentications/createOAuth2AuthenticationToken.ts
function createOAuth2AuthenticationToken(authenticationData) {
return `Bearer ${authenticationData.accessToken}`;
}
// src/services/authenticationService/getAuthenticationToken.ts
async function getAuthenticationToken(authentication) {
if (!authentication) {
return void 0;
}
if ("basic" in authentication) {
return createBasicAuthenticationToken(authentication.basic);
}
return createOAuth2AuthenticationToken(authentication.oauth2);
}
// src/clients/httpException.ts
var isUndefined = (obj) => typeof obj === "undefined";
var isNil = (val) => isUndefined(val) || val === null;
var isObject = (fn) => !isNil(fn) && typeof fn === "object";
var isString = (val) => typeof val === "string";
var isNumber = (val) => typeof val === "number";
var DEFAULT_EXCEPTION_STATUS = 500;
var DEFAULT_EXCEPTION_MESSAGE = "Something went wrong";
var DEFAULT_EXCEPTION_CODE = "INTERNAL_SERVER_ERROR";
var DEFAULT_EXCEPTION_STATUS_TEXT = "Internal server error";
var HttpException = class extends Error {
/**
* Instantiate a plain HTTP Exception.
*
* @example
* throw new HttpException('message', HttpStatus.BAD_REQUEST);
* throw new HttpException('custom message', HttpStatus.BAD_REQUEST, {
* cause: new Error('Cause Error'),
* });
*
* @param response String, object describing the error condition or the error cause.
* @param status HTTP response status code.
* @param options An object used to add an error cause. Configures error chaining support
* @usageNotes
* The constructor arguments define the response and the HTTP response status code.
* - The `response` argument (required) defines the JSON response body. alternatively, it can also be
* an error object that is used to define an error [cause](https://nodejs.org/en/blog/release/v16.9.0/#error-cause).
* - The `status` argument (optional) defines the HTTP Status Code.
* - The `options` argument (optional) defines additional error options. Currently, it supports the `cause` attribute,
* and can be used as an alternative way to specify the error cause: `const error = new HttpException('description', 400, { cause: new Error() });`
*
* By default, the JSON response body contains two properties:
* - `statusCode`: the Http Status Code.
* - `message`: a short description of the HTTP error by default; override this
* by supplying a string in the `response` parameter.
*
* The `status` argument is required, and should be a valid HTTP status code.
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
* @see https://nodejs.org/en/blog/release/v16.9.0/#error-cause
* @see https://github.com/microsoft/TypeScript/issues/45167
*/
constructor(response, status, options) {
super();
this.response = response;
this.name = this.initName();
this.cause = this.initCause(response, options);
this.code = this.initCode(response);
this.message = this.initMessage(response);
this.status = this.initStatus(response, status);
this.statusText = this.initStatusText(response, this.status);
}
cause;
code;
status;
statusText;
initMessage(response) {
if (isString(response)) {
return response;
}
if (isObject(response) && isString(response.message)) {
return response.message;
}
if (this.constructor) {
return this.constructor.name.match(/[A-Z][a-z]+|[0-9]+/g)?.join(" ") ?? "Error";
}
return DEFAULT_EXCEPTION_MESSAGE;
}
initCause(response, options) {
if (options?.cause) {
return options.cause;
}
if (isObject(response) && isObject(response.cause)) {
return response.cause;
}
return void 0;
}
initCode(response) {
if (isObject(response) && isString(response.code)) {
return response.code;
}
return DEFAULT_EXCEPTION_CODE;
}
initName() {
return this.constructor.name;
}
initStatus(response, status) {
if (status) {
return status;
}
if (isObject(response) && isNumber(response.status)) {
return response.status;
}
if (isObject(response) && isNumber(response.statusCode)) {
return response.statusCode;
}
return DEFAULT_EXCEPTION_STATUS;
}
initStatusText(response, status) {
if (isObject(response) && isString(response.statusText)) {
return response.statusText;
}
return status ? void 0 : DEFAULT_EXCEPTION_STATUS_TEXT;
}
};
// src/clients/baseClient.ts
import { ZodError } from "zod";
var STRICT_GDPR_FLAG = "x-atlassian-force-account-id";
var ATLASSIAN_TOKEN_CHECK_FLAG = "X-Atlassian-Token";
var ATLASSIAN_TOKEN_CHECK_NOCHECK_VALUE = "no-check";
var BaseClient = class {
constructor(config) {
this.config = config;
try {
this.config = ConfigSchema.parse(config);
} catch (e) {
if (e instanceof ZodError && e.errors[0].message === "Invalid url") {
throw new Error(
"Couldn't parse the host URL. Perhaps you forgot to add 'http://' or 'https://' at the beginning of the URL?"
);
}
throw e;
}
this.instance = axios.create({
paramsSerializer: this.paramSerializer.bind(this),
...config.baseRequestConfig,
baseURL: config.host,
headers: this.removeUndefinedProperties({
[STRICT_GDPR_FLAG]: config.strictGDPR,
[ATLASSIAN_TOKEN_CHECK_FLAG]: config.noCheckAtlassianToken ? ATLASSIAN_TOKEN_CHECK_NOCHECK_VALUE : void 0,
...config.baseRequestConfig?.headers
})
});
}
instance;
paramSerializer(parameters) {
const parts = [];
Object.entries(parameters).forEach(([key, value]) => {
if (value === null || typeof value === "undefined") {
return;
}
if (Array.isArray(value)) {
value = value.join(",");
}
if (value instanceof Date) {
value = value.toISOString();
} else if (value !== null && typeof value === "object") {
value = JSON.stringify(value);
} else if (value instanceof Function) {
const part = value();
return part && parts.push(part);
}
parts.push(`${this.encode(key)}=${this.encode(value)}`);
});
return parts.join("&");
}
encode(value) {
return encodeURIComponent(value).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
}
removeUndefinedProperties(obj) {
return Object.entries(obj).filter(([, value]) => typeof value !== "undefined").reduce((accumulator, [key, value]) => ({ ...accumulator, [key]: value }), {});
}
async sendRequest(requestConfig, callback) {
try {
const response = await this.sendRequestFullResponse(requestConfig);
return this.handleSuccessResponse(response.data, callback);
} catch (e) {
return this.handleFailedResponse(e, callback);
}
}
async sendRequestFullResponse(requestConfig) {
const modifiedRequestConfig = {
...requestConfig,
headers: this.removeUndefinedProperties({
Authorization: await getAuthenticationToken(this.config.authentication),
...requestConfig.headers
})
};
return this.instance.request(modifiedRequestConfig);
}
handleSuccessResponse(response, callback) {
const callbackResponseHandler = callback && ((data) => callback(null, data));
const defaultResponseHandler = (data) => data;
const responseHandler = callbackResponseHandler ?? defaultResponseHandler;
this.config.middlewares?.onResponse?.(response.data);
return responseHandler(response);
}
handleFailedResponse(e, callback) {
const err = this.buildErrorHandlingResponse(e);
const callbackErrorHandler = callback && ((error) => callback(error));
const defaultErrorHandler = (error) => {
throw error;
};
const errorHandler = callbackErrorHandler ?? defaultErrorHandler;
this.config.middlewares?.onError?.(err);
return errorHandler(err);
}
buildErrorHandlingResponse(e) {
if (axios.isAxiosError(e) && e.response) {
return new HttpException(
{
code: e.code,
message: e.message,
data: e.response.data,
status: e.response.status,
statusText: e.response.statusText
},
e.response.status,
{ cause: e }
);
}
if (axios.isAxiosError(e)) {
return e;
}
if (isObject(e) && isObject(e.response)) {
return new HttpException(e.response);
}
if (e instanceof Error) {
return new HttpException(e);
}
return new HttpException("Unknown error occurred.", 500, { cause: e });
}
};
// src/agile/client/agileClient.ts
var AgileClient = class extends BaseClient {
backlog = new Backlog(this);
board = new Board(this);
builds = new Builds(this);
deployments = new Deployments(this);
developmentInformation = new DevelopmentInformation(this);
devopsComponents = new DevopsComponents(this);
epic = new Epic(this);
featureFlags = new FeatureFlags(this);
issue = new Issue(this);
operations = new Operations(this);
remoteLinks = new RemoteLinks(this);
securityInformation = new SecurityInformation(this);
sprint = new Sprint(this);
};
// src/version2/index.ts
var version2_exports = {};
__export(version2_exports, {
AnnouncementBanner: () => AnnouncementBanner,
AppDataPolicies: () => AppDataPolicies,
AppMigration: () => AppMigration,
AppProperties: () => AppProperties,
ApplicationRoles: () => ApplicationRoles,
AuditRecords: () => AuditRecords,
Avatars: () => Avatars,
ClassificationLevels: () => ClassificationLevels,
Dashboards: () => Dashboards,
DynamicModules: () => DynamicModules,
FilterSharing: () => FilterSharing,
Filters: () => Filters,
GroupAndUserPicker: () => GroupAndUserPicker,
Groups: () => Groups,
IssueAttachments: () => IssueAttachments,
IssueCommentProperties: () => IssueCommentProperties,
IssueComments: () => IssueComments,
IssueCustomFieldAssociations: () => IssueCustomFieldAssociations,
IssueCustomFieldConfigurationApps: () => IssueCustomFieldConfigurationApps,
IssueCustomFieldContexts: () => IssueCustomFieldContexts,
IssueCustomFieldOptions: () => IssueCustomFieldOptions,
IssueCustomFieldOptionsApps: () => IssueCustomFieldOptionsApps,
IssueCustomFieldValuesApps: () => IssueCustomFieldValuesApps,
IssueFieldConfigurations: () => IssueFieldConfigurations,
IssueFields: () => IssueFields,
IssueLinkTypes: () => IssueLinkTypes,
IssueLinks: () => IssueLinks,
IssueNavigatorSettings: () => IssueNavigatorSettings,
IssueNotificationSchemes: () => IssueNotificationSchemes,
IssuePriorities: () => IssuePriorities,
IssueProperties: () => IssueProperties,
IssueRemoteLinks: () => IssueRemoteLinks,
IssueResolutions: () => IssueResolutions,
IssueSearch: () => IssueSearch,
IssueSecurityLevel: () => IssueSecurityLevel,
IssueSecuritySchemes: () => IssueSecuritySchemes,
IssueTypeProperties: () => IssueTypeProperties,
IssueTypeSchemes: () => IssueTypeSchemes,
IssueTypeScreenSchemes: () => IssueTypeScreenSchemes,
IssueTypes: () => IssueTypes,
IssueVotes: () => IssueVotes,
IssueWatchers: () => IssueWatchers,
IssueWorklogProperties: () => IssueWorklogProperties,
IssueWorklogs: () => IssueWorklogs,
Issues: () => Issues,
JQL: () => JQL,
JiraExpressions: () => JiraExpressions,
JiraSettings: () => JiraSettings,
JqlFunctionsApps: () => JqlFunctionsApps,
Labels: () => Labels,
LicenseMetrics: () => LicenseMetrics,
Myself: () => Myself,
PermissionSchemes: () => PermissionSchemes,
Permissions: () => Permissions,
Plans: () => Plans,
PrioritySchemes: () => PrioritySchemes,
ProjectAvatars: () => ProjectAvatars,
ProjectCategories: () => ProjectCategories,
ProjectClassificationLevels: () => ProjectClassificationLevels,
ProjectComponents: () => ProjectComponents,
ProjectEmail: () => ProjectEmail,
ProjectFeatures: () => ProjectFeatures,
ProjectKeyAndNameValidation: () => ProjectKeyAndNameValidation,
ProjectPermissionSchemes: () => ProjectPermissionSchemes,
ProjectProperties: () => ProjectProperties,
ProjectRoleActors: () => ProjectRoleActors,
ProjectRoles: () => ProjectRoles,
ProjectTemplates: () => ProjectTemplates,
ProjectTypes: () => ProjectTypes,
ProjectVersions: () => ProjectVersions,
Projects: () => Projects,
ScreenSchemes: () => ScreenSchemes,
ScreenTabFields: () => ScreenTabFields,
ScreenTabs: () => ScreenTabs,
Screens: () => Screens,
ServerInfo: () => ServerInfo,
ServiceRegistry: () => ServiceRegistry,
Status: () => Status,
Tasks: () => Tasks,
TeamsInPlan: () => TeamsInPlan,
TimeTracking: () => TimeTracking,
UIModificationsApps: () => UIModificationsApps,
UserNavProperties: () => UserNavProperties,
UserProperties: () => UserProperties,
UserSearch: () => UserSearch,
Users: () => Users,
Version2Client: () => Version2Client,
Version2Models: () => models_exports2,
Version2Parameters: () => parameters_exports2,
Webhooks: () => Webhooks,
WorkflowSchemeDrafts: () => WorkflowSchemeDrafts,
WorkflowSchemeProjectAssociations: () => WorkflowSchemeProjectAssociations,
WorkflowSchemes: () => WorkflowSchemes,
WorkflowStatusCategories: () => WorkflowStatusCategories,
WorkflowStatuses: () => WorkflowStatuses,
WorkflowTransitionProperties: () => WorkflowTransitionProperties,
WorkflowTransitionRules: () => WorkflowTransitionRules,
Workflows: () => Workflows
});
// src/version2/announcementBanner.ts
var AnnouncementBanner = class {
constructor(client) {
this.client = client;
}
async getBanner(callback) {
const config = {
url: "/rest/api/2/announcementBanner",
method: "GET"
};
return this.client.sendRequest(config, callback);
}
async setBanner(parameters, callback) {
const config = {
url: "/rest/api/2/announcementBanner",
method: "PUT",
data: {
isDismissible: parameters.isDismissible,
isEnabled: parameters.isEnabled,
message: parameters.message,
visibility: parameters.visibility
}
};
return this.client.sendRequest(config, callback);
}
};
// src/version2/appDataPolicies.ts
var AppDataPolicies = class {
constructor(client) {
this.client = client;
}
async getPolicy(callback) {
const config = {
url: "/rest/api/2/data-policy",
method: "GET"
};
return this.c