@harnessio/react-ti-service-client 0.6.1 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/ti-service/src/services/hooks/useGetAllTestMarkingsQuery.d.ts +37 -0
  2. package/dist/ti-service/src/services/hooks/useGetAllTestMarkingsQuery.js +15 -0
  3. package/dist/ti-service/src/services/hooks/useGetExecutionCoverageReportQuery.d.ts +1 -1
  4. package/dist/ti-service/src/services/hooks/useGetExecutionCoverageReportQuery.js +1 -1
  5. package/dist/ti-service/src/services/hooks/useGetFlakyTestsQuery.d.ts +33 -0
  6. package/dist/ti-service/src/services/hooks/useGetFlakyTestsQuery.js +14 -0
  7. package/dist/ti-service/src/services/hooks/useGetPoliciesQuery.d.ts +25 -0
  8. package/dist/ti-service/src/services/hooks/useGetPoliciesQuery.js +14 -0
  9. package/dist/ti-service/src/services/hooks/useGetTestManagementRepositoriesQuery.d.ts +33 -0
  10. package/dist/ti-service/src/services/hooks/useGetTestManagementRepositoriesQuery.js +15 -0
  11. package/dist/ti-service/src/services/hooks/useSetFlakyStatusMutation.d.ts +30 -0
  12. package/dist/ti-service/src/services/hooks/useSetFlakyStatusMutation.js +15 -0
  13. package/dist/ti-service/src/services/hooks/useSetQuarantineStatusMutation.d.ts +30 -0
  14. package/dist/ti-service/src/services/hooks/useSetQuarantineStatusMutation.js +15 -0
  15. package/dist/ti-service/src/services/hooks/useUpsertPoliciesMutation.d.ts +32 -0
  16. package/dist/ti-service/src/services/hooks/useUpsertPoliciesMutation.js +15 -0
  17. package/dist/ti-service/src/services/index.d.ts +25 -0
  18. package/dist/ti-service/src/services/index.js +7 -0
  19. package/dist/ti-service/src/services/schemas/MarkedTest.d.ts +21 -0
  20. package/dist/ti-service/src/services/schemas/MarkedTest.js +4 -0
  21. package/dist/ti-service/src/services/schemas/MarkedTestsResponse.d.ts +9 -0
  22. package/dist/ti-service/src/services/schemas/MarkedTestsResponse.js +1 -0
  23. package/dist/ti-service/src/services/schemas/Pagination.d.ts +18 -0
  24. package/dist/ti-service/src/services/schemas/Pagination.js +4 -0
  25. package/dist/ti-service/src/services/schemas/PoliciesResponse.d.ts +7 -0
  26. package/dist/ti-service/src/services/schemas/PoliciesResponse.js +1 -0
  27. package/dist/ti-service/src/services/schemas/Policy.d.ts +21 -0
  28. package/dist/ti-service/src/services/schemas/Policy.js +4 -0
  29. package/dist/ti-service/src/services/schemas/RepositoriesResponse.d.ts +9 -0
  30. package/dist/ti-service/src/services/schemas/RepositoriesResponse.js +1 -0
  31. package/dist/ti-service/src/services/schemas/Repository.d.ts +10 -0
  32. package/dist/ti-service/src/services/schemas/Repository.js +4 -0
  33. package/dist/ti-service/src/services/schemas/TestMarkingDetail.d.ts +37 -0
  34. package/dist/ti-service/src/services/schemas/TestMarkingDetail.js +4 -0
  35. package/dist/ti-service/src/services/schemas/TestMarkingRequest.d.ts +24 -0
  36. package/dist/ti-service/src/services/schemas/TestMarkingRequest.js +4 -0
  37. package/dist/ti-service/src/services/schemas/TestMarkingResponse.d.ts +15 -0
  38. package/dist/ti-service/src/services/schemas/TestMarkingResponse.js +4 -0
  39. package/dist/ti-service/src/services/schemas/TestMarkingsResponse.d.ts +19 -0
  40. package/dist/ti-service/src/services/schemas/TestMarkingsResponse.js +1 -0
  41. package/package.json +1 -1
@@ -0,0 +1,37 @@
1
+ import { UseQueryOptions } from '@tanstack/react-query';
2
+ import type { TestMarkingsResponse } from '../schemas/TestMarkingsResponse';
3
+ import type { BadRequestResponse } from '../responses/BadRequestResponse';
4
+ import type { InternalErrorResponse } from '../responses/InternalErrorResponse';
5
+ import { FetcherOptions } from '../../../../custom-fetcher/index.js';
6
+ export interface GetAllTestMarkingsQueryQueryParams {
7
+ accountId: string;
8
+ orgId: string;
9
+ projectId: string;
10
+ repo: string;
11
+ /**
12
+ * @default 0
13
+ */
14
+ pageIndex?: number;
15
+ /**
16
+ * @default 100
17
+ */
18
+ pageSize?: number;
19
+ flaky?: boolean;
20
+ quarantine?: boolean;
21
+ test_name?: string;
22
+ }
23
+ export type GetAllTestMarkingsOkResponse = TestMarkingsResponse;
24
+ export type GetAllTestMarkingsErrorResponse = BadRequestResponse | InternalErrorResponse;
25
+ export interface GetAllTestMarkingsProps extends Omit<FetcherOptions<GetAllTestMarkingsQueryQueryParams, unknown>, 'url'> {
26
+ queryParams: GetAllTestMarkingsQueryQueryParams;
27
+ }
28
+ export interface GetAllTestMarkingsResponseContainer {
29
+ body: GetAllTestMarkingsOkResponse;
30
+ headers: Headers;
31
+ }
32
+ export declare function getAllTestMarkings(props: GetAllTestMarkingsProps): Promise<GetAllTestMarkingsResponseContainer>;
33
+ /**
34
+ * Returns all tests with their combined flaky and quarantine markings for the given account and repo, with pagination. Use the optional `flaky` and `quarantine` parameters to filter results to only tests with a specific status for each field. The response also includes `totalFlaky` and `totalQuarantine` — the aggregate counts of flaky and quarantined tests across the entire repository, independent of any active pagination or filters.
35
+ *
36
+ */
37
+ export declare function useGetAllTestMarkingsQuery(props: GetAllTestMarkingsProps, options?: Omit<UseQueryOptions<GetAllTestMarkingsResponseContainer, GetAllTestMarkingsErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<GetAllTestMarkingsResponseContainer, import("..").Error>;
@@ -0,0 +1,15 @@
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 getAllTestMarkings(props) {
7
+ return fetcher(Object.assign({ url: `/test-management/tests`, method: 'GET' }, props));
8
+ }
9
+ /**
10
+ * Returns all tests with their combined flaky and quarantine markings for the given account and repo, with pagination. Use the optional `flaky` and `quarantine` parameters to filter results to only tests with a specific status for each field. The response also includes `totalFlaky` and `totalQuarantine` — the aggregate counts of flaky and quarantined tests across the entire repository, independent of any active pagination or filters.
11
+ *
12
+ */
13
+ export function useGetAllTestMarkingsQuery(props, options) {
14
+ return useQuery(['getAllTestMarkings', props.queryParams], ({ signal }) => getAllTestMarkings(Object.assign(Object.assign({}, props), { signal })), options);
15
+ }
@@ -32,6 +32,6 @@ export interface GetExecutionCoverageReportResponseContainer {
32
32
  }
33
33
  export declare function getExecutionCoverageReport(props: GetExecutionCoverageReportProps): Promise<GetExecutionCoverageReportResponseContainer>;
34
34
  /**
35
- * Retrieve pipeline execution coverage data for a specific file path or directory tree
35
+ * Retrieve pipeline execution coverage data for a specific file path or directory tree. Use the tags parameter to filter coverage by specific tags.
36
36
  */
37
37
  export declare function useGetExecutionCoverageReportQuery(props: GetExecutionCoverageReportProps, options?: Omit<UseQueryOptions<GetExecutionCoverageReportResponseContainer, GetExecutionCoverageReportErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<GetExecutionCoverageReportResponseContainer, import("..").Error>;
@@ -7,7 +7,7 @@ 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
  }
9
9
  /**
10
- * Retrieve pipeline execution coverage data for a specific file path or directory tree
10
+ * Retrieve pipeline execution coverage data for a specific file path or directory tree. Use the tags parameter to filter coverage by specific tags.
11
11
  */
12
12
  export function useGetExecutionCoverageReportQuery(props, options) {
13
13
  return useQuery([
@@ -0,0 +1,33 @@
1
+ import { UseQueryOptions } from '@tanstack/react-query';
2
+ import type { MarkedTestsResponse } from '../schemas/MarkedTestsResponse';
3
+ import type { BadRequestResponse } from '../responses/BadRequestResponse';
4
+ import type { InternalErrorResponse } from '../responses/InternalErrorResponse';
5
+ import { FetcherOptions } from '../../../../custom-fetcher/index.js';
6
+ export interface GetFlakyTestsQueryQueryParams {
7
+ accountId: string;
8
+ orgId: string;
9
+ projectId: string;
10
+ repo: string;
11
+ /**
12
+ * @default 0
13
+ */
14
+ pageIndex?: number;
15
+ /**
16
+ * @default 100
17
+ */
18
+ pageSize?: number;
19
+ }
20
+ export type GetFlakyTestsOkResponse = MarkedTestsResponse;
21
+ export type GetFlakyTestsErrorResponse = BadRequestResponse | InternalErrorResponse;
22
+ export interface GetFlakyTestsProps extends Omit<FetcherOptions<GetFlakyTestsQueryQueryParams, unknown>, 'url'> {
23
+ queryParams: GetFlakyTestsQueryQueryParams;
24
+ }
25
+ export interface GetFlakyTestsResponseContainer {
26
+ body: GetFlakyTestsOkResponse;
27
+ headers: Headers;
28
+ }
29
+ export declare function getFlakyTests(props: GetFlakyTestsProps): Promise<GetFlakyTestsResponseContainer>;
30
+ /**
31
+ * Returns all tests currently marked as flaky for the given account and repo, with pagination.
32
+ */
33
+ export declare function useGetFlakyTestsQuery(props: GetFlakyTestsProps, options?: Omit<UseQueryOptions<GetFlakyTestsResponseContainer, GetFlakyTestsErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<GetFlakyTestsResponseContainer, 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 getFlakyTests(props) {
7
+ return fetcher(Object.assign({ url: `/test-management/flaky`, method: 'GET' }, props));
8
+ }
9
+ /**
10
+ * Returns all tests currently marked as flaky for the given account and repo, with pagination.
11
+ */
12
+ export function useGetFlakyTestsQuery(props, options) {
13
+ return useQuery(['getFlakyTests', props.queryParams], ({ signal }) => getFlakyTests(Object.assign(Object.assign({}, props), { signal })), options);
14
+ }
@@ -0,0 +1,25 @@
1
+ import { UseQueryOptions } from '@tanstack/react-query';
2
+ import type { PoliciesResponse } from '../schemas/PoliciesResponse';
3
+ import type { BadRequestResponse } from '../responses/BadRequestResponse';
4
+ import type { InternalErrorResponse } from '../responses/InternalErrorResponse';
5
+ import { FetcherOptions } from '../../../../custom-fetcher/index.js';
6
+ export interface GetPoliciesQueryQueryParams {
7
+ accountId: string;
8
+ orgId: string;
9
+ projectId: string;
10
+ repo: string;
11
+ }
12
+ export type GetPoliciesOkResponse = PoliciesResponse;
13
+ export type GetPoliciesErrorResponse = BadRequestResponse | InternalErrorResponse;
14
+ export interface GetPoliciesProps extends Omit<FetcherOptions<GetPoliciesQueryQueryParams, unknown>, 'url'> {
15
+ queryParams: GetPoliciesQueryQueryParams;
16
+ }
17
+ export interface GetPoliciesResponseContainer {
18
+ body: GetPoliciesOkResponse;
19
+ headers: Headers;
20
+ }
21
+ export declare function getPolicies(props: GetPoliciesProps): Promise<GetPoliciesResponseContainer>;
22
+ /**
23
+ * Returns all automation policies configured for the given account, org, project, and repo.
24
+ */
25
+ export declare function useGetPoliciesQuery(props: GetPoliciesProps, options?: Omit<UseQueryOptions<GetPoliciesResponseContainer, GetPoliciesErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<GetPoliciesResponseContainer, 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 getPolicies(props) {
7
+ return fetcher(Object.assign({ url: `/test-management/policies`, method: 'GET' }, props));
8
+ }
9
+ /**
10
+ * Returns all automation policies configured for the given account, org, project, and repo.
11
+ */
12
+ export function useGetPoliciesQuery(props, options) {
13
+ return useQuery(['getPolicies', props.queryParams], ({ signal }) => getPolicies(Object.assign(Object.assign({}, props), { signal })), options);
14
+ }
@@ -0,0 +1,33 @@
1
+ import { UseQueryOptions } from '@tanstack/react-query';
2
+ import type { RepositoriesResponse } from '../schemas/RepositoriesResponse';
3
+ import type { BadRequestResponse } from '../responses/BadRequestResponse';
4
+ import type { InternalErrorResponse } from '../responses/InternalErrorResponse';
5
+ import { FetcherOptions } from '../../../../custom-fetcher/index.js';
6
+ export interface GetTestManagementRepositoriesQueryQueryParams {
7
+ accountId: string;
8
+ orgId: string;
9
+ projectId: string;
10
+ /**
11
+ * @default 0
12
+ */
13
+ pageIndex?: number;
14
+ /**
15
+ * @default 10
16
+ */
17
+ pageSize?: number;
18
+ }
19
+ export type GetTestManagementRepositoriesOkResponse = RepositoriesResponse;
20
+ export type GetTestManagementRepositoriesErrorResponse = BadRequestResponse | InternalErrorResponse;
21
+ export interface GetTestManagementRepositoriesProps extends Omit<FetcherOptions<GetTestManagementRepositoriesQueryQueryParams, unknown>, 'url'> {
22
+ queryParams: GetTestManagementRepositoriesQueryQueryParams;
23
+ }
24
+ export interface GetTestManagementRepositoriesResponseContainer {
25
+ body: GetTestManagementRepositoriesOkResponse;
26
+ headers: Headers;
27
+ }
28
+ export declare function getTestManagementRepositories(props: GetTestManagementRepositoriesProps): Promise<GetTestManagementRepositoriesResponseContainer>;
29
+ /**
30
+ * Returns a paginated list of distinct repositories that have at least one test marking (flaky or quarantined) for the given account, optionally scoped to an org and project. Default page size is 10.
31
+ *
32
+ */
33
+ export declare function useGetTestManagementRepositoriesQuery(props: GetTestManagementRepositoriesProps, options?: Omit<UseQueryOptions<GetTestManagementRepositoriesResponseContainer, GetTestManagementRepositoriesErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<GetTestManagementRepositoriesResponseContainer, import("..").Error>;
@@ -0,0 +1,15 @@
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 getTestManagementRepositories(props) {
7
+ return fetcher(Object.assign({ url: `/test-management/repos`, method: 'GET' }, props));
8
+ }
9
+ /**
10
+ * Returns a paginated list of distinct repositories that have at least one test marking (flaky or quarantined) for the given account, optionally scoped to an org and project. Default page size is 10.
11
+ *
12
+ */
13
+ export function useGetTestManagementRepositoriesQuery(props, options) {
14
+ return useQuery(['getTestManagementRepositories', props.queryParams], ({ signal }) => getTestManagementRepositories(Object.assign(Object.assign({}, props), { signal })), options);
15
+ }
@@ -0,0 +1,30 @@
1
+ import { UseMutationOptions } from '@tanstack/react-query';
2
+ import type { TestMarkingResponse } from '../schemas/TestMarkingResponse';
3
+ import type { BadRequestResponse } from '../responses/BadRequestResponse';
4
+ import type { InternalErrorResponse } from '../responses/InternalErrorResponse';
5
+ import type { TestMarkingRequest } from '../schemas/TestMarkingRequest';
6
+ import { FetcherOptions } from '../../../../custom-fetcher/index.js';
7
+ export interface SetFlakyStatusMutationQueryParams {
8
+ accountId: string;
9
+ orgId: string;
10
+ projectId: string;
11
+ repo: string;
12
+ }
13
+ export type SetFlakyStatusRequestBody = TestMarkingRequest[];
14
+ export type SetFlakyStatusOkResponse = TestMarkingResponse;
15
+ export type SetFlakyStatusErrorResponse = BadRequestResponse | InternalErrorResponse;
16
+ export interface SetFlakyStatusProps extends Omit<FetcherOptions<SetFlakyStatusMutationQueryParams, SetFlakyStatusRequestBody>, 'url'> {
17
+ queryParams: SetFlakyStatusMutationQueryParams;
18
+ body: SetFlakyStatusRequestBody;
19
+ }
20
+ export interface SetFlakyStatusResponseContainer {
21
+ body: SetFlakyStatusOkResponse;
22
+ headers: Headers;
23
+ }
24
+ export declare function setFlakyStatus(props: SetFlakyStatusProps): Promise<SetFlakyStatusResponseContainer>;
25
+ export type SetFlakyStatusMutationProps<T extends keyof SetFlakyStatusProps> = Omit<SetFlakyStatusProps, T> & Partial<Pick<SetFlakyStatusProps, T>>;
26
+ /**
27
+ * Upserts the flaky marking for each test in the request body. A `marking` of `"true"` marks the test as flaky, `"false"` removes the marking, and `"unset"` clears any stored value.
28
+ *
29
+ */
30
+ export declare function useSetFlakyStatusMutation<T extends keyof SetFlakyStatusProps>(props: Pick<Partial<SetFlakyStatusProps>, T>, options?: Omit<UseMutationOptions<SetFlakyStatusResponseContainer, SetFlakyStatusErrorResponse, SetFlakyStatusMutationProps<T>>, 'mutationKey' | 'mutationFn'>): import("@tanstack/react-query").UseMutationResult<SetFlakyStatusResponseContainer, import("..").Error, SetFlakyStatusMutationProps<T>, unknown>;
@@ -0,0 +1,15 @@
1
+ /* eslint-disable */
2
+ // This code is autogenerated using @harnessio/oats-cli.
3
+ // Please do not modify this code directly.
4
+ import { useMutation } from '@tanstack/react-query';
5
+ import { fetcher } from '../../../../custom-fetcher/index.js';
6
+ export function setFlakyStatus(props) {
7
+ return fetcher(Object.assign({ url: `/test-management/flaky`, method: 'POST' }, props));
8
+ }
9
+ /**
10
+ * Upserts the flaky marking for each test in the request body. A `marking` of `"true"` marks the test as flaky, `"false"` removes the marking, and `"unset"` clears any stored value.
11
+ *
12
+ */
13
+ export function useSetFlakyStatusMutation(props, options) {
14
+ return useMutation((mutateProps) => setFlakyStatus(Object.assign(Object.assign({}, props), mutateProps)), options);
15
+ }
@@ -0,0 +1,30 @@
1
+ import { UseMutationOptions } from '@tanstack/react-query';
2
+ import type { TestMarkingResponse } from '../schemas/TestMarkingResponse';
3
+ import type { BadRequestResponse } from '../responses/BadRequestResponse';
4
+ import type { InternalErrorResponse } from '../responses/InternalErrorResponse';
5
+ import type { TestMarkingRequest } from '../schemas/TestMarkingRequest';
6
+ import { FetcherOptions } from '../../../../custom-fetcher/index.js';
7
+ export interface SetQuarantineStatusMutationQueryParams {
8
+ accountId: string;
9
+ orgId: string;
10
+ projectId: string;
11
+ repo: string;
12
+ }
13
+ export type SetQuarantineStatusRequestBody = TestMarkingRequest[];
14
+ export type SetQuarantineStatusOkResponse = TestMarkingResponse;
15
+ export type SetQuarantineStatusErrorResponse = BadRequestResponse | InternalErrorResponse;
16
+ export interface SetQuarantineStatusProps extends Omit<FetcherOptions<SetQuarantineStatusMutationQueryParams, SetQuarantineStatusRequestBody>, 'url'> {
17
+ queryParams: SetQuarantineStatusMutationQueryParams;
18
+ body: SetQuarantineStatusRequestBody;
19
+ }
20
+ export interface SetQuarantineStatusResponseContainer {
21
+ body: SetQuarantineStatusOkResponse;
22
+ headers: Headers;
23
+ }
24
+ export declare function setQuarantineStatus(props: SetQuarantineStatusProps): Promise<SetQuarantineStatusResponseContainer>;
25
+ export type SetQuarantineStatusMutationProps<T extends keyof SetQuarantineStatusProps> = Omit<SetQuarantineStatusProps, T> & Partial<Pick<SetQuarantineStatusProps, T>>;
26
+ /**
27
+ * Upserts the quarantine marking for each test in the request body. A `marking` of `"true"` quarantines the test, `"false"` removes the quarantine, and `"unset"` clears any stored value.
28
+ *
29
+ */
30
+ export declare function useSetQuarantineStatusMutation<T extends keyof SetQuarantineStatusProps>(props: Pick<Partial<SetQuarantineStatusProps>, T>, options?: Omit<UseMutationOptions<SetQuarantineStatusResponseContainer, SetQuarantineStatusErrorResponse, SetQuarantineStatusMutationProps<T>>, 'mutationKey' | 'mutationFn'>): import("@tanstack/react-query").UseMutationResult<SetQuarantineStatusResponseContainer, import("..").Error, SetQuarantineStatusMutationProps<T>, unknown>;
@@ -0,0 +1,15 @@
1
+ /* eslint-disable */
2
+ // This code is autogenerated using @harnessio/oats-cli.
3
+ // Please do not modify this code directly.
4
+ import { useMutation } from '@tanstack/react-query';
5
+ import { fetcher } from '../../../../custom-fetcher/index.js';
6
+ export function setQuarantineStatus(props) {
7
+ return fetcher(Object.assign({ url: `/test-management/quarantine`, method: 'POST' }, props));
8
+ }
9
+ /**
10
+ * Upserts the quarantine marking for each test in the request body. A `marking` of `"true"` quarantines the test, `"false"` removes the quarantine, and `"unset"` clears any stored value.
11
+ *
12
+ */
13
+ export function useSetQuarantineStatusMutation(props, options) {
14
+ return useMutation((mutateProps) => setQuarantineStatus(Object.assign(Object.assign({}, props), mutateProps)), options);
15
+ }
@@ -0,0 +1,32 @@
1
+ import { UseMutationOptions } from '@tanstack/react-query';
2
+ import type { BadRequestResponse } from '../responses/BadRequestResponse';
3
+ import type { InternalErrorResponse } from '../responses/InternalErrorResponse';
4
+ import type { Policy } from '../schemas/Policy';
5
+ import { FetcherOptions } from '../../../../custom-fetcher/index.js';
6
+ export interface UpsertPoliciesMutationQueryParams {
7
+ accountId: string;
8
+ orgId: string;
9
+ projectId: string;
10
+ repo: string;
11
+ }
12
+ export type UpsertPoliciesRequestBody = Policy[];
13
+ export type UpsertPoliciesOkResponse = {
14
+ count?: number;
15
+ message?: string;
16
+ };
17
+ export type UpsertPoliciesErrorResponse = BadRequestResponse | InternalErrorResponse;
18
+ export interface UpsertPoliciesProps extends Omit<FetcherOptions<UpsertPoliciesMutationQueryParams, UpsertPoliciesRequestBody>, 'url'> {
19
+ queryParams: UpsertPoliciesMutationQueryParams;
20
+ body: UpsertPoliciesRequestBody;
21
+ }
22
+ export interface UpsertPoliciesResponseContainer {
23
+ body: UpsertPoliciesOkResponse;
24
+ headers: Headers;
25
+ }
26
+ export declare function upsertPolicies(props: UpsertPoliciesProps): Promise<UpsertPoliciesResponseContainer>;
27
+ export type UpsertPoliciesMutationProps<T extends keyof UpsertPoliciesProps> = Omit<UpsertPoliciesProps, T> & Partial<Pick<UpsertPoliciesProps, T>>;
28
+ /**
29
+ * Replaces all policies for the given account, org, project, and repo scope with the supplied list. Sending an empty array clears all policies. Each policy must have at least one rule condition and one action. Valid rule conditions: `"test is flaky"`, `"test is slow"`, `"test failed"`, `"passes ? consecutive times on ? branch"`, `"failed more than ? times on ? branch"`, `"test passed and failed on the same commit"`. Valid actions: `"mark quarantine"`, `"mark unquarantine"`, `"unmark quarantine"`, `"mark flaky"`, `"mark unflaky"`, `"unmark flaky"`.
30
+ *
31
+ */
32
+ export declare function useUpsertPoliciesMutation<T extends keyof UpsertPoliciesProps>(props: Pick<Partial<UpsertPoliciesProps>, T>, options?: Omit<UseMutationOptions<UpsertPoliciesResponseContainer, UpsertPoliciesErrorResponse, UpsertPoliciesMutationProps<T>>, 'mutationKey' | 'mutationFn'>): import("@tanstack/react-query").UseMutationResult<UpsertPoliciesResponseContainer, import("..").Error, UpsertPoliciesMutationProps<T>, unknown>;
@@ -0,0 +1,15 @@
1
+ /* eslint-disable */
2
+ // This code is autogenerated using @harnessio/oats-cli.
3
+ // Please do not modify this code directly.
4
+ import { useMutation } from '@tanstack/react-query';
5
+ import { fetcher } from '../../../../custom-fetcher/index.js';
6
+ export function upsertPolicies(props) {
7
+ return fetcher(Object.assign({ url: `/test-management/policies`, method: 'PUT' }, props));
8
+ }
9
+ /**
10
+ * Replaces all policies for the given account, org, project, and repo scope with the supplied list. Sending an empty array clears all policies. Each policy must have at least one rule condition and one action. Valid rule conditions: `"test is flaky"`, `"test is slow"`, `"test failed"`, `"passes ? consecutive times on ? branch"`, `"failed more than ? times on ? branch"`, `"test passed and failed on the same commit"`. Valid actions: `"mark quarantine"`, `"mark unquarantine"`, `"unmark quarantine"`, `"mark flaky"`, `"mark unflaky"`, `"unmark flaky"`.
11
+ *
12
+ */
13
+ export function useUpsertPoliciesMutation(props, options) {
14
+ return useMutation((mutateProps) => upsertPolicies(Object.assign(Object.assign({}, props), mutateProps)), options);
15
+ }
@@ -1,7 +1,15 @@
1
+ export type { GetAllTestMarkingsErrorResponse, GetAllTestMarkingsOkResponse, GetAllTestMarkingsProps, GetAllTestMarkingsQueryQueryParams, } from './hooks/useGetAllTestMarkingsQuery';
2
+ export { getAllTestMarkings, useGetAllTestMarkingsQuery } from './hooks/useGetAllTestMarkingsQuery';
1
3
  export type { GetCoverageHistoryErrorResponse, GetCoverageHistoryOkResponse, GetCoverageHistoryProps, GetCoverageHistoryQueryPathParams, GetCoverageHistoryQueryQueryParams, } from './hooks/useGetCoverageHistoryQuery';
2
4
  export { getCoverageHistory, useGetCoverageHistoryQuery } from './hooks/useGetCoverageHistoryQuery';
3
5
  export type { GetExecutionCoverageReportErrorResponse, GetExecutionCoverageReportOkResponse, GetExecutionCoverageReportProps, GetExecutionCoverageReportQueryPathParams, GetExecutionCoverageReportQueryQueryParams, } from './hooks/useGetExecutionCoverageReportQuery';
4
6
  export { getExecutionCoverageReport, useGetExecutionCoverageReportQuery, } from './hooks/useGetExecutionCoverageReportQuery';
7
+ export type { GetFlakyTestsErrorResponse, GetFlakyTestsOkResponse, GetFlakyTestsProps, GetFlakyTestsQueryQueryParams, } from './hooks/useGetFlakyTestsQuery';
8
+ export { getFlakyTests, useGetFlakyTestsQuery } from './hooks/useGetFlakyTestsQuery';
9
+ export type { GetPoliciesErrorResponse, GetPoliciesOkResponse, GetPoliciesProps, GetPoliciesQueryQueryParams, } from './hooks/useGetPoliciesQuery';
10
+ export { getPolicies, useGetPoliciesQuery } from './hooks/useGetPoliciesQuery';
11
+ export type { GetTestManagementRepositoriesErrorResponse, GetTestManagementRepositoriesOkResponse, GetTestManagementRepositoriesProps, GetTestManagementRepositoriesQueryQueryParams, } from './hooks/useGetTestManagementRepositoriesQuery';
12
+ export { getTestManagementRepositories, useGetTestManagementRepositoriesQuery, } from './hooks/useGetTestManagementRepositoriesQuery';
5
13
  export type { GetTokenErrorResponse, GetTokenOkResponse, GetTokenProps, GetTokenQueryQueryParams, } from './hooks/useGetTokenQuery';
6
14
  export { getToken, useGetTokenQuery } from './hooks/useGetTokenQuery';
7
15
  export type { PatchCoverageFilesErrorResponse, PatchCoverageFilesOkResponse, PatchCoverageFilesProps, PatchCoverageFilesQueryPathParams, PatchCoverageFilesQueryQueryParams, } from './hooks/usePatchCoverageFilesQuery';
@@ -12,12 +20,18 @@ export type { ReportsInfoErrorResponse, ReportsInfoOkResponse, ReportsInfoProps,
12
20
  export { reportsInfo, useReportsInfoQuery } from './hooks/useReportsInfoQuery';
13
21
  export type { SearchCoverageFilesErrorResponse, SearchCoverageFilesOkResponse, SearchCoverageFilesProps, SearchCoverageFilesQueryPathParams, SearchCoverageFilesQueryQueryParams, } from './hooks/useSearchCoverageFilesQuery';
14
22
  export { searchCoverageFiles, useSearchCoverageFilesQuery, } from './hooks/useSearchCoverageFilesQuery';
23
+ export type { SetFlakyStatusErrorResponse, SetFlakyStatusMutationProps, SetFlakyStatusMutationQueryParams, SetFlakyStatusOkResponse, SetFlakyStatusProps, SetFlakyStatusRequestBody, } from './hooks/useSetFlakyStatusMutation';
24
+ export { setFlakyStatus, useSetFlakyStatusMutation } from './hooks/useSetFlakyStatusMutation';
25
+ export type { SetQuarantineStatusErrorResponse, SetQuarantineStatusMutationProps, SetQuarantineStatusMutationQueryParams, SetQuarantineStatusOkResponse, SetQuarantineStatusProps, SetQuarantineStatusRequestBody, } from './hooks/useSetQuarantineStatusMutation';
26
+ export { setQuarantineStatus, useSetQuarantineStatusMutation, } from './hooks/useSetQuarantineStatusMutation';
15
27
  export type { TestCaseSummaryV2ErrorResponse, TestCaseSummaryV2OkResponse, TestCaseSummaryV2Props, TestCaseSummaryV2QueryQueryParams, } from './hooks/useTestCaseSummaryV2Query';
16
28
  export { testCaseSummaryV2, useTestCaseSummaryV2Query } from './hooks/useTestCaseSummaryV2Query';
17
29
  export type { TestInfoErrorResponse, TestInfoOkResponse, TestInfoProps, TestInfoQueryQueryParams, } from './hooks/useTestInfoQuery';
18
30
  export { testInfo, useTestInfoQuery } from './hooks/useTestInfoQuery';
19
31
  export type { TestOverviewErrorResponse, TestOverviewOkResponse, TestOverviewProps, TestOverviewQueryQueryParams, } from './hooks/useTestOverviewQuery';
20
32
  export { testOverview, useTestOverviewQuery } from './hooks/useTestOverviewQuery';
33
+ export type { UpsertPoliciesErrorResponse, UpsertPoliciesMutationProps, UpsertPoliciesMutationQueryParams, UpsertPoliciesOkResponse, UpsertPoliciesProps, UpsertPoliciesRequestBody, } from './hooks/useUpsertPoliciesMutation';
34
+ export { upsertPolicies, useUpsertPoliciesMutation } from './hooks/useUpsertPoliciesMutation';
21
35
  export type { BadRequestResponse } from './responses/BadRequestResponse';
22
36
  export type { InternalErrorResponse } from './responses/InternalErrorResponse';
23
37
  export type { NotFoundResponse } from './responses/NotFoundResponse';
@@ -29,10 +43,17 @@ export type { CoverageMetric } from './schemas/CoverageMetric';
29
43
  export type { CoverageSummary } from './schemas/CoverageSummary';
30
44
  export type { Error } from './schemas/Error';
31
45
  export type { ItemSummary } from './schemas/ItemSummary';
46
+ export type { MarkedTest } from './schemas/MarkedTest';
47
+ export type { MarkedTestsResponse } from './schemas/MarkedTestsResponse';
48
+ export type { Pagination } from './schemas/Pagination';
32
49
  export type { PatchFilesResponse } from './schemas/PatchFilesResponse';
33
50
  export type { PatchSummary } from './schemas/PatchSummary';
34
51
  export type { PipelineExecutionReport } from './schemas/PipelineExecutionReport';
52
+ export type { PoliciesResponse } from './schemas/PoliciesResponse';
53
+ export type { Policy } from './schemas/Policy';
35
54
  export type { ReportOutput } from './schemas/ReportOutput';
55
+ export type { RepositoriesResponse } from './schemas/RepositoriesResponse';
56
+ export type { Repository } from './schemas/Repository';
36
57
  export type { ResponseMetadata } from './schemas/ResponseMetadata';
37
58
  export type { Result } from './schemas/Result';
38
59
  export type { SearchResults } from './schemas/SearchResults';
@@ -42,4 +63,8 @@ export type { StepInfo } from './schemas/StepInfo';
42
63
  export type { TestCase } from './schemas/TestCase';
43
64
  export type { TestCaseStatus } from './schemas/TestCaseStatus';
44
65
  export type { TestCases } from './schemas/TestCases';
66
+ export type { TestMarkingDetail } from './schemas/TestMarkingDetail';
67
+ export type { TestMarkingRequest } from './schemas/TestMarkingRequest';
68
+ export type { TestMarkingResponse } from './schemas/TestMarkingResponse';
69
+ export type { TestMarkingsResponse } from './schemas/TestMarkingsResponse';
45
70
  export type { TestReportSummary } from './schemas/TestReportSummary';
@@ -1,10 +1,17 @@
1
+ export { getAllTestMarkings, useGetAllTestMarkingsQuery } from './hooks/useGetAllTestMarkingsQuery';
1
2
  export { getCoverageHistory, useGetCoverageHistoryQuery } from './hooks/useGetCoverageHistoryQuery';
2
3
  export { getExecutionCoverageReport, useGetExecutionCoverageReportQuery, } from './hooks/useGetExecutionCoverageReportQuery';
4
+ export { getFlakyTests, useGetFlakyTestsQuery } from './hooks/useGetFlakyTestsQuery';
5
+ export { getPolicies, useGetPoliciesQuery } from './hooks/useGetPoliciesQuery';
6
+ export { getTestManagementRepositories, useGetTestManagementRepositoriesQuery, } from './hooks/useGetTestManagementRepositoriesQuery';
3
7
  export { getToken, useGetTokenQuery } from './hooks/useGetTokenQuery';
4
8
  export { patchCoverageFiles, usePatchCoverageFilesQuery } from './hooks/usePatchCoverageFilesQuery';
5
9
  export { reportSummary, useReportSummaryQuery } from './hooks/useReportSummaryQuery';
6
10
  export { reportsInfo, useReportsInfoQuery } from './hooks/useReportsInfoQuery';
7
11
  export { searchCoverageFiles, useSearchCoverageFilesQuery, } from './hooks/useSearchCoverageFilesQuery';
12
+ export { setFlakyStatus, useSetFlakyStatusMutation } from './hooks/useSetFlakyStatusMutation';
13
+ export { setQuarantineStatus, useSetQuarantineStatusMutation, } from './hooks/useSetQuarantineStatusMutation';
8
14
  export { testCaseSummaryV2, useTestCaseSummaryV2Query } from './hooks/useTestCaseSummaryV2Query';
9
15
  export { testInfo, useTestInfoQuery } from './hooks/useTestInfoQuery';
10
16
  export { testOverview, useTestOverviewQuery } from './hooks/useTestOverviewQuery';
17
+ export { upsertPolicies, useUpsertPoliciesMutation } from './hooks/useUpsertPoliciesMutation';
@@ -0,0 +1,21 @@
1
+ /**
2
+ * A test that has been marked as flaky or quarantined
3
+ */
4
+ export interface MarkedTest {
5
+ /**
6
+ * Fully-qualified class name of the test
7
+ */
8
+ class_name?: string;
9
+ /**
10
+ * Suite the test belongs to (omitted when empty)
11
+ */
12
+ suite_name?: string;
13
+ /**
14
+ * Deterministic hash that uniquely identifies the test
15
+ */
16
+ test_id?: string;
17
+ /**
18
+ * Name of the test method
19
+ */
20
+ test_name?: string;
21
+ }
@@ -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,9 @@
1
+ import type { Pagination } from '../schemas/Pagination';
2
+ import type { MarkedTest } from '../schemas/MarkedTest';
3
+ /**
4
+ * Paginated list of marked (flaky or quarantined) tests
5
+ */
6
+ export interface MarkedTestsResponse {
7
+ pagination?: Pagination;
8
+ tests?: MarkedTest[];
9
+ }
@@ -0,0 +1,18 @@
1
+ export interface Pagination {
2
+ /**
3
+ * Current page index (0-based)
4
+ */
5
+ pageIndex?: number;
6
+ /**
7
+ * Maximum number of items per page
8
+ */
9
+ pageSize?: number;
10
+ /**
11
+ * Total number of items matching the query
12
+ */
13
+ totalItems?: number;
14
+ /**
15
+ * Total number of pages
16
+ */
17
+ totalPages?: number;
18
+ }
@@ -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 { Policy } from '../schemas/Policy';
2
+ /**
3
+ * List of policies for a scope
4
+ */
5
+ export interface PoliciesResponse {
6
+ policies?: Policy[];
7
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * An automation policy that triggers actions when rule conditions are met. Parameterized conditions (containing `?`) require a corresponding entry in `values` at the same index.
3
+ *
4
+ */
5
+ export interface Policy {
6
+ /**
7
+ * One or more actions to apply. Valid values: "mark quarantine", "mark unquarantine", "unmark quarantine", "mark flaky", "mark unflaky", "unmark flaky".
8
+ *
9
+ */
10
+ action: string[];
11
+ /**
12
+ * One or more rule conditions. Valid values: "test is flaky", "test is slow", "test failed", "passes ? consecutive times on ? branch", "failed more than ? times on ? branch", "test passed and failed on the same commit".
13
+ *
14
+ */
15
+ rule: string[];
16
+ /**
17
+ * Optional. Values to substitute for `?` placeholders in parameterized rule conditions. Index corresponds to the rule condition at the same position.
18
+ *
19
+ */
20
+ values?: Array<Array<{}>>;
21
+ }
@@ -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,9 @@
1
+ import type { Pagination } from '../schemas/Pagination';
2
+ import type { Repository } from '../schemas/Repository';
3
+ /**
4
+ * Paginated list of repositories with test markings
5
+ */
6
+ export interface RepositoriesResponse {
7
+ pagination?: Pagination;
8
+ repositories?: Repository[];
9
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * A repository that has at least one test marking
3
+ */
4
+ export interface Repository {
5
+ /**
6
+ * Repository identifier (e.g. "github.com/org/repo")
7
+ * @example "github.com/harness/harness-core"
8
+ */
9
+ name: string;
10
+ }
@@ -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,37 @@
1
+ /**
2
+ * A test together with both its flaky and quarantine markings
3
+ */
4
+ export interface TestMarkingDetail {
5
+ /**
6
+ * Fully-qualified class name of the test
7
+ */
8
+ class_name?: string;
9
+ /**
10
+ * Optional reason the test was marked flaky
11
+ */
12
+ flaky_reason?: string | null;
13
+ /**
14
+ * true = flaky, false = not flaky, null = not marked
15
+ */
16
+ flaky_status?: boolean | null;
17
+ /**
18
+ * Optional reason the test was quarantined
19
+ */
20
+ quarantine_reason?: string | null;
21
+ /**
22
+ * true = quarantined, false = not quarantined, null = not marked
23
+ */
24
+ quarantine_status?: boolean | null;
25
+ /**
26
+ * Suite the test belongs to (omitted when empty)
27
+ */
28
+ suite_name?: string;
29
+ /**
30
+ * Deterministic hash that uniquely identifies the test
31
+ */
32
+ test_id?: string;
33
+ /**
34
+ * Name of the test method
35
+ */
36
+ test_name?: string;
37
+ }
@@ -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,24 @@
1
+ /**
2
+ * Request payload for setting flaky or quarantine status on a single test
3
+ */
4
+ export interface TestMarkingRequest {
5
+ /**
6
+ * Fully-qualified class name of the test
7
+ * @example "com.example.MyTest"
8
+ */
9
+ class_name: string;
10
+ /**
11
+ * Desired marking state
12
+ */
13
+ marking: 'false' | 'true' | 'unset';
14
+ /**
15
+ * Suite (module) the test belongs to
16
+ * @example "unit"
17
+ */
18
+ suite_name?: string;
19
+ /**
20
+ * Name of the test method
21
+ * @example "shouldReturnTrue"
22
+ */
23
+ test_name: string;
24
+ }
@@ -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,15 @@
1
+ /**
2
+ * Response returned after a set-flaky or set-quarantine operation
3
+ */
4
+ export interface TestMarkingResponse {
5
+ /**
6
+ * Human-readable summary
7
+ * @example "Successfully updated flaky status for 3 test(s)"
8
+ */
9
+ message?: string;
10
+ /**
11
+ * Number of tests whose status was updated
12
+ * @example 3
13
+ */
14
+ updated?: number;
15
+ }
@@ -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,19 @@
1
+ import type { Pagination } from '../schemas/Pagination';
2
+ import type { TestMarkingDetail } from '../schemas/TestMarkingDetail';
3
+ /**
4
+ * Paginated list of tests with their combined markings
5
+ */
6
+ export interface TestMarkingsResponse {
7
+ pagination?: Pagination;
8
+ tests?: TestMarkingDetail[];
9
+ /**
10
+ * Total number of tests marked as flaky in the repository (independent of pagination and filters)
11
+ * @example 12
12
+ */
13
+ totalFlaky?: number;
14
+ /**
15
+ * Total number of tests marked as quarantined in the repository (independent of pagination and filters)
16
+ * @example 5
17
+ */
18
+ totalQuarantine?: number;
19
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harnessio/react-ti-service-client",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "description": "Harness React TI service client - TI APIs integrated with react hooks",
5
5
  "author": "Harness Inc",
6
6
  "license": "MIT",