@atlaskit/teams-client 4.24.0 → 4.24.1

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # @atlaskit/teams-client
2
2
 
3
+ ## 4.24.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`16637112d793a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/16637112d793a) -
8
+ Team creation accepts both team type ID and team type ARI
9
+
3
10
  ## 4.24.0
4
11
 
5
12
  ### Minor Changes
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.USER_ARI_PREFIX = exports.TEAM_ARI_PREFIX = void 0;
6
+ exports.USER_ARI_PREFIX = exports.TEAM_TYPE_ARI_PREFIX = exports.TEAM_ARI_PREFIX = void 0;
7
7
  var USER_ARI_PREFIX = exports.USER_ARI_PREFIX = 'ari:cloud:identity::user/';
8
- var TEAM_ARI_PREFIX = exports.TEAM_ARI_PREFIX = 'ari:cloud:identity::team/';
8
+ var TEAM_ARI_PREFIX = exports.TEAM_ARI_PREFIX = 'ari:cloud:identity::team/';
9
+ var TEAM_TYPE_ARI_PREFIX = exports.TEAM_TYPE_ARI_PREFIX = 'ari:cloud:identity::team-type/';
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.toUserId = exports.toUserARI = exports.toTeamId = exports.toTeamARI = exports.isUserARI = exports.isTeamARI = void 0;
6
+ exports.toUserId = exports.toUserARI = exports.toTeamTypeId = exports.toTeamId = exports.toTeamARI = exports.isUserARI = exports.isTeamTypeAri = exports.isTeamARI = void 0;
7
7
  var _types = require("../types");
8
8
  var isUserARI = exports.isUserARI = function isUserARI(ari) {
9
9
  return ari.startsWith(_types.USER_ARI_PREFIX);
@@ -28,4 +28,17 @@ var toTeamId = exports.toTeamId = function toTeamId(ari) {
28
28
  };
29
29
  var toTeamARI = exports.toTeamARI = function toTeamARI(teamId) {
30
30
  return isTeamARI(teamId) ? teamId : "".concat(_types.TEAM_ARI_PREFIX).concat(teamId);
31
+ };
32
+
33
+ /**
34
+ * TODO: Replace these team type ari utils with @atlassian/ari when it is published
35
+ */
36
+ var isTeamTypeAri = exports.isTeamTypeAri = function isTeamTypeAri(ari) {
37
+ return ari.startsWith(_types.TEAM_TYPE_ARI_PREFIX);
38
+ };
39
+ var toTeamTypeId = exports.toTeamTypeId = function toTeamTypeId(teamTypeAriOrId) {
40
+ if (isTeamTypeAri(teamTypeAriOrId)) {
41
+ return teamTypeAriOrId.replace(_types.TEAM_TYPE_ARI_PREFIX, '');
42
+ }
43
+ return teamTypeAriOrId;
31
44
  };
package/dist/cjs/index.js CHANGED
@@ -111,6 +111,12 @@ Object.defineProperty(exports, "toTeamId", {
111
111
  return _ari.toTeamId;
112
112
  }
113
113
  });
114
+ Object.defineProperty(exports, "toTeamTypeId", {
115
+ enumerable: true,
116
+ get: function get() {
117
+ return _ari.toTeamTypeId;
118
+ }
119
+ });
114
120
  Object.defineProperty(exports, "toUserARI", {
115
121
  enumerable: true,
116
122
  get: function get() {
@@ -15,6 +15,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
15
15
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
16
16
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
17
17
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
18
+ var _ari = require("../../common/utils/ari");
18
19
  var _constants = require("../constants");
19
20
  var _restClient = require("../rest-client");
20
21
  var _excluded = ["linkUri"];
@@ -673,7 +674,7 @@ var LegionClient = exports.LegionClient = /*#__PURE__*/function (_RestClient) {
673
674
  while (1) switch (_context21.prev = _context21.next) {
674
675
  case 0:
675
676
  siteId = this.getCloudId();
676
- return _context21.abrupt("return", this.postResourceRaw("".concat(v4UrlPath, "/archive?siteId=").concat(siteId), JSON.stringify([this.trimTeamARI(teamId)])));
677
+ return _context21.abrupt("return", this.postResource("".concat(v4UrlPath, "/").concat(this.trimTeamARI(teamId), "/archive?siteId=").concat(siteId)));
677
678
  case 2:
678
679
  case "end":
679
680
  return _context21.stop();
@@ -694,7 +695,7 @@ var LegionClient = exports.LegionClient = /*#__PURE__*/function (_RestClient) {
694
695
  while (1) switch (_context22.prev = _context22.next) {
695
696
  case 0:
696
697
  siteId = this.getCloudId();
697
- return _context22.abrupt("return", this.postResourceRaw("".concat(v4UrlPath, "/unarchive?siteId=").concat(siteId), JSON.stringify([this.trimTeamARI(teamId)])));
698
+ return _context22.abrupt("return", this.postResource("".concat(v4UrlPath, "/").concat(this.trimTeamARI(teamId), "/unarchive?siteId=").concat(siteId)));
698
699
  case 2:
699
700
  case "end":
700
701
  return _context22.stop();
@@ -789,7 +790,7 @@ var LegionClient = exports.LegionClient = /*#__PURE__*/function (_RestClient) {
789
790
  siteId: this.getCloudId(),
790
791
  organizationId: organizationId,
791
792
  members: (0, _toConsumableArray2.default)(new Set(members)),
792
- typeId: typeId
793
+ typeId: typeId ? (0, _ari.toTeamTypeId)(typeId) : undefined
793
794
  });
794
795
  case 10:
795
796
  legionTeam = _context25.sent;
@@ -1,2 +1,3 @@
1
1
  export const USER_ARI_PREFIX = 'ari:cloud:identity::user/';
2
- export const TEAM_ARI_PREFIX = 'ari:cloud:identity::team/';
2
+ export const TEAM_ARI_PREFIX = 'ari:cloud:identity::team/';
3
+ export const TEAM_TYPE_ARI_PREFIX = 'ari:cloud:identity::team-type/';
@@ -1,4 +1,4 @@
1
- import { TEAM_ARI_PREFIX, USER_ARI_PREFIX } from '../types';
1
+ import { TEAM_ARI_PREFIX, TEAM_TYPE_ARI_PREFIX, USER_ARI_PREFIX } from '../types';
2
2
  export const isUserARI = ari => ari.startsWith(USER_ARI_PREFIX);
3
3
  export const toUserId = ari => {
4
4
  if (isUserARI(ari)) {
@@ -18,4 +18,15 @@ export const toTeamId = ari => {
18
18
  };
19
19
  export const toTeamARI = teamId => {
20
20
  return isTeamARI(teamId) ? teamId : `${TEAM_ARI_PREFIX}${teamId}`;
21
+ };
22
+
23
+ /**
24
+ * TODO: Replace these team type ari utils with @atlassian/ari when it is published
25
+ */
26
+ export const isTeamTypeAri = ari => ari.startsWith(TEAM_TYPE_ARI_PREFIX);
27
+ export const toTeamTypeId = teamTypeAriOrId => {
28
+ if (isTeamTypeAri(teamTypeAriOrId)) {
29
+ return teamTypeAriOrId.replace(TEAM_TYPE_ARI_PREFIX, '');
30
+ }
31
+ return teamTypeAriOrId;
21
32
  };
@@ -15,5 +15,5 @@ export { userInfoProvider, UserInfoProvider } from './services/user-info-provide
15
15
 
16
16
  // /utils
17
17
  export { sortMembersByType, isInvited, isMember, isNonMember, isRequestingJoin } from './common/utils';
18
- export { toUserARI, toUserId, toTeamARI, toTeamId } from './common/utils/ari';
18
+ export { toUserARI, toUserId, toTeamARI, toTeamId, toTeamTypeId } from './common/utils/ari';
19
19
  export { useLazyQueryLight, useQueryLight, UseQueryLightError } from './services/use-query-light';
@@ -1,3 +1,4 @@
1
+ import { toTeamTypeId } from '../../common/utils/ari';
1
2
  import { DEFAULT_CONFIG } from '../constants';
2
3
  import { RestClient } from '../rest-client';
3
4
 
@@ -249,11 +250,11 @@ export class LegionClient extends RestClient {
249
250
  }
250
251
  async archiveTeam(teamId) {
251
252
  const siteId = this.getCloudId();
252
- return this.postResourceRaw(`${v4UrlPath}/archive?siteId=${siteId}`, JSON.stringify([this.trimTeamARI(teamId)]));
253
+ return this.postResource(`${v4UrlPath}/${this.trimTeamARI(teamId)}/archive?siteId=${siteId}`);
253
254
  }
254
255
  async unArchiveTeam(teamId) {
255
256
  const siteId = this.getCloudId();
256
- return this.postResourceRaw(`${v4UrlPath}/unarchive?siteId=${siteId}`, JSON.stringify([this.trimTeamARI(teamId)]));
257
+ return this.postResource(`${v4UrlPath}/${this.trimTeamARI(teamId)}/unarchive?siteId=${siteId}`);
257
258
  }
258
259
  async unlinkTeamFromGroup(teamId, membershipSettings) {
259
260
  return this.patchResource(`${v4UrlPath}/${this.trimTeamARI(teamId)}`, {
@@ -285,7 +286,7 @@ export class LegionClient extends RestClient {
285
286
  siteId: this.getCloudId(),
286
287
  organizationId: organizationId,
287
288
  members: [...new Set(members)],
288
- typeId
289
+ typeId: typeId ? toTeamTypeId(typeId) : undefined
289
290
  });
290
291
  return this.mapTeamCreateResponseV4ToTeam(legionTeam);
291
292
  }
@@ -1,2 +1,3 @@
1
1
  export var USER_ARI_PREFIX = 'ari:cloud:identity::user/';
2
- export var TEAM_ARI_PREFIX = 'ari:cloud:identity::team/';
2
+ export var TEAM_ARI_PREFIX = 'ari:cloud:identity::team/';
3
+ export var TEAM_TYPE_ARI_PREFIX = 'ari:cloud:identity::team-type/';
@@ -1,4 +1,4 @@
1
- import { TEAM_ARI_PREFIX, USER_ARI_PREFIX } from '../types';
1
+ import { TEAM_ARI_PREFIX, TEAM_TYPE_ARI_PREFIX, USER_ARI_PREFIX } from '../types';
2
2
  export var isUserARI = function isUserARI(ari) {
3
3
  return ari.startsWith(USER_ARI_PREFIX);
4
4
  };
@@ -22,4 +22,17 @@ export var toTeamId = function toTeamId(ari) {
22
22
  };
23
23
  export var toTeamARI = function toTeamARI(teamId) {
24
24
  return isTeamARI(teamId) ? teamId : "".concat(TEAM_ARI_PREFIX).concat(teamId);
25
+ };
26
+
27
+ /**
28
+ * TODO: Replace these team type ari utils with @atlassian/ari when it is published
29
+ */
30
+ export var isTeamTypeAri = function isTeamTypeAri(ari) {
31
+ return ari.startsWith(TEAM_TYPE_ARI_PREFIX);
32
+ };
33
+ export var toTeamTypeId = function toTeamTypeId(teamTypeAriOrId) {
34
+ if (isTeamTypeAri(teamTypeAriOrId)) {
35
+ return teamTypeAriOrId.replace(TEAM_TYPE_ARI_PREFIX, '');
36
+ }
37
+ return teamTypeAriOrId;
25
38
  };
package/dist/esm/index.js CHANGED
@@ -15,5 +15,5 @@ export { userInfoProvider, UserInfoProvider } from './services/user-info-provide
15
15
 
16
16
  // /utils
17
17
  export { sortMembersByType, isInvited, isMember, isNonMember, isRequestingJoin } from './common/utils';
18
- export { toUserARI, toUserId, toTeamARI, toTeamId } from './common/utils/ari';
18
+ export { toUserARI, toUserId, toTeamARI, toTeamId, toTeamTypeId } from './common/utils/ari';
19
19
  export { useLazyQueryLight, useQueryLight, UseQueryLightError } from './services/use-query-light';
@@ -13,6 +13,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
13
13
  import _regeneratorRuntime from "@babel/runtime/regenerator";
14
14
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
15
15
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
16
+ import { toTeamTypeId } from '../../common/utils/ari';
16
17
  import { DEFAULT_CONFIG } from '../constants';
17
18
  import { RestClient } from '../rest-client';
18
19
 
@@ -667,7 +668,7 @@ export var LegionClient = /*#__PURE__*/function (_RestClient) {
667
668
  while (1) switch (_context21.prev = _context21.next) {
668
669
  case 0:
669
670
  siteId = this.getCloudId();
670
- return _context21.abrupt("return", this.postResourceRaw("".concat(v4UrlPath, "/archive?siteId=").concat(siteId), JSON.stringify([this.trimTeamARI(teamId)])));
671
+ return _context21.abrupt("return", this.postResource("".concat(v4UrlPath, "/").concat(this.trimTeamARI(teamId), "/archive?siteId=").concat(siteId)));
671
672
  case 2:
672
673
  case "end":
673
674
  return _context21.stop();
@@ -688,7 +689,7 @@ export var LegionClient = /*#__PURE__*/function (_RestClient) {
688
689
  while (1) switch (_context22.prev = _context22.next) {
689
690
  case 0:
690
691
  siteId = this.getCloudId();
691
- return _context22.abrupt("return", this.postResourceRaw("".concat(v4UrlPath, "/unarchive?siteId=").concat(siteId), JSON.stringify([this.trimTeamARI(teamId)])));
692
+ return _context22.abrupt("return", this.postResource("".concat(v4UrlPath, "/").concat(this.trimTeamARI(teamId), "/unarchive?siteId=").concat(siteId)));
692
693
  case 2:
693
694
  case "end":
694
695
  return _context22.stop();
@@ -783,7 +784,7 @@ export var LegionClient = /*#__PURE__*/function (_RestClient) {
783
784
  siteId: this.getCloudId(),
784
785
  organizationId: organizationId,
785
786
  members: _toConsumableArray(new Set(members)),
786
- typeId: typeId
787
+ typeId: typeId ? toTeamTypeId(typeId) : undefined
787
788
  });
788
789
  case 10:
789
790
  legionTeam = _context25.sent;
@@ -2,3 +2,5 @@ export declare const USER_ARI_PREFIX: "ari:cloud:identity::user/";
2
2
  export type UserARI = `${typeof USER_ARI_PREFIX}${string}`;
3
3
  export declare const TEAM_ARI_PREFIX: "ari:cloud:identity::team/";
4
4
  export type TeamARI = `${typeof TEAM_ARI_PREFIX}${string}`;
5
+ export declare const TEAM_TYPE_ARI_PREFIX: "ari:cloud:identity::team-type/";
6
+ export type TeamTypeAri = `${typeof TEAM_TYPE_ARI_PREFIX}${string}`;
@@ -1,7 +1,12 @@
1
- import { type TeamARI, type UserARI } from '../types';
1
+ import { type TeamARI, type TeamTypeAri, type UserARI } from '../types';
2
2
  export declare const isUserARI: (ari: string) => ari is UserARI;
3
3
  export declare const toUserId: (ari: UserARI | string) => string;
4
4
  export declare const toUserARI: (userId: string) => UserARI;
5
5
  export declare const isTeamARI: (ari: string) => ari is TeamARI;
6
6
  export declare const toTeamId: (ari: TeamARI | string) => string;
7
7
  export declare const toTeamARI: (teamId: string) => TeamARI;
8
+ /**
9
+ * TODO: Replace these team type ari utils with @atlassian/ari when it is published
10
+ */
11
+ export declare const isTeamTypeAri: (ari: string) => ari is TeamTypeAri;
12
+ export declare const toTeamTypeId: (teamTypeAriOrId: TeamTypeAri | string) => string;
@@ -10,6 +10,6 @@ export { logException, logInfoMessage } from './services/sentry/main';
10
10
  export type { SentryClient } from './services/sentry/types';
11
11
  export { userInfoProvider, UserInfoProvider } from './services/user-info-provider';
12
12
  export { sortMembersByType, isInvited, isMember, isNonMember, isRequestingJoin, } from './common/utils';
13
- export { toUserARI, toUserId, toTeamARI, toTeamId } from './common/utils/ari';
13
+ export { toUserARI, toUserId, toTeamARI, toTeamId, toTeamTypeId } from './common/utils/ari';
14
14
  export { useLazyQueryLight, useQueryLight, UseQueryLightError, type ActualGraphQLError, } from './services/use-query-light';
15
15
  export type { FetchMoreArgs, QueryOptions } from './services/use-query-light';
@@ -88,8 +88,8 @@ export interface LegionClient {
88
88
  deleteTeamMembership(teamId: string, memberId: string): Promise<TeamMembership>;
89
89
  revokeTeamInvite(teamId: string, memberId: string): Promise<TeamMembership>;
90
90
  deleteTeam(teamId: string): Promise<void>;
91
- archiveTeam(teamId: string): Promise<void>;
92
- unArchiveTeam(teamId: string): Promise<void>;
91
+ archiveTeam(teamId: string): Promise<TeamWithImageUrls>;
92
+ unArchiveTeam(teamId: string): Promise<TeamWithImageUrls>;
93
93
  isSingleFullMemberTeam(teamId: string): Promise<boolean>;
94
94
  createTeam(displayName: string, originQuery: OriginQuery, members?: string[], membershipSettings?: TeamMembershipSettings, typeId?: string): Promise<Team>;
95
95
  createExternalTeam(description: string, externalReference: ExternalReference, teamName?: string, siteId?: string): Promise<Team>;
@@ -1,4 +1,4 @@
1
- import { type MembershipState, type TeamMembership } from '../types';
1
+ import { type MembershipState, type TeamMembership, type TeamWithImageUrls } from '../types';
2
2
  import { aggClient } from './agg-client';
3
3
  import { type AGGPageInfoVariables, type ResultWithPageInfo } from './agg-client/types';
4
4
  import collaborationGraphClient from './collaborationgraph-client';
@@ -196,11 +196,11 @@ export declare class TeamsClient {
196
196
  /**
197
197
  * Archive a team
198
198
  */
199
- archiveTeam(teamId: string): Promise<void>;
199
+ archiveTeam(teamId: string): Promise<TeamWithImageUrls>;
200
200
  /**
201
201
  * Unarchive a team
202
202
  */
203
- unarchiveTeam(teamId: string): Promise<void>;
203
+ unarchiveTeam(teamId: string): Promise<TeamWithImageUrls>;
204
204
  /**
205
205
  * Unlink a team from group
206
206
  */
@@ -2,3 +2,5 @@ export declare const USER_ARI_PREFIX: "ari:cloud:identity::user/";
2
2
  export type UserARI = `${typeof USER_ARI_PREFIX}${string}`;
3
3
  export declare const TEAM_ARI_PREFIX: "ari:cloud:identity::team/";
4
4
  export type TeamARI = `${typeof TEAM_ARI_PREFIX}${string}`;
5
+ export declare const TEAM_TYPE_ARI_PREFIX: "ari:cloud:identity::team-type/";
6
+ export type TeamTypeAri = `${typeof TEAM_TYPE_ARI_PREFIX}${string}`;
@@ -1,7 +1,12 @@
1
- import { type TeamARI, type UserARI } from '../types';
1
+ import { type TeamARI, type TeamTypeAri, type UserARI } from '../types';
2
2
  export declare const isUserARI: (ari: string) => ari is UserARI;
3
3
  export declare const toUserId: (ari: UserARI | string) => string;
4
4
  export declare const toUserARI: (userId: string) => UserARI;
5
5
  export declare const isTeamARI: (ari: string) => ari is TeamARI;
6
6
  export declare const toTeamId: (ari: TeamARI | string) => string;
7
7
  export declare const toTeamARI: (teamId: string) => TeamARI;
8
+ /**
9
+ * TODO: Replace these team type ari utils with @atlassian/ari when it is published
10
+ */
11
+ export declare const isTeamTypeAri: (ari: string) => ari is TeamTypeAri;
12
+ export declare const toTeamTypeId: (teamTypeAriOrId: TeamTypeAri | string) => string;
@@ -10,6 +10,6 @@ export { logException, logInfoMessage } from './services/sentry/main';
10
10
  export type { SentryClient } from './services/sentry/types';
11
11
  export { userInfoProvider, UserInfoProvider } from './services/user-info-provider';
12
12
  export { sortMembersByType, isInvited, isMember, isNonMember, isRequestingJoin, } from './common/utils';
13
- export { toUserARI, toUserId, toTeamARI, toTeamId } from './common/utils/ari';
13
+ export { toUserARI, toUserId, toTeamARI, toTeamId, toTeamTypeId } from './common/utils/ari';
14
14
  export { useLazyQueryLight, useQueryLight, UseQueryLightError, type ActualGraphQLError, } from './services/use-query-light';
15
15
  export type { FetchMoreArgs, QueryOptions } from './services/use-query-light';
@@ -88,8 +88,8 @@ export interface LegionClient {
88
88
  deleteTeamMembership(teamId: string, memberId: string): Promise<TeamMembership>;
89
89
  revokeTeamInvite(teamId: string, memberId: string): Promise<TeamMembership>;
90
90
  deleteTeam(teamId: string): Promise<void>;
91
- archiveTeam(teamId: string): Promise<void>;
92
- unArchiveTeam(teamId: string): Promise<void>;
91
+ archiveTeam(teamId: string): Promise<TeamWithImageUrls>;
92
+ unArchiveTeam(teamId: string): Promise<TeamWithImageUrls>;
93
93
  isSingleFullMemberTeam(teamId: string): Promise<boolean>;
94
94
  createTeam(displayName: string, originQuery: OriginQuery, members?: string[], membershipSettings?: TeamMembershipSettings, typeId?: string): Promise<Team>;
95
95
  createExternalTeam(description: string, externalReference: ExternalReference, teamName?: string, siteId?: string): Promise<Team>;
@@ -1,4 +1,4 @@
1
- import { type MembershipState, type TeamMembership } from '../types';
1
+ import { type MembershipState, type TeamMembership, type TeamWithImageUrls } from '../types';
2
2
  import { aggClient } from './agg-client';
3
3
  import { type AGGPageInfoVariables, type ResultWithPageInfo } from './agg-client/types';
4
4
  import collaborationGraphClient from './collaborationgraph-client';
@@ -196,11 +196,11 @@ export declare class TeamsClient {
196
196
  /**
197
197
  * Archive a team
198
198
  */
199
- archiveTeam(teamId: string): Promise<void>;
199
+ archiveTeam(teamId: string): Promise<TeamWithImageUrls>;
200
200
  /**
201
201
  * Unarchive a team
202
202
  */
203
- unarchiveTeam(teamId: string): Promise<void>;
203
+ unarchiveTeam(teamId: string): Promise<TeamWithImageUrls>;
204
204
  /**
205
205
  * Unlink a team from group
206
206
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/teams-client",
3
- "version": "4.24.0",
3
+ "version": "4.24.1",
4
4
  "description": "A client to retrieve team related data",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",