@harnessio/react-ti-service-client 0.2.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 (40) 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 +12 -7
  6. package/dist/ti-service/src/services/hooks/useGetTokenQuery.js +1 -1
  7. package/dist/ti-service/src/services/hooks/useReportSummaryQuery.d.ts +12 -7
  8. package/dist/ti-service/src/services/hooks/useReportSummaryQuery.js +1 -1
  9. package/dist/ti-service/src/services/hooks/useReportsInfoQuery.d.ts +12 -7
  10. package/dist/ti-service/src/services/hooks/useReportsInfoQuery.js +1 -1
  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 +12 -7
  14. package/dist/ti-service/src/services/hooks/useTestInfoQuery.js +1 -1
  15. package/dist/ti-service/src/services/hooks/useTestOverviewQuery.d.ts +13 -8
  16. package/dist/ti-service/src/services/hooks/useTestOverviewQuery.js +1 -1
  17. package/dist/ti-service/src/services/index.d.ts +4 -10
  18. package/dist/ti-service/src/services/index.js +0 -1
  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/package.json +1 -1
  24. package/dist/ti-service/src/services/helpers.d.ts +0 -14
  25. package/dist/ti-service/src/services/hooks/useTestCaseSummaryV2Query.d.ts +0 -42
  26. package/dist/ti-service/src/services/hooks/useTestCaseSummaryV2Query.js +0 -14
  27. package/dist/ti-service/src/services/schemas/ReportPipelineExecutionOutput.d.ts +0 -11
  28. package/dist/ti-service/src/services/schemas/ResponseMetadata.d.ts +0 -6
  29. package/dist/ti-service/src/services/schemas/ResponseMetadata.js +0 -4
  30. package/dist/ti-service/src/services/schemas/Result.d.ts +0 -16
  31. package/dist/ti-service/src/services/schemas/TestCase.d.ts +0 -21
  32. package/dist/ti-service/src/services/schemas/TestCase.js +0 -1
  33. package/dist/ti-service/src/services/schemas/TestCaseStatus.d.ts +0 -4
  34. package/dist/ti-service/src/services/schemas/TestCaseStatus.js +0 -4
  35. package/dist/ti-service/src/services/schemas/TestCases.d.ts +0 -6
  36. package/dist/ti-service/src/services/schemas/TestCases.js +0 -1
  37. /package/dist/ti-service/src/services/{helpers.js → responses/NotFoundResponse.js} +0 -0
  38. /package/dist/ti-service/src/services/schemas/{FileSummary.js → ItemSummary.js} +0 -0
  39. /package/dist/ti-service/src/services/schemas/{ReportPipelineExecutionOutput.js → PipelineExecutionReport.js} +0 -0
  40. /package/dist/ti-service/src/services/schemas/{Result.js → ReportOutput.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
  }
@@ -1,17 +1,22 @@
1
1
  import { UseQueryOptions } from '@tanstack/react-query';
2
- import type { Error } from '../schemas/Error';
3
- import type { ResponseWithPagination } from '../helpers';
4
- import { FetcherOptions } from '../../../../fetcher/index.js';
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';
5
6
  export interface GetTokenQueryQueryParams {
6
7
  accountId: string;
7
8
  }
8
- export type GetTokenOkResponse = ResponseWithPagination<string>;
9
- export type GetTokenErrorResponse = Error;
9
+ export type GetTokenOkResponse = string;
10
+ export type GetTokenErrorResponse = BadRequestResponse | NotFoundResponse | InternalErrorResponse;
10
11
  export interface GetTokenProps extends Omit<FetcherOptions<GetTokenQueryQueryParams, unknown>, 'url'> {
11
12
  queryParams: GetTokenQueryQueryParams;
12
13
  }
13
- export declare function getToken(props: GetTokenProps): Promise<GetTokenOkResponse>;
14
+ export interface GetTokenResponseContainer {
15
+ body: GetTokenOkResponse;
16
+ headers: Headers;
17
+ }
18
+ export declare function getToken(props: GetTokenProps): Promise<GetTokenResponseContainer>;
14
19
  /**
15
20
  * Get an account level token
16
21
  */
17
- export declare function useGetTokenQuery(props: GetTokenProps, options?: Omit<UseQueryOptions<GetTokenOkResponse, GetTokenErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<GetTokenOkResponse, Error>;
22
+ export declare function useGetTokenQuery(props: GetTokenProps, options?: Omit<UseQueryOptions<GetTokenResponseContainer, GetTokenErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<GetTokenResponseContainer, 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 getToken(props) {
7
7
  return fetcher(Object.assign({ url: `/token`, method: 'GET' }, props));
8
8
  }
@@ -1,8 +1,9 @@
1
1
  import { UseQueryOptions } from '@tanstack/react-query';
2
2
  import type { TestReportSummary } from '../schemas/TestReportSummary';
3
- import type { Error } from '../schemas/Error';
4
- import type { ResponseWithPagination } from '../helpers';
5
- import { FetcherOptions } from '../../../../fetcher/index.js';
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';
6
7
  export interface ReportSummaryQueryQueryParams {
7
8
  accountId: string;
8
9
  orgId: string;
@@ -13,13 +14,17 @@ export interface ReportSummaryQueryQueryParams {
13
14
  stepId?: string;
14
15
  stageId?: string;
15
16
  }
16
- export type ReportSummaryOkResponse = ResponseWithPagination<TestReportSummary>;
17
- export type ReportSummaryErrorResponse = Error;
17
+ export type ReportSummaryOkResponse = TestReportSummary;
18
+ export type ReportSummaryErrorResponse = BadRequestResponse | NotFoundResponse | InternalErrorResponse;
18
19
  export interface ReportSummaryProps extends Omit<FetcherOptions<ReportSummaryQueryQueryParams, unknown>, 'url'> {
19
20
  queryParams: ReportSummaryQueryQueryParams;
20
21
  }
21
- export declare function reportSummary(props: ReportSummaryProps): Promise<ReportSummaryOkResponse>;
22
+ export interface ReportSummaryResponseContainer {
23
+ body: ReportSummaryOkResponse;
24
+ headers: Headers;
25
+ }
26
+ export declare function reportSummary(props: ReportSummaryProps): Promise<ReportSummaryResponseContainer>;
22
27
  /**
23
28
  * Get summary of test reports
24
29
  */
25
- export declare function useReportSummaryQuery(props: ReportSummaryProps, options?: Omit<UseQueryOptions<ReportSummaryOkResponse, ReportSummaryErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<ReportSummaryOkResponse, Error>;
30
+ export declare function useReportSummaryQuery(props: ReportSummaryProps, options?: Omit<UseQueryOptions<ReportSummaryResponseContainer, ReportSummaryErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<ReportSummaryResponseContainer, 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 reportSummary(props) {
7
7
  return fetcher(Object.assign({ url: `/reports/summary`, method: 'GET' }, props));
8
8
  }
@@ -1,8 +1,9 @@
1
1
  import { UseQueryOptions } from '@tanstack/react-query';
2
2
  import type { StepInfo } from '../schemas/StepInfo';
3
- import type { Error } from '../schemas/Error';
4
- import type { ResponseWithPagination } from '../helpers';
5
- import { FetcherOptions } from '../../../../fetcher/index.js';
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';
6
7
  export interface ReportsInfoQueryQueryParams {
7
8
  accountId: string;
8
9
  orgId: string;
@@ -10,13 +11,17 @@ export interface ReportsInfoQueryQueryParams {
10
11
  pipelineId: string;
11
12
  buildId: string;
12
13
  }
13
- export type ReportsInfoOkResponse = ResponseWithPagination<StepInfo[]>;
14
- export type ReportsInfoErrorResponse = Error;
14
+ export type ReportsInfoOkResponse = StepInfo[];
15
+ export type ReportsInfoErrorResponse = BadRequestResponse | NotFoundResponse | InternalErrorResponse;
15
16
  export interface ReportsInfoProps extends Omit<FetcherOptions<ReportsInfoQueryQueryParams, unknown>, 'url'> {
16
17
  queryParams: ReportsInfoQueryQueryParams;
17
18
  }
18
- export declare function reportsInfo(props: ReportsInfoProps): Promise<ReportsInfoOkResponse>;
19
+ export interface ReportsInfoResponseContainer {
20
+ body: ReportsInfoOkResponse;
21
+ headers: Headers;
22
+ }
23
+ export declare function reportsInfo(props: ReportsInfoProps): Promise<ReportsInfoResponseContainer>;
19
24
  /**
20
25
  * Get information about test reports
21
26
  */
22
- export declare function useReportsInfoQuery(props: ReportsInfoProps, options?: Omit<UseQueryOptions<ReportsInfoOkResponse, ReportsInfoErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<ReportsInfoOkResponse, Error>;
27
+ export declare function useReportsInfoQuery(props: ReportsInfoProps, options?: Omit<UseQueryOptions<ReportsInfoResponseContainer, ReportsInfoErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<ReportsInfoResponseContainer, 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 reportsInfo(props) {
7
7
  return fetcher(Object.assign({ url: `/reports/info`, method: 'GET' }, props));
8
8
  }
@@ -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
@@ -1,8 +1,9 @@
1
1
  import { UseQueryOptions } from '@tanstack/react-query';
2
2
  import type { StepInfo } from '../schemas/StepInfo';
3
- import type { Error } from '../schemas/Error';
4
- import type { ResponseWithPagination } from '../helpers';
5
- import { FetcherOptions } from '../../../../fetcher/index.js';
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';
6
7
  export interface TestInfoQueryQueryParams {
7
8
  accountId: string;
8
9
  orgId: string;
@@ -10,13 +11,17 @@ export interface TestInfoQueryQueryParams {
10
11
  pipelineId: string;
11
12
  buildId: string;
12
13
  }
13
- export type TestInfoOkResponse = ResponseWithPagination<StepInfo[]>;
14
- export type TestInfoErrorResponse = Error;
14
+ export type TestInfoOkResponse = StepInfo[];
15
+ export type TestInfoErrorResponse = BadRequestResponse | NotFoundResponse | InternalErrorResponse;
15
16
  export interface TestInfoProps extends Omit<FetcherOptions<TestInfoQueryQueryParams, unknown>, 'url'> {
16
17
  queryParams: TestInfoQueryQueryParams;
17
18
  }
18
- export declare function testInfo(props: TestInfoProps): Promise<TestInfoOkResponse>;
19
+ export interface TestInfoResponseContainer {
20
+ body: TestInfoOkResponse;
21
+ headers: Headers;
22
+ }
23
+ export declare function testInfo(props: TestInfoProps): Promise<TestInfoResponseContainer>;
19
24
  /**
20
25
  * Get information about TI steps
21
26
  */
22
- export declare function useTestInfoQuery(props: TestInfoProps, options?: Omit<UseQueryOptions<TestInfoOkResponse, TestInfoErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<TestInfoOkResponse, Error>;
27
+ export declare function useTestInfoQuery(props: TestInfoProps, options?: Omit<UseQueryOptions<TestInfoResponseContainer, TestInfoErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<TestInfoResponseContainer, 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 testInfo(props) {
7
7
  return fetcher(Object.assign({ url: `/tests/info`, method: 'GET' }, props));
8
8
  }
@@ -1,24 +1,29 @@
1
1
  import { UseQueryOptions } from '@tanstack/react-query';
2
2
  import type { SelectionOverview } from '../schemas/SelectionOverview';
3
- import type { Error } from '../schemas/Error';
4
- import type { ResponseWithPagination } from '../helpers';
5
- import { FetcherOptions } from '../../../../fetcher/index.js';
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';
6
7
  export interface TestOverviewQueryQueryParams {
7
8
  accountId: string;
8
9
  orgId: string;
9
10
  projectId: string;
10
11
  pipelineId: string;
11
12
  buildId: string;
12
- stepId: string;
13
13
  stageId: string;
14
+ stepId: string;
14
15
  }
15
- export type TestOverviewOkResponse = ResponseWithPagination<SelectionOverview>;
16
- export type TestOverviewErrorResponse = Error;
16
+ export type TestOverviewOkResponse = SelectionOverview;
17
+ export type TestOverviewErrorResponse = BadRequestResponse | NotFoundResponse | InternalErrorResponse;
17
18
  export interface TestOverviewProps extends Omit<FetcherOptions<TestOverviewQueryQueryParams, unknown>, 'url'> {
18
19
  queryParams: TestOverviewQueryQueryParams;
19
20
  }
20
- export declare function testOverview(props: TestOverviewProps): Promise<TestOverviewOkResponse>;
21
+ export interface TestOverviewResponseContainer {
22
+ body: TestOverviewOkResponse;
23
+ headers: Headers;
24
+ }
25
+ export declare function testOverview(props: TestOverviewProps): Promise<TestOverviewResponseContainer>;
21
26
  /**
22
27
  * Get overview of selected tests.
23
28
  */
24
- export declare function useTestOverviewQuery(props: TestOverviewProps, options?: Omit<UseQueryOptions<TestOverviewOkResponse, TestOverviewErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<TestOverviewOkResponse, Error>;
29
+ export declare function useTestOverviewQuery(props: TestOverviewProps, options?: Omit<UseQueryOptions<TestOverviewResponseContainer, TestOverviewErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<TestOverviewResponseContainer, 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 testOverview(props) {
7
7
  return fetcher(Object.assign({ url: `/tests/overview`, method: 'GET' }, props));
8
8
  }
@@ -1,4 +1,3 @@
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';
4
3
  export type { GetTokenErrorResponse, GetTokenOkResponse, GetTokenProps, GetTokenQueryQueryParams, } from './hooks/useGetTokenQuery';
@@ -9,27 +8,22 @@ export type { ReportsInfoErrorResponse, ReportsInfoOkResponse, ReportsInfoProps,
9
8
  export { reportsInfo, useReportsInfoQuery } from './hooks/useReportsInfoQuery';
10
9
  export type { SearchCoverageFilesErrorResponse, SearchCoverageFilesOkResponse, SearchCoverageFilesProps, SearchCoverageFilesQueryPathParams, SearchCoverageFilesQueryQueryParams, } from './hooks/useSearchCoverageFilesQuery';
11
10
  export { searchCoverageFiles, useSearchCoverageFilesQuery, } from './hooks/useSearchCoverageFilesQuery';
12
- export type { TestCaseSummaryV2ErrorResponse, TestCaseSummaryV2OkResponse, TestCaseSummaryV2Props, TestCaseSummaryV2QueryQueryParams, } from './hooks/useTestCaseSummaryV2Query';
13
- export { testCaseSummaryV2, useTestCaseSummaryV2Query } from './hooks/useTestCaseSummaryV2Query';
14
11
  export type { TestInfoErrorResponse, TestInfoOkResponse, TestInfoProps, TestInfoQueryQueryParams, } from './hooks/useTestInfoQuery';
15
12
  export { testInfo, useTestInfoQuery } from './hooks/useTestInfoQuery';
16
13
  export type { TestOverviewErrorResponse, TestOverviewOkResponse, TestOverviewProps, TestOverviewQueryQueryParams, } from './hooks/useTestOverviewQuery';
17
14
  export { testOverview, useTestOverviewQuery } from './hooks/useTestOverviewQuery';
18
15
  export type { BadRequestResponse } from './responses/BadRequestResponse';
19
16
  export type { InternalErrorResponse } from './responses/InternalErrorResponse';
17
+ export type { NotFoundResponse } from './responses/NotFoundResponse';
20
18
  export type { UnauthenticatedResponse } from './responses/UnauthenticatedResponse';
21
19
  export type { UnauthorizedResponse } from './responses/UnauthorizedResponse';
22
20
  export type { CoverageSummary } from './schemas/CoverageSummary';
23
21
  export type { Error } from './schemas/Error';
24
- export type { FileSummary } from './schemas/FileSummary';
25
- export type { ReportPipelineExecutionOutput } from './schemas/ReportPipelineExecutionOutput';
26
- export type { ResponseMetadata } from './schemas/ResponseMetadata';
27
- export type { Result } from './schemas/Result';
22
+ export type { ItemSummary } from './schemas/ItemSummary';
23
+ export type { PipelineExecutionReport } from './schemas/PipelineExecutionReport';
24
+ export type { ReportOutput } from './schemas/ReportOutput';
28
25
  export type { SearchResults } from './schemas/SearchResults';
29
26
  export type { SelectionDetails } from './schemas/SelectionDetails';
30
27
  export type { SelectionOverview } from './schemas/SelectionOverview';
31
28
  export type { StepInfo } from './schemas/StepInfo';
32
- export type { TestCase } from './schemas/TestCase';
33
- export type { TestCaseStatus } from './schemas/TestCaseStatus';
34
- export type { TestCases } from './schemas/TestCases';
35
29
  export type { TestReportSummary } from './schemas/TestReportSummary';
@@ -3,6 +3,5 @@ export { getToken, useGetTokenQuery } from './hooks/useGetTokenQuery';
3
3
  export { reportSummary, useReportSummaryQuery } from './hooks/useReportSummaryQuery';
4
4
  export { reportsInfo, useReportsInfoQuery } from './hooks/useReportsInfoQuery';
5
5
  export { searchCoverageFiles, useSearchCoverageFilesQuery, } from './hooks/useSearchCoverageFilesQuery';
6
- export { testCaseSummaryV2, useTestCaseSummaryV2Query } from './hooks/useTestCaseSummaryV2Query';
7
6
  export { testInfo, useTestInfoQuery } from './hooks/useTestInfoQuery';
8
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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harnessio/react-ti-service-client",
3
- "version": "0.2.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,42 +0,0 @@
1
- import { UseQueryOptions } from '@tanstack/react-query';
2
- import type { TestCases } from '../schemas/TestCases';
3
- import type { Error } from '../schemas/Error';
4
- import type { ResponseWithPagination } from '../helpers';
5
- import { FetcherOptions } from '../../../../fetcher/index.js';
6
- export interface TestCaseSummaryV2QueryQueryParams {
7
- accountId: string;
8
- orgId: string;
9
- projectId: string;
10
- pipelineId: string;
11
- buildId: string;
12
- stepId?: string;
13
- stageId?: string;
14
- report: 'junit';
15
- suite_name?: string;
16
- testCaseSearchTerm?: string;
17
- /**
18
- * @default 100
19
- */
20
- pageSize?: number;
21
- /**
22
- * @default 0
23
- */
24
- pageIndex?: number;
25
- status?: 'failed';
26
- flaky?: boolean;
27
- sort?: 'class_name' | 'duration_ms' | 'name' | 'status';
28
- /**
29
- * @default "ASC"
30
- */
31
- order?: 'ASC' | 'DESC';
32
- }
33
- export type TestCaseSummaryV2OkResponse = ResponseWithPagination<TestCases>;
34
- export type TestCaseSummaryV2ErrorResponse = Error;
35
- export interface TestCaseSummaryV2Props extends Omit<FetcherOptions<TestCaseSummaryV2QueryQueryParams, unknown>, 'url'> {
36
- queryParams: TestCaseSummaryV2QueryQueryParams;
37
- }
38
- export declare function testCaseSummaryV2(props: TestCaseSummaryV2Props): Promise<TestCaseSummaryV2OkResponse>;
39
- /**
40
- * Get test case details
41
- */
42
- export declare function useTestCaseSummaryV2Query(props: TestCaseSummaryV2Props, options?: Omit<UseQueryOptions<TestCaseSummaryV2OkResponse, TestCaseSummaryV2ErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<TestCaseSummaryV2OkResponse, Error>;
@@ -1,14 +0,0 @@
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 '../../../../fetcher/index.js';
6
- export function testCaseSummaryV2(props) {
7
- return fetcher(Object.assign({ url: `/reports/test_cases_v2`, method: 'GET' }, props));
8
- }
9
- /**
10
- * Get test case details
11
- */
12
- export function useTestCaseSummaryV2Query(props, options) {
13
- return useQuery(['testCaseSummaryV2', props.queryParams], ({ signal }) => testCaseSummaryV2(Object.assign(Object.assign({}, props), { signal })), options);
14
- }
@@ -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
- }
@@ -1,6 +0,0 @@
1
- export interface ResponseMetadata {
2
- pageItemCount?: number;
3
- pageSize?: number;
4
- totalItems?: number;
5
- totalPages?: number;
6
- }
@@ -1,4 +0,0 @@
1
- /* eslint-disable */
2
- // This code is autogenerated using @harnessio/oats-cli.
3
- // Please do not modify this code directly.
4
- export {};
@@ -1,16 +0,0 @@
1
- import type { TestCaseStatus } from '../schemas/TestCaseStatus';
2
- export interface Result {
3
- /**
4
- * Description corresponding to the test case status
5
- */
6
- desc?: string;
7
- /**
8
- * Message corresponding to the test case status
9
- */
10
- message?: string;
11
- status?: TestCaseStatus;
12
- /**
13
- * Type corresponding to the test case status
14
- */
15
- type?: string;
16
- }
@@ -1,21 +0,0 @@
1
- import type { Result } from '../schemas/Result';
2
- export interface TestCase {
3
- class_name?: string;
4
- /**
5
- * @format int64
6
- */
7
- duration_ms?: number;
8
- file_name?: string;
9
- flaky?: boolean;
10
- name?: string;
11
- result?: Result;
12
- /**
13
- * (Truncated) stderr while running the test
14
- */
15
- stderr?: string;
16
- /**
17
- * (Truncated) stdout while running the test
18
- */
19
- stdout?: string;
20
- suite_name?: string;
21
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,4 +0,0 @@
1
- /**
2
- * Status of the test
3
- */
4
- export type TestCaseStatus = 'error' | 'failed' | 'passed' | 'skipped' | 'skipped_by_ti';
@@ -1,4 +0,0 @@
1
- /* eslint-disable */
2
- // This code is autogenerated using @harnessio/oats-cli.
3
- // Please do not modify this code directly.
4
- export {};
@@ -1,6 +0,0 @@
1
- import type { TestCase } from '../schemas/TestCase';
2
- import type { ResponseMetadata } from '../schemas/ResponseMetadata';
3
- export interface TestCases {
4
- content?: TestCase[];
5
- data?: ResponseMetadata;
6
- }
@@ -1 +0,0 @@
1
- export {};