@atlaskit/teams-public 0.2.0 → 0.3.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 +20 -0
- package/dist/cjs/common/utils/error/index.js +120 -0
- package/dist/cjs/common/utils/get-container-properties.js +2 -12
- package/dist/cjs/common/utils/http.js +119 -0
- package/dist/cjs/common/utils/status-code-handlers-provider.js +30 -0
- package/dist/cjs/common/utils/team-id-to-ari.js +10 -0
- package/dist/cjs/controllers/hooks/use-team-containers/index.js +79 -0
- package/dist/cjs/controllers/index.js +12 -0
- package/dist/cjs/services/agg-client/index.js +79 -0
- package/dist/cjs/services/agg-client/mocks/index.js +52 -0
- package/dist/cjs/services/agg-client/utils/queries/team-containers-query.js +12 -0
- package/dist/cjs/services/base-client/index.js +92 -0
- package/dist/cjs/services/constants.js +9 -0
- package/dist/cjs/services/graphql-client/index.js +12 -0
- package/dist/cjs/services/graphql-client/main.js +69 -0
- package/dist/cjs/services/graphql-client/types.js +5 -0
- package/dist/cjs/services/graphql-client/utils/index.js +157 -0
- package/dist/cjs/services/index.js +18 -0
- package/dist/cjs/services/main.js +72 -0
- package/dist/cjs/services/types.js +5 -0
- package/dist/cjs/ui/team-containers/add-container-card/index.compiled.css +0 -2
- package/dist/cjs/ui/team-containers/add-container-card/index.js +30 -12
- package/dist/cjs/ui/team-containers/linked-container-card/index.compiled.css +1 -2
- package/dist/cjs/ui/team-containers/linked-container-card/index.js +45 -15
- package/dist/cjs/ui/team-containers/main.js +94 -16
- package/dist/cjs/ui/team-containers/team-containers-skeleton/index.compiled.css +4 -0
- package/dist/cjs/ui/team-containers/team-containers-skeleton/index.js +36 -0
- package/dist/cjs/ui/team-containers/team-containers-skeleton/linked-container-card-skeleton/index.compiled.css +14 -0
- package/dist/cjs/ui/team-containers/team-containers-skeleton/linked-container-card-skeleton/index.js +38 -0
- package/dist/es2019/common/utils/error/index.js +87 -0
- package/dist/es2019/common/utils/get-container-properties.js +3 -13
- package/dist/es2019/common/utils/http.js +82 -0
- package/dist/es2019/common/utils/status-code-handlers-provider.js +25 -0
- package/dist/es2019/common/utils/team-id-to-ari.js +2 -0
- package/dist/es2019/controllers/hooks/use-team-containers/index.js +45 -0
- package/dist/es2019/controllers/index.js +1 -0
- package/dist/es2019/services/agg-client/index.js +36 -0
- package/dist/es2019/services/agg-client/mocks/index.js +46 -0
- package/dist/es2019/services/agg-client/utils/queries/team-containers-query.js +46 -0
- package/dist/es2019/services/base-client/index.js +64 -0
- package/dist/es2019/services/constants.js +3 -0
- package/dist/es2019/services/graphql-client/index.js +1 -0
- package/dist/es2019/services/graphql-client/main.js +23 -0
- package/dist/es2019/services/graphql-client/types.js +1 -0
- package/dist/es2019/services/graphql-client/utils/index.js +76 -0
- package/dist/es2019/services/index.js +1 -0
- package/dist/es2019/services/main.js +39 -0
- package/dist/es2019/services/types.js +1 -0
- package/dist/es2019/ui/team-containers/add-container-card/index.compiled.css +0 -2
- package/dist/es2019/ui/team-containers/add-container-card/index.js +15 -7
- package/dist/es2019/ui/team-containers/linked-container-card/index.compiled.css +1 -2
- package/dist/es2019/ui/team-containers/linked-container-card/index.js +28 -9
- package/dist/es2019/ui/team-containers/main.js +79 -16
- package/dist/es2019/ui/team-containers/team-containers-skeleton/index.compiled.css +4 -0
- package/dist/es2019/ui/team-containers/team-containers-skeleton/index.js +27 -0
- package/dist/es2019/ui/team-containers/team-containers-skeleton/linked-container-card-skeleton/index.compiled.css +14 -0
- package/dist/es2019/ui/team-containers/team-containers-skeleton/linked-container-card-skeleton/index.js +31 -0
- package/dist/esm/common/utils/error/index.js +117 -0
- package/dist/esm/common/utils/get-container-properties.js +3 -13
- package/dist/esm/common/utils/http.js +109 -0
- package/dist/esm/common/utils/status-code-handlers-provider.js +23 -0
- package/dist/esm/common/utils/team-id-to-ari.js +4 -0
- package/dist/esm/controllers/hooks/use-team-containers/index.js +72 -0
- package/dist/esm/controllers/index.js +1 -0
- package/dist/esm/services/agg-client/index.js +72 -0
- package/dist/esm/services/agg-client/mocks/index.js +46 -0
- package/dist/esm/services/agg-client/utils/queries/team-containers-query.js +5 -0
- package/dist/esm/services/base-client/index.js +85 -0
- package/dist/esm/services/constants.js +3 -0
- package/dist/esm/services/graphql-client/index.js +1 -0
- package/dist/esm/services/graphql-client/main.js +62 -0
- package/dist/esm/services/graphql-client/types.js +1 -0
- package/dist/esm/services/graphql-client/utils/index.js +149 -0
- package/dist/esm/services/index.js +1 -0
- package/dist/esm/services/main.js +65 -0
- package/dist/esm/services/types.js +1 -0
- package/dist/esm/ui/team-containers/add-container-card/index.compiled.css +0 -2
- package/dist/esm/ui/team-containers/add-container-card/index.js +25 -7
- package/dist/esm/ui/team-containers/linked-container-card/index.compiled.css +1 -2
- package/dist/esm/ui/team-containers/linked-container-card/index.js +39 -9
- package/dist/esm/ui/team-containers/main.js +91 -16
- package/dist/esm/ui/team-containers/team-containers-skeleton/index.compiled.css +4 -0
- package/dist/esm/ui/team-containers/team-containers-skeleton/index.js +29 -0
- package/dist/esm/ui/team-containers/team-containers-skeleton/linked-container-card-skeleton/index.compiled.css +14 -0
- package/dist/esm/ui/team-containers/team-containers-skeleton/linked-container-card-skeleton/index.js +31 -0
- package/dist/types/common/types.d.ts +1 -1
- package/dist/types/common/utils/error/index.d.ts +59 -0
- package/dist/types/common/utils/http.d.ts +31 -0
- package/dist/types/common/utils/status-code-handlers-provider.d.ts +17 -0
- package/dist/types/common/utils/team-id-to-ari.d.ts +2 -0
- package/dist/types/controllers/hooks/use-team-containers/index.d.ts +12 -0
- package/dist/types/controllers/index.d.ts +1 -0
- package/dist/types/services/agg-client/index.d.ts +15 -0
- package/dist/types/services/agg-client/mocks/index.d.ts +55 -0
- package/dist/types/services/agg-client/utils/queries/team-containers-query.d.ts +44 -0
- package/dist/types/services/base-client/index.d.ts +37 -0
- package/dist/types/services/constants.d.ts +4 -0
- package/dist/types/services/graphql-client/index.d.ts +1 -0
- package/dist/types/services/graphql-client/main.d.ts +8 -0
- package/dist/types/services/graphql-client/types.d.ts +19 -0
- package/dist/types/services/graphql-client/utils/index.d.ts +3 -0
- package/dist/types/services/index.d.ts +1 -0
- package/dist/types/services/main.d.ts +25 -0
- package/dist/types/services/types.d.ts +19 -0
- package/dist/types/ui/team-containers/add-container-card/index.d.ts +3 -2
- package/dist/types/ui/team-containers/linked-container-card/index.d.ts +3 -6
- package/dist/types/ui/team-containers/main.d.ts +3 -1
- package/dist/types/ui/team-containers/team-containers-skeleton/index.d.ts +6 -0
- package/dist/types/ui/team-containers/team-containers-skeleton/linked-container-card-skeleton/index.d.ts +2 -0
- package/dist/types/ui/team-containers/types.d.ts +5 -0
- package/dist/types-ts4.5/common/types.d.ts +1 -1
- package/dist/types-ts4.5/common/utils/error/index.d.ts +59 -0
- package/dist/types-ts4.5/common/utils/http.d.ts +31 -0
- package/dist/types-ts4.5/common/utils/status-code-handlers-provider.d.ts +17 -0
- package/dist/types-ts4.5/common/utils/team-id-to-ari.d.ts +2 -0
- package/dist/types-ts4.5/controllers/hooks/use-team-containers/index.d.ts +12 -0
- package/dist/types-ts4.5/controllers/index.d.ts +1 -0
- package/dist/types-ts4.5/services/agg-client/index.d.ts +15 -0
- package/dist/types-ts4.5/services/agg-client/mocks/index.d.ts +55 -0
- package/dist/types-ts4.5/services/agg-client/utils/queries/team-containers-query.d.ts +44 -0
- package/dist/types-ts4.5/services/base-client/index.d.ts +37 -0
- package/dist/types-ts4.5/services/constants.d.ts +4 -0
- package/dist/types-ts4.5/services/graphql-client/index.d.ts +1 -0
- package/dist/types-ts4.5/services/graphql-client/main.d.ts +8 -0
- package/dist/types-ts4.5/services/graphql-client/types.d.ts +19 -0
- package/dist/types-ts4.5/services/graphql-client/utils/index.d.ts +3 -0
- package/dist/types-ts4.5/services/index.d.ts +1 -0
- package/dist/types-ts4.5/services/main.d.ts +25 -0
- package/dist/types-ts4.5/services/types.d.ts +19 -0
- package/dist/types-ts4.5/ui/team-containers/add-container-card/index.d.ts +3 -2
- package/dist/types-ts4.5/ui/team-containers/linked-container-card/index.d.ts +3 -6
- package/dist/types-ts4.5/ui/team-containers/main.d.ts +3 -1
- package/dist/types-ts4.5/ui/team-containers/team-containers-skeleton/index.d.ts +6 -0
- package/dist/types-ts4.5/ui/team-containers/team-containers-skeleton/linked-container-card-skeleton/index.d.ts +2 -0
- package/dist/types-ts4.5/ui/team-containers/types.d.ts +5 -0
- package/package.json +13 -9
- package/dist/cjs/ui/team-containers/constants.js +0 -7
- package/dist/es2019/ui/team-containers/constants.js +0 -1
- package/dist/esm/ui/team-containers/constants.js +0 -1
- package/dist/types/ui/team-containers/constants.d.ts +0 -1
- package/dist/types-ts4.5/ui/team-containers/constants.d.ts +0 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare const EXPONENTIAL_BACKOFF_RETRY_POLICY: {
|
|
2
|
+
INITIAL_DELAY: number;
|
|
3
|
+
MAX_RETRIES: number;
|
|
4
|
+
JITTER: boolean;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Checks whether a status code is a 5xx HTTP code.
|
|
8
|
+
* @param {number} status HTTP status code
|
|
9
|
+
*/
|
|
10
|
+
export declare function is5xx(status: number): boolean;
|
|
11
|
+
export declare function isFetchResponse(data: unknown): data is {
|
|
12
|
+
response: Response;
|
|
13
|
+
};
|
|
14
|
+
type ToTryFunctionArgs = any[];
|
|
15
|
+
type ToTryFunction<T> = (...args: ToTryFunctionArgs) => Promise<T>;
|
|
16
|
+
type RetryIfCallback<T> = (a: T) => boolean;
|
|
17
|
+
interface WithExponentialBackoffOptions<T> {
|
|
18
|
+
initial: number;
|
|
19
|
+
jitter?: boolean;
|
|
20
|
+
max: number;
|
|
21
|
+
retryIf?: RetryIfCallback<T>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Transparently wrap a function so that it is retried until it succeeds or reaches a max retry limit.
|
|
25
|
+
* The returned function has the same signature as the wrapped function.
|
|
26
|
+
*
|
|
27
|
+
* Modified from https://jsfiddle.net/pajtai/pLka0ow9/
|
|
28
|
+
*/
|
|
29
|
+
export declare function withExponentialBackoff<ResponseType>(toTry: ToTryFunction<ResponseType>, hofOptions?: WithExponentialBackoffOptions<ResponseType>): (...args: ToTryFunctionArgs) => Promise<ResponseType>;
|
|
30
|
+
export declare const fetchWithExponentialBackoff: (...args: ToTryFunctionArgs) => Promise<Response>;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Our REST clients are initialised when their module loads which makes it tricky for them to consume the `statusCodeHandlers` prop passed to App from the host application.
|
|
3
|
+
* This is a temporary measure to enable the clients to consume `statusCodeHandlers`.
|
|
4
|
+
* The long term solution is to replace our REST clients with Apollo client custom resolvers
|
|
5
|
+
* This will unify all remote data handling under the apollo-client module which is able to easily receive `statusCodeHandlers` as it is initialised within the React portion of our app.
|
|
6
|
+
*/
|
|
7
|
+
type StatusCodeHandler = (response: Response) => void;
|
|
8
|
+
export interface StatusCodeHandlerMap {
|
|
9
|
+
[statusCode: number]: StatusCodeHandler;
|
|
10
|
+
}
|
|
11
|
+
export declare const statusCodeHandlersProvider: {
|
|
12
|
+
handlers: StatusCodeHandlerMap;
|
|
13
|
+
get(): StatusCodeHandlerMap;
|
|
14
|
+
setHandlers(handlers: StatusCodeHandlerMap): void;
|
|
15
|
+
};
|
|
16
|
+
export declare function handleResponse(response: Response): void;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Action } from 'react-sweet-state';
|
|
2
|
+
import { type TeamContainers } from '../../../services/types';
|
|
3
|
+
type State = {
|
|
4
|
+
teamContainers: TeamContainers;
|
|
5
|
+
loading: boolean;
|
|
6
|
+
error: Error | null;
|
|
7
|
+
};
|
|
8
|
+
export declare const useTeamContainersHook: import("react-sweet-state").HookFunction<State, import("react-sweet-state").BoundActions<State, {
|
|
9
|
+
fetchTeamContainers: (teamId: string) => Action<State>;
|
|
10
|
+
}>, void>;
|
|
11
|
+
export declare const useTeamContainers: (teamId: string) => State;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useTeamContainers } from './hooks/use-team-containers';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ClientConfig } from '../base-client';
|
|
2
|
+
import { BaseGraphQlClient } from '../graphql-client';
|
|
3
|
+
export declare class AGGClient extends BaseGraphQlClient {
|
|
4
|
+
constructor(baseUrl: string, config: ClientConfig);
|
|
5
|
+
setBaseUrl(baseUrl: string): void;
|
|
6
|
+
getTeamContainers(teamId: string): Promise<{
|
|
7
|
+
id: string;
|
|
8
|
+
type: "ConfluenceSpace" | "JiraProject";
|
|
9
|
+
name: string;
|
|
10
|
+
icon: string;
|
|
11
|
+
createdDate: Date;
|
|
12
|
+
link: string;
|
|
13
|
+
}[]>;
|
|
14
|
+
}
|
|
15
|
+
export declare const aggClient: AGGClient;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export declare const MOCK_TEAM_CONTAINERS: {
|
|
2
|
+
graphStore: {
|
|
3
|
+
cypherQuery: {
|
|
4
|
+
edges: ({
|
|
5
|
+
node: {
|
|
6
|
+
from: {
|
|
7
|
+
id: string;
|
|
8
|
+
};
|
|
9
|
+
to: {
|
|
10
|
+
id: string;
|
|
11
|
+
data: {
|
|
12
|
+
__typename: string;
|
|
13
|
+
confluenceSpaceName: string;
|
|
14
|
+
type: string;
|
|
15
|
+
createdDate: string;
|
|
16
|
+
links: {
|
|
17
|
+
webUi: string;
|
|
18
|
+
};
|
|
19
|
+
icon: {
|
|
20
|
+
path: string;
|
|
21
|
+
};
|
|
22
|
+
jiraProjectName?: undefined;
|
|
23
|
+
webUrl?: undefined;
|
|
24
|
+
created?: undefined;
|
|
25
|
+
avatar?: undefined;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
} | {
|
|
30
|
+
node: {
|
|
31
|
+
from: {
|
|
32
|
+
id: string;
|
|
33
|
+
};
|
|
34
|
+
to: {
|
|
35
|
+
id: string;
|
|
36
|
+
data: {
|
|
37
|
+
__typename: string;
|
|
38
|
+
jiraProjectName: string;
|
|
39
|
+
webUrl: string;
|
|
40
|
+
created: string;
|
|
41
|
+
avatar: {
|
|
42
|
+
medium: string;
|
|
43
|
+
};
|
|
44
|
+
confluenceSpaceName?: undefined;
|
|
45
|
+
type?: undefined;
|
|
46
|
+
createdDate?: undefined;
|
|
47
|
+
links?: undefined;
|
|
48
|
+
icon?: undefined;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
})[];
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export declare const TeamContainersQuery: string;
|
|
2
|
+
export type TeamContainersQueryVariables = {
|
|
3
|
+
cypherQuery: string;
|
|
4
|
+
};
|
|
5
|
+
export type TeamContainersQueryResponse = {
|
|
6
|
+
cypherQuery: {
|
|
7
|
+
edges: Array<{
|
|
8
|
+
node: {
|
|
9
|
+
from: {
|
|
10
|
+
id: string;
|
|
11
|
+
};
|
|
12
|
+
to: {
|
|
13
|
+
id: string;
|
|
14
|
+
data: JiraProject | ConfluenceSpace;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
}>;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
type JiraProject = {
|
|
21
|
+
__typename: 'JiraProject';
|
|
22
|
+
id: string;
|
|
23
|
+
jiraProjectName: string;
|
|
24
|
+
webUrl: string;
|
|
25
|
+
created: string;
|
|
26
|
+
avatar: {
|
|
27
|
+
medium: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
type ConfluenceSpace = {
|
|
31
|
+
__typename: 'ConfluenceSpace';
|
|
32
|
+
id: string;
|
|
33
|
+
confluenceSpaceName?: string;
|
|
34
|
+
type: string;
|
|
35
|
+
createdDate: string;
|
|
36
|
+
links: {
|
|
37
|
+
base: string;
|
|
38
|
+
webUi: string;
|
|
39
|
+
};
|
|
40
|
+
icon: {
|
|
41
|
+
path: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type ClientContext, type ClientContextProps } from '../types';
|
|
2
|
+
type NestedContext = {
|
|
3
|
+
[key: string]: string | number | boolean | NestedContext;
|
|
4
|
+
};
|
|
5
|
+
export type LogExceptionFN = (ex: unknown | Error, name: string, context?: NestedContext & {
|
|
6
|
+
tags?: Record<string, string>;
|
|
7
|
+
}) => void;
|
|
8
|
+
export type ClientConfig = {
|
|
9
|
+
logException: LogExceptionFN;
|
|
10
|
+
};
|
|
11
|
+
export declare class BaseClient {
|
|
12
|
+
private config;
|
|
13
|
+
private context;
|
|
14
|
+
private cache;
|
|
15
|
+
constructor(config: ClientConfig);
|
|
16
|
+
setContext(context: ClientContextProps): void;
|
|
17
|
+
getContext(): ClientContext;
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param localValue is used for backwards compatibility
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
getOrgId(localValue?: string): string;
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @param localValue is used for backwards compatibility
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
getCloudId(localValue?: string): string | null | undefined;
|
|
30
|
+
logException: (ex: unknown | Error, name: string, context?: NestedContext & {
|
|
31
|
+
tags?: Record<string, string>;
|
|
32
|
+
}) => void;
|
|
33
|
+
private keyWithContext;
|
|
34
|
+
cacheValue<T>(key: string, value: T, expiryMs?: number): void;
|
|
35
|
+
getCachedValue<T>(key: string): T | undefined;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BaseGraphQlClient } from './main';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseClient, type ClientConfig } from '../base-client';
|
|
2
|
+
import { type Body, type Options, type ResultResponse } from './types';
|
|
3
|
+
export declare class BaseGraphQlClient extends BaseClient {
|
|
4
|
+
private serviceUrl;
|
|
5
|
+
constructor(serviceUrl: string, config: ClientConfig);
|
|
6
|
+
setServiceUrl(serviceUrl: string): void;
|
|
7
|
+
makeGraphQLRequest<Key extends string, Data = unknown, Variables = unknown>(body: Body<Variables>, options?: Options): Promise<ResultResponse<Key, Data>>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ErrorData } from '../../common/utils/error';
|
|
2
|
+
export interface Options {
|
|
3
|
+
operationName?: string;
|
|
4
|
+
errorPolicy?: 'none' | 'all' | 'ignore';
|
|
5
|
+
}
|
|
6
|
+
export type InnerResponse<T> = {
|
|
7
|
+
data: T;
|
|
8
|
+
errors?: ErrorData[];
|
|
9
|
+
};
|
|
10
|
+
export type ResultResponse<Key extends string, Data> = {
|
|
11
|
+
[name in Key]: Data;
|
|
12
|
+
};
|
|
13
|
+
export type Body<Variables> = {
|
|
14
|
+
query: string;
|
|
15
|
+
variables?: Variables;
|
|
16
|
+
};
|
|
17
|
+
export type GraphQLRequestDataResponse<Data> = Data | {
|
|
18
|
+
response: Response;
|
|
19
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type Body, type GraphQLRequestDataResponse, type Options, type ResultResponse } from '../types';
|
|
2
|
+
export declare function makeGraphQLRequestWithoutRetries<Data, Variables>(serviceUrl: string, body: Body<Variables>, options?: Options): Promise<GraphQLRequestDataResponse<Data>>;
|
|
3
|
+
export declare function handleGraphQLRequest<Key extends string, Data = unknown, Variables = unknown>(serviceUrl: string, body: Body<Variables>, options?: Options): Promise<ResultResponse<Key, Data>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { teamsClient, TeamsClient } from './main';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ClientContextProps, type TeamContainers } from './types';
|
|
2
|
+
export declare class TeamsClient {
|
|
3
|
+
private readonly _aggClient;
|
|
4
|
+
constructor(
|
|
5
|
+
/**
|
|
6
|
+
* @param {ClientContextProps} context - Context including CloudId & OrgId to be used for all requests
|
|
7
|
+
*/
|
|
8
|
+
context?: ClientContextProps);
|
|
9
|
+
/**
|
|
10
|
+
* Sets the base URL to be used in the client requests
|
|
11
|
+
* @param {string} baseUrl - The new base URL
|
|
12
|
+
*/
|
|
13
|
+
setBaseUrl(baseUrl: string): void;
|
|
14
|
+
/**
|
|
15
|
+
* Sets context including CloudId & OrgId to be used for all requests
|
|
16
|
+
*/
|
|
17
|
+
setContext(context: ClientContextProps): void;
|
|
18
|
+
/**
|
|
19
|
+
* Get the containers for a given team
|
|
20
|
+
* @param {string} teamId
|
|
21
|
+
* @returns {Promise<TeamContainers>}
|
|
22
|
+
*/
|
|
23
|
+
getTeamContainers(teamId: string): Promise<TeamContainers>;
|
|
24
|
+
}
|
|
25
|
+
export declare const teamsClient: TeamsClient;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ContainerTypes } from '../common/types';
|
|
2
|
+
export type ClientContext = {
|
|
3
|
+
cloudId?: string | null;
|
|
4
|
+
orgId?: string;
|
|
5
|
+
userId?: string;
|
|
6
|
+
};
|
|
7
|
+
export type ClientContextProps = {
|
|
8
|
+
cloudId?: string | null;
|
|
9
|
+
orgId?: string;
|
|
10
|
+
userId?: string;
|
|
11
|
+
};
|
|
12
|
+
export type TeamContainers = Array<{
|
|
13
|
+
id: string;
|
|
14
|
+
type: ContainerTypes;
|
|
15
|
+
name: string;
|
|
16
|
+
icon: string;
|
|
17
|
+
createdDate: Date;
|
|
18
|
+
link: string;
|
|
19
|
+
}>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { type ContainerTypes } from '../../../common/types';
|
|
3
3
|
interface AddContainerCardProps {
|
|
4
4
|
containerType: ContainerTypes;
|
|
5
|
+
onAddAContainerClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
5
6
|
}
|
|
6
|
-
export declare const AddContainerCard: ({ containerType }: AddContainerCardProps) => JSX.Element;
|
|
7
|
+
export declare const AddContainerCard: ({ containerType, onAddAContainerClick, }: AddContainerCardProps) => React.JSX.Element;
|
|
7
8
|
export {};
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
/// <reference types="react" />
|
|
1
|
+
import React from 'react';
|
|
6
2
|
import { type ContainerTypes } from '../../../common/types';
|
|
7
3
|
interface LinkedContainerCardProps {
|
|
8
4
|
containerType: ContainerTypes;
|
|
9
5
|
title: string;
|
|
10
6
|
containerIcon: string;
|
|
7
|
+
link: string;
|
|
11
8
|
}
|
|
12
|
-
export declare const LinkedContainerCard: ({ containerType, title, containerIcon, }: LinkedContainerCardProps) => JSX.Element;
|
|
9
|
+
export declare const LinkedContainerCard: ({ containerType, title, containerIcon, link, }: LinkedContainerCardProps) => React.JSX.Element;
|
|
13
10
|
export {};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { type TeamContainerProps } from './types';
|
|
2
3
|
export declare const ICON_BACKGROUND: "var(--ds-icon-inverse)";
|
|
3
4
|
export declare const ICON_COLOR: "var(--ds-icon-subtle)";
|
|
4
|
-
export declare const
|
|
5
|
+
export declare const MAX_NUMBER_OF_CONTAINERS_TO_SHOW = 4;
|
|
6
|
+
export declare const TeamContainers: ({ teamId, onAddAContainerClick }: TeamContainerProps) => React.JSX.Element;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
export interface TeamContainerProps {
|
|
2
3
|
/**
|
|
3
4
|
* The team id to fetch the team container for
|
|
4
5
|
*/
|
|
5
6
|
teamId: string;
|
|
7
|
+
/**
|
|
8
|
+
* The function to call when the add a container button is clicked
|
|
9
|
+
*/
|
|
10
|
+
onAddAContainerClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
6
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type ContainerTypes = '
|
|
1
|
+
export type ContainerTypes = 'ConfluenceSpace' | 'JiraProject';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export declare enum StatusCode {
|
|
2
|
+
UNAUTHORIZED = 401,
|
|
3
|
+
FORBIDDEN = 403,
|
|
4
|
+
TIMEOUT = 408,
|
|
5
|
+
GONE = 410,
|
|
6
|
+
PAYLOAD_TOO_LARGE = 413
|
|
7
|
+
}
|
|
8
|
+
declare class CommonError extends Error {
|
|
9
|
+
message: string;
|
|
10
|
+
name: string;
|
|
11
|
+
stack: string;
|
|
12
|
+
constructor(message?: string);
|
|
13
|
+
}
|
|
14
|
+
export declare class DefaultError extends CommonError {
|
|
15
|
+
constructor({ message }: {
|
|
16
|
+
message?: string;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* These errors will not fail UFO experiences
|
|
21
|
+
*/
|
|
22
|
+
export declare class SLOIgnoreError extends CommonError {
|
|
23
|
+
constructor({ message }: {
|
|
24
|
+
message?: string;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
interface HttpErrorArguments {
|
|
28
|
+
message: string;
|
|
29
|
+
status: number;
|
|
30
|
+
traceId?: string;
|
|
31
|
+
path?: string;
|
|
32
|
+
}
|
|
33
|
+
export declare class HttpError extends CommonError {
|
|
34
|
+
status: number;
|
|
35
|
+
traceId?: string;
|
|
36
|
+
path?: string;
|
|
37
|
+
constructor({ message, status, traceId, path }: HttpErrorArguments);
|
|
38
|
+
}
|
|
39
|
+
interface ResultErrorData {
|
|
40
|
+
category: string;
|
|
41
|
+
message: string;
|
|
42
|
+
fields?: object;
|
|
43
|
+
}
|
|
44
|
+
interface FieldError {
|
|
45
|
+
message: string;
|
|
46
|
+
field: string;
|
|
47
|
+
}
|
|
48
|
+
export interface ErrorData {
|
|
49
|
+
category: string;
|
|
50
|
+
message: string;
|
|
51
|
+
fields?: FieldError[];
|
|
52
|
+
}
|
|
53
|
+
export declare class GraphQLError extends CommonError {
|
|
54
|
+
fields?: any;
|
|
55
|
+
category?: string;
|
|
56
|
+
constructor({ message, category, fields }: Partial<ResultErrorData>);
|
|
57
|
+
static from: (rawErrors: ErrorData[]) => GraphQLError;
|
|
58
|
+
}
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare const EXPONENTIAL_BACKOFF_RETRY_POLICY: {
|
|
2
|
+
INITIAL_DELAY: number;
|
|
3
|
+
MAX_RETRIES: number;
|
|
4
|
+
JITTER: boolean;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Checks whether a status code is a 5xx HTTP code.
|
|
8
|
+
* @param {number} status HTTP status code
|
|
9
|
+
*/
|
|
10
|
+
export declare function is5xx(status: number): boolean;
|
|
11
|
+
export declare function isFetchResponse(data: unknown): data is {
|
|
12
|
+
response: Response;
|
|
13
|
+
};
|
|
14
|
+
type ToTryFunctionArgs = any[];
|
|
15
|
+
type ToTryFunction<T> = (...args: ToTryFunctionArgs) => Promise<T>;
|
|
16
|
+
type RetryIfCallback<T> = (a: T) => boolean;
|
|
17
|
+
interface WithExponentialBackoffOptions<T> {
|
|
18
|
+
initial: number;
|
|
19
|
+
jitter?: boolean;
|
|
20
|
+
max: number;
|
|
21
|
+
retryIf?: RetryIfCallback<T>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Transparently wrap a function so that it is retried until it succeeds or reaches a max retry limit.
|
|
25
|
+
* The returned function has the same signature as the wrapped function.
|
|
26
|
+
*
|
|
27
|
+
* Modified from https://jsfiddle.net/pajtai/pLka0ow9/
|
|
28
|
+
*/
|
|
29
|
+
export declare function withExponentialBackoff<ResponseType>(toTry: ToTryFunction<ResponseType>, hofOptions?: WithExponentialBackoffOptions<ResponseType>): (...args: ToTryFunctionArgs) => Promise<ResponseType>;
|
|
30
|
+
export declare const fetchWithExponentialBackoff: (...args: ToTryFunctionArgs) => Promise<Response>;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Our REST clients are initialised when their module loads which makes it tricky for them to consume the `statusCodeHandlers` prop passed to App from the host application.
|
|
3
|
+
* This is a temporary measure to enable the clients to consume `statusCodeHandlers`.
|
|
4
|
+
* The long term solution is to replace our REST clients with Apollo client custom resolvers
|
|
5
|
+
* This will unify all remote data handling under the apollo-client module which is able to easily receive `statusCodeHandlers` as it is initialised within the React portion of our app.
|
|
6
|
+
*/
|
|
7
|
+
type StatusCodeHandler = (response: Response) => void;
|
|
8
|
+
export interface StatusCodeHandlerMap {
|
|
9
|
+
[statusCode: number]: StatusCodeHandler;
|
|
10
|
+
}
|
|
11
|
+
export declare const statusCodeHandlersProvider: {
|
|
12
|
+
handlers: StatusCodeHandlerMap;
|
|
13
|
+
get(): StatusCodeHandlerMap;
|
|
14
|
+
setHandlers(handlers: StatusCodeHandlerMap): void;
|
|
15
|
+
};
|
|
16
|
+
export declare function handleResponse(response: Response): void;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Action } from 'react-sweet-state';
|
|
2
|
+
import { type TeamContainers } from '../../../services/types';
|
|
3
|
+
type State = {
|
|
4
|
+
teamContainers: TeamContainers;
|
|
5
|
+
loading: boolean;
|
|
6
|
+
error: Error | null;
|
|
7
|
+
};
|
|
8
|
+
export declare const useTeamContainersHook: import("react-sweet-state").HookFunction<State, import("react-sweet-state").BoundActions<State, {
|
|
9
|
+
fetchTeamContainers: (teamId: string) => Action<State>;
|
|
10
|
+
}>, void>;
|
|
11
|
+
export declare const useTeamContainers: (teamId: string) => State;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useTeamContainers } from './hooks/use-team-containers';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ClientConfig } from '../base-client';
|
|
2
|
+
import { BaseGraphQlClient } from '../graphql-client';
|
|
3
|
+
export declare class AGGClient extends BaseGraphQlClient {
|
|
4
|
+
constructor(baseUrl: string, config: ClientConfig);
|
|
5
|
+
setBaseUrl(baseUrl: string): void;
|
|
6
|
+
getTeamContainers(teamId: string): Promise<{
|
|
7
|
+
id: string;
|
|
8
|
+
type: "ConfluenceSpace" | "JiraProject";
|
|
9
|
+
name: string;
|
|
10
|
+
icon: string;
|
|
11
|
+
createdDate: Date;
|
|
12
|
+
link: string;
|
|
13
|
+
}[]>;
|
|
14
|
+
}
|
|
15
|
+
export declare const aggClient: AGGClient;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export declare const MOCK_TEAM_CONTAINERS: {
|
|
2
|
+
graphStore: {
|
|
3
|
+
cypherQuery: {
|
|
4
|
+
edges: ({
|
|
5
|
+
node: {
|
|
6
|
+
from: {
|
|
7
|
+
id: string;
|
|
8
|
+
};
|
|
9
|
+
to: {
|
|
10
|
+
id: string;
|
|
11
|
+
data: {
|
|
12
|
+
__typename: string;
|
|
13
|
+
confluenceSpaceName: string;
|
|
14
|
+
type: string;
|
|
15
|
+
createdDate: string;
|
|
16
|
+
links: {
|
|
17
|
+
webUi: string;
|
|
18
|
+
};
|
|
19
|
+
icon: {
|
|
20
|
+
path: string;
|
|
21
|
+
};
|
|
22
|
+
jiraProjectName?: undefined;
|
|
23
|
+
webUrl?: undefined;
|
|
24
|
+
created?: undefined;
|
|
25
|
+
avatar?: undefined;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
} | {
|
|
30
|
+
node: {
|
|
31
|
+
from: {
|
|
32
|
+
id: string;
|
|
33
|
+
};
|
|
34
|
+
to: {
|
|
35
|
+
id: string;
|
|
36
|
+
data: {
|
|
37
|
+
__typename: string;
|
|
38
|
+
jiraProjectName: string;
|
|
39
|
+
webUrl: string;
|
|
40
|
+
created: string;
|
|
41
|
+
avatar: {
|
|
42
|
+
medium: string;
|
|
43
|
+
};
|
|
44
|
+
confluenceSpaceName?: undefined;
|
|
45
|
+
type?: undefined;
|
|
46
|
+
createdDate?: undefined;
|
|
47
|
+
links?: undefined;
|
|
48
|
+
icon?: undefined;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
})[];
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export declare const TeamContainersQuery: string;
|
|
2
|
+
export type TeamContainersQueryVariables = {
|
|
3
|
+
cypherQuery: string;
|
|
4
|
+
};
|
|
5
|
+
export type TeamContainersQueryResponse = {
|
|
6
|
+
cypherQuery: {
|
|
7
|
+
edges: Array<{
|
|
8
|
+
node: {
|
|
9
|
+
from: {
|
|
10
|
+
id: string;
|
|
11
|
+
};
|
|
12
|
+
to: {
|
|
13
|
+
id: string;
|
|
14
|
+
data: JiraProject | ConfluenceSpace;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
}>;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
type JiraProject = {
|
|
21
|
+
__typename: 'JiraProject';
|
|
22
|
+
id: string;
|
|
23
|
+
jiraProjectName: string;
|
|
24
|
+
webUrl: string;
|
|
25
|
+
created: string;
|
|
26
|
+
avatar: {
|
|
27
|
+
medium: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
type ConfluenceSpace = {
|
|
31
|
+
__typename: 'ConfluenceSpace';
|
|
32
|
+
id: string;
|
|
33
|
+
confluenceSpaceName?: string;
|
|
34
|
+
type: string;
|
|
35
|
+
createdDate: string;
|
|
36
|
+
links: {
|
|
37
|
+
base: string;
|
|
38
|
+
webUi: string;
|
|
39
|
+
};
|
|
40
|
+
icon: {
|
|
41
|
+
path: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export {};
|