@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.
@@ -1,425 +0,0 @@
1
- /// <reference types="react" />
2
-
3
- import { ApiHolder } from '@backstage/core-plugin-api';
4
- import { ApiRef } from '@backstage/core-plugin-api';
5
- import { ComponentType } from 'react';
6
- import { Dispatch } from 'react';
7
- import { Extension } from '@backstage/core-plugin-api';
8
- import { FieldProps } from '@rjsf/core';
9
- import { FieldProps as FieldProps_2 } from '@rjsf/utils';
10
- import { FieldValidation } from '@rjsf/core';
11
- import { FieldValidation as FieldValidation_2 } from '@rjsf/utils';
12
- import { FormProps as FormProps_2 } from '@rjsf/core-v5';
13
- import { IconComponent } from '@backstage/core-plugin-api';
14
- import { JsonObject } from '@backstage/types';
15
- import { JSONSchema7 } from 'json-schema';
16
- import { JsonValue } from '@backstage/types';
17
- import { Observable } from '@backstage/types';
18
- import { PropsWithChildren } from 'react';
19
- import { default as React_2 } from 'react';
20
- import { ReactNode } from 'react';
21
- import { RJSFSchema } from '@rjsf/utils';
22
- import { SetStateAction } from 'react';
23
- import { TaskSpec } from '@backstage/plugin-scaffolder-common';
24
- import { TaskStep } from '@backstage/plugin-scaffolder-common';
25
- import { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';
26
- import { UIOptionsType } from '@rjsf/utils';
27
- import { UiSchema } from '@rjsf/utils';
28
-
29
- /**
30
- * The response shape for a single action in the `listActions` call to the `scaffolder-backend`
31
- *
32
- * @public
33
- */
34
- export declare type Action = {
35
- id: string;
36
- description?: string;
37
- schema?: {
38
- input?: JSONSchema7;
39
- output?: JSONSchema7;
40
- };
41
- examples?: ActionExample[];
42
- };
43
-
44
- /**
45
- * A single action example
46
- *
47
- * @public
48
- */
49
- export declare type ActionExample = {
50
- description: string;
51
- example: string;
52
- };
53
-
54
- /* Excluded from this release type: createFieldValidation */
55
-
56
- /* Excluded from this release type: createNextScaffolderFieldExtension */
57
-
58
- /**
59
- * Method for creating field extensions that can be used in the scaffolder
60
- * frontend form.
61
- * @public
62
- */
63
- export declare function createScaffolderFieldExtension<TReturnValue = unknown, TInputProps = unknown>(options: FieldExtensionOptions<TReturnValue, TInputProps>): Extension<FieldExtensionComponent<TReturnValue, TInputProps>>;
64
-
65
- /**
66
- * Method for creating custom Layouts that can be used in the scaffolder frontend form
67
- *
68
- * @public
69
- */
70
- export declare function createScaffolderLayout<TInputProps = unknown>(options: LayoutOptions): Extension<LayoutComponent<TInputProps>>;
71
-
72
- /**
73
- * Type for the Custom Field Extension schema.
74
- *
75
- * @public
76
- */
77
- export declare type CustomFieldExtensionSchema = {
78
- returnValue: JSONSchema7;
79
- uiOptions?: JSONSchema7;
80
- };
81
-
82
- /**
83
- * Field validation type for Custom Field Extensions.
84
- *
85
- * @public
86
- */
87
- export declare type CustomFieldValidator<TFieldReturnValue> = (data: TFieldReturnValue, field: FieldValidation, context: {
88
- apiHolder: ApiHolder;
89
- }) => void | Promise<void>;
90
-
91
- /* Excluded from this release type: DefaultTemplateOutputs */
92
-
93
- /* Excluded from this release type: EmbeddableWorkflow */
94
-
95
- /* Excluded from this release type: extractSchemaFromStep */
96
-
97
- /**
98
- * The type used to wrap up the Layout and embed the input props
99
- *
100
- * @public
101
- */
102
- export declare type FieldExtensionComponent<_TReturnValue, _TInputProps> = () => null;
103
-
104
- /**
105
- * Type for field extensions and being able to type
106
- * incoming props easier.
107
- *
108
- * @public
109
- */
110
- export declare interface FieldExtensionComponentProps<TFieldReturnValue, TUiOptions extends {} = {}> extends FieldProps<TFieldReturnValue> {
111
- uiSchema: FieldProps['uiSchema'] & {
112
- 'ui:options'?: TUiOptions;
113
- };
114
- }
115
-
116
- /**
117
- * Type for the Custom Field Extension with the
118
- * name and components and validation function.
119
- *
120
- * @public
121
- */
122
- export declare type FieldExtensionOptions<TFieldReturnValue = unknown, TInputProps = unknown> = {
123
- name: string;
124
- component: (props: FieldExtensionComponentProps<TFieldReturnValue, TInputProps>) => JSX.Element | null;
125
- validation?: CustomFieldValidator<TFieldReturnValue>;
126
- schema?: CustomFieldExtensionSchema;
127
- };
128
-
129
- /* Excluded from this release type: Form */
130
-
131
- /**
132
- * Any `@rjsf/core` form properties that are publicly exposed to the `NextScaffolderpage`
133
- *
134
- * @public
135
- */
136
- export declare type FormProps = Pick<FormProps_2, 'transformErrors' | 'noHtml5Validate'>;
137
-
138
- /**
139
- * A type used to wrap up the FieldExtension to embed the ReturnValue and the InputProps
140
- * @public
141
- */
142
- export declare type LayoutComponent<_TInputProps> = () => null;
143
-
144
- /**
145
- * The type of layouts that is passed to the TemplateForms
146
- *
147
- * @public
148
- */
149
- export declare interface LayoutOptions<P = any> {
150
- name: string;
151
- component: LayoutTemplate<P>;
152
- }
153
-
154
- /**
155
- * The field template from `@rjsf/core` which is a react component that gets passed `@rjsf/core` field related props.
156
- *
157
- * @public
158
- */
159
- export declare type LayoutTemplate<T = any> = NonNullable<FormProps_2<T>['uiSchema']>['ui:ObjectFieldTemplate'];
160
-
161
- /**
162
- * The response shape for the `listActions` call to the `scaffolder-backend`
163
- *
164
- * @public
165
- */
166
- export declare type ListActionsResponse = Array<Action>;
167
-
168
- /**
169
- * The shape of a `LogEvent` message from the `scaffolder-backend`
170
- *
171
- * @public
172
- */
173
- export declare type LogEvent = {
174
- type: 'log' | 'completion';
175
- body: {
176
- message: string;
177
- stepId?: string;
178
- status?: ScaffolderTaskStatus;
179
- };
180
- createdAt: string;
181
- id: string;
182
- taskId: string;
183
- };
184
-
185
- /* Excluded from this release type: NextCustomFieldValidator */
186
-
187
- /* Excluded from this release type: NextFieldExtensionComponentProps */
188
-
189
- /* Excluded from this release type: NextFieldExtensionOptions */
190
-
191
- /* Excluded from this release type: ParsedTemplateSchema */
192
-
193
- /* Excluded from this release type: ReviewState */
194
-
195
- /* Excluded from this release type: ReviewStateProps */
196
-
197
- /**
198
- * An API to interact with the scaffolder backend.
199
- *
200
- * @public
201
- */
202
- export declare interface ScaffolderApi {
203
- getTemplateParameterSchema(templateRef: string): Promise<TemplateParameterSchema>;
204
- /**
205
- * Executes the scaffolding of a component, given a template and its
206
- * parameter values.
207
- *
208
- * @param options - The {@link ScaffolderScaffoldOptions} the scaffolding.
209
- */
210
- scaffold(options: ScaffolderScaffoldOptions): Promise<ScaffolderScaffoldResponse>;
211
- getTask(taskId: string): Promise<ScaffolderTask>;
212
- listTasks?(options: {
213
- filterByOwnership: 'owned' | 'all';
214
- }): Promise<{
215
- tasks: ScaffolderTask[];
216
- }>;
217
- getIntegrationsList(options: ScaffolderGetIntegrationsListOptions): Promise<ScaffolderGetIntegrationsListResponse>;
218
- /**
219
- * Returns a list of all installed actions.
220
- */
221
- listActions(): Promise<ListActionsResponse>;
222
- streamLogs(options: ScaffolderStreamLogsOptions): Observable<LogEvent>;
223
- dryRun?(options: ScaffolderDryRunOptions): Promise<ScaffolderDryRunResponse>;
224
- }
225
-
226
- /** @public */
227
- export declare const scaffolderApiRef: ApiRef<ScaffolderApi>;
228
-
229
- /** @public */
230
- export declare interface ScaffolderDryRunOptions {
231
- template: JsonValue;
232
- values: JsonObject;
233
- secrets?: Record<string, string>;
234
- directoryContents: {
235
- path: string;
236
- base64Content: string;
237
- }[];
238
- }
239
-
240
- /** @public */
241
- export declare interface ScaffolderDryRunResponse {
242
- directoryContents: Array<{
243
- path: string;
244
- base64Content: string;
245
- executable: boolean;
246
- }>;
247
- log: Array<Pick<LogEvent, 'body'>>;
248
- steps: TaskStep[];
249
- output: ScaffolderTaskOutput;
250
- }
251
-
252
- /**
253
- * The Wrapping component for defining fields extensions inside
254
- *
255
- * @public
256
- */
257
- export declare const ScaffolderFieldExtensions: React_2.ComponentType<React_2.PropsWithChildren<{}>>;
258
-
259
- /**
260
- * The arguments for `getIntegrationsList`.
261
- *
262
- * @public
263
- */
264
- export declare interface ScaffolderGetIntegrationsListOptions {
265
- allowedHosts: string[];
266
- }
267
-
268
- /**
269
- * The response shape for `getIntegrationsList`.
270
- *
271
- * @public
272
- */
273
- export declare interface ScaffolderGetIntegrationsListResponse {
274
- integrations: {
275
- type: string;
276
- title: string;
277
- host: string;
278
- }[];
279
- }
280
-
281
- /**
282
- * The wrapping component for defining scaffolder layouts as children
283
- *
284
- * @public
285
- */
286
- export declare const ScaffolderLayouts: React.ComponentType;
287
-
288
- /** @public */
289
- export declare type ScaffolderOutputLink = {
290
- title?: string;
291
- icon?: string;
292
- url?: string;
293
- entityRef?: string;
294
- };
295
-
296
- /**
297
- * The input options to the `scaffold` method of the `ScaffolderClient`.
298
- *
299
- * @public
300
- */
301
- export declare interface ScaffolderScaffoldOptions {
302
- templateRef: string;
303
- values: Record<string, JsonValue>;
304
- secrets?: Record<string, string>;
305
- }
306
-
307
- /**
308
- * The response shape of the `scaffold` method of the `ScaffolderClient`.
309
- *
310
- * @public
311
- */
312
- export declare interface ScaffolderScaffoldResponse {
313
- taskId: string;
314
- }
315
-
316
- /**
317
- * The input options to the `streamLogs` method of the `ScaffolderClient`.
318
- *
319
- * @public
320
- */
321
- export declare interface ScaffolderStreamLogsOptions {
322
- taskId: string;
323
- after?: number;
324
- }
325
-
326
- /**
327
- * The shape of each task returned from the `scaffolder-backend`
328
- *
329
- * @public
330
- */
331
- export declare type ScaffolderTask = {
332
- id: string;
333
- spec: TaskSpec;
334
- status: 'failed' | 'completed' | 'processing' | 'open' | 'cancelled';
335
- lastHeartbeatAt: string;
336
- createdAt: string;
337
- };
338
-
339
- /** @public */
340
- export declare type ScaffolderTaskOutput = {
341
- links?: ScaffolderOutputLink[];
342
- } & {
343
- [key: string]: unknown;
344
- };
345
-
346
- /**
347
- * The status of each task in a Scaffolder Job
348
- *
349
- * @public
350
- */
351
- export declare type ScaffolderTaskStatus = 'open' | 'processing' | 'failed' | 'completed' | 'skipped';
352
-
353
- /**
354
- * The return type from the useTemplateSecrets hook.
355
- * @public
356
- */
357
- export declare interface ScaffolderUseTemplateSecrets {
358
- setSecrets: (input: Record<string, string>) => void;
359
- secrets: Record<string, string>;
360
- }
361
-
362
- /**
363
- * The Context Provider that holds the state for the secrets.
364
- * @public
365
- */
366
- export declare const SecretsContextProvider: ({ children }: PropsWithChildren<{}>) => JSX.Element;
367
-
368
- /* Excluded from this release type: Stepper */
369
-
370
- /* Excluded from this release type: StepperProps */
371
-
372
- /* Excluded from this release type: TemplateCard */
373
-
374
- /* Excluded from this release type: TemplateCardProps */
375
-
376
- /* Excluded from this release type: TemplateGroup */
377
-
378
- /* Excluded from this release type: TemplateGroupProps */
379
-
380
- /**
381
- * The shape of each entry of parameters which gets rendered
382
- * as a separate step in the wizard input
383
- *
384
- * @public
385
- */
386
- export declare type TemplateParameterSchema = {
387
- title: string;
388
- description?: string;
389
- steps: Array<{
390
- title: string;
391
- description?: string;
392
- schema: JsonObject;
393
- }>;
394
- };
395
-
396
- /**
397
- * Hook that returns all custom field extensions from the current outlet.
398
- * @public
399
- */
400
- export declare const useCustomFieldExtensions: <TComponentDataType = FieldExtensionOptions<unknown, unknown>>(outlet: React.ReactNode) => TComponentDataType[];
401
-
402
- /**
403
- * Hook that returns all custom field extensions from the current outlet.
404
- * @public
405
- */
406
- export declare const useCustomLayouts: <TComponentDataType = LayoutOptions<any>>(outlet: React.ReactNode) => TComponentDataType[];
407
-
408
- /* Excluded from this release type: useFormDataFromQuery */
409
-
410
- /* Excluded from this release type: useTemplateParameterSchema */
411
-
412
- /* Excluded from this release type: useTemplateSchema */
413
-
414
- /**
415
- * Hook to access the secrets context to be able to set secrets that are
416
- * passed to the Scaffolder backend.
417
- * @public
418
- */
419
- export declare const useTemplateSecrets: () => ScaffolderUseTemplateSecrets;
420
-
421
- /* Excluded from this release type: Workflow */
422
-
423
- /* Excluded from this release type: WorkflowProps */
424
-
425
- export { }