@atlaskit/teams-public 0.65.2 → 0.65.4
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 +14 -0
- package/dist/cjs/controllers/hooks/use-team-containers/index.js +5 -6
- package/dist/es2019/controllers/hooks/use-team-containers/index.js +6 -7
- package/dist/esm/controllers/hooks/use-team-containers/index.js +6 -7
- package/dist/types/controllers/hooks/use-team-containers/index.d.ts +1 -2
- package/dist/types-ts4.5/controllers/hooks/use-team-containers/index.d.ts +1 -2
- package/package.json +13 -15
- package/dist/cjs/services/agg-client/index.js +0 -254
- package/dist/cjs/services/agg-client/mocks/index.js +0 -177
- package/dist/cjs/services/agg-client/types.js +0 -1
- package/dist/cjs/services/agg-client/utils/mutations/unlink-container-mutation.js +0 -12
- package/dist/cjs/services/agg-client/utils/queries/number-of-team-connected-to-container-query.js +0 -12
- package/dist/cjs/services/agg-client/utils/queries/team-connected-to-container-query.js +0 -12
- package/dist/cjs/services/agg-client/utils/queries/team-containers-query.js +0 -15
- package/dist/cjs/services/agg-client/utils/query-context-headers.js +0 -18
- package/dist/cjs/services/base-client/index.js +0 -92
- package/dist/cjs/services/constants.js +0 -9
- package/dist/cjs/services/graphql-client/index.js +0 -12
- package/dist/cjs/services/graphql-client/main.js +0 -95
- package/dist/cjs/services/graphql-client/types.js +0 -5
- package/dist/cjs/services/graphql-client/utils/index.js +0 -160
- package/dist/cjs/services/index.js +0 -18
- package/dist/cjs/services/main.js +0 -148
- package/dist/cjs/services/types.js +0 -5
- package/dist/es2019/services/agg-client/index.js +0 -153
- package/dist/es2019/services/agg-client/mocks/index.js +0 -171
- package/dist/es2019/services/agg-client/types.js +0 -0
- package/dist/es2019/services/agg-client/utils/mutations/unlink-container-mutation.js +0 -20
- package/dist/es2019/services/agg-client/utils/queries/number-of-team-connected-to-container-query.js +0 -14
- package/dist/es2019/services/agg-client/utils/queries/team-connected-to-container-query.js +0 -55
- package/dist/es2019/services/agg-client/utils/queries/team-containers-query.js +0 -56
- package/dist/es2019/services/agg-client/utils/query-context-headers.js +0 -12
- package/dist/es2019/services/base-client/index.js +0 -64
- package/dist/es2019/services/constants.js +0 -3
- package/dist/es2019/services/graphql-client/index.js +0 -1
- package/dist/es2019/services/graphql-client/main.js +0 -47
- package/dist/es2019/services/graphql-client/types.js +0 -1
- package/dist/es2019/services/graphql-client/utils/index.js +0 -77
- package/dist/es2019/services/index.js +0 -1
- package/dist/es2019/services/main.js +0 -67
- package/dist/es2019/services/types.js +0 -1
- package/dist/esm/services/agg-client/index.js +0 -247
- package/dist/esm/services/agg-client/mocks/index.js +0 -171
- package/dist/esm/services/agg-client/types.js +0 -0
- package/dist/esm/services/agg-client/utils/mutations/unlink-container-mutation.js +0 -5
- package/dist/esm/services/agg-client/utils/queries/number-of-team-connected-to-container-query.js +0 -5
- package/dist/esm/services/agg-client/utils/queries/team-connected-to-container-query.js +0 -5
- package/dist/esm/services/agg-client/utils/queries/team-containers-query.js +0 -8
- package/dist/esm/services/agg-client/utils/query-context-headers.js +0 -12
- package/dist/esm/services/base-client/index.js +0 -85
- package/dist/esm/services/constants.js +0 -3
- package/dist/esm/services/graphql-client/index.js +0 -1
- package/dist/esm/services/graphql-client/main.js +0 -88
- package/dist/esm/services/graphql-client/types.js +0 -1
- package/dist/esm/services/graphql-client/utils/index.js +0 -152
- package/dist/esm/services/index.js +0 -1
- package/dist/esm/services/main.js +0 -141
- package/dist/esm/services/types.js +0 -1
- package/dist/types/services/agg-client/index.d.ts +0 -14
- package/dist/types/services/agg-client/mocks/index.d.ts +0 -180
- package/dist/types/services/agg-client/types.d.ts +0 -4
- package/dist/types/services/agg-client/utils/mutations/unlink-container-mutation.d.ts +0 -18
- package/dist/types/services/agg-client/utils/queries/number-of-team-connected-to-container-query.d.ts +0 -11
- package/dist/types/services/agg-client/utils/queries/team-connected-to-container-query.d.ts +0 -45
- package/dist/types/services/agg-client/utils/queries/team-containers-query.d.ts +0 -71
- package/dist/types/services/agg-client/utils/query-context-headers.d.ts +0 -5
- package/dist/types/services/base-client/index.d.ts +0 -37
- package/dist/types/services/constants.d.ts +0 -4
- package/dist/types/services/graphql-client/index.d.ts +0 -1
- package/dist/types/services/graphql-client/main.d.ts +0 -12
- package/dist/types/services/graphql-client/types.d.ts +0 -20
- package/dist/types/services/graphql-client/utils/index.d.ts +0 -3
- package/dist/types/services/index.d.ts +0 -1
- package/dist/types/services/main.d.ts +0 -46
- package/dist/types/services/types.d.ts +0 -37
- package/dist/types-ts4.5/services/agg-client/index.d.ts +0 -14
- package/dist/types-ts4.5/services/agg-client/mocks/index.d.ts +0 -180
- package/dist/types-ts4.5/services/agg-client/types.d.ts +0 -4
- package/dist/types-ts4.5/services/agg-client/utils/mutations/unlink-container-mutation.d.ts +0 -18
- package/dist/types-ts4.5/services/agg-client/utils/queries/number-of-team-connected-to-container-query.d.ts +0 -11
- package/dist/types-ts4.5/services/agg-client/utils/queries/team-connected-to-container-query.d.ts +0 -45
- package/dist/types-ts4.5/services/agg-client/utils/queries/team-containers-query.d.ts +0 -71
- package/dist/types-ts4.5/services/agg-client/utils/query-context-headers.d.ts +0 -5
- package/dist/types-ts4.5/services/base-client/index.d.ts +0 -37
- package/dist/types-ts4.5/services/constants.d.ts +0 -4
- package/dist/types-ts4.5/services/graphql-client/index.d.ts +0 -1
- package/dist/types-ts4.5/services/graphql-client/main.d.ts +0 -12
- package/dist/types-ts4.5/services/graphql-client/types.d.ts +0 -20
- package/dist/types-ts4.5/services/graphql-client/utils/index.d.ts +0 -3
- package/dist/types-ts4.5/services/index.d.ts +0 -1
- package/dist/types-ts4.5/services/main.d.ts +0 -46
- package/dist/types-ts4.5/services/types.d.ts +0 -37
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
export class BaseClient {
|
|
3
|
-
constructor(config) {
|
|
4
|
-
_defineProperty(this, "cache", {});
|
|
5
|
-
_defineProperty(this, "logException", (ex, name, context) => {
|
|
6
|
-
this.config.logException(ex, name, context);
|
|
7
|
-
});
|
|
8
|
-
this.config = config;
|
|
9
|
-
this.context = {
|
|
10
|
-
cloudId: null
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
setContext(context) {
|
|
14
|
-
this.context = {
|
|
15
|
-
...context,
|
|
16
|
-
cloudId: context.cloudId || null
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
getContext() {
|
|
20
|
-
return this.context;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
*
|
|
25
|
-
* @param localValue is used for backwards compatibility
|
|
26
|
-
* @returns
|
|
27
|
-
*/
|
|
28
|
-
getOrgId(localValue) {
|
|
29
|
-
const orgId = localValue || this.getContext().orgId;
|
|
30
|
-
if (!orgId) {
|
|
31
|
-
const err = new Error('No orgId set');
|
|
32
|
-
this.logException(err, 'No orgId set');
|
|
33
|
-
throw err;
|
|
34
|
-
}
|
|
35
|
-
return orgId;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
*
|
|
39
|
-
* @param localValue is used for backwards compatibility
|
|
40
|
-
* @returns
|
|
41
|
-
*/
|
|
42
|
-
getCloudId(localValue) {
|
|
43
|
-
return localValue || this.getContext().cloudId;
|
|
44
|
-
}
|
|
45
|
-
keyWithContext(key) {
|
|
46
|
-
var _this$getContext$orgI, _this$getContext$user;
|
|
47
|
-
return `${this.getContext().cloudId}-${(_this$getContext$orgI = this.getContext().orgId) !== null && _this$getContext$orgI !== void 0 ? _this$getContext$orgI : 'no-org-id'}-${(_this$getContext$user = this.getContext().userId) !== null && _this$getContext$user !== void 0 ? _this$getContext$user : 'no-user-id'}-${key}`;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Default expiration is 5 minutes
|
|
51
|
-
cacheValue(key, value, expiryMs = 1000 * 60 * 5) {
|
|
52
|
-
this.cache[this.keyWithContext(key)] = {
|
|
53
|
-
data: value,
|
|
54
|
-
expiration: Date.now() + expiryMs
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
getCachedValue(key) {
|
|
58
|
-
const record = this.cache[this.keyWithContext(key)];
|
|
59
|
-
if (record && record.expiration > Date.now()) {
|
|
60
|
-
return record.data;
|
|
61
|
-
}
|
|
62
|
-
return undefined;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { BaseGraphQlClient } from './main';
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { DefaultError, GraphQLError } from '../../common/utils/error';
|
|
2
|
-
import { BaseClient } from '../base-client';
|
|
3
|
-
import { handleGraphQLRequest } from './utils';
|
|
4
|
-
export class BaseGraphQlClient extends BaseClient {
|
|
5
|
-
constructor(serviceUrl, config) {
|
|
6
|
-
super(config);
|
|
7
|
-
this.serviceUrl = serviceUrl;
|
|
8
|
-
}
|
|
9
|
-
setServiceUrl(serviceUrl) {
|
|
10
|
-
this.serviceUrl = serviceUrl;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Creates query context headers if cloudId is available.
|
|
15
|
-
*/
|
|
16
|
-
createQueryContextHeaders(cloudId) {
|
|
17
|
-
if (!cloudId) {
|
|
18
|
-
return undefined;
|
|
19
|
-
}
|
|
20
|
-
return {
|
|
21
|
-
'X-Query-Context': `ari:cloud:platform::site/${cloudId}`
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
async makeGraphQLRequest(body, options = {}) {
|
|
25
|
-
try {
|
|
26
|
-
// Automatically add X-Query-Context header if cloudId is available in context
|
|
27
|
-
const cloudId = this.getCloudId();
|
|
28
|
-
const queryContextHeaders = this.createQueryContextHeaders(cloudId);
|
|
29
|
-
|
|
30
|
-
// Merge headers: query context headers first, then provided headers (provided headers take precedence)
|
|
31
|
-
const mergedOptions = {
|
|
32
|
-
...options,
|
|
33
|
-
headers: {
|
|
34
|
-
...queryContextHeaders,
|
|
35
|
-
...options.headers
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
return handleGraphQLRequest(this.serviceUrl, body, mergedOptions);
|
|
39
|
-
} catch (error) {
|
|
40
|
-
if (error instanceof GraphQLError) {
|
|
41
|
-
throw error;
|
|
42
|
-
}
|
|
43
|
-
this.logException(error, 'UnknownError in GraphQLClient.makeGraphQLRequestWithoutRetries');
|
|
44
|
-
throw new DefaultError({});
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { GraphQLError, HttpError } from '../../../common/utils/error';
|
|
2
|
-
import { EXPONENTIAL_BACKOFF_RETRY_POLICY, is5xx, isFetchResponse, withExponentialBackoff } from '../../../common/utils/http';
|
|
3
|
-
import { handleResponse } from '../../../common/utils/status-code-handlers-provider';
|
|
4
|
-
export async function makeGraphQLRequestWithoutRetries(serviceUrl, body, options = {}) {
|
|
5
|
-
const operationNameQuery = options.operationName ? `?q=${options.operationName}` : '';
|
|
6
|
-
const errorPolicy = options.errorPolicy || 'none';
|
|
7
|
-
const url = serviceUrl + operationNameQuery;
|
|
8
|
-
const request = fetch(url, {
|
|
9
|
-
method: 'POST',
|
|
10
|
-
headers: new Headers({
|
|
11
|
-
'Content-Type': 'application/json',
|
|
12
|
-
...(options.headers || {})
|
|
13
|
-
}),
|
|
14
|
-
credentials: 'include',
|
|
15
|
-
body: JSON.stringify(body)
|
|
16
|
-
}).then(res => {
|
|
17
|
-
if (res.status < 300 || res.status === 400) {
|
|
18
|
-
return res.json();
|
|
19
|
-
} else {
|
|
20
|
-
throw res;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
try {
|
|
24
|
-
const response = await request;
|
|
25
|
-
const errors = response.errors;
|
|
26
|
-
if (errors) {
|
|
27
|
-
if (errorPolicy === 'none') {
|
|
28
|
-
throw GraphQLError.from(errors);
|
|
29
|
-
} else if (errorPolicy === 'all') {
|
|
30
|
-
// Set timeout will postpone error throwing and de-touch it to another event loop,
|
|
31
|
-
// so we can return data along with throwing error
|
|
32
|
-
return new Promise((_resolve, reject) => {
|
|
33
|
-
setTimeout(() => {
|
|
34
|
-
reject(GraphQLError.from(errors));
|
|
35
|
-
}, 0);
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return response.data;
|
|
40
|
-
} catch (error) {
|
|
41
|
-
if (error instanceof Response) {
|
|
42
|
-
return {
|
|
43
|
-
response: error
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
if (Object(error).hasOwnProperty('response')) {
|
|
47
|
-
throw error;
|
|
48
|
-
}
|
|
49
|
-
return error;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
export async function handleGraphQLRequest(serviceUrl, body, options = {}) {
|
|
53
|
-
const makeGraphQLRequestWithRetries = withExponentialBackoff(makeGraphQLRequestWithoutRetries, {
|
|
54
|
-
initial: EXPONENTIAL_BACKOFF_RETRY_POLICY.INITIAL_DELAY,
|
|
55
|
-
jitter: EXPONENTIAL_BACKOFF_RETRY_POLICY.JITTER,
|
|
56
|
-
max: EXPONENTIAL_BACKOFF_RETRY_POLICY.MAX_RETRIES,
|
|
57
|
-
retryIf: data => {
|
|
58
|
-
return isFetchResponse(data) && is5xx(data.response.status);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
const result = await makeGraphQLRequestWithRetries(serviceUrl, body, options);
|
|
62
|
-
const response = result === null || result === void 0 ? void 0 : result.response;
|
|
63
|
-
if (response) {
|
|
64
|
-
const status = response.status;
|
|
65
|
-
const statusText = response.statusText;
|
|
66
|
-
const traceId = response.headers.get('atl-traceid');
|
|
67
|
-
handleResponse(response);
|
|
68
|
-
if (status > 400 && status <= 599) {
|
|
69
|
-
throw new HttpError({
|
|
70
|
-
message: statusText,
|
|
71
|
-
status,
|
|
72
|
-
traceId: traceId !== null && traceId !== void 0 ? traceId : undefined
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return result;
|
|
77
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { teamsClient, TeamsClient } from './main';
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import { aggClient } from './agg-client';
|
|
3
|
-
export class TeamsClient {
|
|
4
|
-
constructor(
|
|
5
|
-
/**
|
|
6
|
-
* @param {ClientContextProps} context - Context including CloudId & OrgId to be used for all requests
|
|
7
|
-
*/
|
|
8
|
-
context) {
|
|
9
|
-
_defineProperty(this, "_aggClient", aggClient);
|
|
10
|
-
if (context) {
|
|
11
|
-
this.setContext(context);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Sets the base URL to be used in the client requests
|
|
17
|
-
* @param {string} baseUrl - The new base URL
|
|
18
|
-
*/
|
|
19
|
-
setBaseUrl(baseUrl) {
|
|
20
|
-
this._aggClient.setBaseUrl(baseUrl);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Sets context including CloudId & OrgId to be used for all requests
|
|
25
|
-
*/
|
|
26
|
-
setContext(context) {
|
|
27
|
-
this._aggClient.setContext(context);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Get the containers for a given team
|
|
32
|
-
* @param {string} teamId
|
|
33
|
-
* @returns {Promise<TeamContainers>}
|
|
34
|
-
*/
|
|
35
|
-
async getTeamContainers(teamId) {
|
|
36
|
-
return this._aggClient.getTeamContainers(teamId);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Get the number of teams connected to a container (Confluence space or Jira project)
|
|
41
|
-
* @param {string} containerId
|
|
42
|
-
* @returns {Promise}
|
|
43
|
-
*/
|
|
44
|
-
async getNumberOfConnectedTeams(containerId) {
|
|
45
|
-
return this._aggClient.queryNumberOfTeamConnectedToContainer(containerId);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Get teams connected to a container (Confluence space or Jira project)
|
|
50
|
-
* @param {string} containerId
|
|
51
|
-
* @returns {Promise}
|
|
52
|
-
*/
|
|
53
|
-
async getConnectedTeams(containerId) {
|
|
54
|
-
return this._aggClient.queryTeamsConnectedToContainer(containerId);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Unlink a container from a team
|
|
59
|
-
* @param {string} teamId
|
|
60
|
-
* @param {string} containerId
|
|
61
|
-
* @returns {Promise<void>}
|
|
62
|
-
*/
|
|
63
|
-
async unlinkTeamContainer(teamId, containerId) {
|
|
64
|
-
return this._aggClient.unlinkTeamContainer(teamId, containerId);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
export const teamsClient = new TeamsClient();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
9
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
|
-
import { teamIdToAri } from '../../common/utils/team-id-to-ari';
|
|
11
|
-
import { toUserId } from '../../common/utils/user-ari';
|
|
12
|
-
import { DEFAULT_CONFIG } from '../constants';
|
|
13
|
-
import { BaseGraphQlClient } from '../graphql-client';
|
|
14
|
-
import { UnlinkContainerMutation } from './utils/mutations/unlink-container-mutation';
|
|
15
|
-
import { NumberOfTeamConnectedToContainerQuery } from './utils/queries/number-of-team-connected-to-container-query';
|
|
16
|
-
import { TeamConnectedToContainerQuery } from './utils/queries/team-connected-to-container-query';
|
|
17
|
-
import { TeamContainersQueryV2 } from './utils/queries/team-containers-query';
|
|
18
|
-
export var AGGClient = /*#__PURE__*/function (_BaseGraphQlClient) {
|
|
19
|
-
function AGGClient(baseUrl, config) {
|
|
20
|
-
_classCallCheck(this, AGGClient);
|
|
21
|
-
return _callSuper(this, AGGClient, ["".concat(baseUrl, "/graphql"), config]);
|
|
22
|
-
}
|
|
23
|
-
_inherits(AGGClient, _BaseGraphQlClient);
|
|
24
|
-
return _createClass(AGGClient, [{
|
|
25
|
-
key: "setBaseUrl",
|
|
26
|
-
value: function setBaseUrl(baseUrl) {
|
|
27
|
-
this.setServiceUrl("".concat(baseUrl, "/graphql"));
|
|
28
|
-
}
|
|
29
|
-
}, {
|
|
30
|
-
key: "getTeamContainers",
|
|
31
|
-
value: function () {
|
|
32
|
-
var _getTeamContainers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(teamId) {
|
|
33
|
-
var teamAri, cypherQuery, response;
|
|
34
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
35
|
-
while (1) switch (_context.prev = _context.next) {
|
|
36
|
-
case 0:
|
|
37
|
-
teamAri = teamIdToAri(teamId);
|
|
38
|
-
cypherQuery = "MATCH (team:IdentityTeam {ari: '".concat(teamAri, "'})-[:team_connected_to_container]->(container) RETURN container");
|
|
39
|
-
_context.next = 4;
|
|
40
|
-
return this.makeGraphQLRequest({
|
|
41
|
-
query: TeamContainersQueryV2,
|
|
42
|
-
variables: {
|
|
43
|
-
cypherQuery: cypherQuery,
|
|
44
|
-
params: {
|
|
45
|
-
id: teamAri
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}, {
|
|
49
|
-
operationName: 'TeamContainersQueryV2'
|
|
50
|
-
});
|
|
51
|
-
case 4:
|
|
52
|
-
response = _context.sent;
|
|
53
|
-
return _context.abrupt("return", this.processResponse(response));
|
|
54
|
-
case 6:
|
|
55
|
-
case "end":
|
|
56
|
-
return _context.stop();
|
|
57
|
-
}
|
|
58
|
-
}, _callee, this);
|
|
59
|
-
}));
|
|
60
|
-
function getTeamContainers(_x) {
|
|
61
|
-
return _getTeamContainers.apply(this, arguments);
|
|
62
|
-
}
|
|
63
|
-
return getTeamContainers;
|
|
64
|
-
}()
|
|
65
|
-
}, {
|
|
66
|
-
key: "processResponse",
|
|
67
|
-
value: function processResponse(response) {
|
|
68
|
-
var containersResult = response.graphStore.cypherQueryV2.edges.reduce(function (containers, edge) {
|
|
69
|
-
edge.node.columns.forEach(function (column) {
|
|
70
|
-
var _column$value;
|
|
71
|
-
var containerData = (_column$value = column.value) === null || _column$value === void 0 ? void 0 : _column$value.data;
|
|
72
|
-
if (!containerData) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
if ((containerData === null || containerData === void 0 ? void 0 : containerData.__typename) === 'ConfluenceSpace') {
|
|
76
|
-
containers.push({
|
|
77
|
-
id: containerData.id,
|
|
78
|
-
type: containerData.__typename,
|
|
79
|
-
name: containerData.confluenceSpaceName || '',
|
|
80
|
-
icon: "".concat(containerData.links.base).concat(containerData.icon.path),
|
|
81
|
-
createdDate: new Date(containerData.createdDate),
|
|
82
|
-
link: "".concat(containerData.links.base).concat(containerData.links.webUi),
|
|
83
|
-
containerTypeProperties: {
|
|
84
|
-
subType: undefined,
|
|
85
|
-
name: undefined
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
} else if ((containerData === null || containerData === void 0 ? void 0 : containerData.__typename) === 'JiraProject') {
|
|
89
|
-
containers.push({
|
|
90
|
-
id: containerData.id,
|
|
91
|
-
type: containerData.__typename,
|
|
92
|
-
name: containerData.jiraProjectName,
|
|
93
|
-
icon: containerData.avatar.medium,
|
|
94
|
-
createdDate: new Date(containerData.created),
|
|
95
|
-
link: containerData.webUrl,
|
|
96
|
-
containerTypeProperties: {
|
|
97
|
-
subType: containerData.projectType || '',
|
|
98
|
-
name: containerData.projectTypeName || ''
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
} else if ((containerData === null || containerData === void 0 ? void 0 : containerData.__typename) === 'LoomSpace') {
|
|
102
|
-
containers.push({
|
|
103
|
-
id: containerData.id,
|
|
104
|
-
type: containerData.__typename,
|
|
105
|
-
name: containerData.loomSpaceName,
|
|
106
|
-
icon: '',
|
|
107
|
-
link: containerData.url
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
return containers;
|
|
112
|
-
}, []);
|
|
113
|
-
return containersResult;
|
|
114
|
-
}
|
|
115
|
-
}, {
|
|
116
|
-
key: "unlinkTeamContainer",
|
|
117
|
-
value: function () {
|
|
118
|
-
var _unlinkTeamContainer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(teamId, containerId) {
|
|
119
|
-
var teamAri, response;
|
|
120
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
121
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
122
|
-
case 0:
|
|
123
|
-
teamAri = teamIdToAri(teamId);
|
|
124
|
-
_context2.next = 3;
|
|
125
|
-
return this.makeGraphQLRequest({
|
|
126
|
-
query: UnlinkContainerMutation,
|
|
127
|
-
variables: {
|
|
128
|
-
containerId: containerId,
|
|
129
|
-
teamId: teamAri
|
|
130
|
-
}
|
|
131
|
-
}, {
|
|
132
|
-
operationName: 'UnlinkContainerMutation'
|
|
133
|
-
});
|
|
134
|
-
case 3:
|
|
135
|
-
response = _context2.sent;
|
|
136
|
-
return _context2.abrupt("return", response.graphStore);
|
|
137
|
-
case 5:
|
|
138
|
-
case "end":
|
|
139
|
-
return _context2.stop();
|
|
140
|
-
}
|
|
141
|
-
}, _callee2, this);
|
|
142
|
-
}));
|
|
143
|
-
function unlinkTeamContainer(_x2, _x3) {
|
|
144
|
-
return _unlinkTeamContainer.apply(this, arguments);
|
|
145
|
-
}
|
|
146
|
-
return unlinkTeamContainer;
|
|
147
|
-
}()
|
|
148
|
-
}, {
|
|
149
|
-
key: "queryNumberOfTeamConnectedToContainer",
|
|
150
|
-
value: function () {
|
|
151
|
-
var _queryNumberOfTeamConnectedToContainer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(containerId) {
|
|
152
|
-
var _response$graphStore;
|
|
153
|
-
var response;
|
|
154
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
155
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
156
|
-
case 0:
|
|
157
|
-
_context3.next = 2;
|
|
158
|
-
return this.makeGraphQLRequest({
|
|
159
|
-
query: NumberOfTeamConnectedToContainerQuery,
|
|
160
|
-
variables: {
|
|
161
|
-
containerId: containerId
|
|
162
|
-
}
|
|
163
|
-
}, {
|
|
164
|
-
operationName: 'NumberOfTeamConnectedToContainerQuery'
|
|
165
|
-
});
|
|
166
|
-
case 2:
|
|
167
|
-
response = _context3.sent;
|
|
168
|
-
return _context3.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);
|
|
169
|
-
case 4:
|
|
170
|
-
case "end":
|
|
171
|
-
return _context3.stop();
|
|
172
|
-
}
|
|
173
|
-
}, _callee3, this);
|
|
174
|
-
}));
|
|
175
|
-
function queryNumberOfTeamConnectedToContainer(_x4) {
|
|
176
|
-
return _queryNumberOfTeamConnectedToContainer.apply(this, arguments);
|
|
177
|
-
}
|
|
178
|
-
return queryNumberOfTeamConnectedToContainer;
|
|
179
|
-
}()
|
|
180
|
-
}, {
|
|
181
|
-
key: "queryTeamsConnectedToContainer",
|
|
182
|
-
value: function () {
|
|
183
|
-
var _queryTeamsConnectedToContainer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(containerId) {
|
|
184
|
-
var _response$graphStore2;
|
|
185
|
-
var response;
|
|
186
|
-
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
187
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
188
|
-
case 0:
|
|
189
|
-
_context4.next = 2;
|
|
190
|
-
return this.makeGraphQLRequest({
|
|
191
|
-
query: TeamConnectedToContainerQuery,
|
|
192
|
-
variables: {
|
|
193
|
-
containerId: containerId
|
|
194
|
-
}
|
|
195
|
-
}, {
|
|
196
|
-
operationName: 'TeamConnectedToContainerQuery'
|
|
197
|
-
});
|
|
198
|
-
case 2:
|
|
199
|
-
response = _context4.sent;
|
|
200
|
-
return _context4.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 (_ref) {
|
|
201
|
-
var _node$creator, _node$members$nodes$m, _node$members, _node$members$nodes$l, _node$members2;
|
|
202
|
-
var node = _ref.node;
|
|
203
|
-
return {
|
|
204
|
-
id: node.id,
|
|
205
|
-
displayName: node.displayName,
|
|
206
|
-
description: node.description,
|
|
207
|
-
state: node.state,
|
|
208
|
-
membershipSettings: node.membershipSettings,
|
|
209
|
-
organizationId: node.organizationId,
|
|
210
|
-
creatorId: (_node$creator = node.creator) === null || _node$creator === void 0 ? void 0 : _node$creator.id,
|
|
211
|
-
isVerified: node.isVerified,
|
|
212
|
-
members: (_node$members$nodes$m = (_node$members = node.members) === null || _node$members === void 0 ? void 0 : _node$members.nodes.map(function (_ref2) {
|
|
213
|
-
var _member$name;
|
|
214
|
-
var member = _ref2.member;
|
|
215
|
-
return {
|
|
216
|
-
id: member !== null && member !== void 0 && member.id ? toUserId(member === null || member === void 0 ? void 0 : member.id) : '',
|
|
217
|
-
fullName: (_member$name = member === null || member === void 0 ? void 0 : member.name) !== null && _member$name !== void 0 ? _member$name : '',
|
|
218
|
-
avatarUrl: member === null || member === void 0 ? void 0 : member.picture,
|
|
219
|
-
status: member === null || member === void 0 ? void 0 : member.accountStatus
|
|
220
|
-
};
|
|
221
|
-
})) !== null && _node$members$nodes$m !== void 0 ? _node$members$nodes$m : [],
|
|
222
|
-
includesYou: false,
|
|
223
|
-
// to-do - this needs to be computed - https://product-fabric.atlassian.net/browse/CCECO-4368
|
|
224
|
-
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,
|
|
225
|
-
largeAvatarImageUrl: node.largeAvatarImageUrl,
|
|
226
|
-
smallAvatarImageUrl: node.smallAvatarImageUrl,
|
|
227
|
-
largeHeaderImageUrl: node.largeHeaderImageUrl,
|
|
228
|
-
smallHeaderImageUrl: node.smallHeaderImageUrl,
|
|
229
|
-
restriction: 'ORG_MEMBERS' // to-do - figure out if this should be optional (it's deprecated) - https://product-fabric.atlassian.net/browse/CCECO-4368
|
|
230
|
-
};
|
|
231
|
-
}));
|
|
232
|
-
case 4:
|
|
233
|
-
case "end":
|
|
234
|
-
return _context4.stop();
|
|
235
|
-
}
|
|
236
|
-
}, _callee4, this);
|
|
237
|
-
}));
|
|
238
|
-
function queryTeamsConnectedToContainer(_x5) {
|
|
239
|
-
return _queryTeamsConnectedToContainer.apply(this, arguments);
|
|
240
|
-
}
|
|
241
|
-
return queryTeamsConnectedToContainer;
|
|
242
|
-
}()
|
|
243
|
-
}]);
|
|
244
|
-
}(BaseGraphQlClient);
|
|
245
|
-
export var aggClient = new AGGClient(DEFAULT_CONFIG.stargateRoot, {
|
|
246
|
-
logException: function logException() {}
|
|
247
|
-
});
|