@harnessio/react-ti-service-client 0.3.4 → 0.4.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.
@@ -0,0 +1,30 @@
1
+ import { UseQueryOptions } from '@tanstack/react-query';
2
+ import type { PatchFilesResponse } from '../schemas/PatchFilesResponse';
3
+ import type { BadRequestResponse } from '../responses/BadRequestResponse';
4
+ import type { UnauthenticatedResponse } from '../responses/UnauthenticatedResponse';
5
+ import type { UnauthorizedResponse } from '../responses/UnauthorizedResponse';
6
+ import type { InternalErrorResponse } from '../responses/InternalErrorResponse';
7
+ import { FetcherOptions } from '../../../../custom-fetcher/index.js';
8
+ export interface PatchCoverageFilesQueryPathParams {
9
+ account_identifier: string;
10
+ execution_id: string;
11
+ repo_ref: string;
12
+ commit: string;
13
+ }
14
+ export interface PatchCoverageFilesQueryHeaderParams {
15
+ 'harness-account'?: string;
16
+ 'X-Harness-Token': string;
17
+ }
18
+ export type PatchCoverageFilesOkResponse = PatchFilesResponse;
19
+ export type PatchCoverageFilesErrorResponse = BadRequestResponse | UnauthenticatedResponse | UnauthorizedResponse | InternalErrorResponse;
20
+ export interface PatchCoverageFilesProps extends PatchCoverageFilesQueryPathParams, Omit<FetcherOptions<unknown, unknown, PatchCoverageFilesQueryHeaderParams>, 'url'> {
21
+ }
22
+ export interface PatchCoverageFilesResponseContainer {
23
+ body: PatchCoverageFilesOkResponse;
24
+ headers: Headers;
25
+ }
26
+ export declare function patchCoverageFiles(props: PatchCoverageFilesProps): Promise<PatchCoverageFilesResponseContainer>;
27
+ /**
28
+ * Show coverage for patch files
29
+ */
30
+ export declare function usePatchCoverageFilesQuery(props: PatchCoverageFilesProps, options?: Omit<UseQueryOptions<PatchCoverageFilesResponseContainer, PatchCoverageFilesErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<PatchCoverageFilesResponseContainer, import("..").Error>;
@@ -0,0 +1,20 @@
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 patchCoverageFiles(props) {
7
+ return fetcher(Object.assign({ url: `/coverage/api/v1/accounts/${props.account_identifier}/executions/${props.execution_id}/repo/${props.repo_ref}/patch/${props.commit}`, method: 'GET' }, props));
8
+ }
9
+ /**
10
+ * Show coverage for patch files
11
+ */
12
+ export function usePatchCoverageFilesQuery(props, options) {
13
+ return useQuery([
14
+ 'patchCoverageFiles',
15
+ props.account_identifier,
16
+ props.execution_id,
17
+ props.repo_ref,
18
+ props.commit,
19
+ ], ({ signal }) => patchCoverageFiles(Object.assign(Object.assign({}, props), { signal })), options);
20
+ }
@@ -2,6 +2,8 @@ export type { GetExecutionCoverageReportErrorResponse, GetExecutionCoverageRepor
2
2
  export { getExecutionCoverageReport, useGetExecutionCoverageReportQuery, } from './hooks/useGetExecutionCoverageReportQuery';
3
3
  export type { GetTokenErrorResponse, GetTokenOkResponse, GetTokenProps, GetTokenQueryQueryParams, } from './hooks/useGetTokenQuery';
4
4
  export { getToken, useGetTokenQuery } from './hooks/useGetTokenQuery';
5
+ export type { PatchCoverageFilesErrorResponse, PatchCoverageFilesOkResponse, PatchCoverageFilesProps, PatchCoverageFilesQueryPathParams, } from './hooks/usePatchCoverageFilesQuery';
6
+ export { patchCoverageFiles, usePatchCoverageFilesQuery } from './hooks/usePatchCoverageFilesQuery';
5
7
  export type { ReportSummaryErrorResponse, ReportSummaryOkResponse, ReportSummaryProps, ReportSummaryQueryQueryParams, } from './hooks/useReportSummaryQuery';
6
8
  export { reportSummary, useReportSummaryQuery } from './hooks/useReportSummaryQuery';
7
9
  export type { ReportsInfoErrorResponse, ReportsInfoOkResponse, ReportsInfoProps, ReportsInfoQueryQueryParams, } from './hooks/useReportsInfoQuery';
@@ -22,6 +24,8 @@ export type { UnauthorizedResponse } from './responses/UnauthorizedResponse';
22
24
  export type { CoverageSummary } from './schemas/CoverageSummary';
23
25
  export type { Error } from './schemas/Error';
24
26
  export type { ItemSummary } from './schemas/ItemSummary';
27
+ export type { PatchFilesResponse } from './schemas/PatchFilesResponse';
28
+ export type { PatchSummary } from './schemas/PatchSummary';
25
29
  export type { PipelineExecutionReport } from './schemas/PipelineExecutionReport';
26
30
  export type { ReportOutput } from './schemas/ReportOutput';
27
31
  export type { ResponseMetadata } from './schemas/ResponseMetadata';
@@ -1,5 +1,6 @@
1
1
  export { getExecutionCoverageReport, useGetExecutionCoverageReportQuery, } from './hooks/useGetExecutionCoverageReportQuery';
2
2
  export { getToken, useGetTokenQuery } from './hooks/useGetTokenQuery';
3
+ export { patchCoverageFiles, usePatchCoverageFilesQuery } from './hooks/usePatchCoverageFilesQuery';
3
4
  export { reportSummary, useReportSummaryQuery } from './hooks/useReportSummaryQuery';
4
5
  export { reportsInfo, useReportsInfoQuery } from './hooks/useReportsInfoQuery';
5
6
  export { searchCoverageFiles, useSearchCoverageFilesQuery, } from './hooks/useSearchCoverageFilesQuery';
@@ -1,8 +1,5 @@
1
- export interface CoverageSummary {
2
- coverage: number;
3
- files: number;
4
- hits: number;
5
- lines: number;
6
- misses: number;
7
- partials: number;
1
+ import type { PatchSummary } from '../schemas/PatchSummary';
2
+ export interface CoverageSummary extends PatchSummary {
3
+ files?: number;
4
+ patch?: PatchSummary;
8
5
  }
@@ -1,4 +1 @@
1
- /* eslint-disable */
2
- // This code is autogenerated using @harnessio/oats-cli.
3
- // Please do not modify this code directly.
4
1
  export {};
@@ -0,0 +1,8 @@
1
+ import type { CoverageSummary } from '../schemas/CoverageSummary';
2
+ export type PatchFilesResponse = Array<{
3
+ lines?: Array<number[]>;
4
+ path?: string;
5
+ summary?: CoverageSummary | {
6
+ changes?: number;
7
+ };
8
+ }>;
@@ -0,0 +1,7 @@
1
+ export interface PatchSummary {
2
+ coverage?: number;
3
+ hits?: number;
4
+ lines?: number;
5
+ misses?: number;
6
+ partials?: number;
7
+ }
@@ -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.3.4",
3
+ "version": "0.4.0",
4
4
  "description": "Harness React TI service client - TI APIs integrated with react hooks",
5
5
  "author": "Harness Inc",
6
6
  "license": "MIT",