@wise/dynamic-flow-client 3.5.0-experimental-63c768d → 3.5.1-experimental-ccbce45
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/build/common/errorBoundary/ErrorBoundaryAlert.js +1 -1
- package/build/common/httpClientContext/HttpClientContext.js +2 -13
- package/build/common/makeHttpClient/makeHttpClient.spec.js +10 -10
- package/build/common/messages/external-confirmation.messages.js +5 -5
- package/build/common/messages/generic-error.messages.js +4 -4
- package/build/common/messages/help.messages.js +2 -2
- package/build/common/messages/multi-file-upload.messages.js +4 -4
- package/build/common/messages/multi-select.messages.js +2 -2
- package/build/common/messages/paragraph.messages.js +3 -3
- package/build/common/messages/repeatable.messages.js +5 -5
- package/build/common/messages/validation.array.messages.js +3 -3
- package/build/common/messages/validation.messages.js +11 -11
- package/build/i18n/index.js +1 -1
- package/build/legacy/common/constants/DateMode.js +1 -1
- package/build/legacy/common/constants/FormControlType.js +1 -1
- package/build/legacy/common/constants/MonthFormat.js +1 -1
- package/build/legacy/common/constants/Size.js +1 -1
- package/build/legacy/common/contexts/dynamicFlowContexts/DynamicFlowContexts.js +3 -14
- package/build/legacy/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.js +3 -1
- package/build/legacy/common/contexts/eventsContext/EventsContext.js +2 -2
- package/build/legacy/common/contexts/eventsContext/EventsContext.spec.js +1 -12
- package/build/legacy/common/contexts/featureContext/FeatureContext.js +1 -12
- package/build/legacy/common/contexts/featureContext/FeatureContext.spec.js +4 -15
- package/build/legacy/common/contexts/logContext/LogContext.js +2 -2
- package/build/legacy/common/contexts/logContext/LogContext.spec.js +1 -12
- package/build/legacy/common/hooks/useExternal/useExternal.spec.js +6 -6
- package/build/legacy/common/hooks/useExternalStepPolling/useExternalStepPolling.js +3 -2
- package/build/legacy/common/hooks/usePersistAsync/usePersistAsync.js +1 -1
- package/build/legacy/common/hooks/usePolling/usePolling.js +4 -2
- package/build/legacy/common/hooks/useStepPolling/useStepPolling.js +5 -3
- package/build/legacy/common/hooks/useStepPolling/useStepPolling.spec.js +4 -4
- package/build/legacy/common/messages.js +2 -2
- package/build/legacy/common/utils/file-utils.spec.js +4 -4
- package/build/legacy/common/utils/mobile-utils.spec.js +1 -1
- package/build/legacy/common/utils/schema-utils.js +2 -2
- package/build/legacy/common/validators/models/model-utils.spec.js +7 -7
- package/build/legacy/common/validators/models/model-validators.js +2 -2
- package/build/legacy/common/validators/models/model-validators.spec.js +54 -54
- package/build/legacy/common/validators/schemas/schema-validators.js +1 -1
- package/build/legacy/common/validators/schemas/schema-validators.spec.js +20 -20
- package/build/legacy/common/validators/validationFailures/validation-failures.js +2 -2
- package/build/legacy/common/validators/validationFailures/validation-failures.spec.js +11 -11
- package/build/legacy/dynamicFlow/BackButton.js +2 -2
- package/build/legacy/dynamicFlow/DynamicFlow.js +5 -5
- package/build/legacy/dynamicFlow/stories/dev-tools/DynamicFlow.story.js +7 -7
- package/build/legacy/dynamicFlow/stories/dev-tools/ErrorResponses.story.js +18 -18
- package/build/legacy/dynamicFlow/stories/dev-tools/Examples.story.js +1 -1
- package/build/legacy/dynamicFlow/stories/dev-tools/Features.story.js +1 -1
- package/build/legacy/dynamicFlow/stories/dev-tools/JsonSchemaForm.story.js +5 -5
- package/build/legacy/dynamicFlow/stories/dev-tools/RefreshOnChange.story.js +24 -24
- package/build/legacy/dynamicFlow/stories/dev-tools/SearchFeature.story.js +10 -21
- package/build/legacy/dynamicFlow/stories/dev-tools/ServerTest.story.js +4 -4
- package/build/legacy/dynamicFlow/stories/dev-tools/Upload.story.js +19 -19
- package/build/legacy/dynamicFlow/stories/dev-tools/ValidationAsync.story.js +18 -18
- package/build/legacy/dynamicFlow/stories/examples/ObjectConst.story.js +25 -25
- package/build/legacy/dynamicFlow/tests/Actions.spec.js +6 -6
- package/build/legacy/dynamicFlow/tests/AllOfSchema.spec.js +17 -17
- package/build/legacy/dynamicFlow/tests/AutocompleteHints.spec.js +6 -6
- package/build/legacy/dynamicFlow/tests/DynamicFlow.BackButton.spec.js +11 -11
- package/build/legacy/dynamicFlow/tests/DynamicFlow.search.spec.js +13 -13
- package/build/legacy/dynamicFlow/tests/DynamicFlow.spec.js +48 -48
- package/build/legacy/dynamicFlow/tests/DynamicImage.spec.js +4 -4
- package/build/legacy/dynamicFlow/tests/DynamicInstructions.spec.js +3 -3
- package/build/legacy/dynamicFlow/tests/HiddenSchemas.spec.js +24 -24
- package/build/legacy/dynamicFlow/tests/ModalLayout.spec.js +20 -20
- package/build/legacy/dynamicFlow/tests/MultiSelect.spec.js +21 -21
- package/build/legacy/dynamicFlow/tests/MultipleFileUploadSchema.spec.js +24 -24
- package/build/legacy/dynamicFlow/tests/ObjectSchema.spec.js +16 -16
- package/build/legacy/dynamicFlow/tests/OneOfSchema.spec.js +77 -77
- package/build/legacy/dynamicFlow/tests/PersistAsync.blob-schema.spec.js +19 -19
- package/build/legacy/dynamicFlow/tests/PersistAsync.string-schema.spec.js +10 -10
- package/build/legacy/dynamicFlow/tests/RefreshStepOnChange.debouncing.spec.js +19 -19
- package/build/legacy/dynamicFlow/tests/RefreshStepOnChange.spec.js +46 -46
- package/build/legacy/dynamicFlow/tests/RepeatableSchema.spec.js +62 -62
- package/build/legacy/dynamicFlow/tests/StepModel.spec.js +6 -6
- package/build/legacy/dynamicFlow/tests/ValidationAsync.spec.js +13 -13
- package/build/legacy/dynamicFlow/utils/responseParsers/response-parsers.spec.js +13 -13
- package/build/legacy/dynamicFlow/utils/useDynamicFlowState.js +4 -4
- package/build/legacy/formControl/FormControl.js +9 -9
- package/build/legacy/formControl/Select.spec.js +3 -3
- package/build/legacy/formControl/utils/getAutocompleteString.js +1 -1
- package/build/legacy/formControl/utils/value-utils.js +1 -1
- package/build/legacy/jsonSchemaForm/JsonSchemaForm.end-to-end.spec.js +66 -66
- package/build/legacy/jsonSchemaForm/JsonSchemaForm.js +1 -1
- package/build/legacy/jsonSchemaForm/allOfSchema/AllOfSchema.js +5 -5
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/ArraySchema.js +1 -1
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.js +1 -1
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multiSelectSchema/MultiSelectSchema.js +6 -17
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.js +3 -3
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.js +1 -1
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.js +7 -7
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchemaStep.js +6 -6
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/utils/summary-utils.js +7 -7
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/utils/summary-utils.spec.js +190 -190
- package/build/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.js +8 -19
- package/build/legacy/jsonSchemaForm/controlFeedback/ControlFeedback.js +14 -14
- package/build/legacy/jsonSchemaForm/genericSchema/GenericSchema.rtl.spec.js +2 -2
- package/build/legacy/jsonSchemaForm/help/Help.js +1 -12
- package/build/legacy/jsonSchemaForm/objectSchema/ObjectSchema.js +4 -4
- package/build/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.js +12 -12
- package/build/legacy/jsonSchemaForm/oneOfSchema/utils.js +6 -6
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.js +1 -1
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.js +2 -2
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.js +4 -4
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.js +2 -2
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.js +2 -2
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.js +1 -12
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.js +1 -1
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.js +3 -3
- package/build/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.js +1 -1
- package/build/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js +3 -3
- package/build/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.js +6 -6
- package/build/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.spec.js +12 -12
- package/build/legacy/jsonSchemaForm/schemaFormControl/utils/mapping-utils.js +10 -10
- package/build/legacy/jsonSchemaForm/schemaFormControl/utils/mapping-utils.spec.js +23 -23
- package/build/legacy/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.js +2 -2
- package/build/legacy/layout/DynamicLayout.js +1 -1
- package/build/legacy/layout/box/DynamicBox.js +2 -13
- package/build/legacy/layout/button/DynamicButton.js +1 -12
- package/build/legacy/layout/button/DynamicButton.spec.js +13 -24
- package/build/legacy/layout/button/utils.js +3 -3
- package/build/legacy/layout/button/utils.spec.js +6 -6
- package/build/legacy/layout/columns/DynamicColumns.js +4 -15
- package/build/legacy/layout/decision/DynamicDecision.js +1 -12
- package/build/legacy/layout/external/DynamicExternal.js +1 -1
- package/build/legacy/layout/external/DynamicExternal.messages.js +2 -2
- package/build/legacy/layout/form/DynamicForm.js +2 -2
- package/build/legacy/layout/heading/DynamicHeading.js +8 -19
- package/build/legacy/layout/image/DynamicImage.js +5 -4
- package/build/legacy/layout/instructions/DynamicInstructions.js +1 -12
- package/build/legacy/layout/list/DynamicStatusList.js +3 -3
- package/build/legacy/layout/list/DynamicStatusList.spec.js +9 -9
- package/build/legacy/layout/loadingIndicator/DynamicLoadingIndicator.js +1 -1
- package/build/legacy/layout/markdown/DynamicMarkdown.js +2 -13
- package/build/legacy/layout/markdown/DynamicMarkdown.spec.js +4 -4
- package/build/legacy/layout/modal/DynamicModal.js +2 -2
- package/build/legacy/layout/paragraph/DynamicParagraph.js +5 -16
- package/build/legacy/layout/review/DynamicReview.js +3 -14
- package/build/legacy/layout/review/DynamicReview.spec.js +6 -6
- package/build/legacy/layout/search/DynamicSearch.js +2 -13
- package/build/legacy/layout/search/SearchInput.js +1 -12
- package/build/legacy/layout/search/SearchResults.js +3 -14
- package/build/legacy/layout/search/useSearch.js +4 -4
- package/build/legacy/layout/utils/getNavigationOptionMedia.js +2 -13
- package/build/legacy/step/cameraStep/CameraStep.js +1 -1
- package/build/legacy/step/cameraStep/cameraCapture/CameraCapture.js +6 -6
- package/build/legacy/step/cameraStep/cameraCapture/CameraCapture.messages.js +12 -12
- package/build/legacy/step/cameraStep/cameraCapture/CameraCapture.spec.js +13 -13
- package/build/legacy/step/cameraStep/cameraCapture/components/bottomBar/BottomBar.js +3 -14
- package/build/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.js +1 -12
- package/build/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.messages.js +2 -2
- package/build/legacy/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.js +6 -4
- package/build/legacy/step/cameraStep/cameraCapture/hooks/useVideoConstraints.js +1 -1
- package/build/legacy/step/cameraStep/cameraCapture/overlay/Overlay.js +6 -6
- package/build/legacy/step/cameraStep/cameraCapture/screens/cameraErrorScreen/CameraErrorScreen.js +1 -12
- package/build/legacy/step/cameraStep/cameraCapture/tracking/index.js +1 -1
- package/build/legacy/step/externalConfirmationStep/ExternalConfirmationStep.js +7 -7
- package/build/legacy/step/layoutStep/LayoutStep.js +1 -1
- package/build/legacy/step/layoutStep/utils/inline-reference-utils.js +3 -3
- package/build/legacy/step/layoutStep/utils/layout-utils.js +12 -12
- package/build/legacy/test-utils/DynamicFlowProviders.js +1 -12
- package/build/legacy/test-utils/legacy-utils.js +4 -4
- package/build/legacy/test-utils/log-utils.js +1 -1
- package/build/revamp/DynamicFlowCore.js +5 -5
- package/build/revamp/DynamicFlowWise.js +1 -1
- package/build/revamp/DynamicFlowWise.spec.js +11 -11
- package/build/revamp/domain/components/AllOfComponent.js +1 -1
- package/build/revamp/domain/components/BooleanInputComponent.js +2 -2
- package/build/revamp/domain/components/ConstComponent.js +1 -1
- package/build/revamp/domain/components/DateInputComponent.js +2 -2
- package/build/revamp/domain/components/IntegerInputComponent.js +2 -2
- package/build/revamp/domain/components/NumberInputComponent.js +2 -2
- package/build/revamp/domain/components/ObjectComponent.js +1 -1
- package/build/revamp/domain/components/SelectInputComponent.js +2 -2
- package/build/revamp/domain/components/StepDomainComponent.js +1 -1
- package/build/revamp/domain/components/TextInputComponent.js +2 -2
- package/build/revamp/domain/components/UploadInputComponent.js +1 -1
- package/build/revamp/domain/components/repeatableComponent/RepeatableComponent.js +1 -1
- package/build/revamp/domain/components/repeatableComponent/RepeatableComponent.spec.js +1 -1
- package/build/revamp/domain/components/searchComponent/SearchComponent.js +4 -3
- package/build/revamp/domain/components/searchComponent/SearchComponent.spec.js +13 -13
- package/build/revamp/domain/components/utils/isPartialLocalValueMatch.spec.js +7 -7
- package/build/revamp/domain/features/persistAsync/getComponentPersistAsync.js +4 -4
- package/build/revamp/domain/features/persistAsync/getComponentPersistAsync.spec.js +1 -1
- package/build/revamp/domain/features/persistAsync/getInitialPersistedState.js +1 -1
- package/build/revamp/domain/features/persistAsync/getPerformPersistAsync.spec.js +17 -17
- package/build/revamp/domain/features/search/getPerformSearchFunction.js +3 -3
- package/build/revamp/domain/features/search/getPerformSearchFunction.spec.js +18 -18
- package/build/revamp/domain/features/summary/summary-utils.js +2 -2
- package/build/revamp/domain/features/summary/summary-utils.spec.js +27 -27
- package/build/revamp/domain/features/utils/http-utils.js +1 -1
- package/build/revamp/domain/features/validation/spec-utils.js +1 -1
- package/build/revamp/domain/features/validation/validation-functions.spec.js +4 -4
- package/build/revamp/domain/features/validation/value-checks.spec.js +4 -4
- package/build/revamp/domain/features/validationAsync/getComponentValidationAsync.js +4 -3
- package/build/revamp/domain/features/validationAsync/getComponentValidationAsync.spec.js +1 -1
- package/build/revamp/domain/features/validationAsync/getInitialValidationState.js +1 -1
- package/build/revamp/domain/features/validationAsync/getPerformValidationAsync.js +1 -1
- package/build/revamp/domain/features/validationAsync/getPerformValidationAsync.spec.js +17 -17
- package/build/revamp/domain/mappers/layout/alertLayoutToComponent.js +1 -1
- package/build/revamp/domain/mappers/layout/boxLayoutToComponents.js +1 -1
- package/build/revamp/domain/mappers/layout/buttonLayoutToComponent.js +1 -1
- package/build/revamp/domain/mappers/layout/columnsLayoutToComponent.js +1 -1
- package/build/revamp/domain/mappers/layout/decisionLayoutToComponent.js +1 -1
- package/build/revamp/domain/mappers/layout/formLayoutToComponent.js +2 -2
- package/build/revamp/domain/mappers/layout/headingLayoutToComponent.js +1 -1
- package/build/revamp/domain/mappers/layout/imageLayoutToComponent.js +1 -1
- package/build/revamp/domain/mappers/layout/infoLayoutToComponent.js +1 -1
- package/build/revamp/domain/mappers/layout/instructionsLayoutToComponent.js +2 -2
- package/build/revamp/domain/mappers/layout/listLayoutToComponent.js +2 -2
- package/build/revamp/domain/mappers/layout/markdownLayoutToComponent.js +1 -1
- package/build/revamp/domain/mappers/layout/modalLayoutToComponent.js +2 -2
- package/build/revamp/domain/mappers/layout/paragraphLayoutToComponent.js +1 -1
- package/build/revamp/domain/mappers/layout/reviewLayoutToComponent.js +3 -3
- package/build/revamp/domain/mappers/layout/searchLayoutToComponent.js +1 -1
- package/build/revamp/domain/mappers/layout/statusListLayoutToComponent.js +1 -1
- package/build/revamp/domain/mappers/mapSchemaToComponent.js +1 -1
- package/build/revamp/domain/mappers/mapSchemaToComponent.spec.js +22 -22
- package/build/revamp/domain/mappers/mapStepToComponent.js +3 -3
- package/build/revamp/domain/mappers/mapStepToComponent.spec.js +12 -12
- package/build/revamp/domain/mappers/schema/allOfSchemaToComponent.js +1 -1
- package/build/revamp/domain/mappers/schema/arraySchemaToComponent/arraySchemaToRepeatableComponent.js +2 -2
- package/build/revamp/domain/mappers/schema/booleanSchemaToComponent.js +1 -1
- package/build/revamp/domain/mappers/schema/constSchemaToComponent.js +2 -2
- package/build/revamp/domain/mappers/schema/integerSchemaToComponent.js +1 -1
- package/build/revamp/domain/mappers/schema/numberSchemaToComponent.js +1 -1
- package/build/revamp/domain/mappers/schema/objectSchemaToComponent/objectSchemaToComponent.js +1 -1
- package/build/revamp/domain/mappers/schema/objectSchemaToComponent/objectSchemaToComponent.spec.js +21 -21
- package/build/revamp/domain/mappers/schema/oneOfSchemaToComponent/oneOfSchemaToComponent.js +4 -4
- package/build/revamp/domain/mappers/schema/oneOfSchemaToComponent/oneOfSchemaToComponent.spec.js +48 -48
- package/build/revamp/domain/mappers/schema/stringSchemaToComponent/stringSchemaToComponent.spec.js +21 -21
- package/build/revamp/domain/mappers/schema/stringSchemaToComponent/stringSchemaToDateInputComponent.js +1 -1
- package/build/revamp/domain/mappers/schema/stringSchemaToComponent/stringSchemaToTextInputComponent.js +1 -1
- package/build/revamp/domain/mappers/schema/utils/getPersistAsyncInitialState.js +1 -1
- package/build/revamp/domain/mappers/schema/utils/getValidationAsyncInitialState.js +1 -1
- package/build/revamp/domain/mappers/utils/getAutocompleteString.js +1 -1
- package/build/revamp/domain/mappers/utils/legacy-utils.js +2 -2
- package/build/revamp/flow/executeRefresh.js +2 -2
- package/build/revamp/flow/executeSubmission.js +1 -1
- package/build/revamp/renderers/CoreContainerRenderer.js +1 -1
- package/build/revamp/renderers/getRenderFunction.js +3 -3
- package/build/revamp/renderers/getSchemaErrorMessageFunction.js +12 -12
- package/build/revamp/renderers/mappers/allOfComponentToProps.js +1 -1
- package/build/revamp/renderers/mappers/buttonComponentToProps.js +1 -1
- package/build/revamp/renderers/mappers/containerComponentToProps.js +1 -1
- package/build/revamp/renderers/mappers/headingComponentToProps.js +1 -1
- package/build/revamp/renderers/mappers/hiddenComponentToProps.js +1 -1
- package/build/revamp/renderers/mappers/imageComponentToProps.js +1 -1
- package/build/revamp/renderers/mappers/instructionsComponentToProps.js +1 -1
- package/build/revamp/renderers/mappers/loadingIndicatorComponentToProps.js +1 -1
- package/build/revamp/renderers/mappers/markdownComponentToProps.js +1 -1
- package/build/revamp/renderers/mappers/modalComponentToProps.js +1 -1
- package/build/revamp/renderers/mappers/multiUploadInputComponentToProps.js +1 -1
- package/build/revamp/renderers/mappers/objectComponentToProps.js +1 -1
- package/build/revamp/renderers/mappers/paragraphComponentToProps.js +1 -1
- package/build/revamp/renderers/mappers/repeatableComponentToProps.js +2 -2
- package/build/revamp/renderers/mappers/reviewComponentToProps.js +1 -1
- package/build/revamp/renderers/mappers/searchComponentToProps.js +2 -2
- package/build/revamp/renderers/mappers/statusListComponentToProps.js +1 -1
- package/build/revamp/renderers/mappers/utils/inputComponentToProps.js +1 -1
- package/build/revamp/renderers/step/ExternalConfirmationDialog.js +2 -13
- package/build/revamp/renderers/step/StepRenderer.js +2 -13
- package/build/revamp/renderers/stepComponentToProps.js +1 -1
- package/build/revamp/stories/dev-tools/DynamicFlowRevamp.story.js +53 -53
- package/build/revamp/stories/dev-tools/EditableStep.story.js +7 -7
- package/build/revamp/stories/dev-tools/ErrorHandling.story.js +17 -17
- package/build/revamp/stories/dev-tools/External.story.js +6 -6
- package/build/revamp/stories/dev-tools/OneOf.Inititalisation.story.js +14 -14
- package/build/revamp/stories/dev-tools/PersistAsync.story.js +16 -16
- package/build/revamp/stories/dev-tools/RefreshOnChange.story.js +41 -41
- package/build/revamp/stories/dev-tools/RefreshOnChange.with.PersistAsync.story.js +210 -210
- package/build/revamp/stories/dev-tools/ServerTest.story.js +4 -4
- package/build/revamp/stories/dev-tools/Upload.story.js +18 -18
- package/build/revamp/stories/dev-tools/ValidationAsync.story.js +18 -18
- package/build/revamp/stories/examples/ObjectConst.story.js +25 -25
- package/build/revamp/stories/examples/OneOfInitialisation.story.js +10 -10
- package/build/revamp/stories/utils/fixtureHttpClient.js +1 -1
- package/build/revamp/stories/utils/mockSearchHandler.js +8 -8
- package/build/revamp/stories/visual-tests/VisualTests.story.js +1 -1
- package/build/revamp/test-utils/step-utils.js +1 -1
- package/build/revamp/tests/ImageRenderer.spec.js +3 -3
- package/build/revamp/tests/InitialAction.spec.js +9 -9
- package/build/revamp/tests/InitialStep.spec.js +3 -3
- package/build/revamp/tests/Logging.spec.js +5 -5
- package/build/revamp/tests/OneOfInitialisation.spec.js +73 -73
- package/build/revamp/tests/RefreshOnChange.ResponseHandling.spec.js +19 -19
- package/build/revamp/tests/RefreshOnChange.with.Tabs.spec.js +57 -57
- package/build/revamp/tests/RefreshOnChangePreserve.spec.js +13 -13
- package/build/revamp/tests/Submission.ResponseHandling.spec.js +38 -38
- package/build/revamp/tests/Submission.spec.js +23 -23
- package/build/revamp/tests/legacy/HiddenSchemas.spec.js +24 -24
- package/build/revamp/tests/legacy/MultipleFileUploadSchema.spec.js +27 -27
- package/build/revamp/tests/legacy/PersistAsync.blob-schema.spec.js +18 -18
- package/build/revamp/tests/legacy/PersistAsync.string-schema.spec.js +8 -8
- package/build/revamp/tests/legacy/RefreshStepOnChange.debouncing.spec.js +15 -14
- package/build/revamp/tests/legacy/RefreshStepOnChange.spec.js +50 -50
- package/build/revamp/tests/legacy/ValidationAsync.spec.js +14 -14
- package/build/revamp/tests/legacy/useExternal.spec.js +6 -6
- package/build/revamp/utils/component-utils.spec.js +43 -43
- package/build/revamp/utils/findComponent.spec.js +14 -14
- package/build/revamp/utils/type-utils.js +1 -1
- package/build/revamp/wise/renderers/AlertRenderer.js +1 -1
- package/build/revamp/wise/renderers/BooleanInputRenderer.js +2 -2
- package/build/revamp/wise/renderers/BoxRenderer.js +4 -15
- package/build/revamp/wise/renderers/ButtonRenderer.js +2 -13
- package/build/revamp/wise/renderers/ColumnsRenderer.js +4 -15
- package/build/revamp/wise/renderers/DateInputRenderer.js +2 -2
- package/build/revamp/wise/renderers/DecisionRenderer.js +3 -14
- package/build/revamp/wise/renderers/DividerRenderer.js +1 -1
- package/build/revamp/wise/renderers/FormRenderer.js +2 -13
- package/build/revamp/wise/renderers/FormSectionRenderer.js +1 -1
- package/build/revamp/wise/renderers/HeadingRenderer.js +7 -7
- package/build/revamp/wise/renderers/ImageRenderer.js +5 -4
- package/build/revamp/wise/renderers/InstructionsRenderer.js +2 -13
- package/build/revamp/wise/renderers/IntegerInputRenderer.js +3 -3
- package/build/revamp/wise/renderers/LoadingIndicatorRenderer.js +1 -1
- package/build/revamp/wise/renderers/MarkdownRenderer.js +2 -13
- package/build/revamp/wise/renderers/ModalRenderer.js +2 -2
- package/build/revamp/wise/renderers/MultiUploadInputRenderer.js +3 -14
- package/build/revamp/wise/renderers/NumberInputRenderer.js +3 -3
- package/build/revamp/wise/renderers/ParagraphRenderer.js +5 -4
- package/build/revamp/wise/renderers/RepeatableRenderer.js +5 -5
- package/build/revamp/wise/renderers/ReviewRenderer.js +5 -16
- package/build/revamp/wise/renderers/SearchRenderer.js +5 -5
- package/build/revamp/wise/renderers/SelectInputRenderer/OptionMedia.js +2 -13
- package/build/revamp/wise/renderers/SelectInputRenderer/RadioInputRendererComponent.js +3 -14
- package/build/revamp/wise/renderers/SelectInputRenderer/SelectInputRenderer.js +1 -1
- package/build/revamp/wise/renderers/SelectInputRenderer/SelectInputRendererComponent.js +4 -4
- package/build/revamp/wise/renderers/SelectInputRenderer/SelectTriggerMedia.js +2 -13
- package/build/revamp/wise/renderers/SelectInputRenderer/TabInputRendererComponent.js +3 -14
- package/build/revamp/wise/renderers/StatusListRenderer.js +3 -14
- package/build/revamp/wise/renderers/TextInputRenderer.js +2 -2
- package/build/revamp/wise/renderers/UploadInputRenderer.js +6 -6
- package/build/revamp/wise/renderers/components/FieldInput.js +1 -12
- package/build/revamp/wise/renderers/components/Help.js +1 -12
- package/build/revamp/wise/renderers/components/UploadFieldInput.js +3 -14
- package/build/revamp/wise/renderers/components/icon/NavigationOptionMedia.js +2 -13
- package/build/test-utils/NeptuneProviders.js +1 -1
- package/build/types/common/messages/multi-file-upload.messages.d.ts +9 -9
- package/build/types/legacy/common/utils/mobile-utils.d.ts +1 -1
- package/build/types/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.d.ts +6 -6
- package/build/types/legacy/layout/external/DynamicExternal.messages.d.ts +3 -3
- package/build/types/revamp/domain/components/MultiUploadInputComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/UploadInputComponent.d.ts +1 -1
- package/package.json +3 -3
|
@@ -32,12 +32,14 @@ export function createPollingClosure(asyncFn, maxAttempts, maxConsecutiveFails,
|
|
|
32
32
|
.then(function (pollingResponse) {
|
|
33
33
|
consecutiveFailures = 0;
|
|
34
34
|
isPolling = onPollingResponse(pollingResponse);
|
|
35
|
-
})
|
|
35
|
+
})
|
|
36
|
+
.catch(function (error) {
|
|
36
37
|
// do not fail on network errors
|
|
37
38
|
if (error.message !== 'network failed') {
|
|
38
39
|
consecutiveFailures += 1;
|
|
39
40
|
}
|
|
40
|
-
})
|
|
41
|
+
})
|
|
42
|
+
.finally(function () {
|
|
41
43
|
if (consecutiveFailures >= maxConsecutiveFails || attemptCount >= maxAttempts) {
|
|
42
44
|
onFailure();
|
|
43
45
|
isPolling = false;
|
|
@@ -11,10 +11,12 @@ export function useStepPolling(polling, onAction) {
|
|
|
11
11
|
if (response.ok) {
|
|
12
12
|
return response
|
|
13
13
|
.json()
|
|
14
|
-
.then(function (pollingResponse) { return pollingResponse; })
|
|
14
|
+
.then(function (pollingResponse) { return pollingResponse; })
|
|
15
|
+
.catch(function (error) { return null; });
|
|
15
16
|
}
|
|
16
17
|
throw new Error('failed');
|
|
17
|
-
})
|
|
18
|
+
})
|
|
19
|
+
.catch(function (error) {
|
|
18
20
|
throw new Error(error.message === 'failed' ? 'failed' : 'network failed');
|
|
19
21
|
});
|
|
20
22
|
};
|
|
@@ -38,6 +40,6 @@ export function useStepPolling(polling, onAction) {
|
|
|
38
40
|
if (polling) {
|
|
39
41
|
onAction(polling.onError.action);
|
|
40
42
|
}
|
|
41
|
-
}, [onAction, polling])
|
|
43
|
+
}, [onAction, polling]),
|
|
42
44
|
});
|
|
43
45
|
}
|
|
@@ -66,8 +66,8 @@ describe('useStepPolling', function () {
|
|
|
66
66
|
url: POLLING_URL,
|
|
67
67
|
interval: 5,
|
|
68
68
|
maxAttempts: MAX_ATTEMPTS,
|
|
69
|
-
onError: { action: { url: '/on-error' } }
|
|
70
|
-
}
|
|
69
|
+
onError: { action: { url: '/on-error' } },
|
|
70
|
+
},
|
|
71
71
|
};
|
|
72
72
|
it('makes a requests to the speficied URL with the given interval', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
73
73
|
return __generator(this, function (_a) {
|
|
@@ -93,8 +93,8 @@ describe('useStepPolling', function () {
|
|
|
93
93
|
action: {
|
|
94
94
|
url: '/success',
|
|
95
95
|
method: 'POST',
|
|
96
|
-
data: { 'action-data': '1234567890' }
|
|
97
|
-
}
|
|
96
|
+
data: { 'action-data': '1234567890' },
|
|
97
|
+
},
|
|
98
98
|
}))
|
|
99
99
|
: new Response("{}")];
|
|
100
100
|
});
|
|
@@ -3,6 +3,6 @@ export default defineMessages({
|
|
|
3
3
|
required: {
|
|
4
4
|
id: 'dynamicFlows.DefaultErrorMessages.required',
|
|
5
5
|
defaultMessage: 'Please fill out this field.',
|
|
6
|
-
description: 'Customer has left the required field empty'
|
|
7
|
-
}
|
|
6
|
+
description: 'Customer has left the required field empty',
|
|
7
|
+
},
|
|
8
8
|
});
|
|
@@ -39,13 +39,13 @@ describe('Given a set of utility functions for file', function () {
|
|
|
39
39
|
id: 111,
|
|
40
40
|
status: Status.SUCCEEDED,
|
|
41
41
|
url: 'www.something.com/file.png',
|
|
42
|
-
filename: 'filename1.png'
|
|
42
|
+
filename: 'filename1.png',
|
|
43
43
|
};
|
|
44
44
|
var file = {
|
|
45
45
|
id: 111,
|
|
46
46
|
status: Status.SUCCEEDED,
|
|
47
47
|
url: 'www.somethingElse.com/file.png',
|
|
48
|
-
filename: 'filename2.png'
|
|
48
|
+
filename: 'filename2.png',
|
|
49
49
|
};
|
|
50
50
|
expect(areFilesSame([anotherFile], [file])).toBeTruthy();
|
|
51
51
|
});
|
|
@@ -54,13 +54,13 @@ describe('Given a set of utility functions for file', function () {
|
|
|
54
54
|
id: 111,
|
|
55
55
|
status: Status.SUCCEEDED,
|
|
56
56
|
url: 'www.something.com/file.png',
|
|
57
|
-
filename: 'filename.png'
|
|
57
|
+
filename: 'filename.png',
|
|
58
58
|
};
|
|
59
59
|
var file = {
|
|
60
60
|
id: 112,
|
|
61
61
|
status: Status.SUCCEEDED,
|
|
62
62
|
url: 'www.something.com/file.png',
|
|
63
|
-
filename: 'filename.png'
|
|
63
|
+
filename: 'filename.png',
|
|
64
64
|
};
|
|
65
65
|
expect(areFilesSame([anotherFile], [file])).toBeFalsy();
|
|
66
66
|
});
|
|
@@ -44,7 +44,7 @@ describe('hasMobileScreenSize', function () {
|
|
|
44
44
|
});
|
|
45
45
|
describe('hasTouchScreen', function () {
|
|
46
46
|
var mockNavigator = {
|
|
47
|
-
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36'
|
|
47
|
+
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36',
|
|
48
48
|
};
|
|
49
49
|
it('should return true if the device has a touch screen', function () {
|
|
50
50
|
expect(isTouchScreen(__assign(__assign({}, mockNavigator), { maxTouchPoints: 1 }))).toBe(true);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isObject, isUndefined } from '../validators';
|
|
2
2
|
export function isConstSchema(schema) {
|
|
3
|
-
return !isUndefined(schema === null || schema === void 0 ? void 0 : schema
|
|
3
|
+
return !isUndefined(schema === null || schema === void 0 ? void 0 : schema.const);
|
|
4
4
|
}
|
|
5
5
|
export function isNoNConstSchema(schema) {
|
|
6
6
|
return Boolean(schema) && !isConstSchema(schema);
|
|
@@ -14,7 +14,7 @@ export var isPromotedOneOfSchema = function (schema) {
|
|
|
14
14
|
export var basicTypes = new Set(['string', 'number', 'integer', 'boolean']);
|
|
15
15
|
export function isBasicSchema(schema) {
|
|
16
16
|
return (basicTypes.has(schema.type || '') ||
|
|
17
|
-
('const' in schema && schema
|
|
17
|
+
('const' in schema && schema.const !== undefined && !isObject(schema.const)));
|
|
18
18
|
}
|
|
19
19
|
export function isObjectSchema(schema) {
|
|
20
20
|
return schema.type === 'object';
|
|
@@ -3,8 +3,8 @@ var basicArray = {
|
|
|
3
3
|
type: 'array',
|
|
4
4
|
items: {
|
|
5
5
|
title: 'Email',
|
|
6
|
-
type: 'string'
|
|
7
|
-
}
|
|
6
|
+
type: 'string',
|
|
7
|
+
},
|
|
8
8
|
};
|
|
9
9
|
var objectArray = {
|
|
10
10
|
type: 'array',
|
|
@@ -16,14 +16,14 @@ var objectArray = {
|
|
|
16
16
|
properties: {
|
|
17
17
|
name: {
|
|
18
18
|
title: 'Full name',
|
|
19
|
-
type: 'string'
|
|
19
|
+
type: 'string',
|
|
20
20
|
},
|
|
21
21
|
terms: {
|
|
22
22
|
title: 'I agree to the terms and conditions',
|
|
23
|
-
type: 'boolean'
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
23
|
+
type: 'boolean',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
27
|
};
|
|
28
28
|
describe('cleanModelWithArraySchema', function () {
|
|
29
29
|
it('should return null if the model is not an array', function () {
|
|
@@ -17,7 +17,7 @@ export function getValidBasicModelOrNull(model, schema) {
|
|
|
17
17
|
if (schema.oneOf) {
|
|
18
18
|
return cleanBasicModelWithOneOfSchema(model, schema);
|
|
19
19
|
}
|
|
20
|
-
if (!isUndefined(schema
|
|
20
|
+
if (!isUndefined(schema.const) && model === schema.const) {
|
|
21
21
|
return model;
|
|
22
22
|
}
|
|
23
23
|
if (schema.type) {
|
|
@@ -46,7 +46,7 @@ export function getValidObjectModelParts(model, schema) {
|
|
|
46
46
|
if (schema.oneOf) {
|
|
47
47
|
return cleanObjectModelWithOneOfSchema(model, schema);
|
|
48
48
|
}
|
|
49
|
-
if (!isUndefined(schema
|
|
49
|
+
if (!isUndefined(schema.const) && isEqual(model, schema.const)) {
|
|
50
50
|
return model;
|
|
51
51
|
}
|
|
52
52
|
return isObjectSchema(schema) ? cleanObjectModelWithObjectSchema(model, schema) : null;
|
|
@@ -97,7 +97,7 @@ describe('Given a library for returning the valid parts of a model based on a sc
|
|
|
97
97
|
});
|
|
98
98
|
describe('when cleaning a const schema', function () {
|
|
99
99
|
describe('when the const is a number', function () {
|
|
100
|
-
var schema = {
|
|
100
|
+
var schema = { const: 1 };
|
|
101
101
|
describe('if the model matches the const', function () {
|
|
102
102
|
it('should return the original model', function () {
|
|
103
103
|
var result = getValidModelParts(1, schema);
|
|
@@ -119,13 +119,13 @@ describe('Given a library for returning the valid parts of a model based on a sc
|
|
|
119
119
|
});
|
|
120
120
|
describe('if the const evaluates to false', function () {
|
|
121
121
|
it('should still return matches', function () {
|
|
122
|
-
var result = getValidModelParts(0, {
|
|
122
|
+
var result = getValidModelParts(0, { const: 0 });
|
|
123
123
|
expect(result).toBe(0);
|
|
124
124
|
});
|
|
125
125
|
});
|
|
126
126
|
});
|
|
127
127
|
describe('when the const is a string', function () {
|
|
128
|
-
var schema = {
|
|
128
|
+
var schema = { const: 'one' };
|
|
129
129
|
describe('if the model matches the const', function () {
|
|
130
130
|
it('should return the original model', function () {
|
|
131
131
|
var result = getValidModelParts('one', schema);
|
|
@@ -147,13 +147,13 @@ describe('Given a library for returning the valid parts of a model based on a sc
|
|
|
147
147
|
});
|
|
148
148
|
describe('if the const evaluates to false', function () {
|
|
149
149
|
it('should still return matches', function () {
|
|
150
|
-
var result = getValidModelParts('', {
|
|
150
|
+
var result = getValidModelParts('', { const: '' });
|
|
151
151
|
expect(result).toBe('');
|
|
152
152
|
});
|
|
153
153
|
});
|
|
154
154
|
});
|
|
155
155
|
describe('when the const is a boolean', function () {
|
|
156
|
-
var schema = {
|
|
156
|
+
var schema = { const: true };
|
|
157
157
|
describe('if the model matches the const', function () {
|
|
158
158
|
it('should return the original model', function () {
|
|
159
159
|
var result = getValidModelParts(true, schema);
|
|
@@ -174,7 +174,7 @@ describe('Given a library for returning the valid parts of a model based on a sc
|
|
|
174
174
|
});
|
|
175
175
|
describe('if the const evaluates to false', function () {
|
|
176
176
|
it('should still return matches', function () {
|
|
177
|
-
var result = getValidModelParts(false, {
|
|
177
|
+
var result = getValidModelParts(false, { const: false });
|
|
178
178
|
expect(result).toBe(false);
|
|
179
179
|
});
|
|
180
180
|
});
|
|
@@ -185,10 +185,10 @@ describe('Given a library for returning the valid parts of a model based on a sc
|
|
|
185
185
|
type: 'object',
|
|
186
186
|
properties: {
|
|
187
187
|
a: {
|
|
188
|
-
type: 'number'
|
|
189
|
-
}
|
|
188
|
+
type: 'number',
|
|
189
|
+
},
|
|
190
190
|
},
|
|
191
|
-
displayOrder: ['a']
|
|
191
|
+
displayOrder: ['a'],
|
|
192
192
|
};
|
|
193
193
|
describe('if the model has a property with the correct name and the correct type', function () {
|
|
194
194
|
it('should return the property', function () {
|
|
@@ -225,25 +225,25 @@ describe('Given a library for returning the valid parts of a model based on a sc
|
|
|
225
225
|
type: 'object',
|
|
226
226
|
properties: {
|
|
227
227
|
a: {
|
|
228
|
-
type: 'number'
|
|
228
|
+
type: 'number',
|
|
229
229
|
},
|
|
230
230
|
b: {
|
|
231
231
|
type: 'object',
|
|
232
232
|
properties: {
|
|
233
233
|
c: {
|
|
234
|
-
type: 'number'
|
|
235
|
-
}
|
|
234
|
+
type: 'number',
|
|
235
|
+
},
|
|
236
236
|
},
|
|
237
|
-
displayOrder: ['c']
|
|
237
|
+
displayOrder: ['c'],
|
|
238
238
|
},
|
|
239
239
|
d: {
|
|
240
|
-
|
|
240
|
+
const: 1,
|
|
241
241
|
},
|
|
242
242
|
e: {
|
|
243
|
-
|
|
244
|
-
}
|
|
243
|
+
const: { f: 2 },
|
|
244
|
+
},
|
|
245
245
|
},
|
|
246
|
-
displayOrder: ['a', 'b', 'c', 'd', 'e']
|
|
246
|
+
displayOrder: ['a', 'b', 'c', 'd', 'e'],
|
|
247
247
|
};
|
|
248
248
|
describe('if the nested model is valid', function () {
|
|
249
249
|
it('should be returned', function () {
|
|
@@ -265,21 +265,21 @@ describe('Given a library for returning the valid parts of a model based on a sc
|
|
|
265
265
|
type: 'object',
|
|
266
266
|
properties: {
|
|
267
267
|
a: {
|
|
268
|
-
type: 'number'
|
|
269
|
-
}
|
|
268
|
+
type: 'number',
|
|
269
|
+
},
|
|
270
270
|
},
|
|
271
|
-
displayOrder: ['a']
|
|
271
|
+
displayOrder: ['a'],
|
|
272
272
|
},
|
|
273
273
|
{
|
|
274
274
|
type: 'object',
|
|
275
275
|
properties: {
|
|
276
276
|
b: {
|
|
277
|
-
type: 'number'
|
|
278
|
-
}
|
|
277
|
+
type: 'number',
|
|
278
|
+
},
|
|
279
279
|
},
|
|
280
|
-
displayOrder: ['b']
|
|
280
|
+
displayOrder: ['b'],
|
|
281
281
|
},
|
|
282
|
-
]
|
|
282
|
+
],
|
|
283
283
|
};
|
|
284
284
|
describe('if all of the properties are valid', function () {
|
|
285
285
|
it('should return them', function () {
|
|
@@ -320,7 +320,7 @@ describe('Given a library for returning the valid parts of a model based on a sc
|
|
|
320
320
|
describe('when cleaning a oneOf schema of const', function () {
|
|
321
321
|
describe('when the consts are numbers', function () {
|
|
322
322
|
var schema = {
|
|
323
|
-
oneOf: [{
|
|
323
|
+
oneOf: [{ const: 0 }, { const: 1 }, { const: 2 }],
|
|
324
324
|
};
|
|
325
325
|
describe('when the value is in the const collection', function () {
|
|
326
326
|
it('should return the value', function () {
|
|
@@ -346,7 +346,7 @@ describe('Given a library for returning the valid parts of a model based on a sc
|
|
|
346
346
|
});
|
|
347
347
|
describe('when the consts are strings', function () {
|
|
348
348
|
var schema = {
|
|
349
|
-
oneOf: [{
|
|
349
|
+
oneOf: [{ const: 'zero' }, { const: 'one' }, { const: 'two' }],
|
|
350
350
|
};
|
|
351
351
|
describe('when the value is in the const collection', function () {
|
|
352
352
|
it('should return the value', function () {
|
|
@@ -371,7 +371,7 @@ describe('Given a library for returning the valid parts of a model based on a sc
|
|
|
371
371
|
});
|
|
372
372
|
describe('when the consts are booleans', function () {
|
|
373
373
|
var schema = {
|
|
374
|
-
oneOf: [{
|
|
374
|
+
oneOf: [{ const: false }, { const: true }],
|
|
375
375
|
};
|
|
376
376
|
describe('when the value is in the const collection', function () {
|
|
377
377
|
it('should return the value', function () {
|
|
@@ -393,7 +393,7 @@ describe('Given a library for returning the valid parts of a model based on a sc
|
|
|
393
393
|
});
|
|
394
394
|
describe('when the consts are objects', function () {
|
|
395
395
|
var schema = {
|
|
396
|
-
oneOf: [{
|
|
396
|
+
oneOf: [{ const: { a: 1 } }, { const: { b: 2 } }],
|
|
397
397
|
};
|
|
398
398
|
describe('when the value is in the const collection', function () {
|
|
399
399
|
it('should return the value', function () {
|
|
@@ -423,15 +423,15 @@ describe('Given a library for returning the valid parts of a model based on a sc
|
|
|
423
423
|
type: 'array',
|
|
424
424
|
addItemTitle: '',
|
|
425
425
|
editItemTitle: '',
|
|
426
|
-
items: { type: 'string' }
|
|
426
|
+
items: { type: 'string' },
|
|
427
427
|
},
|
|
428
428
|
{
|
|
429
429
|
type: 'array',
|
|
430
430
|
addItemTitle: '',
|
|
431
431
|
editItemTitle: '',
|
|
432
|
-
items: { type: 'number' }
|
|
432
|
+
items: { type: 'number' },
|
|
433
433
|
},
|
|
434
|
-
]
|
|
434
|
+
],
|
|
435
435
|
};
|
|
436
436
|
describe('when the model is valid for one of the one-ofs', function () {
|
|
437
437
|
it('should return the model', function () {
|
|
@@ -458,21 +458,21 @@ describe('Given a library for returning the valid parts of a model based on a sc
|
|
|
458
458
|
type: 'object',
|
|
459
459
|
properties: {
|
|
460
460
|
a: {
|
|
461
|
-
type: 'number'
|
|
462
|
-
}
|
|
461
|
+
type: 'number',
|
|
462
|
+
},
|
|
463
463
|
},
|
|
464
|
-
displayOrder: ['a']
|
|
464
|
+
displayOrder: ['a'],
|
|
465
465
|
},
|
|
466
466
|
{
|
|
467
467
|
type: 'object',
|
|
468
468
|
properties: {
|
|
469
469
|
b: {
|
|
470
|
-
type: 'number'
|
|
471
|
-
}
|
|
470
|
+
type: 'number',
|
|
471
|
+
},
|
|
472
472
|
},
|
|
473
|
-
displayOrder: ['b']
|
|
473
|
+
displayOrder: ['b'],
|
|
474
474
|
},
|
|
475
|
-
]
|
|
475
|
+
],
|
|
476
476
|
};
|
|
477
477
|
describe('if all of the properties are valid', function () {
|
|
478
478
|
it('should return them', function () {
|
|
@@ -513,12 +513,12 @@ describe('Given a library for returning the valid parts of a model based on a sc
|
|
|
513
513
|
nested: {
|
|
514
514
|
type: 'object',
|
|
515
515
|
properties: {
|
|
516
|
-
a: { type: 'string' }
|
|
516
|
+
a: { type: 'string' },
|
|
517
517
|
},
|
|
518
|
-
displayOrder: ['a']
|
|
519
|
-
}
|
|
518
|
+
displayOrder: ['a'],
|
|
519
|
+
},
|
|
520
520
|
},
|
|
521
|
-
displayOrder: ['nested']
|
|
521
|
+
displayOrder: ['nested'],
|
|
522
522
|
},
|
|
523
523
|
{
|
|
524
524
|
type: 'object',
|
|
@@ -526,14 +526,14 @@ describe('Given a library for returning the valid parts of a model based on a sc
|
|
|
526
526
|
nested: {
|
|
527
527
|
type: 'object',
|
|
528
528
|
properties: {
|
|
529
|
-
b: { type: 'string' }
|
|
529
|
+
b: { type: 'string' },
|
|
530
530
|
},
|
|
531
|
-
displayOrder: ['b']
|
|
532
|
-
}
|
|
531
|
+
displayOrder: ['b'],
|
|
532
|
+
},
|
|
533
533
|
},
|
|
534
|
-
displayOrder: ['nested']
|
|
534
|
+
displayOrder: ['nested'],
|
|
535
535
|
},
|
|
536
|
-
]
|
|
536
|
+
],
|
|
537
537
|
};
|
|
538
538
|
it('should deep merge the content of the nested objects', function () {
|
|
539
539
|
var model = { nested: { a: 'one', b: 'two' } };
|
|
@@ -557,10 +557,10 @@ describe('Given a library for returning the valid parts of a model based on a sc
|
|
|
557
557
|
type: 'string',
|
|
558
558
|
format: 'base64url',
|
|
559
559
|
maxSize: 5242000,
|
|
560
|
-
title: 'Invoice (optional)'
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
}
|
|
560
|
+
title: 'Invoice (optional)',
|
|
561
|
+
},
|
|
562
|
+
},
|
|
563
|
+
},
|
|
564
564
|
};
|
|
565
565
|
it('should deep merge the content of the nested objects', function () {
|
|
566
566
|
var result = getValidModelParts(['file-123', 'file-234'], schema);
|
|
@@ -572,7 +572,7 @@ describe('Given a library for returning the valid parts of a model based on a sc
|
|
|
572
572
|
type: 'array',
|
|
573
573
|
addItemTitle: '',
|
|
574
574
|
editItemTitle: '',
|
|
575
|
-
items: { type: 'number' }
|
|
575
|
+
items: { type: 'number' },
|
|
576
576
|
};
|
|
577
577
|
describe('when the model is an array of numbers', function () {
|
|
578
578
|
var model = [1, 2, 3];
|
|
@@ -598,7 +598,7 @@ describe('Given a library for returning the valid parts of a model based on a sc
|
|
|
598
598
|
type: 'array',
|
|
599
599
|
addItemTitle: '',
|
|
600
600
|
editItemTitle: '',
|
|
601
|
-
items: { type: 'string' }
|
|
601
|
+
items: { type: 'string' },
|
|
602
602
|
};
|
|
603
603
|
describe('when the model is an array of strings', function () {
|
|
604
604
|
var model = ['a', 'b', 'c'];
|
|
@@ -624,7 +624,7 @@ describe('Given a library for returning the valid parts of a model based on a sc
|
|
|
624
624
|
type: 'array',
|
|
625
625
|
addItemTitle: '',
|
|
626
626
|
editItemTitle: '',
|
|
627
|
-
items: { type: 'boolean' }
|
|
627
|
+
items: { type: 'boolean' },
|
|
628
628
|
};
|
|
629
629
|
describe('when the model is an array of booleans', function () {
|
|
630
630
|
var model = [true, false, true];
|
|
@@ -8,18 +8,18 @@ describe('Given a library for validating json schema models', function () {
|
|
|
8
8
|
properties: {
|
|
9
9
|
a: {
|
|
10
10
|
type: 'number',
|
|
11
|
-
minimum: 2
|
|
11
|
+
minimum: 2,
|
|
12
12
|
},
|
|
13
13
|
b: {
|
|
14
14
|
type: 'string',
|
|
15
|
-
minLength: 3
|
|
15
|
+
minLength: 3,
|
|
16
16
|
},
|
|
17
17
|
c: {
|
|
18
|
-
|
|
19
|
-
}
|
|
18
|
+
const: true,
|
|
19
|
+
},
|
|
20
20
|
},
|
|
21
21
|
required: ['a', 'c'],
|
|
22
|
-
displayOrder: ['a', 'b', 'c']
|
|
22
|
+
displayOrder: ['a', 'b', 'c'],
|
|
23
23
|
};
|
|
24
24
|
});
|
|
25
25
|
it('should return false if the value is of an incorrect type', function () {
|
|
@@ -49,10 +49,10 @@ describe('Given a library for validating json schema models', function () {
|
|
|
49
49
|
editItemTitle: '',
|
|
50
50
|
items: {
|
|
51
51
|
type: 'string',
|
|
52
|
-
minLength: 2
|
|
52
|
+
minLength: 2,
|
|
53
53
|
},
|
|
54
54
|
minItems: 2,
|
|
55
|
-
maxItems: 2
|
|
55
|
+
maxItems: 2,
|
|
56
56
|
};
|
|
57
57
|
});
|
|
58
58
|
it('should return false if not an array', function () {
|
|
@@ -77,13 +77,13 @@ describe('Given a library for validating json schema models', function () {
|
|
|
77
77
|
oneOf: [
|
|
78
78
|
{
|
|
79
79
|
type: 'string',
|
|
80
|
-
minLength: 2
|
|
80
|
+
minLength: 2,
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
83
|
type: 'number',
|
|
84
|
-
minimum: 2
|
|
84
|
+
minimum: 2,
|
|
85
85
|
},
|
|
86
|
-
]
|
|
86
|
+
],
|
|
87
87
|
};
|
|
88
88
|
});
|
|
89
89
|
it('should return false if neither schema validates', function () {
|
|
@@ -105,24 +105,24 @@ describe('Given a library for validating json schema models', function () {
|
|
|
105
105
|
properties: {
|
|
106
106
|
a: {
|
|
107
107
|
type: 'string',
|
|
108
|
-
minLength: 2
|
|
109
|
-
}
|
|
108
|
+
minLength: 2,
|
|
109
|
+
},
|
|
110
110
|
},
|
|
111
111
|
displayOrder: ['a'],
|
|
112
|
-
required: ['a']
|
|
112
|
+
required: ['a'],
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
type: 'object',
|
|
116
116
|
properties: {
|
|
117
117
|
b: {
|
|
118
118
|
type: 'number',
|
|
119
|
-
minimum: 2
|
|
120
|
-
}
|
|
119
|
+
minimum: 2,
|
|
120
|
+
},
|
|
121
121
|
},
|
|
122
122
|
displayOrder: ['b'],
|
|
123
|
-
required: ['b']
|
|
123
|
+
required: ['b'],
|
|
124
124
|
},
|
|
125
|
-
]
|
|
125
|
+
],
|
|
126
126
|
};
|
|
127
127
|
});
|
|
128
128
|
it('should return false if only one schema is present', function () {
|
|
@@ -143,11 +143,11 @@ describe('Given a library for validating json schema models', function () {
|
|
|
143
143
|
a: {
|
|
144
144
|
hidden: true,
|
|
145
145
|
type: 'number',
|
|
146
|
-
minimum: 2
|
|
147
|
-
}
|
|
146
|
+
minimum: 2,
|
|
147
|
+
},
|
|
148
148
|
},
|
|
149
149
|
required: ['a'],
|
|
150
|
-
displayOrder: ['a']
|
|
150
|
+
displayOrder: ['a'],
|
|
151
151
|
};
|
|
152
152
|
it('should return true for both valid and invalid schemas', function () {
|
|
153
153
|
expect(isValidSchema({ a: 3 }, schema)).toBe(true);
|
|
@@ -2,7 +2,7 @@ import { isEqual, isObjectModel, isStringSchema } from '../../utils';
|
|
|
2
2
|
import { isArray, isString, isNumber, isInteger, isBoolean, isNull, } from '../types/type-validators';
|
|
3
3
|
import { isValidRequired, isValidMinLength, isValidMaxLength, isValidPattern, isValidMaximum, isValidMinimum, isValidMinItems, isValidMaxItems, isValidRequiredArray, } from './validation-failures.utils';
|
|
4
4
|
function getValidationFailures(value, schema, isRequired) {
|
|
5
|
-
if (schema
|
|
5
|
+
if (schema.const) {
|
|
6
6
|
return getConstValidationFailures(value, schema, isRequired);
|
|
7
7
|
}
|
|
8
8
|
if (isNull(value)) {
|
|
@@ -90,7 +90,7 @@ function getConstValidationFailures(value, schema, isRequired) {
|
|
|
90
90
|
if (!isValidRequired(value, isRequired)) {
|
|
91
91
|
return ['required'];
|
|
92
92
|
}
|
|
93
|
-
if (!isEqual(value, schema
|
|
93
|
+
if (!isEqual(value, schema.const)) {
|
|
94
94
|
return ['const'];
|
|
95
95
|
}
|
|
96
96
|
return [];
|