@harnessio/react-template-service-client 1.0.0 → 1.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/dist/template-service/src/services/hooks/useGetTemplateInputsMutation.d.ts +53 -0
- package/dist/template-service/src/services/hooks/useGetTemplateInputsMutation.js +30 -0
- package/dist/template-service/src/services/index.d.ts +4 -0
- package/dist/template-service/src/services/index.js +1 -0
- package/dist/template-service/src/services/responses/TemplateInputsResponseBodyResponse.d.ts +2 -0
- package/dist/template-service/src/services/responses/TemplateInputsResponseBodyResponse.js +1 -0
- package/dist/template-service/src/services/schemas/TemplateCreateRequestBody.d.ts +4 -0
- package/dist/template-service/src/services/schemas/TemplateInputsResponseBody.d.ts +16 -0
- package/dist/template-service/src/services/schemas/TemplateInputsResponseBody.js +4 -0
- package/dist/template-service/src/services/schemas/TemplateMetadataSummaryResponse.d.ts +4 -0
- package/dist/template-service/src/services/schemas/TemplateResponse.d.ts +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { UseMutationOptions } from '@tanstack/react-query';
|
|
2
|
+
import type { TemplateInputsResponseBodyResponse } from '../responses/TemplateInputsResponseBodyResponse';
|
|
3
|
+
import type { GetPathParamsType, ResponseWithPagination } from '../helpers';
|
|
4
|
+
import { FetcherOptions } from '../../../../fetcher/index.js';
|
|
5
|
+
export interface GetTemplateInputsAccountPathParams {
|
|
6
|
+
template: string;
|
|
7
|
+
}
|
|
8
|
+
export interface GetTemplateInputsAccountQueryParams {
|
|
9
|
+
version?: string;
|
|
10
|
+
branch_name?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface GetTemplateInputsAccountHeaderParams {
|
|
13
|
+
'Load-From-Cache'?: string;
|
|
14
|
+
'Harness-Account'?: string;
|
|
15
|
+
}
|
|
16
|
+
export type GetTemplateInputsAccountOKResponse = TemplateInputsResponseBodyResponse;
|
|
17
|
+
export type GetTemplateInputsAccountErrorResponse = unknown;
|
|
18
|
+
export interface GetTemplateInputsOrgPathParams {
|
|
19
|
+
org: string;
|
|
20
|
+
template: string;
|
|
21
|
+
}
|
|
22
|
+
export interface GetTemplateInputsOrgQueryParams {
|
|
23
|
+
version?: string;
|
|
24
|
+
branch_name?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface GetTemplateInputsOrgHeaderParams {
|
|
27
|
+
'Load-From-Cache'?: string;
|
|
28
|
+
'Harness-Account'?: string;
|
|
29
|
+
}
|
|
30
|
+
export type GetTemplateInputsOrgOKResponse = TemplateInputsResponseBodyResponse;
|
|
31
|
+
export type GetTemplateInputsOrgErrorResponse = unknown;
|
|
32
|
+
export interface GetTemplateInputsProjectPathParams {
|
|
33
|
+
org: string;
|
|
34
|
+
project: string;
|
|
35
|
+
template: string;
|
|
36
|
+
}
|
|
37
|
+
export interface GetTemplateInputsProjectQueryParams {
|
|
38
|
+
version?: string;
|
|
39
|
+
branch_name?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface GetTemplateInputsProjectHeaderParams {
|
|
42
|
+
'Load-From-Cache'?: string;
|
|
43
|
+
'Harness-Account'?: string;
|
|
44
|
+
}
|
|
45
|
+
export type GetTemplateInputsProjectOKResponse = TemplateInputsResponseBodyResponse;
|
|
46
|
+
export type GetTemplateInputsProjectErrorResponse = unknown;
|
|
47
|
+
export type GetTemplateInputsOKResponse<T> = T extends GetTemplateInputsProjectPathParams ? ResponseWithPagination<GetTemplateInputsProjectOKResponse> : T extends GetTemplateInputsOrgPathParams ? ResponseWithPagination<GetTemplateInputsOrgOKResponse> : ResponseWithPagination<GetTemplateInputsAccountOKResponse>;
|
|
48
|
+
export type GetTemplateInputsErrorResponse<T> = T extends GetTemplateInputsProjectPathParams ? GetTemplateInputsProjectErrorResponse : T extends GetTemplateInputsOrgPathParams ? GetTemplateInputsOrgErrorResponse : GetTemplateInputsAccountErrorResponse;
|
|
49
|
+
export interface GetTemplateInputsProps extends Omit<FetcherOptions<unknown, unknown>, 'url'> {
|
|
50
|
+
pathParams: GetTemplateInputsAccountPathParams | GetTemplateInputsOrgPathParams | GetTemplateInputsProjectPathParams;
|
|
51
|
+
}
|
|
52
|
+
export declare function getTemplateInputs<T extends GetTemplateInputsProps = GetTemplateInputsProps>(props: T): Promise<GetTemplateInputsOKResponse<GetPathParamsType<T>>>;
|
|
53
|
+
export declare function useGetTemplateInputsMutation(options?: Omit<UseMutationOptions<GetTemplateInputsOKResponse<unknown>, GetTemplateInputsErrorResponse<unknown>, GetTemplateInputsProps>, 'mutationKey' | 'mutationFn'>): import("@tanstack/react-query").UseMutationResult<ResponseWithPagination<import("..").TemplateInputsResponseBody>, unknown, GetTemplateInputsProps, unknown>;
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
function isProjectPathParams(pathParams) {
|
|
7
|
+
return !!(pathParams.org &&
|
|
8
|
+
pathParams.project);
|
|
9
|
+
}
|
|
10
|
+
function isOrgPathParams(pathParams) {
|
|
11
|
+
return !!(pathParams.org &&
|
|
12
|
+
!pathParams.project);
|
|
13
|
+
}
|
|
14
|
+
export function getTemplateInputs(props) {
|
|
15
|
+
let url = `/v1/templates/${props.pathParams.template}/inputs`;
|
|
16
|
+
let method = 'POST';
|
|
17
|
+
if (isProjectPathParams(props.pathParams)) {
|
|
18
|
+
url = `/v1/orgs/${props.pathParams.org}/projects/${props.pathParams.project}/templates/${props.pathParams.template}/inputs`;
|
|
19
|
+
method = 'POST';
|
|
20
|
+
}
|
|
21
|
+
else if (isOrgPathParams(props.pathParams)) {
|
|
22
|
+
url = `/v1/orgs/${props.pathParams.org}/templates/${props.pathParams.template}/inputs`;
|
|
23
|
+
method = 'POST';
|
|
24
|
+
}
|
|
25
|
+
return fetcher(Object.assign({ url,
|
|
26
|
+
method }, props));
|
|
27
|
+
}
|
|
28
|
+
export function useGetTemplateInputsMutation(options) {
|
|
29
|
+
return useMutation((mutateProps) => getTemplateInputs(mutateProps), options);
|
|
30
|
+
}
|
|
@@ -15,6 +15,8 @@ export type { GetOrgTemplatesInputsSchemaErrorResponse, GetOrgTemplatesInputsSch
|
|
|
15
15
|
export { getOrgTemplatesInputsSchema, useGetOrgTemplatesInputsSchemaQuery, } from './hooks/useGetOrgTemplatesInputsSchemaQuery';
|
|
16
16
|
export type { GetProjectTemplatesInputsSchemaErrorResponse, GetProjectTemplatesInputsSchemaOkResponse, GetProjectTemplatesInputsSchemaProps, GetProjectTemplatesInputsSchemaQueryPathParams, } from './hooks/useGetProjectTemplatesInputsSchemaQuery';
|
|
17
17
|
export { getProjectTemplatesInputsSchema, useGetProjectTemplatesInputsSchemaQuery, } from './hooks/useGetProjectTemplatesInputsSchemaQuery';
|
|
18
|
+
export type { GetTemplateInputsAccountErrorResponse, GetTemplateInputsAccountOKResponse, GetTemplateInputsAccountPathParams, GetTemplateInputsAccountQueryParams, GetTemplateInputsOrgErrorResponse, GetTemplateInputsOrgOKResponse, GetTemplateInputsOrgPathParams, GetTemplateInputsOrgQueryParams, GetTemplateInputsProjectErrorResponse, GetTemplateInputsProjectOKResponse, GetTemplateInputsProjectPathParams, GetTemplateInputsProjectQueryParams, GetTemplateInputsProps, } from './hooks/useGetTemplateInputsMutation';
|
|
19
|
+
export { getTemplateInputs, useGetTemplateInputsMutation, } from './hooks/useGetTemplateInputsMutation';
|
|
18
20
|
export type { GetTemplateAccountErrorResponse, GetTemplateAccountOKResponse, GetTemplateAccountPathParams, GetTemplateAccountQueryParams, GetTemplateOrgErrorResponse, GetTemplateOrgOKResponse, GetTemplateOrgPathParams, GetTemplateOrgQueryParams, GetTemplateProjectErrorResponse, GetTemplateProjectOKResponse, GetTemplateProjectPathParams, GetTemplateProjectQueryParams, GetTemplateProps, } from './hooks/useGetTemplateQuery';
|
|
19
21
|
export { getTemplate, useGetTemplateQuery } from './hooks/useGetTemplateQuery';
|
|
20
22
|
export type { GetTemplateSchemaErrorResponse, GetTemplateSchemaOkResponse, GetTemplateSchemaProps, GetTemplateSchemaQueryQueryParams, } from './hooks/useGetTemplateSchemaQuery';
|
|
@@ -48,6 +50,7 @@ export type { EntityTemplateReferencesResponseResponse } from './responses/Entit
|
|
|
48
50
|
export type { NotificationTemplateValidateResponseBodyResponse } from './responses/NotificationTemplateValidateResponseBodyResponse';
|
|
49
51
|
export type { TemplateImportResponseBodyResponse } from './responses/TemplateImportResponseBodyResponse';
|
|
50
52
|
export type { TemplateInputSchemaDetailsResponseBodyResponse } from './responses/TemplateInputSchemaDetailsResponseBodyResponse';
|
|
53
|
+
export type { TemplateInputsResponseBodyResponse } from './responses/TemplateInputsResponseBodyResponse';
|
|
51
54
|
export type { TemplateMetaDataListResponse } from './responses/TemplateMetaDataListResponse';
|
|
52
55
|
export type { TemplateResponseResponse } from './responses/TemplateResponseResponse';
|
|
53
56
|
export type { TemplateSchemaResponseResponse } from './responses/TemplateSchemaResponseResponse';
|
|
@@ -78,6 +81,7 @@ export type { TemplateImportRequestBody } from './schemas/TemplateImportRequestB
|
|
|
78
81
|
export type { TemplateImportRequestDto } from './schemas/TemplateImportRequestDto';
|
|
79
82
|
export type { TemplateImportResponseBody } from './schemas/TemplateImportResponseBody';
|
|
80
83
|
export type { TemplateInputSchemaDetailsResponseBody } from './schemas/TemplateInputSchemaDetailsResponseBody';
|
|
84
|
+
export type { TemplateInputsResponseBody } from './schemas/TemplateInputsResponseBody';
|
|
81
85
|
export type { TemplateInputsSchemaRequestBody } from './schemas/TemplateInputsSchemaRequestBody';
|
|
82
86
|
export type { TemplateMetaDataList } from './schemas/TemplateMetaDataList';
|
|
83
87
|
export type { TemplateMetadataFilterExpression } from './schemas/TemplateMetadataFilterExpression';
|
|
@@ -6,6 +6,7 @@ export { getEntityTemplateReferences, useGetEntityTemplateReferencesQuery, } fro
|
|
|
6
6
|
export { getInputsSchema, useGetInputsSchemaMutation } from './hooks/useGetInputsSchemaMutation';
|
|
7
7
|
export { getOrgTemplatesInputsSchema, useGetOrgTemplatesInputsSchemaQuery, } from './hooks/useGetOrgTemplatesInputsSchemaQuery';
|
|
8
8
|
export { getProjectTemplatesInputsSchema, useGetProjectTemplatesInputsSchemaQuery, } from './hooks/useGetProjectTemplatesInputsSchemaQuery';
|
|
9
|
+
export { getTemplateInputs, useGetTemplateInputsMutation, } from './hooks/useGetTemplateInputsMutation';
|
|
9
10
|
export { getTemplate, useGetTemplateQuery } from './hooks/useGetTemplateQuery';
|
|
10
11
|
export { getTemplateSchema, useGetTemplateSchemaQuery } from './hooks/useGetTemplateSchemaQuery';
|
|
11
12
|
export { getTemplateStable, useGetTemplateStableQuery } from './hooks/useGetTemplateStableQuery';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface TemplateInputsResponseBody {
|
|
2
|
+
/**
|
|
3
|
+
* Map of input name to input definition (type, default, required, enum, etc.)
|
|
4
|
+
*/
|
|
5
|
+
inputs?: {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Template YAML with nested template refs resolved
|
|
10
|
+
*/
|
|
11
|
+
resolved_template_yaml?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Runtime input form YAML with input placeholders and defaults
|
|
14
|
+
*/
|
|
15
|
+
template_yaml?: string;
|
|
16
|
+
}
|
|
@@ -53,6 +53,10 @@ export interface TemplateMetadataSummaryResponse {
|
|
|
53
53
|
* Scope of template
|
|
54
54
|
*/
|
|
55
55
|
scope?: 'account' | 'org' | 'project' | 'unknown';
|
|
56
|
+
/**
|
|
57
|
+
* Semantic template labels
|
|
58
|
+
*/
|
|
59
|
+
semantic_labels?: string[];
|
|
56
60
|
/**
|
|
57
61
|
* True if this version is stable version of Template
|
|
58
62
|
*/
|
|
@@ -47,6 +47,10 @@ export interface TemplateResponse {
|
|
|
47
47
|
* Scope of template
|
|
48
48
|
*/
|
|
49
49
|
scope?: 'account' | 'org' | 'project' | 'unknown';
|
|
50
|
+
/**
|
|
51
|
+
* Semantic template labels
|
|
52
|
+
*/
|
|
53
|
+
semantic_labels?: string[];
|
|
50
54
|
/**
|
|
51
55
|
* True if this version is stable version of Template
|
|
52
56
|
*/
|
package/package.json
CHANGED