@atlaskit/teams-client 4.6.3 → 4.7.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.
Files changed (30) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/common/utils/ufo/index.js +2 -2
  3. package/dist/cjs/services/agg-client/index.js +51 -0
  4. package/dist/cjs/services/agg-client/utils/queries/team-has-agents-query.js +12 -0
  5. package/dist/cjs/services/main.js +515 -490
  6. package/dist/cjs/services/sentry/utils/get-sentry-config.js +1 -1
  7. package/dist/cjs/types/association.js +5 -0
  8. package/dist/es2019/common/utils/ufo/index.js +2 -2
  9. package/dist/es2019/services/agg-client/index.js +29 -1
  10. package/dist/es2019/services/agg-client/utils/queries/team-has-agents-query.js +24 -0
  11. package/dist/es2019/services/main.js +9 -0
  12. package/dist/es2019/services/sentry/utils/get-sentry-config.js +1 -1
  13. package/dist/es2019/types/association.js +1 -0
  14. package/dist/esm/common/utils/ufo/index.js +2 -2
  15. package/dist/esm/services/agg-client/index.js +52 -1
  16. package/dist/esm/services/agg-client/utils/queries/team-has-agents-query.js +5 -0
  17. package/dist/esm/services/main.js +515 -490
  18. package/dist/esm/services/sentry/utils/get-sentry-config.js +1 -1
  19. package/dist/esm/types/association.js +1 -0
  20. package/dist/types/services/agg-client/index.d.ts +3 -1
  21. package/dist/types/services/agg-client/utils/queries/team-has-agents-query.d.ts +15 -0
  22. package/dist/types/services/main.d.ts +6 -0
  23. package/dist/types/types/association.d.ts +8 -0
  24. package/dist/types/types/index.d.ts +2 -1
  25. package/dist/types-ts4.5/services/agg-client/index.d.ts +3 -1
  26. package/dist/types-ts4.5/services/agg-client/utils/queries/team-has-agents-query.d.ts +15 -0
  27. package/dist/types-ts4.5/services/main.d.ts +6 -0
  28. package/dist/types-ts4.5/types/association.d.ts +8 -0
  29. package/dist/types-ts4.5/types/index.d.ts +2 -1
  30. package/package.json +1 -1
@@ -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.6.2") ||
39
+ release: "".concat("@atlaskit/teams-client", "@").concat("4.6.4") ||
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) || '---',
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -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.6.2",
30
+ packageVersion: "4.6.4",
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.6.2",
38
+ packageVersion: "4.6.4",
39
39
  packageName: "@atlaskit/teams-client"
40
40
  }
41
41
  });
@@ -1,7 +1,8 @@
1
- import { toUserId } from '../../common/utils/ari';
1
+ 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 { TeamHasAgentsQuery } from './utils/queries/team-has-agents-query';
5
6
  import TeamMembershipsQuery from './utils/queries/team-membership-query';
6
7
  import { TeamsUserQuery } from './utils/queries/user-query';
7
8
  import { toUserType } from './utils/user-type';
@@ -64,6 +65,33 @@ export class AGGClient extends BaseGraphQlClient {
64
65
  });
65
66
  return response.user;
66
67
  }
68
+ async queryTeamHasAgents(teamId) {
69
+ const teamAri = toTeamARI(teamId);
70
+ const response = await this.makeGraphQLRequest({
71
+ query: TeamHasAgentsQuery,
72
+ variables: {
73
+ id: teamAri
74
+ }
75
+ }, {
76
+ operationName: 'TeamHasAgentsQuery'
77
+ });
78
+ return this.processTeamHasAgentsResponse(teamId, response.graphStore);
79
+ }
80
+ processTeamHasAgentsResponse(teamId, response) {
81
+ return response.teamHasAgents.edges.map(({
82
+ node
83
+ }) => ({
84
+ associationId: {
85
+ teamId,
86
+ memberId: toUserId(node.id)
87
+ },
88
+ agent: {
89
+ id: node.id,
90
+ fullName: node.name,
91
+ avatarUrl: node.picture
92
+ }
93
+ }));
94
+ }
67
95
  }
68
96
  export const aggClient = new AGGClient(DEFAULT_CONFIG.stargateRoot, {
69
97
  logException
@@ -0,0 +1,24 @@
1
+ import { print } from 'graphql';
2
+ import gql from 'graphql-tag';
3
+ export const TeamHasAgentsQuery = print(gql`
4
+ query serviceName_TeamHasAgentsQuery($id: ID!) {
5
+ graphStore @optIn(to: "GraphStore") {
6
+ teamHasAgents(id: $id) @optIn(to: "GraphStoreTeamHasAgents") {
7
+ edges {
8
+ node {
9
+ ... on AppUser {
10
+ id
11
+ name
12
+ picture
13
+ }
14
+ }
15
+ cursor
16
+ }
17
+ pageInfo {
18
+ hasNextPage
19
+ endCursor
20
+ }
21
+ }
22
+ }
23
+ }
24
+ `);
@@ -157,6 +157,15 @@ export class TeamsClient {
157
157
  return this._aggClient.queryAGGUser(userId);
158
158
  }
159
159
 
160
+ /**
161
+ * Get the agents associated with the team
162
+ * @param {string} userId
163
+ * @returns {Promise}
164
+ */
165
+ async queryTeamHasAgents(teamId) {
166
+ return this._aggClient.queryTeamHasAgents(teamId);
167
+ }
168
+
160
169
  /**
161
170
  * Get user information of a member of a team
162
171
  * @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.6.2"}` ||
31
+ release: `${"@atlaskit/teams-client"}@${"4.6.4"}` ||
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) || '---',
@@ -0,0 +1 @@
1
+ export {};
@@ -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.6.2",
48
+ packageVersion: "4.6.4",
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.6.2",
56
+ packageVersion: "4.6.4",
57
57
  packageName: "@atlaskit/teams-client"
58
58
  }
59
59
  }]);
@@ -10,10 +10,11 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
10
10
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
11
11
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
12
12
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
13
- import { toUserId } from '../../common/utils/ari';
13
+ 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 { TeamHasAgentsQuery } from './utils/queries/team-has-agents-query';
17
18
  import TeamMembershipsQuery from './utils/queries/team-membership-query';
18
19
  import { TeamsUserQuery } from './utils/queries/user-query';
19
20
  import { toUserType } from './utils/user-type';
@@ -123,6 +124,56 @@ export var AGGClient = /*#__PURE__*/function (_BaseGraphQlClient) {
123
124
  }
124
125
  return queryAGGUser;
125
126
  }()
127
+ }, {
128
+ key: "queryTeamHasAgents",
129
+ value: function () {
130
+ var _queryTeamHasAgents = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(teamId) {
131
+ var teamAri, response;
132
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
133
+ while (1) switch (_context3.prev = _context3.next) {
134
+ case 0:
135
+ teamAri = toTeamARI(teamId);
136
+ _context3.next = 3;
137
+ return this.makeGraphQLRequest({
138
+ query: TeamHasAgentsQuery,
139
+ variables: {
140
+ id: teamAri
141
+ }
142
+ }, {
143
+ operationName: 'TeamHasAgentsQuery'
144
+ });
145
+ case 3:
146
+ response = _context3.sent;
147
+ return _context3.abrupt("return", this.processTeamHasAgentsResponse(teamId, response.graphStore));
148
+ case 5:
149
+ case "end":
150
+ return _context3.stop();
151
+ }
152
+ }, _callee3, this);
153
+ }));
154
+ function queryTeamHasAgents(_x3) {
155
+ return _queryTeamHasAgents.apply(this, arguments);
156
+ }
157
+ return queryTeamHasAgents;
158
+ }()
159
+ }, {
160
+ key: "processTeamHasAgentsResponse",
161
+ value: function processTeamHasAgentsResponse(teamId, response) {
162
+ return response.teamHasAgents.edges.map(function (_ref2) {
163
+ var node = _ref2.node;
164
+ return {
165
+ associationId: {
166
+ teamId: teamId,
167
+ memberId: toUserId(node.id)
168
+ },
169
+ agent: {
170
+ id: node.id,
171
+ fullName: node.name,
172
+ avatarUrl: node.picture
173
+ }
174
+ };
175
+ });
176
+ }
126
177
  }]);
127
178
  }(BaseGraphQlClient);
128
179
  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 TeamHasAgentsQuery = print(gql(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\tquery serviceName_TeamHasAgentsQuery($id: ID!) {\n\t\tgraphStore @optIn(to: \"GraphStore\") {\n\t\t\tteamHasAgents(id: $id) @optIn(to: \"GraphStoreTeamHasAgents\") {\n\t\t\t\tedges {\n\t\t\t\t\tnode {\n\t\t\t\t\t\t... on AppUser {\n\t\t\t\t\t\t\tid\n\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\tpicture\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcursor\n\t\t\t\t}\n\t\t\t\tpageInfo {\n\t\t\t\t\thasNextPage\n\t\t\t\t\tendCursor\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n"]))));