@backstage/plugin-scaffolder 1.8.0-next.1 → 1.9.0-next.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/index.d.ts CHANGED
@@ -12,6 +12,7 @@ import { BackstagePlugin } from '@backstage/core-plugin-api';
12
12
  import { ComponentType } from 'react';
13
13
  import { DiscoveryApi } from '@backstage/core-plugin-api';
14
14
  import { Entity } from '@backstage/catalog-model';
15
+ import type { ErrorTransformer } from '@rjsf/utils';
15
16
  import { Extension } from '@backstage/core-plugin-api';
16
17
  import { ExternalRouteRef } from '@backstage/core-plugin-api';
17
18
  import { FetchApi } from '@backstage/core-plugin-api';
@@ -36,6 +37,7 @@ import { TaskStep } from '@backstage/plugin-scaffolder-common';
36
37
  import { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';
37
38
  import { UIOptionsType } from '@rjsf/utils';
38
39
  import { UiSchema } from '@rjsf/utils';
40
+ import { z } from 'zod';
39
41
 
40
42
  /* Excluded from this release type: createNextScaffolderFieldExtension */
41
43
 
@@ -53,6 +55,16 @@ export declare function createScaffolderFieldExtension<TReturnValue = unknown, T
53
55
  */
54
56
  export declare function createScaffolderLayout<TInputProps = unknown>(options: LayoutOptions): Extension<LayoutComponent<TInputProps>>;
55
57
 
58
+ /**
59
+ * Type for the Custom Field Extension schema.
60
+ *
61
+ * @public
62
+ */
63
+ export declare type CustomFieldExtensionSchema = {
64
+ returnValue: JSONSchema7;
65
+ uiOptions?: JSONSchema7;
66
+ };
67
+
56
68
  /**
57
69
  * Field validation type for Custom Field Extensions.
58
70
  *
@@ -74,7 +86,22 @@ export declare const EntityNamePickerFieldExtension: FieldExtensionComponent<str
74
86
  *
75
87
  * @public
76
88
  */
77
- export declare const EntityPickerFieldExtension: FieldExtensionComponent<string, EntityPickerUiOptions>;
89
+ export declare const EntityPickerFieldExtension: FieldExtensionComponent<string, {
90
+ defaultKind?: string | undefined;
91
+ defaultNamespace?: string | false | undefined;
92
+ allowedKinds?: string[] | undefined;
93
+ allowArbitraryValues?: boolean | undefined;
94
+ }>;
95
+
96
+ /**
97
+ * @public
98
+ */
99
+ export declare const EntityPickerFieldSchema: FieldSchema<string, {
100
+ defaultKind?: string | undefined;
101
+ defaultNamespace?: string | false | undefined;
102
+ allowedKinds?: string[] | undefined;
103
+ allowArbitraryValues?: boolean | undefined;
104
+ }>;
78
105
 
79
106
  /**
80
107
  * The input props that can be specified under `ui:options` for the
@@ -82,18 +109,26 @@ export declare const EntityPickerFieldExtension: FieldExtensionComponent<string,
82
109
  *
83
110
  * @public
84
111
  */
85
- export declare interface EntityPickerUiOptions {
86
- allowedKinds?: string[];
87
- defaultKind?: string;
88
- allowArbitraryValues?: boolean;
89
- defaultNamespace?: string | false;
90
- }
112
+ export declare type EntityPickerUiOptions = typeof EntityPickerFieldSchema.uiOptionsType;
91
113
 
92
114
  /**
93
115
  * EntityTagsPickerFieldExtension
94
116
  * @public
95
117
  */
96
- export declare const EntityTagsPickerFieldExtension: FieldExtensionComponent<string[], EntityTagsPickerUiOptions>;
118
+ export declare const EntityTagsPickerFieldExtension: FieldExtensionComponent<string[], {
119
+ showCounts?: boolean | undefined;
120
+ kinds?: string[] | undefined;
121
+ helperText?: string | undefined;
122
+ }>;
123
+
124
+ /**
125
+ * @public
126
+ */
127
+ export declare const EntityTagsPickerFieldSchema: FieldSchema<string[], {
128
+ showCounts?: boolean | undefined;
129
+ kinds?: string[] | undefined;
130
+ helperText?: string | undefined;
131
+ }>;
97
132
 
98
133
  /**
99
134
  * The input props that can be specified under `ui:options` for the
@@ -101,11 +136,7 @@ export declare const EntityTagsPickerFieldExtension: FieldExtensionComponent<str
101
136
  *
102
137
  * @public
103
138
  */
104
- export declare interface EntityTagsPickerUiOptions {
105
- kinds?: string[];
106
- showCounts?: boolean;
107
- helperText?: string;
108
- }
139
+ export declare type EntityTagsPickerUiOptions = typeof EntityTagsPickerFieldSchema.uiOptionsType;
109
140
 
110
141
  /**
111
142
  * A type used to wrap up the FieldExtension to embed the ReturnValue and the InputProps
@@ -136,8 +167,20 @@ export declare type FieldExtensionOptions<TFieldReturnValue = unknown, TInputPro
136
167
  name: string;
137
168
  component: (props: FieldExtensionComponentProps<TFieldReturnValue, TInputProps>) => JSX.Element | null;
138
169
  validation?: CustomFieldValidator<TFieldReturnValue>;
170
+ schema?: CustomFieldExtensionSchema;
139
171
  };
140
172
 
173
+ /**
174
+ * @public
175
+ * FieldSchema encapsulates a JSONSchema7 along with the
176
+ * matching FieldExtensionComponentProps type for a field extension.
177
+ */
178
+ export declare interface FieldSchema<TReturn, TUiOptions> {
179
+ readonly schema: CustomFieldExtensionSchema;
180
+ readonly type: FieldExtensionComponentProps<TReturn, TUiOptions>;
181
+ readonly uiOptionsType: TUiOptions;
182
+ }
183
+
141
184
  /**
142
185
  * The type used to wrap up the Layout and embed the input props
143
186
  *
@@ -193,6 +236,13 @@ export declare type LogEvent = {
193
236
  taskId: string;
194
237
  };
195
238
 
239
+ /**
240
+ * @public
241
+ * Utility function to convert zod return and UI options schemas to a
242
+ * CustomFieldExtensionSchema with FieldExtensionComponentProps type inference
243
+ */
244
+ export declare function makeFieldSchemaFromZod<TReturnSchema extends z.ZodType, TUiOptionsSchema extends z.ZodType = z.ZodType<any, any, {}>>(returnSchema: TReturnSchema, uiOptionsSchema?: TUiOptionsSchema): FieldSchema<TReturnSchema extends z.ZodType<any, any, infer IReturn> ? IReturn : never, TUiOptionsSchema extends z.ZodType<any, any, infer IUiOptions> ? IUiOptions : never>;
245
+
196
246
  /* Excluded from this release type: NextCustomFieldValidator */
197
247
 
198
248
  /* Excluded from this release type: NextFieldExtensionComponentProps */
@@ -212,7 +262,22 @@ export declare type LogEvent = {
212
262
  *
213
263
  * @public
214
264
  */
215
- export declare const OwnedEntityPickerFieldExtension: FieldExtensionComponent<string, OwnedEntityPickerUiOptions>;
265
+ export declare const OwnedEntityPickerFieldExtension: FieldExtensionComponent<string, {
266
+ defaultKind?: string | undefined;
267
+ defaultNamespace?: string | false | undefined;
268
+ allowedKinds?: string[] | undefined;
269
+ allowArbitraryValues?: boolean | undefined;
270
+ }>;
271
+
272
+ /**
273
+ * @public
274
+ */
275
+ export declare const OwnedEntityPickerFieldSchema: FieldSchema<string, {
276
+ defaultKind?: string | undefined;
277
+ defaultNamespace?: string | false | undefined;
278
+ allowedKinds?: string[] | undefined;
279
+ allowArbitraryValues?: boolean | undefined;
280
+ }>;
216
281
 
217
282
  /**
218
283
  * The input props that can be specified under `ui:options` for the
@@ -220,19 +285,27 @@ export declare const OwnedEntityPickerFieldExtension: FieldExtensionComponent<st
220
285
  *
221
286
  * @public
222
287
  */
223
- export declare interface OwnedEntityPickerUiOptions {
224
- allowedKinds?: string[];
225
- defaultKind?: string;
226
- allowArbitraryValues?: boolean;
227
- defaultNamespace?: string | false;
228
- }
288
+ export declare type OwnedEntityPickerUiOptions = typeof OwnedEntityPickerFieldSchema.uiOptionsType;
229
289
 
230
290
  /**
231
291
  * A field extension for picking users and groups out of the Catalog.
232
292
  *
233
293
  * @public
234
294
  */
235
- export declare const OwnerPickerFieldExtension: FieldExtensionComponent<string, OwnerPickerUiOptions>;
295
+ export declare const OwnerPickerFieldExtension: FieldExtensionComponent<string, {
296
+ defaultNamespace?: string | false | undefined;
297
+ allowedKinds?: string[] | undefined;
298
+ allowArbitraryValues?: boolean | undefined;
299
+ }>;
300
+
301
+ /**
302
+ * @public
303
+ */
304
+ export declare const OwnerPickerFieldSchema: FieldSchema<string, {
305
+ defaultNamespace?: string | false | undefined;
306
+ allowedKinds?: string[] | undefined;
307
+ allowArbitraryValues?: boolean | undefined;
308
+ }>;
236
309
 
237
310
  /**
238
311
  * The input props that can be specified under `ui:options` for the
@@ -240,11 +313,7 @@ export declare const OwnerPickerFieldExtension: FieldExtensionComponent<string,
240
313
  *
241
314
  * @public
242
315
  */
243
- export declare interface OwnerPickerUiOptions {
244
- allowedKinds?: string[];
245
- allowArbitraryValues?: boolean;
246
- defaultNamespace?: string | false;
247
- }
316
+ export declare type OwnerPickerUiOptions = typeof OwnerPickerFieldSchema.uiOptionsType;
248
317
 
249
318
  /**
250
319
  * The validation function for the `repoUrl` that is returned from the
@@ -259,11 +328,46 @@ export declare const repoPickerValidation: (value: string, validation: FieldVali
259
328
 
260
329
  /**
261
330
  * The field extension which provides the ability to select a RepositoryUrl.
262
- * Currently this is an encoded URL that looks something like the following `github.com?repo=myRepoName&owner=backstage`.
263
- *
331
+ * Currently, this is an encoded URL that looks something like the following `github.com?repo=myRepoName&owner=backstage`.
332
+ *
333
+ * @public
334
+ */
335
+ export declare const RepoUrlPickerFieldExtension: FieldExtensionComponent<string, {
336
+ allowedOwners?: string[] | undefined;
337
+ allowedOrganizations?: string[] | undefined;
338
+ allowedRepos?: string[] | undefined;
339
+ allowedHosts?: string[] | undefined;
340
+ requestUserCredentials?: {
341
+ additionalScopes?: {
342
+ azure?: string[] | undefined;
343
+ github?: string[] | undefined;
344
+ gitlab?: string[] | undefined;
345
+ bitbucket?: string[] | undefined;
346
+ gerrit?: string[] | undefined;
347
+ } | undefined;
348
+ secretsKey: string;
349
+ } | undefined;
350
+ }>;
351
+
352
+ /**
264
353
  * @public
265
354
  */
266
- export declare const RepoUrlPickerFieldExtension: FieldExtensionComponent<string, RepoUrlPickerUiOptions>;
355
+ export declare const RepoUrlPickerFieldSchema: FieldSchema<string, {
356
+ allowedOwners?: string[] | undefined;
357
+ allowedOrganizations?: string[] | undefined;
358
+ allowedRepos?: string[] | undefined;
359
+ allowedHosts?: string[] | undefined;
360
+ requestUserCredentials?: {
361
+ additionalScopes?: {
362
+ azure?: string[] | undefined;
363
+ github?: string[] | undefined;
364
+ gitlab?: string[] | undefined;
365
+ bitbucket?: string[] | undefined;
366
+ gerrit?: string[] | undefined;
367
+ } | undefined;
368
+ secretsKey: string;
369
+ } | undefined;
370
+ }>;
267
371
 
268
372
  /**
269
373
  * The input props that can be specified under `ui:options` for the
@@ -271,22 +375,26 @@ export declare const RepoUrlPickerFieldExtension: FieldExtensionComponent<string
271
375
  *
272
376
  * @public
273
377
  */
274
- export declare interface RepoUrlPickerUiOptions {
275
- allowedHosts?: string[];
276
- allowedOrganizations?: string[];
277
- allowedOwners?: string[];
278
- allowedRepos?: string[];
279
- requestUserCredentials?: {
280
- secretsKey: string;
281
- additionalScopes?: {
282
- gerrit?: string[];
283
- github?: string[];
284
- gitlab?: string[];
285
- bitbucket?: string[];
286
- azure?: string[];
287
- };
288
- };
289
- }
378
+ export declare type RepoUrlPickerUiOptions = typeof RepoUrlPickerFieldSchema.uiOptionsType;
379
+
380
+ /**
381
+ * The props for the Last Step in scaffolder template form.
382
+ * Which represents the summary of the input provided by the end user.
383
+ *
384
+ * @public
385
+ */
386
+ export declare type ReviewStepProps = {
387
+ disableButtons: boolean;
388
+ formData: JsonObject;
389
+ handleBack: () => void;
390
+ handleReset: () => void;
391
+ handleCreate: () => void;
392
+ steps: {
393
+ uiSchema: UiSchema;
394
+ mergedSchema: JsonObject;
395
+ schema: JsonObject;
396
+ }[];
397
+ };
290
398
 
291
399
  /** @public */
292
400
  export declare const rootRouteRef: RouteRef<undefined>;
@@ -297,6 +405,7 @@ export declare const rootRouteRef: RouteRef<undefined>;
297
405
  */
298
406
  export declare type RouterProps = {
299
407
  components?: {
408
+ ReviewStepComponent?: ComponentType<ReviewStepProps>;
300
409
  TemplateCardComponent?: ComponentType<{
301
410
  template: TemplateEntityV1beta3;
302
411
  }> | undefined;
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- export { D as EntityNamePickerFieldExtension, C as EntityPickerFieldExtension, G as EntityTagsPickerFieldExtension, N as NextScaffolderPage, I as OwnedEntityPickerFieldExtension, H as OwnerPickerFieldExtension, J as RepoUrlPickerFieldExtension, x as ScaffolderClient, z as ScaffolderFieldExtensions, B as ScaffolderLayouts, K as ScaffolderPage, m as TaskPage, T as TemplateTypePicker, P as createNextScaffolderFieldExtension, y as createScaffolderFieldExtension, A as createScaffolderLayout, w as nextRouteRef, u as nextSelectedTemplateRouteRef, q as repoPickerValidation, f as rootRouteRef, c as scaffolderApiRef, M as scaffolderPlugin, s as selectedTemplateRouteRef, Q as useTemplateSecrets } from './esm/index-68c01d69.esm.js';
1
+ export { M as EntityNamePickerFieldExtension, K as EntityPickerFieldExtension, _ as EntityPickerFieldSchema, N as EntityTagsPickerFieldExtension, a2 as EntityTagsPickerFieldSchema, X as NextScaffolderPage, Q as OwnedEntityPickerFieldExtension, a1 as OwnedEntityPickerFieldSchema, P as OwnerPickerFieldExtension, $ as OwnerPickerFieldSchema, U as RepoUrlPickerFieldExtension, a0 as RepoUrlPickerFieldSchema, D as ScaffolderClient, H as ScaffolderFieldExtensions, J as ScaffolderLayouts, V as ScaffolderPage, m as TaskPage, T as TemplateTypePicker, Y as createNextScaffolderFieldExtension, G as createScaffolderFieldExtension, I as createScaffolderLayout, Z as makeFieldSchemaFromZod, C as nextRouteRef, B as nextSelectedTemplateRouteRef, w as repoPickerValidation, f as rootRouteRef, c as scaffolderApiRef, W as scaffolderPlugin, s as selectedTemplateRouteRef, a3 as useTemplateSecrets } from './esm/index-ed1a1fba.esm.js';
2
2
  import '@backstage/catalog-model';
3
3
  import '@backstage/core-plugin-api';
4
4
  import '@backstage/errors';
@@ -10,6 +10,8 @@ import '@material-ui/core/FormControl';
10
10
  import '@material-ui/lab/Autocomplete';
11
11
  import 'react';
12
12
  import 'react-use/lib/useAsync';
13
+ import 'zod';
14
+ import 'zod-to-json-schema';
13
15
  import 'react-use/lib/useEffectOnce';
14
16
  import '@material-ui/lab';
15
17
  import '@backstage/integration-react';
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder",
3
3
  "description": "The Backstage plugin that helps you create new things",
4
- "version": "1.8.0-next.1",
4
+ "version": "1.9.0-next.0",
5
5
  "main": "dist/index.esm.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -33,20 +33,20 @@
33
33
  "clean": "backstage-cli package clean"
34
34
  },
35
35
  "dependencies": {
36
- "@backstage/catalog-client": "^1.1.2-next.0",
37
- "@backstage/catalog-model": "^1.1.3-next.0",
38
- "@backstage/config": "^1.0.4-next.0",
39
- "@backstage/core-components": "^0.12.0-next.1",
40
- "@backstage/core-plugin-api": "^1.1.0-next.0",
41
- "@backstage/errors": "^1.1.3-next.0",
42
- "@backstage/integration": "^1.4.0-next.0",
43
- "@backstage/integration-react": "^1.1.6-next.1",
44
- "@backstage/plugin-catalog-common": "^1.0.8-next.0",
45
- "@backstage/plugin-catalog-react": "^1.2.1-next.1",
46
- "@backstage/plugin-permission-react": "^0.4.7-next.0",
47
- "@backstage/plugin-scaffolder-common": "^1.2.2-next.0",
36
+ "@backstage/catalog-client": "^1.2.0-next.0",
37
+ "@backstage/catalog-model": "^1.1.4-next.0",
38
+ "@backstage/config": "^1.0.5-next.0",
39
+ "@backstage/core-components": "^0.12.1-next.0",
40
+ "@backstage/core-plugin-api": "^1.1.1-next.0",
41
+ "@backstage/errors": "^1.1.4-next.0",
42
+ "@backstage/integration": "^1.4.1-next.0",
43
+ "@backstage/integration-react": "^1.1.7-next.0",
44
+ "@backstage/plugin-catalog-common": "^1.0.9-next.0",
45
+ "@backstage/plugin-catalog-react": "^1.2.2-next.0",
46
+ "@backstage/plugin-permission-react": "^0.4.8-next.0",
47
+ "@backstage/plugin-scaffolder-common": "^1.2.3-next.0",
48
48
  "@backstage/theme": "^0.2.16",
49
- "@backstage/types": "^1.0.1-next.0",
49
+ "@backstage/types": "^1.0.2-next.0",
50
50
  "@codemirror/language": "^6.0.0",
51
51
  "@codemirror/legacy-modes": "^6.1.0",
52
52
  "@codemirror/view": "^6.0.0",
@@ -55,11 +55,11 @@
55
55
  "@material-ui/lab": "4.0.0-alpha.57",
56
56
  "@react-hookz/web": "^15.0.0",
57
57
  "@rjsf/core": "^3.2.1",
58
- "@rjsf/core-v5": "npm:@rjsf/core@^5.0.0-beta.10",
58
+ "@rjsf/core-v5": "npm:@rjsf/core@^5.0.0-beta.12",
59
59
  "@rjsf/material-ui": "^3.2.1",
60
- "@rjsf/material-ui-v5": "npm:@rjsf/material-ui@^5.0.0-beta.10",
61
- "@rjsf/utils": "^5.0.0-beta.10",
62
- "@rjsf/validator-ajv8": "^5.0.0-beta.10",
60
+ "@rjsf/material-ui-v5": "npm:@rjsf/material-ui@^5.0.0-beta.12",
61
+ "@rjsf/utils": "^5.0.0-beta.12",
62
+ "@rjsf/validator-ajv8": "^5.0.0-beta.12",
63
63
  "@types/json-schema": "^7.0.9",
64
64
  "@uiw/react-codemirror": "^4.9.3",
65
65
  "classnames": "^2.2.6",
@@ -74,7 +74,9 @@
74
74
  "react-use": "^17.2.4",
75
75
  "use-immer": "^0.7.0",
76
76
  "yaml": "^2.0.0",
77
- "zen-observable": "^0.8.15"
77
+ "zen-observable": "^0.9.0",
78
+ "zod": "^3.11.6",
79
+ "zod-to-json-schema": "^3.18.1"
78
80
  },
79
81
  "peerDependencies": {
80
82
  "@types/react": "^16.13.1 || ^17.0.0",
@@ -83,11 +85,11 @@
83
85
  "react-router-dom": "6.0.0-beta.0 || ^6.3.0"
84
86
  },
85
87
  "devDependencies": {
86
- "@backstage/cli": "^0.21.0-next.1",
87
- "@backstage/core-app-api": "^1.2.0-next.0",
88
- "@backstage/dev-utils": "^1.0.8-next.1",
89
- "@backstage/plugin-catalog": "^1.6.1-next.1",
90
- "@backstage/test-utils": "^1.2.2-next.0",
88
+ "@backstage/cli": "^0.21.2-next.0",
89
+ "@backstage/core-app-api": "^1.2.1-next.0",
90
+ "@backstage/dev-utils": "^1.0.9-next.0",
91
+ "@backstage/plugin-catalog": "^1.6.2-next.0",
92
+ "@backstage/test-utils": "^1.2.3-next.0",
91
93
  "@testing-library/jest-dom": "^5.10.1",
92
94
  "@testing-library/react": "^12.1.3",
93
95
  "@testing-library/react-hooks": "^8.0.0",
@@ -96,7 +98,7 @@
96
98
  "@types/node": "^16.11.26",
97
99
  "cross-fetch": "^3.1.5",
98
100
  "event-source-polyfill": "1.0.25",
99
- "msw": "^0.47.0"
101
+ "msw": "^0.49.0"
100
102
  },
101
103
  "files": [
102
104
  "dist",