@valiantys/atlassian-app-frontend 3.0.0-alpha-4 → 3.0.0-alpha-6

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 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;
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){const t=s?`?startAt=${s}`:"";return await this.fetchSvc.fetch({method:"GET",url:this.fetchSvc.route`/rest/api/3/issue/${e}/comment${t}`})}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)}async transitionIssue(e,s){await this.fetchSvc.fetch({method:"POST",url:this.fetchSvc.route`/rest/api/3/issue/${e}/transitions`},s)}};u.issueUrl="/rest/api/3/issue";let i=u;exports.JiraIssueService=i;
@@ -74,10 +74,11 @@ const i = class i {
74
74
  );
75
75
  }
76
76
  async getIssueComments(e, s = 0) {
77
- return (await this.fetchSvc.fetch({
77
+ const t = s ? `?startAt=${s}` : "";
78
+ return await this.fetchSvc.fetch({
78
79
  method: "GET",
79
- url: this.fetchSvc.route`/rest/api/3/issue/${e}/comment?startAt=${s}`
80
- })).comments;
80
+ url: this.fetchSvc.route`/rest/api/3/issue/${e}/comment${t}`
81
+ });
81
82
  }
82
83
  async getIssueCommentById(e, s) {
83
84
  return await this.fetchSvc.fetch({
@@ -94,6 +95,16 @@ const i = class i {
94
95
  s
95
96
  );
96
97
  }
98
+ // https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-transitions-post
99
+ async transitionIssue(e, s) {
100
+ await this.fetchSvc.fetch(
101
+ {
102
+ method: "POST",
103
+ url: this.fetchSvc.route`/rest/api/3/issue/${e}/transitions`
104
+ },
105
+ s
106
+ );
107
+ }
97
108
  };
98
109
  i.issueUrl = "/rest/api/3/issue";
99
110
  let o = i;
@@ -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
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("@atlaskit/button/new"),l=require("@atlaskit/icon/glyph/copy"),d=require("@atlaskit/popup"),x=require("@atlaskit/primitives"),C=require("react");function g({textToCopy:o,label:n,appearance:r,popupText:i,popupPlacement:s}){const[u,t]=C.useState(!1);return e.jsx(d,{isOpen:u,onClose:()=>t(!1),placement:s||"auto",content:()=>e.jsx(x.Box,{padding:"space.100",children:i||"Copied!"}),trigger:c=>e.jsx(p.IconButton,{...c,icon:l,label:n||"Copy",appearance:r||"subtle",onClick:a=>{a.preventDefault(),navigator.clipboard.writeText(o),t(!0)}})})}exports.CopyTextButton=g;
@@ -0,0 +1,39 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { IconButton as l } from "@atlaskit/button/new";
3
+ import s from "@atlaskit/icon/glyph/copy";
4
+ import f from "@atlaskit/popup";
5
+ import { Box as u } from "@atlaskit/primitives";
6
+ import { useState as d } from "react";
7
+ function B({
8
+ textToCopy: e,
9
+ label: r,
10
+ appearance: p,
11
+ popupText: n,
12
+ popupPlacement: i
13
+ }) {
14
+ const [a, t] = d(!1);
15
+ return /* @__PURE__ */ o(
16
+ f,
17
+ {
18
+ isOpen: a,
19
+ onClose: () => t(!1),
20
+ placement: i || "auto",
21
+ content: () => /* @__PURE__ */ o(u, { padding: "space.100", children: n || "Copied!" }),
22
+ trigger: (m) => /* @__PURE__ */ o(
23
+ l,
24
+ {
25
+ ...m,
26
+ icon: s,
27
+ label: r || "Copy",
28
+ appearance: p || "subtle",
29
+ onClick: (c) => {
30
+ c.preventDefault(), navigator.clipboard.writeText(e), t(!0);
31
+ }
32
+ }
33
+ )
34
+ }
35
+ );
36
+ }
37
+ export {
38
+ B as CopyTextButton
39
+ };
@@ -243,8 +243,9 @@
243
243
  "text": ", body: "
244
244
  },
245
245
  {
246
- "kind": "Content",
247
- "text": "any"
246
+ "kind": "Reference",
247
+ "text": "AtlassianDocumentFormat",
248
+ "canonicalReference": "@valiantys/atlassian-app-frontend!~AtlassianDocumentFormat:interface"
248
249
  },
249
250
  {
250
251
  "kind": "Content",
@@ -637,12 +638,12 @@
637
638
  },
638
639
  {
639
640
  "kind": "Reference",
640
- "text": "IssueComment",
641
- "canonicalReference": "@valiantys/atlassian-app-frontend!~IssueComment:type"
641
+ "text": "JiraCommentResponse",
642
+ "canonicalReference": "@valiantys/atlassian-app-frontend!~JiraCommentResponse:type"
642
643
  },
643
644
  {
644
645
  "kind": "Content",
645
- "text": "[] | undefined>"
646
+ "text": " | undefined>"
646
647
  },
647
648
  {
648
649
  "kind": "Content",
@@ -1029,6 +1030,76 @@
1029
1030
  "isAbstract": false,
1030
1031
  "name": "queryForIssuesInProjects"
1031
1032
  },
1033
+ {
1034
+ "kind": "Method",
1035
+ "canonicalReference": "@valiantys/atlassian-app-frontend!JiraIssueService#transitionIssue:member(1)",
1036
+ "docComment": "",
1037
+ "excerptTokens": [
1038
+ {
1039
+ "kind": "Content",
1040
+ "text": "transitionIssue(issueIdOrKey: "
1041
+ },
1042
+ {
1043
+ "kind": "Content",
1044
+ "text": "string"
1045
+ },
1046
+ {
1047
+ "kind": "Content",
1048
+ "text": ", body: "
1049
+ },
1050
+ {
1051
+ "kind": "Reference",
1052
+ "text": "TransitionIssueRequest",
1053
+ "canonicalReference": "@valiantys/atlassian-app-frontend!~TransitionIssueRequest:interface"
1054
+ },
1055
+ {
1056
+ "kind": "Content",
1057
+ "text": "): "
1058
+ },
1059
+ {
1060
+ "kind": "Reference",
1061
+ "text": "Promise",
1062
+ "canonicalReference": "!Promise:interface"
1063
+ },
1064
+ {
1065
+ "kind": "Content",
1066
+ "text": "<void>"
1067
+ },
1068
+ {
1069
+ "kind": "Content",
1070
+ "text": ";"
1071
+ }
1072
+ ],
1073
+ "isStatic": false,
1074
+ "returnTypeTokenRange": {
1075
+ "startIndex": 5,
1076
+ "endIndex": 7
1077
+ },
1078
+ "releaseTag": "Public",
1079
+ "isProtected": false,
1080
+ "overloadIndex": 1,
1081
+ "parameters": [
1082
+ {
1083
+ "parameterName": "issueIdOrKey",
1084
+ "parameterTypeTokenRange": {
1085
+ "startIndex": 1,
1086
+ "endIndex": 2
1087
+ },
1088
+ "isOptional": false
1089
+ },
1090
+ {
1091
+ "parameterName": "body",
1092
+ "parameterTypeTokenRange": {
1093
+ "startIndex": 3,
1094
+ "endIndex": 4
1095
+ },
1096
+ "isOptional": false
1097
+ }
1098
+ ],
1099
+ "isOptional": false,
1100
+ "isAbstract": false,
1101
+ "name": "transitionIssue"
1102
+ },
1032
1103
  {
1033
1104
  "kind": "Method",
1034
1105
  "canonicalReference": "@valiantys/atlassian-app-frontend!JiraIssueService#updateField:member(1)",
@@ -8,8 +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
+ //
11
13
  // (undocumented)
12
- addIssueComment(issueIdOrKey: string, body: any): Promise<IssueComment>;
14
+ addIssueComment(issueIdOrKey: string, body: AtlassianDocumentFormat): Promise<IssueComment>;
13
15
  // Warning: (ae-forgotten-export) The symbol "WorklogCreateRequest" needs to be exported by the entry point data-access-issue.d.ts
14
16
  // Warning: (ae-forgotten-export) The symbol "Worklog" needs to be exported by the entry point data-access-issue.d.ts
15
17
  //
@@ -24,12 +26,14 @@ export class JiraIssueService {
24
26
  //
25
27
  // (undocumented)
26
28
  getIssue(issueIdOrKey: string, fields?: string[]): Promise<Issue | undefined>;
29
+ // Warning: (ae-forgotten-export) The symbol "IssueComment" needs to be exported by the entry point data-access-issue.d.ts
30
+ //
27
31
  // (undocumented)
28
32
  getIssueCommentById(issueIdOrKey: string, commentId: string): Promise<IssueComment | undefined>;
29
- // Warning: (ae-forgotten-export) The symbol "IssueComment" needs to be exported by the entry point data-access-issue.d.ts
33
+ // Warning: (ae-forgotten-export) The symbol "JiraCommentResponse" needs to be exported by the entry point data-access-issue.d.ts
30
34
  //
31
35
  // (undocumented)
32
- getIssueComments(issueIdOrKey: string, startAt?: number): Promise<IssueComment[] | undefined>;
36
+ getIssueComments(issueIdOrKey: string, startAt?: number): Promise<JiraCommentResponse | undefined>;
33
37
  // (undocumented)
34
38
  getIssueField<T>(issueIdOrKey: string, field: string): Promise<T | undefined>;
35
39
  // Warning: (ae-forgotten-export) The symbol "IssueFields" needs to be exported by the entry point data-access-issue.d.ts
@@ -42,6 +46,10 @@ export class JiraIssueService {
42
46
  static readonly issueUrl = "/rest/api/3/issue";
43
47
  // (undocumented)
44
48
  queryForIssuesInProjects(projectIds: number[]): Promise<Issue[]>;
49
+ // Warning: (ae-forgotten-export) The symbol "TransitionIssueRequest" needs to be exported by the entry point data-access-issue.d.ts
50
+ //
51
+ // (undocumented)
52
+ transitionIssue(issueIdOrKey: string, body: TransitionIssueRequest): Promise<void>;
45
53
  // (undocumented)
46
54
  updateField(issueIdOrKey: string, fieldName: string, value: unknown): Promise<void>;
47
55
  // (undocumented)
@@ -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;
@@ -15,13 +32,6 @@ declare interface AvatarUrls {
15
32
  '32x32': string;
16
33
  }
17
34
 
18
- declare type CommentAuthor = {
19
- accountId: string;
20
- active: boolean;
21
- displayName: string;
22
- self: string;
23
- };
24
-
25
35
  declare interface CreatedIssue {
26
36
  id: string;
27
37
  key: string;
@@ -112,16 +122,12 @@ declare interface Issue {
112
122
  }
113
123
 
114
124
  declare type IssueComment = {
115
- author: CommentAuthor;
116
- body: {
117
- type: string;
118
- version: number;
119
- content: unknown[];
120
- };
125
+ author: User;
126
+ body: AtlassianDocumentFormat;
121
127
  created: string;
122
128
  id: string;
123
129
  self: string;
124
- updateAuthor: CommentAuthor;
130
+ updateAuthor: User;
125
131
  updated: string;
126
132
  visibility: Visibility;
127
133
  };
@@ -154,6 +160,13 @@ declare interface IssueTransition {
154
160
  looped: boolean;
155
161
  }
156
162
 
163
+ declare type JiraCommentResponse = {
164
+ comments: IssueComment[];
165
+ maxResults: number;
166
+ startAt: number;
167
+ total: number;
168
+ };
169
+
157
170
  export declare class JiraIssueService {
158
171
  private fetchSvc;
159
172
  static readonly issueUrl = "/rest/api/3/issue";
@@ -168,9 +181,10 @@ export declare class JiraIssueService {
168
181
  queryForIssuesInProjects(projectIds: number[]): Promise<Issue[]>;
169
182
  createIssue(body: CreateIssue): Promise<CreatedIssue>;
170
183
  updateIssue(issueIdOrKey: string, body: UpdateIssue): Promise<void>;
171
- getIssueComments(issueIdOrKey: string, startAt?: number): Promise<IssueComment[] | undefined>;
184
+ getIssueComments(issueIdOrKey: string, startAt?: number): Promise<JiraCommentResponse | undefined>;
172
185
  getIssueCommentById(issueIdOrKey: string, commentId: string): Promise<IssueComment | undefined>;
173
- addIssueComment(issueIdOrKey: string, body: any): Promise<IssueComment>;
186
+ addIssueComment(issueIdOrKey: string, body: AtlassianDocumentFormat): Promise<IssueComment>;
187
+ transitionIssue(issueIdOrKey: string, body: TransitionIssueRequest): Promise<void>;
174
188
  }
175
189
 
176
190
  declare type Product = 'jira' | 'bitbucket' | 'confluence' | 'connected-data';
@@ -229,17 +243,7 @@ declare interface StaticIssueFields {
229
243
  };
230
244
  created?: string;
231
245
  updated?: string;
232
- description?: {
233
- type: 'doc';
234
- version: 1;
235
- content: {
236
- type: 'paragraph';
237
- content: {
238
- type: 'text';
239
- text: string;
240
- }[];
241
- }[];
242
- };
246
+ description?: AtlassianDocumentFormat;
243
247
  timetracking?: {
244
248
  remainingEstimate: string;
245
249
  timeSpent: string;
@@ -254,6 +258,14 @@ declare interface StaticIssueFields {
254
258
  issuelinks?: IssueLink[];
255
259
  }
256
260
 
261
+ declare interface TransitionIssueRequest {
262
+ fields?: any;
263
+ historyMetadata?: HistoryMetadata;
264
+ properties?: EntityProperty[];
265
+ transition: IssueTransition;
266
+ update?: any;
267
+ }
268
+
257
269
  declare type UpdateIssue = CreatedIssue;
258
270
 
259
271
  declare interface User {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valiantys/atlassian-app-frontend",
3
- "version": "3.0.0-alpha-4",
3
+ "version": "3.0.0-alpha-6",
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": {
@@ -78,6 +78,11 @@
78
78
  "require": "./ui-backend-adapter/index.cjs.js",
79
79
  "types": "./ui-backend-adapter/index.d.ts"
80
80
  },
81
+ "./ui-copy-button": {
82
+ "import": "./ui-copy-button/index.es.js",
83
+ "require": "./ui-copy-button/index.cjs.js",
84
+ "types": "./ui-copy-button/index.d.ts"
85
+ },
81
86
  "./ui-host-router": {
82
87
  "import": "./ui-host-router/index.es.js",
83
88
  "require": "./ui-host-router/index.cjs.js",