@atlaskit/teams-client 4.28.0 → 4.29.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/CHANGELOG.md +7 -0
- package/dist/cjs/common/utils/ufo/index.js +2 -2
- package/dist/cjs/services/agg-client/index.js +219 -0
- package/dist/cjs/services/agg-client/utils/mutations/unlink-container-mutation.js +12 -0
- package/dist/cjs/services/agg-client/utils/queries/number-of-team-connected-to-container-query.js +12 -0
- package/dist/cjs/services/agg-client/utils/queries/team-connected-to-container-query.js +12 -0
- package/dist/cjs/services/agg-client/utils/queries/team-containers-query.js +12 -0
- package/dist/cjs/services/main.js +782 -631
- package/dist/cjs/services/sentry/utils/get-sentry-config.js +1 -1
- package/dist/es2019/common/utils/ufo/index.js +2 -2
- package/dist/es2019/services/agg-client/index.js +141 -0
- package/dist/es2019/services/agg-client/utils/mutations/unlink-container-mutation.js +20 -0
- package/dist/es2019/services/agg-client/utils/queries/number-of-team-connected-to-container-query.js +14 -0
- package/dist/es2019/services/agg-client/utils/queries/team-connected-to-container-query.js +55 -0
- package/dist/es2019/services/agg-client/utils/queries/team-containers-query.js +53 -0
- package/dist/es2019/services/main.js +55 -0
- package/dist/es2019/services/sentry/utils/get-sentry-config.js +1 -1
- package/dist/esm/common/utils/ufo/index.js +2 -2
- package/dist/esm/services/agg-client/index.js +221 -0
- package/dist/esm/services/agg-client/utils/mutations/unlink-container-mutation.js +5 -0
- package/dist/esm/services/agg-client/utils/queries/number-of-team-connected-to-container-query.js +5 -0
- package/dist/esm/services/agg-client/utils/queries/team-connected-to-container-query.js +5 -0
- package/dist/esm/services/agg-client/utils/queries/team-containers-query.js +5 -0
- package/dist/esm/services/main.js +782 -631
- package/dist/esm/services/sentry/utils/get-sentry-config.js +1 -1
- package/dist/types/services/agg-client/index.d.ts +23 -1
- package/dist/types/services/agg-client/utils/mutations/unlink-container-mutation.d.ts +18 -0
- package/dist/types/services/agg-client/utils/queries/number-of-team-connected-to-container-query.d.ts +11 -0
- package/dist/types/services/agg-client/utils/queries/team-connected-to-container-query.d.ts +47 -0
- package/dist/types/services/agg-client/utils/queries/team-containers-query.d.ts +52 -0
- package/dist/types/services/main.d.ts +39 -2
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types-ts4.5/services/agg-client/index.d.ts +23 -1
- package/dist/types-ts4.5/services/agg-client/utils/mutations/unlink-container-mutation.d.ts +18 -0
- package/dist/types-ts4.5/services/agg-client/utils/queries/number-of-team-connected-to-container-query.d.ts +11 -0
- package/dist/types-ts4.5/services/agg-client/utils/queries/team-connected-to-container-query.d.ts +47 -0
- package/dist/types-ts4.5/services/agg-client/utils/queries/team-containers-query.d.ts +52 -0
- package/dist/types-ts4.5/services/main.d.ts +39 -2
- package/dist/types-ts4.5/types/index.d.ts +1 -1
- package/package.json +2 -2
|
@@ -36,7 +36,7 @@ function getSentryConfig(options) {
|
|
|
36
36
|
return _objectSpread(_objectSpread(_objectSpread({}, otherOptions), DEFAULT_SENTRY_CONFIG), {}, {
|
|
37
37
|
// Standalone __VERSION__ is set from `bin/set-release-version.sh`
|
|
38
38
|
// when building to deploy to production
|
|
39
|
-
release: "".concat("@atlaskit/teams-client", "@").concat("4.
|
|
39
|
+
release: "".concat("@atlaskit/teams-client", "@").concat("4.28.0") ||
|
|
40
40
|
// @ts-ignore Jira - window.BUILD_KEY
|
|
41
41
|
window.BUILD_KEY || ( // @ts-ignore Confluence - window.__buildInfo
|
|
42
42
|
(_window$__buildInfo = window.__buildInfo) === null || _window$__buildInfo === void 0 ? void 0 : _window$__buildInfo.FRONTEND_VERSION) || '---',
|
|
@@ -27,7 +27,7 @@ export class TeamsUFOExperience extends UFOExperience {
|
|
|
27
27
|
return super.failure({
|
|
28
28
|
metadata: {
|
|
29
29
|
error: createErrorMetadata(error),
|
|
30
|
-
packageVersion: "4.
|
|
30
|
+
packageVersion: "4.28.0",
|
|
31
31
|
packageName: "@atlaskit/teams-client"
|
|
32
32
|
}
|
|
33
33
|
});
|
|
@@ -35,7 +35,7 @@ export class TeamsUFOExperience extends UFOExperience {
|
|
|
35
35
|
return super.failure({
|
|
36
36
|
metadata: {
|
|
37
37
|
error: 'unknown error',
|
|
38
|
-
packageVersion: "4.
|
|
38
|
+
packageVersion: "4.28.0",
|
|
39
39
|
packageName: "@atlaskit/teams-client"
|
|
40
40
|
}
|
|
41
41
|
});
|
|
@@ -2,10 +2,17 @@ import { toTeamARI, toUserId } from '../../common/utils/ari';
|
|
|
2
2
|
import { DEFAULT_CONFIG } from '../constants';
|
|
3
3
|
import { BaseGraphQlClient } from '../graphql-client';
|
|
4
4
|
import { logException } from '../sentry/main';
|
|
5
|
+
import { UnlinkContainerMutation } from './utils/mutations/unlink-container-mutation';
|
|
6
|
+
import { NumberOfTeamConnectedToContainerQuery } from './utils/queries/number-of-team-connected-to-container-query';
|
|
7
|
+
import { TeamConnectedToContainerQuery } from './utils/queries/team-connected-to-container-query';
|
|
8
|
+
import { TeamContainersQueryV2 } from './utils/queries/team-containers-query';
|
|
5
9
|
import { TeamHasAgentsQuery } from './utils/queries/team-has-agents-query';
|
|
6
10
|
import TeamMembershipsQuery from './utils/queries/team-membership-query';
|
|
7
11
|
import { TeamsUserQuery } from './utils/queries/user-query';
|
|
8
12
|
import { toUserType } from './utils/user-type';
|
|
13
|
+
|
|
14
|
+
// Local type definition to avoid circular dependency with teams-public
|
|
15
|
+
|
|
9
16
|
export class AGGClient extends BaseGraphQlClient {
|
|
10
17
|
constructor(baseUrl, config) {
|
|
11
18
|
super(`${baseUrl}/graphql`, config);
|
|
@@ -92,6 +99,140 @@ export class AGGClient extends BaseGraphQlClient {
|
|
|
92
99
|
}
|
|
93
100
|
}));
|
|
94
101
|
}
|
|
102
|
+
async getTeamContainers(teamId) {
|
|
103
|
+
const teamAri = toTeamARI(teamId);
|
|
104
|
+
const cypherQuery = `MATCH (team:IdentityTeam {ari: '${teamAri}'})-[:team_connected_to_container]->(container) RETURN container`;
|
|
105
|
+
const response = await this.makeGraphQLRequest({
|
|
106
|
+
query: TeamContainersQueryV2,
|
|
107
|
+
variables: {
|
|
108
|
+
cypherQuery,
|
|
109
|
+
params: {
|
|
110
|
+
id: teamAri
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}, {
|
|
114
|
+
operationName: 'TeamContainersQueryV2'
|
|
115
|
+
});
|
|
116
|
+
return this.processV2Response(response);
|
|
117
|
+
}
|
|
118
|
+
processV2Response(response) {
|
|
119
|
+
const containersResult = response.graphStore.cypherQueryV2.edges.reduce((containers, edge) => {
|
|
120
|
+
edge.node.columns.forEach(column => {
|
|
121
|
+
var _column$value;
|
|
122
|
+
const containerData = (_column$value = column.value) === null || _column$value === void 0 ? void 0 : _column$value.data;
|
|
123
|
+
if (!containerData) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if ((containerData === null || containerData === void 0 ? void 0 : containerData.__typename) === 'ConfluenceSpace') {
|
|
127
|
+
containers.push({
|
|
128
|
+
id: containerData.id,
|
|
129
|
+
type: containerData.__typename,
|
|
130
|
+
name: containerData.confluenceSpaceName || '',
|
|
131
|
+
icon: `${containerData.links.base}${containerData.icon.path}`,
|
|
132
|
+
createdDate: new Date(containerData.createdDate),
|
|
133
|
+
link: `${containerData.links.base}${containerData.links.webUi}`,
|
|
134
|
+
containerTypeProperties: {
|
|
135
|
+
subType: undefined,
|
|
136
|
+
name: undefined
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
} else if ((containerData === null || containerData === void 0 ? void 0 : containerData.__typename) === 'JiraProject') {
|
|
140
|
+
containers.push({
|
|
141
|
+
id: containerData.id,
|
|
142
|
+
type: containerData.__typename,
|
|
143
|
+
name: containerData.jiraProjectName,
|
|
144
|
+
icon: containerData.avatar.medium,
|
|
145
|
+
createdDate: new Date(containerData.created),
|
|
146
|
+
link: containerData.webUrl,
|
|
147
|
+
containerTypeProperties: {
|
|
148
|
+
subType: containerData.projectType || '',
|
|
149
|
+
name: containerData.projectTypeName || ''
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
} else if ((containerData === null || containerData === void 0 ? void 0 : containerData.__typename) === 'LoomSpace') {
|
|
153
|
+
containers.push({
|
|
154
|
+
id: containerData.id,
|
|
155
|
+
type: containerData.__typename,
|
|
156
|
+
name: containerData.loomSpaceName,
|
|
157
|
+
icon: '',
|
|
158
|
+
link: containerData.url
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
return containers;
|
|
163
|
+
}, []);
|
|
164
|
+
return containersResult;
|
|
165
|
+
}
|
|
166
|
+
async unlinkTeamContainer(teamId, containerId) {
|
|
167
|
+
const teamAri = toTeamARI(teamId);
|
|
168
|
+
const response = await this.makeGraphQLRequest({
|
|
169
|
+
query: UnlinkContainerMutation,
|
|
170
|
+
variables: {
|
|
171
|
+
containerId,
|
|
172
|
+
teamId: teamAri
|
|
173
|
+
}
|
|
174
|
+
}, {
|
|
175
|
+
operationName: 'UnlinkContainerMutation'
|
|
176
|
+
});
|
|
177
|
+
return response.graphStore;
|
|
178
|
+
}
|
|
179
|
+
async queryNumberOfTeamConnectedToContainer(containerId) {
|
|
180
|
+
var _response$graphStore, _response$graphStore$, _response$graphStore$2;
|
|
181
|
+
const response = await this.makeGraphQLRequest({
|
|
182
|
+
query: NumberOfTeamConnectedToContainerQuery,
|
|
183
|
+
variables: {
|
|
184
|
+
containerId
|
|
185
|
+
}
|
|
186
|
+
}, {
|
|
187
|
+
operationName: 'NumberOfTeamConnectedToContainerQuery'
|
|
188
|
+
});
|
|
189
|
+
return response === null || response === void 0 ? void 0 : (_response$graphStore = response.graphStore) === null || _response$graphStore === void 0 ? void 0 : (_response$graphStore$ = _response$graphStore.teamConnectedToContainerInverse) === null || _response$graphStore$ === void 0 ? void 0 : (_response$graphStore$2 = _response$graphStore$.edges) === null || _response$graphStore$2 === void 0 ? void 0 : _response$graphStore$2.length;
|
|
190
|
+
}
|
|
191
|
+
async queryTeamsConnectedToContainer(containerId) {
|
|
192
|
+
var _response$graphStore2, _response$graphStore3, _response$graphStore4;
|
|
193
|
+
const response = await this.makeGraphQLRequest({
|
|
194
|
+
query: TeamConnectedToContainerQuery,
|
|
195
|
+
variables: {
|
|
196
|
+
containerId
|
|
197
|
+
}
|
|
198
|
+
}, {
|
|
199
|
+
operationName: 'TeamConnectedToContainerQuery'
|
|
200
|
+
});
|
|
201
|
+
return response === null || response === void 0 ? void 0 : (_response$graphStore2 = response.graphStore) === null || _response$graphStore2 === void 0 ? void 0 : (_response$graphStore3 = _response$graphStore2.teamConnectedToContainerInverse) === null || _response$graphStore3 === void 0 ? void 0 : (_response$graphStore4 = _response$graphStore3.edges) === null || _response$graphStore4 === void 0 ? void 0 : _response$graphStore4.map(({
|
|
202
|
+
node
|
|
203
|
+
}) => {
|
|
204
|
+
var _node$creator, _node$members$nodes$m, _node$members, _node$members$nodes$l, _node$members2;
|
|
205
|
+
return {
|
|
206
|
+
id: node.id,
|
|
207
|
+
displayName: node.displayName,
|
|
208
|
+
description: node.description,
|
|
209
|
+
state: node.state,
|
|
210
|
+
membershipSettings: node.membershipSettings,
|
|
211
|
+
organizationId: node.organizationId,
|
|
212
|
+
creatorId: (_node$creator = node.creator) === null || _node$creator === void 0 ? void 0 : _node$creator.id,
|
|
213
|
+
isVerified: node.isVerified,
|
|
214
|
+
members: (_node$members$nodes$m = (_node$members = node.members) === null || _node$members === void 0 ? void 0 : _node$members.nodes.map(({
|
|
215
|
+
member
|
|
216
|
+
}) => {
|
|
217
|
+
var _member$name;
|
|
218
|
+
return {
|
|
219
|
+
id: member !== null && member !== void 0 && member.id ? toUserId(member === null || member === void 0 ? void 0 : member.id) : '',
|
|
220
|
+
fullName: (_member$name = member === null || member === void 0 ? void 0 : member.name) !== null && _member$name !== void 0 ? _member$name : '',
|
|
221
|
+
avatarUrl: member === null || member === void 0 ? void 0 : member.picture,
|
|
222
|
+
status: member === null || member === void 0 ? void 0 : member.accountStatus
|
|
223
|
+
};
|
|
224
|
+
})) !== null && _node$members$nodes$m !== void 0 ? _node$members$nodes$m : [],
|
|
225
|
+
includesYou: false,
|
|
226
|
+
// to-do - this needs to be computed - https://product-fabric.atlassian.net/browse/CCECO-4368
|
|
227
|
+
memberCount: (_node$members$nodes$l = (_node$members2 = node.members) === null || _node$members2 === void 0 ? void 0 : _node$members2.nodes.length) !== null && _node$members$nodes$l !== void 0 ? _node$members$nodes$l : 0,
|
|
228
|
+
largeAvatarImageUrl: node.largeAvatarImageUrl,
|
|
229
|
+
smallAvatarImageUrl: node.smallAvatarImageUrl,
|
|
230
|
+
largeHeaderImageUrl: node.largeHeaderImageUrl,
|
|
231
|
+
smallHeaderImageUrl: node.smallHeaderImageUrl,
|
|
232
|
+
restriction: 'ORG_MEMBERS' // deprecated field, kept for backwards compatibility
|
|
233
|
+
};
|
|
234
|
+
});
|
|
235
|
+
}
|
|
95
236
|
}
|
|
96
237
|
export const aggClient = new AGGClient(DEFAULT_CONFIG.stargateRoot, {
|
|
97
238
|
logException
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { print } from 'graphql';
|
|
2
|
+
import gql from 'graphql-tag';
|
|
3
|
+
export const UnlinkContainerMutation = print(gql`
|
|
4
|
+
mutation unlinkTeamToContainerMutation($teamId: ID!, $containerId: ID!) {
|
|
5
|
+
graphStore @optIn(to: ["GraphStoreMutation"]) {
|
|
6
|
+
deleteTeamConnectedToContainer(
|
|
7
|
+
input: { relationships: [{ from: $teamId, to: $containerId }] }
|
|
8
|
+
) @optIn(to: ["GraphStoreTeamConnectedToContainer"]) {
|
|
9
|
+
errors {
|
|
10
|
+
message
|
|
11
|
+
extensions {
|
|
12
|
+
statusCode
|
|
13
|
+
errorType
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
success
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
`);
|
package/dist/es2019/services/agg-client/utils/queries/number-of-team-connected-to-container-query.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { print } from 'graphql';
|
|
2
|
+
import gql from 'graphql-tag';
|
|
3
|
+
export const NumberOfTeamConnectedToContainerQuery = print(gql`
|
|
4
|
+
query getNumberOfTeamsForContainer($containerId: ID!) {
|
|
5
|
+
graphStore @optIn(to: "GraphStore") {
|
|
6
|
+
teamConnectedToContainerInverse(id: $containerId, consistentRead: true)
|
|
7
|
+
@optIn(to: "GraphStoreTeamConnectedToContainer") {
|
|
8
|
+
edges {
|
|
9
|
+
id
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
`);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { print } from 'graphql';
|
|
2
|
+
import gql from 'graphql-tag';
|
|
3
|
+
export const TeamConnectedToContainerQuery = print(gql`
|
|
4
|
+
query getTeamsForContainer($containerId: ID!) {
|
|
5
|
+
graphStore @optIn(to: "GraphStore") {
|
|
6
|
+
teamConnectedToContainerInverse(id: $containerId, consistentRead: true)
|
|
7
|
+
@optIn(to: "GraphStoreTeamConnectedToContainer") {
|
|
8
|
+
edges {
|
|
9
|
+
node {
|
|
10
|
+
... on TeamV2 {
|
|
11
|
+
id
|
|
12
|
+
description
|
|
13
|
+
displayName
|
|
14
|
+
creator {
|
|
15
|
+
id
|
|
16
|
+
}
|
|
17
|
+
smallAvatarImageUrl
|
|
18
|
+
smallHeaderImageUrl
|
|
19
|
+
largeAvatarImageUrl
|
|
20
|
+
largeHeaderImageUrl
|
|
21
|
+
members {
|
|
22
|
+
nodes {
|
|
23
|
+
member {
|
|
24
|
+
id
|
|
25
|
+
name
|
|
26
|
+
picture
|
|
27
|
+
accountStatus
|
|
28
|
+
... on AtlassianAccountUser {
|
|
29
|
+
extendedProfile {
|
|
30
|
+
jobTitle
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
... on AppUser {
|
|
34
|
+
appType
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
role
|
|
38
|
+
state
|
|
39
|
+
}
|
|
40
|
+
pageInfo {
|
|
41
|
+
endCursor
|
|
42
|
+
hasNextPage
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
organizationId
|
|
46
|
+
membershipSettings
|
|
47
|
+
isVerified
|
|
48
|
+
state
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
`);
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { print } from 'graphql';
|
|
2
|
+
import gql from 'graphql-tag';
|
|
3
|
+
export const TeamContainersQueryV2 = print(gql`
|
|
4
|
+
query TeamContainersQueryV2($cypherQuery: String!, $params: JSON!) {
|
|
5
|
+
graphStore @optIn(to: ["GraphStore", "GraphStoreCypherQueryV2"]) {
|
|
6
|
+
cypherQueryV2(query: $cypherQuery, params: $params) {
|
|
7
|
+
edges {
|
|
8
|
+
node {
|
|
9
|
+
columns {
|
|
10
|
+
key
|
|
11
|
+
value {
|
|
12
|
+
... on GraphStoreCypherQueryV2AriNode {
|
|
13
|
+
data {
|
|
14
|
+
__typename
|
|
15
|
+
... on ConfluenceSpace {
|
|
16
|
+
id
|
|
17
|
+
confluenceSpaceName: name
|
|
18
|
+
type
|
|
19
|
+
createdDate
|
|
20
|
+
links {
|
|
21
|
+
base
|
|
22
|
+
webUi
|
|
23
|
+
}
|
|
24
|
+
icon {
|
|
25
|
+
path
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
... on JiraProject {
|
|
29
|
+
id
|
|
30
|
+
jiraProjectName: name
|
|
31
|
+
webUrl
|
|
32
|
+
created
|
|
33
|
+
avatar {
|
|
34
|
+
medium
|
|
35
|
+
}
|
|
36
|
+
projectType
|
|
37
|
+
projectTypeName
|
|
38
|
+
}
|
|
39
|
+
... on LoomSpace {
|
|
40
|
+
id
|
|
41
|
+
loomSpaceName: name
|
|
42
|
+
url
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
`);
|
|
@@ -177,6 +177,61 @@ export class TeamsClient {
|
|
|
177
177
|
return this._aggClient.queryTeamHasAgents(teamId);
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
+
/**
|
|
181
|
+
* Get containers associated with the team
|
|
182
|
+
* @param {string} teamId
|
|
183
|
+
* @returns {Promise<TeamContainers>}
|
|
184
|
+
*/
|
|
185
|
+
async getTeamContainers(teamId) {
|
|
186
|
+
return this._aggClient.getTeamContainers(teamId);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Unlink a container from a team
|
|
191
|
+
* @param {string} teamId
|
|
192
|
+
* @param {string} containerId
|
|
193
|
+
* @returns {Promise}
|
|
194
|
+
*/
|
|
195
|
+
async unlinkTeamContainer(teamId, containerId) {
|
|
196
|
+
return this._aggClient.unlinkTeamContainer(teamId, containerId);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Get the number of teams connected to a container
|
|
201
|
+
* @param {string} containerId
|
|
202
|
+
* @returns {Promise<number>}
|
|
203
|
+
*/
|
|
204
|
+
async queryNumberOfTeamConnectedToContainer(containerId) {
|
|
205
|
+
return this._aggClient.queryNumberOfTeamConnectedToContainer(containerId);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Get the number of teams connected to a container (Confluence space or Jira project)
|
|
210
|
+
* @param {string} containerId
|
|
211
|
+
* @returns {Promise<number>}
|
|
212
|
+
*/
|
|
213
|
+
async getNumberOfConnectedTeams(containerId) {
|
|
214
|
+
return this.queryNumberOfTeamConnectedToContainer(containerId);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Get teams connected to a container
|
|
219
|
+
* @param {string} containerId
|
|
220
|
+
* @returns {Promise<TeamWithMemberships[]>}
|
|
221
|
+
*/
|
|
222
|
+
async queryTeamsConnectedToContainer(containerId) {
|
|
223
|
+
return this._aggClient.queryTeamsConnectedToContainer(containerId);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Get teams connected to a container (Confluence space or Jira project)
|
|
228
|
+
* @param {string} containerId
|
|
229
|
+
* @returns {Promise<TeamWithMemberships[]>}
|
|
230
|
+
*/
|
|
231
|
+
async getConnectedTeams(containerId) {
|
|
232
|
+
return this.queryTeamsConnectedToContainer(containerId);
|
|
233
|
+
}
|
|
234
|
+
|
|
180
235
|
/**
|
|
181
236
|
* Get user information of a member of a team
|
|
182
237
|
* @param {string} userId
|
|
@@ -28,7 +28,7 @@ export function getSentryConfig(options) {
|
|
|
28
28
|
...DEFAULT_SENTRY_CONFIG,
|
|
29
29
|
// Standalone __VERSION__ is set from `bin/set-release-version.sh`
|
|
30
30
|
// when building to deploy to production
|
|
31
|
-
release: `${"@atlaskit/teams-client"}@${"4.
|
|
31
|
+
release: `${"@atlaskit/teams-client"}@${"4.28.0"}` ||
|
|
32
32
|
// @ts-ignore Jira - window.BUILD_KEY
|
|
33
33
|
window.BUILD_KEY || ( // @ts-ignore Confluence - window.__buildInfo
|
|
34
34
|
(_window$__buildInfo = window.__buildInfo) === null || _window$__buildInfo === void 0 ? void 0 : _window$__buildInfo.FRONTEND_VERSION) || '---',
|
|
@@ -45,7 +45,7 @@ export var TeamsUFOExperience = /*#__PURE__*/function (_UFOExperience) {
|
|
|
45
45
|
return _superPropGet(TeamsUFOExperience, "failure", this, 3)([{
|
|
46
46
|
metadata: {
|
|
47
47
|
error: createErrorMetadata(error),
|
|
48
|
-
packageVersion: "4.
|
|
48
|
+
packageVersion: "4.28.0",
|
|
49
49
|
packageName: "@atlaskit/teams-client"
|
|
50
50
|
}
|
|
51
51
|
}]);
|
|
@@ -53,7 +53,7 @@ export var TeamsUFOExperience = /*#__PURE__*/function (_UFOExperience) {
|
|
|
53
53
|
return _superPropGet(TeamsUFOExperience, "failure", this, 3)([{
|
|
54
54
|
metadata: {
|
|
55
55
|
error: 'unknown error',
|
|
56
|
-
packageVersion: "4.
|
|
56
|
+
packageVersion: "4.28.0",
|
|
57
57
|
packageName: "@atlaskit/teams-client"
|
|
58
58
|
}
|
|
59
59
|
}]);
|
|
@@ -14,10 +14,17 @@ import { toTeamARI, toUserId } from '../../common/utils/ari';
|
|
|
14
14
|
import { DEFAULT_CONFIG } from '../constants';
|
|
15
15
|
import { BaseGraphQlClient } from '../graphql-client';
|
|
16
16
|
import { logException } from '../sentry/main';
|
|
17
|
+
import { UnlinkContainerMutation } from './utils/mutations/unlink-container-mutation';
|
|
18
|
+
import { NumberOfTeamConnectedToContainerQuery } from './utils/queries/number-of-team-connected-to-container-query';
|
|
19
|
+
import { TeamConnectedToContainerQuery } from './utils/queries/team-connected-to-container-query';
|
|
20
|
+
import { TeamContainersQueryV2 } from './utils/queries/team-containers-query';
|
|
17
21
|
import { TeamHasAgentsQuery } from './utils/queries/team-has-agents-query';
|
|
18
22
|
import TeamMembershipsQuery from './utils/queries/team-membership-query';
|
|
19
23
|
import { TeamsUserQuery } from './utils/queries/user-query';
|
|
20
24
|
import { toUserType } from './utils/user-type';
|
|
25
|
+
|
|
26
|
+
// Local type definition to avoid circular dependency with teams-public
|
|
27
|
+
|
|
21
28
|
export var AGGClient = /*#__PURE__*/function (_BaseGraphQlClient) {
|
|
22
29
|
function AGGClient(baseUrl, config) {
|
|
23
30
|
_classCallCheck(this, AGGClient);
|
|
@@ -174,6 +181,220 @@ export var AGGClient = /*#__PURE__*/function (_BaseGraphQlClient) {
|
|
|
174
181
|
};
|
|
175
182
|
});
|
|
176
183
|
}
|
|
184
|
+
}, {
|
|
185
|
+
key: "getTeamContainers",
|
|
186
|
+
value: function () {
|
|
187
|
+
var _getTeamContainers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(teamId) {
|
|
188
|
+
var teamAri, cypherQuery, response;
|
|
189
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
190
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
191
|
+
case 0:
|
|
192
|
+
teamAri = toTeamARI(teamId);
|
|
193
|
+
cypherQuery = "MATCH (team:IdentityTeam {ari: '".concat(teamAri, "'})-[:team_connected_to_container]->(container) RETURN container");
|
|
194
|
+
_context4.next = 4;
|
|
195
|
+
return this.makeGraphQLRequest({
|
|
196
|
+
query: TeamContainersQueryV2,
|
|
197
|
+
variables: {
|
|
198
|
+
cypherQuery: cypherQuery,
|
|
199
|
+
params: {
|
|
200
|
+
id: teamAri
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}, {
|
|
204
|
+
operationName: 'TeamContainersQueryV2'
|
|
205
|
+
});
|
|
206
|
+
case 4:
|
|
207
|
+
response = _context4.sent;
|
|
208
|
+
return _context4.abrupt("return", this.processV2Response(response));
|
|
209
|
+
case 6:
|
|
210
|
+
case "end":
|
|
211
|
+
return _context4.stop();
|
|
212
|
+
}
|
|
213
|
+
}, _callee4, this);
|
|
214
|
+
}));
|
|
215
|
+
function getTeamContainers(_x4) {
|
|
216
|
+
return _getTeamContainers.apply(this, arguments);
|
|
217
|
+
}
|
|
218
|
+
return getTeamContainers;
|
|
219
|
+
}()
|
|
220
|
+
}, {
|
|
221
|
+
key: "processV2Response",
|
|
222
|
+
value: function processV2Response(response) {
|
|
223
|
+
var containersResult = response.graphStore.cypherQueryV2.edges.reduce(function (containers, edge) {
|
|
224
|
+
edge.node.columns.forEach(function (column) {
|
|
225
|
+
var _column$value;
|
|
226
|
+
var containerData = (_column$value = column.value) === null || _column$value === void 0 ? void 0 : _column$value.data;
|
|
227
|
+
if (!containerData) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
if ((containerData === null || containerData === void 0 ? void 0 : containerData.__typename) === 'ConfluenceSpace') {
|
|
231
|
+
containers.push({
|
|
232
|
+
id: containerData.id,
|
|
233
|
+
type: containerData.__typename,
|
|
234
|
+
name: containerData.confluenceSpaceName || '',
|
|
235
|
+
icon: "".concat(containerData.links.base).concat(containerData.icon.path),
|
|
236
|
+
createdDate: new Date(containerData.createdDate),
|
|
237
|
+
link: "".concat(containerData.links.base).concat(containerData.links.webUi),
|
|
238
|
+
containerTypeProperties: {
|
|
239
|
+
subType: undefined,
|
|
240
|
+
name: undefined
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
} else if ((containerData === null || containerData === void 0 ? void 0 : containerData.__typename) === 'JiraProject') {
|
|
244
|
+
containers.push({
|
|
245
|
+
id: containerData.id,
|
|
246
|
+
type: containerData.__typename,
|
|
247
|
+
name: containerData.jiraProjectName,
|
|
248
|
+
icon: containerData.avatar.medium,
|
|
249
|
+
createdDate: new Date(containerData.created),
|
|
250
|
+
link: containerData.webUrl,
|
|
251
|
+
containerTypeProperties: {
|
|
252
|
+
subType: containerData.projectType || '',
|
|
253
|
+
name: containerData.projectTypeName || ''
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
} else if ((containerData === null || containerData === void 0 ? void 0 : containerData.__typename) === 'LoomSpace') {
|
|
257
|
+
containers.push({
|
|
258
|
+
id: containerData.id,
|
|
259
|
+
type: containerData.__typename,
|
|
260
|
+
name: containerData.loomSpaceName,
|
|
261
|
+
icon: '',
|
|
262
|
+
link: containerData.url
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
return containers;
|
|
267
|
+
}, []);
|
|
268
|
+
return containersResult;
|
|
269
|
+
}
|
|
270
|
+
}, {
|
|
271
|
+
key: "unlinkTeamContainer",
|
|
272
|
+
value: function () {
|
|
273
|
+
var _unlinkTeamContainer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(teamId, containerId) {
|
|
274
|
+
var teamAri, response;
|
|
275
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
276
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
277
|
+
case 0:
|
|
278
|
+
teamAri = toTeamARI(teamId);
|
|
279
|
+
_context5.next = 3;
|
|
280
|
+
return this.makeGraphQLRequest({
|
|
281
|
+
query: UnlinkContainerMutation,
|
|
282
|
+
variables: {
|
|
283
|
+
containerId: containerId,
|
|
284
|
+
teamId: teamAri
|
|
285
|
+
}
|
|
286
|
+
}, {
|
|
287
|
+
operationName: 'UnlinkContainerMutation'
|
|
288
|
+
});
|
|
289
|
+
case 3:
|
|
290
|
+
response = _context5.sent;
|
|
291
|
+
return _context5.abrupt("return", response.graphStore);
|
|
292
|
+
case 5:
|
|
293
|
+
case "end":
|
|
294
|
+
return _context5.stop();
|
|
295
|
+
}
|
|
296
|
+
}, _callee5, this);
|
|
297
|
+
}));
|
|
298
|
+
function unlinkTeamContainer(_x5, _x6) {
|
|
299
|
+
return _unlinkTeamContainer.apply(this, arguments);
|
|
300
|
+
}
|
|
301
|
+
return unlinkTeamContainer;
|
|
302
|
+
}()
|
|
303
|
+
}, {
|
|
304
|
+
key: "queryNumberOfTeamConnectedToContainer",
|
|
305
|
+
value: function () {
|
|
306
|
+
var _queryNumberOfTeamConnectedToContainer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(containerId) {
|
|
307
|
+
var _response$graphStore;
|
|
308
|
+
var response;
|
|
309
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
310
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
311
|
+
case 0:
|
|
312
|
+
_context6.next = 2;
|
|
313
|
+
return this.makeGraphQLRequest({
|
|
314
|
+
query: NumberOfTeamConnectedToContainerQuery,
|
|
315
|
+
variables: {
|
|
316
|
+
containerId: containerId
|
|
317
|
+
}
|
|
318
|
+
}, {
|
|
319
|
+
operationName: 'NumberOfTeamConnectedToContainerQuery'
|
|
320
|
+
});
|
|
321
|
+
case 2:
|
|
322
|
+
response = _context6.sent;
|
|
323
|
+
return _context6.abrupt("return", response === null || response === void 0 || (_response$graphStore = response.graphStore) === null || _response$graphStore === void 0 || (_response$graphStore = _response$graphStore.teamConnectedToContainerInverse) === null || _response$graphStore === void 0 || (_response$graphStore = _response$graphStore.edges) === null || _response$graphStore === void 0 ? void 0 : _response$graphStore.length);
|
|
324
|
+
case 4:
|
|
325
|
+
case "end":
|
|
326
|
+
return _context6.stop();
|
|
327
|
+
}
|
|
328
|
+
}, _callee6, this);
|
|
329
|
+
}));
|
|
330
|
+
function queryNumberOfTeamConnectedToContainer(_x7) {
|
|
331
|
+
return _queryNumberOfTeamConnectedToContainer.apply(this, arguments);
|
|
332
|
+
}
|
|
333
|
+
return queryNumberOfTeamConnectedToContainer;
|
|
334
|
+
}()
|
|
335
|
+
}, {
|
|
336
|
+
key: "queryTeamsConnectedToContainer",
|
|
337
|
+
value: function () {
|
|
338
|
+
var _queryTeamsConnectedToContainer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(containerId) {
|
|
339
|
+
var _response$graphStore2;
|
|
340
|
+
var response;
|
|
341
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
342
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
343
|
+
case 0:
|
|
344
|
+
_context7.next = 2;
|
|
345
|
+
return this.makeGraphQLRequest({
|
|
346
|
+
query: TeamConnectedToContainerQuery,
|
|
347
|
+
variables: {
|
|
348
|
+
containerId: containerId
|
|
349
|
+
}
|
|
350
|
+
}, {
|
|
351
|
+
operationName: 'TeamConnectedToContainerQuery'
|
|
352
|
+
});
|
|
353
|
+
case 2:
|
|
354
|
+
response = _context7.sent;
|
|
355
|
+
return _context7.abrupt("return", response === null || response === void 0 || (_response$graphStore2 = response.graphStore) === null || _response$graphStore2 === void 0 || (_response$graphStore2 = _response$graphStore2.teamConnectedToContainerInverse) === null || _response$graphStore2 === void 0 || (_response$graphStore2 = _response$graphStore2.edges) === null || _response$graphStore2 === void 0 ? void 0 : _response$graphStore2.map(function (_ref3) {
|
|
356
|
+
var _node$creator, _node$members$nodes$m, _node$members, _node$members$nodes$l, _node$members2;
|
|
357
|
+
var node = _ref3.node;
|
|
358
|
+
return {
|
|
359
|
+
id: node.id,
|
|
360
|
+
displayName: node.displayName,
|
|
361
|
+
description: node.description,
|
|
362
|
+
state: node.state,
|
|
363
|
+
membershipSettings: node.membershipSettings,
|
|
364
|
+
organizationId: node.organizationId,
|
|
365
|
+
creatorId: (_node$creator = node.creator) === null || _node$creator === void 0 ? void 0 : _node$creator.id,
|
|
366
|
+
isVerified: node.isVerified,
|
|
367
|
+
members: (_node$members$nodes$m = (_node$members = node.members) === null || _node$members === void 0 ? void 0 : _node$members.nodes.map(function (_ref4) {
|
|
368
|
+
var _member$name;
|
|
369
|
+
var member = _ref4.member;
|
|
370
|
+
return {
|
|
371
|
+
id: member !== null && member !== void 0 && member.id ? toUserId(member === null || member === void 0 ? void 0 : member.id) : '',
|
|
372
|
+
fullName: (_member$name = member === null || member === void 0 ? void 0 : member.name) !== null && _member$name !== void 0 ? _member$name : '',
|
|
373
|
+
avatarUrl: member === null || member === void 0 ? void 0 : member.picture,
|
|
374
|
+
status: member === null || member === void 0 ? void 0 : member.accountStatus
|
|
375
|
+
};
|
|
376
|
+
})) !== null && _node$members$nodes$m !== void 0 ? _node$members$nodes$m : [],
|
|
377
|
+
includesYou: false,
|
|
378
|
+
// to-do - this needs to be computed - https://product-fabric.atlassian.net/browse/CCECO-4368
|
|
379
|
+
memberCount: (_node$members$nodes$l = (_node$members2 = node.members) === null || _node$members2 === void 0 ? void 0 : _node$members2.nodes.length) !== null && _node$members$nodes$l !== void 0 ? _node$members$nodes$l : 0,
|
|
380
|
+
largeAvatarImageUrl: node.largeAvatarImageUrl,
|
|
381
|
+
smallAvatarImageUrl: node.smallAvatarImageUrl,
|
|
382
|
+
largeHeaderImageUrl: node.largeHeaderImageUrl,
|
|
383
|
+
smallHeaderImageUrl: node.smallHeaderImageUrl,
|
|
384
|
+
restriction: 'ORG_MEMBERS' // deprecated field, kept for backwards compatibility
|
|
385
|
+
};
|
|
386
|
+
}));
|
|
387
|
+
case 4:
|
|
388
|
+
case "end":
|
|
389
|
+
return _context7.stop();
|
|
390
|
+
}
|
|
391
|
+
}, _callee7, this);
|
|
392
|
+
}));
|
|
393
|
+
function queryTeamsConnectedToContainer(_x8) {
|
|
394
|
+
return _queryTeamsConnectedToContainer.apply(this, arguments);
|
|
395
|
+
}
|
|
396
|
+
return queryTeamsConnectedToContainer;
|
|
397
|
+
}()
|
|
177
398
|
}]);
|
|
178
399
|
}(BaseGraphQlClient);
|
|
179
400
|
export var aggClient = new AGGClient(DEFAULT_CONFIG.stargateRoot, {
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject;
|
|
3
|
+
import { print } from 'graphql';
|
|
4
|
+
import gql from 'graphql-tag';
|
|
5
|
+
export var UnlinkContainerMutation = print(gql(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\tmutation unlinkTeamToContainerMutation($teamId: ID!, $containerId: ID!) {\n\t\tgraphStore @optIn(to: [\"GraphStoreMutation\"]) {\n\t\t\tdeleteTeamConnectedToContainer(\n\t\t\t\tinput: { relationships: [{ from: $teamId, to: $containerId }] }\n\t\t\t) @optIn(to: [\"GraphStoreTeamConnectedToContainer\"]) {\n\t\t\t\terrors {\n\t\t\t\t\tmessage\n\t\t\t\t\textensions {\n\t\t\t\t\t\tstatusCode\n\t\t\t\t\t\terrorType\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tsuccess\n\t\t\t}\n\t\t}\n\t}\n"]))));
|
package/dist/esm/services/agg-client/utils/queries/number-of-team-connected-to-container-query.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject;
|
|
3
|
+
import { print } from 'graphql';
|
|
4
|
+
import gql from 'graphql-tag';
|
|
5
|
+
export var NumberOfTeamConnectedToContainerQuery = print(gql(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\tquery getNumberOfTeamsForContainer($containerId: ID!) {\n\t\tgraphStore @optIn(to: \"GraphStore\") {\n\t\t\tteamConnectedToContainerInverse(id: $containerId, consistentRead: true)\n\t\t\t\t@optIn(to: \"GraphStoreTeamConnectedToContainer\") {\n\t\t\t\tedges {\n\t\t\t\t\tid\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n"]))));
|