@harnessio/react-hhi-armory-service-client 0.0.0-stage → 0.1.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.
- package/README.md +57 -2
- package/dist/fetcher/index.d.ts +17 -0
- package/dist/fetcher/index.js +65 -0
- package/dist/hhi-armory-service/src/index.d.ts +6 -0
- package/dist/hhi-armory-service/src/index.js +10 -0
- package/dist/hhi-armory-service/src/services/helpers.d.ts +14 -0
- package/dist/hhi-armory-service/src/services/helpers.js +1 -0
- package/dist/hhi-armory-service/src/services/hooks/useHardeningGetArtifactsSummaryQuery.d.ts +29 -0
- package/dist/hhi-armory-service/src/services/hooks/useHardeningGetArtifactsSummaryQuery.js +16 -0
- package/dist/hhi-armory-service/src/services/hooks/useHardeningListArtifactsQuery.d.ts +51 -0
- package/dist/hhi-armory-service/src/services/hooks/useHardeningListArtifactsQuery.js +15 -0
- package/dist/hhi-armory-service/src/services/hooks/useMigrationCreateMigrationMutation.d.ts +33 -0
- package/dist/hhi-armory-service/src/services/hooks/useMigrationCreateMigrationMutation.js +16 -0
- package/dist/hhi-armory-service/src/services/hooks/useMigrationGetMigrationQuery.d.ts +33 -0
- package/dist/hhi-armory-service/src/services/hooks/useMigrationGetMigrationQuery.js +15 -0
- package/dist/hhi-armory-service/src/services/hooks/useMigrationListMigrationsQuery.d.ts +41 -0
- package/dist/hhi-armory-service/src/services/hooks/useMigrationListMigrationsQuery.js +14 -0
- package/dist/hhi-armory-service/src/services/index.d.ts +49 -0
- package/dist/hhi-armory-service/src/services/index.js +5 -0
- package/dist/hhi-armory-service/src/services/responses/BadRequestResponse.d.ts +2 -0
- package/dist/hhi-armory-service/src/services/responses/BadRequestResponse.js +1 -0
- package/dist/hhi-armory-service/src/services/responses/ConflictResponse.d.ts +2 -0
- package/dist/hhi-armory-service/src/services/responses/ConflictResponse.js +1 -0
- package/dist/hhi-armory-service/src/services/responses/InternalServerErrorResponse.d.ts +2 -0
- package/dist/hhi-armory-service/src/services/responses/InternalServerErrorResponse.js +1 -0
- package/dist/hhi-armory-service/src/services/responses/NotFoundResponse.d.ts +2 -0
- package/dist/hhi-armory-service/src/services/responses/NotFoundResponse.js +1 -0
- package/dist/hhi-armory-service/src/services/responses/UnauthorizedResponse.d.ts +2 -0
- package/dist/hhi-armory-service/src/services/responses/UnauthorizedResponse.js +1 -0
- package/dist/hhi-armory-service/src/services/schemas/BadRequest.d.ts +7 -0
- package/dist/hhi-armory-service/src/services/schemas/BadRequest.js +4 -0
- package/dist/hhi-armory-service/src/services/schemas/ChangeSummary.d.ts +4 -0
- package/dist/hhi-armory-service/src/services/schemas/ChangeSummary.js +4 -0
- package/dist/hhi-armory-service/src/services/schemas/CheckStatus.d.ts +4 -0
- package/dist/hhi-armory-service/src/services/schemas/CheckStatus.js +4 -0
- package/dist/hhi-armory-service/src/services/schemas/Conflict.d.ts +7 -0
- package/dist/hhi-armory-service/src/services/schemas/Conflict.js +4 -0
- package/dist/hhi-armory-service/src/services/schemas/CreateMigrationRequest.d.ts +32 -0
- package/dist/hhi-armory-service/src/services/schemas/CreateMigrationRequest.js +1 -0
- package/dist/hhi-armory-service/src/services/schemas/CveDiff.d.ts +8 -0
- package/dist/hhi-armory-service/src/services/schemas/CveDiff.js +1 -0
- package/dist/hhi-armory-service/src/services/schemas/CveDiffRow.d.ts +11 -0
- package/dist/hhi-armory-service/src/services/schemas/CveDiffRow.js +4 -0
- package/dist/hhi-armory-service/src/services/schemas/CveSeverityCounts.d.ts +22 -0
- package/dist/hhi-armory-service/src/services/schemas/CveSeverityCounts.js +4 -0
- package/dist/hhi-armory-service/src/services/schemas/DownloadStats.d.ts +10 -0
- package/dist/hhi-armory-service/src/services/schemas/DownloadStats.js +4 -0
- package/dist/hhi-armory-service/src/services/schemas/HardeningArtifactItem.d.ts +35 -0
- package/dist/hhi-armory-service/src/services/schemas/HardeningArtifactItem.js +1 -0
- package/dist/hhi-armory-service/src/services/schemas/HardeningArtifactsListResponse.d.ts +6 -0
- package/dist/hhi-armory-service/src/services/schemas/HardeningArtifactsListResponse.js +1 -0
- package/dist/hhi-armory-service/src/services/schemas/HardeningArtifactsSummaryResponse.d.ts +18 -0
- package/dist/hhi-armory-service/src/services/schemas/HardeningArtifactsSummaryResponse.js +1 -0
- package/dist/hhi-armory-service/src/services/schemas/ImageRefPair.d.ts +3 -0
- package/dist/hhi-armory-service/src/services/schemas/ImageRefPair.js +4 -0
- package/dist/hhi-armory-service/src/services/schemas/ImageUsedEntry.d.ts +8 -0
- package/dist/hhi-armory-service/src/services/schemas/ImageUsedEntry.js +4 -0
- package/dist/hhi-armory-service/src/services/schemas/InternalServerError.d.ts +7 -0
- package/dist/hhi-armory-service/src/services/schemas/InternalServerError.js +4 -0
- package/dist/hhi-armory-service/src/services/schemas/MigrationChecks.d.ts +7 -0
- package/dist/hhi-armory-service/src/services/schemas/MigrationChecks.js +1 -0
- package/dist/hhi-armory-service/src/services/schemas/MigrationDetail.d.ts +19 -0
- package/dist/hhi-armory-service/src/services/schemas/MigrationDetail.js +1 -0
- package/dist/hhi-armory-service/src/services/schemas/MigrationFailure.d.ts +3 -0
- package/dist/hhi-armory-service/src/services/schemas/MigrationFailure.js +4 -0
- package/dist/hhi-armory-service/src/services/schemas/MigrationListResponse.d.ts +6 -0
- package/dist/hhi-armory-service/src/services/schemas/MigrationListResponse.js +1 -0
- package/dist/hhi-armory-service/src/services/schemas/MigrationScmConfig.d.ts +12 -0
- package/dist/hhi-armory-service/src/services/schemas/MigrationScmConfig.js +4 -0
- package/dist/hhi-armory-service/src/services/schemas/MigrationSnippet.d.ts +6 -0
- package/dist/hhi-armory-service/src/services/schemas/MigrationSnippet.js +1 -0
- package/dist/hhi-armory-service/src/services/schemas/MigrationSummary.d.ts +36 -0
- package/dist/hhi-armory-service/src/services/schemas/MigrationSummary.js +1 -0
- package/dist/hhi-armory-service/src/services/schemas/NotFound.d.ts +7 -0
- package/dist/hhi-armory-service/src/services/schemas/NotFound.js +4 -0
- package/dist/hhi-armory-service/src/services/schemas/Pagination.d.ts +14 -0
- package/dist/hhi-armory-service/src/services/schemas/Pagination.js +4 -0
- package/dist/hhi-armory-service/src/services/schemas/PinnedImage.d.ts +4 -0
- package/dist/hhi-armory-service/src/services/schemas/PinnedImage.js +4 -0
- package/dist/hhi-armory-service/src/services/schemas/PrReference.d.ts +21 -0
- package/dist/hhi-armory-service/src/services/schemas/PrReference.js +4 -0
- package/dist/hhi-armory-service/src/services/schemas/RuntimeEnvironment.d.ts +6 -0
- package/dist/hhi-armory-service/src/services/schemas/RuntimeEnvironment.js +4 -0
- package/dist/hhi-armory-service/src/services/schemas/RuntimeTest.d.ts +8 -0
- package/dist/hhi-armory-service/src/services/schemas/RuntimeTest.js +1 -0
- package/dist/hhi-armory-service/src/services/schemas/RuntimeTestCheck.d.ts +10 -0
- package/dist/hhi-armory-service/src/services/schemas/RuntimeTestCheck.js +4 -0
- package/dist/hhi-armory-service/src/services/schemas/RuntimeTestResult.d.ts +4 -0
- package/dist/hhi-armory-service/src/services/schemas/RuntimeTestResult.js +4 -0
- package/dist/hhi-armory-service/src/services/schemas/RuntimeTestsBlock.d.ts +6 -0
- package/dist/hhi-armory-service/src/services/schemas/RuntimeTestsBlock.js +1 -0
- package/dist/hhi-armory-service/src/services/schemas/SupplyChainInfo.d.ts +11 -0
- package/dist/hhi-armory-service/src/services/schemas/SupplyChainInfo.js +1 -0
- package/dist/hhi-armory-service/src/services/schemas/Unauthorized.d.ts +7 -0
- package/dist/hhi-armory-service/src/services/schemas/Unauthorized.js +4 -0
- package/package.json +32 -4
package/README.md
CHANGED
|
@@ -1,3 +1,58 @@
|
|
|
1
|
-
#
|
|
1
|
+
# React HHI Armory Service Client (WIP)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**OpenAPI → OA · TypeScript → TS · OpenAPI + TypeScript → OATS**
|
|
4
|
+
|
|
5
|
+
HHI Armory (Hardening Agent) APIs and types generated from OpenAPI using `OATS CLI`. Hooks use `@tanstack/react-query`.
|
|
6
|
+
|
|
7
|
+
Contract: [Hardening agent API contracts](https://harness.atlassian.net/wiki/spaces/HSA/pages/24484675971/Hardening+agent+API+contracts)
|
|
8
|
+
|
|
9
|
+
## Hooks
|
|
10
|
+
|
|
11
|
+
| Screen | HTTP | Hook |
|
|
12
|
+
|--------|------|------|
|
|
13
|
+
| Artifacts list — summary cards | `GET …/hardening/artifacts/summary` | `useHardeningGetArtifactsSummaryQuery` |
|
|
14
|
+
| Artifacts list — table | `GET …/hardening/artifacts` | `useHardeningListArtifactsQuery` |
|
|
15
|
+
| Harden Artifact panel | `POST …/migrations` (202) | `useMigrationCreateMigrationMutation` |
|
|
16
|
+
| Executions list | `GET …/migrations` | `useMigrationListMigrationsQuery` |
|
|
17
|
+
| View PR drawer | `GET …/migrations/{id}` | `useMigrationGetMigrationQuery` |
|
|
18
|
+
|
|
19
|
+
`GET …/migrations/{id}/execution` is not generated (deferred in Confluence v4).
|
|
20
|
+
|
|
21
|
+
When **hhi-armory** publishes an updated spec, replace `openapi.yaml`, update `allowedOperationIds` in `oats.config.ts`, and run `yarn build`.
|
|
22
|
+
|
|
23
|
+
## Build
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
yarn build
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Platform UI adoption
|
|
30
|
+
|
|
31
|
+
Initialize `HhiArmoryServiceAPIClient` before using hooks:
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import {
|
|
35
|
+
useHardeningListArtifactsQuery,
|
|
36
|
+
HhiArmoryServiceAPIClient,
|
|
37
|
+
} from '@harnessio/react-hhi-armory-service-client';
|
|
38
|
+
|
|
39
|
+
new HhiArmoryServiceAPIClient({
|
|
40
|
+
urlInterceptor: (url) => `${window.apiUrl}/gateway/hhi${url}`,
|
|
41
|
+
getRequestHeaders: () => ({
|
|
42
|
+
token: SessionToken.getToken(),
|
|
43
|
+
'Harness-Account': accountId,
|
|
44
|
+
}),
|
|
45
|
+
});
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Local verification
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
cp .env.example .env
|
|
52
|
+
npm run verify-local
|
|
53
|
+
npm run verify-apis
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Versioning
|
|
57
|
+
|
|
58
|
+

|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
export declare function fetcher<TResponse = unknown, TQueryParams = never, TBody = never, THeaderParams = HeadersInit>(options: FetcherOptions<TQueryParams, TBody, THeaderParams>): Promise<TResponse>;
|
|
@@ -0,0 +1,65 @@
|
|
|
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, _b;
|
|
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 = { account: customHeaders['Harness-Account'] } } = options, rest = __rest(options, ["stringifyQueryParamsOptions", "headers", "body", "url", "queryParams"]);
|
|
25
|
+
const token = customHeaders.token;
|
|
26
|
+
let finalUrl = url;
|
|
27
|
+
if (queryParams) {
|
|
28
|
+
finalUrl += stringify(queryParams, Object.assign(Object.assign({}, stringifyQueryParamsOptions), { addQueryPrefix: true }));
|
|
29
|
+
}
|
|
30
|
+
if (fetcherCallbacks === null || fetcherCallbacks === void 0 ? void 0 : fetcherCallbacks.urlInterceptor) {
|
|
31
|
+
finalUrl = (_a = fetcherCallbacks === null || fetcherCallbacks === void 0 ? void 0 : fetcherCallbacks.urlInterceptor) === null || _a === void 0 ? void 0 : _a.call(fetcherCallbacks, finalUrl);
|
|
32
|
+
}
|
|
33
|
+
let request = new Request(finalUrl, Object.assign({ headers: Object.assign(Object.assign(Object.assign({}, (token ? { Authorization: `Bearer ${token}` } : {})), headers), customHeaders), body: body ? JSON.stringify(body) : undefined }, rest));
|
|
34
|
+
if (fetcherCallbacks === null || fetcherCallbacks === void 0 ? void 0 : fetcherCallbacks.requestInterceptor) {
|
|
35
|
+
request = fetcherCallbacks.requestInterceptor(request.clone());
|
|
36
|
+
}
|
|
37
|
+
let response = yield fetch(request);
|
|
38
|
+
if (fetcherCallbacks === null || fetcherCallbacks === void 0 ? void 0 : fetcherCallbacks.responseInterceptor) {
|
|
39
|
+
response = (_b = fetcherCallbacks === null || fetcherCallbacks === void 0 ? void 0 : fetcherCallbacks.responseInterceptor) === null || _b === void 0 ? void 0 : _b.call(fetcherCallbacks, response.clone());
|
|
40
|
+
}
|
|
41
|
+
const contentType = response.headers.get('Content-Type');
|
|
42
|
+
let total, pageSize, pageNumber, pageCount, pagination;
|
|
43
|
+
try {
|
|
44
|
+
total = response.headers.get('x-total-elements');
|
|
45
|
+
pageSize = response.headers.get('x-page-size');
|
|
46
|
+
pageNumber = response.headers.get('x-page-number');
|
|
47
|
+
pagination = total || pageSize || pageNumber;
|
|
48
|
+
if (pagination) {
|
|
49
|
+
total = Number(total);
|
|
50
|
+
pageSize = Number(pageSize);
|
|
51
|
+
pageCount = Math.ceil(total / pageSize);
|
|
52
|
+
pageNumber = Number(pageNumber);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch (e) {
|
|
56
|
+
throw new Error('HarnessReactAPIClient: An error occurred while parsing pagination headers. ' + e);
|
|
57
|
+
}
|
|
58
|
+
const asJson = contentType && JSON_CONTENT_TYPES.some((h) => contentType.startsWith(h));
|
|
59
|
+
const data = yield (asJson ? response.json() : response.text());
|
|
60
|
+
if (response.ok) {
|
|
61
|
+
return Object.assign({ content: data }, (pagination ? { pagination: { total, pageCount, pageSize, pageNumber } } : {}));
|
|
62
|
+
}
|
|
63
|
+
throw data;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { setupClient, updateClientHeaders } from '../../fetcher';
|
|
2
|
+
export * from './services/index';
|
|
3
|
+
export class HhiArmoryServiceAPIClient {
|
|
4
|
+
constructor(callbacks) {
|
|
5
|
+
setupClient(callbacks);
|
|
6
|
+
this.updateHeaders = (headers) => {
|
|
7
|
+
updateClientHeaders(headers);
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { UseQueryOptions } from '@tanstack/react-query';
|
|
2
|
+
import type { HardeningArtifactsSummaryResponse } from '../schemas/HardeningArtifactsSummaryResponse';
|
|
3
|
+
import type { BadRequestResponse } from '../responses/BadRequestResponse';
|
|
4
|
+
import type { UnauthorizedResponse } from '../responses/UnauthorizedResponse';
|
|
5
|
+
import type { NotFoundResponse } from '../responses/NotFoundResponse';
|
|
6
|
+
import type { InternalServerErrorResponse } from '../responses/InternalServerErrorResponse';
|
|
7
|
+
import type { ResponseWithPagination } from '../helpers';
|
|
8
|
+
import { FetcherOptions } from '../../../../fetcher/index.js';
|
|
9
|
+
export interface HardeningGetArtifactsSummaryQueryPathParams {
|
|
10
|
+
/**
|
|
11
|
+
* @example "default"
|
|
12
|
+
*/
|
|
13
|
+
orgId: string;
|
|
14
|
+
/**
|
|
15
|
+
* @example "my-project"
|
|
16
|
+
*/
|
|
17
|
+
projectId: string;
|
|
18
|
+
}
|
|
19
|
+
export type HardeningGetArtifactsSummaryOkResponse = ResponseWithPagination<HardeningArtifactsSummaryResponse>;
|
|
20
|
+
export type HardeningGetArtifactsSummaryErrorResponse = BadRequestResponse | UnauthorizedResponse | NotFoundResponse | InternalServerErrorResponse;
|
|
21
|
+
export interface HardeningGetArtifactsSummaryProps extends HardeningGetArtifactsSummaryQueryPathParams, Omit<FetcherOptions<unknown, unknown>, 'url'> {
|
|
22
|
+
}
|
|
23
|
+
export declare function hardeningGetArtifactsSummary(props: HardeningGetArtifactsSummaryProps): Promise<HardeningGetArtifactsSummaryOkResponse>;
|
|
24
|
+
/**
|
|
25
|
+
* Artifacts list — header cards. Requires Harness-Account header.
|
|
26
|
+
* `counts` (ready/hardened/no_match) is not served yet. `projectedCves` is omitted until at least one artifact has a projection; `projectedArtifacts` is the count covered.
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
export declare function useHardeningGetArtifactsSummaryQuery(props: HardeningGetArtifactsSummaryProps, options?: Omit<UseQueryOptions<HardeningGetArtifactsSummaryOkResponse, HardeningGetArtifactsSummaryErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<HardeningGetArtifactsSummaryOkResponse, HardeningGetArtifactsSummaryErrorResponse>;
|
|
@@ -0,0 +1,16 @@
|
|
|
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 hardeningGetArtifactsSummary(props) {
|
|
7
|
+
return fetcher(Object.assign({ url: `/api/v1/orgs/${props.orgId}/projects/${props.projectId}/hardening/artifacts/summary`, method: 'GET' }, props));
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Artifacts list — header cards. Requires Harness-Account header.
|
|
11
|
+
* `counts` (ready/hardened/no_match) is not served yet. `projectedCves` is omitted until at least one artifact has a projection; `projectedArtifacts` is the count covered.
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
export function useHardeningGetArtifactsSummaryQuery(props, options) {
|
|
15
|
+
return useQuery(['Hardening#GetArtifactsSummary', props.orgId, props.projectId], ({ signal }) => hardeningGetArtifactsSummary(Object.assign(Object.assign({}, props), { signal })), options);
|
|
16
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { UseQueryOptions } from '@tanstack/react-query';
|
|
2
|
+
import type { HardeningArtifactsListResponse } from '../schemas/HardeningArtifactsListResponse';
|
|
3
|
+
import type { BadRequestResponse } from '../responses/BadRequestResponse';
|
|
4
|
+
import type { UnauthorizedResponse } from '../responses/UnauthorizedResponse';
|
|
5
|
+
import type { NotFoundResponse } from '../responses/NotFoundResponse';
|
|
6
|
+
import type { InternalServerErrorResponse } from '../responses/InternalServerErrorResponse';
|
|
7
|
+
import type { ResponseWithPagination } from '../helpers';
|
|
8
|
+
import { FetcherOptions } from '../../../../fetcher/index.js';
|
|
9
|
+
export interface HardeningListArtifactsQueryPathParams {
|
|
10
|
+
/**
|
|
11
|
+
* @example "default"
|
|
12
|
+
*/
|
|
13
|
+
orgId: string;
|
|
14
|
+
/**
|
|
15
|
+
* @example "my-project"
|
|
16
|
+
*/
|
|
17
|
+
projectId: string;
|
|
18
|
+
}
|
|
19
|
+
export interface HardeningListArtifactsQueryQueryParams {
|
|
20
|
+
tab?: 'hardened' | 'no_match' | 'ready';
|
|
21
|
+
search?: string;
|
|
22
|
+
/**
|
|
23
|
+
* @default "lastScannedAt"
|
|
24
|
+
*/
|
|
25
|
+
sort?: 'lastScannedAt' | 'name' | 'reductionPct';
|
|
26
|
+
/**
|
|
27
|
+
* @default "desc"
|
|
28
|
+
*/
|
|
29
|
+
order?: 'asc' | 'desc';
|
|
30
|
+
/**
|
|
31
|
+
* @format int64
|
|
32
|
+
* @default 0
|
|
33
|
+
*/
|
|
34
|
+
page?: number;
|
|
35
|
+
/**
|
|
36
|
+
* @format int64
|
|
37
|
+
* @default 50
|
|
38
|
+
*/
|
|
39
|
+
pageSize?: number;
|
|
40
|
+
}
|
|
41
|
+
export type HardeningListArtifactsOkResponse = ResponseWithPagination<HardeningArtifactsListResponse>;
|
|
42
|
+
export type HardeningListArtifactsErrorResponse = BadRequestResponse | UnauthorizedResponse | NotFoundResponse | InternalServerErrorResponse;
|
|
43
|
+
export interface HardeningListArtifactsProps extends HardeningListArtifactsQueryPathParams, Omit<FetcherOptions<HardeningListArtifactsQueryQueryParams, unknown>, 'url'> {
|
|
44
|
+
queryParams: HardeningListArtifactsQueryQueryParams;
|
|
45
|
+
}
|
|
46
|
+
export declare function hardeningListArtifacts(props: HardeningListArtifactsProps): Promise<HardeningListArtifactsOkResponse>;
|
|
47
|
+
/**
|
|
48
|
+
* Artifacts list. `tab` query is not served yet (ignored). Poll GET migrations/{id} while a run is in progress.
|
|
49
|
+
*
|
|
50
|
+
*/
|
|
51
|
+
export declare function useHardeningListArtifactsQuery(props: HardeningListArtifactsProps, options?: Omit<UseQueryOptions<HardeningListArtifactsOkResponse, HardeningListArtifactsErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<HardeningListArtifactsOkResponse, HardeningListArtifactsErrorResponse>;
|
|
@@ -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 '../../../../fetcher/index.js';
|
|
6
|
+
export function hardeningListArtifacts(props) {
|
|
7
|
+
return fetcher(Object.assign({ url: `/api/v1/orgs/${props.orgId}/projects/${props.projectId}/hardening/artifacts`, method: 'GET' }, props));
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Artifacts list. `tab` query is not served yet (ignored). Poll GET migrations/{id} while a run is in progress.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
export function useHardeningListArtifactsQuery(props, options) {
|
|
14
|
+
return useQuery(['Hardening#ListArtifacts', props.orgId, props.projectId, props.queryParams], ({ signal }) => hardeningListArtifacts(Object.assign(Object.assign({}, props), { signal })), options);
|
|
15
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { UseMutationOptions } from '@tanstack/react-query';
|
|
2
|
+
import type { MigrationSummary } from '../schemas/MigrationSummary';
|
|
3
|
+
import type { BadRequestResponse } from '../responses/BadRequestResponse';
|
|
4
|
+
import type { UnauthorizedResponse } from '../responses/UnauthorizedResponse';
|
|
5
|
+
import type { NotFoundResponse } from '../responses/NotFoundResponse';
|
|
6
|
+
import type { ConflictResponse } from '../responses/ConflictResponse';
|
|
7
|
+
import type { InternalServerErrorResponse } from '../responses/InternalServerErrorResponse';
|
|
8
|
+
import type { CreateMigrationRequest } from '../schemas/CreateMigrationRequest';
|
|
9
|
+
import type { ResponseWithPagination } from '../helpers';
|
|
10
|
+
import { FetcherOptions } from '../../../../fetcher/index.js';
|
|
11
|
+
export interface MigrationCreateMigrationMutationPathParams {
|
|
12
|
+
/**
|
|
13
|
+
* @example "default"
|
|
14
|
+
*/
|
|
15
|
+
orgId: string;
|
|
16
|
+
/**
|
|
17
|
+
* @example "my-project"
|
|
18
|
+
*/
|
|
19
|
+
projectId: string;
|
|
20
|
+
}
|
|
21
|
+
export type MigrationCreateMigrationRequestBody = CreateMigrationRequest;
|
|
22
|
+
export type MigrationCreateMigrationOkResponse = ResponseWithPagination<MigrationSummary>;
|
|
23
|
+
export type MigrationCreateMigrationErrorResponse = BadRequestResponse | UnauthorizedResponse | NotFoundResponse | ConflictResponse | InternalServerErrorResponse;
|
|
24
|
+
export interface MigrationCreateMigrationProps extends MigrationCreateMigrationMutationPathParams, Omit<FetcherOptions<unknown, MigrationCreateMigrationRequestBody>, 'url'> {
|
|
25
|
+
body: MigrationCreateMigrationRequestBody;
|
|
26
|
+
}
|
|
27
|
+
export declare function migrationCreateMigration(props: MigrationCreateMigrationProps): Promise<MigrationCreateMigrationOkResponse>;
|
|
28
|
+
/**
|
|
29
|
+
* Start harden artifact flow. Requires Harness-Account and Authorization/x-api-key.
|
|
30
|
+
* Returns 202 with migration IN_PROGRESS. Only the first platform in `platforms` runs for now.
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
export declare function useMigrationCreateMigrationMutation(options?: Omit<UseMutationOptions<MigrationCreateMigrationOkResponse, MigrationCreateMigrationErrorResponse, MigrationCreateMigrationProps>, 'mutationKey' | 'mutationFn'>): import("@tanstack/react-query").UseMutationResult<MigrationCreateMigrationOkResponse, MigrationCreateMigrationErrorResponse, MigrationCreateMigrationProps, unknown>;
|
|
@@ -0,0 +1,16 @@
|
|
|
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 '../../../../fetcher/index.js';
|
|
6
|
+
export function migrationCreateMigration(props) {
|
|
7
|
+
return fetcher(Object.assign({ url: `/api/v1/orgs/${props.orgId}/projects/${props.projectId}/migrations`, method: 'POST' }, props));
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Start harden artifact flow. Requires Harness-Account and Authorization/x-api-key.
|
|
11
|
+
* Returns 202 with migration IN_PROGRESS. Only the first platform in `platforms` runs for now.
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
export function useMigrationCreateMigrationMutation(options) {
|
|
15
|
+
return useMutation((mutateProps) => migrationCreateMigration(mutateProps), options);
|
|
16
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { UseQueryOptions } from '@tanstack/react-query';
|
|
2
|
+
import type { MigrationDetail } from '../schemas/MigrationDetail';
|
|
3
|
+
import type { BadRequestResponse } from '../responses/BadRequestResponse';
|
|
4
|
+
import type { UnauthorizedResponse } from '../responses/UnauthorizedResponse';
|
|
5
|
+
import type { NotFoundResponse } from '../responses/NotFoundResponse';
|
|
6
|
+
import type { InternalServerErrorResponse } from '../responses/InternalServerErrorResponse';
|
|
7
|
+
import type { ResponseWithPagination } from '../helpers';
|
|
8
|
+
import { FetcherOptions } from '../../../../fetcher/index.js';
|
|
9
|
+
export interface MigrationGetMigrationQueryPathParams {
|
|
10
|
+
/**
|
|
11
|
+
* @example "default"
|
|
12
|
+
*/
|
|
13
|
+
orgId: string;
|
|
14
|
+
/**
|
|
15
|
+
* @example "my-project"
|
|
16
|
+
*/
|
|
17
|
+
projectId: string;
|
|
18
|
+
/**
|
|
19
|
+
* @format uuid
|
|
20
|
+
* @example "c1a03fe7-1514-40f4-a631-c6df6da2c4f0"
|
|
21
|
+
*/
|
|
22
|
+
id: string;
|
|
23
|
+
}
|
|
24
|
+
export type MigrationGetMigrationOkResponse = ResponseWithPagination<MigrationDetail>;
|
|
25
|
+
export type MigrationGetMigrationErrorResponse = BadRequestResponse | UnauthorizedResponse | NotFoundResponse | InternalServerErrorResponse;
|
|
26
|
+
export interface MigrationGetMigrationProps extends MigrationGetMigrationQueryPathParams, Omit<FetcherOptions<unknown, unknown>, 'url'> {
|
|
27
|
+
}
|
|
28
|
+
export declare function migrationGetMigration(props: MigrationGetMigrationProps): Promise<MigrationGetMigrationOkResponse>;
|
|
29
|
+
/**
|
|
30
|
+
* View PR drawer. Refreshes IN_PROGRESS runs from the pipeline; poll while in progress.
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
export declare function useMigrationGetMigrationQuery(props: MigrationGetMigrationProps, options?: Omit<UseQueryOptions<MigrationGetMigrationOkResponse, MigrationGetMigrationErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<MigrationGetMigrationOkResponse, MigrationGetMigrationErrorResponse>;
|
|
@@ -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 '../../../../fetcher/index.js';
|
|
6
|
+
export function migrationGetMigration(props) {
|
|
7
|
+
return fetcher(Object.assign({ url: `/api/v1/orgs/${props.orgId}/projects/${props.projectId}/migrations/${props.id}`, method: 'GET' }, props));
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* View PR drawer. Refreshes IN_PROGRESS runs from the pipeline; poll while in progress.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
export function useMigrationGetMigrationQuery(props, options) {
|
|
14
|
+
return useQuery(['Migration#GetMigration', props.orgId, props.projectId, props.id], ({ signal }) => migrationGetMigration(Object.assign(Object.assign({}, props), { signal })), options);
|
|
15
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { UseQueryOptions } from '@tanstack/react-query';
|
|
2
|
+
import type { MigrationListResponse } from '../schemas/MigrationListResponse';
|
|
3
|
+
import type { BadRequestResponse } from '../responses/BadRequestResponse';
|
|
4
|
+
import type { UnauthorizedResponse } from '../responses/UnauthorizedResponse';
|
|
5
|
+
import type { NotFoundResponse } from '../responses/NotFoundResponse';
|
|
6
|
+
import type { InternalServerErrorResponse } from '../responses/InternalServerErrorResponse';
|
|
7
|
+
import type { ResponseWithPagination } from '../helpers';
|
|
8
|
+
import { FetcherOptions } from '../../../../fetcher/index.js';
|
|
9
|
+
export interface MigrationListMigrationsQueryPathParams {
|
|
10
|
+
/**
|
|
11
|
+
* @example "default"
|
|
12
|
+
*/
|
|
13
|
+
orgId: string;
|
|
14
|
+
/**
|
|
15
|
+
* @example "my-project"
|
|
16
|
+
*/
|
|
17
|
+
projectId: string;
|
|
18
|
+
}
|
|
19
|
+
export interface MigrationListMigrationsQueryQueryParams {
|
|
20
|
+
search?: string;
|
|
21
|
+
/**
|
|
22
|
+
* @format int64
|
|
23
|
+
* @default 0
|
|
24
|
+
*/
|
|
25
|
+
page?: number;
|
|
26
|
+
/**
|
|
27
|
+
* @format int64
|
|
28
|
+
* @default 50
|
|
29
|
+
*/
|
|
30
|
+
pageSize?: number;
|
|
31
|
+
}
|
|
32
|
+
export type MigrationListMigrationsOkResponse = ResponseWithPagination<MigrationListResponse>;
|
|
33
|
+
export type MigrationListMigrationsErrorResponse = BadRequestResponse | UnauthorizedResponse | NotFoundResponse | InternalServerErrorResponse;
|
|
34
|
+
export interface MigrationListMigrationsProps extends MigrationListMigrationsQueryPathParams, Omit<FetcherOptions<MigrationListMigrationsQueryQueryParams, unknown>, 'url'> {
|
|
35
|
+
queryParams: MigrationListMigrationsQueryQueryParams;
|
|
36
|
+
}
|
|
37
|
+
export declare function migrationListMigrations(props: MigrationListMigrationsProps): Promise<MigrationListMigrationsOkResponse>;
|
|
38
|
+
/**
|
|
39
|
+
* Hardening Agent executions list; does not refresh status from pipeline (use GET migrations/{id}).
|
|
40
|
+
*/
|
|
41
|
+
export declare function useMigrationListMigrationsQuery(props: MigrationListMigrationsProps, options?: Omit<UseQueryOptions<MigrationListMigrationsOkResponse, MigrationListMigrationsErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<MigrationListMigrationsOkResponse, MigrationListMigrationsErrorResponse>;
|
|
@@ -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 '../../../../fetcher/index.js';
|
|
6
|
+
export function migrationListMigrations(props) {
|
|
7
|
+
return fetcher(Object.assign({ url: `/api/v1/orgs/${props.orgId}/projects/${props.projectId}/migrations`, method: 'GET' }, props));
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Hardening Agent executions list; does not refresh status from pipeline (use GET migrations/{id}).
|
|
11
|
+
*/
|
|
12
|
+
export function useMigrationListMigrationsQuery(props, options) {
|
|
13
|
+
return useQuery(['Migration#ListMigrations', props.orgId, props.projectId, props.queryParams], ({ signal }) => migrationListMigrations(Object.assign(Object.assign({}, props), { signal })), options);
|
|
14
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export type { GetPathParamsType, ResponseWithPagination } from './helpers';
|
|
2
|
+
export type { HardeningGetArtifactsSummaryErrorResponse, HardeningGetArtifactsSummaryOkResponse, HardeningGetArtifactsSummaryProps, HardeningGetArtifactsSummaryQueryPathParams, } from './hooks/useHardeningGetArtifactsSummaryQuery';
|
|
3
|
+
export { hardeningGetArtifactsSummary, useHardeningGetArtifactsSummaryQuery, } from './hooks/useHardeningGetArtifactsSummaryQuery';
|
|
4
|
+
export type { HardeningListArtifactsErrorResponse, HardeningListArtifactsOkResponse, HardeningListArtifactsProps, HardeningListArtifactsQueryPathParams, HardeningListArtifactsQueryQueryParams, } from './hooks/useHardeningListArtifactsQuery';
|
|
5
|
+
export { hardeningListArtifacts, useHardeningListArtifactsQuery, } from './hooks/useHardeningListArtifactsQuery';
|
|
6
|
+
export type { MigrationCreateMigrationErrorResponse, MigrationCreateMigrationMutationPathParams, MigrationCreateMigrationOkResponse, MigrationCreateMigrationProps, MigrationCreateMigrationRequestBody, } from './hooks/useMigrationCreateMigrationMutation';
|
|
7
|
+
export { migrationCreateMigration, useMigrationCreateMigrationMutation, } from './hooks/useMigrationCreateMigrationMutation';
|
|
8
|
+
export type { MigrationGetMigrationErrorResponse, MigrationGetMigrationOkResponse, MigrationGetMigrationProps, MigrationGetMigrationQueryPathParams, } from './hooks/useMigrationGetMigrationQuery';
|
|
9
|
+
export { migrationGetMigration, useMigrationGetMigrationQuery, } from './hooks/useMigrationGetMigrationQuery';
|
|
10
|
+
export type { MigrationListMigrationsErrorResponse, MigrationListMigrationsOkResponse, MigrationListMigrationsProps, MigrationListMigrationsQueryPathParams, MigrationListMigrationsQueryQueryParams, } from './hooks/useMigrationListMigrationsQuery';
|
|
11
|
+
export { migrationListMigrations, useMigrationListMigrationsQuery, } from './hooks/useMigrationListMigrationsQuery';
|
|
12
|
+
export type { BadRequestResponse } from './responses/BadRequestResponse';
|
|
13
|
+
export type { ConflictResponse } from './responses/ConflictResponse';
|
|
14
|
+
export type { InternalServerErrorResponse } from './responses/InternalServerErrorResponse';
|
|
15
|
+
export type { NotFoundResponse } from './responses/NotFoundResponse';
|
|
16
|
+
export type { UnauthorizedResponse } from './responses/UnauthorizedResponse';
|
|
17
|
+
export type { BadRequest } from './schemas/BadRequest';
|
|
18
|
+
export type { ChangeSummary } from './schemas/ChangeSummary';
|
|
19
|
+
export type { CheckStatus } from './schemas/CheckStatus';
|
|
20
|
+
export type { Conflict } from './schemas/Conflict';
|
|
21
|
+
export type { CreateMigrationRequest } from './schemas/CreateMigrationRequest';
|
|
22
|
+
export type { CveDiff } from './schemas/CveDiff';
|
|
23
|
+
export type { CveDiffRow } from './schemas/CveDiffRow';
|
|
24
|
+
export type { CveSeverityCounts } from './schemas/CveSeverityCounts';
|
|
25
|
+
export type { DownloadStats } from './schemas/DownloadStats';
|
|
26
|
+
export type { HardeningArtifactItem } from './schemas/HardeningArtifactItem';
|
|
27
|
+
export type { HardeningArtifactsListResponse } from './schemas/HardeningArtifactsListResponse';
|
|
28
|
+
export type { HardeningArtifactsSummaryResponse } from './schemas/HardeningArtifactsSummaryResponse';
|
|
29
|
+
export type { ImageRefPair } from './schemas/ImageRefPair';
|
|
30
|
+
export type { ImageUsedEntry } from './schemas/ImageUsedEntry';
|
|
31
|
+
export type { InternalServerError } from './schemas/InternalServerError';
|
|
32
|
+
export type { MigrationChecks } from './schemas/MigrationChecks';
|
|
33
|
+
export type { MigrationDetail } from './schemas/MigrationDetail';
|
|
34
|
+
export type { MigrationFailure } from './schemas/MigrationFailure';
|
|
35
|
+
export type { MigrationListResponse } from './schemas/MigrationListResponse';
|
|
36
|
+
export type { MigrationScmConfig } from './schemas/MigrationScmConfig';
|
|
37
|
+
export type { MigrationSnippet } from './schemas/MigrationSnippet';
|
|
38
|
+
export type { MigrationSummary } from './schemas/MigrationSummary';
|
|
39
|
+
export type { NotFound } from './schemas/NotFound';
|
|
40
|
+
export type { Pagination } from './schemas/Pagination';
|
|
41
|
+
export type { PinnedImage } from './schemas/PinnedImage';
|
|
42
|
+
export type { PrReference } from './schemas/PrReference';
|
|
43
|
+
export type { RuntimeEnvironment } from './schemas/RuntimeEnvironment';
|
|
44
|
+
export type { RuntimeTest } from './schemas/RuntimeTest';
|
|
45
|
+
export type { RuntimeTestCheck } from './schemas/RuntimeTestCheck';
|
|
46
|
+
export type { RuntimeTestResult } from './schemas/RuntimeTestResult';
|
|
47
|
+
export type { RuntimeTestsBlock } from './schemas/RuntimeTestsBlock';
|
|
48
|
+
export type { SupplyChainInfo } from './schemas/SupplyChainInfo';
|
|
49
|
+
export type { Unauthorized } from './schemas/Unauthorized';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { hardeningGetArtifactsSummary, useHardeningGetArtifactsSummaryQuery, } from './hooks/useHardeningGetArtifactsSummaryQuery';
|
|
2
|
+
export { hardeningListArtifacts, useHardeningListArtifactsQuery, } from './hooks/useHardeningListArtifactsQuery';
|
|
3
|
+
export { migrationCreateMigration, useMigrationCreateMigrationMutation, } from './hooks/useMigrationCreateMigrationMutation';
|
|
4
|
+
export { migrationGetMigration, useMigrationGetMigrationQuery, } from './hooks/useMigrationGetMigrationQuery';
|
|
5
|
+
export { migrationListMigrations, useMigrationListMigrationsQuery, } from './hooks/useMigrationListMigrationsQuery';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|