diff --git a/plugins/scaffolder/api-report.md b/plugins/scaffolder/api-report.md index 0947042815..eb015ad8da 100644 --- a/plugins/scaffolder/api-report.md +++ b/plugins/scaffolder/api-report.md @@ -36,112 +36,146 @@ import { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common'; import { UIOptionsType } from '@rjsf/utils'; import { UiSchema } from '@rjsf/core'; import { UiSchema as UiSchema_2 } from '@rjsf/utils'; +import { z } from 'zod'; // @alpha export function createNextScaffolderFieldExtension< - TReturnValue = unknown, - TInputProps extends UIOptionsType = {}, - >( - options: NextFieldExtensionOptions, + TReturnValue = unknown, + TInputProps extends UIOptionsType = {}, +>( + options: NextFieldExtensionOptions, ): Extension>; // @public export function createScaffolderFieldExtension< - TReturnValue = unknown, - TInputProps = unknown, - >( - options: FieldExtensionOptions, + TReturnValue = unknown, + TInputProps = unknown, +>( + options: FieldExtensionOptions, ): Extension>; // @public export function createScaffolderLayout( - options: LayoutOptions, + options: LayoutOptions, ): Extension>; +// @public +export type CustomFieldExtensionSchema = { + returnValue: JSONSchema7; + uiOptions?: JSONSchema7; +}; + // @public export type CustomFieldValidator = ( - data: TFieldReturnValue, - field: FieldValidation, - context: { - apiHolder: ApiHolder; - }, + data: TFieldReturnValue, + field: FieldValidation, + context: { + apiHolder: ApiHolder; + }, ) => void | Promise; // @public export const EntityNamePickerFieldExtension: FieldExtensionComponent< - string, - {} - >; + string, + {} +>; // @public export const EntityPickerFieldExtension: FieldExtensionComponent< - string, - EntityPickerUiOptions - >; + string, + { + defaultKind?: string | undefined; + defaultNamespace?: string | false | undefined; + allowedKinds?: string[] | undefined; + allowArbitraryValues?: boolean | undefined; + } +>; + +// @public (undocumented) +export const EntityPickerFieldSchema: FieldSchema< + string, + { + defaultKind?: string | undefined; + defaultNamespace?: string | false | undefined; + allowedKinds?: string[] | undefined; + allowArbitraryValues?: boolean | undefined; + } +>; // @public -export interface EntityPickerUiOptions { - // (undocumented) - allowArbitraryValues?: boolean; - // (undocumented) - allowedKinds?: string[]; - // (undocumented) - defaultKind?: string; - // (undocumented) - defaultNamespace?: string | false; -} +export type EntityPickerUiOptions = + typeof EntityPickerFieldSchema.uiOptionsType; // @public export const EntityTagsPickerFieldExtension: FieldExtensionComponent< - string[], - EntityTagsPickerUiOptions - >; + string[], + { + showCounts?: boolean | undefined; + kinds?: string[] | undefined; + helperText?: string | undefined; + } +>; + +// @public (undocumented) +export const EntityTagsPickerFieldSchema: FieldSchema< + string[], + { + showCounts?: boolean | undefined; + kinds?: string[] | undefined; + helperText?: string | undefined; + } +>; // @public -export interface EntityTagsPickerUiOptions { - // (undocumented) - helperText?: string; - // (undocumented) - kinds?: string[]; - // (undocumented) - showCounts?: boolean; -} +export type EntityTagsPickerUiOptions = + typeof EntityTagsPickerFieldSchema.uiOptionsType; // @public export type FieldExtensionComponent<_TReturnValue, _TInputProps> = () => null; // @public export interface FieldExtensionComponentProps< - TFieldReturnValue, - TUiOptions extends {} = {}, - > extends FieldProps { - // (undocumented) - uiSchema: FieldProps['uiSchema'] & { - 'ui:options'?: TUiOptions; - }; + TFieldReturnValue, + TUiOptions extends {} = {}, +> extends FieldProps { + // (undocumented) + uiSchema: FieldProps['uiSchema'] & { + 'ui:options'?: TUiOptions; + }; } // @public export type FieldExtensionOptions< - TFieldReturnValue = unknown, - TInputProps = unknown, - > = { - name: string; - component: ( - props: FieldExtensionComponentProps, - ) => JSX.Element | null; - validation?: CustomFieldValidator; + TFieldReturnValue = unknown, + TInputProps = unknown, +> = { + name: string; + component: ( + props: FieldExtensionComponentProps, + ) => JSX.Element | null; + validation?: CustomFieldValidator; + schema?: CustomFieldExtensionSchema; }; +// @public +export interface FieldSchema { + // (undocumented) + readonly schema: CustomFieldExtensionSchema; + // (undocumented) + readonly type: FieldExtensionComponentProps; + // (undocumented) + readonly uiOptionsType: TUiOptions; +} + // @public export type LayoutComponent<_TInputProps> = () => null; // @public export interface LayoutOptions

{ - // (undocumented) - component: LayoutTemplate

; - // (undocumented) - name: string; + // (undocumented) + component: LayoutTemplate

; + // (undocumented) + name: string; } // @public @@ -149,57 +183,72 @@ export type LayoutTemplate = FormProps['ObjectFieldTemplate']; // @public export type ListActionsResponse = Array<{ - id: string; - description?: string; - schema?: { - input?: JSONSchema7; - output?: JSONSchema7; - }; + id: string; + description?: string; + schema?: { + input?: JSONSchema7; + output?: JSONSchema7; + }; }>; // @public export type LogEvent = { - type: 'log' | 'completion'; - body: { - message: string; - stepId?: string; - status?: ScaffolderTaskStatus; - }; - createdAt: string; - id: string; - taskId: string; + type: 'log' | 'completion'; + body: { + message: string; + stepId?: string; + status?: ScaffolderTaskStatus; + }; + createdAt: string; + id: string; + taskId: string; }; +// @public +export function makeFieldSchemaFromZod< + TReturnSchema extends z.ZodType, + TUiOptionsSchema extends z.ZodType = z.ZodType, +>( + returnSchema: TReturnSchema, + uiOptionsSchema?: TUiOptionsSchema, +): FieldSchema< + TReturnSchema extends z.ZodType ? IReturn : never, + TUiOptionsSchema extends z.ZodType + ? IUiOptions + : never +>; + // @alpha export type NextCustomFieldValidator = ( - data: TFieldReturnValue, - field: FieldValidation_2, - context: { - apiHolder: ApiHolder; - }, + data: TFieldReturnValue, + field: FieldValidation_2, + context: { + apiHolder: ApiHolder; + }, ) => void | Promise; // @alpha export interface NextFieldExtensionComponentProps< - TFieldReturnValue, - TUiOptions = {}, - > extends PropsWithChildren> { - // (undocumented) - uiSchema?: UiSchema_2 & { - 'ui:options'?: TUiOptions & UIOptionsType; - }; + TFieldReturnValue, + TUiOptions = {}, +> extends PropsWithChildren> { + // (undocumented) + uiSchema?: UiSchema_2 & { + 'ui:options'?: TUiOptions & UIOptionsType; + }; } // @alpha export type NextFieldExtensionOptions< - TFieldReturnValue = unknown, - TInputProps = unknown, - > = { - name: string; - component: ( - props: NextFieldExtensionComponentProps, - ) => JSX.Element | null; - validation?: NextCustomFieldValidator; + TFieldReturnValue = unknown, + TInputProps = unknown, +> = { + name: string; + component: ( + props: NextFieldExtensionComponentProps, + ) => JSX.Element | null; + validation?: NextCustomFieldValidator; + schema?: CustomFieldExtensionSchema; }; // @alpha (undocumented) @@ -207,109 +256,149 @@ export const nextRouteRef: RouteRef; // @alpha export type NextRouterProps = { - components?: { - TemplateCardComponent?: React_2.ComponentType<{ - template: TemplateEntityV1beta3; - }>; - TaskPageComponent?: React_2.ComponentType<{}>; - }; - groups?: TemplateGroupFilter[]; + components?: { + TemplateCardComponent?: React_2.ComponentType<{ + template: TemplateEntityV1beta3; + }>; + TaskPageComponent?: React_2.ComponentType<{}>; + }; + groups?: TemplateGroupFilter[]; }; // @alpha export const NextScaffolderPage: ( - props: PropsWithChildren, + props: PropsWithChildren, ) => JSX.Element; // @alpha (undocumented) export const nextSelectedTemplateRouteRef: SubRouteRef< - PathParams<'/templates/:namespace/:templateName'> - >; + PathParams<'/templates/:namespace/:templateName'> +>; // @public export const OwnedEntityPickerFieldExtension: FieldExtensionComponent< - string, - OwnedEntityPickerUiOptions - >; + string, + { + defaultKind?: string | undefined; + defaultNamespace?: string | false | undefined; + allowedKinds?: string[] | undefined; + allowArbitraryValues?: boolean | undefined; + } +>; + +// @public (undocumented) +export const OwnedEntityPickerFieldSchema: FieldSchema< + string, + { + defaultKind?: string | undefined; + defaultNamespace?: string | false | undefined; + allowedKinds?: string[] | undefined; + allowArbitraryValues?: boolean | undefined; + } +>; // @public -export interface OwnedEntityPickerUiOptions { - // (undocumented) - allowArbitraryValues?: boolean; - // (undocumented) - allowedKinds?: string[]; - // (undocumented) - defaultKind?: string; - // (undocumented) - defaultNamespace?: string | false; -} +export type OwnedEntityPickerUiOptions = + typeof OwnedEntityPickerFieldSchema.uiOptionsType; // @public export const OwnerPickerFieldExtension: FieldExtensionComponent< - string, - OwnerPickerUiOptions - >; + string, + { + defaultNamespace?: string | false | undefined; + allowedKinds?: string[] | undefined; + allowArbitraryValues?: boolean | undefined; + } +>; + +// @public (undocumented) +export const OwnerPickerFieldSchema: FieldSchema< + string, + { + defaultNamespace?: string | false | undefined; + allowedKinds?: string[] | undefined; + allowArbitraryValues?: boolean | undefined; + } +>; // @public -export interface OwnerPickerUiOptions { - // (undocumented) - allowArbitraryValues?: boolean; - // (undocumented) - allowedKinds?: string[]; - // (undocumented) - defaultNamespace?: string | false; -} +export type OwnerPickerUiOptions = typeof OwnerPickerFieldSchema.uiOptionsType; // @public export const repoPickerValidation: ( - value: string, - validation: FieldValidation, - context: { - apiHolder: ApiHolder; - }, + value: string, + validation: FieldValidation, + context: { + apiHolder: ApiHolder; + }, ) => void; // @public export const RepoUrlPickerFieldExtension: FieldExtensionComponent< - string, - RepoUrlPickerUiOptions - >; + string, + { + allowedOwners?: string[] | undefined; + allowedOrganizations?: string[] | undefined; + allowedRepos?: string[] | undefined; + allowedHosts?: string[] | undefined; + requestUserCredentials?: + | { + additionalScopes?: + | { + azure?: string[] | undefined; + github?: string[] | undefined; + gitlab?: string[] | undefined; + bitbucket?: string[] | undefined; + gerrit?: string[] | undefined; + } + | undefined; + secretsKey: string; + } + | undefined; + } +>; + +// @public (undocumented) +export const RepoUrlPickerFieldSchema: FieldSchema< + string, + { + allowedOwners?: string[] | undefined; + allowedOrganizations?: string[] | undefined; + allowedRepos?: string[] | undefined; + allowedHosts?: string[] | undefined; + requestUserCredentials?: + | { + additionalScopes?: + | { + azure?: string[] | undefined; + github?: string[] | undefined; + gitlab?: string[] | undefined; + bitbucket?: string[] | undefined; + gerrit?: string[] | undefined; + } + | undefined; + secretsKey: string; + } + | undefined; + } +>; // @public -export interface RepoUrlPickerUiOptions { - // (undocumented) - allowedHosts?: string[]; - // (undocumented) - allowedOrganizations?: string[]; - // (undocumented) - allowedOwners?: string[]; - // (undocumented) - allowedRepos?: string[]; - // (undocumented) - requestUserCredentials?: { - secretsKey: string; - additionalScopes?: { - gerrit?: string[]; - github?: string[]; - gitlab?: string[]; - bitbucket?: string[]; - azure?: string[]; - }; - }; -} +export type RepoUrlPickerUiOptions = + typeof RepoUrlPickerFieldSchema.uiOptionsType; // @public export type ReviewStepProps = { - disableButtons: boolean; - formData: JsonObject; - handleBack: () => void; - handleReset: () => void; - handleCreate: () => void; - steps: { - uiSchema: UiSchema; - mergedSchema: JsonObject; - schema: JsonObject; - }[]; + disableButtons: boolean; + formData: JsonObject; + handleBack: () => void; + handleReset: () => void; + handleCreate: () => void; + steps: { + uiSchema: UiSchema; + mergedSchema: JsonObject; + schema: JsonObject; + }[]; }; // @public (undocumented) @@ -317,55 +406,55 @@ export const rootRouteRef: RouteRef; // @public export type RouterProps = { - components?: { - ReviewStepComponent?: ComponentType; - TemplateCardComponent?: - | ComponentType<{ - template: TemplateEntityV1beta3; + components?: { + ReviewStepComponent?: ComponentType; + TemplateCardComponent?: + | ComponentType<{ + template: TemplateEntityV1beta3; }> - | undefined; - TaskPageComponent?: ComponentType<{}>; - }; - groups?: Array<{ - title?: React_2.ReactNode; - filter: (entity: Entity) => boolean; - }>; - defaultPreviewTemplate?: string; - headerOptions?: { - pageTitleOverride?: string; - title?: string; - subtitle?: string; - }; - contextMenu?: { - editor?: boolean; - actions?: boolean; - }; + | undefined; + TaskPageComponent?: ComponentType<{}>; + }; + groups?: Array<{ + title?: React_2.ReactNode; + filter: (entity: Entity) => boolean; + }>; + defaultPreviewTemplate?: string; + headerOptions?: { + pageTitleOverride?: string; + title?: string; + subtitle?: string; + }; + contextMenu?: { + editor?: boolean; + actions?: boolean; + }; }; // @public export interface ScaffolderApi { - // (undocumented) - dryRun?(options: ScaffolderDryRunOptions): Promise; - // (undocumented) - getIntegrationsList( - options: ScaffolderGetIntegrationsListOptions, - ): Promise; - // (undocumented) - getTask(taskId: string): Promise; - // (undocumented) - getTemplateParameterSchema( - templateRef: string, - ): Promise; - listActions(): Promise; - // (undocumented) - listTasks?(options: { filterByOwnership: 'owned' | 'all' }): Promise<{ - tasks: ScaffolderTask[]; - }>; - scaffold( - options: ScaffolderScaffoldOptions, - ): Promise; - // (undocumented) - streamLogs(options: ScaffolderStreamLogsOptions): Observable; + // (undocumented) + dryRun?(options: ScaffolderDryRunOptions): Promise; + // (undocumented) + getIntegrationsList( + options: ScaffolderGetIntegrationsListOptions, + ): Promise; + // (undocumented) + getTask(taskId: string): Promise; + // (undocumented) + getTemplateParameterSchema( + templateRef: string, + ): Promise; + listActions(): Promise; + // (undocumented) + listTasks?(options: { filterByOwnership: 'owned' | 'all' }): Promise<{ + tasks: ScaffolderTask[]; + }>; + scaffold( + options: ScaffolderScaffoldOptions, + ): Promise; + // (undocumented) + streamLogs(options: ScaffolderStreamLogsOptions): Observable; } // @public @@ -373,67 +462,67 @@ export const scaffolderApiRef: ApiRef; // @public export class ScaffolderClient implements ScaffolderApi { - constructor(options: { - discoveryApi: DiscoveryApi; - fetchApi: FetchApi; - identityApi?: IdentityApi; - scmIntegrationsApi: ScmIntegrationRegistry; - useLongPollingLogs?: boolean; - }); - // (undocumented) - dryRun(options: ScaffolderDryRunOptions): Promise; - // (undocumented) - getIntegrationsList( - options: ScaffolderGetIntegrationsListOptions, - ): Promise; - // (undocumented) - getTask(taskId: string): Promise; - // (undocumented) - getTemplateParameterSchema( - templateRef: string, - ): Promise; - // (undocumented) - listActions(): Promise; - // (undocumented) - listTasks(options: { filterByOwnership: 'owned' | 'all' }): Promise<{ - tasks: ScaffolderTask[]; - }>; - scaffold( - options: ScaffolderScaffoldOptions, - ): Promise; - // (undocumented) - streamLogs(options: ScaffolderStreamLogsOptions): Observable; + constructor(options: { + discoveryApi: DiscoveryApi; + fetchApi: FetchApi; + identityApi?: IdentityApi; + scmIntegrationsApi: ScmIntegrationRegistry; + useLongPollingLogs?: boolean; + }); + // (undocumented) + dryRun(options: ScaffolderDryRunOptions): Promise; + // (undocumented) + getIntegrationsList( + options: ScaffolderGetIntegrationsListOptions, + ): Promise; + // (undocumented) + getTask(taskId: string): Promise; + // (undocumented) + getTemplateParameterSchema( + templateRef: string, + ): Promise; + // (undocumented) + listActions(): Promise; + // (undocumented) + listTasks(options: { filterByOwnership: 'owned' | 'all' }): Promise<{ + tasks: ScaffolderTask[]; + }>; + scaffold( + options: ScaffolderScaffoldOptions, + ): Promise; + // (undocumented) + streamLogs(options: ScaffolderStreamLogsOptions): Observable; } // @public (undocumented) export interface ScaffolderDryRunOptions { - // (undocumented) - directoryContents: { - path: string; - base64Content: string; - }[]; - // (undocumented) - secrets?: Record; - // (undocumented) - template: JsonValue; - // (undocumented) - values: JsonObject; + // (undocumented) + directoryContents: { + path: string; + base64Content: string; + }[]; + // (undocumented) + secrets?: Record; + // (undocumented) + template: JsonValue; + // (undocumented) + values: JsonObject; } // @public (undocumented) export interface ScaffolderDryRunResponse { - // (undocumented) - directoryContents: Array<{ - path: string; - base64Content: string; - executable: boolean; - }>; - // (undocumented) - log: Array>; - // (undocumented) - output: ScaffolderTaskOutput; - // (undocumented) - steps: TaskStep[]; + // (undocumented) + directoryContents: Array<{ + path: string; + base64Content: string; + executable: boolean; + }>; + // (undocumented) + log: Array>; + // (undocumented) + output: ScaffolderTaskOutput; + // (undocumented) + steps: TaskStep[]; } // @public @@ -441,18 +530,18 @@ export const ScaffolderFieldExtensions: React_2.ComponentType; // @public export interface ScaffolderGetIntegrationsListOptions { - // (undocumented) - allowedHosts: string[]; + // (undocumented) + allowedHosts: string[]; } // @public export interface ScaffolderGetIntegrationsListResponse { - // (undocumented) - integrations: { - type: string; - title: string; - host: string; - }[]; + // (undocumented) + integrations: { + type: string; + title: string; + host: string; + }[]; } // @public @@ -460,10 +549,10 @@ export const ScaffolderLayouts: React.ComponentType; // @public (undocumented) export type ScaffolderOutputLink = { - title?: string; - icon?: string; - url?: string; - entityRef?: string; + title?: string; + icon?: string; + url?: string; + entityRef?: string; }; // @public @@ -471,105 +560,105 @@ export const ScaffolderPage: (props: RouterProps) => JSX.Element; // @public export const scaffolderPlugin: BackstagePlugin< - { - root: RouteRef; - }, - { - registerComponent: ExternalRouteRef; - viewTechDoc: ExternalRouteRef< - { - name: string; - kind: string; - namespace: string; - }, - true - >; - }, - {} + { + root: RouteRef; + }, + { + registerComponent: ExternalRouteRef; + viewTechDoc: ExternalRouteRef< + { + name: string; + kind: string; + namespace: string; + }, + true >; + }, + {} +>; // @public export interface ScaffolderScaffoldOptions { - // (undocumented) - secrets?: Record; - // (undocumented) - templateRef: string; - // (undocumented) - values: Record; + // (undocumented) + secrets?: Record; + // (undocumented) + templateRef: string; + // (undocumented) + values: Record; } // @public export interface ScaffolderScaffoldResponse { - // (undocumented) - taskId: string; + // (undocumented) + taskId: string; } // @public export interface ScaffolderStreamLogsOptions { - // (undocumented) - after?: number; - // (undocumented) - taskId: string; + // (undocumented) + after?: number; + // (undocumented) + taskId: string; } // @public export type ScaffolderTask = { - id: string; - spec: TaskSpec; - status: 'failed' | 'completed' | 'processing' | 'open' | 'cancelled'; - lastHeartbeatAt: string; - createdAt: string; + id: string; + spec: TaskSpec; + status: 'failed' | 'completed' | 'processing' | 'open' | 'cancelled'; + lastHeartbeatAt: string; + createdAt: string; }; // @public (undocumented) export type ScaffolderTaskOutput = { - links?: ScaffolderOutputLink[]; + links?: ScaffolderOutputLink[]; } & { - [key: string]: unknown; + [key: string]: unknown; }; // @public export type ScaffolderTaskStatus = - | 'open' - | 'processing' - | 'failed' - | 'completed' - | 'skipped'; + | 'open' + | 'processing' + | 'failed' + | 'completed' + | 'skipped'; // @public export interface ScaffolderUseTemplateSecrets { - // (undocumented) - setSecrets: (input: Record) => void; + // (undocumented) + setSecrets: (input: Record) => void; } // @public (undocumented) export const selectedTemplateRouteRef: SubRouteRef< - PathParams<'/templates/:namespace/:templateName'> - >; + PathParams<'/templates/:namespace/:templateName'> +>; // @public export const TaskPage: ({ loadingText }: TaskPageProps) => JSX.Element; // @public export type TaskPageProps = { - loadingText?: string; + loadingText?: string; }; // @alpha (undocumented) export type TemplateGroupFilter = { - title?: React_2.ReactNode; - filter: (entity: Entity) => boolean; + title?: React_2.ReactNode; + filter: (entity: Entity) => boolean; }; // @public export type TemplateParameterSchema = { + title: string; + description?: string; + steps: Array<{ title: string; description?: string; - steps: Array<{ - title: string; - description?: string; - schema: JsonObject; - }>; + schema: JsonObject; + }>; }; // @public