@harnessio/react-ti-service-client 0.1.0 → 0.3.0

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 (37) hide show
  1. package/dist/custom-fetcher/index.d.ts +22 -0
  2. package/dist/custom-fetcher/index.js +63 -0
  3. package/dist/ti-service/src/services/hooks/useGetExecutionCoverageReportQuery.d.ts +10 -6
  4. package/dist/ti-service/src/services/hooks/useGetExecutionCoverageReportQuery.js +1 -1
  5. package/dist/ti-service/src/services/hooks/useGetTokenQuery.d.ts +22 -0
  6. package/dist/ti-service/src/services/hooks/useGetTokenQuery.js +14 -0
  7. package/dist/ti-service/src/services/hooks/useReportSummaryQuery.d.ts +30 -0
  8. package/dist/ti-service/src/services/hooks/useReportSummaryQuery.js +14 -0
  9. package/dist/ti-service/src/services/hooks/useReportsInfoQuery.d.ts +27 -0
  10. package/dist/ti-service/src/services/hooks/useReportsInfoQuery.js +14 -0
  11. package/dist/ti-service/src/services/hooks/useSearchCoverageFilesQuery.d.ts +9 -5
  12. package/dist/ti-service/src/services/hooks/useSearchCoverageFilesQuery.js +2 -2
  13. package/dist/ti-service/src/services/hooks/useTestInfoQuery.d.ts +27 -0
  14. package/dist/ti-service/src/services/hooks/useTestInfoQuery.js +14 -0
  15. package/dist/ti-service/src/services/hooks/useTestOverviewQuery.d.ts +29 -0
  16. package/dist/ti-service/src/services/hooks/useTestOverviewQuery.js +14 -0
  17. package/dist/ti-service/src/services/index.d.ts +18 -3
  18. package/dist/ti-service/src/services/index.js +5 -0
  19. package/dist/ti-service/src/services/responses/NotFoundResponse.d.ts +2 -0
  20. package/dist/ti-service/src/services/schemas/{FileSummary.d.ts → ItemSummary.d.ts} +1 -1
  21. package/dist/ti-service/src/services/schemas/PipelineExecutionReport.d.ts +4 -0
  22. package/dist/ti-service/src/services/schemas/ReportOutput.d.ts +8 -0
  23. package/dist/ti-service/src/services/schemas/ReportOutput.js +1 -0
  24. package/dist/ti-service/src/services/schemas/SelectionDetails.d.ts +5 -0
  25. package/dist/ti-service/src/services/schemas/SelectionDetails.js +4 -0
  26. package/dist/ti-service/src/services/schemas/SelectionOverview.d.ts +7 -0
  27. package/dist/ti-service/src/services/schemas/SelectionOverview.js +1 -0
  28. package/dist/ti-service/src/services/schemas/StepInfo.d.ts +4 -0
  29. package/dist/ti-service/src/services/schemas/StepInfo.js +4 -0
  30. package/dist/ti-service/src/services/schemas/TestReportSummary.d.ts +30 -0
  31. package/dist/ti-service/src/services/schemas/TestReportSummary.js +4 -0
  32. package/package.json +1 -1
  33. package/dist/ti-service/src/services/helpers.d.ts +0 -14
  34. package/dist/ti-service/src/services/schemas/ReportPipelineExecutionOutput.d.ts +0 -11
  35. /package/dist/ti-service/src/services/{helpers.js → responses/NotFoundResponse.js} +0 -0
  36. /package/dist/ti-service/src/services/schemas/{FileSummary.js → ItemSummary.js} +0 -0
  37. /package/dist/ti-service/src/services/schemas/{ReportPipelineExecutionOutput.js → PipelineExecutionReport.js} +0 -0
@@ -0,0 +1,22 @@
1
+ import type { IStringifyOptions } from 'qs';
2
+ export interface FetcherOptions<TQueryParams = never, TBody = never, THeaderParams = HeadersInit> extends Omit<RequestInit, 'body' | 'headers'> {
3
+ url: string;
4
+ queryParams?: TQueryParams extends never ? undefined : TQueryParams;
5
+ body?: TBody extends never ? undefined : TBody;
6
+ stringifyQueryParamsOptions?: IStringifyOptions;
7
+ headers?: THeaderParams;
8
+ }
9
+ export interface ClientCallbacks {
10
+ responseInterceptor?: (response: Response) => Response;
11
+ requestInterceptor?: (request: Request) => Request;
12
+ urlInterceptor?: (url: string) => string;
13
+ getRequestHeaders?: () => Record<string, any>;
14
+ }
15
+ export declare function setupClient(callbacks: ClientCallbacks): void;
16
+ export declare const updateClientHeaders: (headers: Record<string, any>) => void;
17
+ interface ResponseContainer<T> {
18
+ body: T;
19
+ headers: Headers;
20
+ }
21
+ export declare function fetcher<TResponse = unknown, TQueryParams = never, TBody = never, THeaderParams = HeadersInit>(options: FetcherOptions<TQueryParams, TBody, THeaderParams>): Promise<ResponseContainer<TResponse>>;
22
+ export {};
@@ -0,0 +1,63 @@
1
+ import { __awaiter, __rest } from "tslib";
2
+ import { stringify } from 'qs';
3
+ const JSON_CONTENT_TYPES = ['application/json'];
4
+ let APIClientInitialized = false;
5
+ let fetcherCallbacks;
6
+ let customHeaders = {
7
+ 'Content-Type': JSON_CONTENT_TYPES[0],
8
+ };
9
+ export function setupClient(callbacks) {
10
+ fetcherCallbacks = callbacks;
11
+ customHeaders = Object.assign(Object.assign({}, customHeaders), ((fetcherCallbacks === null || fetcherCallbacks === void 0 ? void 0 : fetcherCallbacks.getRequestHeaders) ? fetcherCallbacks === null || fetcherCallbacks === void 0 ? void 0 : fetcherCallbacks.getRequestHeaders() : {}));
12
+ APIClientInitialized = true;
13
+ }
14
+ export const updateClientHeaders = (headers) => {
15
+ customHeaders = Object.assign(Object.assign({}, customHeaders), headers);
16
+ };
17
+ export function fetcher(options) {
18
+ var _a;
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ // If not initialized throw error even without making request
21
+ if (!APIClientInitialized) {
22
+ throw { reason: 'HarnessReactAPIClient has not been initialized' };
23
+ }
24
+ const { stringifyQueryParamsOptions, headers, body, url, queryParams = {} } = options, rest = __rest(options, ["stringifyQueryParamsOptions", "headers", "body", "url", "queryParams"]);
25
+ let finalUrl = url;
26
+ if (queryParams) {
27
+ finalUrl += stringify(queryParams, Object.assign(Object.assign({}, stringifyQueryParamsOptions), { addQueryPrefix: true }));
28
+ }
29
+ if (fetcherCallbacks === null || fetcherCallbacks === void 0 ? void 0 : fetcherCallbacks.urlInterceptor) {
30
+ finalUrl = fetcherCallbacks.urlInterceptor(finalUrl);
31
+ }
32
+ let requestBody;
33
+ let finalHeaders = Object.assign(Object.assign({}, headers), customHeaders);
34
+ if (body instanceof FormData) {
35
+ requestBody = body;
36
+ // remove Content-Type so browser sets correct multipart boundary
37
+ const _b = finalHeaders, { ['Content-Type']: _ } = _b, restHeaders = __rest(_b, ['Content-Type']);
38
+ finalHeaders = restHeaders;
39
+ }
40
+ else if (body !== undefined) {
41
+ requestBody = JSON.stringify(body);
42
+ finalHeaders = Object.assign(Object.assign({}, finalHeaders), { 'Content-Type': 'application/json' });
43
+ }
44
+ let request = new Request(finalUrl, Object.assign({ headers: finalHeaders, body: requestBody }, rest));
45
+ if (fetcherCallbacks === null || fetcherCallbacks === void 0 ? void 0 : fetcherCallbacks.requestInterceptor) {
46
+ request = fetcherCallbacks.requestInterceptor(request.clone());
47
+ }
48
+ let response = yield fetch(request);
49
+ if (fetcherCallbacks === null || fetcherCallbacks === void 0 ? void 0 : fetcherCallbacks.responseInterceptor) {
50
+ response = fetcherCallbacks.responseInterceptor(response.clone());
51
+ }
52
+ const contentType = (_a = response === null || response === void 0 ? void 0 : response.headers) === null || _a === void 0 ? void 0 : _a.get('Content-Type');
53
+ const asJson = contentType && JSON_CONTENT_TYPES.some((h) => contentType.startsWith(h));
54
+ const data = yield (asJson ? response.json() : response.text());
55
+ if (response.ok) {
56
+ return {
57
+ body: data,
58
+ headers: response.headers,
59
+ };
60
+ }
61
+ throw data;
62
+ });
63
+ }
@@ -1,11 +1,10 @@
1
1
  import { UseQueryOptions } from '@tanstack/react-query';
2
- import type { ReportPipelineExecutionOutput } from '../schemas/ReportPipelineExecutionOutput';
2
+ import type { PipelineExecutionReport } from '../schemas/PipelineExecutionReport';
3
3
  import type { BadRequestResponse } from '../responses/BadRequestResponse';
4
4
  import type { UnauthenticatedResponse } from '../responses/UnauthenticatedResponse';
5
5
  import type { UnauthorizedResponse } from '../responses/UnauthorizedResponse';
6
6
  import type { InternalErrorResponse } from '../responses/InternalErrorResponse';
7
- import type { ResponseWithPagination } from '../helpers';
8
- import { FetcherOptions } from '../../../../fetcher/index.js';
7
+ import { FetcherOptions } from '../../../../custom-fetcher/index.js';
9
8
  export interface GetExecutionCoverageReportQueryPathParams {
10
9
  account_identifier: string;
11
10
  execution_id: string;
@@ -16,14 +15,19 @@ export interface GetExecutionCoverageReportQueryQueryParams {
16
15
  }
17
16
  export interface GetExecutionCoverageReportQueryHeaderParams {
18
17
  'harness-account'?: string;
18
+ 'X-Harness-Token': string;
19
19
  }
20
- export type GetExecutionCoverageReportOkResponse = ResponseWithPagination<ReportPipelineExecutionOutput>;
20
+ export type GetExecutionCoverageReportOkResponse = PipelineExecutionReport;
21
21
  export type GetExecutionCoverageReportErrorResponse = BadRequestResponse | UnauthenticatedResponse | UnauthorizedResponse | InternalErrorResponse;
22
22
  export interface GetExecutionCoverageReportProps extends GetExecutionCoverageReportQueryPathParams, Omit<FetcherOptions<GetExecutionCoverageReportQueryQueryParams, unknown, GetExecutionCoverageReportQueryHeaderParams>, 'url'> {
23
23
  queryParams: GetExecutionCoverageReportQueryQueryParams;
24
24
  }
25
- export declare function getExecutionCoverageReport(props: GetExecutionCoverageReportProps): Promise<GetExecutionCoverageReportOkResponse>;
25
+ export interface GetExecutionCoverageReportResponseContainer {
26
+ body: GetExecutionCoverageReportOkResponse;
27
+ headers: Headers;
28
+ }
29
+ export declare function getExecutionCoverageReport(props: GetExecutionCoverageReportProps): Promise<GetExecutionCoverageReportResponseContainer>;
26
30
  /**
27
31
  * Retrieve pipeline execution coverage data for a specific file path or directory tree
28
32
  */
29
- export declare function useGetExecutionCoverageReportQuery(props: GetExecutionCoverageReportProps, options?: Omit<UseQueryOptions<GetExecutionCoverageReportOkResponse, GetExecutionCoverageReportErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<GetExecutionCoverageReportOkResponse, import("..").Error>;
33
+ export declare function useGetExecutionCoverageReportQuery(props: GetExecutionCoverageReportProps, options?: Omit<UseQueryOptions<GetExecutionCoverageReportResponseContainer, GetExecutionCoverageReportErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<GetExecutionCoverageReportResponseContainer, import("..").Error>;
@@ -2,7 +2,7 @@
2
2
  // This code is autogenerated using @harnessio/oats-cli.
3
3
  // Please do not modify this code directly.
4
4
  import { useQuery } from '@tanstack/react-query';
5
- import { fetcher } from '../../../../fetcher/index.js';
5
+ import { fetcher } from '../../../../custom-fetcher/index.js';
6
6
  export function getExecutionCoverageReport(props) {
7
7
  return fetcher(Object.assign({ url: `/coverage/api/v1/accounts/${props.account_identifier}/executions/${props.execution_id}/tree/${props.tree_path}`, method: 'GET' }, props));
8
8
  }
@@ -0,0 +1,22 @@
1
+ import { UseQueryOptions } from '@tanstack/react-query';
2
+ import type { BadRequestResponse } from '../responses/BadRequestResponse';
3
+ import type { NotFoundResponse } from '../responses/NotFoundResponse';
4
+ import type { InternalErrorResponse } from '../responses/InternalErrorResponse';
5
+ import { FetcherOptions } from '../../../../custom-fetcher/index.js';
6
+ export interface GetTokenQueryQueryParams {
7
+ accountId: string;
8
+ }
9
+ export type GetTokenOkResponse = string;
10
+ export type GetTokenErrorResponse = BadRequestResponse | NotFoundResponse | InternalErrorResponse;
11
+ export interface GetTokenProps extends Omit<FetcherOptions<GetTokenQueryQueryParams, unknown>, 'url'> {
12
+ queryParams: GetTokenQueryQueryParams;
13
+ }
14
+ export interface GetTokenResponseContainer {
15
+ body: GetTokenOkResponse;
16
+ headers: Headers;
17
+ }
18
+ export declare function getToken(props: GetTokenProps): Promise<GetTokenResponseContainer>;
19
+ /**
20
+ * Get an account level token
21
+ */
22
+ export declare function useGetTokenQuery(props: GetTokenProps, options?: Omit<UseQueryOptions<GetTokenResponseContainer, GetTokenErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<GetTokenResponseContainer, import("..").Error>;
@@ -0,0 +1,14 @@
1
+ /* eslint-disable */
2
+ // This code is autogenerated using @harnessio/oats-cli.
3
+ // Please do not modify this code directly.
4
+ import { useQuery } from '@tanstack/react-query';
5
+ import { fetcher } from '../../../../custom-fetcher/index.js';
6
+ export function getToken(props) {
7
+ return fetcher(Object.assign({ url: `/token`, method: 'GET' }, props));
8
+ }
9
+ /**
10
+ * Get an account level token
11
+ */
12
+ export function useGetTokenQuery(props, options) {
13
+ return useQuery(['getToken', props.queryParams], ({ signal }) => getToken(Object.assign(Object.assign({}, props), { signal })), options);
14
+ }
@@ -0,0 +1,30 @@
1
+ import { UseQueryOptions } from '@tanstack/react-query';
2
+ import type { TestReportSummary } from '../schemas/TestReportSummary';
3
+ import type { BadRequestResponse } from '../responses/BadRequestResponse';
4
+ import type { NotFoundResponse } from '../responses/NotFoundResponse';
5
+ import type { InternalErrorResponse } from '../responses/InternalErrorResponse';
6
+ import { FetcherOptions } from '../../../../custom-fetcher/index.js';
7
+ export interface ReportSummaryQueryQueryParams {
8
+ accountId: string;
9
+ orgId: string;
10
+ projectId: string;
11
+ pipelineId: string;
12
+ buildId: string;
13
+ report: 'junit';
14
+ stepId?: string;
15
+ stageId?: string;
16
+ }
17
+ export type ReportSummaryOkResponse = TestReportSummary;
18
+ export type ReportSummaryErrorResponse = BadRequestResponse | NotFoundResponse | InternalErrorResponse;
19
+ export interface ReportSummaryProps extends Omit<FetcherOptions<ReportSummaryQueryQueryParams, unknown>, 'url'> {
20
+ queryParams: ReportSummaryQueryQueryParams;
21
+ }
22
+ export interface ReportSummaryResponseContainer {
23
+ body: ReportSummaryOkResponse;
24
+ headers: Headers;
25
+ }
26
+ export declare function reportSummary(props: ReportSummaryProps): Promise<ReportSummaryResponseContainer>;
27
+ /**
28
+ * Get summary of test reports
29
+ */
30
+ export declare function useReportSummaryQuery(props: ReportSummaryProps, options?: Omit<UseQueryOptions<ReportSummaryResponseContainer, ReportSummaryErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<ReportSummaryResponseContainer, import("..").Error>;
@@ -0,0 +1,14 @@
1
+ /* eslint-disable */
2
+ // This code is autogenerated using @harnessio/oats-cli.
3
+ // Please do not modify this code directly.
4
+ import { useQuery } from '@tanstack/react-query';
5
+ import { fetcher } from '../../../../custom-fetcher/index.js';
6
+ export function reportSummary(props) {
7
+ return fetcher(Object.assign({ url: `/reports/summary`, method: 'GET' }, props));
8
+ }
9
+ /**
10
+ * Get summary of test reports
11
+ */
12
+ export function useReportSummaryQuery(props, options) {
13
+ return useQuery(['reportSummary', props.queryParams], ({ signal }) => reportSummary(Object.assign(Object.assign({}, props), { signal })), options);
14
+ }
@@ -0,0 +1,27 @@
1
+ import { UseQueryOptions } from '@tanstack/react-query';
2
+ import type { StepInfo } from '../schemas/StepInfo';
3
+ import type { BadRequestResponse } from '../responses/BadRequestResponse';
4
+ import type { NotFoundResponse } from '../responses/NotFoundResponse';
5
+ import type { InternalErrorResponse } from '../responses/InternalErrorResponse';
6
+ import { FetcherOptions } from '../../../../custom-fetcher/index.js';
7
+ export interface ReportsInfoQueryQueryParams {
8
+ accountId: string;
9
+ orgId: string;
10
+ projectId: string;
11
+ pipelineId: string;
12
+ buildId: string;
13
+ }
14
+ export type ReportsInfoOkResponse = StepInfo[];
15
+ export type ReportsInfoErrorResponse = BadRequestResponse | NotFoundResponse | InternalErrorResponse;
16
+ export interface ReportsInfoProps extends Omit<FetcherOptions<ReportsInfoQueryQueryParams, unknown>, 'url'> {
17
+ queryParams: ReportsInfoQueryQueryParams;
18
+ }
19
+ export interface ReportsInfoResponseContainer {
20
+ body: ReportsInfoOkResponse;
21
+ headers: Headers;
22
+ }
23
+ export declare function reportsInfo(props: ReportsInfoProps): Promise<ReportsInfoResponseContainer>;
24
+ /**
25
+ * Get information about test reports
26
+ */
27
+ export declare function useReportsInfoQuery(props: ReportsInfoProps, options?: Omit<UseQueryOptions<ReportsInfoResponseContainer, ReportsInfoErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<ReportsInfoResponseContainer, import("..").Error>;
@@ -0,0 +1,14 @@
1
+ /* eslint-disable */
2
+ // This code is autogenerated using @harnessio/oats-cli.
3
+ // Please do not modify this code directly.
4
+ import { useQuery } from '@tanstack/react-query';
5
+ import { fetcher } from '../../../../custom-fetcher/index.js';
6
+ export function reportsInfo(props) {
7
+ return fetcher(Object.assign({ url: `/reports/info`, method: 'GET' }, props));
8
+ }
9
+ /**
10
+ * Get information about test reports
11
+ */
12
+ export function useReportsInfoQuery(props, options) {
13
+ return useQuery(['reportsInfo', props.queryParams], ({ signal }) => reportsInfo(Object.assign(Object.assign({}, props), { signal })), options);
14
+ }
@@ -4,8 +4,7 @@ import type { BadRequestResponse } from '../responses/BadRequestResponse';
4
4
  import type { UnauthenticatedResponse } from '../responses/UnauthenticatedResponse';
5
5
  import type { UnauthorizedResponse } from '../responses/UnauthorizedResponse';
6
6
  import type { InternalErrorResponse } from '../responses/InternalErrorResponse';
7
- import type { ResponseWithPagination } from '../helpers';
8
- import { FetcherOptions } from '../../../../fetcher/index.js';
7
+ import { FetcherOptions } from '../../../../custom-fetcher/index.js';
9
8
  export interface SearchCoverageFilesQueryPathParams {
10
9
  account_identifier: string;
11
10
  execution_id: string;
@@ -15,14 +14,19 @@ export interface SearchCoverageFilesQueryQueryParams {
15
14
  }
16
15
  export interface SearchCoverageFilesQueryHeaderParams {
17
16
  'harness-account'?: string;
17
+ 'X-Harness-Token': string;
18
18
  }
19
- export type SearchCoverageFilesOkResponse = ResponseWithPagination<SearchResults>;
19
+ export type SearchCoverageFilesOkResponse = SearchResults;
20
20
  export type SearchCoverageFilesErrorResponse = BadRequestResponse | UnauthenticatedResponse | UnauthorizedResponse | InternalErrorResponse;
21
21
  export interface SearchCoverageFilesProps extends SearchCoverageFilesQueryPathParams, Omit<FetcherOptions<SearchCoverageFilesQueryQueryParams, unknown, SearchCoverageFilesQueryHeaderParams>, 'url'> {
22
22
  queryParams: SearchCoverageFilesQueryQueryParams;
23
23
  }
24
- export declare function searchCoverageFiles(props: SearchCoverageFilesProps): Promise<SearchCoverageFilesOkResponse>;
24
+ export interface SearchCoverageFilesResponseContainer {
25
+ body: SearchCoverageFilesOkResponse;
26
+ headers: Headers;
27
+ }
28
+ export declare function searchCoverageFiles(props: SearchCoverageFilesProps): Promise<SearchCoverageFilesResponseContainer>;
25
29
  /**
26
30
  * Search for files in a pipeline execution
27
31
  */
28
- export declare function useSearchCoverageFilesQuery(props: SearchCoverageFilesProps, options?: Omit<UseQueryOptions<SearchCoverageFilesOkResponse, SearchCoverageFilesErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<SearchCoverageFilesOkResponse, import("..").Error>;
32
+ export declare function useSearchCoverageFilesQuery(props: SearchCoverageFilesProps, options?: Omit<UseQueryOptions<SearchCoverageFilesResponseContainer, SearchCoverageFilesErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<SearchCoverageFilesResponseContainer, import("..").Error>;
@@ -2,9 +2,9 @@
2
2
  // This code is autogenerated using @harnessio/oats-cli.
3
3
  // Please do not modify this code directly.
4
4
  import { useQuery } from '@tanstack/react-query';
5
- import { fetcher } from '../../../../fetcher/index.js';
5
+ import { fetcher } from '../../../../custom-fetcher/index.js';
6
6
  export function searchCoverageFiles(props) {
7
- return fetcher(Object.assign({ url: `/coverage/api/v1/accounts/${props.account_identifier}/executions/${props.execution_id}/search`, method: 'GET' }, props));
7
+ return fetcher(Object.assign({ url: `/coverage/api/v1/accounts/${props.account_identifier}/executions/${props.execution_id}`, method: 'GET' }, props));
8
8
  }
9
9
  /**
10
10
  * Search for files in a pipeline execution
@@ -0,0 +1,27 @@
1
+ import { UseQueryOptions } from '@tanstack/react-query';
2
+ import type { StepInfo } from '../schemas/StepInfo';
3
+ import type { BadRequestResponse } from '../responses/BadRequestResponse';
4
+ import type { NotFoundResponse } from '../responses/NotFoundResponse';
5
+ import type { InternalErrorResponse } from '../responses/InternalErrorResponse';
6
+ import { FetcherOptions } from '../../../../custom-fetcher/index.js';
7
+ export interface TestInfoQueryQueryParams {
8
+ accountId: string;
9
+ orgId: string;
10
+ projectId: string;
11
+ pipelineId: string;
12
+ buildId: string;
13
+ }
14
+ export type TestInfoOkResponse = StepInfo[];
15
+ export type TestInfoErrorResponse = BadRequestResponse | NotFoundResponse | InternalErrorResponse;
16
+ export interface TestInfoProps extends Omit<FetcherOptions<TestInfoQueryQueryParams, unknown>, 'url'> {
17
+ queryParams: TestInfoQueryQueryParams;
18
+ }
19
+ export interface TestInfoResponseContainer {
20
+ body: TestInfoOkResponse;
21
+ headers: Headers;
22
+ }
23
+ export declare function testInfo(props: TestInfoProps): Promise<TestInfoResponseContainer>;
24
+ /**
25
+ * Get information about TI steps
26
+ */
27
+ export declare function useTestInfoQuery(props: TestInfoProps, options?: Omit<UseQueryOptions<TestInfoResponseContainer, TestInfoErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<TestInfoResponseContainer, import("..").Error>;
@@ -0,0 +1,14 @@
1
+ /* eslint-disable */
2
+ // This code is autogenerated using @harnessio/oats-cli.
3
+ // Please do not modify this code directly.
4
+ import { useQuery } from '@tanstack/react-query';
5
+ import { fetcher } from '../../../../custom-fetcher/index.js';
6
+ export function testInfo(props) {
7
+ return fetcher(Object.assign({ url: `/tests/info`, method: 'GET' }, props));
8
+ }
9
+ /**
10
+ * Get information about TI steps
11
+ */
12
+ export function useTestInfoQuery(props, options) {
13
+ return useQuery(['testInfo', props.queryParams], ({ signal }) => testInfo(Object.assign(Object.assign({}, props), { signal })), options);
14
+ }
@@ -0,0 +1,29 @@
1
+ import { UseQueryOptions } from '@tanstack/react-query';
2
+ import type { SelectionOverview } from '../schemas/SelectionOverview';
3
+ import type { BadRequestResponse } from '../responses/BadRequestResponse';
4
+ import type { NotFoundResponse } from '../responses/NotFoundResponse';
5
+ import type { InternalErrorResponse } from '../responses/InternalErrorResponse';
6
+ import { FetcherOptions } from '../../../../custom-fetcher/index.js';
7
+ export interface TestOverviewQueryQueryParams {
8
+ accountId: string;
9
+ orgId: string;
10
+ projectId: string;
11
+ pipelineId: string;
12
+ buildId: string;
13
+ stageId: string;
14
+ stepId: string;
15
+ }
16
+ export type TestOverviewOkResponse = SelectionOverview;
17
+ export type TestOverviewErrorResponse = BadRequestResponse | NotFoundResponse | InternalErrorResponse;
18
+ export interface TestOverviewProps extends Omit<FetcherOptions<TestOverviewQueryQueryParams, unknown>, 'url'> {
19
+ queryParams: TestOverviewQueryQueryParams;
20
+ }
21
+ export interface TestOverviewResponseContainer {
22
+ body: TestOverviewOkResponse;
23
+ headers: Headers;
24
+ }
25
+ export declare function testOverview(props: TestOverviewProps): Promise<TestOverviewResponseContainer>;
26
+ /**
27
+ * Get overview of selected tests.
28
+ */
29
+ export declare function useTestOverviewQuery(props: TestOverviewProps, options?: Omit<UseQueryOptions<TestOverviewResponseContainer, TestOverviewErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<TestOverviewResponseContainer, import("..").Error>;
@@ -0,0 +1,14 @@
1
+ /* eslint-disable */
2
+ // This code is autogenerated using @harnessio/oats-cli.
3
+ // Please do not modify this code directly.
4
+ import { useQuery } from '@tanstack/react-query';
5
+ import { fetcher } from '../../../../custom-fetcher/index.js';
6
+ export function testOverview(props) {
7
+ return fetcher(Object.assign({ url: `/tests/overview`, method: 'GET' }, props));
8
+ }
9
+ /**
10
+ * Get overview of selected tests.
11
+ */
12
+ export function useTestOverviewQuery(props, options) {
13
+ return useQuery(['testOverview', props.queryParams], ({ signal }) => testOverview(Object.assign(Object.assign({}, props), { signal })), options);
14
+ }
@@ -1,14 +1,29 @@
1
- export type { GetPathParamsType, ResponseWithPagination } from './helpers';
2
1
  export type { GetExecutionCoverageReportErrorResponse, GetExecutionCoverageReportOkResponse, GetExecutionCoverageReportProps, GetExecutionCoverageReportQueryPathParams, GetExecutionCoverageReportQueryQueryParams, } from './hooks/useGetExecutionCoverageReportQuery';
3
2
  export { getExecutionCoverageReport, useGetExecutionCoverageReportQuery, } from './hooks/useGetExecutionCoverageReportQuery';
3
+ export type { GetTokenErrorResponse, GetTokenOkResponse, GetTokenProps, GetTokenQueryQueryParams, } from './hooks/useGetTokenQuery';
4
+ export { getToken, useGetTokenQuery } from './hooks/useGetTokenQuery';
5
+ export type { ReportSummaryErrorResponse, ReportSummaryOkResponse, ReportSummaryProps, ReportSummaryQueryQueryParams, } from './hooks/useReportSummaryQuery';
6
+ export { reportSummary, useReportSummaryQuery } from './hooks/useReportSummaryQuery';
7
+ export type { ReportsInfoErrorResponse, ReportsInfoOkResponse, ReportsInfoProps, ReportsInfoQueryQueryParams, } from './hooks/useReportsInfoQuery';
8
+ export { reportsInfo, useReportsInfoQuery } from './hooks/useReportsInfoQuery';
4
9
  export type { SearchCoverageFilesErrorResponse, SearchCoverageFilesOkResponse, SearchCoverageFilesProps, SearchCoverageFilesQueryPathParams, SearchCoverageFilesQueryQueryParams, } from './hooks/useSearchCoverageFilesQuery';
5
10
  export { searchCoverageFiles, useSearchCoverageFilesQuery, } from './hooks/useSearchCoverageFilesQuery';
11
+ export type { TestInfoErrorResponse, TestInfoOkResponse, TestInfoProps, TestInfoQueryQueryParams, } from './hooks/useTestInfoQuery';
12
+ export { testInfo, useTestInfoQuery } from './hooks/useTestInfoQuery';
13
+ export type { TestOverviewErrorResponse, TestOverviewOkResponse, TestOverviewProps, TestOverviewQueryQueryParams, } from './hooks/useTestOverviewQuery';
14
+ export { testOverview, useTestOverviewQuery } from './hooks/useTestOverviewQuery';
6
15
  export type { BadRequestResponse } from './responses/BadRequestResponse';
7
16
  export type { InternalErrorResponse } from './responses/InternalErrorResponse';
17
+ export type { NotFoundResponse } from './responses/NotFoundResponse';
8
18
  export type { UnauthenticatedResponse } from './responses/UnauthenticatedResponse';
9
19
  export type { UnauthorizedResponse } from './responses/UnauthorizedResponse';
10
20
  export type { CoverageSummary } from './schemas/CoverageSummary';
11
21
  export type { Error } from './schemas/Error';
12
- export type { FileSummary } from './schemas/FileSummary';
13
- export type { ReportPipelineExecutionOutput } from './schemas/ReportPipelineExecutionOutput';
22
+ export type { ItemSummary } from './schemas/ItemSummary';
23
+ export type { PipelineExecutionReport } from './schemas/PipelineExecutionReport';
24
+ export type { ReportOutput } from './schemas/ReportOutput';
14
25
  export type { SearchResults } from './schemas/SearchResults';
26
+ export type { SelectionDetails } from './schemas/SelectionDetails';
27
+ export type { SelectionOverview } from './schemas/SelectionOverview';
28
+ export type { StepInfo } from './schemas/StepInfo';
29
+ export type { TestReportSummary } from './schemas/TestReportSummary';
@@ -1,2 +1,7 @@
1
1
  export { getExecutionCoverageReport, useGetExecutionCoverageReportQuery, } from './hooks/useGetExecutionCoverageReportQuery';
2
+ export { getToken, useGetTokenQuery } from './hooks/useGetTokenQuery';
3
+ export { reportSummary, useReportSummaryQuery } from './hooks/useReportSummaryQuery';
4
+ export { reportsInfo, useReportsInfoQuery } from './hooks/useReportsInfoQuery';
2
5
  export { searchCoverageFiles, useSearchCoverageFilesQuery, } from './hooks/useSearchCoverageFilesQuery';
6
+ export { testInfo, useTestInfoQuery } from './hooks/useTestInfoQuery';
7
+ export { testOverview, useTestOverviewQuery } from './hooks/useTestOverviewQuery';
@@ -0,0 +1,2 @@
1
+ import type { Error } from '../schemas/Error';
2
+ export type NotFoundResponse = Error;
@@ -1,5 +1,5 @@
1
1
  import type { CoverageSummary } from '../schemas/CoverageSummary';
2
- export interface FileSummary extends CoverageSummary {
2
+ export interface ItemSummary extends CoverageSummary {
3
3
  path?: string;
4
4
  type?: 'dir' | 'file' | 'repo';
5
5
  }
@@ -0,0 +1,4 @@
1
+ import type { ReportOutput } from '../schemas/ReportOutput';
2
+ export interface PipelineExecutionReport extends ReportOutput {
3
+ type?: 'dir' | 'file' | 'repo';
4
+ }
@@ -0,0 +1,8 @@
1
+ import type { ItemSummary } from '../schemas/ItemSummary';
2
+ import type { CoverageSummary } from '../schemas/CoverageSummary';
3
+ export interface ReportOutput {
4
+ items?: ItemSummary[];
5
+ lines?: Array<number[]>;
6
+ path?: string;
7
+ summary: CoverageSummary;
8
+ }
@@ -0,0 +1,5 @@
1
+ export interface SelectionDetails {
2
+ new_tests?: number;
3
+ source_code_changes?: number;
4
+ updated_tests?: number;
5
+ }
@@ -0,0 +1,4 @@
1
+ /* eslint-disable */
2
+ // This code is autogenerated using @harnessio/oats-cli.
3
+ // Please do not modify this code directly.
4
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { SelectionDetails } from '../schemas/SelectionDetails';
2
+ export interface SelectionOverview {
3
+ selected_tests?: SelectionDetails;
4
+ skipped_tests?: number;
5
+ time_saved_ms?: number;
6
+ total_tests?: number;
7
+ }
@@ -0,0 +1,4 @@
1
+ export interface StepInfo {
2
+ stage?: string;
3
+ step?: string;
4
+ }
@@ -0,0 +1,4 @@
1
+ /* eslint-disable */
2
+ // This code is autogenerated using @harnessio/oats-cli.
3
+ // Please do not modify this code directly.
4
+ export {};
@@ -0,0 +1,30 @@
1
+ export interface TestReportSummary {
2
+ /**
3
+ * @format int64
4
+ */
5
+ duration_ms?: number;
6
+ /**
7
+ * @format int64
8
+ */
9
+ failed_tests?: number;
10
+ /**
11
+ * @format int64
12
+ */
13
+ flaky_tests?: number;
14
+ /**
15
+ * @format int64
16
+ */
17
+ skipped_by_ti?: number;
18
+ /**
19
+ * @format int64
20
+ */
21
+ skipped_tests?: number;
22
+ /**
23
+ * @format int64
24
+ */
25
+ successful_tests?: number;
26
+ /**
27
+ * @format int64
28
+ */
29
+ total_tests?: number;
30
+ }
@@ -0,0 +1,4 @@
1
+ /* eslint-disable */
2
+ // This code is autogenerated using @harnessio/oats-cli.
3
+ // Please do not modify this code directly.
4
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harnessio/react-ti-service-client",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Harness React TI service client - TI APIs integrated with react hooks",
5
5
  "author": "Harness Inc",
6
6
  "license": "MIT",
@@ -1,14 +0,0 @@
1
- export type GetPathParamsType<T> = T extends {
2
- pathParams: infer R;
3
- } ? R : never;
4
- export interface ResponseWithPagination<T> {
5
- content: T;
6
- pagination?: {
7
- total?: number;
8
- pageSize?: number;
9
- pageCount?: number;
10
- pageNumber?: number;
11
- };
12
- }
13
- export type WithOptional<TInput, Tkeys extends keyof TInput> = Omit<TInput, Tkeys> & Partial<Pick<TInput, Tkeys>>;
14
- export type PickPartial<TInput, Tkeys extends keyof TInput> = Pick<Partial<TInput>, Tkeys>;
@@ -1,11 +0,0 @@
1
- import type { FileSummary } from '../schemas/FileSummary';
2
- import type { CoverageSummary } from '../schemas/CoverageSummary';
3
- export interface ReportPipelineExecutionOutput {
4
- files: FileSummary[];
5
- lines?: Array<number[]>;
6
- path?: string;
7
- summary: CoverageSummary | {
8
- report_count?: number;
9
- };
10
- type?: 'dir' | 'file' | 'repo';
11
- }