@valiantys/atlassian-app-frontend 3.0.0-alpha-3 → 3.0.0-alpha-5

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=class h{constructor(e){this.fetchSvc=e}async updateField(e,t,s){await this.updateFields(e,{[t]:s})}async updateFields(e,t){await this.fetchSvc.fetch({method:"PUT",url:this.fetchSvc.route`/rest/api/3/issue/${e}`},{fields:t})}async getIssueField(e,t){var s;return(s=await this.getIssueFields(e,[t]))==null?void 0:s[t]}async getIssueFields(e,t){return(await this.fetchSvc.fetch({method:"GET",url:this.fetchSvc.route`/rest/api/3/issue/${e}?fields=${t.join(",")}`})).fields}async getIssue(e,t=["*all"]){return this.fetchSvc.fetch({method:"GET",url:this.fetchSvc.route`/rest/api/3/issue/${e}?fields=${t.join(",")}`})}async issueSearch(e,t,s=50){let c;const r=[];do{const u=await this.fetchSvc.fetch({method:"GET",url:this.fetchSvc.route`/rest/api/3/search/jql?jql=${e}&fields=${t.join(",")}&maxResults=${s}&${c?"nextPageToken="+c:""}`});r.push(...u.issues),c=u.nextPageToken}while(c!==void 0);return r}async addWorklog(e,t){return this.fetchSvc.fetch({method:"POST",url:this.fetchSvc.route`/rest/api/3/issue/${e}/worklog`},t)}async queryForIssuesInProjects(e){const t=`project IN (${e.join(",")})`;return this.issueSearch(t,["key"],5e3)}async createIssue(e){return this.fetchSvc.fetch({method:"POST",url:this.fetchSvc.route`/rest/api/2/issue`},e)}async updateIssue(e,t){return this.fetchSvc.fetch({method:"PUT",url:this.fetchSvc.route`/rest/api/2/issue/${e}`},t)}};h.issueUrl="/rest/api/3/issue";let i=h;exports.JiraIssueService=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=class u{constructor(e){this.fetchSvc=e}async updateField(e,s,t){await this.updateFields(e,{[s]:t})}async updateFields(e,s){await this.fetchSvc.fetch({method:"PUT",url:this.fetchSvc.route`/rest/api/3/issue/${e}`},{fields:s})}async getIssueField(e,s){var t;return(t=await this.getIssueFields(e,[s]))==null?void 0:t[s]}async getIssueFields(e,s){return(await this.fetchSvc.fetch({method:"GET",url:this.fetchSvc.route`/rest/api/3/issue/${e}?fields=${s.join(",")}`})).fields}async getIssue(e,s=["*all"]){return this.fetchSvc.fetch({method:"GET",url:this.fetchSvc.route`/rest/api/3/issue/${e}?fields=${s.join(",")}`})}async issueSearch(e,s,t=50){let c;const h=[];do{const o=await this.fetchSvc.fetch({method:"GET",url:this.fetchSvc.route`/rest/api/3/search/jql?jql=${e}&fields=${s.join(",")}&maxResults=${t}&${c?"nextPageToken="+c:""}`});h.push(...o.issues),c=o.nextPageToken}while(c!==void 0);return h}async addWorklog(e,s){return this.fetchSvc.fetch({method:"POST",url:this.fetchSvc.route`/rest/api/3/issue/${e}/worklog`},s)}async queryForIssuesInProjects(e){const s=`project IN (${e.join(",")})`;return this.issueSearch(s,["key"],5e3)}async createIssue(e){return this.fetchSvc.fetch({method:"POST",url:this.fetchSvc.route`/rest/api/2/issue`},e)}async updateIssue(e,s){return this.fetchSvc.fetch({method:"PUT",url:this.fetchSvc.route`/rest/api/2/issue/${e}`},s)}async getIssueComments(e,s=0){return(await this.fetchSvc.fetch({method:"GET",url:this.fetchSvc.route`/rest/api/3/issue/${e}/comment?startAt=${s}`})).comments}async getIssueCommentById(e,s){return await this.fetchSvc.fetch({method:"GET",url:this.fetchSvc.route`/rest/api/3/issue/${e}/comment/${s}`})}async addIssueComment(e,s){return await this.fetchSvc.fetch({method:"POST",url:this.fetchSvc.route`/rest/api/3/issue/${e}/comment`},s)}};u.issueUrl="/rest/api/3/issue";let i=u;exports.JiraIssueService=i;
@@ -73,9 +73,30 @@ const i = class i {
73
73
  s
74
74
  );
75
75
  }
76
+ async getIssueComments(e, s = 0) {
77
+ return (await this.fetchSvc.fetch({
78
+ method: "GET",
79
+ url: this.fetchSvc.route`/rest/api/3/issue/${e}/comment?startAt=${s}`
80
+ })).comments;
81
+ }
82
+ async getIssueCommentById(e, s) {
83
+ return await this.fetchSvc.fetch({
84
+ method: "GET",
85
+ url: this.fetchSvc.route`/rest/api/3/issue/${e}/comment/${s}`
86
+ });
87
+ }
88
+ async addIssueComment(e, s) {
89
+ return await this.fetchSvc.fetch(
90
+ {
91
+ method: "POST",
92
+ url: this.fetchSvc.route`/rest/api/3/issue/${e}/comment`
93
+ },
94
+ s
95
+ );
96
+ }
76
97
  };
77
98
  i.issueUrl = "/rest/api/3/issue";
78
- let r = i;
99
+ let o = i;
79
100
  export {
80
- r as JiraIssueService
101
+ o as JiraIssueService
81
102
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="fixVersions";exports.FIX_VERSIONS_FIELD=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a="fixVersions";function e(t){return t.type==="paragraph"}function o(t){return t.type==="text"}exports.FIX_VERSIONS_FIELD=a;exports.isAtlassianDocumentFormatParagraphNode=e;exports.isAtlassianDocumentFormatTextNode=o;
@@ -1,4 +1,12 @@
1
- const o = "fixVersions";
1
+ const a = "fixVersions";
2
+ function e(t) {
3
+ return t.type === "paragraph";
4
+ }
5
+ function n(t) {
6
+ return t.type === "text";
7
+ }
2
8
  export {
3
- o as FIX_VERSIONS_FIELD
9
+ a as FIX_VERSIONS_FIELD,
10
+ e as isAtlassianDocumentFormatParagraphNode,
11
+ n as isAtlassianDocumentFormatTextNode
4
12
  };
@@ -225,6 +225,85 @@
225
225
  }
226
226
  ]
227
227
  },
228
+ {
229
+ "kind": "Method",
230
+ "canonicalReference": "@valiantys/atlassian-app-frontend!JiraIssueService#addIssueComment:member(1)",
231
+ "docComment": "",
232
+ "excerptTokens": [
233
+ {
234
+ "kind": "Content",
235
+ "text": "addIssueComment(issueIdOrKey: "
236
+ },
237
+ {
238
+ "kind": "Content",
239
+ "text": "string"
240
+ },
241
+ {
242
+ "kind": "Content",
243
+ "text": ", body: "
244
+ },
245
+ {
246
+ "kind": "Reference",
247
+ "text": "AtlassianDocumentFormat",
248
+ "canonicalReference": "@valiantys/atlassian-app-frontend!~AtlassianDocumentFormat:interface"
249
+ },
250
+ {
251
+ "kind": "Content",
252
+ "text": "): "
253
+ },
254
+ {
255
+ "kind": "Reference",
256
+ "text": "Promise",
257
+ "canonicalReference": "!Promise:interface"
258
+ },
259
+ {
260
+ "kind": "Content",
261
+ "text": "<"
262
+ },
263
+ {
264
+ "kind": "Reference",
265
+ "text": "IssueComment",
266
+ "canonicalReference": "@valiantys/atlassian-app-frontend!~IssueComment:type"
267
+ },
268
+ {
269
+ "kind": "Content",
270
+ "text": ">"
271
+ },
272
+ {
273
+ "kind": "Content",
274
+ "text": ";"
275
+ }
276
+ ],
277
+ "isStatic": false,
278
+ "returnTypeTokenRange": {
279
+ "startIndex": 5,
280
+ "endIndex": 9
281
+ },
282
+ "releaseTag": "Public",
283
+ "isProtected": false,
284
+ "overloadIndex": 1,
285
+ "parameters": [
286
+ {
287
+ "parameterName": "issueIdOrKey",
288
+ "parameterTypeTokenRange": {
289
+ "startIndex": 1,
290
+ "endIndex": 2
291
+ },
292
+ "isOptional": false
293
+ },
294
+ {
295
+ "parameterName": "body",
296
+ "parameterTypeTokenRange": {
297
+ "startIndex": 3,
298
+ "endIndex": 4
299
+ },
300
+ "isOptional": false
301
+ }
302
+ ],
303
+ "isOptional": false,
304
+ "isAbstract": false,
305
+ "name": "addIssueComment"
306
+ },
228
307
  {
229
308
  "kind": "Method",
230
309
  "canonicalReference": "@valiantys/atlassian-app-frontend!JiraIssueService#addWorklog:member(1)",
@@ -445,6 +524,162 @@
445
524
  "isAbstract": false,
446
525
  "name": "getIssue"
447
526
  },
527
+ {
528
+ "kind": "Method",
529
+ "canonicalReference": "@valiantys/atlassian-app-frontend!JiraIssueService#getIssueCommentById:member(1)",
530
+ "docComment": "",
531
+ "excerptTokens": [
532
+ {
533
+ "kind": "Content",
534
+ "text": "getIssueCommentById(issueIdOrKey: "
535
+ },
536
+ {
537
+ "kind": "Content",
538
+ "text": "string"
539
+ },
540
+ {
541
+ "kind": "Content",
542
+ "text": ", commentId: "
543
+ },
544
+ {
545
+ "kind": "Content",
546
+ "text": "string"
547
+ },
548
+ {
549
+ "kind": "Content",
550
+ "text": "): "
551
+ },
552
+ {
553
+ "kind": "Reference",
554
+ "text": "Promise",
555
+ "canonicalReference": "!Promise:interface"
556
+ },
557
+ {
558
+ "kind": "Content",
559
+ "text": "<"
560
+ },
561
+ {
562
+ "kind": "Reference",
563
+ "text": "IssueComment",
564
+ "canonicalReference": "@valiantys/atlassian-app-frontend!~IssueComment:type"
565
+ },
566
+ {
567
+ "kind": "Content",
568
+ "text": " | undefined>"
569
+ },
570
+ {
571
+ "kind": "Content",
572
+ "text": ";"
573
+ }
574
+ ],
575
+ "isStatic": false,
576
+ "returnTypeTokenRange": {
577
+ "startIndex": 5,
578
+ "endIndex": 9
579
+ },
580
+ "releaseTag": "Public",
581
+ "isProtected": false,
582
+ "overloadIndex": 1,
583
+ "parameters": [
584
+ {
585
+ "parameterName": "issueIdOrKey",
586
+ "parameterTypeTokenRange": {
587
+ "startIndex": 1,
588
+ "endIndex": 2
589
+ },
590
+ "isOptional": false
591
+ },
592
+ {
593
+ "parameterName": "commentId",
594
+ "parameterTypeTokenRange": {
595
+ "startIndex": 3,
596
+ "endIndex": 4
597
+ },
598
+ "isOptional": false
599
+ }
600
+ ],
601
+ "isOptional": false,
602
+ "isAbstract": false,
603
+ "name": "getIssueCommentById"
604
+ },
605
+ {
606
+ "kind": "Method",
607
+ "canonicalReference": "@valiantys/atlassian-app-frontend!JiraIssueService#getIssueComments:member(1)",
608
+ "docComment": "",
609
+ "excerptTokens": [
610
+ {
611
+ "kind": "Content",
612
+ "text": "getIssueComments(issueIdOrKey: "
613
+ },
614
+ {
615
+ "kind": "Content",
616
+ "text": "string"
617
+ },
618
+ {
619
+ "kind": "Content",
620
+ "text": ", startAt?: "
621
+ },
622
+ {
623
+ "kind": "Content",
624
+ "text": "number"
625
+ },
626
+ {
627
+ "kind": "Content",
628
+ "text": "): "
629
+ },
630
+ {
631
+ "kind": "Reference",
632
+ "text": "Promise",
633
+ "canonicalReference": "!Promise:interface"
634
+ },
635
+ {
636
+ "kind": "Content",
637
+ "text": "<"
638
+ },
639
+ {
640
+ "kind": "Reference",
641
+ "text": "IssueComment",
642
+ "canonicalReference": "@valiantys/atlassian-app-frontend!~IssueComment:type"
643
+ },
644
+ {
645
+ "kind": "Content",
646
+ "text": "[] | undefined>"
647
+ },
648
+ {
649
+ "kind": "Content",
650
+ "text": ";"
651
+ }
652
+ ],
653
+ "isStatic": false,
654
+ "returnTypeTokenRange": {
655
+ "startIndex": 5,
656
+ "endIndex": 9
657
+ },
658
+ "releaseTag": "Public",
659
+ "isProtected": false,
660
+ "overloadIndex": 1,
661
+ "parameters": [
662
+ {
663
+ "parameterName": "issueIdOrKey",
664
+ "parameterTypeTokenRange": {
665
+ "startIndex": 1,
666
+ "endIndex": 2
667
+ },
668
+ "isOptional": false
669
+ },
670
+ {
671
+ "parameterName": "startAt",
672
+ "parameterTypeTokenRange": {
673
+ "startIndex": 3,
674
+ "endIndex": 4
675
+ },
676
+ "isOptional": true
677
+ }
678
+ ],
679
+ "isOptional": false,
680
+ "isAbstract": false,
681
+ "name": "getIssueComments"
682
+ },
448
683
  {
449
684
  "kind": "Method",
450
685
  "canonicalReference": "@valiantys/atlassian-app-frontend!JiraIssueService#getIssueField:member(1)",
@@ -8,6 +8,10 @@
8
8
  export class JiraIssueService {
9
9
  // Warning: (ae-forgotten-export) The symbol "AtlassianProductFetchService" needs to be exported by the entry point data-access-issue.d.ts
10
10
  constructor(fetchSvc: AtlassianProductFetchService<'jira'>);
11
+ // Warning: (ae-forgotten-export) The symbol "AtlassianDocumentFormat" needs to be exported by the entry point data-access-issue.d.ts
12
+ //
13
+ // (undocumented)
14
+ addIssueComment(issueIdOrKey: string, body: AtlassianDocumentFormat): Promise<IssueComment>;
11
15
  // Warning: (ae-forgotten-export) The symbol "WorklogCreateRequest" needs to be exported by the entry point data-access-issue.d.ts
12
16
  // Warning: (ae-forgotten-export) The symbol "Worklog" needs to be exported by the entry point data-access-issue.d.ts
13
17
  //
@@ -23,6 +27,12 @@ export class JiraIssueService {
23
27
  // (undocumented)
24
28
  getIssue(issueIdOrKey: string, fields?: string[]): Promise<Issue | undefined>;
25
29
  // (undocumented)
30
+ getIssueCommentById(issueIdOrKey: string, commentId: string): Promise<IssueComment | undefined>;
31
+ // Warning: (ae-forgotten-export) The symbol "IssueComment" needs to be exported by the entry point data-access-issue.d.ts
32
+ //
33
+ // (undocumented)
34
+ getIssueComments(issueIdOrKey: string, startAt?: number): Promise<IssueComment[] | undefined>;
35
+ // (undocumented)
26
36
  getIssueField<T>(issueIdOrKey: string, field: string): Promise<T | undefined>;
27
37
  // Warning: (ae-forgotten-export) The symbol "IssueFields" needs to be exported by the entry point data-access-issue.d.ts
28
38
  //
@@ -1,5 +1,22 @@
1
1
  declare type APIResponse = Pick<Response, 'json' | 'text' | 'ok' | 'status' | 'statusText' | 'headers'>;
2
2
 
3
+ declare interface AtlassianDocumentFormat {
4
+ type: 'doc';
5
+ version: number;
6
+ content: AtlassianDocumentFormatNode[];
7
+ }
8
+
9
+ declare interface AtlassianDocumentFormatBlockNode {
10
+ type: string;
11
+ content: AtlassianDocumentFormatNode[];
12
+ }
13
+
14
+ declare interface AtlassianDocumentFormatInlineNode {
15
+ type: string;
16
+ }
17
+
18
+ declare type AtlassianDocumentFormatNode = AtlassianDocumentFormatInlineNode | AtlassianDocumentFormatBlockNode;
19
+
3
20
  declare interface AtlassianProductFetchService<P extends Product> {
4
21
  productType: P;
5
22
  fetch: FetchSignature;
@@ -104,6 +121,17 @@ declare interface Issue {
104
121
  fields: IssueFields;
105
122
  }
106
123
 
124
+ declare type IssueComment = {
125
+ author: User;
126
+ body: AtlassianDocumentFormat;
127
+ created: string;
128
+ id: string;
129
+ self: string;
130
+ updateAuthor: User;
131
+ updated: string;
132
+ visibility: Visibility;
133
+ };
134
+
107
135
  declare type IssueFields = CustomFields & StaticIssueFields;
108
136
 
109
137
  declare interface IssueLink {
@@ -146,6 +174,9 @@ export declare class JiraIssueService {
146
174
  queryForIssuesInProjects(projectIds: number[]): Promise<Issue[]>;
147
175
  createIssue(body: CreateIssue): Promise<CreatedIssue>;
148
176
  updateIssue(issueIdOrKey: string, body: UpdateIssue): Promise<void>;
177
+ getIssueComments(issueIdOrKey: string, startAt?: number): Promise<IssueComment[] | undefined>;
178
+ getIssueCommentById(issueIdOrKey: string, commentId: string): Promise<IssueComment | undefined>;
179
+ addIssueComment(issueIdOrKey: string, body: AtlassianDocumentFormat): Promise<IssueComment>;
149
180
  }
150
181
 
151
182
  declare type Product = 'jira' | 'bitbucket' | 'confluence' | 'connected-data';
@@ -204,17 +235,7 @@ declare interface StaticIssueFields {
204
235
  };
205
236
  created?: string;
206
237
  updated?: string;
207
- description?: {
208
- type: 'doc';
209
- version: 1;
210
- content: {
211
- type: 'paragraph';
212
- content: {
213
- type: 'text';
214
- text: string;
215
- }[];
216
- }[];
217
- };
238
+ description?: AtlassianDocumentFormat;
218
239
  timetracking?: {
219
240
  remainingEstimate: string;
220
241
  timeSpent: string;
@@ -242,6 +263,12 @@ declare interface User {
242
263
  self?: string;
243
264
  }
244
265
 
266
+ declare type Visibility = {
267
+ identifier: string;
268
+ type: string;
269
+ value: string;
270
+ };
271
+
245
272
  declare interface Worklog extends WorklogCreateRequest {
246
273
  self: string;
247
274
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valiantys/atlassian-app-frontend",
3
- "version": "3.0.0-alpha-3",
3
+ "version": "3.0.0-alpha-5",
4
4
  "description": "This library provides an Atlassian Forge Custom UI wrapper component that handles all the setup necessary to support an app that can run deployed or in standalone mode",
5
5
  "exports": {
6
6
  "./atlassian-app": {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react");function i(t){return console.error(t),`Error Occurred: ${t.message||t}`}function d(t,c=i){const[u,s]=e.useState(),[l,r]=e.useState(!0),[f,n]=e.useState(),o=e.useCallback(async()=>{r(!0);try{const a=await t();return s(a),a}catch(a){n(c(a))}finally{r(!1)}},[t,c]);return e.useEffect(()=>{o()},[o]),{data:u,loading:l,error:f,setData:s,setLoading:r,setError:n,manualTrigger:()=>o()}}exports.useLoadDataEffect=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react");function d(t){return console.error(t),`Error Occurred: ${t.message||t}`}function f(t,n=d){const[u,r]=e.useState(),[i,o]=e.useState(!0),[l,c]=e.useState(),s=e.useCallback(async()=>{o(!0);try{c(void 0);const a=await t();return r(a),a}catch(a){c(n(a)),r(void 0)}finally{o(!1)}},[t,n]);return e.useEffect(()=>{s()},[s]),{data:u,loading:i,error:l,setData:r,setLoading:o,setError:c,manualTrigger:()=>s()}}exports.useLoadDataEffect=f;
@@ -1,29 +1,30 @@
1
- import { useState as o, useCallback as i, useEffect as d } from "react";
1
+ import { useState as n, useCallback as d, useEffect as f } from "react";
2
2
  function g(r) {
3
3
  return console.error(r), `Error Occurred: ${r.message || r}`;
4
4
  }
5
- function m(r, c = g) {
6
- const [u, n] = o(), [l, a] = o(!0), [f, s] = o(), e = i(async () => {
7
- a(!0);
5
+ function m(r, s = g) {
6
+ const [u, a] = n(), [i, o] = n(!0), [l, e] = n(), c = d(async () => {
7
+ o(!0);
8
8
  try {
9
+ e(void 0);
9
10
  const t = await r();
10
- return n(t), t;
11
+ return a(t), t;
11
12
  } catch (t) {
12
- s(c(t));
13
+ e(s(t)), a(void 0);
13
14
  } finally {
14
- a(!1);
15
+ o(!1);
15
16
  }
16
- }, [r, c]);
17
- return d(() => {
18
- e();
19
- }, [e]), {
17
+ }, [r, s]);
18
+ return f(() => {
19
+ c();
20
+ }, [c]), {
20
21
  data: u,
21
- loading: l,
22
- error: f,
23
- setData: n,
24
- setLoading: a,
25
- setError: s,
26
- manualTrigger: () => e()
22
+ loading: i,
23
+ error: l,
24
+ setData: a,
25
+ setLoading: o,
26
+ setError: e,
27
+ manualTrigger: () => c()
27
28
  };
28
29
  }
29
30
  export {