chore: fixing api reports for a cleanup
Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
@@ -77,6 +77,10 @@ export interface TemplateEntityV1beta3 extends Entity {
|
||||
type: string;
|
||||
presentation?: TemplatePresentationV1beta3;
|
||||
EXPERIMENTAL_recovery?: TemplateRecoveryV1beta3;
|
||||
EXPERIMENTAL_formDecorators?: {
|
||||
id: string;
|
||||
input?: JsonObject;
|
||||
}[];
|
||||
parameters?: TemplateParametersV1beta3 | TemplateParametersV1beta3[];
|
||||
steps: Array<TemplateEntityStepV1beta3>;
|
||||
output?: {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
```ts
|
||||
/// <reference types="react" />
|
||||
|
||||
import { AnyApiRef } from '@backstage/core-plugin-api';
|
||||
import { ApiHolder } from '@backstage/core-plugin-api';
|
||||
import { ComponentType } from 'react';
|
||||
import { ConfigurableExtensionDataRef } from '@backstage/frontend-plugin-api';
|
||||
@@ -75,6 +76,35 @@ export function createFormField<
|
||||
TUiOptions extends z.ZodType,
|
||||
>(opts: FormFieldExtensionData<TReturnValue, TUiOptions>): FormField;
|
||||
|
||||
// @alpha
|
||||
export function createScaffolderFormDecorator<
|
||||
TDeps extends {
|
||||
[key in string]: AnyApiRef;
|
||||
},
|
||||
TInputSchema extends {
|
||||
[key in string]: (zImpl: typeof z) => z.ZodType;
|
||||
},
|
||||
TInput extends {} = {
|
||||
[key in keyof TInputSchema]: z.infer<ReturnType<TInputSchema[key]>>;
|
||||
},
|
||||
>(options: {
|
||||
id: string;
|
||||
schema?: {
|
||||
input?: TInputSchema;
|
||||
};
|
||||
deps?: TDeps;
|
||||
fn: (
|
||||
ctx: ScaffolderFormDecoratorContext<TInput>,
|
||||
deps: TDeps extends {
|
||||
[key in string]: AnyApiRef;
|
||||
}
|
||||
? {
|
||||
[key in keyof TDeps]: TDeps[key]['T'];
|
||||
}
|
||||
: never,
|
||||
) => Promise<void>;
|
||||
}): ScaffolderFormDecorator<TInputSchema, TDeps, TInput>;
|
||||
|
||||
// @alpha
|
||||
export const DefaultTemplateOutputs: (props: {
|
||||
output?: ScaffolderTaskOutput;
|
||||
@@ -190,6 +220,50 @@ export interface ScaffolderFieldProps {
|
||||
required?: boolean;
|
||||
}
|
||||
|
||||
// @alpha (undocumented)
|
||||
export type ScaffolderFormDecorator<
|
||||
TInputSchema extends {
|
||||
[key in string]: (zImpl: typeof z) => z.ZodType;
|
||||
} = {},
|
||||
TDeps extends {
|
||||
[key in string]: AnyApiRef;
|
||||
} = {
|
||||
[key in string]: AnyApiRef;
|
||||
},
|
||||
TInput extends {} = {
|
||||
[key in keyof TInputSchema]: z.infer<ReturnType<TInputSchema[key]>>;
|
||||
},
|
||||
> = {
|
||||
version: 'v1';
|
||||
id: string;
|
||||
schema?: {
|
||||
input?: TInputSchema;
|
||||
};
|
||||
deps?: TDeps;
|
||||
fn: (
|
||||
ctx: ScaffolderFormDecoratorContext<TInput>,
|
||||
deps: TDeps extends {
|
||||
[key in string]: AnyApiRef;
|
||||
}
|
||||
? {
|
||||
[key in keyof TDeps]: TDeps[key]['T'];
|
||||
}
|
||||
: never,
|
||||
) => Promise<void>;
|
||||
};
|
||||
|
||||
// @alpha (undocumented)
|
||||
export type ScaffolderFormDecoratorContext<TInput> = {
|
||||
input: TInput;
|
||||
formState: Record<string, JsonValue>;
|
||||
setFormState: (
|
||||
fn: (currentState: Record<string, JsonValue>) => Record<string, JsonValue>,
|
||||
) => void;
|
||||
setSecrets: (
|
||||
fn: (currentState: Record<string, string>) => Record<string, string>,
|
||||
) => void;
|
||||
};
|
||||
|
||||
// @alpha (undocumented)
|
||||
export function ScaffolderPageContextMenu(
|
||||
props: ScaffolderPageContextMenuProps,
|
||||
@@ -346,9 +420,9 @@ export const useFormDataFromQuery: (
|
||||
|
||||
// @alpha (undocumented)
|
||||
export const useTemplateParameterSchema: (templateRef: string) => {
|
||||
manifest: TemplateParameterSchema | undefined;
|
||||
manifest?: TemplateParameterSchema | undefined;
|
||||
loading: boolean;
|
||||
error: Error | undefined;
|
||||
error?: Error | undefined;
|
||||
};
|
||||
|
||||
// @alpha
|
||||
|
||||
@@ -538,6 +538,10 @@ export type TemplateParameterSchema = {
|
||||
description?: string;
|
||||
schema: JsonObject;
|
||||
}>;
|
||||
EXPERIMENTAL_formDecorators?: {
|
||||
id: string;
|
||||
input?: JsonObject;
|
||||
}[];
|
||||
};
|
||||
|
||||
// @public
|
||||
|
||||
@@ -17,6 +17,7 @@ import { AnyApiRef } from '@backstage/core-plugin-api';
|
||||
import { JsonValue } from '@backstage/types';
|
||||
import { z } from 'zod';
|
||||
|
||||
/** @alpha */
|
||||
export type ScaffolderFormDecoratorContext<TInput> = {
|
||||
input: TInput;
|
||||
formState: Record<string, JsonValue>;
|
||||
@@ -29,6 +30,7 @@ export type ScaffolderFormDecoratorContext<TInput> = {
|
||||
) => void;
|
||||
};
|
||||
|
||||
/** @alpha */
|
||||
export type ScaffolderFormDecorator<
|
||||
TInputSchema extends { [key in string]: (zImpl: typeof z) => z.ZodType } = {},
|
||||
TDeps extends { [key in string]: AnyApiRef } = { [key in string]: AnyApiRef },
|
||||
@@ -53,7 +55,7 @@ export type ScaffolderFormDecorator<
|
||||
/**
|
||||
* Method for creating decorators which can be used to collect
|
||||
* secrets from the user before submitting to the backend.
|
||||
* @public
|
||||
* @alpha
|
||||
*/
|
||||
export function createScaffolderFormDecorator<
|
||||
TDeps extends { [key in string]: AnyApiRef },
|
||||
|
||||
@@ -17,11 +17,14 @@
|
||||
import useAsync from 'react-use/esm/useAsync';
|
||||
import { scaffolderApiRef } from '../../api/ref';
|
||||
import { useApi } from '@backstage/core-plugin-api';
|
||||
import { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';
|
||||
|
||||
/**
|
||||
* @alpha
|
||||
*/
|
||||
export const useTemplateParameterSchema = (templateRef: string) => {
|
||||
export const useTemplateParameterSchema = (
|
||||
templateRef: string,
|
||||
): { manifest?: TemplateParameterSchema; loading: boolean; error?: Error } => {
|
||||
const scaffolderApi = useApi(scaffolderApiRef);
|
||||
const {
|
||||
value: manifest,
|
||||
|
||||
Reference in New Issue
Block a user