@felixgeelhaar/jira-sdk 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -13182,12 +13182,24 @@ var IssueLinkTypeSchema = external_exports.object({
13182
13182
  outward: external_exports.string(),
13183
13183
  self: external_exports.url().optional()
13184
13184
  });
13185
+ var LinkedIssueFieldsSchema = external_exports.object({
13186
+ summary: external_exports.string().optional(),
13187
+ status: IssueStatusSchema.optional(),
13188
+ priority: IssuePrioritySchema.nullable().optional(),
13189
+ issuetype: IssueTypeSchema.optional()
13190
+ });
13191
+ var LinkedIssueSchema = external_exports.object({
13192
+ id: external_exports.string(),
13193
+ key: external_exports.string(),
13194
+ self: external_exports.url().optional(),
13195
+ fields: LinkedIssueFieldsSchema.optional()
13196
+ });
13185
13197
  var IssueLinkSchema = external_exports.object({
13186
13198
  id: external_exports.string(),
13187
13199
  self: external_exports.url().optional(),
13188
13200
  type: IssueLinkTypeSchema,
13189
- inwardIssue: IssueRefSchema.optional(),
13190
- outwardIssue: IssueRefSchema.optional()
13201
+ inwardIssue: LinkedIssueSchema.optional(),
13202
+ outwardIssue: LinkedIssueSchema.optional()
13191
13203
  });
13192
13204
  var CreateIssueLinkInputSchema = external_exports.object({
13193
13205
  type: external_exports.object({
@@ -13207,6 +13219,41 @@ var CreateIssueLinkInputSchema = external_exports.object({
13207
13219
  var IssueLinkTypesResponseSchema = external_exports.object({
13208
13220
  issueLinkTypes: external_exports.array(IssueLinkTypeSchema)
13209
13221
  });
13222
+ function blocksLinkType() {
13223
+ return {
13224
+ name: "Blocks",
13225
+ inward: "is blocked by",
13226
+ outward: "blocks"
13227
+ };
13228
+ }
13229
+ function duplicatesLinkType() {
13230
+ return {
13231
+ name: "Duplicate",
13232
+ inward: "is duplicated by",
13233
+ outward: "duplicates"
13234
+ };
13235
+ }
13236
+ function relatesToLinkType() {
13237
+ return {
13238
+ name: "Relates",
13239
+ inward: "relates to",
13240
+ outward: "relates to"
13241
+ };
13242
+ }
13243
+ function causesLinkType() {
13244
+ return {
13245
+ name: "Causes",
13246
+ inward: "is caused by",
13247
+ outward: "causes"
13248
+ };
13249
+ }
13250
+ function clonesLinkType() {
13251
+ return {
13252
+ name: "Cloners",
13253
+ inward: "is cloned by",
13254
+ outward: "clones"
13255
+ };
13256
+ }
13210
13257
  var WatchersSchema = external_exports.object({
13211
13258
  self: external_exports.url(),
13212
13259
  watchCount: external_exports.number().int().min(0),
@@ -13575,6 +13622,139 @@ var IssueService = class extends BaseService {
13575
13622
  async removeVote(issueIdOrKey) {
13576
13623
  await this.deleteMethod(`/issue/${issueIdOrKey}/votes`);
13577
13624
  }
13625
+ // Attachments
13626
+ /**
13627
+ * Add an attachment to an issue
13628
+ *
13629
+ * @param issueIdOrKey - Issue ID or key
13630
+ * @param file - File or Blob to upload
13631
+ * @param filename - Optional filename (defaults to File.name or 'attachment')
13632
+ * @returns Array of created attachments
13633
+ *
13634
+ * @example
13635
+ * ```typescript
13636
+ * const file = new File(['content'], 'document.txt', { type: 'text/plain' });
13637
+ * const attachments = await client.issues.addAttachment('PROJECT-123', file);
13638
+ * ```
13639
+ */
13640
+ async addAttachment(issueIdOrKey, file2, filename) {
13641
+ const formData = new FormData();
13642
+ const name = filename ?? (file2 instanceof File ? file2.name : "attachment");
13643
+ formData.append("file", file2, name);
13644
+ const response = await this.http.post(
13645
+ this.buildPath(`/issue/${issueIdOrKey}/attachments`),
13646
+ formData,
13647
+ {
13648
+ headers: {
13649
+ "X-Atlassian-Token": "no-check"
13650
+ }
13651
+ }
13652
+ );
13653
+ return this.validateResponse(response, AddAttachmentResponseSchema);
13654
+ }
13655
+ /**
13656
+ * Get attachment metadata by ID
13657
+ *
13658
+ * @param attachmentId - Attachment ID
13659
+ * @returns Attachment metadata
13660
+ */
13661
+ async getAttachment(attachmentId) {
13662
+ return this.getMethod(`/attachment/${attachmentId}`, AttachmentMetadataSchema);
13663
+ }
13664
+ /**
13665
+ * Download attachment content
13666
+ *
13667
+ * @param attachmentId - Attachment ID
13668
+ * @returns Blob containing the attachment content
13669
+ */
13670
+ async downloadAttachment(attachmentId) {
13671
+ const response = await this.http.request({
13672
+ method: "GET",
13673
+ url: this.buildPath(`/attachment/content/${attachmentId}`),
13674
+ headers: {
13675
+ Accept: "*/*"
13676
+ },
13677
+ metadata: { rawResponse: true }
13678
+ });
13679
+ return response.data;
13680
+ }
13681
+ /**
13682
+ * Delete an attachment
13683
+ *
13684
+ * @param attachmentId - Attachment ID
13685
+ */
13686
+ async deleteAttachment(attachmentId) {
13687
+ await this.deleteMethod(`/attachment/${attachmentId}`);
13688
+ }
13689
+ // Issue Links
13690
+ /**
13691
+ * Get all links for an issue
13692
+ *
13693
+ * @param issueIdOrKey - Issue ID or key
13694
+ * @returns Array of issue links
13695
+ */
13696
+ async getIssueLinks(issueIdOrKey) {
13697
+ const issue2 = await this.get(issueIdOrKey, {
13698
+ fields: ["issuelinks"]
13699
+ });
13700
+ const links = issue2.fields["issuelinks"];
13701
+ if (!links || !Array.isArray(links)) {
13702
+ return [];
13703
+ }
13704
+ return links.map((link) => IssueLinkSchema.parse(link));
13705
+ }
13706
+ /**
13707
+ * Create a link between two issues
13708
+ *
13709
+ * @param input - Issue link creation input
13710
+ *
13711
+ * @example
13712
+ * ```typescript
13713
+ * await client.issues.createIssueLink({
13714
+ * type: { name: 'Blocks' },
13715
+ * inwardIssue: { key: 'PROJECT-123' },
13716
+ * outwardIssue: { key: 'PROJECT-456' },
13717
+ * });
13718
+ * ```
13719
+ */
13720
+ async createIssueLink(input) {
13721
+ const validatedInput = CreateIssueLinkInputSchema.parse(input);
13722
+ await this.postMethodRaw("/issueLink", validatedInput);
13723
+ }
13724
+ /**
13725
+ * Get an issue link by ID
13726
+ *
13727
+ * @param linkId - Issue link ID
13728
+ * @returns Issue link
13729
+ */
13730
+ async getIssueLink(linkId) {
13731
+ return this.getMethod(`/issueLink/${linkId}`, IssueLinkSchema);
13732
+ }
13733
+ /**
13734
+ * Delete an issue link
13735
+ *
13736
+ * @param linkId - Issue link ID
13737
+ */
13738
+ async deleteIssueLink(linkId) {
13739
+ await this.deleteMethod(`/issueLink/${linkId}`);
13740
+ }
13741
+ /**
13742
+ * List all available issue link types
13743
+ *
13744
+ * @returns Issue link types response
13745
+ */
13746
+ async listIssueLinkTypes() {
13747
+ return this.getMethod("/issueLinkType", IssueLinkTypesResponseSchema);
13748
+ }
13749
+ /**
13750
+ * Get a specific issue link type
13751
+ *
13752
+ * @param linkTypeId - Issue link type ID
13753
+ * @returns Issue link type
13754
+ */
13755
+ async getIssueLinkType(linkTypeId) {
13756
+ return this.getMethod(`/issueLinkType/${linkTypeId}`, IssueLinkTypeSchema);
13757
+ }
13578
13758
  };
13579
13759
 
13580
13760
  // src/services/project.service.ts
@@ -14159,6 +14339,8 @@ exports.IssueStatusSchema = IssueStatusSchema;
14159
14339
  exports.IssueTypeInputSchema = IssueTypeInputSchema;
14160
14340
  exports.IssueTypeSchema = IssueTypeSchema;
14161
14341
  exports.JiraClient = JiraClient;
14342
+ exports.LinkedIssueFieldsSchema = LinkedIssueFieldsSchema;
14343
+ exports.LinkedIssueSchema = LinkedIssueSchema;
14162
14344
  exports.PriorityInputSchema = PriorityInputSchema;
14163
14345
  exports.ProjectCategorySchema = ProjectCategorySchema;
14164
14346
  exports.ProjectInputSchema = ProjectInputSchema;
@@ -14185,8 +14367,13 @@ exports.WatchersSchema = WatchersSchema;
14185
14367
  exports.WorklogSchema = WorklogSchema;
14186
14368
  exports.WorklogVisibilitySchema = WorklogVisibilitySchema;
14187
14369
  exports.WorklogsPageSchema = WorklogsPageSchema;
14370
+ exports.blocksLinkType = blocksLinkType;
14371
+ exports.causesLinkType = causesLinkType;
14372
+ exports.clonesLinkType = clonesLinkType;
14188
14373
  exports.createJiraClient = createJiraClient;
14189
14374
  exports.createResilienceMiddleware = createResilienceMiddleware;
14375
+ exports.duplicatesLinkType = duplicatesLinkType;
14376
+ exports.relatesToLinkType = relatesToLinkType;
14190
14377
  exports.withApiVersion = withApiVersion;
14191
14378
  exports.withDebug = withDebug;
14192
14379
  exports.withLogger = withLogger;