@harnessio/react-idp-service-client 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +39 -0
  2. package/dist/fetcher.d.ts +17 -0
  3. package/dist/fetcher.js +49 -0
  4. package/dist/index.d.ts +6 -0
  5. package/dist/index.js +10 -0
  6. package/dist/services/hooks/useGetHarnessEntitiesV1Query.d.ts +26 -0
  7. package/dist/services/hooks/useGetHarnessEntitiesV1Query.js +14 -0
  8. package/dist/services/hooks/useImportHarnessEntitiesV1Mutation.d.ts +22 -0
  9. package/dist/services/hooks/useImportHarnessEntitiesV1Mutation.js +14 -0
  10. package/dist/services/hooks/useOnboardingAccessCheckV1Query.d.ts +22 -0
  11. package/dist/services/hooks/useOnboardingAccessCheckV1Query.js +14 -0
  12. package/dist/services/index.d.ts +34 -0
  13. package/dist/services/index.js +3 -0
  14. package/dist/services/requestBodies/EnvironmentSecretRequestListRequestBody.d.ts +2 -0
  15. package/dist/services/requestBodies/EnvironmentSecretRequestListRequestBody.js +1 -0
  16. package/dist/services/requestBodies/EnvironmentSecretRequestRequestBody.d.ts +2 -0
  17. package/dist/services/requestBodies/EnvironmentSecretRequestRequestBody.js +1 -0
  18. package/dist/services/requestBodies/ImportHarnessEntitiesRequestRequestBody.d.ts +2 -0
  19. package/dist/services/requestBodies/ImportHarnessEntitiesRequestRequestBody.js +1 -0
  20. package/dist/services/requestBodies/ManualComponentImportRequestRequestBody.d.ts +2 -0
  21. package/dist/services/requestBodies/ManualComponentImportRequestRequestBody.js +1 -0
  22. package/dist/services/requestBodies/StatusInfoRequestRequestBody.d.ts +2 -0
  23. package/dist/services/requestBodies/StatusInfoRequestRequestBody.js +1 -0
  24. package/dist/services/responses/EnvironmentSecretResponseListResponse.d.ts +2 -0
  25. package/dist/services/responses/EnvironmentSecretResponseListResponse.js +1 -0
  26. package/dist/services/responses/EnvironmentSecretResponseResponse.d.ts +2 -0
  27. package/dist/services/responses/EnvironmentSecretResponseResponse.js +1 -0
  28. package/dist/services/responses/HarnessEntitiesResponseResponse.d.ts +2 -0
  29. package/dist/services/responses/HarnessEntitiesResponseResponse.js +1 -0
  30. package/dist/services/responses/ImportEntitiesResponseResponse.d.ts +2 -0
  31. package/dist/services/responses/ImportEntitiesResponseResponse.js +1 -0
  32. package/dist/services/responses/NamespaceResponseResponse.d.ts +2 -0
  33. package/dist/services/responses/NamespaceResponseResponse.js +1 -0
  34. package/dist/services/responses/OnboardingAccessCheckResponseResponse.d.ts +2 -0
  35. package/dist/services/responses/OnboardingAccessCheckResponseResponse.js +1 -0
  36. package/dist/services/responses/StatusInfoResponseResponse.d.ts +2 -0
  37. package/dist/services/responses/StatusInfoResponseResponse.js +1 -0
  38. package/dist/services/schemas/CatalogConnectorInfo.d.ts +10 -0
  39. package/dist/services/schemas/CatalogConnectorInfo.js +4 -0
  40. package/dist/services/schemas/EntitiesForImport.d.ts +8 -0
  41. package/dist/services/schemas/EntitiesForImport.js +4 -0
  42. package/dist/services/schemas/EnvironmentSecret.d.ts +14 -0
  43. package/dist/services/schemas/EnvironmentSecret.js +4 -0
  44. package/dist/services/schemas/EnvironmentSecretRequest.d.ts +4 -0
  45. package/dist/services/schemas/EnvironmentSecretRequest.js +1 -0
  46. package/dist/services/schemas/EnvironmentSecretResponse.d.ts +4 -0
  47. package/dist/services/schemas/EnvironmentSecretResponse.js +1 -0
  48. package/dist/services/schemas/HarnessBackstageEntities.d.ts +11 -0
  49. package/dist/services/schemas/HarnessBackstageEntities.js +4 -0
  50. package/dist/services/schemas/HarnessEntitiesResponse.d.ts +10 -0
  51. package/dist/services/schemas/HarnessEntitiesResponse.js +1 -0
  52. package/dist/services/schemas/ImportEntitiesResponse.d.ts +6 -0
  53. package/dist/services/schemas/ImportEntitiesResponse.js +4 -0
  54. package/dist/services/schemas/ImportHarnessEntitiesRequest.d.ts +9 -0
  55. package/dist/services/schemas/ImportHarnessEntitiesRequest.js +1 -0
  56. package/dist/services/schemas/ManualComponentImportRequest.d.ts +9 -0
  57. package/dist/services/schemas/ManualComponentImportRequest.js +1 -0
  58. package/dist/services/schemas/NamepsaceResponse.d.ts +5 -0
  59. package/dist/services/schemas/NamepsaceResponse.js +1 -0
  60. package/dist/services/schemas/NamespaceInfo.d.ts +7 -0
  61. package/dist/services/schemas/NamespaceInfo.js +4 -0
  62. package/dist/services/schemas/OnboardingAccessCheckResponse.d.ts +6 -0
  63. package/dist/services/schemas/OnboardingAccessCheckResponse.js +4 -0
  64. package/dist/services/schemas/StatusInfo.d.ts +8 -0
  65. package/dist/services/schemas/StatusInfo.js +4 -0
  66. package/dist/services/schemas/StatusInfoRequest.d.ts +4 -0
  67. package/dist/services/schemas/StatusInfoRequest.js +1 -0
  68. package/dist/services/schemas/StatusInfoResponse.d.ts +4 -0
  69. package/dist/services/schemas/StatusInfoResponse.js +1 -0
  70. package/package.json +46 -0
package/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # React IDP Service Client(WIP)
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 IDP Service 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 : IDPServiceAPIClient should be initialized
19
+ Before using API Client, it must be initilaized with required `ClientCallbacks`.
20
+
21
+ Example:
22
+
23
+ ```
24
+ new IDPServiceAPIClient({
25
+ getHeaders: () => {
26
+ return { token: SessionToken.getToken(), 'Harness-Account': accountId }
27
+ }}
28
+ ```
29
+
30
+ ## Versioning
31
+ ![@harnessio/react-idp-service-client]
32
+
33
+ Once development phase is completed, this repo will have changes and versioning driven by API spec only.
34
+
35
+
36
+ ## License
37
+
38
+ [MIT](./LICENSE.md). Copyright(c) [Harness Inc](https://harness.io)
39
+
@@ -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,49 @@
1
+ import { __awaiter, __rest } from "tslib";
2
+ import { stringify } from 'qs';
3
+ const JSON_CONTENT_TYPES = ['application/json'];
4
+ let APIClientIntitilized = 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
+ APIClientIntitilized = 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 (!APIClientIntitilized) {
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({ 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
+ const asJson = contentType && JSON_CONTENT_TYPES.some((h) => contentType.startsWith(h));
43
+ const data = yield (asJson ? response.json() : response.text());
44
+ if (response.ok) {
45
+ return data;
46
+ }
47
+ throw data;
48
+ });
49
+ }
@@ -0,0 +1,6 @@
1
+ import { ClientCallbacks } from './fetcher';
2
+ export * from './services/index';
3
+ export declare class IDPServiceAPIClient {
4
+ updateHeaders: (headers: Record<string, any>) => void;
5
+ constructor(callbacks: ClientCallbacks);
6
+ }
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ import { setupClient, updateClientHeaders } from './fetcher';
2
+ export * from './services/index';
3
+ export class IDPServiceAPIClient {
4
+ constructor(callbacks) {
5
+ setupClient(callbacks);
6
+ this.updateHeaders = (headers) => {
7
+ updateClientHeaders(headers);
8
+ };
9
+ }
10
+ }
@@ -0,0 +1,26 @@
1
+ import { UseQueryOptions } from '@tanstack/react-query';
2
+ import type { HarnessEntitiesResponseResponse } from '../responses/HarnessEntitiesResponseResponse';
3
+ import { FetcherOptions } from './../../fetcher';
4
+ export interface GetHarnessEntitiesV1QueryPathParams {
5
+ accountIdentifier: string;
6
+ }
7
+ export interface GetHarnessEntitiesV1QueryQueryParams {
8
+ page?: number;
9
+ limit?: number;
10
+ sort?: string;
11
+ order?: string;
12
+ search_term?: string;
13
+ }
14
+ export interface GetHarnessEntitiesV1QueryHeaderParams {
15
+ 'Harness-Account'?: string;
16
+ }
17
+ export type GetHarnessEntitiesV1OkResponse = HarnessEntitiesResponseResponse;
18
+ export type GetHarnessEntitiesV1ErrorResponse = unknown;
19
+ export interface GetHarnessEntitiesV1Props extends GetHarnessEntitiesV1QueryPathParams, Omit<FetcherOptions<GetHarnessEntitiesV1QueryQueryParams, unknown, GetHarnessEntitiesV1QueryHeaderParams>, 'url'> {
20
+ queryParams: GetHarnessEntitiesV1QueryQueryParams;
21
+ }
22
+ export declare function getHarnessEntitiesV1(props: GetHarnessEntitiesV1Props): Promise<GetHarnessEntitiesV1OkResponse>;
23
+ /**
24
+ * Get Harness Entities
25
+ */
26
+ export declare function useGetHarnessEntitiesV1Query(props: GetHarnessEntitiesV1Props, options?: Omit<UseQueryOptions<GetHarnessEntitiesV1OkResponse, GetHarnessEntitiesV1ErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<import("..").HarnessEntitiesResponse, 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';
6
+ export function getHarnessEntitiesV1(props) {
7
+ return fetcher(Object.assign({ url: `/v1/account/${props.accountIdentifier}/onboarding/harness-entities`, method: 'GET' }, props));
8
+ }
9
+ /**
10
+ * Get Harness Entities
11
+ */
12
+ export function useGetHarnessEntitiesV1Query(props, options) {
13
+ return useQuery(['get-harness-entities-v1', props.accountIdentifier, props.queryParams], ({ signal }) => getHarnessEntitiesV1(Object.assign(Object.assign({}, props), { signal })), options);
14
+ }
@@ -0,0 +1,22 @@
1
+ import { UseMutationOptions } from '@tanstack/react-query';
2
+ import type { ImportEntitiesResponseResponse } from '../responses/ImportEntitiesResponseResponse';
3
+ import type { ImportHarnessEntitiesRequestRequestBody } from '../requestBodies/ImportHarnessEntitiesRequestRequestBody';
4
+ import { FetcherOptions } from './../../fetcher';
5
+ export interface ImportHarnessEntitiesV1MutationPathParams {
6
+ accountIdentifier: string;
7
+ }
8
+ export interface ImportHarnessEntitiesV1MutationHeaderParams {
9
+ 'Harness-Account'?: string;
10
+ }
11
+ export type ImportHarnessEntitiesV1RequestBody = ImportHarnessEntitiesRequestRequestBody;
12
+ export type ImportHarnessEntitiesV1OkResponse = ImportEntitiesResponseResponse;
13
+ export type ImportHarnessEntitiesV1ErrorResponse = unknown;
14
+ export interface ImportHarnessEntitiesV1Props extends ImportHarnessEntitiesV1MutationPathParams, Omit<FetcherOptions<unknown, ImportHarnessEntitiesV1RequestBody, ImportHarnessEntitiesV1MutationHeaderParams>, 'url'> {
15
+ body: ImportHarnessEntitiesV1RequestBody;
16
+ }
17
+ export declare function importHarnessEntitiesV1(props: ImportHarnessEntitiesV1Props): Promise<ImportHarnessEntitiesV1OkResponse>;
18
+ export type ImportHarnessEntitiesV1MutationProps<T extends keyof ImportHarnessEntitiesV1Props> = Omit<ImportHarnessEntitiesV1Props, T> & Partial<Pick<ImportHarnessEntitiesV1Props, T>>;
19
+ /**
20
+ * Import Harness Entities to IDP
21
+ */
22
+ export declare function useImportHarnessEntitiesV1Mutation<T extends keyof ImportHarnessEntitiesV1Props>(props: Pick<Partial<ImportHarnessEntitiesV1Props>, T>, options?: Omit<UseMutationOptions<ImportHarnessEntitiesV1OkResponse, ImportHarnessEntitiesV1ErrorResponse, ImportHarnessEntitiesV1MutationProps<T>>, 'mutationKey' | 'mutationFn'>): import("@tanstack/react-query").UseMutationResult<import("..").ImportEntitiesResponse, unknown, ImportHarnessEntitiesV1MutationProps<T>, 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';
6
+ export function importHarnessEntitiesV1(props) {
7
+ return fetcher(Object.assign({ url: `/v1/account/${props.accountIdentifier}/onboarding/import-harness-entities`, method: 'POST' }, props));
8
+ }
9
+ /**
10
+ * Import Harness Entities to IDP
11
+ */
12
+ export function useImportHarnessEntitiesV1Mutation(props, options) {
13
+ return useMutation((mutateProps) => importHarnessEntitiesV1(Object.assign(Object.assign({}, props), mutateProps)), options);
14
+ }
@@ -0,0 +1,22 @@
1
+ import { UseQueryOptions } from '@tanstack/react-query';
2
+ import type { OnboardingAccessCheckResponseResponse } from '../responses/OnboardingAccessCheckResponseResponse';
3
+ import { FetcherOptions } from './../../fetcher';
4
+ export interface OnboardingAccessCheckV1QueryPathParams {
5
+ accountIdentifier: string;
6
+ }
7
+ export interface OnboardingAccessCheckV1QueryQueryParams {
8
+ userId?: string;
9
+ }
10
+ export interface OnboardingAccessCheckV1QueryHeaderParams {
11
+ 'Harness-Account'?: string;
12
+ }
13
+ export type OnboardingAccessCheckV1OkResponse = OnboardingAccessCheckResponseResponse;
14
+ export type OnboardingAccessCheckV1ErrorResponse = unknown;
15
+ export interface OnboardingAccessCheckV1Props extends OnboardingAccessCheckV1QueryPathParams, Omit<FetcherOptions<OnboardingAccessCheckV1QueryQueryParams, unknown, OnboardingAccessCheckV1QueryHeaderParams>, 'url'> {
16
+ queryParams: OnboardingAccessCheckV1QueryQueryParams;
17
+ }
18
+ export declare function onboardingAccessCheckV1(props: OnboardingAccessCheckV1Props): Promise<OnboardingAccessCheckV1OkResponse>;
19
+ /**
20
+ * Check if User is allowed to perform IDP onboarding workflow
21
+ */
22
+ export declare function useOnboardingAccessCheckV1Query(props: OnboardingAccessCheckV1Props, options?: Omit<UseQueryOptions<OnboardingAccessCheckV1OkResponse, OnboardingAccessCheckV1ErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<import("..").OnboardingAccessCheckResponse, 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';
6
+ export function onboardingAccessCheckV1(props) {
7
+ return fetcher(Object.assign({ url: `/v1/account/${props.accountIdentifier}/onboarding/access-check`, method: 'GET' }, props));
8
+ }
9
+ /**
10
+ * Check if User is allowed to perform IDP onboarding workflow
11
+ */
12
+ export function useOnboardingAccessCheckV1Query(props, options) {
13
+ return useQuery(['onboarding-access-check-v1', props.accountIdentifier, props.queryParams], ({ signal }) => onboardingAccessCheckV1(Object.assign(Object.assign({}, props), { signal })), options);
14
+ }
@@ -0,0 +1,34 @@
1
+ export type { GetHarnessEntitiesV1ErrorResponse, GetHarnessEntitiesV1OkResponse, GetHarnessEntitiesV1Props, GetHarnessEntitiesV1QueryPathParams, GetHarnessEntitiesV1QueryQueryParams, } from './hooks/useGetHarnessEntitiesV1Query';
2
+ export { getHarnessEntitiesV1, useGetHarnessEntitiesV1Query, } from './hooks/useGetHarnessEntitiesV1Query';
3
+ export type { ImportHarnessEntitiesV1ErrorResponse, ImportHarnessEntitiesV1MutationPathParams, ImportHarnessEntitiesV1MutationProps, ImportHarnessEntitiesV1OkResponse, ImportHarnessEntitiesV1Props, ImportHarnessEntitiesV1RequestBody, } from './hooks/useImportHarnessEntitiesV1Mutation';
4
+ export { importHarnessEntitiesV1, useImportHarnessEntitiesV1Mutation, } from './hooks/useImportHarnessEntitiesV1Mutation';
5
+ export type { OnboardingAccessCheckV1ErrorResponse, OnboardingAccessCheckV1OkResponse, OnboardingAccessCheckV1Props, OnboardingAccessCheckV1QueryPathParams, OnboardingAccessCheckV1QueryQueryParams, } from './hooks/useOnboardingAccessCheckV1Query';
6
+ export { onboardingAccessCheckV1, useOnboardingAccessCheckV1Query, } from './hooks/useOnboardingAccessCheckV1Query';
7
+ export type { EnvironmentSecretRequestListRequestBody } from './requestBodies/EnvironmentSecretRequestListRequestBody';
8
+ export type { EnvironmentSecretRequestRequestBody } from './requestBodies/EnvironmentSecretRequestRequestBody';
9
+ export type { ImportHarnessEntitiesRequestRequestBody } from './requestBodies/ImportHarnessEntitiesRequestRequestBody';
10
+ export type { ManualComponentImportRequestRequestBody } from './requestBodies/ManualComponentImportRequestRequestBody';
11
+ export type { StatusInfoRequestRequestBody } from './requestBodies/StatusInfoRequestRequestBody';
12
+ export type { EnvironmentSecretResponseListResponse } from './responses/EnvironmentSecretResponseListResponse';
13
+ export type { EnvironmentSecretResponseResponse } from './responses/EnvironmentSecretResponseResponse';
14
+ export type { HarnessEntitiesResponseResponse } from './responses/HarnessEntitiesResponseResponse';
15
+ export type { ImportEntitiesResponseResponse } from './responses/ImportEntitiesResponseResponse';
16
+ export type { NamespaceResponseResponse } from './responses/NamespaceResponseResponse';
17
+ export type { OnboardingAccessCheckResponseResponse } from './responses/OnboardingAccessCheckResponseResponse';
18
+ export type { StatusInfoResponseResponse } from './responses/StatusInfoResponseResponse';
19
+ export type { CatalogConnectorInfo } from './schemas/CatalogConnectorInfo';
20
+ export type { EntitiesForImport } from './schemas/EntitiesForImport';
21
+ export type { EnvironmentSecret } from './schemas/EnvironmentSecret';
22
+ export type { EnvironmentSecretRequest } from './schemas/EnvironmentSecretRequest';
23
+ export type { EnvironmentSecretResponse } from './schemas/EnvironmentSecretResponse';
24
+ export type { HarnessBackstageEntities } from './schemas/HarnessBackstageEntities';
25
+ export type { HarnessEntitiesResponse } from './schemas/HarnessEntitiesResponse';
26
+ export type { ImportEntitiesResponse } from './schemas/ImportEntitiesResponse';
27
+ export type { ImportHarnessEntitiesRequest } from './schemas/ImportHarnessEntitiesRequest';
28
+ export type { ManualComponentImportRequest } from './schemas/ManualComponentImportRequest';
29
+ export type { NamepsaceResponse } from './schemas/NamepsaceResponse';
30
+ export type { NamespaceInfo } from './schemas/NamespaceInfo';
31
+ export type { OnboardingAccessCheckResponse } from './schemas/OnboardingAccessCheckResponse';
32
+ export type { StatusInfo } from './schemas/StatusInfo';
33
+ export type { StatusInfoRequest } from './schemas/StatusInfoRequest';
34
+ export type { StatusInfoResponse } from './schemas/StatusInfoResponse';
@@ -0,0 +1,3 @@
1
+ export { getHarnessEntitiesV1, useGetHarnessEntitiesV1Query, } from './hooks/useGetHarnessEntitiesV1Query';
2
+ export { importHarnessEntitiesV1, useImportHarnessEntitiesV1Mutation, } from './hooks/useImportHarnessEntitiesV1Mutation';
3
+ export { onboardingAccessCheckV1, useOnboardingAccessCheckV1Query, } from './hooks/useOnboardingAccessCheckV1Query';
@@ -0,0 +1,2 @@
1
+ import type { EnvironmentSecretRequest } from '../schemas/EnvironmentSecretRequest';
2
+ export type EnvironmentSecretRequestListRequestBody = EnvironmentSecretRequest[];
@@ -0,0 +1,2 @@
1
+ import type { EnvironmentSecretRequest } from '../schemas/EnvironmentSecretRequest';
2
+ export type EnvironmentSecretRequestRequestBody = EnvironmentSecretRequest;
@@ -0,0 +1,2 @@
1
+ import type { ImportHarnessEntitiesRequest } from '../schemas/ImportHarnessEntitiesRequest';
2
+ export type ImportHarnessEntitiesRequestRequestBody = ImportHarnessEntitiesRequest;
@@ -0,0 +1,2 @@
1
+ import type { ManualComponentImportRequest } from '../schemas/ManualComponentImportRequest';
2
+ export type ManualComponentImportRequestRequestBody = ManualComponentImportRequest;
@@ -0,0 +1,2 @@
1
+ import type { StatusInfoRequest } from '../schemas/StatusInfoRequest';
2
+ export type StatusInfoRequestRequestBody = StatusInfoRequest;
@@ -0,0 +1,2 @@
1
+ import type { EnvironmentSecretResponse } from '../schemas/EnvironmentSecretResponse';
2
+ export type EnvironmentSecretResponseListResponse = EnvironmentSecretResponse[];
@@ -0,0 +1,2 @@
1
+ import type { EnvironmentSecretResponse } from '../schemas/EnvironmentSecretResponse';
2
+ export type EnvironmentSecretResponseResponse = EnvironmentSecretResponse;
@@ -0,0 +1,2 @@
1
+ import type { HarnessEntitiesResponse } from '../schemas/HarnessEntitiesResponse';
2
+ export type HarnessEntitiesResponseResponse = HarnessEntitiesResponse;
@@ -0,0 +1,2 @@
1
+ import type { ImportEntitiesResponse } from '../schemas/ImportEntitiesResponse';
2
+ export type ImportEntitiesResponseResponse = ImportEntitiesResponse;
@@ -0,0 +1,2 @@
1
+ import type { NamepsaceResponse } from '../schemas/NamepsaceResponse';
2
+ export type NamespaceResponseResponse = NamepsaceResponse;
@@ -0,0 +1,2 @@
1
+ import type { OnboardingAccessCheckResponse } from '../schemas/OnboardingAccessCheckResponse';
2
+ export type OnboardingAccessCheckResponseResponse = OnboardingAccessCheckResponse;
@@ -0,0 +1,2 @@
1
+ import type { StatusInfoResponse } from '../schemas/StatusInfoResponse';
2
+ export type StatusInfoResponseResponse = StatusInfoResponse;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Details of IDP catalog connector
3
+ */
4
+ export interface CatalogConnectorInfo {
5
+ branch: string;
6
+ infraConnectorIdentifier: string;
7
+ path: string;
8
+ repo: string;
9
+ sourceConnectorIdentifier: 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,8 @@
1
+ /**
2
+ * Details of Harness Entities to import
3
+ */
4
+ export interface EntitiesForImport {
5
+ orgs: string[];
6
+ projects: string[];
7
+ services: string[];
8
+ }
@@ -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,14 @@
1
+ export interface EnvironmentSecret {
2
+ /**
3
+ * @format int64
4
+ */
5
+ created?: number;
6
+ decrypted_value?: string;
7
+ env_name?: string;
8
+ identifier?: string;
9
+ secret_identifier?: string;
10
+ /**
11
+ * @format int64
12
+ */
13
+ updated?: number;
14
+ }
@@ -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,4 @@
1
+ import type { EnvironmentSecret } from '../schemas/EnvironmentSecret';
2
+ export interface EnvironmentSecretRequest {
3
+ secret?: EnvironmentSecret;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { EnvironmentSecret } from '../schemas/EnvironmentSecret';
2
+ export interface EnvironmentSecretResponse {
3
+ secret?: EnvironmentSecret;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Harness entities mapping with backstage entities
3
+ */
4
+ export interface HarnessBackstageEntities {
5
+ absoluteIdentifier: string;
6
+ entityType: string;
7
+ name: string;
8
+ owner: string;
9
+ system: string;
10
+ type: string;
11
+ }
@@ -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,10 @@
1
+ import type { HarnessBackstageEntities } from '../schemas/HarnessBackstageEntities';
2
+ /**
3
+ * Response for harness entities mapping with backstage entities
4
+ */
5
+ export interface HarnessEntitiesResponse {
6
+ harnessBackstageEntities: HarnessBackstageEntities[];
7
+ orgCount: number;
8
+ projectCount: number;
9
+ serviceCount: number;
10
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Response for import / save harness entities to IDP
3
+ */
4
+ export interface ImportEntitiesResponse {
5
+ status: string;
6
+ }
@@ -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 { CatalogConnectorInfo } from '../schemas/CatalogConnectorInfo';
2
+ import type { EntitiesForImport } from '../schemas/EntitiesForImport';
3
+ /**
4
+ * Details of Harness Entities and Catalog Location info
5
+ */
6
+ export interface ImportHarnessEntitiesRequest {
7
+ catalogConnectorInfo: CatalogConnectorInfo;
8
+ entities: EntitiesForImport;
9
+ }
@@ -0,0 +1,9 @@
1
+ import type { CatalogConnectorInfo } from '../schemas/CatalogConnectorInfo';
2
+ /**
3
+ * Details of yaml and Catalog Location info to manually import component
4
+ */
5
+ export interface ManualComponentImportRequest {
6
+ catalogConnectorInfo: CatalogConnectorInfo;
7
+ entityName: string;
8
+ yaml: string;
9
+ }
@@ -0,0 +1,5 @@
1
+ import type { NamespaceInfo } from '../schemas/NamespaceInfo';
2
+ /**
3
+ * Namespace response body
4
+ */
5
+ export type NamepsaceResponse = NamespaceInfo;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Namespace response body content
3
+ */
4
+ export interface NamespaceInfo {
5
+ accountIdentifier?: string;
6
+ namespace?: string;
7
+ }
@@ -0,0 +1,4 @@
1
+ /* eslint-disable */
2
+ // This code is autogenerated using @harnessio/oats-cli.
3
+ // Please do not modify this code directly.
4
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Response to check whether user is allowed to perform IDP onboarding or not
3
+ */
4
+ export interface OnboardingAccessCheckResponse {
5
+ access: string;
6
+ }
@@ -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,8 @@
1
+ export interface StatusInfo {
2
+ currentStatus?: string;
3
+ reason?: string;
4
+ /**
5
+ * @format int64
6
+ */
7
+ updatedAt?: number;
8
+ }
@@ -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,4 @@
1
+ import type { StatusInfo } from '../schemas/StatusInfo';
2
+ export interface StatusInfoRequest {
3
+ status?: StatusInfo;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { StatusInfo } from '../schemas/StatusInfo';
2
+ export interface StatusInfoResponse {
3
+ status?: StatusInfo;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@harnessio/react-idp-service-client",
3
+ "version": "0.2.0",
4
+ "description": "Harness React idp service client - IDP APIs integrated with react hooks",
5
+ "author": "Harness Inc",
6
+ "license": "MIT",
7
+ "source": "src/index.ts",
8
+ "main": "./dist/index.js",
9
+ "exports": {
10
+ ".": "./dist/index.js"
11
+ },
12
+ "types": "./dist/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": "oats import --config='./oats.config.ts' && cp '../fetcher/fetcher.ts' './src/fetcher.ts' && tsc",
28
+ "fmt": "prettier --write ./index.ts"
29
+ },
30
+ "dependencies": {
31
+ "@tanstack/react-query": "^4.20.4",
32
+ "@types/qs": "^6.9.7",
33
+ "qs": "^6.9.4"
34
+ },
35
+ "devDependencies": {
36
+ "@harnessio/oats-cli": "^2.1.1",
37
+ "@harnessio/oats-plugin-react-query": "^2.1.2",
38
+ "@types/node": "^18.11.9",
39
+ "@types/react": "^18.0.24",
40
+ "eslint": "^8.15.0",
41
+ "typescript": "^4.8.4"
42
+ },
43
+ "engines": {
44
+ "node": "^16"
45
+ }
46
+ }