@webiny/app-admin 6.6.0-alpha.0 → 6.6.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/base/Admin.js +34 -2
- package/base/Admin.js.map +1 -1
- package/base/Base/DefaultFieldRenderers.js +21 -2
- package/base/Base/DefaultFieldRenderers.js.map +1 -1
- package/base/Base/FieldRenderers/AutoCompleteRenderer.d.ts +13 -0
- package/base/Base/FieldRenderers/AutoCompleteRenderer.js +30 -0
- package/base/Base/FieldRenderers/AutoCompleteRenderer.js.map +1 -0
- package/base/Base/FieldRenderers/BirthdayInputRenderer.d.ts +21 -0
- package/base/Base/FieldRenderers/BirthdayInputRenderer.js +39 -0
- package/base/Base/FieldRenderers/BirthdayInputRenderer.js.map +1 -0
- package/base/Base/FieldRenderers/BirthdayInputRenderer.test.d.ts +1 -0
- package/base/Base/FieldRenderers/BirthdayInputRenderer.test.js +123 -0
- package/base/Base/FieldRenderers/BirthdayInputRenderer.test.js.map +1 -0
- package/base/Base/FieldRenderers/HorizontalTabsRenderer.d.ts +2 -2
- package/base/Base/FieldRenderers/LexicalRenderer.js +10 -6
- package/base/Base/FieldRenderers/LexicalRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/MultiFilePickerRenderer.js +8 -5
- package/base/Base/FieldRenderers/MultiFilePickerRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/MultiSelectRenderer.d.ts +15 -0
- package/base/Base/FieldRenderers/MultiSelectRenderer.js +31 -0
- package/base/Base/FieldRenderers/MultiSelectRenderer.js.map +1 -0
- package/base/Base/FieldRenderers/ObjectRenderer/DynamicZoneRenderer.d.ts +2 -0
- package/base/Base/FieldRenderers/ObjectRenderer/DynamicZoneRenderer.js +5 -2
- package/base/Base/FieldRenderers/ObjectRenderer/DynamicZoneRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/MultiValueDynamicZone.d.ts +11 -0
- package/base/Base/FieldRenderers/ObjectRenderer/{MultiValueDynamicZone.js → MultiValueDynamicZone/MultiValueDynamicZone.js} +83 -15
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/MultiValueDynamicZone.js.map +1 -0
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/MultiValueDynamicZonePresenter.d.ts +13 -0
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/MultiValueDynamicZonePresenter.js +28 -0
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/MultiValueDynamicZonePresenter.js.map +1 -0
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/abstractions.d.ts +15 -0
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/abstractions.js +5 -0
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/abstractions.js.map +1 -0
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/feature.d.ts +1 -0
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/feature.js +11 -0
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/feature.js.map +1 -0
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/index.d.ts +2 -0
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/index.js +2 -0
- package/base/Base/FieldRenderers/ObjectRenderer/ObjectAccordionMultipleRenderer.d.ts +1 -1
- package/base/Base/FieldRenderers/ObjectRenderer/ObjectAccordionMultipleRenderer.js +29 -4
- package/base/Base/FieldRenderers/ObjectRenderer/ObjectAccordionMultipleRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/ObjectRenderer/ObjectFieldComponents.d.ts +12 -8
- package/base/Base/FieldRenderers/ObjectRenderer/ObjectFieldComponents.js +48 -8
- package/base/Base/FieldRenderers/ObjectRenderer/ObjectFieldComponents.js.map +1 -1
- package/base/Base/FieldRenderers/ObjectRenderer/ObjectRenderer.js +16 -25
- package/base/Base/FieldRenderers/ObjectRenderer/ObjectRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/ObjectRenderer/SingleValueDynamicZone.d.ts +3 -2
- package/base/Base/FieldRenderers/ObjectRenderer/SingleValueDynamicZone.js +29 -8
- package/base/Base/FieldRenderers/ObjectRenderer/SingleValueDynamicZone.js.map +1 -1
- package/base/Base/FieldRenderers/ObjectRenderer/{TemplatePicker.d.ts → TemplatePicker/AddTemplateButton.d.ts} +1 -1
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker/AddTemplateButton.js +24 -0
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker/AddTemplateButton.js.map +1 -0
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker/SelectableTemplate.d.ts +13 -0
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker/SelectableTemplate.js +21 -0
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker/SelectableTemplate.js.map +1 -0
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker/TemplateCard.d.ts +3 -0
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker/TemplateCard.js +35 -0
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker/TemplateCard.js.map +1 -0
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker/TemplateGallery.d.ts +8 -0
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker/TemplateGallery.js +22 -0
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker/TemplateGallery.js.map +1 -0
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker/TemplateGalleryToolbar.d.ts +10 -0
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker/TemplateGalleryToolbar.js +52 -0
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker/TemplateGalleryToolbar.js.map +1 -0
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker/TemplateIcon.d.ts +8 -0
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker/TemplateIcon.js +16 -0
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker/TemplateIcon.js.map +1 -0
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker/TemplateList.d.ts +10 -0
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker/TemplateList.js +22 -0
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker/TemplateList.js.map +1 -0
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker/TemplateListItem.d.ts +3 -0
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker/TemplateListItem.js +35 -0
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker/TemplateListItem.js.map +1 -0
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker/index.d.ts +1 -0
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker/index.js +1 -0
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker/types.d.ts +6 -0
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker/types.js +0 -0
- package/base/Base/FieldRenderers/ObjectRenderer/resolveItemTitle.d.ts +8 -3
- package/base/Base/FieldRenderers/ObjectRenderer/resolveItemTitle.js +25 -17
- package/base/Base/FieldRenderers/ObjectRenderer/resolveItemTitle.js.map +1 -1
- package/base/Base/FieldRenderers/ObjectRenderer/resolveItemTitle.test.d.ts +1 -0
- package/base/Base/FieldRenderers/ObjectRenderer/resolveItemTitle.test.js +106 -0
- package/base/Base/FieldRenderers/ObjectRenderer/resolveItemTitle.test.js.map +1 -0
- package/base/Base/FieldRenderers/RadioButtonsRenderer.js +3 -2
- package/base/Base/FieldRenderers/RadioButtonsRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/SelectRenderer.d.ts +6 -0
- package/base/Base/FieldRenderers/SelectRenderer.js +4 -2
- package/base/Base/FieldRenderers/SelectRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/VerticalTabsRenderer.d.ts +2 -2
- package/base/Base/Menus.js +4 -4
- package/base/Base/Menus.js.map +1 -1
- package/base/Base.js +2 -1
- package/base/Base.js.map +1 -1
- package/base/createRootContainer.js +8 -2
- package/base/createRootContainer.js.map +1 -1
- package/base/resolveApiUrl.d.ts +10 -0
- package/base/resolveApiUrl.js +11 -3
- package/base/resolveApiUrl.js.map +1 -1
- package/base/ui/AssumedPermissionsSelector.d.ts +47 -0
- package/base/ui/AssumedPermissionsSelector.js +7 -0
- package/base/ui/AssumedPermissionsSelector.js.map +1 -0
- package/base/ui/DebuggerIndicator.d.ts +23 -0
- package/base/ui/DebuggerIndicator.js +5 -0
- package/base/ui/DebuggerIndicator.js.map +1 -0
- package/base/ui/Layout.d.ts +20 -0
- package/base/ui/Layout.js +2 -1
- package/base/ui/Layout.js.map +1 -1
- package/components/DeveloperMode/DeveloperMode.d.ts +1 -3
- package/components/DeveloperMode/DeveloperMode.js.map +1 -1
- package/components/Drawers/DrawerParamsContext.d.ts +6 -0
- package/components/Drawers/DrawerParamsContext.js +10 -0
- package/components/Drawers/DrawerParamsContext.js.map +1 -0
- package/components/Drawers/DrawersContext.d.ts +13 -0
- package/components/Drawers/DrawersContext.js +50 -0
- package/components/Drawers/DrawersContext.js.map +1 -0
- package/components/Drawers/useDrawers.d.ts +2 -0
- package/components/Drawers/useDrawers.js +10 -0
- package/components/Drawers/useDrawers.js.map +1 -0
- package/components/Filters/Filters.js +10 -3
- package/components/Filters/Filters.js.map +1 -1
- package/components/IconPicker/IconPickerComponent.d.ts +2 -2
- package/components/IconPicker/IconPickerComponent.js +1 -1
- package/components/IconPicker/IconPickerComponent.js.map +1 -1
- package/components/LexicalEditor/LexicalLinkForm.js +3 -0
- package/components/LexicalEditor/LexicalLinkForm.js.map +1 -1
- package/components/ListView/ListViewBulkActions.d.ts +2 -2
- package/components/ListView/ListViewContent.d.ts +2 -2
- package/components/ListView/ListViewFilters.d.ts +2 -2
- package/components/ListView/index.d.ts +6 -6
- package/components/OverlayLayout/OverlayLayout.js +4 -2
- package/components/OverlayLayout/OverlayLayout.js.map +1 -1
- package/components/OverlayLayout/components/OverlayContent.js +1 -0
- package/components/OverlayLayout/components/OverlayContent.js.map +1 -1
- package/components/RolesMultiAutocomplete/index.d.ts +4 -2
- package/components/SplitView/SplitView.d.ts +2 -2
- package/components/SplitView/SplitView.js +8 -8
- package/components/SplitView/SplitView.js.map +1 -1
- package/components/Table/components/Table/TableInner.d.ts +2 -2
- package/components/TeamAutocomplete/index.d.ts +4 -2
- package/components/TeamsMultiAutocomplete/index.d.ts +4 -2
- package/components/index.d.ts +0 -1
- package/components/index.js +0 -1
- package/config/AdminConfig/Breadcrumbs.d.ts +42 -0
- package/config/AdminConfig/Breadcrumbs.js +24 -0
- package/config/AdminConfig/Breadcrumbs.js.map +1 -0
- package/config/AdminConfig/Drawer.d.ts +10 -0
- package/config/AdminConfig/Drawer.js +19 -0
- package/config/AdminConfig/Drawer.js.map +1 -0
- package/config/AdminConfig/LexicalTheme/AllowCustomColors.d.ts +5 -0
- package/config/AdminConfig/LexicalTheme/AllowCustomColors.js +18 -0
- package/config/AdminConfig/LexicalTheme/AllowCustomColors.js.map +1 -0
- package/config/AdminConfig/LexicalTheme.d.ts +2 -0
- package/config/AdminConfig/LexicalTheme.js +2 -0
- package/config/AdminConfig/LexicalTheme.js.map +1 -1
- package/config/AdminConfig/Widget.d.ts +9 -1
- package/config/AdminConfig/Widget.js +6 -2
- package/config/AdminConfig/Widget.js.map +1 -1
- package/config/AdminConfig.d.ts +8 -0
- package/config/AdminConfig.js +8 -1
- package/config/AdminConfig.js.map +1 -1
- package/domain/Identity.js +1 -1
- package/domain/Identity.js.map +1 -1
- package/exports/admin/ui.d.ts +4 -0
- package/exports/admin/ui.js +4 -1
- package/exports/admin.d.ts +7 -0
- package/exports/admin.js +5 -0
- package/features/accessManagement/types.d.ts +3 -3
- package/features/adminAssistant/AdminAssistantGateway.d.ts +30 -0
- package/features/adminAssistant/AdminAssistantGateway.js +41 -0
- package/features/adminAssistant/AdminAssistantGateway.js.map +1 -0
- package/features/adminAssistant/AdminAssistantPresenter.d.ts +60 -0
- package/features/adminAssistant/AdminAssistantPresenter.js +377 -0
- package/features/adminAssistant/AdminAssistantPresenter.js.map +1 -0
- package/features/adminAssistant/abstractions.d.ts +176 -0
- package/features/adminAssistant/abstractions.js +6 -0
- package/features/adminAssistant/abstractions.js.map +1 -0
- package/features/adminAssistant/feature.d.ts +3 -0
- package/features/adminAssistant/feature.js +19 -0
- package/features/adminAssistant/feature.js.map +1 -0
- package/features/adminAssistant/index.d.ts +6 -0
- package/features/adminAssistant/index.js +3 -0
- package/features/adminAssistant/turnsFromMessages.d.ts +15 -0
- package/features/adminAssistant/turnsFromMessages.js +77 -0
- package/features/adminAssistant/turnsFromMessages.js.map +1 -0
- package/features/adminUsers/account/getCurrentUser/GetCurrentUserGateway.d.ts +11 -0
- package/features/adminUsers/account/getCurrentUser/GetCurrentUserGateway.js +44 -0
- package/features/adminUsers/account/getCurrentUser/GetCurrentUserGateway.js.map +1 -0
- package/features/adminUsers/account/getCurrentUser/GetCurrentUserUseCase.d.ts +10 -0
- package/features/adminUsers/account/getCurrentUser/GetCurrentUserUseCase.js +19 -0
- package/features/adminUsers/account/getCurrentUser/GetCurrentUserUseCase.js.map +1 -0
- package/features/adminUsers/account/getCurrentUser/abstractions/GetCurrentUserGateway.d.ts +16 -0
- package/features/adminUsers/account/getCurrentUser/abstractions/GetCurrentUserGateway.js +5 -0
- package/features/adminUsers/account/getCurrentUser/abstractions/GetCurrentUserGateway.js.map +1 -0
- package/features/adminUsers/account/getCurrentUser/abstractions/GetCurrentUserUseCase.d.ts +10 -0
- package/features/adminUsers/account/getCurrentUser/abstractions/GetCurrentUserUseCase.js +5 -0
- package/features/adminUsers/account/getCurrentUser/abstractions/GetCurrentUserUseCase.js.map +1 -0
- package/features/adminUsers/account/getCurrentUser/abstractions/index.d.ts +6 -0
- package/features/adminUsers/account/getCurrentUser/abstractions/index.js +2 -0
- package/features/adminUsers/account/getCurrentUser/feature.d.ts +3 -0
- package/features/adminUsers/account/getCurrentUser/feature.js +19 -0
- package/features/adminUsers/account/getCurrentUser/feature.js.map +1 -0
- package/features/adminUsers/account/getCurrentUser/index.d.ts +1 -0
- package/features/adminUsers/account/getCurrentUser/index.js +1 -0
- package/features/adminUsers/account/updateCurrentUser/UpdateCurrentUserGateway.d.ts +11 -0
- package/features/adminUsers/account/updateCurrentUser/UpdateCurrentUserGateway.js +48 -0
- package/features/adminUsers/account/updateCurrentUser/UpdateCurrentUserGateway.js.map +1 -0
- package/features/adminUsers/account/updateCurrentUser/UpdateCurrentUserUseCase.d.ts +10 -0
- package/features/adminUsers/account/updateCurrentUser/UpdateCurrentUserUseCase.js +19 -0
- package/features/adminUsers/account/updateCurrentUser/UpdateCurrentUserUseCase.js.map +1 -0
- package/features/adminUsers/account/updateCurrentUser/abstractions/UpdateCurrentUserGateway.d.ts +26 -0
- package/features/adminUsers/account/updateCurrentUser/abstractions/UpdateCurrentUserGateway.js +5 -0
- package/features/adminUsers/account/updateCurrentUser/abstractions/UpdateCurrentUserGateway.js.map +1 -0
- package/features/adminUsers/account/updateCurrentUser/abstractions/UpdateCurrentUserUseCase.d.ts +13 -0
- package/features/adminUsers/account/updateCurrentUser/abstractions/UpdateCurrentUserUseCase.js +5 -0
- package/features/adminUsers/account/updateCurrentUser/abstractions/UpdateCurrentUserUseCase.js.map +1 -0
- package/features/adminUsers/account/updateCurrentUser/abstractions/index.d.ts +8 -0
- package/features/adminUsers/account/updateCurrentUser/abstractions/index.js +2 -0
- package/features/adminUsers/account/updateCurrentUser/feature.d.ts +3 -0
- package/features/adminUsers/account/updateCurrentUser/feature.js +19 -0
- package/features/adminUsers/account/updateCurrentUser/feature.js.map +1 -0
- package/features/adminUsers/account/updateCurrentUser/index.d.ts +1 -0
- package/features/adminUsers/account/updateCurrentUser/index.js +1 -0
- package/features/adminUsers/passwordPolicy/RulesPasswordPolicy.d.ts +6 -0
- package/features/adminUsers/passwordPolicy/RulesPasswordPolicy.js +22 -0
- package/features/adminUsers/passwordPolicy/RulesPasswordPolicy.js.map +1 -0
- package/features/adminUsers/passwordPolicy/abstractions.d.ts +20 -0
- package/features/adminUsers/passwordPolicy/abstractions.js +5 -0
- package/features/adminUsers/passwordPolicy/abstractions.js.map +1 -0
- package/features/adminUsers/passwordPolicy/feature.d.ts +8 -0
- package/features/adminUsers/passwordPolicy/feature.js +18 -0
- package/features/adminUsers/passwordPolicy/feature.js.map +1 -0
- package/features/adminUsers/passwordPolicy/index.d.ts +3 -0
- package/features/adminUsers/passwordPolicy/index.js +3 -0
- package/features/adminUsers/passwordPolicy/readPasswordPolicyRules.d.ts +10 -0
- package/features/adminUsers/passwordPolicy/readPasswordPolicyRules.js +11 -0
- package/features/adminUsers/passwordPolicy/readPasswordPolicyRules.js.map +1 -0
- package/features/adminUsers/permissions/abstractions.d.ts +17 -0
- package/features/adminUsers/permissions/abstractions.js +6 -0
- package/features/adminUsers/permissions/abstractions.js.map +1 -0
- package/features/adminUsers/permissions/feature.d.ts +14 -0
- package/features/adminUsers/permissions/feature.js +7 -0
- package/features/adminUsers/permissions/feature.js.map +1 -0
- package/features/adminUsers/permissionsSchema.d.ts +10 -0
- package/features/adminUsers/permissionsSchema.js +18 -0
- package/features/adminUsers/permissionsSchema.js.map +1 -0
- package/features/adminUsers/users/createUser/CreateUserGateway.d.ts +11 -0
- package/features/adminUsers/users/createUser/CreateUserGateway.js +49 -0
- package/features/adminUsers/users/createUser/CreateUserGateway.js.map +1 -0
- package/features/adminUsers/users/createUser/CreateUserUseCase.d.ts +10 -0
- package/features/adminUsers/users/createUser/CreateUserUseCase.js +18 -0
- package/features/adminUsers/users/createUser/CreateUserUseCase.js.map +1 -0
- package/features/adminUsers/users/createUser/abstractions/CreateUserGateway.d.ts +21 -0
- package/features/adminUsers/users/createUser/abstractions/CreateUserGateway.js +5 -0
- package/features/adminUsers/users/createUser/abstractions/CreateUserGateway.js.map +1 -0
- package/features/adminUsers/users/createUser/abstractions/CreateUserUseCase.d.ts +14 -0
- package/features/adminUsers/users/createUser/abstractions/CreateUserUseCase.js +5 -0
- package/features/adminUsers/users/createUser/abstractions/CreateUserUseCase.js.map +1 -0
- package/features/adminUsers/users/createUser/abstractions/index.d.ts +2 -0
- package/features/adminUsers/users/createUser/abstractions/index.js +2 -0
- package/features/adminUsers/users/createUser/feature.d.ts +3 -0
- package/features/adminUsers/users/createUser/feature.js +19 -0
- package/features/adminUsers/users/createUser/feature.js.map +1 -0
- package/features/adminUsers/users/createUser/index.d.ts +2 -0
- package/features/adminUsers/users/createUser/index.js +2 -0
- package/features/adminUsers/users/deleteUser/DeleteUserGateway.d.ts +11 -0
- package/features/adminUsers/users/deleteUser/DeleteUserGateway.js +40 -0
- package/features/adminUsers/users/deleteUser/DeleteUserGateway.js.map +1 -0
- package/features/adminUsers/users/deleteUser/DeleteUserUseCase.d.ts +10 -0
- package/features/adminUsers/users/deleteUser/DeleteUserUseCase.js +18 -0
- package/features/adminUsers/users/deleteUser/DeleteUserUseCase.js.map +1 -0
- package/features/adminUsers/users/deleteUser/abstractions/DeleteUserGateway.d.ts +11 -0
- package/features/adminUsers/users/deleteUser/abstractions/DeleteUserGateway.js +5 -0
- package/features/adminUsers/users/deleteUser/abstractions/DeleteUserGateway.js.map +1 -0
- package/features/adminUsers/users/deleteUser/abstractions/DeleteUserUseCase.d.ts +11 -0
- package/features/adminUsers/users/deleteUser/abstractions/DeleteUserUseCase.js +5 -0
- package/features/adminUsers/users/deleteUser/abstractions/DeleteUserUseCase.js.map +1 -0
- package/features/adminUsers/users/deleteUser/abstractions/index.d.ts +2 -0
- package/features/adminUsers/users/deleteUser/abstractions/index.js +2 -0
- package/features/adminUsers/users/deleteUser/feature.d.ts +3 -0
- package/features/adminUsers/users/deleteUser/feature.js +19 -0
- package/features/adminUsers/users/deleteUser/feature.js.map +1 -0
- package/features/adminUsers/users/deleteUser/index.d.ts +2 -0
- package/features/adminUsers/users/deleteUser/index.js +2 -0
- package/features/adminUsers/users/getUser/GetUserGateway.d.ts +11 -0
- package/features/adminUsers/users/getUser/GetUserGateway.js +57 -0
- package/features/adminUsers/users/getUser/GetUserGateway.js.map +1 -0
- package/features/adminUsers/users/getUser/GetUserUseCase.d.ts +10 -0
- package/features/adminUsers/users/getUser/GetUserUseCase.js +18 -0
- package/features/adminUsers/users/getUser/GetUserUseCase.js.map +1 -0
- package/features/adminUsers/users/getUser/abstractions/GetUserGateway.d.ts +32 -0
- package/features/adminUsers/users/getUser/abstractions/GetUserGateway.js +5 -0
- package/features/adminUsers/users/getUser/abstractions/GetUserGateway.js.map +1 -0
- package/features/adminUsers/users/getUser/abstractions/GetUserUseCase.d.ts +14 -0
- package/features/adminUsers/users/getUser/abstractions/GetUserUseCase.js +5 -0
- package/features/adminUsers/users/getUser/abstractions/GetUserUseCase.js.map +1 -0
- package/features/adminUsers/users/getUser/abstractions/index.d.ts +2 -0
- package/features/adminUsers/users/getUser/abstractions/index.js +2 -0
- package/features/adminUsers/users/getUser/feature.d.ts +3 -0
- package/features/adminUsers/users/getUser/feature.js +19 -0
- package/features/adminUsers/users/getUser/feature.js.map +1 -0
- package/features/adminUsers/users/getUser/index.d.ts +2 -0
- package/features/adminUsers/users/getUser/index.js +2 -0
- package/features/adminUsers/users/listUsers/ListUsersGateway.d.ts +11 -0
- package/features/adminUsers/users/listUsers/ListUsersGateway.js +39 -0
- package/features/adminUsers/users/listUsers/ListUsersGateway.js.map +1 -0
- package/features/adminUsers/users/listUsers/ListUsersUseCase.d.ts +10 -0
- package/features/adminUsers/users/listUsers/ListUsersUseCase.js +18 -0
- package/features/adminUsers/users/listUsers/ListUsersUseCase.js.map +1 -0
- package/features/adminUsers/users/listUsers/abstractions/ListUsersGateway.d.ts +17 -0
- package/features/adminUsers/users/listUsers/abstractions/ListUsersGateway.js +5 -0
- package/features/adminUsers/users/listUsers/abstractions/ListUsersGateway.js.map +1 -0
- package/features/adminUsers/users/listUsers/abstractions/ListUsersUseCase.d.ts +10 -0
- package/features/adminUsers/users/listUsers/abstractions/ListUsersUseCase.js +5 -0
- package/features/adminUsers/users/listUsers/abstractions/ListUsersUseCase.js.map +1 -0
- package/features/adminUsers/users/listUsers/abstractions/index.d.ts +2 -0
- package/features/adminUsers/users/listUsers/abstractions/index.js +2 -0
- package/features/adminUsers/users/listUsers/feature.d.ts +3 -0
- package/features/adminUsers/users/listUsers/feature.js +19 -0
- package/features/adminUsers/users/listUsers/feature.js.map +1 -0
- package/features/adminUsers/users/listUsers/index.d.ts +2 -0
- package/features/adminUsers/users/listUsers/index.js +2 -0
- package/features/adminUsers/users/updateUser/UpdateUserGateway.d.ts +11 -0
- package/features/adminUsers/users/updateUser/UpdateUserGateway.js +59 -0
- package/features/adminUsers/users/updateUser/UpdateUserGateway.js.map +1 -0
- package/features/adminUsers/users/updateUser/UpdateUserUseCase.d.ts +10 -0
- package/features/adminUsers/users/updateUser/UpdateUserUseCase.js +18 -0
- package/features/adminUsers/users/updateUser/UpdateUserUseCase.js.map +1 -0
- package/features/adminUsers/users/updateUser/abstractions/UpdateUserGateway.d.ts +33 -0
- package/features/adminUsers/users/updateUser/abstractions/UpdateUserGateway.js +5 -0
- package/features/adminUsers/users/updateUser/abstractions/UpdateUserGateway.js.map +1 -0
- package/features/adminUsers/users/updateUser/abstractions/UpdateUserUseCase.d.ts +15 -0
- package/features/adminUsers/users/updateUser/abstractions/UpdateUserUseCase.js +5 -0
- package/features/adminUsers/users/updateUser/abstractions/UpdateUserUseCase.js.map +1 -0
- package/features/adminUsers/users/updateUser/abstractions/index.d.ts +2 -0
- package/features/adminUsers/users/updateUser/abstractions/index.js +2 -0
- package/features/adminUsers/users/updateUser/feature.d.ts +3 -0
- package/features/adminUsers/users/updateUser/feature.js +19 -0
- package/features/adminUsers/users/updateUser/feature.js.map +1 -0
- package/features/adminUsers/users/updateUser/index.d.ts +2 -0
- package/features/adminUsers/users/updateUser/index.js +2 -0
- package/features/aiChats/AiChatSaveError.d.ts +6 -0
- package/features/aiChats/AiChatSaveError.js +8 -0
- package/features/aiChats/AiChatSaveError.js.map +1 -0
- package/features/aiChats/AiChatsGateway.d.ts +18 -0
- package/features/aiChats/AiChatsGateway.js +132 -0
- package/features/aiChats/AiChatsGateway.js.map +1 -0
- package/features/aiChats/AiChatsRepository.d.ts +36 -0
- package/features/aiChats/AiChatsRepository.js +110 -0
- package/features/aiChats/AiChatsRepository.js.map +1 -0
- package/features/aiChats/AiChatsRequestError.d.ts +9 -0
- package/features/aiChats/AiChatsRequestError.js +8 -0
- package/features/aiChats/AiChatsRequestError.js.map +1 -0
- package/features/aiChats/abstractions.d.ts +76 -0
- package/features/aiChats/abstractions.js +6 -0
- package/features/aiChats/abstractions.js.map +1 -0
- package/features/aiChats/feature.d.ts +3 -0
- package/features/aiChats/feature.js +19 -0
- package/features/aiChats/feature.js.map +1 -0
- package/features/aiChats/index.d.ts +9 -0
- package/features/aiChats/index.js +3 -0
- package/features/aiChats/messageOf.d.ts +2 -0
- package/features/aiChats/messageOf.js +7 -0
- package/features/aiChats/messageOf.js.map +1 -0
- package/features/aiSettings/abstractions.d.ts +16 -0
- package/features/aiSettings/abstractions.js +5 -0
- package/features/aiSettings/abstractions.js.map +1 -0
- package/features/aiSettings/index.d.ts +2 -0
- package/features/aiSettings/index.js +1 -0
- package/features/assumePermissions/ApiStreamClientDecorator.d.ts +16 -0
- package/features/assumePermissions/ApiStreamClientDecorator.js +29 -0
- package/features/assumePermissions/ApiStreamClientDecorator.js.map +1 -0
- package/features/assumePermissions/AssumePermissionsContext.d.ts +17 -0
- package/features/assumePermissions/AssumePermissionsContext.js +32 -0
- package/features/assumePermissions/AssumePermissionsContext.js.map +1 -0
- package/features/assumePermissions/AssumePermissionsUseCase.d.ts +33 -0
- package/features/assumePermissions/AssumePermissionsUseCase.js +48 -0
- package/features/assumePermissions/AssumePermissionsUseCase.js.map +1 -0
- package/features/assumePermissions/GraphQLClientDecorator.d.ts +16 -0
- package/features/assumePermissions/GraphQLClientDecorator.js +29 -0
- package/features/assumePermissions/GraphQLClientDecorator.js.map +1 -0
- package/features/assumePermissions/ListAssumableTargetsGateway.d.ts +13 -0
- package/features/assumePermissions/ListAssumableTargetsGateway.js +74 -0
- package/features/assumePermissions/ListAssumableTargetsGateway.js.map +1 -0
- package/features/assumePermissions/ListAssumableTargetsUseCase.d.ts +16 -0
- package/features/assumePermissions/ListAssumableTargetsUseCase.js +38 -0
- package/features/assumePermissions/ListAssumableTargetsUseCase.js.map +1 -0
- package/features/assumePermissions/LogInUseCaseDecorator.d.ts +33 -0
- package/features/assumePermissions/LogInUseCaseDecorator.js +36 -0
- package/features/assumePermissions/LogInUseCaseDecorator.js.map +1 -0
- package/features/assumePermissions/LogOutUseCaseDecorator.d.ts +16 -0
- package/features/assumePermissions/LogOutUseCaseDecorator.js +21 -0
- package/features/assumePermissions/LogOutUseCaseDecorator.js.map +1 -0
- package/features/assumePermissions/abstractions.d.ts +78 -0
- package/features/assumePermissions/abstractions.js +8 -0
- package/features/assumePermissions/abstractions.js.map +1 -0
- package/features/assumePermissions/assumePermissionsHeader.d.ts +3 -0
- package/features/assumePermissions/assumePermissionsHeader.js +7 -0
- package/features/assumePermissions/assumePermissionsHeader.js.map +1 -0
- package/features/assumePermissions/feature.d.ts +4 -0
- package/features/assumePermissions/feature.js +32 -0
- package/features/assumePermissions/feature.js.map +1 -0
- package/features/assumePermissions/index.d.ts +4 -0
- package/features/assumePermissions/index.js +2 -0
- package/features/banners/Banners.d.ts +15 -0
- package/features/banners/Banners.js +39 -0
- package/features/banners/Banners.js.map +1 -0
- package/features/banners/abstractions.d.ts +34 -0
- package/features/banners/abstractions.js +5 -0
- package/features/banners/abstractions.js.map +1 -0
- package/features/banners/feature.d.ts +3 -0
- package/features/banners/feature.js +17 -0
- package/features/banners/feature.js.map +1 -0
- package/features/banners/index.d.ts +2 -0
- package/features/banners/index.js +2 -0
- package/features/dateFormatter/DefaultDateFormatter.d.ts +8 -0
- package/features/dateFormatter/DefaultDateFormatter.js +25 -0
- package/features/dateFormatter/DefaultDateFormatter.js.map +1 -0
- package/features/dateFormatter/abstractions.d.ts +13 -0
- package/features/dateFormatter/abstractions.js +5 -0
- package/features/dateFormatter/abstractions.js.map +1 -0
- package/features/dateFormatter/feature.d.ts +3 -0
- package/features/dateFormatter/feature.js +17 -0
- package/features/dateFormatter/feature.js.map +1 -0
- package/features/dateFormatter/formatUtcOffset.d.ts +1 -0
- package/features/dateFormatter/formatUtcOffset.js +11 -0
- package/features/dateFormatter/formatUtcOffset.js.map +1 -0
- package/features/dateFormatter/index.d.ts +4 -0
- package/features/dateFormatter/index.js +4 -0
- package/features/dateFormatter/useDateFormatter.d.ts +5 -0
- package/features/dateFormatter/useDateFormatter.js +8 -0
- package/features/dateFormatter/useDateFormatter.js.map +1 -0
- package/features/debugger/DebugSessionsRepository.d.ts +35 -0
- package/features/debugger/DebugSessionsRepository.js +57 -0
- package/features/debugger/DebugSessionsRepository.js.map +1 -0
- package/features/debugger/GraphQLExtensionsDebugHandler.d.ts +17 -0
- package/features/debugger/GraphQLExtensionsDebugHandler.js +21 -0
- package/features/debugger/GraphQLExtensionsDebugHandler.js.map +1 -0
- package/features/debugger/GraphQLExtensionsDebugHandler.test.d.ts +1 -0
- package/features/debugger/GraphQLExtensionsDebugHandler.test.js +112 -0
- package/features/debugger/GraphQLExtensionsDebugHandler.test.js.map +1 -0
- package/features/debugger/abstractions.d.ts +50 -0
- package/features/debugger/abstractions.js +5 -0
- package/features/debugger/abstractions.js.map +1 -0
- package/features/debugger/constants.d.ts +1 -0
- package/features/debugger/constants.js +4 -0
- package/features/debugger/constants.js.map +1 -0
- package/features/debugger/feature.d.ts +3 -0
- package/features/debugger/feature.js +19 -0
- package/features/debugger/feature.js.map +1 -0
- package/features/debugger/index.d.ts +3 -0
- package/features/debugger/index.js +3 -0
- package/features/featureFlags/FeatureFlagsGateway.d.ts +10 -0
- package/features/featureFlags/FeatureFlagsGateway.js +40 -0
- package/features/featureFlags/FeatureFlagsGateway.js.map +1 -0
- package/features/featureFlags/FeatureFlagsService.d.ts +16 -0
- package/features/featureFlags/FeatureFlagsService.js +64 -0
- package/features/featureFlags/FeatureFlagsService.js.map +1 -0
- package/features/featureFlags/abstractions.d.ts +19 -0
- package/features/featureFlags/abstractions.js +6 -0
- package/features/featureFlags/abstractions.js.map +1 -0
- package/features/featureFlags/feature.d.ts +3 -0
- package/features/featureFlags/feature.js +19 -0
- package/features/featureFlags/feature.js.map +1 -0
- package/features/formModel/AccessControlRuleEvaluator.d.ts +12 -0
- package/features/formModel/AccessControlRuleEvaluator.js +30 -0
- package/features/formModel/AccessControlRuleEvaluator.js.map +1 -0
- package/features/formModel/AccessControlRuleEvaluator.test.d.ts +1 -0
- package/features/formModel/AccessControlRuleEvaluator.test.js +219 -0
- package/features/formModel/AccessControlRuleEvaluator.test.js.map +1 -0
- package/features/formModel/ConditionRuleEvaluator.js +34 -4
- package/features/formModel/ConditionRuleEvaluator.js.map +1 -1
- package/features/formModel/Field.d.ts +14 -1
- package/features/formModel/Field.js +49 -3
- package/features/formModel/Field.js.map +1 -1
- package/features/formModel/FieldBuilder.d.ts +3 -3
- package/features/formModel/FieldBuilder.js +3 -2
- package/features/formModel/FieldBuilder.js.map +1 -1
- package/features/formModel/FieldBuilder.test.js +162 -5
- package/features/formModel/FieldBuilder.test.js.map +1 -1
- package/features/formModel/FocusManager.js +10 -3
- package/features/formModel/FocusManager.js.map +1 -1
- package/features/formModel/FormErrors.d.ts +2 -2
- package/features/formModel/FormErrors.js +1 -1
- package/features/formModel/FormErrors.js.map +1 -1
- package/features/formModel/FormModel.d.ts +2 -0
- package/features/formModel/FormModel.js +32 -9
- package/features/formModel/FormModel.js.map +1 -1
- package/features/formModel/FormModel.test.js +883 -2
- package/features/formModel/FormModel.test.js.map +1 -1
- package/features/formModel/FormView.d.ts +8 -4
- package/features/formModel/ObjectField.d.ts +12 -1
- package/features/formModel/ObjectField.js +70 -20
- package/features/formModel/ObjectField.js.map +1 -1
- package/features/formModel/PresenterErrors.d.ts +2 -2
- package/features/formModel/Rules.test.js +224 -16
- package/features/formModel/Rules.test.js.map +1 -1
- package/features/formModel/abstractions.d.ts +56 -4
- package/features/formModel/abstractions.js +2 -1
- package/features/formModel/abstractions.js.map +1 -1
- package/features/formModel/createFieldRenderer.d.ts +42 -0
- package/features/formModel/createFieldRenderer.js +33 -10
- package/features/formModel/createFieldRenderer.js.map +1 -1
- package/features/formModel/demo/FormModelDemo.d.ts +2 -2
- package/features/formModel/feature.js +2 -0
- package/features/formModel/feature.js.map +1 -1
- package/features/formModel/fieldTypes/DateTimeFieldType.d.ts +67 -4
- package/features/formModel/fieldTypes/DateTimeFieldType.js +88 -22
- package/features/formModel/fieldTypes/DateTimeFieldType.js.map +1 -1
- package/features/formModel/fieldTypes/ObjectFieldType.d.ts +3 -1
- package/features/formModel/fieldTypes/ObjectFieldType.js +23 -1
- package/features/formModel/fieldTypes/ObjectFieldType.js.map +1 -1
- package/features/formModel/fieldTypes/dateLimits.d.ts +37 -0
- package/features/formModel/fieldTypes/dateLimits.js +64 -0
- package/features/formModel/fieldTypes/dateLimits.js.map +1 -0
- package/features/formModel/fieldTypes/dateLimits.test.d.ts +1 -0
- package/features/formModel/fieldTypes/dateLimits.test.js +60 -0
- package/features/formModel/fieldTypes/dateLimits.test.js.map +1 -0
- package/features/formModel/hasSubtreeFocusRequest.d.ts +12 -0
- package/features/formModel/hasSubtreeFocusRequest.js +15 -0
- package/features/formModel/hasSubtreeFocusRequest.js.map +1 -0
- package/features/formModel/index.d.ts +3 -2
- package/features/formModel/index.js +2 -1
- package/features/formModel/jsonSchema/JsonSchema.d.ts +18 -0
- package/features/formModel/jsonSchema/JsonSchema.js +0 -0
- package/features/formModel/jsonSchema/JsonSchemaFieldOptions.d.ts +4 -0
- package/features/formModel/jsonSchema/JsonSchemaFieldOptions.js +0 -0
- package/features/formModel/jsonSchema/JsonSchemaIssue.d.ts +4 -0
- package/features/formModel/jsonSchema/JsonSchemaIssue.js +0 -0
- package/features/formModel/jsonSchema/JsonSchemaValidationResult.d.ts +5 -0
- package/features/formModel/jsonSchema/JsonSchemaValidationResult.js +0 -0
- package/features/formModel/jsonSchema/JsonSchemaValidator.d.ts +4 -0
- package/features/formModel/jsonSchema/JsonSchemaValidator.js +0 -0
- package/features/formModel/jsonSchema/PlainObject.d.ts +1 -0
- package/features/formModel/jsonSchema/PlainObject.js +0 -0
- package/features/formModel/jsonSchema/buildFieldsFromJsonSchema.d.ts +5 -0
- package/features/formModel/jsonSchema/buildFieldsFromJsonSchema.js +154 -0
- package/features/formModel/jsonSchema/buildFieldsFromJsonSchema.js.map +1 -0
- package/features/formModel/jsonSchema/buildFieldsFromJsonSchema.test.d.ts +1 -0
- package/features/formModel/jsonSchema/buildFieldsFromJsonSchema.test.js +643 -0
- package/features/formModel/jsonSchema/buildFieldsFromJsonSchema.test.js.map +1 -0
- package/features/formModel/jsonSchema/createJsonSchemaValidator.d.ts +3 -0
- package/features/formModel/jsonSchema/createJsonSchemaValidator.js +40 -0
- package/features/formModel/jsonSchema/createJsonSchemaValidator.js.map +1 -0
- package/features/formModel/jsonSchema/createJsonSchemaValidator.test.d.ts +1 -0
- package/features/formModel/jsonSchema/createJsonSchemaValidator.test.js +141 -0
- package/features/formModel/jsonSchema/createJsonSchemaValidator.test.js.map +1 -0
- package/features/formModel/jsonSchema/formDataToJsonSchemaValue.d.ts +3 -0
- package/features/formModel/jsonSchema/formDataToJsonSchemaValue.js +52 -0
- package/features/formModel/jsonSchema/formDataToJsonSchemaValue.js.map +1 -0
- package/features/formModel/jsonSchema/formDataToJsonSchemaValue.test.d.ts +1 -0
- package/features/formModel/jsonSchema/formDataToJsonSchemaValue.test.js +250 -0
- package/features/formModel/jsonSchema/formDataToJsonSchemaValue.test.js.map +1 -0
- package/features/formModel/jsonSchema/getJsonSchemaKind.d.ts +3 -0
- package/features/formModel/jsonSchema/getJsonSchemaKind.js +31 -0
- package/features/formModel/jsonSchema/getJsonSchemaKind.js.map +1 -0
- package/features/formModel/jsonSchema/getJsonSchemaKind.test.d.ts +1 -0
- package/features/formModel/jsonSchema/getJsonSchemaKind.test.js +123 -0
- package/features/formModel/jsonSchema/getJsonSchemaKind.test.js.map +1 -0
- package/features/formModel/jsonSchema/isPlainObject.d.ts +2 -0
- package/features/formModel/jsonSchema/isPlainObject.js +4 -0
- package/features/formModel/jsonSchema/isPlainObject.js.map +1 -0
- package/features/formModel/jsonSchema/jsonSchemaValueToFormData.d.ts +3 -0
- package/features/formModel/jsonSchema/jsonSchemaValueToFormData.js +30 -0
- package/features/formModel/jsonSchema/jsonSchemaValueToFormData.js.map +1 -0
- package/features/formModel/jsonSchema/jsonSchemaValueToFormData.test.d.ts +1 -0
- package/features/formModel/jsonSchema/jsonSchemaValueToFormData.test.js +207 -0
- package/features/formModel/jsonSchema/jsonSchemaValueToFormData.test.js.map +1 -0
- package/features/formModel/jsonSchema/normalizeJsonSchema.d.ts +2 -0
- package/features/formModel/jsonSchema/normalizeJsonSchema.js +10 -0
- package/features/formModel/jsonSchema/normalizeJsonSchema.js.map +1 -0
- package/features/formModel/renderers.d.ts +2 -0
- package/features/formModel/renderers.js +2 -0
- package/features/notifications/Notifications.d.ts +1 -0
- package/features/notifications/Notifications.js +3 -0
- package/features/notifications/Notifications.js.map +1 -1
- package/features/notifications/Notifications.test.d.ts +1 -0
- package/features/notifications/Notifications.test.js +106 -0
- package/features/notifications/Notifications.test.js.map +1 -0
- package/features/notifications/NotificationsRenderer.d.ts +3 -2
- package/features/notifications/NotificationsRenderer.js +23 -4
- package/features/notifications/NotificationsRenderer.js.map +1 -1
- package/features/notifications/NotificationsRenderer.test.d.ts +1 -0
- package/features/notifications/NotificationsRenderer.test.js +261 -0
- package/features/notifications/NotificationsRenderer.test.js.map +1 -0
- package/features/notifications/abstractions.d.ts +13 -2
- package/features/notifications/abstractions.js.map +1 -1
- package/features/security/AuthenticationContext/ApiStreamClientDecorator.d.ts +22 -0
- package/features/security/AuthenticationContext/ApiStreamClientDecorator.js +32 -0
- package/features/security/AuthenticationContext/ApiStreamClientDecorator.js.map +1 -0
- package/features/security/AuthenticationContext/feature.js +2 -0
- package/features/security/AuthenticationContext/feature.js.map +1 -1
- package/features/security/LogIn/LogInUseCase.d.ts +0 -1
- package/features/security/LogIn/LogInUseCase.js +2 -5
- package/features/security/LogIn/LogInUseCase.js.map +1 -1
- package/features/security/LogIn/hasAppPermissions.d.ts +2 -0
- package/features/security/LogIn/hasAppPermissions.js +8 -0
- package/features/security/LogIn/hasAppPermissions.js.map +1 -0
- package/features/slugify/DefaultSlugify.d.ts +8 -0
- package/features/slugify/DefaultSlugify.js +20 -0
- package/features/slugify/DefaultSlugify.js.map +1 -0
- package/features/slugify/abstractions.d.ts +12 -0
- package/features/slugify/abstractions.js +5 -0
- package/features/slugify/abstractions.js.map +1 -0
- package/features/slugify/feature.d.ts +1 -0
- package/features/slugify/feature.js +11 -0
- package/features/slugify/feature.js.map +1 -0
- package/features/slugify/index.d.ts +3 -0
- package/features/slugify/index.js +3 -0
- package/features/stringFormatter/DefaultStringFormatter.d.ts +17 -0
- package/features/stringFormatter/DefaultStringFormatter.js +19 -0
- package/features/stringFormatter/DefaultStringFormatter.js.map +1 -0
- package/features/stringFormatter/abstractions.d.ts +11 -0
- package/features/stringFormatter/abstractions.js +5 -0
- package/features/stringFormatter/abstractions.js.map +1 -0
- package/features/stringFormatter/feature.d.ts +3 -0
- package/features/stringFormatter/feature.js +19 -0
- package/features/stringFormatter/feature.js.map +1 -0
- package/features/stringFormatter/index.d.ts +4 -0
- package/features/stringFormatter/index.js +4 -0
- package/features/stringFormatter/useStringFormatter.d.ts +5 -0
- package/features/stringFormatter/useStringFormatter.js +8 -0
- package/features/stringFormatter/useStringFormatter.js.map +1 -0
- package/features/tenancy/ApiStreamClientDecorator.d.ts +16 -0
- package/features/tenancy/ApiStreamClientDecorator.js +30 -0
- package/features/tenancy/ApiStreamClientDecorator.js.map +1 -0
- package/features/tenancy/feature.js +2 -0
- package/features/tenancy/feature.js.map +1 -1
- package/features/wcp/ReactLicense.d.ts +11 -0
- package/features/wcp/ReactLicense.js +33 -0
- package/features/wcp/ReactLicense.js.map +1 -1
- package/features/wcp/WcpGateway.js +7 -0
- package/features/wcp/WcpGateway.js.map +1 -1
- package/hooks/index.d.ts +3 -0
- package/hooks/index.js +3 -0
- package/hooks/useDrawer.d.ts +9 -0
- package/hooks/useDrawer.js +19 -0
- package/hooks/useDrawer.js.map +1 -0
- package/hooks/useHotkeys.js +11 -7
- package/hooks/useHotkeys.js.map +1 -1
- package/hooks/useOpenDrawer.d.ts +7 -0
- package/hooks/useOpenDrawer.js +18 -0
- package/hooks/useOpenDrawer.js.map +1 -0
- package/hooks/useSnackbar.js.map +1 -1
- package/index.d.ts +43 -2
- package/index.js +43 -15
- package/modules/AccessManagementExtension.js +49 -23
- package/modules/AccessManagementExtension.js.map +1 -1
- package/modules/DebuggerExtension.d.ts +2 -0
- package/modules/DebuggerExtension.js +55 -0
- package/modules/DebuggerExtension.js.map +1 -0
- package/package.json +41 -38
- package/presentation/accessManagement/SecurityPermissions.js +3 -3
- package/presentation/accessManagement/SecurityPermissions.js.map +1 -1
- package/presentation/accessManagement/apiKeys/ApiKeysPresenter.d.ts +3 -1
- package/presentation/accessManagement/apiKeys/ApiKeysPresenter.js +14 -18
- package/presentation/accessManagement/apiKeys/ApiKeysPresenter.js.map +1 -1
- package/presentation/accessManagement/apiKeys/components/ApiKeysView.d.ts +2 -2
- package/presentation/accessManagement/apiKeys/components/ApiKeysView.js +13 -7
- package/presentation/accessManagement/apiKeys/components/ApiKeysView.js.map +1 -1
- package/presentation/accessManagement/roles/RolesPresenter.d.ts +3 -1
- package/presentation/accessManagement/roles/RolesPresenter.js +12 -16
- package/presentation/accessManagement/roles/RolesPresenter.js.map +1 -1
- package/presentation/accessManagement/roles/components/RolesDataList.d.ts +10 -0
- package/presentation/accessManagement/roles/components/RolesDataList.js +146 -0
- package/presentation/accessManagement/roles/components/RolesDataList.js.map +1 -0
- package/presentation/accessManagement/roles/components/RolesForm.d.ts +13 -0
- package/presentation/accessManagement/roles/components/RolesForm.js +114 -0
- package/presentation/accessManagement/roles/components/RolesForm.js.map +1 -0
- package/presentation/accessManagement/roles/components/RolesView.d.ts +2 -2
- package/presentation/accessManagement/roles/components/RolesView.js +6 -212
- package/presentation/accessManagement/roles/components/RolesView.js.map +1 -1
- package/presentation/accessManagement/teams/TeamsPresenter.d.ts +3 -1
- package/presentation/accessManagement/teams/TeamsPresenter.js +12 -16
- package/presentation/accessManagement/teams/TeamsPresenter.js.map +1 -1
- package/presentation/accessManagement/teams/components/TeamsDataList.d.ts +10 -0
- package/presentation/accessManagement/teams/components/TeamsDataList.js +146 -0
- package/presentation/accessManagement/teams/components/TeamsDataList.js.map +1 -0
- package/presentation/accessManagement/teams/components/TeamsForm.d.ts +13 -0
- package/presentation/accessManagement/teams/components/TeamsForm.js +96 -0
- package/presentation/accessManagement/teams/components/TeamsForm.js.map +1 -0
- package/presentation/accessManagement/teams/components/TeamsView.d.ts +2 -2
- package/presentation/accessManagement/teams/components/TeamsView.js +6 -194
- package/presentation/accessManagement/teams/components/TeamsView.js.map +1 -1
- package/presentation/adminUsers/AdminUsers.d.ts +10 -0
- package/presentation/adminUsers/AdminUsers.js +77 -0
- package/presentation/adminUsers/AdminUsers.js.map +1 -0
- package/presentation/adminUsers/SecurityPermission.d.ts +2 -0
- package/presentation/adminUsers/SecurityPermission.js +15 -0
- package/presentation/adminUsers/SecurityPermission.js.map +1 -0
- package/presentation/adminUsers/UserItem.d.ts +10 -0
- package/presentation/adminUsers/UserItem.js +0 -0
- package/presentation/adminUsers/components/AvatarImage/AvatarImage.d.ts +3 -0
- package/presentation/adminUsers/components/AvatarImage/AvatarImage.js +31 -0
- package/presentation/adminUsers/components/AvatarImage/AvatarImage.js.map +1 -0
- package/presentation/adminUsers/components/AvatarImage/AvatarImagePreview.d.ts +10 -0
- package/presentation/adminUsers/components/AvatarImage/AvatarImagePreview.js +53 -0
- package/presentation/adminUsers/components/AvatarImage/AvatarImagePreview.js.map +1 -0
- package/presentation/adminUsers/components/AvatarImage/AvatarImageTrigger.d.ts +7 -0
- package/presentation/adminUsers/components/AvatarImage/AvatarImageTrigger.js +28 -0
- package/presentation/adminUsers/components/AvatarImage/AvatarImageTrigger.js.map +1 -0
- package/presentation/adminUsers/components/AvatarImage/index.d.ts +1 -0
- package/presentation/adminUsers/components/AvatarImage/index.js +1 -0
- package/presentation/adminUsers/routes.d.ts +10 -0
- package/presentation/adminUsers/routes.js +20 -0
- package/presentation/adminUsers/routes.js.map +1 -0
- package/presentation/adminUsers/userMenu/AccountDetails.d.ts +6 -0
- package/presentation/adminUsers/userMenu/AccountDetails.js +20 -0
- package/presentation/adminUsers/userMenu/AccountDetails.js.map +1 -0
- package/presentation/adminUsers/userMenu/useIsDefaultTenant.d.ts +1 -0
- package/presentation/adminUsers/userMenu/useIsDefaultTenant.js +9 -0
- package/presentation/adminUsers/userMenu/useIsDefaultTenant.js.map +1 -0
- package/presentation/adminUsers/views/Account/Account.d.ts +2 -0
- package/presentation/adminUsers/views/Account/Account.js +137 -0
- package/presentation/adminUsers/views/Account/Account.js.map +1 -0
- package/presentation/adminUsers/views/Account/index.d.ts +1 -0
- package/presentation/adminUsers/views/Account/index.js +1 -0
- package/presentation/adminUsers/views/Users/UsersDataList.d.ts +3 -0
- package/presentation/adminUsers/views/Users/UsersDataList.js +180 -0
- package/presentation/adminUsers/views/Users/UsersDataList.js.map +1 -0
- package/presentation/adminUsers/views/Users/UsersForm.d.ts +5 -0
- package/presentation/adminUsers/views/Users/UsersForm.js +175 -0
- package/presentation/adminUsers/views/Users/UsersForm.js.map +1 -0
- package/presentation/adminUsers/views/Users/UsersView.d.ts +2 -0
- package/presentation/adminUsers/views/Users/UsersView.js +15 -0
- package/presentation/adminUsers/views/Users/UsersView.js.map +1 -0
- package/presentation/adminUsers/views/Users/components/DeleteAction.d.ts +7 -0
- package/presentation/adminUsers/views/Users/components/DeleteAction.js +29 -0
- package/presentation/adminUsers/views/Users/components/DeleteAction.js.map +1 -0
- package/presentation/adminUsers/views/Users/hooks/useUserForm.d.ts +27 -0
- package/presentation/adminUsers/views/Users/hooks/useUserForm.js +101 -0
- package/presentation/adminUsers/views/Users/hooks/useUserForm.js.map +1 -0
- package/presentation/adminUsers/views/Users/search.js +21 -0
- package/presentation/adminUsers/views/Users/search.js.map +1 -0
- package/presentation/adminUsers/views/Users/search.svg +20 -0
- package/presentation/adminUsers/views/utils.d.ts +3 -0
- package/presentation/adminUsers/views/utils.js +12 -0
- package/presentation/adminUsers/views/utils.js.map +1 -0
- package/presentation/aiChats/AiChatsPanelPresenter.d.ts +28 -0
- package/presentation/aiChats/AiChatsPanelPresenter.js +132 -0
- package/presentation/aiChats/AiChatsPanelPresenter.js.map +1 -0
- package/presentation/aiChats/abstractions.d.ts +69 -0
- package/presentation/aiChats/abstractions.js +5 -0
- package/presentation/aiChats/abstractions.js.map +1 -0
- package/presentation/aiChats/feature.d.ts +3 -0
- package/presentation/aiChats/feature.js +17 -0
- package/presentation/aiChats/feature.js.map +1 -0
- package/presentation/aiChats/index.d.ts +2 -0
- package/presentation/aiChats/index.js +2 -0
- package/presentation/assumePermissions/AssumePermissionsPresenter.d.ts +36 -0
- package/presentation/assumePermissions/AssumePermissionsPresenter.js +153 -0
- package/presentation/assumePermissions/AssumePermissionsPresenter.js.map +1 -0
- package/presentation/assumePermissions/abstractions.d.ts +30 -0
- package/presentation/assumePermissions/abstractions.js +5 -0
- package/presentation/assumePermissions/abstractions.js.map +1 -0
- package/presentation/assumePermissions/components/AssumePermissionsButton.d.ts +14 -0
- package/presentation/assumePermissions/components/AssumePermissionsButton.js +42 -0
- package/presentation/assumePermissions/components/AssumePermissionsButton.js.map +1 -0
- package/presentation/assumePermissions/components/AssumedPermissionsBanner.d.ts +11 -0
- package/presentation/assumePermissions/components/AssumedPermissionsBanner.js +25 -0
- package/presentation/assumePermissions/components/AssumedPermissionsBanner.js.map +1 -0
- package/presentation/assumePermissions/components/AssumedPermissionsSelector.d.ts +2 -0
- package/presentation/assumePermissions/components/AssumedPermissionsSelector.js +68 -0
- package/presentation/assumePermissions/components/AssumedPermissionsSelector.js.map +1 -0
- package/presentation/assumePermissions/feature.d.ts +3 -0
- package/presentation/assumePermissions/feature.js +17 -0
- package/presentation/assumePermissions/feature.js.map +1 -0
- package/presentation/assumePermissions/index.d.ts +4 -0
- package/presentation/assumePermissions/index.js +4 -0
- package/presentation/banners/BannersPresenter.d.ts +14 -0
- package/presentation/banners/BannersPresenter.js +60 -0
- package/presentation/banners/BannersPresenter.js.map +1 -0
- package/presentation/banners/abstractions.d.ts +24 -0
- package/presentation/banners/abstractions.js +5 -0
- package/presentation/banners/abstractions.js.map +1 -0
- package/presentation/banners/components/Banner.d.ts +10 -0
- package/presentation/banners/components/Banner.js +32 -0
- package/presentation/banners/components/Banner.js.map +1 -0
- package/presentation/banners/components/BannerBar.d.ts +11 -0
- package/presentation/banners/components/BannerBar.js +51 -0
- package/presentation/banners/components/BannerBar.js.map +1 -0
- package/presentation/banners/feature.d.ts +3 -0
- package/presentation/banners/feature.js +17 -0
- package/presentation/banners/feature.js.map +1 -0
- package/presentation/banners/index.d.ts +6 -0
- package/presentation/banners/index.js +4 -0
- package/presentation/banners/useBanner.d.ts +10 -0
- package/presentation/banners/useBanner.js +15 -0
- package/presentation/banners/useBanner.js.map +1 -0
- package/presentation/commandPalette/CommandPalettePresenter.d.ts +21 -0
- package/presentation/commandPalette/CommandPalettePresenter.js +93 -0
- package/presentation/commandPalette/CommandPalettePresenter.js.map +1 -0
- package/presentation/commandPalette/abstractions.d.ts +81 -0
- package/presentation/commandPalette/abstractions.js +7 -0
- package/presentation/commandPalette/abstractions.js.map +1 -0
- package/presentation/commandPalette/commands/AiChatsCommand.d.ts +24 -0
- package/presentation/commandPalette/commands/AiChatsCommand.js +41 -0
- package/presentation/commandPalette/commands/AiChatsCommand.js.map +1 -0
- package/presentation/commandPalette/commands/AskAiCommand.d.ts +26 -0
- package/presentation/commandPalette/commands/AskAiCommand.js +34 -0
- package/presentation/commandPalette/commands/AskAiCommand.js.map +1 -0
- package/presentation/commandPalette/commands/CopyCurrentUrlCommand.d.ts +15 -0
- package/presentation/commandPalette/commands/CopyCurrentUrlCommand.js +33 -0
- package/presentation/commandPalette/commands/CopyCurrentUrlCommand.js.map +1 -0
- package/presentation/commandPalette/commands/SendMessageCommand.d.ts +23 -0
- package/presentation/commandPalette/commands/SendMessageCommand.js +66 -0
- package/presentation/commandPalette/commands/SendMessageCommand.js.map +1 -0
- package/presentation/commandPalette/commands/SignOutCommand.d.ts +18 -0
- package/presentation/commandPalette/commands/SignOutCommand.js +37 -0
- package/presentation/commandPalette/commands/SignOutCommand.js.map +1 -0
- package/presentation/commandPalette/commands/feature.d.ts +5 -0
- package/presentation/commandPalette/commands/feature.js +19 -0
- package/presentation/commandPalette/commands/feature.js.map +1 -0
- package/presentation/commandPalette/feature.d.ts +3 -0
- package/presentation/commandPalette/feature.js +17 -0
- package/presentation/commandPalette/feature.js.map +1 -0
- package/presentation/commandPalette/index.d.ts +3 -0
- package/presentation/commandPalette/index.js +2 -0
- package/presentation/createReactiveComponent.d.ts +1 -0
- package/presentation/createReactiveComponent.js +1 -0
- package/presentation/debugger/DebuggerPresenter.d.ts +14 -0
- package/presentation/debugger/DebuggerPresenter.js +45 -0
- package/presentation/debugger/DebuggerPresenter.js.map +1 -0
- package/presentation/debugger/abstractions.d.ts +17 -0
- package/presentation/debugger/abstractions.js +5 -0
- package/presentation/debugger/abstractions.js.map +1 -0
- package/presentation/debugger/components/DebuggerIndicator.d.ts +2 -0
- package/presentation/debugger/components/DebuggerIndicator.js +45 -0
- package/presentation/debugger/components/DebuggerIndicator.js.map +1 -0
- package/presentation/debugger/components/DebuggerView.d.ts +4 -0
- package/presentation/debugger/components/DebuggerView.js +44 -0
- package/presentation/debugger/components/DebuggerView.js.map +1 -0
- package/presentation/debugger/downloadJson.d.ts +7 -0
- package/presentation/debugger/downloadJson.js +17 -0
- package/presentation/debugger/downloadJson.js.map +1 -0
- package/presentation/debugger/feature.d.ts +3 -0
- package/presentation/debugger/feature.js +17 -0
- package/presentation/debugger/feature.js.map +1 -0
- package/presentation/debugger/routes.d.ts +4 -0
- package/presentation/debugger/routes.js +10 -0
- package/presentation/debugger/routes.js.map +1 -0
- package/presentation/featureFlags/FeatureFlagsProvider.d.ts +7 -0
- package/presentation/featureFlags/FeatureFlagsProvider.js +22 -0
- package/presentation/featureFlags/FeatureFlagsProvider.js.map +1 -0
- package/presentation/featureFlags/useFeatureFlags.d.ts +2 -0
- package/presentation/featureFlags/useFeatureFlags.js +17 -0
- package/presentation/featureFlags/useFeatureFlags.js.map +1 -0
- package/presentation/installation/components/SystemInstaller/SystemInstaller.d.ts +2 -2
- package/presentation/installation/components/SystemInstaller/steps/AdminUserStep.js +4 -3
- package/presentation/installation/components/SystemInstaller/steps/AdminUserStep.js.map +1 -1
- package/presentation/installation/components/SystemInstaller/steps/FinishSetup/handleStartUsing.js +0 -3
- package/presentation/installation/components/SystemInstaller/steps/FinishSetup/handleStartUsing.js.map +1 -1
- package/presentation/installation/presenters/SystemInstaller/SystemInstallerPresenter.js.map +1 -1
- package/presentation/listPresenter/FolderAwareDataSource.d.ts +5 -0
- package/presentation/listPresenter/FolderAwareDataSource.js +8 -4
- package/presentation/listPresenter/FolderAwareDataSource.js.map +1 -1
- package/presentation/listPresenter/QueryMatcher.d.ts +28 -5
- package/presentation/listPresenter/QueryMatcher.js +74 -4
- package/presentation/listPresenter/QueryMatcher.js.map +1 -1
- package/presentation/listPresenter/QueryMatcher.test.d.ts +1 -0
- package/presentation/listPresenter/QueryMatcher.test.js +345 -0
- package/presentation/listPresenter/QueryMatcher.test.js.map +1 -0
- package/presentation/sortable/SortablePresenter.d.ts +23 -0
- package/presentation/sortable/SortablePresenter.js +175 -0
- package/presentation/sortable/SortablePresenter.js.map +1 -0
- package/presentation/sortable/abstractions.d.ts +24 -0
- package/presentation/sortable/abstractions.js +5 -0
- package/presentation/sortable/abstractions.js.map +1 -0
- package/presentation/sortable/feature.d.ts +1 -0
- package/presentation/sortable/feature.js +11 -0
- package/presentation/sortable/feature.js.map +1 -0
- package/presentation/sortable/index.d.ts +2 -0
- package/presentation/sortable/index.js +2 -0
- package/presentation/trashBin/TrashBinPresenter.js +3 -1
- package/presentation/trashBin/TrashBinPresenter.js.map +1 -1
- package/presentation/trashBin/TrashBinPresenter.test.d.ts +1 -0
- package/presentation/trashBin/TrashBinPresenter.test.js +91 -0
- package/presentation/trashBin/TrashBinPresenter.test.js.map +1 -0
- package/presentation/trashBin/abstractions.d.ts +1 -1
- package/presentation/trashBin/abstractions.js.map +1 -1
- package/presentation/trashBin/components/BulkActions/DeleteItems.d.ts +2 -2
- package/presentation/trashBin/components/BulkActions/DeleteItems.js +5 -1
- package/presentation/trashBin/components/BulkActions/DeleteItems.js.map +1 -1
- package/presentation/trashBin/components/BulkActions/DeleteItems.test.d.ts +1 -0
- package/presentation/trashBin/components/BulkActions/DeleteItems.test.js +100 -0
- package/presentation/trashBin/components/BulkActions/DeleteItems.test.js.map +1 -0
- package/presentation/trashBin/components/BulkActions/RestoreItems.d.ts +2 -2
- package/presentation/trashBin/components/TrashBinOverlay.d.ts +2 -2
- package/presentation/trashBin/hooks/useDeleteTrashBinItem.js +2 -1
- package/presentation/trashBin/hooks/useDeleteTrashBinItem.js.map +1 -1
- package/presentation/trashBin/hooks/useDeleteTrashBinItem.test.d.ts +1 -0
- package/presentation/trashBin/hooks/useDeleteTrashBinItem.test.js +67 -0
- package/presentation/trashBin/hooks/useDeleteTrashBinItem.test.js.map +1 -0
- package/static/svg/search.43fa797c.svg +20 -0
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone.d.ts +0 -10
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone.js.map +0 -1
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker.js +0 -68
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker.js.map +0 -1
- package/base/Base/Menus/WebinyVersion.d.ts +0 -2
- package/base/Base/Menus/WebinyVersion.js +0 -23
- package/base/Base/Menus/WebinyVersion.js.map +0 -1
- package/base/WebinyVersion.d.ts +0 -2
- package/base/WebinyVersion.js +0 -23
- package/base/WebinyVersion.js.map +0 -1
- package/components/Wcp.d.ts +0 -19
- package/components/Wcp.js +0 -37
- package/components/Wcp.js.map +0 -1
- package/presentation/installation/components/SystemInstaller/steps/AdminUserStep/createPasswordValidator.d.ts +0 -8
- package/presentation/installation/components/SystemInstaller/steps/AdminUserStep/createPasswordValidator.js +0 -17
- package/presentation/installation/components/SystemInstaller/steps/AdminUserStep/createPasswordValidator.js.map +0 -1
- package/presentation/installation/components/SystemInstaller/steps/AdminUserStep/usePasswordValidator.d.ts +0 -1
- package/presentation/installation/components/SystemInstaller/steps/AdminUserStep/usePasswordValidator.js +0 -16
- package/presentation/installation/components/SystemInstaller/steps/AdminUserStep/usePasswordValidator.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/formModel/jsonSchema/buildFieldsFromJsonSchema.test.js","sources":["../../../../src/features/formModel/jsonSchema/buildFieldsFromJsonSchema.test.ts"],"sourcesContent":["import { describe } from \"vitest\";\nimport { expect } from \"vitest\";\nimport { it } from \"vitest\";\nimport { Container } from \"@webiny/di\";\nimport { FormModelFeature } from \"../feature.js\";\nimport { FormModelFactory } from \"../abstractions.js\";\nimport type { IFormModel } from \"../abstractions.js\";\nimport { IdentityContextFeature } from \"~/features/security/IdentityContext/feature.js\";\nimport type { JsonSchema } from \"./JsonSchema.js\";\nimport type { JsonSchemaFieldOptions } from \"./JsonSchemaFieldOptions.js\";\nimport { buildFieldsFromJsonSchema } from \"./buildFieldsFromJsonSchema.js\";\nimport { jsonSchemaValueToFormData } from \"./jsonSchemaValueToFormData.js\";\nimport { formDataToJsonSchemaValue } from \"./formDataToJsonSchemaValue.js\";\n\nconst OPTIONS: JsonSchemaFieldOptions = { uiRenderers: { team: \"textarea\" } };\n\nconst createForm = (schema: JsonSchema, options: JsonSchemaFieldOptions = OPTIONS): IFormModel => {\n const container = new Container();\n IdentityContextFeature.register(container);\n FormModelFeature.register(container);\n return container.resolve(FormModelFactory).create({\n fields: registry => buildFieldsFromJsonSchema(schema, registry, options)\n });\n};\n\nconst objectSchema = (properties: Record<string, JsonSchema>, required?: string[]): JsonSchema => {\n const schema: JsonSchema = { type: \"object\", properties };\n if (required) {\n schema.required = required;\n }\n return schema;\n};\n\ndescribe(\"buildFieldsFromJsonSchema\", () => {\n describe(\"strings\", () => {\n it(\"maps a string to a text input with the title as label and the description as help\", () => {\n const form = createForm(\n objectSchema({\n url: { type: \"string\", title: \"URL\", description: \"Where to post.\" }\n })\n );\n\n const vm = form.field(\"url\").vm;\n\n expect(vm.type).toBe(\"text\");\n expect(vm.renderer).toBe(\"textInput\");\n expect(vm.label).toBe(\"URL\");\n expect(vm.help).toBe(\"Where to post.\");\n });\n\n it(\"labels a property without a title with its key\", () => {\n const form = createForm(objectSchema({ webhookUrl: { type: \"string\" } }));\n\n expect(form.field(\"webhookUrl\").vm.label).toBe(\"webhookUrl\");\n expect(form.field(\"webhookUrl\").vm.help).toBeUndefined();\n });\n\n it(\"carries the default into the field value\", () => {\n const form = createForm(objectSchema({ method: { type: \"string\", default: \"POST\" } }));\n\n expect(form.field(\"method\").getValue()).toBe(\"POST\");\n });\n\n it(\"renders the textarea hint as a textarea\", () => {\n const form = createForm(objectSchema({ body: { type: \"string\", ui: \"textarea\" } }));\n\n expect(form.field(\"body\").vm.renderer).toBe(\"textarea\");\n });\n\n it(\"renders another hint with the renderer registered for it\", () => {\n const form = createForm(objectSchema({ team: { type: \"string\", ui: \"team\" } }));\n\n expect(form.field(\"team\").vm.renderer).toBe(\"textarea\");\n });\n\n it(\"renders a hint with no registered renderer as a plain text input\", () => {\n const form = createForm(objectSchema({ owner: { type: \"string\", ui: \"user\" } }));\n\n expect(form.field(\"owner\").vm.renderer).toBe(\"textInput\");\n });\n\n it(\"ignores a hint named like an object prototype member\", () => {\n const form = createForm(objectSchema({ owner: { type: \"string\", ui: \"constructor\" } }));\n\n expect(form.field(\"owner\").vm.renderer).toBe(\"textInput\");\n });\n });\n\n describe(\"enums\", () => {\n it(\"maps a string enum to a select with one option per value\", () => {\n const form = createForm(\n objectSchema({ method: { type: \"string\", enum: [\"GET\", \"POST\"] } })\n );\n\n const vm = form.field(\"method\").vm;\n\n expect(vm.renderer).toBe(\"select\");\n expect(vm.options).toEqual([\n { label: \"GET\", value: \"GET\" },\n { label: \"POST\", value: \"POST\" }\n ]);\n });\n\n it(\"maps a number enum to a number select\", () => {\n const form = createForm(objectSchema({ retries: { type: \"integer\", enum: [1, 3] } }));\n\n const vm = form.field(\"retries\").vm;\n\n expect(vm.type).toBe(\"number\");\n expect(vm.renderer).toBe(\"select\");\n expect(vm.options).toEqual([\n { label: \"1\", value: 1 },\n { label: \"3\", value: 3 }\n ]);\n });\n });\n\n describe(\"numbers\", () => {\n it(\"maps a number to a number input without a check when the schema has no bounds\", () => {\n const form = createForm(objectSchema({ ratio: { type: \"number\" } }));\n\n expect(form.field(\"ratio\").vm.type).toBe(\"number\");\n expect(form.field(\"ratio\").vm.renderer).toBe(\"numberInput\");\n expect(form.field(\"ratio\").config.schema).toBeUndefined();\n });\n\n it(\"checks both bounds with one message\", async () => {\n const form = createForm(\n objectSchema({ timeout: { type: \"integer\", minimum: 1, maximum: 120 } })\n );\n const field = form.field(\"timeout\");\n\n field.setValue(500);\n expect(await field.validate({ force: true })).toBe(false);\n expect(field.vm.validation.message).toBe(\"Enter a number from 1 to 120.\");\n\n field.setValue(0);\n expect(await field.validate({ force: true })).toBe(false);\n expect(field.vm.validation.message).toBe(\"Enter a number from 1 to 120.\");\n\n field.setValue(30);\n expect(await field.validate({ force: true })).toBe(true);\n });\n\n it(\"checks a single bound and exclusive bounds\", async () => {\n const form = createForm(\n objectSchema({\n atLeast: { type: \"number\", minimum: 5 },\n atMost: { type: \"number\", maximum: 5 },\n above: { type: \"number\", exclusiveMinimum: 5 },\n below: { type: \"number\", exclusiveMaximum: 5 }\n })\n );\n\n form.field(\"atLeast\").setValue(4);\n form.field(\"atMost\").setValue(6);\n form.field(\"above\").setValue(5);\n form.field(\"below\").setValue(5);\n\n expect(await form.field(\"atLeast\").validate({ force: true })).toBe(false);\n expect(await form.field(\"atMost\").validate({ force: true })).toBe(false);\n expect(await form.field(\"above\").validate({ force: true })).toBe(false);\n expect(await form.field(\"below\").validate({ force: true })).toBe(false);\n\n expect(form.field(\"atLeast\").vm.validation.message).toBe(\n \"Enter a number of at least 5.\"\n );\n expect(form.field(\"atMost\").vm.validation.message).toBe(\"Enter a number of at most 5.\");\n\n form.field(\"atLeast\").setValue(5);\n form.field(\"atMost\").setValue(5);\n form.field(\"above\").setValue(6);\n form.field(\"below\").setValue(4);\n\n expect(await form.field(\"atLeast\").validate({ force: true })).toBe(true);\n expect(await form.field(\"atMost\").validate({ force: true })).toBe(true);\n expect(await form.field(\"above\").validate({ force: true })).toBe(true);\n expect(await form.field(\"below\").validate({ force: true })).toBe(true);\n });\n\n it(\"rejects a fraction for an integer\", async () => {\n const form = createForm(objectSchema({ retries: { type: \"integer\" } }));\n const field = form.field(\"retries\");\n\n field.setValue(1.5);\n expect(await field.validate({ force: true })).toBe(false);\n expect(field.vm.validation.message).toBe(\"Enter a whole number.\");\n\n field.setValue(2);\n expect(await field.validate({ force: true })).toBe(true);\n });\n\n it(\"skips the check for an empty optional number\", async () => {\n const form = createForm(objectSchema({ timeout: { type: \"integer\", minimum: 1 } }));\n\n expect(await form.field(\"timeout\").validate({ force: true })).toBe(true);\n });\n });\n\n describe(\"booleans, objects and lists\", () => {\n it(\"carries a boolean default into the field value\", () => {\n const form = createForm(objectSchema({ enabled: { type: \"boolean\", default: true } }));\n\n expect(form.field(\"enabled\").getValue()).toBe(true);\n });\n\n it(\"writes an untouched boolean without a default as false\", () => {\n const schema = objectSchema({ enabled: { type: \"boolean\" } });\n const form = createForm(schema);\n\n form.setData(jsonSchemaValueToFormData(schema, {}));\n\n expect(formDataToJsonSchemaValue(schema, form.getData())).toEqual({ enabled: false });\n });\n\n it(\"maps a boolean to a switch\", () => {\n const form = createForm(objectSchema({ enabled: { type: \"boolean\" } }));\n\n expect(form.field(\"enabled\").vm.type).toBe(\"boolean\");\n expect(form.field(\"enabled\").vm.renderer).toBe(\"switch\");\n });\n\n it(\"maps an object to an object field with the nested fields\", () => {\n const form = createForm(\n objectSchema({\n auth: objectSchema({ user: { type: \"string\" }, retries: { type: \"integer\" } })\n })\n );\n const auth = form.field(\"auth\");\n\n expect(auth.vm.type).toBe(\"object\");\n auth.setValue({ user: \"ana\", retries: 2 });\n expect(form.getData()).toEqual({ auth: { user: \"ana\", retries: 2 } });\n });\n\n it(\"maps an array of strings to a tags list\", () => {\n const form = createForm(\n objectSchema({ labels: { type: \"array\", items: { type: \"string\" } } })\n );\n\n const vm = form.field(\"labels\").vm;\n\n expect(vm.isList).toBe(true);\n expect(vm.renderer).toBe(\"tags\");\n expect(vm.value).toEqual([]);\n });\n\n it(\"maps an array of objects to an object list\", () => {\n const form = createForm(\n objectSchema({\n headers: {\n type: \"array\",\n items: objectSchema({ name: { type: \"string\" }, value: { type: \"string\" } })\n }\n })\n );\n\n form.field(\"headers\").setValue([{ name: \"X-Id\", value: \"1\" }]);\n\n expect(form.field(\"headers\").vm.isList).toBe(true);\n expect(form.getData()).toEqual({ headers: [{ name: \"X-Id\", value: \"1\" }] });\n });\n });\n\n describe(\"required\", () => {\n it(\"marks the properties in `required` and uses the label in the message\", async () => {\n const form = createForm(\n objectSchema({ url: { type: \"string\", title: \"URL\" }, note: { type: \"string\" } }, [\n \"url\"\n ])\n );\n\n expect(form.field(\"url\").vm.required).toBe(true);\n expect(form.field(\"note\").vm.required).toBe(false);\n expect(await form.field(\"url\").validate({ force: true })).toBe(false);\n expect(form.field(\"url\").vm.validation.message).toBe(\"URL is required.\");\n });\n\n it(\"does not require a property that has a default\", () => {\n const form = createForm(\n objectSchema({ method: { type: \"string\", default: \"POST\" } }, [\"method\"])\n );\n\n expect(form.field(\"method\").vm.required).toBe(false);\n });\n\n it(\"requires a number, a list and an enum\", () => {\n const form = createForm(\n objectSchema(\n {\n timeout: { type: \"number\" },\n labels: { type: \"array\", items: { type: \"string\" } },\n method: { type: \"string\", enum: [\"GET\", \"POST\"] }\n },\n [\"timeout\", \"labels\", \"method\"]\n )\n );\n\n expect(form.field(\"timeout\").vm.required).toBe(true);\n expect(form.field(\"labels\").vm.required).toBe(true);\n expect(form.field(\"method\").vm.required).toBe(true);\n });\n\n it(\"does not mark a switch or a nested object required\", () => {\n const form = createForm(\n objectSchema(\n {\n enabled: { type: \"boolean\" },\n auth: objectSchema({ user: { type: \"string\" } })\n },\n [\"enabled\", \"auth\"]\n )\n );\n\n expect(form.field(\"enabled\").vm.required).toBe(false);\n expect(form.field(\"auth\").vm.required).toBe(false);\n });\n\n it(\"marks the required properties of a nested object\", () => {\n const form = createForm(\n objectSchema({ auth: objectSchema({ user: { type: \"string\" } }, [\"user\"]) })\n );\n\n expect(form.field(\"auth\").vm.type).toBe(\"object\");\n expect(form.field(\"auth.user\").vm.required).toBe(true);\n });\n });\n\n describe(\"JSON fallback\", () => {\n it(\"renders a schema of no supported shape as a JSON text field\", () => {\n const form = createForm(objectSchema({ payload: { title: \"Extra payload\" } }));\n\n const vm = form.field(\"payload\").vm;\n\n expect(vm.type).toBe(\"text\");\n expect(vm.renderer).toBe(\"codeEditor\");\n expect(vm.rendererSettings).toEqual({ language: \"json\" });\n expect(vm.label).toBe(\"Extra payload\");\n });\n\n it(\"accepts JSON text and rejects text that does not parse\", async () => {\n const form = createForm(objectSchema({ payload: {} }));\n const field = form.field(\"payload\");\n\n field.setValue('{\"a\": 1}');\n expect(await field.validate({ force: true })).toBe(true);\n\n field.setValue(\"{a: 1\");\n expect(await field.validate({ force: true })).toBe(false);\n expect(field.vm.validation.message).toBe(\"Enter valid JSON.\");\n });\n\n it(\"accepts blank text for an optional JSON field\", async () => {\n const form = createForm(objectSchema({ payload: {} }));\n const field = form.field(\"payload\");\n\n field.setValue('{\"a\":1}');\n expect(await field.validate({ force: true })).toBe(true);\n\n field.setValue(\"\");\n expect(await field.validate({ force: true })).toBe(true);\n\n field.setValue(\" \");\n expect(await field.validate({ force: true })).toBe(true);\n });\n\n it(\"requires a JSON field in `required` and names it in the message\", async () => {\n const form = createForm(objectSchema({ payload: {} }, [\"payload\"]));\n const field = form.field(\"payload\");\n\n field.setValue('{\"a\":1}');\n expect(await field.validate({ force: true })).toBe(true);\n\n field.setValue(\"\");\n expect(await field.validate({ force: true })).toBe(false);\n expect(field.vm.validation.message).toBe(\"payload is required.\");\n });\n\n it(\"stringifies a default\", () => {\n const form = createForm(objectSchema({ payload: { default: { a: 1 } } }));\n\n expect(form.field(\"payload\").getValue()).toBe('{\\n \"a\": 1\\n}');\n });\n\n it(\"uses it for a list of numbers and for a type list\", () => {\n const form = createForm(\n objectSchema({\n numbers: { type: \"array\", items: { type: \"number\" } },\n anything: { anyOf: [{ type: \"string\" }, { type: \"null\" }] }\n })\n );\n\n expect(form.field(\"numbers\").vm.renderer).toBe(\"codeEditor\");\n expect(form.field(\"anything\").vm.renderer).toBe(\"codeEditor\");\n });\n });\n\n describe(\"odd schemas\", () => {\n it(\"returns no fields for a schema that is not an object\", () => {\n const form = createForm({ type: \"string\" });\n\n expect(form.getData()).toEqual({});\n });\n\n it(\"returns no fields for an object without properties\", () => {\n const form = createForm({ type: \"object\" });\n\n expect(form.getData()).toEqual({});\n });\n\n it(\"does not crash on a property that is not a schema\", () => {\n const properties = { broken: null, flag: true } as unknown as Record<\n string,\n JsonSchema\n >;\n\n const form = createForm({ type: \"object\", properties });\n\n expect(form.field(\"broken\").vm.renderer).toBe(\"codeEditor\");\n expect(form.field(\"flag\").vm.renderer).toBe(\"codeEditor\");\n });\n\n it(\"ignores a `required` that is not a list\", () => {\n const schema = { type: \"object\", properties: { a: { type: \"string\" } }, required: \"a\" };\n\n const form = createForm(schema as unknown as JsonSchema);\n\n expect(form.field(\"a\").vm.required).toBe(false);\n });\n });\n\n describe(\"with the form data conversions\", () => {\n const SCHEMA = objectSchema(\n {\n url: { type: \"string\", title: \"URL\" },\n retries: { type: \"integer\", default: 3 },\n labels: { type: \"array\", items: { type: \"string\" } },\n payload: { title: \"Extra payload\" }\n },\n [\"url\"]\n );\n\n it(\"loads a stored value into the form and reads it back\", () => {\n const form = createForm(SCHEMA);\n const stored = { url: \"https://a.test\", labels: [\"x\"], payload: { id: 1 } };\n\n form.setData(jsonSchemaValueToFormData(SCHEMA, stored));\n\n expect(form.field(\"payload\").getValue()).toBe('{\\n \"id\": 1\\n}');\n expect(formDataToJsonSchemaValue(SCHEMA, form.getData())).toEqual({\n url: \"https://a.test\",\n retries: 3,\n labels: [\"x\"],\n payload: { id: 1 }\n });\n });\n });\n});\n"],"names":["OPTIONS","createForm","schema","options","container","Container","IdentityContextFeature","FormModelFeature","FormModelFactory","registry","buildFieldsFromJsonSchema","objectSchema","properties","required","describe","it","form","vm","expect","field","jsonSchemaValueToFormData","formDataToJsonSchemaValue","auth","SCHEMA","stored"],"mappings":";;;;;;;;AAcA,MAAMA,UAAkC;IAAE,aAAa;QAAE,MAAM;IAAW;AAAE;AAE5E,MAAMC,aAAa,CAACC,QAAoBC,UAAkCH,OAAO;IAC7E,MAAMI,YAAY,IAAIC;IACtBC,uBAAuB,QAAQ,CAACF;IAChCG,iBAAiB,QAAQ,CAACH;IAC1B,OAAOA,UAAU,OAAO,CAACI,kBAAkB,MAAM,CAAC;QAC9C,QAAQC,CAAAA,WAAYC,0BAA0BR,QAAQO,UAAUN;IACpE;AACJ;AAEA,MAAMQ,eAAe,CAACC,YAAwCC;IAC1D,MAAMX,SAAqB;QAAE,MAAM;QAAUU;IAAW;IACxD,IAAIC,UACAX,OAAO,QAAQ,GAAGW;IAEtB,OAAOX;AACX;AAEAY,SAAS,6BAA6B;IAClCA,SAAS,WAAW;QAChBC,GAAG,qFAAqF;YACpF,MAAMC,OAAOf,WACTU,aAAa;gBAC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AF,SAAS,kCAAkC;QACvC,MAAMS,SAASZ,aACX;YACI,KAAK;gBAAE,MAAM;gBAAU,OAAO;YAAM;YACpC,SAAS;gBAAE,MAAM;gBAAW,SAAS;YAAE;YACvC,QAAQ;gBAAE,MAAM;gBAAS,OAAO;oBAAE,MAAM;gBAAS;YAAE;YACnD,SAAS;gBAAE,OAAO;YAAgB;QACtC,GACA;YAAC;SAAM;QAGXI,GAAG,wDAAwD;YACvD,MAAMC,OAAOf,WAAWsB;YACxB,MAAMC,SAAS;gBAAE,KAAK;gBAAkB,QAAQ;oBAAC;iBAAI;gBAAE,SAAS;oBAAE,IAAI;gBAAE;YAAE;YAE1ER,KAAK,OAAO,CAACI,0BAA0BG,QAAQC;YAE/CN,OAAOF,KAAK,KAAK,CAAC,WAAW,QAAQ,IAAI,IAAI,CAAC;YAC9CE,OAAOG,0BAA0BE,QAAQP,KAAK,OAAO,KAAK,OAAO,CAAC;gBAC9D,KAAK;gBACL,SAAS;gBACT,QAAQ;oBAAC;iBAAI;gBACb,SAAS;oBAAE,IAAI;gBAAE;YACrB;QACJ;IACJ;AACJ"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const buildValid = ()=>({
|
|
3
|
+
valid: true,
|
|
4
|
+
issues: []
|
|
5
|
+
});
|
|
6
|
+
const buildZodSchema = (schema)=>{
|
|
7
|
+
try {
|
|
8
|
+
return z.fromJSONSchema(schema);
|
|
9
|
+
} catch {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const createJsonSchemaValidator = (schema)=>{
|
|
14
|
+
const zodSchema = buildZodSchema(schema);
|
|
15
|
+
return {
|
|
16
|
+
validate (value) {
|
|
17
|
+
if (!zodSchema) return buildValid();
|
|
18
|
+
try {
|
|
19
|
+
const result = zodSchema.safeParse(value);
|
|
20
|
+
if (result.success) return buildValid();
|
|
21
|
+
const issues = result.error.issues.map((issue)=>{
|
|
22
|
+
const path = issue.path.map(String).join(".");
|
|
23
|
+
return {
|
|
24
|
+
path,
|
|
25
|
+
message: issue.message
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
valid: false,
|
|
30
|
+
issues
|
|
31
|
+
};
|
|
32
|
+
} catch {
|
|
33
|
+
return buildValid();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export { createJsonSchemaValidator };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=createJsonSchemaValidator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/formModel/jsonSchema/createJsonSchemaValidator.js","sources":["../../../../src/features/formModel/jsonSchema/createJsonSchemaValidator.ts"],"sourcesContent":["import { z } from \"zod\";\nimport type { JsonSchema } from \"./JsonSchema.js\";\nimport type { JsonSchemaValidationResult } from \"./JsonSchemaValidationResult.js\";\nimport type { JsonSchemaValidator } from \"./JsonSchemaValidator.js\";\n\nconst buildValid = (): JsonSchemaValidationResult => {\n return { valid: true, issues: [] };\n};\n\nconst buildZodSchema = (schema: JsonSchema): z.ZodType | null => {\n try {\n return z.fromJSONSchema(schema);\n } catch {\n // `z.fromJSONSchema` throws for a schema it cannot build (an unknown type, a missing $ref).\n return null;\n }\n};\n\n/*\n * Rebuilds the schema's validator with `z.fromJSONSchema` (R271). It never throws: a schema zod\n * cannot build gives a validator that reports every value as valid. An issue's `path` is the\n * dot-joined zod path (empty for the value itself), like the server's settings issues.\n */\nexport const createJsonSchemaValidator = (schema: JsonSchema): JsonSchemaValidator => {\n const zodSchema = buildZodSchema(schema);\n\n return {\n validate(value: unknown): JsonSchemaValidationResult {\n if (!zodSchema) {\n return buildValid();\n }\n try {\n const result = zodSchema.safeParse(value);\n if (result.success) {\n return buildValid();\n }\n const issues = result.error.issues.map(issue => {\n const path = issue.path.map(String).join(\".\");\n return { path, message: issue.message };\n });\n return { valid: false, issues };\n } catch {\n return buildValid();\n }\n }\n };\n};\n"],"names":["buildValid","buildZodSchema","schema","z","createJsonSchemaValidator","zodSchema","value","result","issues","issue","path","String"],"mappings":";AAKA,MAAMA,aAAa,IACR;QAAE,OAAO;QAAM,QAAQ,EAAE;IAAC;AAGrC,MAAMC,iBAAiB,CAACC;IACpB,IAAI;QACA,OAAOC,EAAE,cAAc,CAACD;IAC5B,EAAE,OAAM;QAEJ,OAAO;IACX;AACJ;AAOO,MAAME,4BAA4B,CAACF;IACtC,MAAMG,YAAYJ,eAAeC;IAEjC,OAAO;QACH,UAASI,KAAc;YACnB,IAAI,CAACD,WACD,OAAOL;YAEX,IAAI;gBACA,MAAMO,SAASF,UAAU,SAAS,CAACC;gBACnC,IAAIC,OAAO,OAAO,EACd,OAAOP;gBAEX,MAAMQ,SAASD,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAACE,CAAAA;oBACnC,MAAMC,OAAOD,MAAM,IAAI,CAAC,GAAG,CAACE,QAAQ,IAAI,CAAC;oBACzC,OAAO;wBAAED;wBAAM,SAASD,MAAM,OAAO;oBAAC;gBAC1C;gBACA,OAAO;oBAAE,OAAO;oBAAOD;gBAAO;YAClC,EAAE,OAAM;gBACJ,OAAOR;YACX;QACJ;IACJ;AACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { createJsonSchemaValidator } from "./createJsonSchemaValidator.js";
|
|
3
|
+
const SCHEMA = {
|
|
4
|
+
type: "object",
|
|
5
|
+
required: [
|
|
6
|
+
"url"
|
|
7
|
+
],
|
|
8
|
+
properties: {
|
|
9
|
+
url: {
|
|
10
|
+
type: "string"
|
|
11
|
+
},
|
|
12
|
+
timeout: {
|
|
13
|
+
type: "integer",
|
|
14
|
+
minimum: 1,
|
|
15
|
+
maximum: 120
|
|
16
|
+
},
|
|
17
|
+
headers: {
|
|
18
|
+
type: "array",
|
|
19
|
+
items: {
|
|
20
|
+
type: "object",
|
|
21
|
+
required: [
|
|
22
|
+
"name"
|
|
23
|
+
],
|
|
24
|
+
properties: {
|
|
25
|
+
name: {
|
|
26
|
+
type: "string"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
describe("createJsonSchemaValidator", ()=>{
|
|
34
|
+
it("reports a valid value with no issues", ()=>{
|
|
35
|
+
const validator = createJsonSchemaValidator(SCHEMA);
|
|
36
|
+
expect(validator.validate({
|
|
37
|
+
url: "https://a.test",
|
|
38
|
+
timeout: 30
|
|
39
|
+
})).toEqual({
|
|
40
|
+
valid: true,
|
|
41
|
+
issues: []
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
it("reports each issue with its dot-joined path", ()=>{
|
|
45
|
+
const validator = createJsonSchemaValidator(SCHEMA);
|
|
46
|
+
const result = validator.validate({
|
|
47
|
+
timeout: 500,
|
|
48
|
+
headers: [
|
|
49
|
+
{}
|
|
50
|
+
]
|
|
51
|
+
});
|
|
52
|
+
expect(result.valid).toBe(false);
|
|
53
|
+
const paths = result.issues.map((issue)=>issue.path).sort();
|
|
54
|
+
expect(paths).toEqual([
|
|
55
|
+
"headers.0.name",
|
|
56
|
+
"timeout",
|
|
57
|
+
"url"
|
|
58
|
+
]);
|
|
59
|
+
const timeout = result.issues.find((issue)=>"timeout" === issue.path);
|
|
60
|
+
expect(timeout?.message).toBe("Too big: expected number to be <=120");
|
|
61
|
+
});
|
|
62
|
+
it("gives an issue about the value itself an empty path", ()=>{
|
|
63
|
+
const validator = createJsonSchemaValidator(SCHEMA);
|
|
64
|
+
const result = validator.validate("text");
|
|
65
|
+
expect(result.valid).toBe(false);
|
|
66
|
+
expect(result.issues[0].path).toBe("");
|
|
67
|
+
});
|
|
68
|
+
it("applies the defaults of the schema", ()=>{
|
|
69
|
+
const schema = {
|
|
70
|
+
type: "object",
|
|
71
|
+
required: [
|
|
72
|
+
"method"
|
|
73
|
+
],
|
|
74
|
+
properties: {
|
|
75
|
+
method: {
|
|
76
|
+
type: "string",
|
|
77
|
+
default: "POST"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
expect(createJsonSchemaValidator(schema).validate({}).valid).toBe(true);
|
|
82
|
+
});
|
|
83
|
+
it("reports every value as valid for a schema zod cannot build", ()=>{
|
|
84
|
+
const schemas = [
|
|
85
|
+
{
|
|
86
|
+
type: "weird"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
type: "object",
|
|
90
|
+
properties: {
|
|
91
|
+
a: {
|
|
92
|
+
$ref: "#/definitions/missing"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
null,
|
|
97
|
+
"text"
|
|
98
|
+
];
|
|
99
|
+
for (const schema of schemas){
|
|
100
|
+
const validator = createJsonSchemaValidator(schema);
|
|
101
|
+
expect(validator.validate({
|
|
102
|
+
anything: 1
|
|
103
|
+
})).toEqual({
|
|
104
|
+
valid: true,
|
|
105
|
+
issues: []
|
|
106
|
+
});
|
|
107
|
+
expect(validator.validate(void 0)).toEqual({
|
|
108
|
+
valid: true,
|
|
109
|
+
issues: []
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
it("does not throw for a value zod cannot handle", ()=>{
|
|
114
|
+
const validator = createJsonSchemaValidator(SCHEMA);
|
|
115
|
+
const circular = {};
|
|
116
|
+
circular.self = circular;
|
|
117
|
+
expect(()=>validator.validate(circular)).not.toThrow();
|
|
118
|
+
expect(()=>validator.validate(void 0)).not.toThrow();
|
|
119
|
+
expect(()=>validator.validate(BigInt(1))).not.toThrow();
|
|
120
|
+
});
|
|
121
|
+
it("returns a fresh valid result on each call", ()=>{
|
|
122
|
+
const validator = createJsonSchemaValidator(SCHEMA);
|
|
123
|
+
const first = validator.validate({
|
|
124
|
+
url: "https://a.test"
|
|
125
|
+
});
|
|
126
|
+
const second = validator.validate({
|
|
127
|
+
url: "https://a.test"
|
|
128
|
+
});
|
|
129
|
+
first.issues.push({
|
|
130
|
+
path: "url",
|
|
131
|
+
message: "mutated"
|
|
132
|
+
});
|
|
133
|
+
expect(first).not.toBe(second);
|
|
134
|
+
expect(second).toEqual({
|
|
135
|
+
valid: true,
|
|
136
|
+
issues: []
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
//# sourceMappingURL=createJsonSchemaValidator.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/formModel/jsonSchema/createJsonSchemaValidator.test.js","sources":["../../../../src/features/formModel/jsonSchema/createJsonSchemaValidator.test.ts"],"sourcesContent":["import { describe } from \"vitest\";\nimport { expect } from \"vitest\";\nimport { it } from \"vitest\";\nimport type { JsonSchema } from \"./JsonSchema.js\";\nimport { createJsonSchemaValidator } from \"./createJsonSchemaValidator.js\";\n\nconst SCHEMA: JsonSchema = {\n type: \"object\",\n required: [\"url\"],\n properties: {\n url: { type: \"string\" },\n timeout: { type: \"integer\", minimum: 1, maximum: 120 },\n headers: {\n type: \"array\",\n items: {\n type: \"object\",\n required: [\"name\"],\n properties: { name: { type: \"string\" } }\n }\n }\n }\n};\n\ndescribe(\"createJsonSchemaValidator\", () => {\n it(\"reports a valid value with no issues\", () => {\n const validator = createJsonSchemaValidator(SCHEMA);\n\n expect(validator.validate({ url: \"https://a.test\", timeout: 30 })).toEqual({\n valid: true,\n issues: []\n });\n });\n\n it(\"reports each issue with its dot-joined path\", () => {\n const validator = createJsonSchemaValidator(SCHEMA);\n\n const result = validator.validate({ timeout: 500, headers: [{}] });\n\n expect(result.valid).toBe(false);\n const paths = result.issues.map(issue => issue.path).sort();\n expect(paths).toEqual([\"headers.0.name\", \"timeout\", \"url\"]);\n const timeout = result.issues.find(issue => issue.path === \"timeout\");\n expect(timeout?.message).toBe(\"Too big: expected number to be <=120\");\n });\n\n it(\"gives an issue about the value itself an empty path\", () => {\n const validator = createJsonSchemaValidator(SCHEMA);\n\n const result = validator.validate(\"text\");\n\n expect(result.valid).toBe(false);\n expect(result.issues[0].path).toBe(\"\");\n });\n\n it(\"applies the defaults of the schema\", () => {\n const schema: JsonSchema = {\n type: \"object\",\n required: [\"method\"],\n properties: { method: { type: \"string\", default: \"POST\" } }\n };\n\n expect(createJsonSchemaValidator(schema).validate({}).valid).toBe(true);\n });\n\n it(\"reports every value as valid for a schema zod cannot build\", () => {\n const schemas = [\n { type: \"weird\" },\n { type: \"object\", properties: { a: { $ref: \"#/definitions/missing\" } } },\n null,\n \"text\"\n ] as unknown as JsonSchema[];\n\n for (const schema of schemas) {\n const validator = createJsonSchemaValidator(schema);\n\n expect(validator.validate({ anything: 1 })).toEqual({ valid: true, issues: [] });\n expect(validator.validate(undefined)).toEqual({ valid: true, issues: [] });\n }\n });\n\n it(\"does not throw for a value zod cannot handle\", () => {\n const validator = createJsonSchemaValidator(SCHEMA);\n const circular: Record<string, unknown> = {};\n circular.self = circular;\n\n expect(() => validator.validate(circular)).not.toThrow();\n expect(() => validator.validate(undefined)).not.toThrow();\n expect(() => validator.validate(BigInt(1))).not.toThrow();\n });\n\n it(\"returns a fresh valid result on each call\", () => {\n const validator = createJsonSchemaValidator(SCHEMA);\n\n const first = validator.validate({ url: \"https://a.test\" });\n const second = validator.validate({ url: \"https://a.test\" });\n first.issues.push({ path: \"url\", message: \"mutated\" });\n\n expect(first).not.toBe(second);\n expect(second).toEqual({ valid: true, issues: [] });\n });\n});\n"],"names":["SCHEMA","describe","it","validator","createJsonSchemaValidator","expect","result","paths","issue","timeout","schema","schemas","undefined","circular","BigInt","first","second"],"mappings":";;AAMA,MAAMA,SAAqB;IACvB,MAAM;IACN,UAAU;QAAC;KAAM;IACjB,YAAY;QACR,KAAK;YAAE,MAAM;QAAS;QACtB,SAAS;YAAE,MAAM;YAAW,SAAS;YAAG,SAAS;QAAI;QACrD,SAAS;YACL,MAAM;YACN,OAAO;gBACH,MAAM;gBACN,UAAU;o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Schema.js";
|
|
3
|
+
import { isPlainObject } from "./isPlainObject.js";
|
|
4
|
+
const parseJsonText = (text)=>{
|
|
5
|
+
try {
|
|
6
|
+
return JSON.parse(text);
|
|
7
|
+
} catch {
|
|
8
|
+
return text;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
const isEmptyScalar = (value)=>null == value || "" === value;
|
|
12
|
+
const toSchemaValue = (schema, data, isRequired)=>{
|
|
13
|
+
const kind = getJsonSchemaKind(schema);
|
|
14
|
+
if ("object" === kind) {
|
|
15
|
+
const nested = formDataToJsonSchemaValue(schema, data);
|
|
16
|
+
return Object.keys(nested).length > 0 || isRequired ? nested : void 0;
|
|
17
|
+
}
|
|
18
|
+
if ("objectList" === kind) {
|
|
19
|
+
const items = Array.isArray(data) ? data : [];
|
|
20
|
+
const itemSchema = normalizeJsonSchema(schema.items);
|
|
21
|
+
const values = items.map((item)=>formDataToJsonSchemaValue(itemSchema, item));
|
|
22
|
+
return values.length > 0 || isRequired ? values : void 0;
|
|
23
|
+
}
|
|
24
|
+
if ("stringList" === kind) {
|
|
25
|
+
const items = Array.isArray(data) ? data : [];
|
|
26
|
+
return items.length > 0 || isRequired ? items : void 0;
|
|
27
|
+
}
|
|
28
|
+
if ("string" === kind && "" === data && void 0 !== schema.default) return "";
|
|
29
|
+
if (isEmptyScalar(data)) return;
|
|
30
|
+
if ("json" === kind) {
|
|
31
|
+
const text = String(data);
|
|
32
|
+
return "" === text.trim() ? void 0 : parseJsonText(text);
|
|
33
|
+
}
|
|
34
|
+
return data;
|
|
35
|
+
};
|
|
36
|
+
const formDataToJsonSchemaValue = (schema, data)=>{
|
|
37
|
+
const value = {};
|
|
38
|
+
if ("object" !== getJsonSchemaKind(schema)) return value;
|
|
39
|
+
const source = isPlainObject(data) ? data : {};
|
|
40
|
+
const requiredNames = Array.isArray(schema.required) ? schema.required : [];
|
|
41
|
+
const properties = schema.properties ?? {};
|
|
42
|
+
for (const [name, property] of Object.entries(properties)){
|
|
43
|
+
const isRequired = requiredNames.includes(name);
|
|
44
|
+
const propertySchema = normalizeJsonSchema(property);
|
|
45
|
+
const propertyValue = toSchemaValue(propertySchema, source[name], isRequired);
|
|
46
|
+
if (void 0 !== propertyValue) value[name] = propertyValue;
|
|
47
|
+
}
|
|
48
|
+
return value;
|
|
49
|
+
};
|
|
50
|
+
export { formDataToJsonSchemaValue };
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=formDataToJsonSchemaValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/formModel/jsonSchema/formDataToJsonSchemaValue.js","sources":["../../../../src/features/formModel/jsonSchema/formDataToJsonSchemaValue.ts"],"sourcesContent":["import type { JsonSchema } from \"./JsonSchema.js\";\nimport { getJsonSchemaKind } from \"./getJsonSchemaKind.js\";\nimport { normalizeJsonSchema } from \"./normalizeJsonSchema.js\";\nimport { isPlainObject } from \"./isPlainObject.js\";\nimport type { PlainObject } from \"./PlainObject.js\";\n\nconst parseJsonText = (text: string): unknown => {\n try {\n return JSON.parse(text);\n } catch {\n // The text stays as typed; the field's own check reports it before a save.\n return text;\n }\n};\n\nconst isEmptyScalar = (value: unknown): boolean => {\n return value === null || value === undefined || value === \"\";\n};\n\n/*\n * The value of one property, or `undefined` to leave the key out. An empty scalar is left out,\n * except a cleared string with a default; an empty list or object is left out too unless the\n * property is required.\n */\nconst toSchemaValue = (schema: JsonSchema, data: unknown, isRequired: boolean): unknown => {\n const kind = getJsonSchemaKind(schema);\n\n if (kind === \"object\") {\n const nested = formDataToJsonSchemaValue(schema, data);\n return Object.keys(nested).length > 0 || isRequired ? nested : undefined;\n }\n if (kind === \"objectList\") {\n const items = Array.isArray(data) ? data : [];\n const itemSchema = normalizeJsonSchema(schema.items);\n const values = items.map(item => formDataToJsonSchemaValue(itemSchema, item));\n return values.length > 0 || isRequired ? values : undefined;\n }\n if (kind === \"stringList\") {\n const items = Array.isArray(data) ? data : [];\n return items.length > 0 || isRequired ? items : undefined;\n }\n // A cleared string with a default is kept: left out, the default would come back on reload.\n if (kind === \"string\" && data === \"\" && schema.default !== undefined) {\n return \"\";\n }\n if (isEmptyScalar(data)) {\n return undefined;\n }\n if (kind === \"json\") {\n const text = String(data);\n return text.trim() === \"\" ? undefined : parseJsonText(text);\n }\n return data;\n};\n\n/*\n * Converts form data back into the stored value (R271): empty fields are left out, a JSON text\n * field is parsed (text that does not parse is kept as typed), a nested object and each list item\n * convert the same way. The inverse of `jsonSchemaValueToFormData`.\n */\nexport const formDataToJsonSchemaValue = (schema: JsonSchema, data: unknown): PlainObject => {\n const value: PlainObject = {};\n if (getJsonSchemaKind(schema) !== \"object\") {\n return value;\n }\n\n const source: PlainObject = isPlainObject(data) ? data : {};\n const requiredNames = Array.isArray(schema.required) ? schema.required : [];\n const properties = schema.properties ?? {};\n\n for (const [name, property] of Object.entries(properties)) {\n const isRequired = requiredNames.includes(name);\n const propertySchema = normalizeJsonSchema(property);\n const propertyValue = toSchemaValue(propertySchema, source[name], isRequired);\n if (propertyValue !== undefined) {\n value[name] = propertyValue;\n }\n }\n\n return value;\n};\n"],"names":["parseJsonText","text","JSON","isEmptyScalar","value","toSchemaValue","schema","data","isRequired","kind","getJsonSchemaKind","nested","formDataToJsonSchemaValue","Object","undefined","items","Array","itemSchema","normalizeJsonSchema","values","item","String","source","isPlainObject","requiredNames","properties","name","property","propertySchema","propertyValue"],"mappings":";;;AAMA,MAAMA,gBAAgB,CAACC;IACnB,IAAI;QACA,OAAOC,KAAK,KAAK,CAACD;IACtB,EAAE,OAAM;QAEJ,OAAOA;IACX;AACJ;AAEA,MAAME,gBAAgB,CAACC,QACZA,QAAAA,SAAyCA,AAAU,OAAVA;AAQpD,MAAMC,gBAAgB,CAACC,QAAoBC,MAAeC;IACtD,MAAMC,OAAOC,kBAAkBJ;IAE/B,IAAIG,AAAS,aAATA,MAAmB;QACnB,MAAME,SAASC,0BAA0BN,QAAQC;QACjD,OAAOM,OAAO,IAAI,CAACF,QAAQ,MAAM,GAA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AAIqB,AAAkBf,WAAlBe,eACAzB,KAAK,CAACsB,KAAK,GAAGG;IAEtB;IAEA,OAAOzB;AACX"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { formDataToJsonSchemaValue } from "./formDataToJsonSchemaValue.js";
|
|
3
|
+
import { jsonSchemaValueToFormData } from "./jsonSchemaValueToFormData.js";
|
|
4
|
+
const SCHEMA = {
|
|
5
|
+
type: "object",
|
|
6
|
+
required: [
|
|
7
|
+
"url",
|
|
8
|
+
"labels",
|
|
9
|
+
"auth"
|
|
10
|
+
],
|
|
11
|
+
properties: {
|
|
12
|
+
url: {
|
|
13
|
+
type: "string"
|
|
14
|
+
},
|
|
15
|
+
note: {
|
|
16
|
+
type: "string"
|
|
17
|
+
},
|
|
18
|
+
timeout: {
|
|
19
|
+
type: "integer"
|
|
20
|
+
},
|
|
21
|
+
enabled: {
|
|
22
|
+
type: "boolean"
|
|
23
|
+
},
|
|
24
|
+
labels: {
|
|
25
|
+
type: "array",
|
|
26
|
+
items: {
|
|
27
|
+
type: "string"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
tags: {
|
|
31
|
+
type: "array",
|
|
32
|
+
items: {
|
|
33
|
+
type: "string"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
auth: {
|
|
37
|
+
type: "object",
|
|
38
|
+
properties: {
|
|
39
|
+
user: {
|
|
40
|
+
type: "string"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
extra: {
|
|
45
|
+
type: "object",
|
|
46
|
+
properties: {
|
|
47
|
+
user: {
|
|
48
|
+
type: "string"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
headers: {
|
|
53
|
+
type: "array",
|
|
54
|
+
items: {
|
|
55
|
+
type: "object",
|
|
56
|
+
properties: {
|
|
57
|
+
name: {
|
|
58
|
+
type: "string"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
payload: {}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
describe("formDataToJsonSchemaValue", ()=>{
|
|
67
|
+
it("leaves out empty scalars and optional empty lists and objects", ()=>{
|
|
68
|
+
const data = {
|
|
69
|
+
url: "",
|
|
70
|
+
note: null,
|
|
71
|
+
timeout: null,
|
|
72
|
+
enabled: null,
|
|
73
|
+
labels: [],
|
|
74
|
+
tags: [],
|
|
75
|
+
auth: {
|
|
76
|
+
user: null
|
|
77
|
+
},
|
|
78
|
+
extra: {
|
|
79
|
+
user: null
|
|
80
|
+
},
|
|
81
|
+
headers: [],
|
|
82
|
+
payload: null
|
|
83
|
+
};
|
|
84
|
+
expect(formDataToJsonSchemaValue(SCHEMA, data)).toEqual({
|
|
85
|
+
labels: [],
|
|
86
|
+
auth: {}
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
it("keeps a required empty list and a required empty object", ()=>{
|
|
90
|
+
const value = formDataToJsonSchemaValue(SCHEMA, {
|
|
91
|
+
labels: [],
|
|
92
|
+
auth: {}
|
|
93
|
+
});
|
|
94
|
+
expect(value).toEqual({
|
|
95
|
+
labels: [],
|
|
96
|
+
auth: {}
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
it("keeps values, including zero and false", ()=>{
|
|
100
|
+
const data = {
|
|
101
|
+
url: "https://a.test",
|
|
102
|
+
timeout: 0,
|
|
103
|
+
enabled: false,
|
|
104
|
+
labels: [
|
|
105
|
+
"a"
|
|
106
|
+
],
|
|
107
|
+
tags: [
|
|
108
|
+
"t"
|
|
109
|
+
],
|
|
110
|
+
auth: {
|
|
111
|
+
user: "ana"
|
|
112
|
+
},
|
|
113
|
+
extra: {
|
|
114
|
+
user: "bo"
|
|
115
|
+
},
|
|
116
|
+
headers: [
|
|
117
|
+
{
|
|
118
|
+
name: "X-Id"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: ""
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
};
|
|
125
|
+
expect(formDataToJsonSchemaValue(SCHEMA, data)).toEqual({
|
|
126
|
+
url: "https://a.test",
|
|
127
|
+
timeout: 0,
|
|
128
|
+
enabled: false,
|
|
129
|
+
labels: [
|
|
130
|
+
"a"
|
|
131
|
+
],
|
|
132
|
+
tags: [
|
|
133
|
+
"t"
|
|
134
|
+
],
|
|
135
|
+
auth: {
|
|
136
|
+
user: "ana"
|
|
137
|
+
},
|
|
138
|
+
extra: {
|
|
139
|
+
user: "bo"
|
|
140
|
+
},
|
|
141
|
+
headers: [
|
|
142
|
+
{
|
|
143
|
+
name: "X-Id"
|
|
144
|
+
},
|
|
145
|
+
{}
|
|
146
|
+
]
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
it("parses the text of a JSON field", ()=>{
|
|
150
|
+
const data = {
|
|
151
|
+
labels: [],
|
|
152
|
+
auth: {},
|
|
153
|
+
payload: '{ "a": [1, 2] }'
|
|
154
|
+
};
|
|
155
|
+
expect(formDataToJsonSchemaValue(SCHEMA, data).payload).toEqual({
|
|
156
|
+
a: [
|
|
157
|
+
1,
|
|
158
|
+
2
|
|
159
|
+
]
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
it("parses JSON text that is a string, a number or null", ()=>{
|
|
163
|
+
expect(formDataToJsonSchemaValue(SCHEMA, {
|
|
164
|
+
payload: '"x"'
|
|
165
|
+
}).payload).toBe("x");
|
|
166
|
+
expect(formDataToJsonSchemaValue(SCHEMA, {
|
|
167
|
+
payload: "12"
|
|
168
|
+
}).payload).toBe(12);
|
|
169
|
+
expect(formDataToJsonSchemaValue(SCHEMA, {
|
|
170
|
+
payload: "null"
|
|
171
|
+
}).payload).toBeNull();
|
|
172
|
+
});
|
|
173
|
+
it("keeps JSON text that does not parse as typed", ()=>{
|
|
174
|
+
expect(formDataToJsonSchemaValue(SCHEMA, {
|
|
175
|
+
payload: "{a: 1"
|
|
176
|
+
}).payload).toBe("{a: 1");
|
|
177
|
+
});
|
|
178
|
+
it("leaves out a blank JSON text", ()=>{
|
|
179
|
+
expect(formDataToJsonSchemaValue(SCHEMA, {
|
|
180
|
+
payload: " "
|
|
181
|
+
})).not.toHaveProperty("payload");
|
|
182
|
+
});
|
|
183
|
+
it("treats data that is not an object as empty", ()=>{
|
|
184
|
+
expect(formDataToJsonSchemaValue(SCHEMA, null)).toEqual({
|
|
185
|
+
labels: [],
|
|
186
|
+
auth: {}
|
|
187
|
+
});
|
|
188
|
+
expect(formDataToJsonSchemaValue(SCHEMA, "x")).toEqual({
|
|
189
|
+
labels: [],
|
|
190
|
+
auth: {}
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
it("returns no value for a schema that is not an object", ()=>{
|
|
194
|
+
expect(formDataToJsonSchemaValue({
|
|
195
|
+
type: "string"
|
|
196
|
+
}, "x")).toEqual({});
|
|
197
|
+
});
|
|
198
|
+
it("keeps a cleared string that has a default, so the default does not come back", ()=>{
|
|
199
|
+
const schema = {
|
|
200
|
+
type: "object",
|
|
201
|
+
properties: {
|
|
202
|
+
greeting: {
|
|
203
|
+
type: "string",
|
|
204
|
+
default: "Hello"
|
|
205
|
+
},
|
|
206
|
+
note: {
|
|
207
|
+
type: "string"
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
const saved = formDataToJsonSchemaValue(schema, {
|
|
212
|
+
greeting: "",
|
|
213
|
+
note: ""
|
|
214
|
+
});
|
|
215
|
+
expect(saved).toEqual({
|
|
216
|
+
greeting: ""
|
|
217
|
+
});
|
|
218
|
+
expect(jsonSchemaValueToFormData(schema, saved)).toMatchObject({
|
|
219
|
+
greeting: ""
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
it("is the inverse of jsonSchemaValueToFormData", ()=>{
|
|
223
|
+
const stored = {
|
|
224
|
+
url: "https://a.test",
|
|
225
|
+
timeout: 30,
|
|
226
|
+
enabled: true,
|
|
227
|
+
labels: [
|
|
228
|
+
"a"
|
|
229
|
+
],
|
|
230
|
+
auth: {
|
|
231
|
+
user: "ana"
|
|
232
|
+
},
|
|
233
|
+
headers: [
|
|
234
|
+
{
|
|
235
|
+
name: "X-Id"
|
|
236
|
+
}
|
|
237
|
+
],
|
|
238
|
+
payload: {
|
|
239
|
+
id: 1,
|
|
240
|
+
tags: [
|
|
241
|
+
"x"
|
|
242
|
+
]
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
const data = jsonSchemaValueToFormData(SCHEMA, stored);
|
|
246
|
+
expect(formDataToJsonSchemaValue(SCHEMA, data)).toEqual(stored);
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
//# sourceMappingURL=formDataToJsonSchemaValue.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/formModel/jsonSchema/formDataToJsonSchemaValue.test.js","sources":["../../../../src/features/formModel/jsonSchema/formDataToJsonSchemaValue.test.ts"],"sourcesContent":["import { describe } from \"vitest\";\nimport { expect } from \"vitest\";\nimport { it } from \"vitest\";\nimport type { JsonSchema } from \"./JsonSchema.js\";\nimport { formDataToJsonSchemaValue } from \"./formDataToJsonSchemaValue.js\";\nimport { jsonSchemaValueToFormData } from \"./jsonSchemaValueToFormData.js\";\n\nconst SCHEMA: JsonSchema = {\n type: \"object\",\n required: [\"url\", \"labels\", \"auth\"],\n properties: {\n url: { type: \"string\" },\n note: { type: \"string\" },\n timeout: { type: \"integer\" },\n enabled: { type: \"boolean\" },\n labels: { type: \"array\", items: { type: \"string\" } },\n tags: { type: \"array\", items: { type: \"string\" } },\n auth: { type: \"object\", properties: { user: { type: \"string\" } } },\n extra: { type: \"object\", properties: { user: { type: \"string\" } } },\n headers: {\n type: \"array\",\n items: { type: \"object\", properties: { name: { type: \"string\" } } }\n },\n payload: {}\n }\n};\n\ndescribe(\"formDataToJsonSchemaValue\", () => {\n it(\"leaves out empty scalars and optional empty lists and objects\", () => {\n const data = {\n url: \"\",\n note: null,\n timeout: null,\n enabled: null,\n labels: [],\n tags: [],\n auth: { user: null },\n extra: { user: null },\n headers: [],\n payload: null\n };\n\n expect(formDataToJsonSchemaValue(SCHEMA, data)).toEqual({ labels: [], auth: {} });\n });\n\n it(\"keeps a required empty list and a required empty object\", () => {\n const value = formDataToJsonSchemaValue(SCHEMA, { labels: [], auth: {} });\n\n expect(value).toEqual({ labels: [], auth: {} });\n });\n\n it(\"keeps values, including zero and false\", () => {\n const data = {\n url: \"https://a.test\",\n timeout: 0,\n enabled: false,\n labels: [\"a\"],\n tags: [\"t\"],\n auth: { user: \"ana\" },\n extra: { user: \"bo\" },\n headers: [{ name: \"X-Id\" }, { name: \"\" }]\n };\n\n expect(formDataToJsonSchemaValue(SCHEMA, data)).toEqual({\n url: \"https://a.test\",\n timeout: 0,\n enabled: false,\n labels: [\"a\"],\n tags: [\"t\"],\n auth: { user: \"ana\" },\n extra: { user: \"bo\" },\n headers: [{ name: \"X-Id\" }, {}]\n });\n });\n\n it(\"parses the text of a JSON field\", () => {\n const data = { labels: [], auth: {}, payload: '{ \"a\": [1, 2] }' };\n\n expect(formDataToJsonSchemaValue(SCHEMA, data).payload).toEqual({ a: [1, 2] });\n });\n\n it(\"parses JSON text that is a string, a number or null\", () => {\n expect(formDataToJsonSchemaValue(SCHEMA, { payload: '\"x\"' }).payload).toBe(\"x\");\n expect(formDataToJsonSchemaValue(SCHEMA, { payload: \"12\" }).payload).toBe(12);\n expect(formDataToJsonSchemaValue(SCHEMA, { payload: \"null\" }).payload).toBeNull();\n });\n\n it(\"keeps JSON text that does not parse as typed\", () => {\n expect(formDataToJsonSchemaValue(SCHEMA, { payload: \"{a: 1\" }).payload).toBe(\"{a: 1\");\n });\n\n it(\"leaves out a blank JSON text\", () => {\n expect(formDataToJsonSchemaValue(SCHEMA, { payload: \" \" })).not.toHaveProperty(\"payload\");\n });\n\n it(\"treats data that is not an object as empty\", () => {\n expect(formDataToJsonSchemaValue(SCHEMA, null)).toEqual({ labels: [], auth: {} });\n expect(formDataToJsonSchemaValue(SCHEMA, \"x\")).toEqual({ labels: [], auth: {} });\n });\n\n it(\"returns no value for a schema that is not an object\", () => {\n expect(formDataToJsonSchemaValue({ type: \"string\" }, \"x\")).toEqual({});\n });\n\n it(\"keeps a cleared string that has a default, so the default does not come back\", () => {\n const schema: JsonSchema = {\n type: \"object\",\n properties: {\n greeting: { type: \"string\", default: \"Hello\" },\n note: { type: \"string\" }\n }\n };\n\n const saved = formDataToJsonSchemaValue(schema, { greeting: \"\", note: \"\" });\n\n expect(saved).toEqual({ greeting: \"\" });\n expect(jsonSchemaValueToFormData(schema, saved)).toMatchObject({ greeting: \"\" });\n });\n\n it(\"is the inverse of jsonSchemaValueToFormData\", () => {\n const stored = {\n url: \"https://a.test\",\n timeout: 30,\n enabled: true,\n labels: [\"a\"],\n auth: { user: \"ana\" },\n headers: [{ name: \"X-Id\" }],\n payload: { id: 1, tags: [\"x\"] }\n };\n\n const data = jsonSchemaValueToFormData(SCHEMA, stored);\n\n expect(formDataToJsonSchemaValue(SCHEMA, data)).toEqual(stored);\n });\n});\n"],"names":["SCHEMA","describe","it","data","expect","formDataToJsonSchemaValue","value","schema","saved","jsonSchemaValueToFormData","stored"],"mappings":";;;AAOA,MAAMA,SAAqB;IACvB,MAAM;IACN,UAAU;QAAC;QAAO;QAAU;KAAO;IACnC,YAAY;QACR,KAAK;YAAE,MAAM;QAAS;QACtB,MAAM;YAAE,MAAM;QAAS;QACvB,SAAS;YAAE,MAAM;QAAU;QAC3B,SAAS;YAAE,MAAM;QAAU;QAC3B,QAAQ;YAAE,MAAM;YAAS,OAAO;gBAAE,MAAM;YAAS;QAAE;QACnD,MAAM;YAAE,MAAM;YAAS,OAAO;gBAAE,MAAM;YAAS;QAAE;QACjD,MAAM;YAAE,MAAM;YAAU,YAAY;gBAAE,MAAM;oBAAE,MAAM;gBAAS;YAAE;QAAE;QACjE,OAAO;Y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