@atlaskit/profilecard 19.5.10 → 19.5.11

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 (41) hide show
  1. package/CHANGELOG.md +115 -109
  2. package/dist/cjs/client/TeamCentralCardClient.js +2 -2
  3. package/dist/cjs/client/UserProfileCardClient.js +1 -1
  4. package/dist/cjs/client/errorUtils.js +67 -14
  5. package/dist/cjs/client/getTeamFromAGG.js +5 -5
  6. package/dist/cjs/client/graphqlUtils.js +106 -36
  7. package/dist/cjs/client/types.js +5 -0
  8. package/dist/cjs/mocks/mock-team-client.js +6 -1
  9. package/dist/cjs/util/analytics.js +1 -1
  10. package/dist/cjs/util/errors.js +114 -0
  11. package/dist/es2019/client/TeamCentralCardClient.js +3 -3
  12. package/dist/es2019/client/UserProfileCardClient.js +2 -2
  13. package/dist/es2019/client/errorUtils.js +63 -12
  14. package/dist/es2019/client/getTeamFromAGG.js +3 -3
  15. package/dist/es2019/client/graphqlUtils.js +28 -26
  16. package/dist/es2019/client/types.js +1 -0
  17. package/dist/es2019/mocks/mock-team-client.js +6 -1
  18. package/dist/es2019/util/analytics.js +1 -1
  19. package/dist/es2019/util/errors.js +59 -0
  20. package/dist/esm/client/TeamCentralCardClient.js +3 -3
  21. package/dist/esm/client/UserProfileCardClient.js +2 -2
  22. package/dist/esm/client/errorUtils.js +63 -12
  23. package/dist/esm/client/getTeamFromAGG.js +6 -6
  24. package/dist/esm/client/graphqlUtils.js +104 -35
  25. package/dist/esm/client/types.js +1 -0
  26. package/dist/esm/mocks/mock-team-client.js +6 -1
  27. package/dist/esm/util/analytics.js +1 -1
  28. package/dist/esm/util/errors.js +102 -0
  29. package/dist/types/client/errorUtils.d.ts +5 -9
  30. package/dist/types/client/graphqlUtils.d.ts +13 -1
  31. package/dist/types/client/types.d.ts +12 -0
  32. package/dist/types/mocks/mock-team-client.d.ts +1 -0
  33. package/dist/types/util/analytics.d.ts +2 -1
  34. package/dist/types/util/errors.d.ts +43 -0
  35. package/dist/types-ts4.5/client/errorUtils.d.ts +5 -9
  36. package/dist/types-ts4.5/client/graphqlUtils.d.ts +13 -1
  37. package/dist/types-ts4.5/client/types.d.ts +12 -0
  38. package/dist/types-ts4.5/mocks/mock-team-client.d.ts +1 -0
  39. package/dist/types-ts4.5/util/analytics.d.ts +2 -1
  40. package/dist/types-ts4.5/util/errors.d.ts +43 -0
  41. package/package.json +6 -6
@@ -8,6 +8,12 @@ export interface GraphQLError {
8
8
  source?: string;
9
9
  message?: string;
10
10
  traceId?: string;
11
+ category: string;
12
+ type: string;
13
+ path: string[];
14
+ extensions: {
15
+ errorNumber: number;
16
+ } & Record<string, any>;
11
17
  }
12
18
  type HeaderProcessor = (headers: Headers) => Headers;
13
19
  /**
@@ -15,5 +21,11 @@ type HeaderProcessor = (headers: Headers) => Headers;
15
21
  * @param {Query} query - GraphQL query
16
22
  * @param {HeaderProcessor} processHeaders - a function to add extra headers to the request
17
23
  */
18
- export declare function graphqlQuery<D>(serviceUrl: string, query: Query, processHeaders?: HeaderProcessor): Promise<D>;
24
+ export declare function directoryGraphqlQuery<D>(serviceUrl: string, query: Query, processHeaders?: HeaderProcessor): Promise<D>;
25
+ /**
26
+ * @param {string} serviceUrl - GraphQL service endpoint
27
+ * @param {Query} query - GraphQL query
28
+ * @param {HeaderProcessor} processHeaders - a function to add extra headers to the request
29
+ */
30
+ export declare function AGGQuery<D>(serviceUrl: string, query: Query, processHeaders?: HeaderProcessor): Promise<D>;
19
31
  export {};
@@ -0,0 +1,12 @@
1
+ export type ErrorAttributes = {
2
+ errorCount?: number;
3
+ errorDetails?: Omit<ErrorAttributes, 'errorDetails'>[];
4
+ errorMessage: string;
5
+ errorCategory?: string;
6
+ errorType?: string;
7
+ errorPath?: string;
8
+ errorNumber?: number;
9
+ isSLOFailure: boolean;
10
+ traceId?: string | null;
11
+ errorStatusCode?: number;
12
+ };
@@ -4,4 +4,5 @@ export default function getMockTeamClient(data: {
4
4
  timeout: number;
5
5
  error: any;
6
6
  errorRate: number;
7
+ traceId: string;
7
8
  }): any;
@@ -1,6 +1,7 @@
1
1
  import { AnalyticsEventPayload } from '@atlaskit/analytics-next';
2
2
  import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next/types';
3
- type GenericAttributes = Record<string, string | number | boolean | undefined>;
3
+ import { ErrorAttributes } from '../client/types';
4
+ type GenericAttributes = Record<string, string | number | boolean | undefined | string[]> | ErrorAttributes;
4
5
  interface AnalyticsEvent {
5
6
  action?: string;
6
7
  actionSubject?: string;
@@ -0,0 +1,43 @@
1
+ export declare class HttpError extends Error {
2
+ code: number;
3
+ traceId?: string | null;
4
+ constructor(code: number, reason: string, traceId?: string | null);
5
+ }
6
+ type KnownErrorExtensions = {
7
+ errorNumber?: number;
8
+ };
9
+ type ErrorExtensions = KnownErrorExtensions & Record<string, any>;
10
+ type ErrorCategory = 'NotFound' | 'NotPermitted' | 'MalformedInput' | 'Internal' | 'Gone';
11
+ export declare class DirectoryGraphQLError extends Error {
12
+ category: ErrorCategory;
13
+ type: string;
14
+ path: string;
15
+ errorNumber?: number;
16
+ extensions: Record<string, any>;
17
+ constructor(message: string, category: ErrorCategory, type: string, extensions: ErrorExtensions, path?: (string | number)[]);
18
+ }
19
+ export declare class DirectoryGraphQLErrors extends Error {
20
+ errors: DirectoryGraphQLError[];
21
+ traceId?: string | null;
22
+ constructor(errors: unknown, traceId: string | null);
23
+ }
24
+ type KnownAggErrorExtensions = {
25
+ statusCode?: number;
26
+ errorType?: string;
27
+ classification?: string;
28
+ };
29
+ type AggErrorExtensions = KnownAggErrorExtensions & Record<string, any>;
30
+ export declare class AGGError extends Error {
31
+ path: string;
32
+ extensions: Record<string, any>;
33
+ statusCode?: number;
34
+ errorType?: string;
35
+ classification?: string;
36
+ constructor(message: string, extensions: AggErrorExtensions, path?: (string | number)[]);
37
+ }
38
+ export declare class AGGErrors extends Error {
39
+ errors: AGGError[];
40
+ traceId?: string | null;
41
+ constructor(errors: unknown, traceId: string | null);
42
+ }
43
+ export {};
@@ -1,9 +1,5 @@
1
- import { GraphQLError } from './graphqlUtils';
2
- export declare const getErrorAttributes: (error?: GraphQLError) => {
3
- errorMessage: string | undefined;
4
- errorStatus: number | undefined;
5
- errorReason: string;
6
- errorSource: string | undefined;
7
- isSLOFailure: boolean;
8
- traceId: string | undefined;
9
- };
1
+ import { AGGError, AGGErrors, DirectoryGraphQLError, DirectoryGraphQLErrors } from '../util/errors';
2
+ import { ErrorAttributes } from './types';
3
+ export declare const getErrorAttributes: (error?: DirectoryGraphQLErrors | Error | unknown | DirectoryGraphQLError | AGGError | AGGErrors) => ErrorAttributes;
4
+ export declare const handleDirectoryGraphQLErrors: (errors: unknown, traceId: string | null) => void;
5
+ export declare const handleAGGErrors: (errors: unknown, traceId: string | null) => void;
@@ -8,6 +8,12 @@ export interface GraphQLError {
8
8
  source?: string;
9
9
  message?: string;
10
10
  traceId?: string;
11
+ category: string;
12
+ type: string;
13
+ path: string[];
14
+ extensions: {
15
+ errorNumber: number;
16
+ } & Record<string, any>;
11
17
  }
12
18
  type HeaderProcessor = (headers: Headers) => Headers;
13
19
  /**
@@ -15,5 +21,11 @@ type HeaderProcessor = (headers: Headers) => Headers;
15
21
  * @param {Query} query - GraphQL query
16
22
  * @param {HeaderProcessor} processHeaders - a function to add extra headers to the request
17
23
  */
18
- export declare function graphqlQuery<D>(serviceUrl: string, query: Query, processHeaders?: HeaderProcessor): Promise<D>;
24
+ export declare function directoryGraphqlQuery<D>(serviceUrl: string, query: Query, processHeaders?: HeaderProcessor): Promise<D>;
25
+ /**
26
+ * @param {string} serviceUrl - GraphQL service endpoint
27
+ * @param {Query} query - GraphQL query
28
+ * @param {HeaderProcessor} processHeaders - a function to add extra headers to the request
29
+ */
30
+ export declare function AGGQuery<D>(serviceUrl: string, query: Query, processHeaders?: HeaderProcessor): Promise<D>;
19
31
  export {};
@@ -0,0 +1,12 @@
1
+ export type ErrorAttributes = {
2
+ errorCount?: number;
3
+ errorDetails?: Omit<ErrorAttributes, 'errorDetails'>[];
4
+ errorMessage: string;
5
+ errorCategory?: string;
6
+ errorType?: string;
7
+ errorPath?: string;
8
+ errorNumber?: number;
9
+ isSLOFailure: boolean;
10
+ traceId?: string | null;
11
+ errorStatusCode?: number;
12
+ };
@@ -4,4 +4,5 @@ export default function getMockTeamClient(data: {
4
4
  timeout: number;
5
5
  error: any;
6
6
  errorRate: number;
7
+ traceId: string;
7
8
  }): any;
@@ -1,6 +1,7 @@
1
1
  import { AnalyticsEventPayload } from '@atlaskit/analytics-next';
2
2
  import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next/types';
3
- type GenericAttributes = Record<string, string | number | boolean | undefined>;
3
+ import { ErrorAttributes } from '../client/types';
4
+ type GenericAttributes = Record<string, string | number | boolean | undefined | string[]> | ErrorAttributes;
4
5
  interface AnalyticsEvent {
5
6
  action?: string;
6
7
  actionSubject?: string;
@@ -0,0 +1,43 @@
1
+ export declare class HttpError extends Error {
2
+ code: number;
3
+ traceId?: string | null;
4
+ constructor(code: number, reason: string, traceId?: string | null);
5
+ }
6
+ type KnownErrorExtensions = {
7
+ errorNumber?: number;
8
+ };
9
+ type ErrorExtensions = KnownErrorExtensions & Record<string, any>;
10
+ type ErrorCategory = 'NotFound' | 'NotPermitted' | 'MalformedInput' | 'Internal' | 'Gone';
11
+ export declare class DirectoryGraphQLError extends Error {
12
+ category: ErrorCategory;
13
+ type: string;
14
+ path: string;
15
+ errorNumber?: number;
16
+ extensions: Record<string, any>;
17
+ constructor(message: string, category: ErrorCategory, type: string, extensions: ErrorExtensions, path?: (string | number)[]);
18
+ }
19
+ export declare class DirectoryGraphQLErrors extends Error {
20
+ errors: DirectoryGraphQLError[];
21
+ traceId?: string | null;
22
+ constructor(errors: unknown, traceId: string | null);
23
+ }
24
+ type KnownAggErrorExtensions = {
25
+ statusCode?: number;
26
+ errorType?: string;
27
+ classification?: string;
28
+ };
29
+ type AggErrorExtensions = KnownAggErrorExtensions & Record<string, any>;
30
+ export declare class AGGError extends Error {
31
+ path: string;
32
+ extensions: Record<string, any>;
33
+ statusCode?: number;
34
+ errorType?: string;
35
+ classification?: string;
36
+ constructor(message: string, extensions: AggErrorExtensions, path?: (string | number)[]);
37
+ }
38
+ export declare class AGGErrors extends Error {
39
+ errors: AGGError[];
40
+ traceId?: string | null;
41
+ constructor(errors: unknown, traceId: string | null);
42
+ }
43
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "19.5.10",
3
+ "version": "19.5.11",
4
4
  "description": "A React component to display a card with user information.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -53,18 +53,18 @@
53
53
  "@atlaskit/avatar": "^21.3.0",
54
54
  "@atlaskit/avatar-group": "^9.4.0",
55
55
  "@atlaskit/button": "^16.10.0",
56
- "@atlaskit/dropdown-menu": "^11.13.0",
56
+ "@atlaskit/dropdown-menu": "^11.14.0",
57
57
  "@atlaskit/empty-state": "^7.6.0",
58
58
  "@atlaskit/focus-ring": "^1.3.4",
59
59
  "@atlaskit/give-kudos": "^2.0.0",
60
60
  "@atlaskit/icon": "^21.12.0",
61
61
  "@atlaskit/lozenge": "^11.4.0",
62
- "@atlaskit/menu": "^1.10.0",
62
+ "@atlaskit/menu": "^1.11.0",
63
63
  "@atlaskit/platform-feature-flags": "^0.2.4",
64
- "@atlaskit/popup": "^1.9.0",
65
- "@atlaskit/spinner": "^15.5.0",
64
+ "@atlaskit/popup": "^1.10.0",
65
+ "@atlaskit/spinner": "^15.6.0",
66
66
  "@atlaskit/theme": "^12.6.0",
67
- "@atlaskit/tokens": "^1.21.0",
67
+ "@atlaskit/tokens": "^1.25.0",
68
68
  "@babel/runtime": "^7.0.0",
69
69
  "@emotion/react": "^11.7.1",
70
70
  "@emotion/styled": "^11.0.0",