@atlaskit/profilecard 19.1.0 → 19.1.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,11 @@
1
1
  # @atlaskit/profilecard
2
2
 
3
+ ## 19.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`f80d2e43a41`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f80d2e43a41) - Added traceId, errorSource and errorMessage to analytic events
8
+
3
9
  ## 19.1.0
4
10
 
5
11
  ### Minor Changes
@@ -10,16 +10,16 @@ var IGNORED_ERRORS = [
10
10
  // Error categories from AGG
11
11
  'TEAMS_FORBIDDEN', 'TEAMS_TEAM_DELETED'];
12
12
  function isIgnoredError(error) {
13
- return !!error && IGNORED_ERRORS.includes(error.reason);
13
+ return !!error && !!error.reason && IGNORED_ERRORS.includes(error.reason);
14
14
  }
15
15
  var getErrorAttributes = function getErrorAttributes(error) {
16
- var _error$response, _error$response$heade;
17
- var traceId = !!error ? (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$heade = _error$response.headers) === null || _error$response$heade === void 0 ? void 0 : _error$response$heade.get('atl-traceid') : undefined;
16
+ var _error$traceId;
18
17
  return {
18
+ errorMessage: error === null || error === void 0 ? void 0 : error.message,
19
19
  errorStatus: error === null || error === void 0 ? void 0 : error.code,
20
- errorReason: error === null || error === void 0 ? void 0 : error.reason,
20
+ errorReason: (error === null || error === void 0 ? void 0 : error.reason) || 'default',
21
21
  isSLOFailure: !isIgnoredError(error),
22
- traceId: traceId !== null && traceId !== void 0 ? traceId : undefined
22
+ traceId: (_error$traceId = error === null || error === void 0 ? void 0 : error.traceId) !== null && _error$traceId !== void 0 ? _error$traceId : undefined
23
23
  };
24
24
  };
25
25
  exports.getErrorAttributes = getErrorAttributes;
@@ -29,9 +29,12 @@ function graphqlQuery(serviceUrl, query) {
29
29
  body: JSON.stringify(query)
30
30
  })).then(function (response) {
31
31
  if (!response.ok) {
32
+ var _response$headers;
33
+ var traceIdFromHeaders = response === null || response === void 0 ? void 0 : (_response$headers = response.headers) === null || _response$headers === void 0 ? void 0 : _response$headers.get('atl-traceid');
32
34
  return Promise.reject({
33
35
  code: response.status,
34
- reason: response.statusText
36
+ reason: response.statusText,
37
+ traceId: traceIdFromHeaders
35
38
  });
36
39
  }
37
40
  return response;
@@ -39,11 +42,13 @@ function graphqlQuery(serviceUrl, query) {
39
42
  return response.json();
40
43
  }).then(function (json) {
41
44
  if (json.errors) {
42
- var _json$errors$, _json$errors$2, _json$errors$2$extens, _json$errors$3, _json$errors$3$extens;
43
- // We need to handle responses from pf-directory and AGG
45
+ var _json$errors$, _json$errors$2, _json$errors$2$extens, _json$errors$3, _json$errors$3$extens, _json$errors$4, _json$errors$4$extens, _json$extensions, _json$extensions$gate;
44
46
  return Promise.reject({
45
47
  reason: ((_json$errors$ = json.errors[0]) === null || _json$errors$ === void 0 ? void 0 : _json$errors$.category) || ((_json$errors$2 = json.errors[0]) === null || _json$errors$2 === void 0 ? void 0 : (_json$errors$2$extens = _json$errors$2.extensions) === null || _json$errors$2$extens === void 0 ? void 0 : _json$errors$2$extens.classification) || 'default',
46
- code: (_json$errors$3 = json.errors[0]) === null || _json$errors$3 === void 0 ? void 0 : (_json$errors$3$extens = _json$errors$3.extensions) === null || _json$errors$3$extens === void 0 ? void 0 : _json$errors$3$extens.statusCode
48
+ code: (_json$errors$3 = json.errors[0]) === null || _json$errors$3 === void 0 ? void 0 : (_json$errors$3$extens = _json$errors$3.extensions) === null || _json$errors$3$extens === void 0 ? void 0 : _json$errors$3$extens.statusCode,
49
+ errorSource: (_json$errors$4 = json.errors[0]) === null || _json$errors$4 === void 0 ? void 0 : (_json$errors$4$extens = _json$errors$4.extensions) === null || _json$errors$4$extens === void 0 ? void 0 : _json$errors$4$extens.errorSource,
50
+ message: json.errors[0].message,
51
+ traceId: (_json$extensions = json.extensions) === null || _json$extensions === void 0 ? void 0 : (_json$extensions$gate = _json$extensions.gateway) === null || _json$extensions$gate === void 0 ? void 0 : _json$extensions$gate.request_id
47
52
  });
48
53
  }
49
54
  return json.data;
@@ -44,7 +44,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
44
44
  actionSubjectId: actionSubjectId,
45
45
  attributes: _objectSpread(_objectSpread({
46
46
  packageName: "@atlaskit/profilecard",
47
- packageVersion: "19.1.0"
47
+ packageVersion: "19.1.1"
48
48
  }, attributes), {}, {
49
49
  firedAt: Math.round((0, _performance.getPageTime)())
50
50
  })
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "19.1.0"
3
+ "version": "19.1.1"
4
4
  }
@@ -4,15 +4,15 @@ const IGNORED_ERRORS = [
4
4
  // Error categories from AGG
5
5
  'TEAMS_FORBIDDEN', 'TEAMS_TEAM_DELETED'];
6
6
  function isIgnoredError(error) {
7
- return !!error && IGNORED_ERRORS.includes(error.reason);
7
+ return !!error && !!error.reason && IGNORED_ERRORS.includes(error.reason);
8
8
  }
9
9
  export const getErrorAttributes = error => {
10
- var _error$response, _error$response$heade;
11
- const traceId = !!error ? (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$heade = _error$response.headers) === null || _error$response$heade === void 0 ? void 0 : _error$response$heade.get('atl-traceid') : undefined;
10
+ var _error$traceId;
12
11
  return {
12
+ errorMessage: error === null || error === void 0 ? void 0 : error.message,
13
13
  errorStatus: error === null || error === void 0 ? void 0 : error.code,
14
- errorReason: error === null || error === void 0 ? void 0 : error.reason,
14
+ errorReason: (error === null || error === void 0 ? void 0 : error.reason) || 'default',
15
15
  isSLOFailure: !isIgnoredError(error),
16
- traceId: traceId !== null && traceId !== void 0 ? traceId : undefined
16
+ traceId: (_error$traceId = error === null || error === void 0 ? void 0 : error.traceId) !== null && _error$traceId !== void 0 ? _error$traceId : undefined
17
17
  };
18
18
  };
@@ -20,19 +20,24 @@ export function graphqlQuery(serviceUrl, query, processHeaders = id) {
20
20
  body: JSON.stringify(query)
21
21
  })).then(response => {
22
22
  if (!response.ok) {
23
+ var _response$headers;
24
+ const traceIdFromHeaders = response === null || response === void 0 ? void 0 : (_response$headers = response.headers) === null || _response$headers === void 0 ? void 0 : _response$headers.get('atl-traceid');
23
25
  return Promise.reject({
24
26
  code: response.status,
25
- reason: response.statusText
27
+ reason: response.statusText,
28
+ traceId: traceIdFromHeaders
26
29
  });
27
30
  }
28
31
  return response;
29
32
  }).then(response => response.json()).then(json => {
30
33
  if (json.errors) {
31
- var _json$errors$, _json$errors$2, _json$errors$2$extens, _json$errors$3, _json$errors$3$extens;
32
- // We need to handle responses from pf-directory and AGG
34
+ var _json$errors$, _json$errors$2, _json$errors$2$extens, _json$errors$3, _json$errors$3$extens, _json$errors$4, _json$errors$4$extens, _json$extensions, _json$extensions$gate;
33
35
  return Promise.reject({
34
36
  reason: ((_json$errors$ = json.errors[0]) === null || _json$errors$ === void 0 ? void 0 : _json$errors$.category) || ((_json$errors$2 = json.errors[0]) === null || _json$errors$2 === void 0 ? void 0 : (_json$errors$2$extens = _json$errors$2.extensions) === null || _json$errors$2$extens === void 0 ? void 0 : _json$errors$2$extens.classification) || 'default',
35
- code: (_json$errors$3 = json.errors[0]) === null || _json$errors$3 === void 0 ? void 0 : (_json$errors$3$extens = _json$errors$3.extensions) === null || _json$errors$3$extens === void 0 ? void 0 : _json$errors$3$extens.statusCode
37
+ code: (_json$errors$3 = json.errors[0]) === null || _json$errors$3 === void 0 ? void 0 : (_json$errors$3$extens = _json$errors$3.extensions) === null || _json$errors$3$extens === void 0 ? void 0 : _json$errors$3$extens.statusCode,
38
+ errorSource: (_json$errors$4 = json.errors[0]) === null || _json$errors$4 === void 0 ? void 0 : (_json$errors$4$extens = _json$errors$4.extensions) === null || _json$errors$4$extens === void 0 ? void 0 : _json$errors$4$extens.errorSource,
39
+ message: json.errors[0].message,
40
+ traceId: (_json$extensions = json.extensions) === null || _json$extensions === void 0 ? void 0 : (_json$extensions$gate = _json$extensions.gateway) === null || _json$extensions$gate === void 0 ? void 0 : _json$extensions$gate.request_id
36
41
  });
37
42
  }
38
43
  return json.data;
@@ -31,7 +31,7 @@ const createEvent = (eventType, action, actionSubject, actionSubjectId, attribut
31
31
  actionSubjectId,
32
32
  attributes: {
33
33
  packageName: "@atlaskit/profilecard",
34
- packageVersion: "19.1.0",
34
+ packageVersion: "19.1.1",
35
35
  ...attributes,
36
36
  firedAt: Math.round(getPageTime())
37
37
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "19.1.0"
3
+ "version": "19.1.1"
4
4
  }
@@ -4,15 +4,15 @@ var IGNORED_ERRORS = [
4
4
  // Error categories from AGG
5
5
  'TEAMS_FORBIDDEN', 'TEAMS_TEAM_DELETED'];
6
6
  function isIgnoredError(error) {
7
- return !!error && IGNORED_ERRORS.includes(error.reason);
7
+ return !!error && !!error.reason && IGNORED_ERRORS.includes(error.reason);
8
8
  }
9
9
  export var getErrorAttributes = function getErrorAttributes(error) {
10
- var _error$response, _error$response$heade;
11
- var traceId = !!error ? (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$heade = _error$response.headers) === null || _error$response$heade === void 0 ? void 0 : _error$response$heade.get('atl-traceid') : undefined;
10
+ var _error$traceId;
12
11
  return {
12
+ errorMessage: error === null || error === void 0 ? void 0 : error.message,
13
13
  errorStatus: error === null || error === void 0 ? void 0 : error.code,
14
- errorReason: error === null || error === void 0 ? void 0 : error.reason,
14
+ errorReason: (error === null || error === void 0 ? void 0 : error.reason) || 'default',
15
15
  isSLOFailure: !isIgnoredError(error),
16
- traceId: traceId !== null && traceId !== void 0 ? traceId : undefined
16
+ traceId: (_error$traceId = error === null || error === void 0 ? void 0 : error.traceId) !== null && _error$traceId !== void 0 ? _error$traceId : undefined
17
17
  };
18
18
  };
@@ -23,9 +23,12 @@ export function graphqlQuery(serviceUrl, query) {
23
23
  body: JSON.stringify(query)
24
24
  })).then(function (response) {
25
25
  if (!response.ok) {
26
+ var _response$headers;
27
+ var traceIdFromHeaders = response === null || response === void 0 ? void 0 : (_response$headers = response.headers) === null || _response$headers === void 0 ? void 0 : _response$headers.get('atl-traceid');
26
28
  return Promise.reject({
27
29
  code: response.status,
28
- reason: response.statusText
30
+ reason: response.statusText,
31
+ traceId: traceIdFromHeaders
29
32
  });
30
33
  }
31
34
  return response;
@@ -33,11 +36,13 @@ export function graphqlQuery(serviceUrl, query) {
33
36
  return response.json();
34
37
  }).then(function (json) {
35
38
  if (json.errors) {
36
- var _json$errors$, _json$errors$2, _json$errors$2$extens, _json$errors$3, _json$errors$3$extens;
37
- // We need to handle responses from pf-directory and AGG
39
+ var _json$errors$, _json$errors$2, _json$errors$2$extens, _json$errors$3, _json$errors$3$extens, _json$errors$4, _json$errors$4$extens, _json$extensions, _json$extensions$gate;
38
40
  return Promise.reject({
39
41
  reason: ((_json$errors$ = json.errors[0]) === null || _json$errors$ === void 0 ? void 0 : _json$errors$.category) || ((_json$errors$2 = json.errors[0]) === null || _json$errors$2 === void 0 ? void 0 : (_json$errors$2$extens = _json$errors$2.extensions) === null || _json$errors$2$extens === void 0 ? void 0 : _json$errors$2$extens.classification) || 'default',
40
- code: (_json$errors$3 = json.errors[0]) === null || _json$errors$3 === void 0 ? void 0 : (_json$errors$3$extens = _json$errors$3.extensions) === null || _json$errors$3$extens === void 0 ? void 0 : _json$errors$3$extens.statusCode
42
+ code: (_json$errors$3 = json.errors[0]) === null || _json$errors$3 === void 0 ? void 0 : (_json$errors$3$extens = _json$errors$3.extensions) === null || _json$errors$3$extens === void 0 ? void 0 : _json$errors$3$extens.statusCode,
43
+ errorSource: (_json$errors$4 = json.errors[0]) === null || _json$errors$4 === void 0 ? void 0 : (_json$errors$4$extens = _json$errors$4.extensions) === null || _json$errors$4$extens === void 0 ? void 0 : _json$errors$4$extens.errorSource,
44
+ message: json.errors[0].message,
45
+ traceId: (_json$extensions = json.extensions) === null || _json$extensions === void 0 ? void 0 : (_json$extensions$gate = _json$extensions.gateway) === null || _json$extensions$gate === void 0 ? void 0 : _json$extensions$gate.request_id
41
46
  });
42
47
  }
43
48
  return json.data;
@@ -38,7 +38,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
38
38
  actionSubjectId: actionSubjectId,
39
39
  attributes: _objectSpread(_objectSpread({
40
40
  packageName: "@atlaskit/profilecard",
41
- packageVersion: "19.1.0"
41
+ packageVersion: "19.1.1"
42
42
  }, attributes), {}, {
43
43
  firedAt: Math.round(getPageTime())
44
44
  })
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "19.1.0"
3
+ "version": "19.1.1"
4
4
  }
@@ -1,6 +1,8 @@
1
- export declare const getErrorAttributes: (error?: any) => {
2
- errorStatus: any;
3
- errorReason: any;
1
+ import { GraphQLError } from './graphqlUtils';
2
+ export declare const getErrorAttributes: (error?: GraphQLError | undefined) => {
3
+ errorMessage: string | undefined;
4
+ errorStatus: number | undefined;
5
+ errorReason: string;
4
6
  isSLOFailure: boolean;
5
7
  traceId: string | undefined;
6
8
  };
@@ -4,7 +4,10 @@ interface Query {
4
4
  }
5
5
  export interface GraphQLError {
6
6
  code?: number;
7
- reason: string;
7
+ reason?: string;
8
+ errorSource?: string;
9
+ message?: string;
10
+ traceId?: string;
8
11
  }
9
12
  declare type HeaderProcessor = (headers: Headers) => Headers;
10
13
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "19.1.0",
3
+ "version": "19.1.1",
4
4
  "description": "A React component to display a card with user information.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"