@backstage/plugin-scaffolder-react 1.18.1-next.0 → 1.19.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.
Files changed (68) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/dist/alpha.d.ts +23 -46
  3. package/dist/api/ref.esm.js.map +1 -1
  4. package/dist/extensions/createScaffolderFieldExtension.esm.js.map +1 -1
  5. package/dist/extensions/keys.esm.js.map +1 -1
  6. package/dist/hooks/useCustomFieldExtensions.esm.js.map +1 -1
  7. package/dist/hooks/useCustomLayouts.esm.js.map +1 -1
  8. package/dist/hooks/useEventStream.esm.js.map +1 -1
  9. package/dist/index.d.ts +67 -201
  10. package/dist/layouts/createScaffolderLayout.esm.js.map +1 -1
  11. package/dist/layouts/keys.esm.js.map +1 -1
  12. package/dist/next/api/FormFieldsApi.esm.js +4 -4
  13. package/dist/next/api/FormFieldsApi.esm.js.map +1 -1
  14. package/dist/next/api/ref.esm.js.map +1 -1
  15. package/dist/next/blueprints/FormDecoratorBlueprint.esm.js.map +1 -1
  16. package/dist/next/blueprints/FormFieldBlueprint.esm.js.map +1 -1
  17. package/dist/next/components/Form/DescriptionFieldTemplate.esm.js.map +1 -1
  18. package/dist/next/components/Form/FieldTemplate.esm.js.map +1 -1
  19. package/dist/next/components/Form/Form.esm.js.map +1 -1
  20. package/dist/next/components/PasswordWidget/PasswordWidget.esm.js.map +1 -1
  21. package/dist/next/components/ReviewState/ReviewState.esm.js +1 -1
  22. package/dist/next/components/ReviewState/ReviewState.esm.js.map +1 -1
  23. package/dist/next/components/ReviewState/util.esm.js.map +1 -1
  24. package/dist/next/components/ScaffolderField/ScaffolderField.esm.js.map +1 -1
  25. package/dist/next/components/ScaffolderPageContextMenu/ScaffolderPageContextMenu.esm.js.map +1 -1
  26. package/dist/next/components/SecretWidget/SecretWidget.esm.js.map +1 -1
  27. package/dist/next/components/Stepper/ErrorListTemplate/errorListTemplate.esm.js.map +1 -1
  28. package/dist/next/components/Stepper/FieldOverrides/DescriptionField.esm.js.map +1 -1
  29. package/dist/next/components/Stepper/Stepper.esm.js.map +1 -1
  30. package/dist/next/components/Stepper/createAsyncValidators.esm.js.map +1 -1
  31. package/dist/next/components/Stepper/utils.esm.js.map +1 -1
  32. package/dist/next/components/TaskLogStream/TaskLogStream.esm.js.map +1 -1
  33. package/dist/next/components/TaskSteps/StepIcon.esm.js.map +1 -1
  34. package/dist/next/components/TaskSteps/StepTime.esm.js.map +1 -1
  35. package/dist/next/components/TaskSteps/TaskBorder.esm.js.map +1 -1
  36. package/dist/next/components/TaskSteps/TaskSteps.esm.js.map +1 -1
  37. package/dist/next/components/TemplateCard/CardHeader.esm.js.map +1 -1
  38. package/dist/next/components/TemplateCard/CardLink.esm.js.map +1 -1
  39. package/dist/next/components/TemplateCard/TemplateCard.esm.js.map +1 -1
  40. package/dist/next/components/TemplateCard/TemplateCardActions.esm.js.map +1 -1
  41. package/dist/next/components/TemplateCard/TemplateCardContent.esm.js.map +1 -1
  42. package/dist/next/components/TemplateCard/TemplateCardLinks.esm.js.map +1 -1
  43. package/dist/next/components/TemplateCard/TemplateCardTags.esm.js.map +1 -1
  44. package/dist/next/components/TemplateCard/TemplateDetailButton.esm.js.map +1 -1
  45. package/dist/next/components/TemplateCategoryPicker/TemplateCategoryPicker.esm.js.map +1 -1
  46. package/dist/next/components/TemplateGroup/TemplateGroup.esm.js.map +1 -1
  47. package/dist/next/components/TemplateGroups/TemplateGroups.esm.js.map +1 -1
  48. package/dist/next/components/TemplateOutputs/DefaultTemplateOutputs.esm.js.map +1 -1
  49. package/dist/next/components/TemplateOutputs/LinkOutputs.esm.js.map +1 -1
  50. package/dist/next/components/TemplateOutputs/TextOutputs.esm.js.map +1 -1
  51. package/dist/next/components/Workflow/Workflow.esm.js +1 -1
  52. package/dist/next/components/Workflow/Workflow.esm.js.map +1 -1
  53. package/dist/next/extensions/createScaffolderFormDecorator.esm.js.map +1 -1
  54. package/dist/next/hooks/useFilteredSchemaProperties.esm.js.map +1 -1
  55. package/dist/next/hooks/useFormDataFromQuery.esm.js.map +1 -1
  56. package/dist/next/hooks/useTemplateParameterSchema.esm.js.map +1 -1
  57. package/dist/next/hooks/useTemplateSchema.esm.js.map +1 -1
  58. package/dist/next/hooks/useTemplateTimeSaved.esm.js.map +1 -1
  59. package/dist/next/hooks/useTransformSchemaToProps.esm.js.map +1 -1
  60. package/dist/next/lib/schema.esm.js.map +1 -1
  61. package/dist/packages/opaque-internal/src/OpaqueType.esm.js.map +1 -1
  62. package/dist/packages/scaffolder-internal/src/wiring/InternalFormDecorator.esm.js.map +1 -1
  63. package/dist/packages/scaffolder-internal/src/wiring/InternalFormField.esm.js.map +1 -1
  64. package/dist/secrets/SecretsContext.esm.js +1 -1
  65. package/dist/secrets/SecretsContext.esm.js.map +1 -1
  66. package/dist/translation.esm.js.map +1 -1
  67. package/dist/utils.esm.js.map +1 -1
  68. package/package.json +18 -18
package/dist/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { ApiHolder, Extension } from '@backstage/core-plugin-api';
2
- import { HTMLAttributes, ReactNode, FormEvent, ElementType, Ref, ComponentType, PropsWithChildren } from 'react';
3
- import { JsonObject, JsonValue, Observable } from '@backstage/types';
2
+ import { HTMLAttributes, ReactNode, ComponentType, FormEvent, ElementType, Ref, PropsWithChildren } from 'react';
3
+ import { JsonObject } from '@backstage/types';
4
4
  import { JSONSchema7 } from 'json-schema';
5
- import { StrictRJSFSchema, RJSFSchema, FormContextType, GenericObjectType, UiSchema, IdSchema, ErrorSchema, Registry, ValidatorType, TemplatesType, RegistryWidgetsType, RJSFValidationError, CustomValidator, ErrorTransformer, Experimental_DefaultFormStateBehavior, UIOptionsType, FieldValidation } from '@rjsf/utils';
5
+ import { StrictRJSFSchema, RJSFSchema, FormContextType, GenericObjectType, UiSchema, IdSchema, ErrorSchema, Registry, ValidatorType, TemplatesType, RegistryWidgetsType, RJSFValidationError, CustomValidator, ErrorTransformer, Experimental_DefaultFormStateBehavior, FieldValidation, UIOptionsType } from '@rjsf/utils';
6
6
  import Form, { IChangeEvent, FormProps as FormProps$1 } from '@rjsf/core';
7
- import { TemplateEntityV1beta3, TemplatePresentationV1beta3, TaskSpec, TaskStep } from '@backstage/plugin-scaffolder-common';
7
+ import * as _backstage_plugin_scaffolder_common from '@backstage/plugin-scaffolder-common';
8
+ import { TemplateEntityV1beta3, TemplateParameterSchema as TemplateParameterSchema$1, ScaffolderTaskStatus as ScaffolderTaskStatus$1, ScaffolderTask as ScaffolderTask$1, ScaffolderUsageExample as ScaffolderUsageExample$1, Action as Action$1, ListActionsResponse as ListActionsResponse$1, TemplateFilter as TemplateFilter$1, TemplateGlobalFunction as TemplateGlobalFunction$1, TemplateGlobalValue as TemplateGlobalValue$1, ListTemplatingExtensionsResponse as ListTemplatingExtensionsResponse$1, ScaffolderOutputLink as ScaffolderOutputLink$1, ScaffolderOutputText as ScaffolderOutputText$1, ScaffolderTaskOutput as ScaffolderTaskOutput$1, LogEvent as LogEvent$1, ScaffolderScaffoldOptions as ScaffolderScaffoldOptions$1, ScaffolderScaffoldResponse as ScaffolderScaffoldResponse$1, ScaffolderGetIntegrationsListOptions as ScaffolderGetIntegrationsListOptions$1, ScaffolderGetIntegrationsListResponse as ScaffolderGetIntegrationsListResponse$1, ScaffolderStreamLogsOptions as ScaffolderStreamLogsOptions$1, ScaffolderDryRunOptions as ScaffolderDryRunOptions$1, ScaffolderDryRunResponse as ScaffolderDryRunResponse$1, ScaffolderApi as ScaffolderApi$1 } from '@backstage/plugin-scaffolder-common';
8
9
  import * as react_jsx_runtime from 'react/jsx-runtime';
9
10
  import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
10
11
  import { z } from 'zod';
@@ -338,21 +339,9 @@ type ReviewStepProps = {
338
339
  * as a separate step in the wizard input
339
340
  *
340
341
  * @public
342
+ * @deprecated use import from {@link @backstage/plugin-scaffolder-common#TemplateParameterSchema} instead as this has now been moved.
341
343
  */
342
- type TemplateParameterSchema = {
343
- title: string;
344
- description?: string;
345
- presentation?: TemplatePresentationV1beta3;
346
- steps: Array<{
347
- title: string;
348
- description?: string;
349
- schema: JsonObject;
350
- }>;
351
- EXPERIMENTAL_formDecorators?: {
352
- id: string;
353
- input?: JsonObject;
354
- }[];
355
- };
344
+ type TemplateParameterSchema = TemplateParameterSchema$1;
356
345
 
357
346
  /**
358
347
  * The Context Provider that holds the state for the secrets.
@@ -376,34 +365,30 @@ interface ScaffolderUseTemplateSecrets {
376
365
  */
377
366
  declare const useTemplateSecrets: () => ScaffolderUseTemplateSecrets;
378
367
 
368
+ /** @public */
369
+ declare const scaffolderApiRef: _backstage_frontend_plugin_api.ApiRef<_backstage_plugin_scaffolder_common.ScaffolderApi>;
370
+
379
371
  /**
380
372
  * The status of each task in a Scaffolder Job
381
373
  *
382
374
  * @public
375
+ * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderTaskStatus} instead as this has now been moved.
383
376
  */
384
- type ScaffolderTaskStatus = 'cancelled' | 'completed' | 'failed' | 'open' | 'processing' | 'skipped';
377
+ type ScaffolderTaskStatus = ScaffolderTaskStatus$1;
385
378
  /**
386
379
  * The shape of each task returned from the `scaffolder-backend`
387
380
  *
388
381
  * @public
382
+ * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderTask} instead as this has now been moved.
389
383
  */
390
- type ScaffolderTask = {
391
- id: string;
392
- spec: TaskSpec;
393
- status: 'failed' | 'completed' | 'processing' | 'open' | 'cancelled';
394
- lastHeartbeatAt: string;
395
- createdAt: string;
396
- };
384
+ type ScaffolderTask = ScaffolderTask$1;
397
385
  /**
398
386
  * A single scaffolder usage example
399
387
  *
400
388
  * @public
389
+ * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderUsageExample} instead as this has now been moved.
401
390
  */
402
- type ScaffolderUsageExample = {
403
- description?: string;
404
- example: string;
405
- notes?: string;
406
- };
391
+ type ScaffolderUsageExample = ScaffolderUsageExample$1;
407
392
  /**
408
393
  * A single action example
409
394
  *
@@ -415,237 +400,118 @@ type ActionExample = ScaffolderUsageExample;
415
400
  * The response shape for a single action in the `listActions` call to the `scaffolder-backend`
416
401
  *
417
402
  * @public
403
+ * @deprecated use import from {@link @backstage/plugin-scaffolder-common#Action} instead as this has now been moved.
418
404
  */
419
- type Action = {
420
- id: string;
421
- description?: string;
422
- schema?: {
423
- input?: JSONSchema7;
424
- output?: JSONSchema7;
425
- };
426
- examples?: ActionExample[];
427
- };
405
+ type Action = Action$1;
428
406
  /**
429
407
  * The response shape for the `listActions` call to the `scaffolder-backend`
430
408
  *
431
409
  * @public
410
+ * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ListActionsResponse} instead as this has now been moved.
432
411
  */
433
- type ListActionsResponse = Array<Action>;
412
+ type ListActionsResponse = ListActionsResponse$1;
434
413
  /**
435
414
  * The response shape for a single filter in the `listTemplatingExtensions` call to the `scaffolder-backend`
436
415
  *
437
416
  * @public
417
+ * @deprecated use import from {@link @backstage/plugin-scaffolder-common#TemplateFilter} instead as this has now been moved.
438
418
  */
439
- type TemplateFilter = {
440
- description?: string;
441
- schema?: {
442
- input?: JSONSchema7;
443
- arguments?: JSONSchema7[];
444
- output?: JSONSchema7;
445
- };
446
- examples?: ScaffolderUsageExample[];
447
- };
419
+ type TemplateFilter = TemplateFilter$1;
448
420
  /**
449
421
  * The response shape for a single global function in the `listTemplatingExtensions` call to the `scaffolder-backend`
450
422
  *
451
423
  * @public
424
+ * @deprecated use import from {@link @backstage/plugin-scaffolder-common#TemplateGlobalFunction} instead as this has now been moved.
452
425
  */
453
- type TemplateGlobalFunction = {
454
- description?: string;
455
- schema?: {
456
- arguments?: JSONSchema7[];
457
- output?: JSONSchema7;
458
- };
459
- examples?: ScaffolderUsageExample[];
460
- };
426
+ type TemplateGlobalFunction = TemplateGlobalFunction$1;
461
427
  /**
462
428
  * The response shape for a single global value in the `listTemplatingExtensions` call to the `scaffolder-backend`
463
429
  *
464
430
  * @public
431
+ * @deprecated use import from {@link @backstage/plugin-scaffolder-common#TemplateGlobalValue} instead as this has now been moved.
465
432
  */
466
- type TemplateGlobalValue = {
467
- description?: string;
468
- value: JsonValue;
469
- };
433
+ type TemplateGlobalValue = TemplateGlobalValue$1;
470
434
  /**
471
435
  * The response shape for the `listTemplatingExtensions` call to the `scaffolder-backend`
472
436
  *
473
437
  * @public
438
+ * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ListTemplatingExtensionsResponse} instead as this has now been moved.
474
439
  */
475
- type ListTemplatingExtensionsResponse = {
476
- filters: Record<string, TemplateFilter>;
477
- globals: {
478
- functions: Record<string, TemplateGlobalFunction>;
479
- values: Record<string, TemplateGlobalValue>;
480
- };
481
- };
482
- /** @public */
483
- type ScaffolderOutputLink = {
484
- title?: string;
485
- icon?: string;
486
- url?: string;
487
- entityRef?: string;
488
- };
489
- /** @public */
490
- type ScaffolderOutputText = {
491
- title?: string;
492
- icon?: string;
493
- content?: string;
494
- default?: boolean;
495
- };
496
- /** @public */
497
- type ScaffolderTaskOutput = {
498
- links?: ScaffolderOutputLink[];
499
- text?: ScaffolderOutputText[];
500
- } & {
501
- [key: string]: unknown;
502
- };
440
+ type ListTemplatingExtensionsResponse = ListTemplatingExtensionsResponse$1;
441
+ /**
442
+ * @public
443
+ * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderOutputLink} instead as this has now been moved.
444
+ */
445
+ type ScaffolderOutputLink = ScaffolderOutputLink$1;
446
+ /**
447
+ * @public
448
+ * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderOutputText} instead as this has now been moved.
449
+ */
450
+ type ScaffolderOutputText = ScaffolderOutputText$1;
451
+ /**
452
+ * @public
453
+ * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderTaskOutput} instead as this has now been moved.
454
+ */
455
+ type ScaffolderTaskOutput = ScaffolderTaskOutput$1;
503
456
  /**
504
457
  * The shape of a `LogEvent` message from the `scaffolder-backend`
505
458
  *
506
459
  * @public
460
+ * @deprecated use import from {@link @backstage/plugin-scaffolder-common#LogEvent} instead as this has now been moved.
507
461
  */
508
- type LogEvent = {
509
- type: 'log' | 'completion' | 'cancelled' | 'recovered';
510
- body: {
511
- message: string;
512
- stepId?: string;
513
- status?: ScaffolderTaskStatus;
514
- };
515
- createdAt: string;
516
- id: string;
517
- taskId: string;
518
- };
462
+ type LogEvent = LogEvent$1;
519
463
  /**
520
464
  * The input options to the `scaffold` method of the `ScaffolderClient`.
521
465
  *
522
466
  * @public
467
+ * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderScaffoldOptions} instead as this has now been moved.
523
468
  */
524
- interface ScaffolderScaffoldOptions {
525
- templateRef: string;
526
- values: Record<string, JsonValue>;
527
- secrets?: Record<string, string>;
528
- }
469
+ type ScaffolderScaffoldOptions = ScaffolderScaffoldOptions$1;
529
470
  /**
530
471
  * The response shape of the `scaffold` method of the `ScaffolderClient`.
531
472
  *
532
473
  * @public
474
+ * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderScaffoldResponse} instead as this has now been moved.
533
475
  */
534
- interface ScaffolderScaffoldResponse {
535
- taskId: string;
536
- }
476
+ type ScaffolderScaffoldResponse = ScaffolderScaffoldResponse$1;
537
477
  /**
538
478
  * The arguments for `getIntegrationsList`.
539
479
  *
540
480
  * @public
481
+ * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderGetIntegrationsListOptions} instead as this has now been moved.
541
482
  */
542
- interface ScaffolderGetIntegrationsListOptions {
543
- allowedHosts: string[];
544
- }
483
+ type ScaffolderGetIntegrationsListOptions = ScaffolderGetIntegrationsListOptions$1;
545
484
  /**
546
485
  * The response shape for `getIntegrationsList`.
547
486
  *
548
487
  * @public
488
+ * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderGetIntegrationsListResponse} instead as this has now been moved.
549
489
  */
550
- interface ScaffolderGetIntegrationsListResponse {
551
- integrations: {
552
- type: string;
553
- title: string;
554
- host: string;
555
- }[];
556
- }
490
+ type ScaffolderGetIntegrationsListResponse = ScaffolderGetIntegrationsListResponse$1;
557
491
  /**
558
492
  * The input options to the `streamLogs` method of the `ScaffolderClient`.
559
493
  *
560
494
  * @public
495
+ * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderStreamLogsOptions} instead as this has now been moved.
561
496
  */
562
- interface ScaffolderStreamLogsOptions {
563
- isTaskRecoverable?: boolean;
564
- taskId: string;
565
- after?: number;
566
- }
567
- /** @public */
568
- interface ScaffolderDryRunOptions {
569
- template: JsonValue;
570
- values: JsonObject;
571
- secrets?: Record<string, string>;
572
- directoryContents: {
573
- path: string;
574
- base64Content: string;
575
- }[];
576
- }
577
- /** @public */
578
- interface ScaffolderDryRunResponse {
579
- directoryContents: Array<{
580
- path: string;
581
- base64Content: string;
582
- executable: boolean;
583
- }>;
584
- log: Array<Pick<LogEvent, 'body'>>;
585
- steps: TaskStep[];
586
- output: ScaffolderTaskOutput;
587
- }
497
+ type ScaffolderStreamLogsOptions = ScaffolderStreamLogsOptions$1;
498
+ /**
499
+ * @public
500
+ * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderDryRunOptions} instead as this has now been moved.
501
+ */
502
+ type ScaffolderDryRunOptions = ScaffolderDryRunOptions$1;
503
+ /**
504
+ * @public
505
+ * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderDryRunResponse} instead as this has now been moved.
506
+ */
507
+ type ScaffolderDryRunResponse = ScaffolderDryRunResponse$1;
588
508
  /**
589
509
  * An API to interact with the scaffolder backend.
590
510
  *
591
511
  * @public
512
+ * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderApi} instead as this has now been moved.
592
513
  */
593
- interface ScaffolderApi {
594
- getTemplateParameterSchema(templateRef: string): Promise<TemplateParameterSchema>;
595
- /**
596
- * Executes the scaffolding of a component, given a template and its
597
- * parameter values.
598
- *
599
- * @param options - The {@link ScaffolderScaffoldOptions} the scaffolding.
600
- */
601
- scaffold(options: ScaffolderScaffoldOptions): Promise<ScaffolderScaffoldResponse>;
602
- getTask(taskId: string): Promise<ScaffolderTask>;
603
- /**
604
- * Sends a signal to a task broker to cancel the running task by taskId.
605
- *
606
- * @param taskId - the id of the task
607
- */
608
- cancelTask(taskId: string): Promise<void>;
609
- /**
610
- * Starts the task again from the point where it failed.
611
- *
612
- * @param taskId - the id of the task
613
- */
614
- retry?(taskId: string): Promise<void>;
615
- listTasks?(options: {
616
- filterByOwnership: 'owned' | 'all';
617
- limit?: number;
618
- offset?: number;
619
- }): Promise<{
620
- tasks: ScaffolderTask[];
621
- totalTasks?: number;
622
- }>;
623
- getIntegrationsList(options: ScaffolderGetIntegrationsListOptions): Promise<ScaffolderGetIntegrationsListResponse>;
624
- /**
625
- * Returns a list of all installed actions.
626
- */
627
- listActions(): Promise<ListActionsResponse>;
628
- /**
629
- * Returns a structure describing the available templating extensions.
630
- */
631
- listTemplatingExtensions?(): Promise<ListTemplatingExtensionsResponse>;
632
- streamLogs(options: ScaffolderStreamLogsOptions): Observable<LogEvent>;
633
- dryRun?(options: ScaffolderDryRunOptions): Promise<ScaffolderDryRunResponse>;
634
- autocomplete?(options: {
635
- token: string;
636
- provider: string;
637
- resource: string;
638
- context?: Record<string, string>;
639
- }): Promise<{
640
- results: {
641
- title?: string;
642
- id: string;
643
- }[];
644
- }>;
645
- }
646
-
647
- /** @public */
648
- declare const scaffolderApiRef: _backstage_frontend_plugin_api.ApiRef<ScaffolderApi>;
514
+ type ScaffolderApi = ScaffolderApi$1;
649
515
 
650
516
  /**
651
517
  * Hook that returns all custom field extensions from the current outlet.
@@ -1 +1 @@
1
- {"version":3,"file":"createScaffolderLayout.esm.js","sources":["../../src/layouts/createScaffolderLayout.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { LAYOUTS_KEY, LAYOUTS_WRAPPER_KEY } from './keys';\nimport { attachComponentData, Extension } from '@backstage/core-plugin-api';\nimport type { FormProps as SchemaFormProps } from '@rjsf/core';\nimport { PropsWithChildren, ComponentType } from 'react';\n\n/**\n * The field template from `@rjsf/core` which is a react component that gets passed `@rjsf/core` field related props.\n *\n * @public\n */\nexport type LayoutTemplate<T = any> = NonNullable<\n SchemaFormProps<T>['uiSchema']\n>['ui:ObjectFieldTemplate'];\n\n/**\n * The type of layouts that is passed to the TemplateForms\n *\n * @public\n */\nexport interface LayoutOptions<P = any> {\n name: string;\n component: LayoutTemplate<P>;\n}\n\n/**\n * A type used to wrap up the FieldExtension to embed the ReturnValue and the InputProps\n * @public\n */\nexport type LayoutComponent<_TInputProps> = () => null;\n\n/**\n * Method for creating custom Layouts that can be used in the scaffolder frontend form\n *\n * @public\n */\nexport function createScaffolderLayout<TInputProps = unknown>(\n options: LayoutOptions,\n): Extension<LayoutComponent<TInputProps>> {\n return {\n expose() {\n const LayoutDataHolder: any = () => null;\n\n attachComponentData(LayoutDataHolder, LAYOUTS_KEY, options);\n\n return LayoutDataHolder;\n },\n };\n}\n\n/**\n * The wrapping component for defining scaffolder layouts as children\n *\n * @public\n */\nexport const ScaffolderLayouts: ComponentType<\n PropsWithChildren<{}>\n> = (): JSX.Element | null => null;\n\nattachComponentData(ScaffolderLayouts, LAYOUTS_WRAPPER_KEY, true);\n"],"names":[],"mappings":";;;AAmDO,SAAS,uBACd,OACyC,EAAA;AACzC,EAAO,OAAA;AAAA,IACL,MAAS,GAAA;AACP,MAAA,MAAM,mBAAwB,MAAM,IAAA;AAEpC,MAAoB,mBAAA,CAAA,gBAAA,EAAkB,aAAa,OAAO,CAAA;AAE1D,MAAO,OAAA,gBAAA;AAAA;AACT,GACF;AACF;AAOO,MAAM,oBAET,MAA0B;AAE9B,mBAAoB,CAAA,iBAAA,EAAmB,qBAAqB,IAAI,CAAA;;;;"}
1
+ {"version":3,"file":"createScaffolderLayout.esm.js","sources":["../../src/layouts/createScaffolderLayout.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { LAYOUTS_KEY, LAYOUTS_WRAPPER_KEY } from './keys';\nimport { attachComponentData, Extension } from '@backstage/core-plugin-api';\nimport type { FormProps as SchemaFormProps } from '@rjsf/core';\nimport { PropsWithChildren, ComponentType } from 'react';\n\n/**\n * The field template from `@rjsf/core` which is a react component that gets passed `@rjsf/core` field related props.\n *\n * @public\n */\nexport type LayoutTemplate<T = any> = NonNullable<\n SchemaFormProps<T>['uiSchema']\n>['ui:ObjectFieldTemplate'];\n\n/**\n * The type of layouts that is passed to the TemplateForms\n *\n * @public\n */\nexport interface LayoutOptions<P = any> {\n name: string;\n component: LayoutTemplate<P>;\n}\n\n/**\n * A type used to wrap up the FieldExtension to embed the ReturnValue and the InputProps\n * @public\n */\nexport type LayoutComponent<_TInputProps> = () => null;\n\n/**\n * Method for creating custom Layouts that can be used in the scaffolder frontend form\n *\n * @public\n */\nexport function createScaffolderLayout<TInputProps = unknown>(\n options: LayoutOptions,\n): Extension<LayoutComponent<TInputProps>> {\n return {\n expose() {\n const LayoutDataHolder: any = () => null;\n\n attachComponentData(LayoutDataHolder, LAYOUTS_KEY, options);\n\n return LayoutDataHolder;\n },\n };\n}\n\n/**\n * The wrapping component for defining scaffolder layouts as children\n *\n * @public\n */\nexport const ScaffolderLayouts: ComponentType<\n PropsWithChildren<{}>\n> = (): JSX.Element | null => null;\n\nattachComponentData(ScaffolderLayouts, LAYOUTS_WRAPPER_KEY, true);\n"],"names":[],"mappings":";;;AAmDO,SAAS,uBACd,OAAA,EACyC;AACzC,EAAA,OAAO;AAAA,IACL,MAAA,GAAS;AACP,MAAA,MAAM,mBAAwB,MAAM,IAAA;AAEpC,MAAA,mBAAA,CAAoB,gBAAA,EAAkB,aAAa,OAAO,CAAA;AAE1D,MAAA,OAAO,gBAAA;AAAA,IACT;AAAA,GACF;AACF;AAOO,MAAM,oBAET,MAA0B;AAE9B,mBAAA,CAAoB,iBAAA,EAAmB,qBAAqB,IAAI,CAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"keys.esm.js","sources":["../../src/layouts/keys.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport const LAYOUTS_KEY = 'scaffolder.layout.v1';\nexport const LAYOUTS_WRAPPER_KEY = 'scaffolder.layouts.wrapper.v1';\n"],"names":[],"mappings":"AAeO,MAAM,WAAc,GAAA;AACpB,MAAM,mBAAsB,GAAA;;;;"}
1
+ {"version":3,"file":"keys.esm.js","sources":["../../src/layouts/keys.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport const LAYOUTS_KEY = 'scaffolder.layout.v1';\nexport const LAYOUTS_WRAPPER_KEY = 'scaffolder.layouts.wrapper.v1';\n"],"names":[],"mappings":"AAeO,MAAM,WAAA,GAAc;AACpB,MAAM,mBAAA,GAAsB;;;;"}
@@ -1,4 +1,4 @@
1
- import { ApiBlueprint, createExtensionInput, createApiFactory } from '@backstage/frontend-plugin-api';
1
+ import { ApiBlueprint, createExtensionInput } from '@backstage/frontend-plugin-api';
2
2
  import { formFieldsApiRef } from './ref.esm.js';
3
3
  import '../blueprints/FormDecoratorBlueprint.esm.js';
4
4
  import { FormFieldBlueprint } from '../blueprints/FormFieldBlueprint.esm.js';
@@ -27,13 +27,13 @@ const formFieldsApi = ApiBlueprint.makeWithOverrides({
27
27
  const formFieldLoaders = inputs.formFields.map(
28
28
  (e) => e.get(FormFieldBlueprint.dataRefs.formFieldLoader)
29
29
  );
30
- return originalFactory({
31
- factory: createApiFactory({
30
+ return originalFactory(
31
+ (defineParams) => defineParams({
32
32
  api: formFieldsApiRef,
33
33
  deps: {},
34
34
  factory: () => new DefaultScaffolderFormFieldsApi(formFieldLoaders)
35
35
  })
36
- });
36
+ );
37
37
  }
38
38
  });
39
39
 
@@ -1 +1 @@
1
- {"version":3,"file":"FormFieldsApi.esm.js","sources":["../../../src/next/api/FormFieldsApi.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ApiBlueprint,\n createApiFactory,\n createExtensionInput,\n} from '@backstage/frontend-plugin-api';\nimport { formFieldsApiRef } from './ref';\nimport { ScaffolderFormFieldsApi } from './types';\nimport { FormFieldBlueprint } from '../blueprints';\nimport { FormField, OpaqueFormField } from '@internal/scaffolder';\n\nclass DefaultScaffolderFormFieldsApi implements ScaffolderFormFieldsApi {\n constructor(\n private readonly formFieldLoaders: Array<() => Promise<FormField>> = [],\n ) {}\n\n async getFormFields() {\n const formFields = await Promise.all(\n this.formFieldLoaders.map(loader => loader()),\n );\n\n const internalFormFields = formFields.map(OpaqueFormField.toInternal);\n\n return internalFormFields;\n }\n}\n\n/** @alpha */\nexport const formFieldsApi = ApiBlueprint.makeWithOverrides({\n name: 'form-fields',\n inputs: {\n formFields: createExtensionInput([\n FormFieldBlueprint.dataRefs.formFieldLoader,\n ]),\n },\n factory(originalFactory, { inputs }) {\n const formFieldLoaders = inputs.formFields.map(e =>\n e.get(FormFieldBlueprint.dataRefs.formFieldLoader),\n );\n\n return originalFactory({\n factory: createApiFactory({\n api: formFieldsApiRef,\n deps: {},\n factory: () => new DefaultScaffolderFormFieldsApi(formFieldLoaders),\n }),\n });\n },\n});\n"],"names":[],"mappings":";;;;;;AA0BA,MAAM,8BAAkE,CAAA;AAAA,EACtE,WAAA,CACmB,gBAAoD,GAAA,EACrE,EAAA;AADiB,IAAA,IAAA,CAAA,gBAAA,GAAA,gBAAA;AAAA;AAChB,EAEH,MAAM,aAAgB,GAAA;AACpB,IAAM,MAAA,UAAA,GAAa,MAAM,OAAQ,CAAA,GAAA;AAAA,MAC/B,IAAK,CAAA,gBAAA,CAAiB,GAAI,CAAA,CAAA,MAAA,KAAU,QAAQ;AAAA,KAC9C;AAEA,IAAA,MAAM,kBAAqB,GAAA,UAAA,CAAW,GAAI,CAAA,eAAA,CAAgB,UAAU,CAAA;AAEpE,IAAO,OAAA,kBAAA;AAAA;AAEX;AAGa,MAAA,aAAA,GAAgB,aAAa,iBAAkB,CAAA;AAAA,EAC1D,IAAM,EAAA,aAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,YAAY,oBAAqB,CAAA;AAAA,MAC/B,mBAAmB,QAAS,CAAA;AAAA,KAC7B;AAAA,GACH;AAAA,EACA,OAAQ,CAAA,eAAA,EAAiB,EAAE,MAAA,EAAU,EAAA;AACnC,IAAM,MAAA,gBAAA,GAAmB,OAAO,UAAW,CAAA,GAAA;AAAA,MAAI,CAC7C,CAAA,KAAA,CAAA,CAAE,GAAI,CAAA,kBAAA,CAAmB,SAAS,eAAe;AAAA,KACnD;AAEA,IAAA,OAAO,eAAgB,CAAA;AAAA,MACrB,SAAS,gBAAiB,CAAA;AAAA,QACxB,GAAK,EAAA,gBAAA;AAAA,QACL,MAAM,EAAC;AAAA,QACP,OAAS,EAAA,MAAM,IAAI,8BAAA,CAA+B,gBAAgB;AAAA,OACnE;AAAA,KACF,CAAA;AAAA;AAEL,CAAC;;;;"}
1
+ {"version":3,"file":"FormFieldsApi.esm.js","sources":["../../../src/next/api/FormFieldsApi.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ApiBlueprint,\n createExtensionInput,\n} from '@backstage/frontend-plugin-api';\nimport { formFieldsApiRef } from './ref';\nimport { FormField, ScaffolderFormFieldsApi } from './types';\nimport { FormFieldBlueprint } from '../blueprints';\nimport { OpaqueFormField } from '@internal/scaffolder';\n\nclass DefaultScaffolderFormFieldsApi implements ScaffolderFormFieldsApi {\n constructor(\n private readonly formFieldLoaders: Array<() => Promise<FormField>> = [],\n ) {}\n\n async getFormFields() {\n const formFields = await Promise.all(\n this.formFieldLoaders.map(loader => loader()),\n );\n\n const internalFormFields = formFields.map(OpaqueFormField.toInternal);\n\n return internalFormFields;\n }\n}\n\n/** @alpha */\nexport const formFieldsApi = ApiBlueprint.makeWithOverrides({\n name: 'form-fields',\n inputs: {\n formFields: createExtensionInput([\n FormFieldBlueprint.dataRefs.formFieldLoader,\n ]),\n },\n factory(originalFactory, { inputs }) {\n const formFieldLoaders = inputs.formFields.map(e =>\n e.get(FormFieldBlueprint.dataRefs.formFieldLoader),\n );\n\n return originalFactory(defineParams =>\n defineParams({\n api: formFieldsApiRef,\n deps: {},\n factory: () => new DefaultScaffolderFormFieldsApi(formFieldLoaders),\n }),\n );\n },\n});\n"],"names":[],"mappings":";;;;;;AAyBA,MAAM,8BAAA,CAAkE;AAAA,EACtE,WAAA,CACmB,gBAAA,GAAoD,EAAC,EACtE;AADiB,IAAA,IAAA,CAAA,gBAAA,GAAA,gBAAA;AAAA,EAChB;AAAA,EAEH,MAAM,aAAA,GAAgB;AACpB,IAAA,MAAM,UAAA,GAAa,MAAM,OAAA,CAAQ,GAAA;AAAA,MAC/B,IAAA,CAAK,gBAAA,CAAiB,GAAA,CAAI,CAAA,MAAA,KAAU,QAAQ;AAAA,KAC9C;AAEA,IAAA,MAAM,kBAAA,GAAqB,UAAA,CAAW,GAAA,CAAI,eAAA,CAAgB,UAAU,CAAA;AAEpE,IAAA,OAAO,kBAAA;AAAA,EACT;AACF;AAGO,MAAM,aAAA,GAAgB,aAAa,iBAAA,CAAkB;AAAA,EAC1D,IAAA,EAAM,aAAA;AAAA,EACN,MAAA,EAAQ;AAAA,IACN,YAAY,oBAAA,CAAqB;AAAA,MAC/B,mBAAmB,QAAA,CAAS;AAAA,KAC7B;AAAA,GACH;AAAA,EACA,OAAA,CAAQ,eAAA,EAAiB,EAAE,MAAA,EAAO,EAAG;AACnC,IAAA,MAAM,gBAAA,GAAmB,OAAO,UAAA,CAAW,GAAA;AAAA,MAAI,CAAA,CAAA,KAC7C,CAAA,CAAE,GAAA,CAAI,kBAAA,CAAmB,SAAS,eAAe;AAAA,KACnD;AAEA,IAAA,OAAO,eAAA;AAAA,MAAgB,kBACrB,YAAA,CAAa;AAAA,QACX,GAAA,EAAK,gBAAA;AAAA,QACL,MAAM,EAAC;AAAA,QACP,OAAA,EAAS,MAAM,IAAI,8BAAA,CAA+B,gBAAgB;AAAA,OACnE;AAAA,KACH;AAAA,EACF;AACF,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ref.esm.js","sources":["../../../src/next/api/ref.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createApiRef } from '@backstage/frontend-plugin-api';\nimport { ScaffolderFormFieldsApi } from './types';\n\n/**\n * @alpha\n * @deprecated This API is no longer necessary and will be removed\n */\nexport const formFieldsApiRef = createApiRef<ScaffolderFormFieldsApi>({\n id: 'plugin.scaffolder.form-fields',\n});\n"],"names":[],"mappings":";;AAuBO,MAAM,mBAAmB,YAAsC,CAAA;AAAA,EACpE,EAAI,EAAA;AACN,CAAC;;;;"}
1
+ {"version":3,"file":"ref.esm.js","sources":["../../../src/next/api/ref.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createApiRef } from '@backstage/frontend-plugin-api';\nimport { ScaffolderFormFieldsApi } from './types';\n\n/**\n * @alpha\n * @deprecated This API is no longer necessary and will be removed\n */\nexport const formFieldsApiRef = createApiRef<ScaffolderFormFieldsApi>({\n id: 'plugin.scaffolder.form-fields',\n});\n"],"names":[],"mappings":";;AAuBO,MAAM,mBAAmB,YAAA,CAAsC;AAAA,EACpE,EAAA,EAAI;AACN,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"FormDecoratorBlueprint.esm.js","sources":["../../../src/next/blueprints/FormDecoratorBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n createExtensionBlueprint,\n createExtensionDataRef,\n} from '@backstage/frontend-plugin-api';\nimport { ScaffolderFormDecorator } from '../extensions';\n\nconst formDecoratorExtensionDataRef =\n createExtensionDataRef<ScaffolderFormDecorator>().with({\n id: 'scaffolder.form-decorator-loader',\n });\n\n/**\n * @alpha\n * Creates extensions that are Field Extensions for the Scaffolder\n * */\nexport const FormDecoratorBlueprint = createExtensionBlueprint({\n kind: 'scaffolder-form-decorator',\n attachTo: { id: 'api:scaffolder/form-decorators', input: 'formDecorators' },\n dataRefs: {\n formDecoratorLoader: formDecoratorExtensionDataRef,\n },\n output: [formDecoratorExtensionDataRef],\n *factory(params: { decorator: ScaffolderFormDecorator }) {\n yield formDecoratorExtensionDataRef(params.decorator);\n },\n});\n"],"names":[],"mappings":";;AAqBA,MAAM,6BAAA,GACJ,sBAAgD,EAAA,CAAE,IAAK,CAAA;AAAA,EACrD,EAAI,EAAA;AACN,CAAC,CAAA;AAMI,MAAM,yBAAyB,wBAAyB,CAAA;AAAA,EAC7D,IAAM,EAAA,2BAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,gCAAA,EAAkC,OAAO,gBAAiB,EAAA;AAAA,EAC1E,QAAU,EAAA;AAAA,IACR,mBAAqB,EAAA;AAAA,GACvB;AAAA,EACA,MAAA,EAAQ,CAAC,6BAA6B,CAAA;AAAA,EACtC,CAAC,QAAQ,MAAgD,EAAA;AACvD,IAAM,MAAA,6BAAA,CAA8B,OAAO,SAAS,CAAA;AAAA;AAExD,CAAC;;;;"}
1
+ {"version":3,"file":"FormDecoratorBlueprint.esm.js","sources":["../../../src/next/blueprints/FormDecoratorBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n createExtensionBlueprint,\n createExtensionDataRef,\n} from '@backstage/frontend-plugin-api';\nimport { ScaffolderFormDecorator } from '../extensions';\n\nconst formDecoratorExtensionDataRef =\n createExtensionDataRef<ScaffolderFormDecorator>().with({\n id: 'scaffolder.form-decorator-loader',\n });\n\n/**\n * @alpha\n * Creates extensions that are Field Extensions for the Scaffolder\n * */\nexport const FormDecoratorBlueprint = createExtensionBlueprint({\n kind: 'scaffolder-form-decorator',\n attachTo: { id: 'api:scaffolder/form-decorators', input: 'formDecorators' },\n dataRefs: {\n formDecoratorLoader: formDecoratorExtensionDataRef,\n },\n output: [formDecoratorExtensionDataRef],\n *factory(params: { decorator: ScaffolderFormDecorator }) {\n yield formDecoratorExtensionDataRef(params.decorator);\n },\n});\n"],"names":[],"mappings":";;AAqBA,MAAM,6BAAA,GACJ,sBAAA,EAAgD,CAAE,IAAA,CAAK;AAAA,EACrD,EAAA,EAAI;AACN,CAAC,CAAA;AAMI,MAAM,yBAAyB,wBAAA,CAAyB;AAAA,EAC7D,IAAA,EAAM,2BAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,gCAAA,EAAkC,OAAO,gBAAA,EAAiB;AAAA,EAC1E,QAAA,EAAU;AAAA,IACR,mBAAA,EAAqB;AAAA,GACvB;AAAA,EACA,MAAA,EAAQ,CAAC,6BAA6B,CAAA;AAAA,EACtC,CAAC,QAAQ,MAAA,EAAgD;AACvD,IAAA,MAAM,6BAAA,CAA8B,OAAO,SAAS,CAAA;AAAA,EACtD;AACF,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"FormFieldBlueprint.esm.js","sources":["../../../src/next/blueprints/FormFieldBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n createExtensionBlueprint,\n createExtensionDataRef,\n} from '@backstage/frontend-plugin-api';\nimport { z } from 'zod';\n\nimport { OpaqueFormField, FormField } from '@internal/scaffolder';\nimport { FormFieldExtensionData } from './types';\n\nconst formFieldExtensionDataRef = createExtensionDataRef<\n () => Promise<FormField>\n>().with({\n id: 'scaffolder.form-field-loader',\n});\n\n/**\n * @alpha\n * Creates extensions that are Field Extensions for the Scaffolder\n * */\nexport const FormFieldBlueprint = createExtensionBlueprint({\n kind: 'scaffolder-form-field',\n attachTo: [\n { id: 'page:scaffolder', input: 'formFields' },\n { id: 'api:scaffolder/form-fields', input: 'formFields' },\n ],\n dataRefs: {\n formFieldLoader: formFieldExtensionDataRef,\n },\n output: [formFieldExtensionDataRef],\n *factory(params: { field: () => Promise<FormField> }) {\n yield formFieldExtensionDataRef(params.field);\n },\n});\n\n/**\n * @alpha\n * Used to create a form field binding with typechecking for compliance\n */\nexport function createFormField<\n TReturnValue extends z.ZodType,\n TUiOptions extends z.ZodType,\n>(opts: FormFieldExtensionData<TReturnValue, TUiOptions>): FormField {\n return OpaqueFormField.createInstance('v1', opts);\n}\n"],"names":[],"mappings":";;;;AAwBA,MAAM,yBAAA,GAA4B,sBAEhC,EAAA,CAAE,IAAK,CAAA;AAAA,EACP,EAAI,EAAA;AACN,CAAC,CAAA;AAMM,MAAM,qBAAqB,wBAAyB,CAAA;AAAA,EACzD,IAAM,EAAA,uBAAA;AAAA,EACN,QAAU,EAAA;AAAA,IACR,EAAE,EAAA,EAAI,iBAAmB,EAAA,KAAA,EAAO,YAAa,EAAA;AAAA,IAC7C,EAAE,EAAA,EAAI,4BAA8B,EAAA,KAAA,EAAO,YAAa;AAAA,GAC1D;AAAA,EACA,QAAU,EAAA;AAAA,IACR,eAAiB,EAAA;AAAA,GACnB;AAAA,EACA,MAAA,EAAQ,CAAC,yBAAyB,CAAA;AAAA,EAClC,CAAC,QAAQ,MAA6C,EAAA;AACpD,IAAM,MAAA,yBAAA,CAA0B,OAAO,KAAK,CAAA;AAAA;AAEhD,CAAC;AAMM,SAAS,gBAGd,IAAmE,EAAA;AACnE,EAAO,OAAA,eAAA,CAAgB,cAAe,CAAA,IAAA,EAAM,IAAI,CAAA;AAClD;;;;"}
1
+ {"version":3,"file":"FormFieldBlueprint.esm.js","sources":["../../../src/next/blueprints/FormFieldBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n createExtensionBlueprint,\n createExtensionDataRef,\n} from '@backstage/frontend-plugin-api';\nimport { z } from 'zod';\n\nimport { OpaqueFormField } from '@internal/scaffolder';\nimport { FormFieldExtensionData } from './types';\nimport { FormField } from '../api';\n\nconst formFieldExtensionDataRef = createExtensionDataRef<\n () => Promise<FormField>\n>().with({\n id: 'scaffolder.form-field-loader',\n});\n\n/**\n * @alpha\n * Creates extensions that are Field Extensions for the Scaffolder\n * */\nexport const FormFieldBlueprint = createExtensionBlueprint({\n kind: 'scaffolder-form-field',\n attachTo: [\n { id: 'page:scaffolder', input: 'formFields' },\n { id: 'api:scaffolder/form-fields', input: 'formFields' },\n ],\n dataRefs: {\n formFieldLoader: formFieldExtensionDataRef,\n },\n output: [formFieldExtensionDataRef],\n *factory(params: { field: () => Promise<FormField> }) {\n yield formFieldExtensionDataRef(params.field);\n },\n});\n\n/**\n * @alpha\n * Used to create a form field binding with typechecking for compliance\n */\nexport function createFormField<\n TReturnValue extends z.ZodType,\n TUiOptions extends z.ZodType,\n>(opts: FormFieldExtensionData<TReturnValue, TUiOptions>): FormField {\n return OpaqueFormField.createInstance('v1', opts);\n}\n"],"names":[],"mappings":";;;;AAyBA,MAAM,yBAAA,GAA4B,sBAAA,EAEhC,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI;AACN,CAAC,CAAA;AAMM,MAAM,qBAAqB,wBAAA,CAAyB;AAAA,EACzD,IAAA,EAAM,uBAAA;AAAA,EACN,QAAA,EAAU;AAAA,IACR,EAAE,EAAA,EAAI,iBAAA,EAAmB,KAAA,EAAO,YAAA,EAAa;AAAA,IAC7C,EAAE,EAAA,EAAI,4BAAA,EAA8B,KAAA,EAAO,YAAA;AAAa,GAC1D;AAAA,EACA,QAAA,EAAU;AAAA,IACR,eAAA,EAAiB;AAAA,GACnB;AAAA,EACA,MAAA,EAAQ,CAAC,yBAAyB,CAAA;AAAA,EAClC,CAAC,QAAQ,MAAA,EAA6C;AACpD,IAAA,MAAM,yBAAA,CAA0B,OAAO,KAAK,CAAA;AAAA,EAC9C;AACF,CAAC;AAMM,SAAS,gBAGd,IAAA,EAAmE;AACnE,EAAA,OAAO,eAAA,CAAgB,cAAA,CAAe,IAAA,EAAM,IAAI,CAAA;AAClD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DescriptionFieldTemplate.esm.js","sources":["../../../../src/next/components/Form/DescriptionFieldTemplate.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { MarkdownContent } from '@backstage/core-components';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport {\n DescriptionFieldProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\n\nconst useStyles = makeStyles(theme => ({\n markdownDescription: {\n fontSize: theme.typography.caption.fontSize,\n margin: 0,\n color: theme.palette.text.secondary,\n '& :first-child': {\n margin: 0,\n marginTop: '3px', // to keep the standard browser padding\n },\n },\n}));\n\n/** The `DescriptionField` is the template to use to render the description of a field\n * @alpha\n * @param props - The `DescriptionFieldProps` for this component\n */\nexport const DescriptionFieldTemplate = <\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(\n props: DescriptionFieldProps<T, S, F>,\n) => {\n const { id, description } = props;\n const classes = useStyles();\n\n if (description) {\n if (typeof description === 'string') {\n return (\n <MarkdownContent\n content={description}\n linkTarget=\"_blank\"\n className={classes.markdownDescription}\n />\n );\n }\n\n return (\n <Typography id={id} variant=\"subtitle2\" style={{ marginTop: '5px' }}>\n {description}\n </Typography>\n );\n }\n\n return null;\n};\n"],"names":[],"mappings":";;;;;AAyBA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,mBAAqB,EAAA;AAAA,IACnB,QAAA,EAAU,KAAM,CAAA,UAAA,CAAW,OAAQ,CAAA,QAAA;AAAA,IACnC,MAAQ,EAAA,CAAA;AAAA,IACR,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA,SAAA;AAAA,IAC1B,gBAAkB,EAAA;AAAA,MAChB,MAAQ,EAAA,CAAA;AAAA,MACR,SAAW,EAAA;AAAA;AAAA;AACb;AAEJ,CAAE,CAAA,CAAA;AAMW,MAAA,wBAAA,GAA2B,CAKtC,KACG,KAAA;AACH,EAAM,MAAA,EAAE,EAAI,EAAA,WAAA,EAAgB,GAAA,KAAA;AAC5B,EAAA,MAAM,UAAU,SAAU,EAAA;AAE1B,EAAA,IAAI,WAAa,EAAA;AACf,IAAI,IAAA,OAAO,gBAAgB,QAAU,EAAA;AACnC,MACE,uBAAA,GAAA;AAAA,QAAC,eAAA;AAAA,QAAA;AAAA,UACC,OAAS,EAAA,WAAA;AAAA,UACT,UAAW,EAAA,QAAA;AAAA,UACX,WAAW,OAAQ,CAAA;AAAA;AAAA,OACrB;AAAA;AAIJ,IACE,uBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,EAAA,EAAQ,OAAQ,EAAA,WAAA,EAAY,OAAO,EAAE,SAAA,EAAW,KAAM,EAAA,EAC/D,QACH,EAAA,WAAA,EAAA,CAAA;AAAA;AAIJ,EAAO,OAAA,IAAA;AACT;;;;"}
1
+ {"version":3,"file":"DescriptionFieldTemplate.esm.js","sources":["../../../../src/next/components/Form/DescriptionFieldTemplate.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { MarkdownContent } from '@backstage/core-components';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport {\n DescriptionFieldProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\n\nconst useStyles = makeStyles(theme => ({\n markdownDescription: {\n fontSize: theme.typography.caption.fontSize,\n margin: 0,\n color: theme.palette.text.secondary,\n '& :first-child': {\n margin: 0,\n marginTop: '3px', // to keep the standard browser padding\n },\n },\n}));\n\n/** The `DescriptionField` is the template to use to render the description of a field\n * @alpha\n * @param props - The `DescriptionFieldProps` for this component\n */\nexport const DescriptionFieldTemplate = <\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(\n props: DescriptionFieldProps<T, S, F>,\n) => {\n const { id, description } = props;\n const classes = useStyles();\n\n if (description) {\n if (typeof description === 'string') {\n return (\n <MarkdownContent\n content={description}\n linkTarget=\"_blank\"\n className={classes.markdownDescription}\n />\n );\n }\n\n return (\n <Typography id={id} variant=\"subtitle2\" style={{ marginTop: '5px' }}>\n {description}\n </Typography>\n );\n }\n\n return null;\n};\n"],"names":[],"mappings":";;;;;AAyBA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,mBAAA,EAAqB;AAAA,IACnB,QAAA,EAAU,KAAA,CAAM,UAAA,CAAW,OAAA,CAAQ,QAAA;AAAA,IACnC,MAAA,EAAQ,CAAA;AAAA,IACR,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,IAAA,CAAK,SAAA;AAAA,IAC1B,gBAAA,EAAkB;AAAA,MAChB,MAAA,EAAQ,CAAA;AAAA,MACR,SAAA,EAAW;AAAA;AAAA;AACb;AAEJ,CAAA,CAAE,CAAA;AAMK,MAAM,wBAAA,GAA2B,CAKtC,KAAA,KACG;AACH,EAAA,MAAM,EAAE,EAAA,EAAI,WAAA,EAAY,GAAI,KAAA;AAC5B,EAAA,MAAM,UAAU,SAAA,EAAU;AAE1B,EAAA,IAAI,WAAA,EAAa;AACf,IAAA,IAAI,OAAO,gBAAgB,QAAA,EAAU;AACnC,MAAA,uBACE,GAAA;AAAA,QAAC,eAAA;AAAA,QAAA;AAAA,UACC,OAAA,EAAS,WAAA;AAAA,UACT,UAAA,EAAW,QAAA;AAAA,UACX,WAAW,OAAA,CAAQ;AAAA;AAAA,OACrB;AAAA,IAEJ;AAEA,IAAA,uBACE,GAAA,CAAC,UAAA,EAAA,EAAW,EAAA,EAAQ,OAAA,EAAQ,WAAA,EAAY,OAAO,EAAE,SAAA,EAAW,KAAA,EAAM,EAC/D,QAAA,EAAA,WAAA,EACH,CAAA;AAAA,EAEJ;AAEA,EAAA,OAAO,IAAA;AACT;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"FieldTemplate.esm.js","sources":["../../../../src/next/components/Form/FieldTemplate.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n FieldTemplateProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n getTemplate,\n getUiOptions,\n} from '@rjsf/utils';\n\nimport { ScaffolderField } from '../ScaffolderField';\n\n/** The `FieldTemplate` component is the template used by `SchemaField` to render any field. It renders the field\n * content, (label, description, children, errors and help) inside of a `WrapIfAdditional` component.\n * @alpha\n * @param props - The `FieldTemplateProps` for this component\n */\nexport const FieldTemplate = <\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(\n props: FieldTemplateProps<T, S, F>,\n) => {\n const {\n id,\n children,\n classNames,\n style,\n disabled,\n displayLabel,\n hidden,\n label,\n onDropPropertyClick,\n onKeyChange,\n readonly,\n required,\n rawErrors = [],\n errors,\n help,\n rawDescription,\n schema,\n uiSchema,\n registry,\n } = props;\n\n const uiOptions = getUiOptions<T, S, F>(uiSchema);\n const WrapIfAdditionalTemplate = getTemplate<\n 'WrapIfAdditionalTemplate',\n T,\n S,\n F\n >('WrapIfAdditionalTemplate', registry, uiOptions);\n\n if (hidden) {\n return <div style={{ display: 'none' }}>{children}</div>;\n }\n return (\n <WrapIfAdditionalTemplate\n classNames={classNames}\n style={style}\n disabled={disabled}\n id={id}\n label={label}\n onDropPropertyClick={onDropPropertyClick}\n onKeyChange={onKeyChange}\n readonly={readonly}\n required={required}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n >\n <ScaffolderField\n displayLabel={displayLabel}\n rawErrors={rawErrors}\n help={help}\n disabled={disabled}\n rawDescription={rawDescription}\n errors={errors}\n required={required}\n >\n {children}\n </ScaffolderField>\n </WrapIfAdditionalTemplate>\n );\n};\n"],"names":[],"mappings":";;;;AA+Ba,MAAA,aAAA,GAAgB,CAK3B,KACG,KAAA;AACH,EAAM,MAAA;AAAA,IACJ,EAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAA;AAAA,IACA,YAAA;AAAA,IACA,MAAA;AAAA,IACA,KAAA;AAAA,IACA,mBAAA;AAAA,IACA,WAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACA,YAAY,EAAC;AAAA,IACb,MAAA;AAAA,IACA,IAAA;AAAA,IACA,cAAA;AAAA,IACA,MAAA;AAAA,IACA,QAAA;AAAA,IACA;AAAA,GACE,GAAA,KAAA;AAEJ,EAAM,MAAA,SAAA,GAAY,aAAsB,QAAQ,CAAA;AAChD,EAAA,MAAM,wBAA2B,GAAA,WAAA,CAK/B,0BAA4B,EAAA,QAAA,EAAU,SAAS,CAAA;AAEjD,EAAA,IAAI,MAAQ,EAAA;AACV,IAAA,2BAAQ,KAAI,EAAA,EAAA,KAAA,EAAO,EAAE,OAAS,EAAA,MAAA,IAAW,QAAS,EAAA,CAAA;AAAA;AAEpD,EACE,uBAAA,GAAA;AAAA,IAAC,wBAAA;AAAA,IAAA;AAAA,MACC,UAAA;AAAA,MACA,KAAA;AAAA,MACA,QAAA;AAAA,MACA,EAAA;AAAA,MACA,KAAA;AAAA,MACA,mBAAA;AAAA,MACA,WAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,MAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MAEA,QAAA,kBAAA,GAAA;AAAA,QAAC,eAAA;AAAA,QAAA;AAAA,UACC,YAAA;AAAA,UACA,SAAA;AAAA,UACA,IAAA;AAAA,UACA,QAAA;AAAA,UACA,cAAA;AAAA,UACA,MAAA;AAAA,UACA,QAAA;AAAA,UAEC;AAAA;AAAA;AACH;AAAA,GACF;AAEJ;;;;"}
1
+ {"version":3,"file":"FieldTemplate.esm.js","sources":["../../../../src/next/components/Form/FieldTemplate.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n FieldTemplateProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n getTemplate,\n getUiOptions,\n} from '@rjsf/utils';\n\nimport { ScaffolderField } from '../ScaffolderField';\n\n/** The `FieldTemplate` component is the template used by `SchemaField` to render any field. It renders the field\n * content, (label, description, children, errors and help) inside of a `WrapIfAdditional` component.\n * @alpha\n * @param props - The `FieldTemplateProps` for this component\n */\nexport const FieldTemplate = <\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(\n props: FieldTemplateProps<T, S, F>,\n) => {\n const {\n id,\n children,\n classNames,\n style,\n disabled,\n displayLabel,\n hidden,\n label,\n onDropPropertyClick,\n onKeyChange,\n readonly,\n required,\n rawErrors = [],\n errors,\n help,\n rawDescription,\n schema,\n uiSchema,\n registry,\n } = props;\n\n const uiOptions = getUiOptions<T, S, F>(uiSchema);\n const WrapIfAdditionalTemplate = getTemplate<\n 'WrapIfAdditionalTemplate',\n T,\n S,\n F\n >('WrapIfAdditionalTemplate', registry, uiOptions);\n\n if (hidden) {\n return <div style={{ display: 'none' }}>{children}</div>;\n }\n return (\n <WrapIfAdditionalTemplate\n classNames={classNames}\n style={style}\n disabled={disabled}\n id={id}\n label={label}\n onDropPropertyClick={onDropPropertyClick}\n onKeyChange={onKeyChange}\n readonly={readonly}\n required={required}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n >\n <ScaffolderField\n displayLabel={displayLabel}\n rawErrors={rawErrors}\n help={help}\n disabled={disabled}\n rawDescription={rawDescription}\n errors={errors}\n required={required}\n >\n {children}\n </ScaffolderField>\n </WrapIfAdditionalTemplate>\n );\n};\n"],"names":[],"mappings":";;;;AA+BO,MAAM,aAAA,GAAgB,CAK3B,KAAA,KACG;AACH,EAAA,MAAM;AAAA,IACJ,EAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAA;AAAA,IACA,YAAA;AAAA,IACA,MAAA;AAAA,IACA,KAAA;AAAA,IACA,mBAAA;AAAA,IACA,WAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACA,YAAY,EAAC;AAAA,IACb,MAAA;AAAA,IACA,IAAA;AAAA,IACA,cAAA;AAAA,IACA,MAAA;AAAA,IACA,QAAA;AAAA,IACA;AAAA,GACF,GAAI,KAAA;AAEJ,EAAA,MAAM,SAAA,GAAY,aAAsB,QAAQ,CAAA;AAChD,EAAA,MAAM,wBAAA,GAA2B,WAAA,CAK/B,0BAAA,EAA4B,QAAA,EAAU,SAAS,CAAA;AAEjD,EAAA,IAAI,MAAA,EAAQ;AACV,IAAA,2BAAQ,KAAA,EAAA,EAAI,KAAA,EAAO,EAAE,OAAA,EAAS,MAAA,IAAW,QAAA,EAAS,CAAA;AAAA,EACpD;AACA,EAAA,uBACE,GAAA;AAAA,IAAC,wBAAA;AAAA,IAAA;AAAA,MACC,UAAA;AAAA,MACA,KAAA;AAAA,MACA,QAAA;AAAA,MACA,EAAA;AAAA,MACA,KAAA;AAAA,MACA,mBAAA;AAAA,MACA,WAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,MAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MAEA,QAAA,kBAAA,GAAA;AAAA,QAAC,eAAA;AAAA,QAAA;AAAA,UACC,YAAA;AAAA,UACA,SAAA;AAAA,UACA,IAAA;AAAA,UACA,QAAA;AAAA,UACA,cAAA;AAAA,UACA,MAAA;AAAA,UACA,QAAA;AAAA,UAEC;AAAA;AAAA;AACH;AAAA,GACF;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Form.esm.js","sources":["../../../../src/next/components/Form/Form.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { withTheme } from '@rjsf/core';\nimport { useMemo, PropsWithChildren } from 'react';\nimport { FieldTemplate } from './FieldTemplate';\nimport { DescriptionFieldTemplate } from './DescriptionFieldTemplate';\nimport { FieldProps } from '@rjsf/utils';\nimport { ScaffolderRJSFFormProps } from '@backstage/plugin-scaffolder-react';\nimport { Theme as MuiTheme } from '@rjsf/material-ui';\n\nconst WrappedForm = withTheme(MuiTheme);\n\n/**\n * The Form component\n * @alpha\n */\nexport const Form = (props: PropsWithChildren<ScaffolderRJSFFormProps>) => {\n // This is where we unbreak the changes from RJSF, and make it work with our custom fields so we don't pass on this\n // breaking change to our users. We will look more into a better API for this in scaffolderv2.\n const wrappedFields = useMemo(\n () =>\n Object.fromEntries(\n Object.entries(props.fields ?? {}).map(([key, Component]) => [\n key,\n (wrapperProps: FieldProps) => {\n return (\n <Component\n {...wrapperProps}\n uiSchema={wrapperProps.uiSchema ?? {}}\n formData={wrapperProps.formData}\n rawErrors={wrapperProps.rawErrors ?? []}\n disabled={wrapperProps.disabled ?? false}\n readonly={wrapperProps.readonly ?? false}\n />\n );\n },\n ]),\n ),\n [props.fields],\n );\n\n const templates = useMemo(\n () => ({\n FieldTemplate,\n DescriptionFieldTemplate,\n ...props.templates,\n }),\n [props.templates],\n );\n\n return (\n <WrappedForm {...props} templates={templates} fields={wrappedFields} />\n );\n};\n"],"names":["MuiTheme"],"mappings":";;;;;;;AAwBA,MAAM,WAAA,GAAc,UAAUA,KAAQ,CAAA;AAMzB,MAAA,IAAA,GAAO,CAAC,KAAsD,KAAA;AAGzE,EAAA,MAAM,aAAgB,GAAA,OAAA;AAAA,IACpB,MACE,MAAO,CAAA,WAAA;AAAA,MACL,MAAO,CAAA,OAAA,CAAQ,KAAM,CAAA,MAAA,IAAU,EAAE,CAAE,CAAA,GAAA,CAAI,CAAC,CAAC,GAAK,EAAA,SAAS,CAAM,KAAA;AAAA,QAC3D,GAAA;AAAA,QACA,CAAC,YAA6B,KAAA;AAC5B,UACE,uBAAA,GAAA;AAAA,YAAC,SAAA;AAAA,YAAA;AAAA,cACE,GAAG,YAAA;AAAA,cACJ,QAAA,EAAU,YAAa,CAAA,QAAA,IAAY,EAAC;AAAA,cACpC,UAAU,YAAa,CAAA,QAAA;AAAA,cACvB,SAAA,EAAW,YAAa,CAAA,SAAA,IAAa,EAAC;AAAA,cACtC,QAAA,EAAU,aAAa,QAAY,IAAA,KAAA;AAAA,cACnC,QAAA,EAAU,aAAa,QAAY,IAAA;AAAA;AAAA,WACrC;AAAA;AAEJ,OACD;AAAA,KACH;AAAA,IACF,CAAC,MAAM,MAAM;AAAA,GACf;AAEA,EAAA,MAAM,SAAY,GAAA,OAAA;AAAA,IAChB,OAAO;AAAA,MACL,aAAA;AAAA,MACA,wBAAA;AAAA,MACA,GAAG,KAAM,CAAA;AAAA,KACX,CAAA;AAAA,IACA,CAAC,MAAM,SAAS;AAAA,GAClB;AAEA,EAAA,2BACG,WAAa,EAAA,EAAA,GAAG,KAAO,EAAA,SAAA,EAAsB,QAAQ,aAAe,EAAA,CAAA;AAEzE;;;;"}
1
+ {"version":3,"file":"Form.esm.js","sources":["../../../../src/next/components/Form/Form.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { withTheme } from '@rjsf/core';\nimport { useMemo, PropsWithChildren } from 'react';\nimport { FieldTemplate } from './FieldTemplate';\nimport { DescriptionFieldTemplate } from './DescriptionFieldTemplate';\nimport { FieldProps } from '@rjsf/utils';\nimport { ScaffolderRJSFFormProps } from '@backstage/plugin-scaffolder-react';\nimport { Theme as MuiTheme } from '@rjsf/material-ui';\n\nconst WrappedForm = withTheme(MuiTheme);\n\n/**\n * The Form component\n * @alpha\n */\nexport const Form = (props: PropsWithChildren<ScaffolderRJSFFormProps>) => {\n // This is where we unbreak the changes from RJSF, and make it work with our custom fields so we don't pass on this\n // breaking change to our users. We will look more into a better API for this in scaffolderv2.\n const wrappedFields = useMemo(\n () =>\n Object.fromEntries(\n Object.entries(props.fields ?? {}).map(([key, Component]) => [\n key,\n (wrapperProps: FieldProps) => {\n return (\n <Component\n {...wrapperProps}\n uiSchema={wrapperProps.uiSchema ?? {}}\n formData={wrapperProps.formData}\n rawErrors={wrapperProps.rawErrors ?? []}\n disabled={wrapperProps.disabled ?? false}\n readonly={wrapperProps.readonly ?? false}\n />\n );\n },\n ]),\n ),\n [props.fields],\n );\n\n const templates = useMemo(\n () => ({\n FieldTemplate,\n DescriptionFieldTemplate,\n ...props.templates,\n }),\n [props.templates],\n );\n\n return (\n <WrappedForm {...props} templates={templates} fields={wrappedFields} />\n );\n};\n"],"names":["MuiTheme"],"mappings":";;;;;;;AAwBA,MAAM,WAAA,GAAc,UAAUA,KAAQ,CAAA;AAM/B,MAAM,IAAA,GAAO,CAAC,KAAA,KAAsD;AAGzE,EAAA,MAAM,aAAA,GAAgB,OAAA;AAAA,IACpB,MACE,MAAA,CAAO,WAAA;AAAA,MACL,MAAA,CAAO,OAAA,CAAQ,KAAA,CAAM,MAAA,IAAU,EAAE,CAAA,CAAE,GAAA,CAAI,CAAC,CAAC,GAAA,EAAK,SAAS,CAAA,KAAM;AAAA,QAC3D,GAAA;AAAA,QACA,CAAC,YAAA,KAA6B;AAC5B,UAAA,uBACE,GAAA;AAAA,YAAC,SAAA;AAAA,YAAA;AAAA,cACE,GAAG,YAAA;AAAA,cACJ,QAAA,EAAU,YAAA,CAAa,QAAA,IAAY,EAAC;AAAA,cACpC,UAAU,YAAA,CAAa,QAAA;AAAA,cACvB,SAAA,EAAW,YAAA,CAAa,SAAA,IAAa,EAAC;AAAA,cACtC,QAAA,EAAU,aAAa,QAAA,IAAY,KAAA;AAAA,cACnC,QAAA,EAAU,aAAa,QAAA,IAAY;AAAA;AAAA,WACrC;AAAA,QAEJ;AAAA,OACD;AAAA,KACH;AAAA,IACF,CAAC,MAAM,MAAM;AAAA,GACf;AAEA,EAAA,MAAM,SAAA,GAAY,OAAA;AAAA,IAChB,OAAO;AAAA,MACL,aAAA;AAAA,MACA,wBAAA;AAAA,MACA,GAAG,KAAA,CAAM;AAAA,KACX,CAAA;AAAA,IACA,CAAC,MAAM,SAAS;AAAA,GAClB;AAEA,EAAA,2BACG,WAAA,EAAA,EAAa,GAAG,KAAA,EAAO,SAAA,EAAsB,QAAQ,aAAA,EAAe,CAAA;AAEzE;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PasswordWidget.esm.js","sources":["../../../../src/next/components/PasswordWidget/PasswordWidget.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MarkdownContent } from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport TextField from '@material-ui/core/TextField';\nimport { WidgetProps } from '@rjsf/utils';\n\nimport { scaffolderReactTranslationRef } from '../../../translation';\n\nexport const PasswordWidget = (\n props: Pick<WidgetProps, 'onChange' | 'schema' | 'value'>,\n) => {\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n\n const {\n value,\n onChange,\n schema: { title },\n } = props;\n\n return (\n <>\n <TextField\n id={title}\n label={title}\n aria-describedby={title}\n onChange={e => {\n onChange(e.target.value);\n }}\n value={value}\n autoComplete=\"off\"\n />\n <FormHelperText error>\n <MarkdownContent content={t('passwordWidget.content')} />\n </FormHelperText>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAwBa,MAAA,cAAA,GAAiB,CAC5B,KACG,KAAA;AACH,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,6BAA6B,CAAA;AAE7D,EAAM,MAAA;AAAA,IACJ,KAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA,EAAQ,EAAE,KAAM;AAAA,GACd,GAAA,KAAA;AAEJ,EAAA,uBAEI,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,SAAA;AAAA,MAAA;AAAA,QACC,EAAI,EAAA,KAAA;AAAA,QACJ,KAAO,EAAA,KAAA;AAAA,QACP,kBAAkB,EAAA,KAAA;AAAA,QAClB,UAAU,CAAK,CAAA,KAAA;AACb,UAAS,QAAA,CAAA,CAAA,CAAE,OAAO,KAAK,CAAA;AAAA,SACzB;AAAA,QACA,KAAA;AAAA,QACA,YAAa,EAAA;AAAA;AAAA,KACf;AAAA,oBACA,GAAA,CAAC,cAAe,EAAA,EAAA,KAAA,EAAK,IACnB,EAAA,QAAA,kBAAA,GAAA,CAAC,mBAAgB,OAAS,EAAA,CAAA,CAAE,wBAAwB,CAAA,EAAG,CACzD,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"PasswordWidget.esm.js","sources":["../../../../src/next/components/PasswordWidget/PasswordWidget.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MarkdownContent } from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport TextField from '@material-ui/core/TextField';\nimport { WidgetProps } from '@rjsf/utils';\n\nimport { scaffolderReactTranslationRef } from '../../../translation';\n\nexport const PasswordWidget = (\n props: Pick<WidgetProps, 'onChange' | 'schema' | 'value'>,\n) => {\n const { t } = useTranslationRef(scaffolderReactTranslationRef);\n\n const {\n value,\n onChange,\n schema: { title },\n } = props;\n\n return (\n <>\n <TextField\n id={title}\n label={title}\n aria-describedby={title}\n onChange={e => {\n onChange(e.target.value);\n }}\n value={value}\n autoComplete=\"off\"\n />\n <FormHelperText error>\n <MarkdownContent content={t('passwordWidget.content')} />\n </FormHelperText>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAwBO,MAAM,cAAA,GAAiB,CAC5B,KAAA,KACG;AACH,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,6BAA6B,CAAA;AAE7D,EAAA,MAAM;AAAA,IACJ,KAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA,EAAQ,EAAE,KAAA;AAAM,GAClB,GAAI,KAAA;AAEJ,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,SAAA;AAAA,MAAA;AAAA,QACC,EAAA,EAAI,KAAA;AAAA,QACJ,KAAA,EAAO,KAAA;AAAA,QACP,kBAAA,EAAkB,KAAA;AAAA,QAClB,UAAU,CAAA,CAAA,KAAK;AACb,UAAA,QAAA,CAAS,CAAA,CAAE,OAAO,KAAK,CAAA;AAAA,QACzB,CAAA;AAAA,QACA,KAAA;AAAA,QACA,YAAA,EAAa;AAAA;AAAA,KACf;AAAA,oBACA,GAAA,CAAC,cAAA,EAAA,EAAe,KAAA,EAAK,IAAA,EACnB,QAAA,kBAAA,GAAA,CAAC,mBAAgB,OAAA,EAAS,CAAA,CAAE,wBAAwB,CAAA,EAAG,CAAA,EACzD;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { StructuredMetadataTable } from '@backstage/core-components';
3
3
  import { Draft07 } from 'json-schema-library';
4
- import { findSchemaForKey, isJsonObject, formatKey } from './util.esm.js';
4
+ import { findSchemaForKey, formatKey, isJsonObject } from './util.esm.js';
5
5
 
6
6
  function processSchema(key, value, schema, formState) {
7
7
  const parsedSchema = new Draft07(schema.mergedSchema);
@@ -1 +1 @@
1
- {"version":3,"file":"ReviewState.esm.js","sources":["../../../../src/next/components/ReviewState/ReviewState.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { StructuredMetadataTable } from '@backstage/core-components';\nimport { JsonObject, JsonValue } from '@backstage/types';\nimport { Draft07 as JSONSchema } from 'json-schema-library';\nimport { ParsedTemplateSchema } from '../../hooks/useTemplateSchema';\nimport { isJsonObject, formatKey, findSchemaForKey } from './util';\n\n/**\n * The props for the {@link ReviewState} component.\n * @alpha\n */\nexport type ReviewStateProps = {\n schemas: ParsedTemplateSchema[];\n formState: JsonObject;\n};\n\nfunction processSchema(\n key: string,\n value: JsonValue | undefined,\n schema: ParsedTemplateSchema,\n formState: JsonObject,\n): [string, JsonValue | undefined][] {\n const parsedSchema = new JSONSchema(schema.mergedSchema);\n const definitionInSchema = parsedSchema.getSchema({\n pointer: `#/${key}`,\n data: formState,\n });\n\n const name =\n definitionInSchema?.['ui:backstage']?.review?.name ??\n definitionInSchema?.title ??\n key;\n\n if (definitionInSchema) {\n const backstageReviewOptions = definitionInSchema['ui:backstage']?.review;\n if (backstageReviewOptions) {\n if (backstageReviewOptions.mask) {\n return [[name, backstageReviewOptions.mask]];\n }\n if (backstageReviewOptions.show === false) {\n return [];\n }\n }\n\n if (\n definitionInSchema['ui:widget'] === 'password' ||\n definitionInSchema['ui:field']?.toLocaleLowerCase('en-us') === 'secret'\n ) {\n return [[name, '******']];\n }\n\n if (definitionInSchema.enum && definitionInSchema.enumNames) {\n return [\n [\n name,\n definitionInSchema.enumNames[\n definitionInSchema.enum.indexOf(value)\n ] || value,\n ],\n ];\n }\n\n if (backstageReviewOptions?.explode !== false && isJsonObject(value)) {\n // Recurse nested objects\n return Object.entries(value).flatMap(([nestedKey, nestedValue]) =>\n processSchema(`${key}/${nestedKey}`, nestedValue, schema, formState),\n );\n }\n }\n\n return [[name, value]];\n}\n\n/**\n * The component used by the {@link Stepper} to render the review step.\n * @alpha\n */\nexport const ReviewState = (props: ReviewStateProps) => {\n const reviewData = Object.fromEntries(\n Object.entries(props.formState)\n .flatMap(([key, value]) => {\n const schema = findSchemaForKey(key, props.schemas, props.formState);\n return schema\n ? processSchema(key, value, schema, props.formState)\n : [[key, value]];\n })\n .filter(prop => prop.length > 0),\n );\n const options = {\n titleFormat: formatKey,\n };\n return <StructuredMetadataTable metadata={reviewData} options={options} />;\n};\n"],"names":["JSONSchema"],"mappings":";;;;;AA8BA,SAAS,aACP,CAAA,GAAA,EACA,KACA,EAAA,MAAA,EACA,SACmC,EAAA;AACnC,EAAA,MAAM,YAAe,GAAA,IAAIA,OAAW,CAAA,MAAA,CAAO,YAAY,CAAA;AACvD,EAAM,MAAA,kBAAA,GAAqB,aAAa,SAAU,CAAA;AAAA,IAChD,OAAA,EAAS,KAAK,GAAG,CAAA,CAAA;AAAA,IACjB,IAAM,EAAA;AAAA,GACP,CAAA;AAED,EAAA,MAAM,OACJ,kBAAqB,GAAA,cAAc,GAAG,MAAQ,EAAA,IAAA,IAC9C,oBAAoB,KACpB,IAAA,GAAA;AAEF,EAAA,IAAI,kBAAoB,EAAA;AACtB,IAAM,MAAA,sBAAA,GAAyB,kBAAmB,CAAA,cAAc,CAAG,EAAA,MAAA;AACnE,IAAA,IAAI,sBAAwB,EAAA;AAC1B,MAAA,IAAI,uBAAuB,IAAM,EAAA;AAC/B,QAAA,OAAO,CAAC,CAAC,IAAM,EAAA,sBAAA,CAAuB,IAAI,CAAC,CAAA;AAAA;AAE7C,MAAI,IAAA,sBAAA,CAAuB,SAAS,KAAO,EAAA;AACzC,QAAA,OAAO,EAAC;AAAA;AACV;AAGF,IACE,IAAA,kBAAA,CAAmB,WAAW,CAAA,KAAM,UACpC,IAAA,kBAAA,CAAmB,UAAU,CAAG,EAAA,iBAAA,CAAkB,OAAO,CAAA,KAAM,QAC/D,EAAA;AACA,MAAA,OAAO,CAAC,CAAC,IAAM,EAAA,QAAQ,CAAC,CAAA;AAAA;AAG1B,IAAI,IAAA,kBAAA,CAAmB,IAAQ,IAAA,kBAAA,CAAmB,SAAW,EAAA;AAC3D,MAAO,OAAA;AAAA,QACL;AAAA,UACE,IAAA;AAAA,UACA,mBAAmB,SACjB,CAAA,kBAAA,CAAmB,KAAK,OAAQ,CAAA,KAAK,CACvC,CAAK,IAAA;AAAA;AACP,OACF;AAAA;AAGF,IAAA,IAAI,sBAAwB,EAAA,OAAA,KAAY,KAAS,IAAA,YAAA,CAAa,KAAK,CAAG,EAAA;AAEpE,MAAO,OAAA,MAAA,CAAO,OAAQ,CAAA,KAAK,CAAE,CAAA,OAAA;AAAA,QAAQ,CAAC,CAAC,SAAW,EAAA,WAAW,CAC3D,KAAA,aAAA,CAAc,CAAG,EAAA,GAAG,CAAI,CAAA,EAAA,SAAS,CAAI,CAAA,EAAA,WAAA,EAAa,QAAQ,SAAS;AAAA,OACrE;AAAA;AACF;AAGF,EAAA,OAAO,CAAC,CAAC,IAAM,EAAA,KAAK,CAAC,CAAA;AACvB;AAMa,MAAA,WAAA,GAAc,CAAC,KAA4B,KAAA;AACtD,EAAA,MAAM,aAAa,MAAO,CAAA,WAAA;AAAA,IACxB,MAAA,CAAO,OAAQ,CAAA,KAAA,CAAM,SAAS,CAAA,CAC3B,QAAQ,CAAC,CAAC,GAAK,EAAA,KAAK,CAAM,KAAA;AACzB,MAAA,MAAM,SAAS,gBAAiB,CAAA,GAAA,EAAK,KAAM,CAAA,OAAA,EAAS,MAAM,SAAS,CAAA;AACnE,MAAA,OAAO,MACH,GAAA,aAAA,CAAc,GAAK,EAAA,KAAA,EAAO,MAAQ,EAAA,KAAA,CAAM,SAAS,CAAA,GACjD,CAAC,CAAC,GAAK,EAAA,KAAK,CAAC,CAAA;AAAA,KAClB,CACA,CAAA,MAAA,CAAO,CAAQ,IAAA,KAAA,IAAA,CAAK,SAAS,CAAC;AAAA,GACnC;AACA,EAAA,MAAM,OAAU,GAAA;AAAA,IACd,WAAa,EAAA;AAAA,GACf;AACA,EAAA,uBAAQ,GAAA,CAAA,uBAAA,EAAA,EAAwB,QAAU,EAAA,UAAA,EAAY,OAAkB,EAAA,CAAA;AAC1E;;;;"}
1
+ {"version":3,"file":"ReviewState.esm.js","sources":["../../../../src/next/components/ReviewState/ReviewState.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { StructuredMetadataTable } from '@backstage/core-components';\nimport { JsonObject, JsonValue } from '@backstage/types';\nimport { Draft07 as JSONSchema } from 'json-schema-library';\nimport { ParsedTemplateSchema } from '../../hooks/useTemplateSchema';\nimport { isJsonObject, formatKey, findSchemaForKey } from './util';\n\n/**\n * The props for the {@link ReviewState} component.\n * @alpha\n */\nexport type ReviewStateProps = {\n schemas: ParsedTemplateSchema[];\n formState: JsonObject;\n};\n\nfunction processSchema(\n key: string,\n value: JsonValue | undefined,\n schema: ParsedTemplateSchema,\n formState: JsonObject,\n): [string, JsonValue | undefined][] {\n const parsedSchema = new JSONSchema(schema.mergedSchema);\n const definitionInSchema = parsedSchema.getSchema({\n pointer: `#/${key}`,\n data: formState,\n });\n\n const name =\n definitionInSchema?.['ui:backstage']?.review?.name ??\n definitionInSchema?.title ??\n key;\n\n if (definitionInSchema) {\n const backstageReviewOptions = definitionInSchema['ui:backstage']?.review;\n if (backstageReviewOptions) {\n if (backstageReviewOptions.mask) {\n return [[name, backstageReviewOptions.mask]];\n }\n if (backstageReviewOptions.show === false) {\n return [];\n }\n }\n\n if (\n definitionInSchema['ui:widget'] === 'password' ||\n definitionInSchema['ui:field']?.toLocaleLowerCase('en-us') === 'secret'\n ) {\n return [[name, '******']];\n }\n\n if (definitionInSchema.enum && definitionInSchema.enumNames) {\n return [\n [\n name,\n definitionInSchema.enumNames[\n definitionInSchema.enum.indexOf(value)\n ] || value,\n ],\n ];\n }\n\n if (backstageReviewOptions?.explode !== false && isJsonObject(value)) {\n // Recurse nested objects\n return Object.entries(value).flatMap(([nestedKey, nestedValue]) =>\n processSchema(`${key}/${nestedKey}`, nestedValue, schema, formState),\n );\n }\n }\n\n return [[name, value]];\n}\n\n/**\n * The component used by the {@link Stepper} to render the review step.\n * @alpha\n */\nexport const ReviewState = (props: ReviewStateProps) => {\n const reviewData = Object.fromEntries(\n Object.entries(props.formState)\n .flatMap(([key, value]) => {\n const schema = findSchemaForKey(key, props.schemas, props.formState);\n return schema\n ? processSchema(key, value, schema, props.formState)\n : [[key, value]];\n })\n .filter(prop => prop.length > 0),\n );\n const options = {\n titleFormat: formatKey,\n };\n return <StructuredMetadataTable metadata={reviewData} options={options} />;\n};\n"],"names":["JSONSchema"],"mappings":";;;;;AA8BA,SAAS,aAAA,CACP,GAAA,EACA,KAAA,EACA,MAAA,EACA,SAAA,EACmC;AACnC,EAAA,MAAM,YAAA,GAAe,IAAIA,OAAA,CAAW,MAAA,CAAO,YAAY,CAAA;AACvD,EAAA,MAAM,kBAAA,GAAqB,aAAa,SAAA,CAAU;AAAA,IAChD,OAAA,EAAS,KAAK,GAAG,CAAA,CAAA;AAAA,IACjB,IAAA,EAAM;AAAA,GACP,CAAA;AAED,EAAA,MAAM,OACJ,kBAAA,GAAqB,cAAc,GAAG,MAAA,EAAQ,IAAA,IAC9C,oBAAoB,KAAA,IACpB,GAAA;AAEF,EAAA,IAAI,kBAAA,EAAoB;AACtB,IAAA,MAAM,sBAAA,GAAyB,kBAAA,CAAmB,cAAc,CAAA,EAAG,MAAA;AACnE,IAAA,IAAI,sBAAA,EAAwB;AAC1B,MAAA,IAAI,uBAAuB,IAAA,EAAM;AAC/B,QAAA,OAAO,CAAC,CAAC,IAAA,EAAM,sBAAA,CAAuB,IAAI,CAAC,CAAA;AAAA,MAC7C;AACA,MAAA,IAAI,sBAAA,CAAuB,SAAS,KAAA,EAAO;AACzC,QAAA,OAAO,EAAC;AAAA,MACV;AAAA,IACF;AAEA,IAAA,IACE,kBAAA,CAAmB,WAAW,CAAA,KAAM,UAAA,IACpC,kBAAA,CAAmB,UAAU,CAAA,EAAG,iBAAA,CAAkB,OAAO,CAAA,KAAM,QAAA,EAC/D;AACA,MAAA,OAAO,CAAC,CAAC,IAAA,EAAM,QAAQ,CAAC,CAAA;AAAA,IAC1B;AAEA,IAAA,IAAI,kBAAA,CAAmB,IAAA,IAAQ,kBAAA,CAAmB,SAAA,EAAW;AAC3D,MAAA,OAAO;AAAA,QACL;AAAA,UACE,IAAA;AAAA,UACA,mBAAmB,SAAA,CACjB,kBAAA,CAAmB,KAAK,OAAA,CAAQ,KAAK,CACvC,CAAA,IAAK;AAAA;AACP,OACF;AAAA,IACF;AAEA,IAAA,IAAI,sBAAA,EAAwB,OAAA,KAAY,KAAA,IAAS,YAAA,CAAa,KAAK,CAAA,EAAG;AAEpE,MAAA,OAAO,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAA,CAAE,OAAA;AAAA,QAAQ,CAAC,CAAC,SAAA,EAAW,WAAW,CAAA,KAC3D,aAAA,CAAc,CAAA,EAAG,GAAG,CAAA,CAAA,EAAI,SAAS,CAAA,CAAA,EAAI,WAAA,EAAa,QAAQ,SAAS;AAAA,OACrE;AAAA,IACF;AAAA,EACF;AAEA,EAAA,OAAO,CAAC,CAAC,IAAA,EAAM,KAAK,CAAC,CAAA;AACvB;AAMO,MAAM,WAAA,GAAc,CAAC,KAAA,KAA4B;AACtD,EAAA,MAAM,aAAa,MAAA,CAAO,WAAA;AAAA,IACxB,MAAA,CAAO,OAAA,CAAQ,KAAA,CAAM,SAAS,CAAA,CAC3B,QAAQ,CAAC,CAAC,GAAA,EAAK,KAAK,CAAA,KAAM;AACzB,MAAA,MAAM,SAAS,gBAAA,CAAiB,GAAA,EAAK,KAAA,CAAM,OAAA,EAAS,MAAM,SAAS,CAAA;AACnE,MAAA,OAAO,MAAA,GACH,aAAA,CAAc,GAAA,EAAK,KAAA,EAAO,MAAA,EAAQ,KAAA,CAAM,SAAS,CAAA,GACjD,CAAC,CAAC,GAAA,EAAK,KAAK,CAAC,CAAA;AAAA,IACnB,CAAC,CAAA,CACA,MAAA,CAAO,CAAA,IAAA,KAAQ,IAAA,CAAK,SAAS,CAAC;AAAA,GACnC;AACA,EAAA,MAAM,OAAA,GAAU;AAAA,IACd,WAAA,EAAa;AAAA,GACf;AACA,EAAA,uBAAO,GAAA,CAAC,uBAAA,EAAA,EAAwB,QAAA,EAAU,UAAA,EAAY,OAAA,EAAkB,CAAA;AAC1E;;;;"}