@backstage/plugin-scaffolder-react 1.1.0 → 1.2.0-next.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,46 @@
1
1
  # @backstage/plugin-scaffolder-react
2
2
 
3
+ ## 1.2.0-next.1
4
+
5
+ ### Minor Changes
6
+
7
+ - 8f4d13f21cf: Move `useTaskStream`, `TaskBorder`, `TaskLogStream` and `TaskSteps` into `scaffolder-react`.
8
+
9
+ ### Patch Changes
10
+
11
+ - 44941fc97eb: scaffolder/next: Move the `uiSchema` to its own property in the validation `context` to align with component development and access of `ui:options`
12
+ - Updated dependencies
13
+ - @backstage/core-components@0.12.5-next.1
14
+ - @backstage/errors@1.1.5-next.0
15
+ - @backstage/catalog-client@1.4.0-next.1
16
+ - @backstage/core-plugin-api@1.4.1-next.1
17
+ - @backstage/theme@0.2.18-next.0
18
+ - @backstage/plugin-catalog-react@1.4.0-next.1
19
+ - @backstage/catalog-model@1.2.1-next.1
20
+ - @backstage/types@1.0.2
21
+ - @backstage/version-bridge@1.0.3
22
+ - @backstage/plugin-scaffolder-common@1.2.6-next.1
23
+
24
+ ## 1.1.1-next.0
25
+
26
+ ### Patch Changes
27
+
28
+ - c8d78b9ae9: fix bug with `hasErrors` returning false when dealing with empty objects
29
+ - 928a12a9b3: Internal refactor of `/alpha` exports.
30
+ - cc418d652a: scaffolder/next: Added the ability to get the fields definition in the schema in the validation function
31
+ - d4100d0ec4: Fix alignment bug for owners on `TemplateCard`
32
+ - Updated dependencies
33
+ - @backstage/catalog-client@1.4.0-next.0
34
+ - @backstage/plugin-catalog-react@1.4.0-next.0
35
+ - @backstage/core-plugin-api@1.4.1-next.0
36
+ - @backstage/catalog-model@1.2.1-next.0
37
+ - @backstage/core-components@0.12.5-next.0
38
+ - @backstage/errors@1.1.4
39
+ - @backstage/theme@0.2.17
40
+ - @backstage/types@1.0.2
41
+ - @backstage/version-bridge@1.0.3
42
+ - @backstage/plugin-scaffolder-common@1.2.6-next.0
43
+
3
44
  ## 1.1.0
4
45
 
5
46
  ### Minor Changes
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-react",
3
- "version": "1.1.0",
4
- "main": "../dist/index.esm.js",
5
- "types": "../dist/index.alpha.d.ts"
3
+ "version": "1.2.0-next.1",
4
+ "main": "../dist/alpha.esm.js",
5
+ "module": "../dist/alpha.esm.js",
6
+ "types": "../dist/alpha.d.ts"
6
7
  }
@@ -0,0 +1,259 @@
1
+ /// <reference types="react" />
2
+ import { JsonObject, JsonValue } from '@backstage/types';
3
+ import * as react from 'react';
4
+ import react__default, { PropsWithChildren, ReactNode } from 'react';
5
+ import { ApiHolder, Extension, IconComponent } from '@backstage/core-plugin-api';
6
+ import * as _rjsf_utils from '@rjsf/utils';
7
+ import { FieldProps, UiSchema, UIOptionsType, FieldValidation } from '@rjsf/utils';
8
+ import { CustomFieldExtensionSchema, FieldExtensionComponent, TemplateParameterSchema, LayoutOptions, ScaffolderTaskOutput, ScaffolderStep } from '@backstage/plugin-scaffolder-react';
9
+ import * as _rjsf_core_v5 from '@rjsf/core-v5';
10
+ import { FormProps as FormProps$1 } from '@rjsf/core-v5';
11
+ import { TemplateEntityV1beta3, TaskStep } from '@backstage/plugin-scaffolder-common';
12
+
13
+ /**
14
+ * Type for Field Extension Props for RJSF v5
15
+ *
16
+ * @alpha
17
+ */
18
+ interface NextFieldExtensionComponentProps<TFieldReturnValue, TUiOptions = {}> extends PropsWithChildren<FieldProps<TFieldReturnValue>> {
19
+ uiSchema?: NextFieldExtensionUiSchema<TFieldReturnValue, TUiOptions>;
20
+ }
21
+ /**
22
+ * Type for Field Extension UiSchema
23
+ *
24
+ * @alpha
25
+ */
26
+ interface NextFieldExtensionUiSchema<TFieldReturnValue, TUiOptions> extends UiSchema<TFieldReturnValue> {
27
+ 'ui:options'?: TUiOptions & UIOptionsType;
28
+ }
29
+ /**
30
+ * Field validation type for Custom Field Extensions.
31
+ *
32
+ * @alpha
33
+ */
34
+ declare type NextCustomFieldValidator<TFieldReturnValue, TUiOptions = unknown> = (data: TFieldReturnValue, field: FieldValidation, context: {
35
+ apiHolder: ApiHolder;
36
+ formData: JsonObject;
37
+ schema: JsonObject;
38
+ uiSchema?: NextFieldExtensionUiSchema<TFieldReturnValue, TUiOptions>;
39
+ }) => void | Promise<void>;
40
+ /**
41
+ * Type for the Custom Field Extension with the
42
+ * name and components and validation function.
43
+ *
44
+ * @alpha
45
+ */
46
+ declare type NextFieldExtensionOptions<TFieldReturnValue = unknown, TUiOptions = unknown> = {
47
+ name: string;
48
+ component: (props: NextFieldExtensionComponentProps<TFieldReturnValue, TUiOptions>) => JSX.Element | null;
49
+ validation?: NextCustomFieldValidator<TFieldReturnValue, TUiOptions>;
50
+ schema?: CustomFieldExtensionSchema;
51
+ };
52
+
53
+ /**
54
+ * Method for creating field extensions that can be used in the scaffolder
55
+ * frontend form.
56
+ * @alpha
57
+ */
58
+ declare function createNextScaffolderFieldExtension<TReturnValue = unknown, TInputProps extends UIOptionsType = {}>(options: NextFieldExtensionOptions<TReturnValue, TInputProps>): Extension<FieldExtensionComponent<TReturnValue, TInputProps>>;
59
+
60
+ /**
61
+ * This is the parsed template schema that is returned from the {@link useTemplateSchema} hook.
62
+ * @alpha
63
+ */
64
+ interface ParsedTemplateSchema {
65
+ uiSchema: UiSchema;
66
+ mergedSchema: JsonObject;
67
+ schema: JsonObject;
68
+ title: string;
69
+ description?: string;
70
+ }
71
+ /**
72
+ * This hook will parse the template schema and return the steps with the
73
+ * parsed schema and uiSchema. Filtering out any steps or properties that
74
+ * are not enabled with feature flags.
75
+ * @alpha
76
+ */
77
+ declare const useTemplateSchema: (manifest: TemplateParameterSchema) => {
78
+ steps: ParsedTemplateSchema[];
79
+ };
80
+
81
+ /**
82
+ * The props for the {@link ReviewState} component.
83
+ * @alpha
84
+ */
85
+ declare type ReviewStateProps = {
86
+ schemas: ParsedTemplateSchema[];
87
+ formState: JsonObject;
88
+ };
89
+ /**
90
+ * The component used by the {@link Stepper} to render the review step.
91
+ * @alpha
92
+ */
93
+ declare const ReviewState: (props: ReviewStateProps) => JSX.Element;
94
+
95
+ /**
96
+ * Any `@rjsf/core` form properties that are publicly exposed to the `NextScaffolderpage`
97
+ *
98
+ * @alpha
99
+ */
100
+ declare type FormProps = Pick<FormProps$1, 'transformErrors' | 'noHtml5Validate'>;
101
+
102
+ /**
103
+ * The Props for {@link Stepper} component
104
+ * @alpha
105
+ */
106
+ declare type StepperProps = {
107
+ manifest: TemplateParameterSchema;
108
+ extensions: NextFieldExtensionOptions<any, any>[];
109
+ templateName?: string;
110
+ FormProps?: FormProps;
111
+ initialState?: Record<string, JsonValue>;
112
+ onCreate: (values: Record<string, JsonValue>) => Promise<void>;
113
+ components?: {
114
+ ReviewStateComponent?: (props: ReviewStateProps) => JSX.Element;
115
+ createButtonText?: ReactNode;
116
+ reviewButtonText?: ReactNode;
117
+ };
118
+ layouts?: LayoutOptions[];
119
+ };
120
+ /**
121
+ * The `Stepper` component is the Wizard that is rendered when a user selects a template
122
+ * @alpha
123
+ */
124
+ declare const Stepper: (stepperProps: StepperProps) => JSX.Element;
125
+
126
+ /**
127
+ * The Props for the {@link TemplateCard} component
128
+ * @alpha
129
+ */
130
+ interface TemplateCardProps {
131
+ template: TemplateEntityV1beta3;
132
+ additionalLinks?: {
133
+ icon: IconComponent;
134
+ text: string;
135
+ url: string;
136
+ }[];
137
+ onSelected?: (template: TemplateEntityV1beta3) => void;
138
+ }
139
+ /**
140
+ * The `TemplateCard` component that is rendered in a list for each template
141
+ * @alpha
142
+ */
143
+ declare const TemplateCard: (props: TemplateCardProps) => JSX.Element;
144
+
145
+ /**
146
+ * The props for the {@link TemplateGroup} component.
147
+ * @alpha
148
+ */
149
+ interface TemplateGroupProps {
150
+ templates: {
151
+ template: TemplateEntityV1beta3;
152
+ additionalLinks?: {
153
+ icon: IconComponent;
154
+ text: string;
155
+ url: string;
156
+ }[];
157
+ }[];
158
+ onSelected: (template: TemplateEntityV1beta3) => void;
159
+ title: react__default.ReactNode;
160
+ components?: {
161
+ CardComponent?: react__default.ComponentType<TemplateCardProps>;
162
+ };
163
+ }
164
+ /**
165
+ * The `TemplateGroup` component is used to display a group of templates with a title.
166
+ * @alpha
167
+ */
168
+ declare const TemplateGroup: (props: TemplateGroupProps) => JSX.Element;
169
+
170
+ /**
171
+ * @alpha
172
+ */
173
+ declare type WorkflowProps = {
174
+ title?: string;
175
+ description?: string;
176
+ namespace: string;
177
+ templateName: string;
178
+ onError(error: Error | undefined): JSX.Element | null;
179
+ } & Pick<StepperProps, 'extensions' | 'FormProps' | 'components' | 'onCreate' | 'initialState' | 'layouts'>;
180
+ /**
181
+ * @alpha
182
+ */
183
+ declare const Workflow: (workflowProps: WorkflowProps) => JSX.Element | null;
184
+ /**
185
+ * @alpha
186
+ */
187
+ declare const EmbeddableWorkflow: (props: WorkflowProps) => JSX.Element;
188
+
189
+ /**
190
+ * The DefaultOutputs renderer for the scaffolder task output
191
+ *
192
+ * @alpha
193
+ */
194
+ declare const DefaultTemplateOutputs: (props: {
195
+ output?: ScaffolderTaskOutput;
196
+ }) => JSX.Element | null;
197
+
198
+ /** @alpha */
199
+ declare const Form: react.ComponentType<_rjsf_core_v5.FormProps<any, _rjsf_utils.RJSFSchema, any>>;
200
+
201
+ /**
202
+ * Props for the TaskSteps component
203
+ *
204
+ * @alpha
205
+ */
206
+ interface TaskStepsProps {
207
+ steps: (TaskStep & ScaffolderStep)[];
208
+ activeStep?: number;
209
+ isComplete?: boolean;
210
+ isError?: boolean;
211
+ }
212
+ /**
213
+ * The visual stepper of the task event stream
214
+ *
215
+ * @alpha
216
+ */
217
+ declare const TaskSteps: (props: TaskStepsProps) => JSX.Element;
218
+
219
+ /**
220
+ * The text of the event stream
221
+ *
222
+ * @alpha
223
+ */
224
+ declare const TaskLogStream: (props: {
225
+ logs: {
226
+ [k: string]: string[];
227
+ };
228
+ }) => JSX.Element;
229
+
230
+ /**
231
+ * Takes a step from a Backstage Template Manifest and converts it to a JSON Schema and UI Schema for rjsf
232
+ * @alpha
233
+ */
234
+ declare const extractSchemaFromStep: (inputStep: JsonObject) => {
235
+ uiSchema: UiSchema;
236
+ schema: JsonObject;
237
+ };
238
+ /**
239
+ * Creates a field validation object for use in react jsonschema form
240
+ * @alpha
241
+ */
242
+ declare const createFieldValidation: () => FieldValidation;
243
+
244
+ /**
245
+ * This hook is used to get the formData from the query string.
246
+ * @alpha
247
+ */
248
+ declare const useFormDataFromQuery: (initialState?: Record<string, JsonValue>) => [Record<string, any>, react.Dispatch<react.SetStateAction<Record<string, any>>>];
249
+
250
+ /**
251
+ * @alpha
252
+ */
253
+ declare const useTemplateParameterSchema: (templateRef: string) => {
254
+ manifest: TemplateParameterSchema;
255
+ loading: boolean;
256
+ error: Error | undefined;
257
+ };
258
+
259
+ export { DefaultTemplateOutputs, EmbeddableWorkflow, Form, FormProps, NextCustomFieldValidator, NextFieldExtensionComponentProps, NextFieldExtensionOptions, NextFieldExtensionUiSchema, ParsedTemplateSchema, ReviewState, ReviewStateProps, Stepper, StepperProps, TaskLogStream, TaskSteps, TaskStepsProps, TemplateCard, TemplateCardProps, TemplateGroup, TemplateGroupProps, Workflow, WorkflowProps, createFieldValidation, createNextScaffolderFieldExtension, extractSchemaFromStep, useFormDataFromQuery, useTemplateParameterSchema, useTemplateSchema };