@harnessio/react-integration-manager-client 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 +40 -0
- package/dist/fetcher/index.d.ts +17 -0
- package/dist/fetcher/index.js +65 -0
- package/dist/integration-manager/src/index.d.ts +6 -0
- package/dist/integration-manager/src/index.js +10 -0
- package/dist/integration-manager/src/services/helpers.d.ts +14 -0
- package/dist/integration-manager/src/services/helpers.js +1 -0
- package/dist/integration-manager/src/services/hooks/useCreateIntegrationConfigMutation.d.ts +20 -0
- package/dist/integration-manager/src/services/hooks/useCreateIntegrationConfigMutation.js +14 -0
- package/dist/integration-manager/src/services/hooks/useGetIntegrationConfigQuery.d.ts +18 -0
- package/dist/integration-manager/src/services/hooks/useGetIntegrationConfigQuery.js +14 -0
- package/dist/integration-manager/src/services/hooks/useListIntegrationConfigsQuery.d.ts +16 -0
- package/dist/integration-manager/src/services/hooks/useListIntegrationConfigsQuery.js +14 -0
- package/dist/integration-manager/src/services/hooks/useTriggerSyncMutation.d.ts +18 -0
- package/dist/integration-manager/src/services/hooks/useTriggerSyncMutation.js +14 -0
- package/dist/integration-manager/src/services/hooks/useUpdateIntegrationConfigMutation.d.ts +21 -0
- package/dist/integration-manager/src/services/hooks/useUpdateIntegrationConfigMutation.js +14 -0
- package/dist/integration-manager/src/services/hooks/useUpdateIntegrationStatusMutation.d.ts +25 -0
- package/dist/integration-manager/src/services/hooks/useUpdateIntegrationStatusMutation.js +14 -0
- package/dist/integration-manager/src/services/index.d.ts +24 -0
- package/dist/integration-manager/src/services/index.js +6 -0
- package/dist/integration-manager/src/services/schemas/EnumIntegrationMode.d.ts +1 -0
- package/dist/integration-manager/src/services/schemas/EnumIntegrationMode.js +4 -0
- package/dist/integration-manager/src/services/schemas/EnumIntegrationType.d.ts +1 -0
- package/dist/integration-manager/src/services/schemas/EnumIntegrationType.js +4 -0
- package/dist/integration-manager/src/services/schemas/OpenapiCreateIntegrationConfigRequest.d.ts +12 -0
- package/dist/integration-manager/src/services/schemas/OpenapiCreateIntegrationConfigRequest.js +1 -0
- package/dist/integration-manager/src/services/schemas/OpenapiTriggerSyncResponse.d.ts +7 -0
- package/dist/integration-manager/src/services/schemas/OpenapiTriggerSyncResponse.js +4 -0
- package/dist/integration-manager/src/services/schemas/OpenapiUpdateIntegrationConfigRequest.d.ts +6 -0
- package/dist/integration-manager/src/services/schemas/OpenapiUpdateIntegrationConfigRequest.js +4 -0
- package/dist/integration-manager/src/services/schemas/TypesFieldMapping.d.ts +4 -0
- package/dist/integration-manager/src/services/schemas/TypesFieldMapping.js +4 -0
- package/dist/integration-manager/src/services/schemas/TypesIntegrationConfig.d.ts +25 -0
- package/dist/integration-manager/src/services/schemas/TypesIntegrationConfig.js +1 -0
- package/dist/integration-manager/src/services/schemas/TypesLastSyncInfo.d.ts +8 -0
- package/dist/integration-manager/src/services/schemas/TypesLastSyncInfo.js +4 -0
- package/dist/integration-manager/src/services/schemas/TypesMappingConfig.d.ts +7 -0
- package/dist/integration-manager/src/services/schemas/TypesMappingConfig.js +1 -0
- package/dist/integration-manager/src/services/schemas/TypesSyncState.d.ts +7 -0
- package/dist/integration-manager/src/services/schemas/TypesSyncState.js +4 -0
- package/dist/integration-manager/src/services/schemas/UsererrorError.d.ts +6 -0
- package/dist/integration-manager/src/services/schemas/UsererrorError.js +4 -0
- package/package.json +31 -0
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# React Integration Manager Client
|
|
2
|
+
|
|
3
|
+
**OpenAPI -> OA**
|
|
4
|
+
|
|
5
|
+
**TypeScript -> TS**
|
|
6
|
+
|
|
7
|
+
**OpenAPI + TypeScript -> OATS**
|
|
8
|
+
|
|
9
|
+
This React API client will store a collection of Harness Integration Manager APIs and Interfaces contracts generated from Open API Spec using `OATS CLI` internally.
|
|
10
|
+
APIs are using hooks from `@tanstack/react-query`
|
|
11
|
+
|
|
12
|
+
## Steps To Generate API Client build as dist folder
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
yarn build
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## For NextGen UI adoption : IntegrationManagerAPIClient should be initialized
|
|
19
|
+
|
|
20
|
+
Before using API Client, it must be initialized with required `ClientCallbacks`.
|
|
21
|
+
|
|
22
|
+
Example:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
new IntegrationManagerAPIClient({
|
|
26
|
+
getHeaders: () => {
|
|
27
|
+
return { token: SessionToken.getToken(), 'Harness-Account': accountId }
|
|
28
|
+
}}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Versioning
|
|
32
|
+
|
|
33
|
+

|
|
34
|
+
|
|
35
|
+
Once development phase is completed, this repo will have changes and versioning driven by API spec only.
|
|
36
|
+
|
|
37
|
+
## License
|
|
38
|
+
|
|
39
|
+
[MIT](./LICENSE.md). Copyright(c) [Harness Inc](https://harness.io)
|
|
40
|
+
|
|
@@ -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 IntegrationManagerAPIClient {
|
|
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,20 @@
|
|
|
1
|
+
import { UseMutationOptions } from '@tanstack/react-query';
|
|
2
|
+
import type { TypesIntegrationConfig } from '../schemas/TypesIntegrationConfig';
|
|
3
|
+
import type { UsererrorError } from '../schemas/UsererrorError';
|
|
4
|
+
import type { OpenapiCreateIntegrationConfigRequest } from '../schemas/OpenapiCreateIntegrationConfigRequest';
|
|
5
|
+
import type { ResponseWithPagination } from '../helpers';
|
|
6
|
+
import { FetcherOptions } from '../../../../fetcher/index.js';
|
|
7
|
+
export interface CreateIntegrationConfigMutationPathParams {
|
|
8
|
+
accountIdentifier: string;
|
|
9
|
+
}
|
|
10
|
+
export type CreateIntegrationConfigRequestBody = OpenapiCreateIntegrationConfigRequest;
|
|
11
|
+
export type CreateIntegrationConfigOkResponse = ResponseWithPagination<TypesIntegrationConfig>;
|
|
12
|
+
export type CreateIntegrationConfigErrorResponse = UsererrorError;
|
|
13
|
+
export interface CreateIntegrationConfigProps extends CreateIntegrationConfigMutationPathParams, Omit<FetcherOptions<unknown, CreateIntegrationConfigRequestBody>, 'url'> {
|
|
14
|
+
body: CreateIntegrationConfigRequestBody;
|
|
15
|
+
}
|
|
16
|
+
export declare function createIntegrationConfig(props: CreateIntegrationConfigProps): Promise<CreateIntegrationConfigOkResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Create integration configuration
|
|
19
|
+
*/
|
|
20
|
+
export declare function useCreateIntegrationConfigMutation(options?: Omit<UseMutationOptions<CreateIntegrationConfigOkResponse, CreateIntegrationConfigErrorResponse, CreateIntegrationConfigProps>, 'mutationKey' | 'mutationFn'>): import("@tanstack/react-query").UseMutationResult<CreateIntegrationConfigOkResponse, UsererrorError, CreateIntegrationConfigProps, unknown>;
|
|
@@ -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 { useMutation } from '@tanstack/react-query';
|
|
5
|
+
import { fetcher } from '../../../../fetcher/index.js';
|
|
6
|
+
export function createIntegrationConfig(props) {
|
|
7
|
+
return fetcher(Object.assign({ url: `/api/v1/accounts/${props.accountIdentifier}/integration-configs`, method: 'POST' }, props));
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Create integration configuration
|
|
11
|
+
*/
|
|
12
|
+
export function useCreateIntegrationConfigMutation(options) {
|
|
13
|
+
return useMutation((mutateProps) => createIntegrationConfig(mutateProps), options);
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { UseQueryOptions } from '@tanstack/react-query';
|
|
2
|
+
import type { TypesIntegrationConfig } from '../schemas/TypesIntegrationConfig';
|
|
3
|
+
import type { UsererrorError } from '../schemas/UsererrorError';
|
|
4
|
+
import type { ResponseWithPagination } from '../helpers';
|
|
5
|
+
import { FetcherOptions } from '../../../../fetcher/index.js';
|
|
6
|
+
export interface GetIntegrationConfigQueryPathParams {
|
|
7
|
+
accountIdentifier: string;
|
|
8
|
+
integrationconfig_identifier: string;
|
|
9
|
+
}
|
|
10
|
+
export type GetIntegrationConfigOkResponse = ResponseWithPagination<TypesIntegrationConfig>;
|
|
11
|
+
export type GetIntegrationConfigErrorResponse = UsererrorError;
|
|
12
|
+
export interface GetIntegrationConfigProps extends GetIntegrationConfigQueryPathParams, Omit<FetcherOptions<unknown, unknown>, 'url'> {
|
|
13
|
+
}
|
|
14
|
+
export declare function getIntegrationConfig(props: GetIntegrationConfigProps): Promise<GetIntegrationConfigOkResponse>;
|
|
15
|
+
/**
|
|
16
|
+
* Get integration configuration
|
|
17
|
+
*/
|
|
18
|
+
export declare function useGetIntegrationConfigQuery(props: GetIntegrationConfigProps, options?: Omit<UseQueryOptions<GetIntegrationConfigOkResponse, GetIntegrationConfigErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<GetIntegrationConfigOkResponse, UsererrorError>;
|
|
@@ -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 getIntegrationConfig(props) {
|
|
7
|
+
return fetcher(Object.assign({ url: `/api/v1/accounts/${props.accountIdentifier}/integration-configs/${props.integrationconfig_identifier}`, method: 'GET' }, props));
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Get integration configuration
|
|
11
|
+
*/
|
|
12
|
+
export function useGetIntegrationConfigQuery(props, options) {
|
|
13
|
+
return useQuery(['getIntegrationConfig', props.accountIdentifier, props.integrationconfig_identifier], ({ signal }) => getIntegrationConfig(Object.assign(Object.assign({}, props), { signal })), options);
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { UseQueryOptions } from '@tanstack/react-query';
|
|
2
|
+
import type { TypesIntegrationConfig } from '../schemas/TypesIntegrationConfig';
|
|
3
|
+
import type { ResponseWithPagination } from '../helpers';
|
|
4
|
+
import { FetcherOptions } from '../../../../fetcher/index.js';
|
|
5
|
+
export interface ListIntegrationConfigsQueryPathParams {
|
|
6
|
+
accountIdentifier: string;
|
|
7
|
+
}
|
|
8
|
+
export type ListIntegrationConfigsOkResponse = ResponseWithPagination<TypesIntegrationConfig[]>;
|
|
9
|
+
export type ListIntegrationConfigsErrorResponse = unknown;
|
|
10
|
+
export interface ListIntegrationConfigsProps extends ListIntegrationConfigsQueryPathParams, Omit<FetcherOptions<unknown, unknown>, 'url'> {
|
|
11
|
+
}
|
|
12
|
+
export declare function listIntegrationConfigs(props: ListIntegrationConfigsProps): Promise<ListIntegrationConfigsOkResponse>;
|
|
13
|
+
/**
|
|
14
|
+
* List integration configurations
|
|
15
|
+
*/
|
|
16
|
+
export declare function useListIntegrationConfigsQuery(props: ListIntegrationConfigsProps, options?: Omit<UseQueryOptions<ListIntegrationConfigsOkResponse, ListIntegrationConfigsErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<ListIntegrationConfigsOkResponse, unknown>;
|
|
@@ -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 listIntegrationConfigs(props) {
|
|
7
|
+
return fetcher(Object.assign({ url: `/api/v1/accounts/${props.accountIdentifier}/integration-configs`, method: 'GET' }, props));
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* List integration configurations
|
|
11
|
+
*/
|
|
12
|
+
export function useListIntegrationConfigsQuery(props, options) {
|
|
13
|
+
return useQuery(['listIntegrationConfigs', props.accountIdentifier], ({ signal }) => listIntegrationConfigs(Object.assign(Object.assign({}, props), { signal })), options);
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { UseMutationOptions } from '@tanstack/react-query';
|
|
2
|
+
import type { OpenapiTriggerSyncResponse } from '../schemas/OpenapiTriggerSyncResponse';
|
|
3
|
+
import type { UsererrorError } from '../schemas/UsererrorError';
|
|
4
|
+
import type { ResponseWithPagination } from '../helpers';
|
|
5
|
+
import { FetcherOptions } from '../../../../fetcher/index.js';
|
|
6
|
+
export interface TriggerSyncMutationPathParams {
|
|
7
|
+
accountIdentifier: string;
|
|
8
|
+
integrationconfig_identifier: string;
|
|
9
|
+
}
|
|
10
|
+
export type TriggerSyncOkResponse = ResponseWithPagination<OpenapiTriggerSyncResponse>;
|
|
11
|
+
export type TriggerSyncErrorResponse = UsererrorError;
|
|
12
|
+
export interface TriggerSyncProps extends TriggerSyncMutationPathParams, Omit<FetcherOptions<unknown, unknown>, 'url'> {
|
|
13
|
+
}
|
|
14
|
+
export declare function triggerSync(props: TriggerSyncProps): Promise<TriggerSyncOkResponse>;
|
|
15
|
+
/**
|
|
16
|
+
* Manually triggers a full sync for the specified integration. The sync will start from the beginning and process all configured kinds.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useTriggerSyncMutation(options?: Omit<UseMutationOptions<TriggerSyncOkResponse, TriggerSyncErrorResponse, TriggerSyncProps>, 'mutationKey' | 'mutationFn'>): import("@tanstack/react-query").UseMutationResult<TriggerSyncOkResponse, UsererrorError, TriggerSyncProps, unknown>;
|
|
@@ -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 { useMutation } from '@tanstack/react-query';
|
|
5
|
+
import { fetcher } from '../../../../fetcher/index.js';
|
|
6
|
+
export function triggerSync(props) {
|
|
7
|
+
return fetcher(Object.assign({ url: `/api/v1/accounts/${props.accountIdentifier}/integration-configs/${props.integrationconfig_identifier}/sync`, method: 'POST' }, props));
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Manually triggers a full sync for the specified integration. The sync will start from the beginning and process all configured kinds.
|
|
11
|
+
*/
|
|
12
|
+
export function useTriggerSyncMutation(options) {
|
|
13
|
+
return useMutation((mutateProps) => triggerSync(mutateProps), options);
|
|
14
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { UseMutationOptions } from '@tanstack/react-query';
|
|
2
|
+
import type { TypesIntegrationConfig } from '../schemas/TypesIntegrationConfig';
|
|
3
|
+
import type { UsererrorError } from '../schemas/UsererrorError';
|
|
4
|
+
import type { OpenapiUpdateIntegrationConfigRequest } from '../schemas/OpenapiUpdateIntegrationConfigRequest';
|
|
5
|
+
import type { ResponseWithPagination } from '../helpers';
|
|
6
|
+
import { FetcherOptions } from '../../../../fetcher/index.js';
|
|
7
|
+
export interface UpdateIntegrationConfigMutationPathParams {
|
|
8
|
+
accountIdentifier: string;
|
|
9
|
+
integrationconfig_identifier: string;
|
|
10
|
+
}
|
|
11
|
+
export type UpdateIntegrationConfigRequestBody = OpenapiUpdateIntegrationConfigRequest;
|
|
12
|
+
export type UpdateIntegrationConfigOkResponse = ResponseWithPagination<TypesIntegrationConfig>;
|
|
13
|
+
export type UpdateIntegrationConfigErrorResponse = UsererrorError;
|
|
14
|
+
export interface UpdateIntegrationConfigProps extends UpdateIntegrationConfigMutationPathParams, Omit<FetcherOptions<unknown, UpdateIntegrationConfigRequestBody>, 'url'> {
|
|
15
|
+
body: UpdateIntegrationConfigRequestBody;
|
|
16
|
+
}
|
|
17
|
+
export declare function updateIntegrationConfig(props: UpdateIntegrationConfigProps): Promise<UpdateIntegrationConfigOkResponse>;
|
|
18
|
+
/**
|
|
19
|
+
* Update integration configuration
|
|
20
|
+
*/
|
|
21
|
+
export declare function useUpdateIntegrationConfigMutation(options?: Omit<UseMutationOptions<UpdateIntegrationConfigOkResponse, UpdateIntegrationConfigErrorResponse, UpdateIntegrationConfigProps>, 'mutationKey' | 'mutationFn'>): import("@tanstack/react-query").UseMutationResult<UpdateIntegrationConfigOkResponse, UsererrorError, UpdateIntegrationConfigProps, unknown>;
|
|
@@ -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 { useMutation } from '@tanstack/react-query';
|
|
5
|
+
import { fetcher } from '../../../../fetcher/index.js';
|
|
6
|
+
export function updateIntegrationConfig(props) {
|
|
7
|
+
return fetcher(Object.assign({ url: `/api/v1/accounts/${props.accountIdentifier}/integration-configs/${props.integrationconfig_identifier}`, method: 'PUT' }, props));
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Update integration configuration
|
|
11
|
+
*/
|
|
12
|
+
export function useUpdateIntegrationConfigMutation(options) {
|
|
13
|
+
return useMutation((mutateProps) => updateIntegrationConfig(mutateProps), options);
|
|
14
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { UseMutationOptions } from '@tanstack/react-query';
|
|
2
|
+
import type { TypesIntegrationConfig } from '../schemas/TypesIntegrationConfig';
|
|
3
|
+
import type { UsererrorError } from '../schemas/UsererrorError';
|
|
4
|
+
import type { ResponseWithPagination } from '../helpers';
|
|
5
|
+
import { FetcherOptions } from '../../../../fetcher/index.js';
|
|
6
|
+
export interface UpdateIntegrationStatusMutationPathParams {
|
|
7
|
+
accountIdentifier: string;
|
|
8
|
+
integrationconfig_identifier: string;
|
|
9
|
+
}
|
|
10
|
+
export interface UpdateIntegrationStatusMutationQueryParams {
|
|
11
|
+
/**
|
|
12
|
+
* Action to perform: 'enable' or 'disable'
|
|
13
|
+
*/
|
|
14
|
+
action: string;
|
|
15
|
+
}
|
|
16
|
+
export type UpdateIntegrationStatusOkResponse = ResponseWithPagination<TypesIntegrationConfig>;
|
|
17
|
+
export type UpdateIntegrationStatusErrorResponse = UsererrorError;
|
|
18
|
+
export interface UpdateIntegrationStatusProps extends UpdateIntegrationStatusMutationPathParams, Omit<FetcherOptions<UpdateIntegrationStatusMutationQueryParams, unknown>, 'url'> {
|
|
19
|
+
queryParams: UpdateIntegrationStatusMutationQueryParams;
|
|
20
|
+
}
|
|
21
|
+
export declare function updateIntegrationStatus(props: UpdateIntegrationStatusProps): Promise<UpdateIntegrationStatusOkResponse>;
|
|
22
|
+
/**
|
|
23
|
+
* Enable or disable an integration configuration. Use action='enable' to enable the integration or action='disable' to disable it. Enabling an integration will trigger an initial sync if the integration is enabled for the first time.
|
|
24
|
+
*/
|
|
25
|
+
export declare function useUpdateIntegrationStatusMutation(options?: Omit<UseMutationOptions<UpdateIntegrationStatusOkResponse, UpdateIntegrationStatusErrorResponse, UpdateIntegrationStatusProps>, 'mutationKey' | 'mutationFn'>): import("@tanstack/react-query").UseMutationResult<UpdateIntegrationStatusOkResponse, UsererrorError, UpdateIntegrationStatusProps, unknown>;
|
|
@@ -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 { useMutation } from '@tanstack/react-query';
|
|
5
|
+
import { fetcher } from '../../../../fetcher/index.js';
|
|
6
|
+
export function updateIntegrationStatus(props) {
|
|
7
|
+
return fetcher(Object.assign({ url: `/api/v1/accounts/${props.accountIdentifier}/integration-configs/${props.integrationconfig_identifier}/status`, method: 'PATCH' }, props));
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Enable or disable an integration configuration. Use action='enable' to enable the integration or action='disable' to disable it. Enabling an integration will trigger an initial sync if the integration is enabled for the first time.
|
|
11
|
+
*/
|
|
12
|
+
export function useUpdateIntegrationStatusMutation(options) {
|
|
13
|
+
return useMutation((mutateProps) => updateIntegrationStatus(mutateProps), options);
|
|
14
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type { GetPathParamsType, ResponseWithPagination } from './helpers';
|
|
2
|
+
export type { CreateIntegrationConfigErrorResponse, CreateIntegrationConfigMutationPathParams, CreateIntegrationConfigOkResponse, CreateIntegrationConfigProps, CreateIntegrationConfigRequestBody, } from './hooks/useCreateIntegrationConfigMutation';
|
|
3
|
+
export { createIntegrationConfig, useCreateIntegrationConfigMutation, } from './hooks/useCreateIntegrationConfigMutation';
|
|
4
|
+
export type { GetIntegrationConfigErrorResponse, GetIntegrationConfigOkResponse, GetIntegrationConfigProps, GetIntegrationConfigQueryPathParams, } from './hooks/useGetIntegrationConfigQuery';
|
|
5
|
+
export { getIntegrationConfig, useGetIntegrationConfigQuery, } from './hooks/useGetIntegrationConfigQuery';
|
|
6
|
+
export type { ListIntegrationConfigsErrorResponse, ListIntegrationConfigsOkResponse, ListIntegrationConfigsProps, ListIntegrationConfigsQueryPathParams, } from './hooks/useListIntegrationConfigsQuery';
|
|
7
|
+
export { listIntegrationConfigs, useListIntegrationConfigsQuery, } from './hooks/useListIntegrationConfigsQuery';
|
|
8
|
+
export type { TriggerSyncErrorResponse, TriggerSyncMutationPathParams, TriggerSyncOkResponse, TriggerSyncProps, } from './hooks/useTriggerSyncMutation';
|
|
9
|
+
export { triggerSync, useTriggerSyncMutation } from './hooks/useTriggerSyncMutation';
|
|
10
|
+
export type { UpdateIntegrationConfigErrorResponse, UpdateIntegrationConfigMutationPathParams, UpdateIntegrationConfigOkResponse, UpdateIntegrationConfigProps, UpdateIntegrationConfigRequestBody, } from './hooks/useUpdateIntegrationConfigMutation';
|
|
11
|
+
export { updateIntegrationConfig, useUpdateIntegrationConfigMutation, } from './hooks/useUpdateIntegrationConfigMutation';
|
|
12
|
+
export type { UpdateIntegrationStatusErrorResponse, UpdateIntegrationStatusMutationPathParams, UpdateIntegrationStatusMutationQueryParams, UpdateIntegrationStatusOkResponse, UpdateIntegrationStatusProps, } from './hooks/useUpdateIntegrationStatusMutation';
|
|
13
|
+
export { updateIntegrationStatus, useUpdateIntegrationStatusMutation, } from './hooks/useUpdateIntegrationStatusMutation';
|
|
14
|
+
export type { EnumIntegrationMode } from './schemas/EnumIntegrationMode';
|
|
15
|
+
export type { EnumIntegrationType } from './schemas/EnumIntegrationType';
|
|
16
|
+
export type { OpenapiCreateIntegrationConfigRequest } from './schemas/OpenapiCreateIntegrationConfigRequest';
|
|
17
|
+
export type { OpenapiTriggerSyncResponse } from './schemas/OpenapiTriggerSyncResponse';
|
|
18
|
+
export type { OpenapiUpdateIntegrationConfigRequest } from './schemas/OpenapiUpdateIntegrationConfigRequest';
|
|
19
|
+
export type { TypesFieldMapping } from './schemas/TypesFieldMapping';
|
|
20
|
+
export type { TypesIntegrationConfig } from './schemas/TypesIntegrationConfig';
|
|
21
|
+
export type { TypesLastSyncInfo } from './schemas/TypesLastSyncInfo';
|
|
22
|
+
export type { TypesMappingConfig } from './schemas/TypesMappingConfig';
|
|
23
|
+
export type { TypesSyncState } from './schemas/TypesSyncState';
|
|
24
|
+
export type { UsererrorError } from './schemas/UsererrorError';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { createIntegrationConfig, useCreateIntegrationConfigMutation, } from './hooks/useCreateIntegrationConfigMutation';
|
|
2
|
+
export { getIntegrationConfig, useGetIntegrationConfigQuery, } from './hooks/useGetIntegrationConfigQuery';
|
|
3
|
+
export { listIntegrationConfigs, useListIntegrationConfigsQuery, } from './hooks/useListIntegrationConfigsQuery';
|
|
4
|
+
export { triggerSync, useTriggerSyncMutation } from './hooks/useTriggerSyncMutation';
|
|
5
|
+
export { updateIntegrationConfig, useUpdateIntegrationConfigMutation, } from './hooks/useUpdateIntegrationConfigMutation';
|
|
6
|
+
export { updateIntegrationStatus, useUpdateIntegrationStatusMutation, } from './hooks/useUpdateIntegrationStatusMutation';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type EnumIntegrationMode = 'airbyte' | 'kubernetes' | 'platform' | 'webhook';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type EnumIntegrationType = 'HarnessCD' | 'HarnessScope' | 'ServiceNow';
|
package/dist/integration-manager/src/services/schemas/OpenapiCreateIntegrationConfigRequest.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { EnumIntegrationType } from '../schemas/EnumIntegrationType';
|
|
2
|
+
import type { TypesMappingConfig } from '../schemas/TypesMappingConfig';
|
|
3
|
+
export interface OpenapiCreateIntegrationConfigRequest {
|
|
4
|
+
configuration?: {
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
} | null;
|
|
7
|
+
identifier?: string;
|
|
8
|
+
integration_type?: EnumIntegrationType;
|
|
9
|
+
kinds?: string[];
|
|
10
|
+
mapping_config?: TypesMappingConfig;
|
|
11
|
+
name?: string;
|
|
12
|
+
}
|
package/dist/integration-manager/src/services/schemas/OpenapiCreateIntegrationConfigRequest.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { EnumIntegrationMode } from '../schemas/EnumIntegrationMode';
|
|
2
|
+
import type { EnumIntegrationType } from '../schemas/EnumIntegrationType';
|
|
3
|
+
import type { TypesLastSyncInfo } from '../schemas/TypesLastSyncInfo';
|
|
4
|
+
import type { TypesSyncState } from '../schemas/TypesSyncState';
|
|
5
|
+
export interface TypesIntegrationConfig {
|
|
6
|
+
configuration?: {
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
} | null;
|
|
9
|
+
created?: number;
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
error?: {
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
};
|
|
14
|
+
identifier?: string;
|
|
15
|
+
integration_mode?: EnumIntegrationMode;
|
|
16
|
+
integration_type?: EnumIntegrationType;
|
|
17
|
+
kinds?: string[] | null;
|
|
18
|
+
last_sync_info?: TypesLastSyncInfo;
|
|
19
|
+
last_updated?: number;
|
|
20
|
+
name?: string;
|
|
21
|
+
space_path?: string;
|
|
22
|
+
status?: string;
|
|
23
|
+
sync?: TypesSyncState;
|
|
24
|
+
version?: string;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@harnessio/react-integration-manager-client",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Harness React integration manager client - Integration Manager APIs integrated with react hooks",
|
|
5
|
+
"author": "Harness Inc",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"source": "src/index.ts",
|
|
8
|
+
"main": "./dist/integration-manager/src/index.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./dist/integration-manager/src/index.js"
|
|
11
|
+
},
|
|
12
|
+
"types": "./dist/integration-manager/src/index.d.ts",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist/*"
|
|
15
|
+
],
|
|
16
|
+
"homepage": "https://github.com/harness/react-api-client",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/harness/react-api-client.git"
|
|
20
|
+
},
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/harness/react-api-client/issues"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"prebuild": "rimraf dist",
|
|
27
|
+
"build": "yarn generate && tsc",
|
|
28
|
+
"generate": "oats import --config='./oats.config.ts'",
|
|
29
|
+
"fmt": "prettier --write ./index.ts"
|
|
30
|
+
}
|
|
31
|
+
}
|