From c2f1010f3c58abcb6503ee149590cfb1eacb5c8e Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 22 Dec 2022 17:33:07 +0100 Subject: [PATCH] chore: fixing the re-exporting of the types with the alpha annotation Signed-off-by: blam --- plugins/scaffolder-react/api-report.md | 248 +++++++++++++++++++++++++ plugins/scaffolder/src/index.ts | 66 ++++++- plugins/scaffolder/src/next/index.ts | 2 - 3 files changed, 307 insertions(+), 9 deletions(-) create mode 100644 plugins/scaffolder-react/api-report.md diff --git a/plugins/scaffolder-react/api-report.md b/plugins/scaffolder-react/api-report.md new file mode 100644 index 0000000000..81259772b5 --- /dev/null +++ b/plugins/scaffolder-react/api-report.md @@ -0,0 +1,248 @@ +## API Report File for "@backstage/plugin-scaffolder-react" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts +/// + +import { ApiHolder } from '@backstage/core-plugin-api'; +import { Extension } from '@backstage/core-plugin-api'; +import { ExternalRouteRef } from '@backstage/core-plugin-api'; +import { FieldProps } from '@rjsf/core'; +import { FieldProps as FieldProps_2 } from '@rjsf/utils'; +import { FieldValidation } from '@rjsf/core'; +import { FieldValidation as FieldValidation_2 } from '@rjsf/utils'; +import type { FormProps as FormProps_2 } from '@rjsf/core-v5'; +import { JsonObject } from '@backstage/types'; +import { JSONSchema7 } from 'json-schema'; +import { JsonValue } from '@backstage/types'; +import { PathParams } from '@backstage/core-plugin-api'; +import { PropsWithChildren } from 'react'; +import { default as React_2 } from 'react'; +import { RouteRef } from '@backstage/core-plugin-api'; +import { SubRouteRef } from '@backstage/core-plugin-api'; +import { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common'; +import { UIOptionsType } from '@rjsf/utils'; +import { UiSchema } from '@rjsf/utils'; + +// Warning: (ae-missing-release-tag) "actionsRouteRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const actionsRouteRef: SubRouteRef; + +// @alpha +export const createFieldValidation: () => FieldValidation_2; + +// @alpha +export function createNextScaffolderFieldExtension< + TReturnValue = unknown, + TInputProps extends UIOptionsType = {}, +>( + options: NextFieldExtensionOptions, +): Extension>; + +// @public +export function createScaffolderFieldExtension< + TReturnValue = unknown, + TInputProps = unknown, +>( + options: FieldExtensionOptions, +): Extension>; + +// @public +export type CustomFieldExtensionSchema = { + returnValue: JSONSchema7; + uiOptions?: JSONSchema7; +}; + +// @public +export type CustomFieldValidator = ( + data: TFieldReturnValue, + field: FieldValidation, + context: { + apiHolder: ApiHolder; + }, +) => void | Promise; + +// Warning: (ae-missing-release-tag) "editRouteRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const editRouteRef: SubRouteRef; + +// @alpha +export const extractSchemaFromStep: (inputStep: JsonObject) => { + uiSchema: UiSchema; + schema: JsonObject; +}; + +// Warning: (ae-missing-release-tag) "FIELD_EXTENSION_KEY" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const FIELD_EXTENSION_KEY = 'scaffolder.extensions.field.v1'; + +// Warning: (ae-missing-release-tag) "FIELD_EXTENSION_WRAPPER_KEY" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const FIELD_EXTENSION_WRAPPER_KEY = 'scaffolder.extensions.wrapper.v1'; + +// @public +export type FieldExtensionComponent<_TReturnValue, _TInputProps> = () => null; + +// @public +export interface FieldExtensionComponentProps< + 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; + schema?: CustomFieldExtensionSchema; +}; + +// @alpha +export type FormProps = Pick< + FormProps_2, + 'transformErrors' | 'noHtml5Validate' +>; + +// Warning: (ae-missing-release-tag) "legacySelectedTemplateRouteRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public @deprecated (undocumented) +export const legacySelectedTemplateRouteRef: SubRouteRef< + PathParams<'/templates/:templateName'> +>; + +// @alpha +export type NextCustomFieldValidator = ( + data: TFieldReturnValue, + field: FieldValidation_2, + context: { + apiHolder: ApiHolder; + formData: JsonObject; + }, +) => void | Promise; + +// @alpha +export interface NextFieldExtensionComponentProps< + TFieldReturnValue, + TUiOptions = {}, +> extends PropsWithChildren> { + // (undocumented) + uiSchema?: UiSchema & { + 'ui:options'?: TUiOptions & UIOptionsType; + }; +} + +// @alpha +export type NextFieldExtensionOptions< + TFieldReturnValue = unknown, + TInputProps = unknown, +> = { + name: string; + component: ( + props: NextFieldExtensionComponentProps, + ) => JSX.Element | null; + validation?: NextCustomFieldValidator; + schema?: CustomFieldExtensionSchema; +}; + +// @alpha (undocumented) +export const nextRouteRef: RouteRef; + +// Warning: (ae-missing-release-tag) "nextScaffolderTaskRouteRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const nextScaffolderTaskRouteRef: SubRouteRef< + PathParams<'/tasks/:taskId'> +>; + +// @alpha (undocumented) +export const nextSelectedTemplateRouteRef: SubRouteRef< + PathParams<'/templates/:namespace/:templateName'> +>; + +// Warning: (ae-missing-release-tag) "registerComponentRouteRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const registerComponentRouteRef: ExternalRouteRef; + +// Warning: (ae-forgotten-export) The symbol "ReviewStateProps" needs to be exported by the entry point index.d.ts +// +// @alpha +export const ReviewState: (props: ReviewStateProps) => JSX.Element; + +// @public (undocumented) +export const rootRouteRef: RouteRef; + +// @public +export const ScaffolderFieldExtensions: React_2.ComponentType; + +// Warning: (ae-missing-release-tag) "scaffolderListTaskRouteRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const scaffolderListTaskRouteRef: SubRouteRef; + +// Warning: (ae-missing-release-tag) "scaffolderTaskRouteRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const scaffolderTaskRouteRef: SubRouteRef>; + +// @public (undocumented) +export const selectedTemplateRouteRef: SubRouteRef< + PathParams<'/templates/:namespace/:templateName'> +>; + +// Warning: (ae-forgotten-export) The symbol "StepperProps" needs to be exported by the entry point index.d.ts +// +// @alpha (undocumented) +export const Stepper: (props: StepperProps) => JSX.Element; + +// @alpha +export const TemplateCard: (props: TemplateCardProps) => JSX.Element; + +// @alpha +export interface TemplateCardProps { + // (undocumented) + deprecated?: boolean; + // (undocumented) + template: TemplateEntityV1beta3; +} + +// @public +export type TemplateParameterSchema = { + title: string; + description?: string; + steps: Array<{ + title: string; + description?: string; + schema: JsonObject; + }>; +}; + +// Warning: (ae-missing-release-tag) "viewTechDocRouteRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const viewTechDocRouteRef: ExternalRouteRef< + { + name: string; + kind: string; + namespace: string; + }, + true +>; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/scaffolder/src/index.ts b/plugins/scaffolder/src/index.ts index a486f2ff8d..9f993d2a13 100644 --- a/plugins/scaffolder/src/index.ts +++ b/plugins/scaffolder/src/index.ts @@ -56,15 +56,8 @@ export { createScaffolderFieldExtension, ScaffolderFieldExtensions, rootRouteRef, - nextRouteRef, selectedTemplateRouteRef, - nextSelectedTemplateRouteRef, - createNextScaffolderFieldExtension, type TemplateParameterSchema, - type NextCustomFieldValidator, - type NextFieldExtensionOptions, - type NextFieldExtensionComponentProps, - type FormProps, type CustomFieldExtensionSchema, type CustomFieldValidator, type FieldExtensionOptions, @@ -78,3 +71,62 @@ export type { TaskPageProps } from './components/TaskPage'; export { NextScaffolderPage } from './plugin'; export type { NextRouterProps } from './next'; export type { TemplateGroupFilter } from './next'; + +// These types in the future can be removed from being exported out of this package and be imported +// instead from @backstage/plugin-scaffolder-react. They have to be redeclared here to keep the alpha +// annotation in order to not polluted the main export surface. +import { + nextRouteRef as nextRouteRefTemp, + nextSelectedTemplateRouteRef as nextSelectedTemplateRouteRefTemp, + createNextScaffolderFieldExtension as createNextScaffolderFieldExtensionTemp, + type NextCustomFieldValidator as NextCustomFieldValidatorTemp, + type NextFieldExtensionOptions as NextFieldExtensionOptionsTemp, + type NextFieldExtensionComponentProps as NextFieldExtensionComponentPropsTemp, + type FormProps as FormPropsTemp, +} from '@backstage/plugin-scaffolder-react'; + +/** + * @alpha + */ +const nextRouteRef = nextRouteRefTemp; +/** + * @alpha + */ +const nextSelectedTemplateRouteRef = nextSelectedTemplateRouteRefTemp; +/** + * @alpha + */ +const createNextScaffolderFieldExtension = + createNextScaffolderFieldExtensionTemp; +/** + * @alpha + */ +type NextCustomFieldValidator = NextCustomFieldValidatorTemp; +/** + * @alpha + */ +type NextFieldExtensionOptions< + TFieldReturnValue = unknown, + TInputProps = unknown, +> = NextFieldExtensionOptionsTemp; +/** + * @alpha + */ +type NextFieldExtensionComponentProps< + TFieldReturnValue, + TUiOptions = {}, +> = NextFieldExtensionComponentPropsTemp; +/** + * @alpha + */ +type FormProps = FormPropsTemp; + +export { + nextRouteRef, + nextSelectedTemplateRouteRef, + createNextScaffolderFieldExtension, + type NextCustomFieldValidator, + type NextFieldExtensionOptions, + type NextFieldExtensionComponentProps, + type FormProps, +}; diff --git a/plugins/scaffolder/src/next/index.ts b/plugins/scaffolder/src/next/index.ts index 30fbb7ff15..089c268b0b 100644 --- a/plugins/scaffolder/src/next/index.ts +++ b/plugins/scaffolder/src/next/index.ts @@ -16,5 +16,3 @@ export * from './Router'; export * from './TemplateListPage'; export * from './TemplateWizardPage'; - -export type { FormProps } from '@backstage/plugin-scaffolder-react';