@wise/dynamic-flow-client 0.4.0-beta-0489d0.8 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -11
- package/build/common/constants/DateMode.js +7 -0
- package/build/common/constants/FormControlType.js +20 -0
- package/build/common/constants/MonthFormat.js +7 -0
- package/build/common/constants/SchemaType.js +14 -0
- package/build/common/constants/Size.js +10 -0
- package/build/common/constants/index.js +21 -0
- package/build/common/contexts/dynamicFlowContexts/DynamicFlowContexts.js +41 -0
- package/build/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.js +17 -0
- package/build/common/contexts/eventsContext/EventsContext.js +39 -0
- package/build/common/contexts/fetcherContexts/FetcherContexts.js +42 -0
- package/build/common/contexts/index.js +20 -0
- package/build/common/contexts/logContext/LogContext.js +45 -0
- package/build/common/hooks/index.js +23 -0
- package/build/common/hooks/useDebouncedFunction/useDebouncedFunction.js +13 -0
- package/build/common/hooks/useExternal/useExternal.js +19 -0
- package/build/common/hooks/useExternalStepPolling/useExternalStepPolling.js +73 -0
- package/build/common/hooks/usePersistAsync/usePersistAsync.js +177 -0
- package/build/common/hooks/usePolling/usePolling.js +53 -0
- package/build/common/hooks/usePrevious/usePrevious.js +12 -0
- package/build/common/hooks/useStepPolling/useStepPolling.js +48 -0
- package/build/common/makeFetcher/index.js +17 -0
- package/build/common/makeFetcher/makeFetcher.js +37 -0
- package/build/common/messages.js +10 -0
- package/build/common/utils/api-utils.js +20 -0
- package/build/common/utils/date-utils.js +27 -0
- package/build/common/utils/debounce.js +42 -0
- package/build/common/utils/file-utils.js +51 -0
- package/build/common/utils/id-utils.js +9 -0
- package/build/common/utils/index.js +24 -0
- package/build/common/utils/is-equal.js +25 -0
- package/build/common/utils/schema-utils.js +55 -0
- package/build/common/utils/step-utils.js +47 -0
- package/build/common/validators/index.js +28 -0
- package/build/common/validators/models/model-validators.js +69 -0
- package/build/common/validators/models/models.utils.js +130 -0
- package/build/common/validators/schemas/schema-validators.js +101 -0
- package/build/common/validators/types/type-validators.js +25 -0
- package/build/common/validators/validationFailures/validation-failures.js +151 -0
- package/build/common/validators/validationFailures/validation-failures.utils.js +51 -0
- package/build/common/validators/values/value-validators.js +9 -0
- package/build/dynamicFlow/DynamicFlow.js +372 -0
- package/build/dynamicFlow/DynamicFlowStep.js +36 -0
- package/build/dynamicFlow/DynamicFlowTypes.js +8 -0
- package/build/dynamicFlow/index.js +16 -0
- package/build/dynamicFlow/stories/DynamicFlow.story.js +36 -0
- package/build/dynamicFlow/stories/EditableDynamicFlow.js +67 -0
- package/build/dynamicFlow/stories/fixtureFetcher.js +118 -0
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.js +47 -0
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.messages.js +15 -0
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundaryAlert.js +19 -0
- package/build/dynamicFlow/utils/index.js +23 -0
- package/build/dynamicFlow/utils/responseParsers/response-parsers.js +131 -0
- package/build/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.js +27 -0
- package/build/dynamicFlow/utils/useDynamicFlowState.js +114 -0
- package/build/dynamicFlow/utils/useLoader.js +26 -0
- package/build/fixtures/components/alert.js +33 -0
- package/build/fixtures/components/box.js +22 -0
- package/build/fixtures/components/button.js +67 -0
- package/build/fixtures/components/columns.js +38 -0
- package/build/fixtures/components/copyable.js +24 -0
- package/build/fixtures/components/decision.js +56 -0
- package/build/fixtures/components/heading.js +16 -0
- package/build/fixtures/components/image.js +25 -0
- package/build/fixtures/components/index.js +40 -0
- package/build/fixtures/components/info.js +19 -0
- package/build/fixtures/components/list.js +36 -0
- package/build/fixtures/components/loading-indicator.js +18 -0
- package/build/fixtures/components/paragraph.js +30 -0
- package/build/fixtures/components/review.js +62 -0
- package/build/fixtures/examples/camera-capture.js +123 -0
- package/build/fixtures/examples/index.js +24 -0
- package/build/fixtures/examples/recipient-update.js +252 -0
- package/build/fixtures/examples/recipient.js +315 -0
- package/build/fixtures/examples/single-file-upload.js +100 -0
- package/build/fixtures/examples/step-validation-errors.js +77 -0
- package/build/fixtures/features/action-response.js +31 -0
- package/build/fixtures/features/external.js +33 -0
- package/build/fixtures/features/index.js +24 -0
- package/build/fixtures/features/persist-async.js +46 -0
- package/build/fixtures/features/polling.js +35 -0
- package/build/fixtures/features/validation-async.js +40 -0
- package/build/fixtures/index.js +49 -0
- package/build/fixtures/jsonSchemaForm/allOf.js +121 -0
- package/build/fixtures/jsonSchemaForm/audRecipient.d.ts +3 -0
- package/build/fixtures/jsonSchemaForm/audRecipient.js +1106 -0
- package/build/fixtures/jsonSchemaForm/currency.d.ts +3 -0
- package/build/fixtures/jsonSchemaForm/currency.js +50 -0
- package/build/fixtures/jsonSchemaForm/multipleFileUploadBase64.d.ts +3 -0
- package/build/fixtures/jsonSchemaForm/multipleFileUploadBase64.js +39 -0
- package/build/fixtures/jsonSchemaForm/multipleFileUploadBlob.d.ts +3 -0
- package/build/fixtures/jsonSchemaForm/multipleFileUploadBlob.js +38 -0
- package/build/fixtures/jsonSchemaForm/oneOf.d.ts +3 -0
- package/build/fixtures/jsonSchemaForm/oneOf.js +121 -0
- package/build/fixtures/jsonSchemaForm/oneOfTabs.d.ts +3 -0
- package/build/fixtures/jsonSchemaForm/oneOfTabs.js +55 -0
- package/build/fixtures/jsonSchemaForm/promotedOneOf.d.ts +3 -0
- package/build/fixtures/jsonSchemaForm/promotedOneOf.js +58 -0
- package/build/fixtures/jsonSchemaForm/promotedOneOfCheckbox.d.ts +3 -0
- package/build/fixtures/jsonSchemaForm/promotedOneOfCheckbox.js +104 -0
- package/build/fixtures/jsonSchemaForm/simple.d.ts +3 -0
- package/build/fixtures/jsonSchemaForm/simple.js +50 -0
- package/build/fixtures/jsonSchemaForm/uploadPersistAsync.d.ts +3 -0
- package/build/fixtures/jsonSchemaForm/uploadPersistAsync.js +73 -0
- package/build/fixtures/jsonSchemaForm/validationAsync.d.ts +3 -0
- package/build/fixtures/jsonSchemaForm/validationAsync.js +25 -0
- package/build/fixtures/layouts/all.js +178 -0
- package/build/fixtures/layouts/final-step-layout.js +41 -0
- package/build/fixtures/layouts/index.js +26 -0
- package/build/fixtures/layouts/list.js +35 -0
- package/build/fixtures/layouts/pay-in.js +99 -0
- package/build/fixtures/layouts/review.js +162 -0
- package/build/fixtures/layouts/success.js +68 -0
- package/build/fixtures/responses/action-response-final.js +26 -0
- package/build/fixtures/responses/action.js +4 -0
- package/build/fixtures/responses/exit.js +4 -0
- package/build/fixtures/responses/index.js +22 -0
- package/build/fixtures/responses/recipient-update-final.js +26 -0
- package/build/fixtures/schemas/basic-form.js +41 -0
- package/build/fixtures/schemas/index.js +22 -0
- package/build/fixtures/schemas/number-and-integer.js +43 -0
- package/build/fixtures/schemas/one-of.js +225 -0
- package/build/fixtures/schemas/string-formats.js +64 -0
- package/build/fixtures/utils/image-util.js +22 -0
- package/build/formControl/FormControl.js +243 -0
- package/build/formControl/index.js +16 -0
- package/build/formControl/utils/index.js +17 -0
- package/build/formControl/utils/value-utils.js +116 -0
- package/build/i18n/index.js +36 -0
- package/build/index.d.ts +11 -0
- package/build/index.js +35 -0
- package/build/jsonSchemaForm/JsonSchemaForm.js +34 -0
- package/build/jsonSchemaForm/allOfSchema/AllOfSchema.js +59 -0
- package/build/jsonSchemaForm/allOfSchema/index.js +16 -0
- package/build/jsonSchemaForm/arrayTypeSchema/ArraySchema.js +30 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.js +31 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/index.js +16 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.js +145 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.js +20 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.js +16 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/index.js +18 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.js +90 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.js +21 -0
- package/build/jsonSchemaForm/arrayTypeSchema/index.js +16 -0
- package/build/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.js +108 -0
- package/build/jsonSchemaForm/basicTypeSchema/index.js +16 -0
- package/build/jsonSchemaForm/controlFeedback/ControlFeedback.js +84 -0
- package/build/jsonSchemaForm/controlFeedback/ControlFeedback.messages.js +55 -0
- package/build/jsonSchemaForm/controlFeedback/index.js +16 -0
- package/build/jsonSchemaForm/genericSchema/GenericSchema.js +127 -0
- package/build/jsonSchemaForm/genericSchema/index.js +16 -0
- package/build/jsonSchemaForm/help/Help.js +14 -0
- package/build/jsonSchemaForm/help/Help.messages.js +10 -0
- package/build/jsonSchemaForm/help/index.js +16 -0
- package/build/jsonSchemaForm/index.js +16 -0
- package/build/jsonSchemaForm/objectSchema/ObjectSchema.js +83 -0
- package/build/jsonSchemaForm/objectSchema/index.js +16 -0
- package/build/jsonSchemaForm/oneOfSchema/OneOfSchema.js +155 -0
- package/build/jsonSchemaForm/oneOfSchema/index.js +16 -0
- package/build/jsonSchemaForm/oneOfSchema/utils/const-schema-utils.js +13 -0
- package/build/jsonSchemaForm/oneOfSchema/utils/index.js +18 -0
- package/build/jsonSchemaForm/oneOfSchema/utils/one-of-utils.js +70 -0
- package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.js +31 -0
- package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.js +10 -0
- package/build/jsonSchemaForm/persistAsyncSchema/index.js +16 -0
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.js +173 -0
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/index.js +16 -0
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.js +131 -0
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.js +36 -0
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/index.js +16 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.js +77 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/index.js +16 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.js +12 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.js +29 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.js +36 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.js +34 -0
- package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.js +60 -0
- package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js +15 -0
- package/build/jsonSchemaForm/readOnlySchema/index.js +16 -0
- package/build/jsonSchemaForm/schemaFormControl/SchemaFormControl.js +111 -0
- package/build/jsonSchemaForm/schemaFormControl/index.js +16 -0
- package/build/jsonSchemaForm/schemaFormControl/utils/currency-utils.js +77 -0
- package/build/jsonSchemaForm/schemaFormControl/utils/index.js +17 -0
- package/build/jsonSchemaForm/schemaFormControl/utils/mapping-utils.js +127 -0
- package/build/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.js +151 -0
- package/build/jsonSchemaForm/validationAsyncSchema/index.js +16 -0
- package/build/layout/DynamicLayout.js +63 -0
- package/build/layout/alert/DynamicAlert.js +31 -0
- package/build/layout/box/DynamicBox.js +43 -0
- package/build/layout/button/DynamicButton.js +60 -0
- package/build/layout/columns/DynamicColumns.js +40 -0
- package/build/layout/decision/DynamicDecision.js +40 -0
- package/build/layout/divider/DynamicDivider.js +11 -0
- package/build/layout/external/DynamicExternal.js +37 -0
- package/build/layout/external/DynamicExternal.messages.js +10 -0
- package/build/layout/form/DynamicForm.js +27 -0
- package/build/layout/heading/DynamicHeading.js +33 -0
- package/build/layout/icon/DynamicIcon.js +50 -0
- package/build/layout/image/DynamicImage.js +112 -0
- package/build/layout/index.js +48 -0
- package/build/layout/info/DynamicInfo.js +21 -0
- package/build/layout/list/DynamicList.js +33 -0
- package/build/layout/loadingIndicator/DynamicLoadingIndicator.js +13 -0
- package/build/layout/paragraph/DynamicParagraph.js +48 -0
- package/build/layout/paragraph/DynamicParagraph.messages.js +15 -0
- package/build/layout/paragraph/useSnackBarIfAvailable.js +13 -0
- package/build/layout/review/DynamicReview.js +35 -0
- package/build/layout/utils.js +35 -0
- package/build/step/cameraStep/CameraStep.js +130 -0
- package/build/step/cameraStep/cameraCapture/CameraCapture.js +127 -0
- package/build/step/cameraStep/cameraCapture/CameraCapture.messages.js +20 -0
- package/build/step/cameraStep/cameraCapture/components/index.js +36 -0
- package/build/step/cameraStep/cameraCapture/hooks/index.js +84 -0
- package/build/step/cameraStep/cameraCapture/index.js +16 -0
- package/build/step/cameraStep/cameraCapture/overlay/Overlay.js +80 -0
- package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.js +24 -0
- package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.js +15 -0
- package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.js +26 -0
- package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.js +20 -0
- package/build/step/cameraStep/cameraCapture/screens/index.js +18 -0
- package/build/step/cameraStep/cameraCapture/tracking/index.js +104 -0
- package/build/step/cameraStep/cameraCapture/utils/index.js +114 -0
- package/build/step/cameraStep/index.js +16 -0
- package/build/step/externalConfirmationStep/ExternalConfirmationStep.js +69 -0
- package/build/step/externalConfirmationStep/ExternalConfirmationStep.messages.js +25 -0
- package/build/step/externalConfirmationStep/index.js +16 -0
- package/build/step/index.js +20 -0
- package/build/step/layoutStep/LayoutStep.js +35 -0
- package/build/step/layoutStep/index.js +16 -0
- package/build/step/layoutStep/utils/index.js +18 -0
- package/build/step/layoutStep/utils/inline-reference-utils.js +95 -0
- package/build/step/layoutStep/utils/layout-utils.js +222 -0
- package/build/types/common/FormControl.js +2 -0
- package/build/types/index.d.ts +15 -10
- package/build/types/index.js +42 -0
- package/build/types/specification/Action.js +2 -0
- package/build/types/specification/FileUploadSchema.js +8 -0
- package/build/types/specification/LayoutComponent.js +2 -0
- package/build/types/specification/Model.js +38 -0
- package/build/types/specification/PersistAsync.js +2 -0
- package/build/types/specification/Polling.js +2 -0
- package/build/types/specification/Promotion.js +2 -0
- package/build/types/specification/Schema.js +67 -0
- package/build/types/specification/Step.js +8 -0
- package/build/types/specification/ValidationAsync.js +2 -0
- package/build/types/specification/core.js +2 -0
- package/package.json +24 -26
- package/build/main.cjs.js +0 -6980
- package/build/main.cjs.min.js +0 -10
- package/build/main.esm.js +0 -6993
- package/build/main.esm.min.js +0 -10
- package/build/main.js +0 -6970
- package/build/main.min.js +0 -10
- package/build/types/types/index.d.ts +0 -15
- /package/build/{types/common → common}/constants/DateMode.d.ts +0 -0
- /package/build/{types/common → common}/constants/FormControlType.d.ts +0 -0
- /package/build/{types/common → common}/constants/MonthFormat.d.ts +0 -0
- /package/build/{types/common → common}/constants/SchemaType.d.ts +0 -0
- /package/build/{types/common → common}/constants/Size.d.ts +0 -0
- /package/build/{types/common → common}/constants/index.d.ts +0 -0
- /package/build/{types/common → common}/contexts/dynamicFlowContexts/DynamicFlowContexts.d.ts +0 -0
- /package/build/{types/common → common}/contexts/dynamicFlowContexts/usePendingPromiseCounter.d.ts +0 -0
- /package/build/{types/common → common}/contexts/eventsContext/EventsContext.d.ts +0 -0
- /package/build/{types/common → common}/contexts/fetcherContexts/FetcherContexts.d.ts +0 -0
- /package/build/{types/common → common}/contexts/index.d.ts +0 -0
- /package/build/{types/common → common}/contexts/logContext/LogContext.d.ts +0 -0
- /package/build/{types/common → common}/hooks/index.d.ts +0 -0
- /package/build/{types/common → common}/hooks/useDebouncedFunction/useDebouncedFunction.d.ts +0 -0
- /package/build/{types/common → common}/hooks/useExternal/useExternal.d.ts +0 -0
- /package/build/{types/common → common}/hooks/useExternalStepPolling/useExternalStepPolling.d.ts +0 -0
- /package/build/{types/common → common}/hooks/usePersistAsync/usePersistAsync.d.ts +0 -0
- /package/build/{types/common → common}/hooks/usePolling/usePolling.d.ts +0 -0
- /package/build/{types/common → common}/hooks/usePrevious/usePrevious.d.ts +0 -0
- /package/build/{types/common → common}/hooks/useStepPolling/useStepPolling.d.ts +0 -0
- /package/build/{types/common → common}/makeFetcher/index.d.ts +0 -0
- /package/build/{types/common → common}/makeFetcher/makeFetcher.d.ts +0 -0
- /package/build/{types/common → common}/messages.d.ts +0 -0
- /package/build/{types/common → common}/utils/api-utils.d.ts +0 -0
- /package/build/{types/common → common}/utils/date-utils.d.ts +0 -0
- /package/build/{types/common → common}/utils/debounce.d.ts +0 -0
- /package/build/{types/common → common}/utils/file-utils.d.ts +0 -0
- /package/build/{types/common → common}/utils/id-utils.d.ts +0 -0
- /package/build/{types/common → common}/utils/index.d.ts +0 -0
- /package/build/{types/common → common}/utils/is-equal.d.ts +0 -0
- /package/build/{types/common → common}/utils/schema-utils.d.ts +0 -0
- /package/build/{types/common → common}/utils/step-utils.d.ts +0 -0
- /package/build/{types/common → common}/validators/index.d.ts +0 -0
- /package/build/{types/common → common}/validators/models/model-validators.d.ts +0 -0
- /package/build/{types/common → common}/validators/models/models.utils.d.ts +0 -0
- /package/build/{types/common → common}/validators/schemas/schema-validators.d.ts +0 -0
- /package/build/{types/common → common}/validators/types/type-validators.d.ts +0 -0
- /package/build/{types/common → common}/validators/validationFailures/validation-failures.d.ts +0 -0
- /package/build/{types/common → common}/validators/validationFailures/validation-failures.utils.d.ts +0 -0
- /package/build/{types/common → common}/validators/values/value-validators.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/DynamicFlow.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/DynamicFlowStep.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/DynamicFlowTypes.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/index.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/stories/DynamicFlow.story.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/stories/EditableDynamicFlow.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/stories/fixtureFetcher.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/utils/errorBoundary/ErrorBoundary.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/utils/errorBoundary/ErrorBoundary.messages.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/utils/errorBoundary/ErrorBoundaryAlert.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/utils/index.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/utils/responseParsers/response-parsers.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/utils/useDebouncedRefresh/useDebouncedRefresh.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/utils/useDynamicFlowState.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/utils/useLoader.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/components/alert.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/components/box.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/components/button.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/components/columns.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/components/copyable.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/components/decision.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/components/heading.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/components/image.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/components/index.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/components/info.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/components/list.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/components/loading-indicator.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/components/paragraph.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/components/review.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/examples/camera-capture.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/examples/index.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/examples/recipient-update.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/examples/recipient.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/examples/single-file-upload.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/examples/step-validation-errors.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/features/action-response.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/features/external.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/features/index.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/features/persist-async.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/features/polling.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/features/validation-async.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/index.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/jsonSchemaForm/allOf.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/layouts/all.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/layouts/final-step-layout.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/layouts/index.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/layouts/list.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/layouts/pay-in.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/layouts/review.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/layouts/success.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/responses/action-response-final.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/responses/action.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/responses/exit.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/responses/index.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/responses/recipient-update-final.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/schemas/basic-form.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/schemas/index.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/schemas/number-and-integer.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/schemas/one-of.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/schemas/string-formats.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/utils/image-util.d.ts +0 -0
- /package/build/{types/formControl → formControl}/FormControl.d.ts +0 -0
- /package/build/{types/formControl → formControl}/index.d.ts +0 -0
- /package/build/{types/formControl → formControl}/utils/index.d.ts +0 -0
- /package/build/{types/formControl → formControl}/utils/value-utils.d.ts +0 -0
- /package/build/{types/i18n → i18n}/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/JsonSchemaForm.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/allOfSchema/AllOfSchema.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/allOfSchema/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/ArraySchema.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/arrayListSchema/ArrayListSchema.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/arrayListSchema/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/basicTypeSchema/BasicTypeSchema.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/basicTypeSchema/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/controlFeedback/ControlFeedback.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/controlFeedback/ControlFeedback.messages.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/controlFeedback/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/genericSchema/GenericSchema.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/genericSchema/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/help/Help.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/help/Help.messages.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/help/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/objectSchema/ObjectSchema.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/objectSchema/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/oneOfSchema/OneOfSchema.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/oneOfSchema/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/oneOfSchema/utils/const-schema-utils.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/oneOfSchema/utils/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/oneOfSchema/utils/one-of-utils.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/persistAsyncSchema/PersistAsyncSchema.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/persistAsyncSchema/PersistAsyncSchema.messages.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/persistAsyncSchema/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/persistAsyncSchema/persistAsyncBasicSchema/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/persistAsyncSchema/persistAsyncBlobSchema/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/promotedOneOfSchema/PromotedOneOfSchema.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/promotedOneOfSchema/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/promotedOneOfSchema/promoted-one-of-utils.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/readOnlySchema/ReadOnlySchema.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/readOnlySchema/ReadOnlySchema.messages.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/readOnlySchema/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/schemaFormControl/SchemaFormControl.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/schemaFormControl/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/schemaFormControl/utils/currency-utils.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/schemaFormControl/utils/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/schemaFormControl/utils/mapping-utils.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/validationAsyncSchema/ValidationAsyncSchema.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/validationAsyncSchema/index.d.ts +0 -0
- /package/build/{types/layout → layout}/DynamicLayout.d.ts +0 -0
- /package/build/{types/layout → layout}/alert/DynamicAlert.d.ts +0 -0
- /package/build/{types/layout → layout}/box/DynamicBox.d.ts +0 -0
- /package/build/{types/layout → layout}/button/DynamicButton.d.ts +0 -0
- /package/build/{types/layout → layout}/columns/DynamicColumns.d.ts +0 -0
- /package/build/{types/layout → layout}/decision/DynamicDecision.d.ts +0 -0
- /package/build/{types/layout → layout}/divider/DynamicDivider.d.ts +0 -0
- /package/build/{types/layout → layout}/external/DynamicExternal.d.ts +0 -0
- /package/build/{types/layout → layout}/external/DynamicExternal.messages.d.ts +0 -0
- /package/build/{types/layout → layout}/form/DynamicForm.d.ts +0 -0
- /package/build/{types/layout → layout}/heading/DynamicHeading.d.ts +0 -0
- /package/build/{types/layout → layout}/icon/DynamicIcon.d.ts +0 -0
- /package/build/{types/layout → layout}/image/DynamicImage.d.ts +0 -0
- /package/build/{types/layout → layout}/index.d.ts +0 -0
- /package/build/{types/layout → layout}/info/DynamicInfo.d.ts +0 -0
- /package/build/{types/layout → layout}/list/DynamicList.d.ts +0 -0
- /package/build/{types/layout → layout}/loadingIndicator/DynamicLoadingIndicator.d.ts +0 -0
- /package/build/{types/layout → layout}/paragraph/DynamicParagraph.d.ts +0 -0
- /package/build/{types/layout → layout}/paragraph/DynamicParagraph.messages.d.ts +0 -0
- /package/build/{types/layout → layout}/paragraph/useSnackBarIfAvailable.d.ts +0 -0
- /package/build/{types/layout → layout}/review/DynamicReview.d.ts +0 -0
- /package/build/{types/layout → layout}/utils.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/CameraStep.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/cameraCapture/CameraCapture.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/cameraCapture/CameraCapture.messages.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/cameraCapture/components/index.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/cameraCapture/hooks/index.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/cameraCapture/index.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/cameraCapture/overlay/Overlay.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/cameraCapture/screens/index.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/cameraCapture/tracking/index.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/cameraCapture/utils/index.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/index.d.ts +0 -0
- /package/build/{types/step → step}/externalConfirmationStep/ExternalConfirmationStep.d.ts +0 -0
- /package/build/{types/step → step}/externalConfirmationStep/ExternalConfirmationStep.messages.d.ts +0 -0
- /package/build/{types/step → step}/externalConfirmationStep/index.d.ts +0 -0
- /package/build/{types/step → step}/index.d.ts +0 -0
- /package/build/{types/step → step}/layoutStep/LayoutStep.d.ts +0 -0
- /package/build/{types/step → step}/layoutStep/index.d.ts +0 -0
- /package/build/{types/step → step}/layoutStep/utils/index.d.ts +0 -0
- /package/build/{types/step → step}/layoutStep/utils/inline-reference-utils.d.ts +0 -0
- /package/build/{types/step → step}/layoutStep/utils/layout-utils.d.ts +0 -0
- /package/build/types/{types/common → common}/FormControl.d.ts +0 -0
- /package/build/types/{types/specification → specification}/Action.d.ts +0 -0
- /package/build/types/{types/specification → specification}/FileUploadSchema.d.ts +0 -0
- /package/build/types/{types/specification → specification}/LayoutComponent.d.ts +0 -0
- /package/build/types/{types/specification → specification}/Model.d.ts +0 -0
- /package/build/types/{types/specification → specification}/PersistAsync.d.ts +0 -0
- /package/build/types/{types/specification → specification}/Polling.d.ts +0 -0
- /package/build/types/{types/specification → specification}/Promotion.d.ts +0 -0
- /package/build/types/{types/specification → specification}/Schema.d.ts +0 -0
- /package/build/types/{types/specification → specification}/Step.d.ts +0 -0
- /package/build/types/{types/specification → specification}/ValidationAsync.d.ts +0 -0
- /package/build/types/{types/specification → specification}/core.d.ts +0 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
exports.__esModule = true;
|
|
14
|
+
exports.cleanObjectModelWithOneOfSchema = exports.cleanObjectModelWithAllOfSchema = exports.cleanObjectModelWithObjectSchema = exports.cleanModelWithArraySchema = exports.cleanModelWithBooleanSchema = exports.cleanModelWithNumberSchema = exports.cleanModelWithStringSchema = exports.cleanArrayModelWithOneOfSchema = exports.cleanBasicModelWithOneOfSchema = void 0;
|
|
15
|
+
var types_1 = require("../../../types");
|
|
16
|
+
var type_validators_1 = require("../types/type-validators");
|
|
17
|
+
var value_validators_1 = require("../values/value-validators");
|
|
18
|
+
var model_validators_1 = require("./model-validators");
|
|
19
|
+
function cleanBasicModelWithOneOfSchema(model, schema) {
|
|
20
|
+
return schema.oneOf.some(function (nestedSchema) { return (0, model_validators_1.getValidBasicModelOrNull)(model, nestedSchema) === model; })
|
|
21
|
+
? model
|
|
22
|
+
: null;
|
|
23
|
+
}
|
|
24
|
+
exports.cleanBasicModelWithOneOfSchema = cleanBasicModelWithOneOfSchema;
|
|
25
|
+
function cleanArrayModelWithOneOfSchema(model, schema) {
|
|
26
|
+
var _a;
|
|
27
|
+
var validModels = schema.oneOf
|
|
28
|
+
.map(function (nestedSchema) { return getValidArrayModelOrNull(model, nestedSchema); })
|
|
29
|
+
.filter(function (item) { return item !== null; });
|
|
30
|
+
if (validModels.length === 0) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
return (_a = validModels.find(function (model) { return model.some(function (item) { return item !== null; }); })) !== null && _a !== void 0 ? _a : validModels[0];
|
|
34
|
+
}
|
|
35
|
+
exports.cleanArrayModelWithOneOfSchema = cleanArrayModelWithOneOfSchema;
|
|
36
|
+
function getValidArrayModelOrNull(model, schema) {
|
|
37
|
+
if (!(0, types_1.isArraySchema)(schema)) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
if (!(0, types_1.isListArraySchema)(schema)) {
|
|
41
|
+
return null; // we don't support tuples at the moment
|
|
42
|
+
}
|
|
43
|
+
return cleanModelWithArraySchema(model, schema);
|
|
44
|
+
}
|
|
45
|
+
function cleanModelWithStringSchema(model) {
|
|
46
|
+
return (0, type_validators_1.isString)(model) && !(0, value_validators_1.isEmpty)(model) ? model : null;
|
|
47
|
+
}
|
|
48
|
+
exports.cleanModelWithStringSchema = cleanModelWithStringSchema;
|
|
49
|
+
function cleanModelWithNumberSchema(model) {
|
|
50
|
+
return (0, type_validators_1.isNumber)(model) ? model : null;
|
|
51
|
+
}
|
|
52
|
+
exports.cleanModelWithNumberSchema = cleanModelWithNumberSchema;
|
|
53
|
+
function cleanModelWithBooleanSchema(model) {
|
|
54
|
+
return (0, type_validators_1.isBoolean)(model) ? model : null;
|
|
55
|
+
}
|
|
56
|
+
exports.cleanModelWithBooleanSchema = cleanModelWithBooleanSchema;
|
|
57
|
+
function cleanModelWithArraySchema(model, schema) {
|
|
58
|
+
if (!(0, type_validators_1.isArray)(model)) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
if (!(0, types_1.isListArraySchema)(schema)) {
|
|
62
|
+
return null; // we don't support tuples at the moment
|
|
63
|
+
}
|
|
64
|
+
if (model.length > 0) {
|
|
65
|
+
var expectedType_1 = typeof model[0];
|
|
66
|
+
if (!model.every(function (item) { return typeof item === expectedType_1; })) {
|
|
67
|
+
return new Array(model.length).fill(null);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return model.map(function (childModel) { return (0, model_validators_1.getValidBasicModelOrNull)(childModel, schema.items); });
|
|
71
|
+
}
|
|
72
|
+
exports.cleanModelWithArraySchema = cleanModelWithArraySchema;
|
|
73
|
+
function cleanObjectModelWithObjectSchema(model, schema) {
|
|
74
|
+
return Object.keys(schema.properties).reduce(function (cleanedModel, property) {
|
|
75
|
+
var _a;
|
|
76
|
+
// If the property exists in the model, clean it, and add it
|
|
77
|
+
if (model && !(0, type_validators_1.isUndefined)(model[property])) {
|
|
78
|
+
var subModel = model[property];
|
|
79
|
+
var subSchema = schema.properties[property];
|
|
80
|
+
var newValue = (0, model_validators_1.getValidModelParts)(subModel, subSchema);
|
|
81
|
+
if (!(0, type_validators_1.isNull)(newValue)) {
|
|
82
|
+
return __assign(__assign({}, cleanedModel), (_a = {}, _a[property] = newValue, _a));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return cleanedModel;
|
|
86
|
+
}, {});
|
|
87
|
+
}
|
|
88
|
+
exports.cleanObjectModelWithObjectSchema = cleanObjectModelWithObjectSchema;
|
|
89
|
+
function cleanObjectModelWithAllOfSchema(model, schema) {
|
|
90
|
+
return schema.allOf.reduce(function (cleanObjectModel, nestedSchema) {
|
|
91
|
+
var validSubsetOfModel = (0, model_validators_1.getValidObjectModelParts)(model, nestedSchema);
|
|
92
|
+
if ((0, types_1.isObjectModel)(validSubsetOfModel)) {
|
|
93
|
+
// Extend model with valid subset
|
|
94
|
+
return __assign(__assign({}, cleanObjectModel), validSubsetOfModel);
|
|
95
|
+
}
|
|
96
|
+
return cleanObjectModel;
|
|
97
|
+
}, {});
|
|
98
|
+
}
|
|
99
|
+
exports.cleanObjectModelWithAllOfSchema = cleanObjectModelWithAllOfSchema;
|
|
100
|
+
function cleanObjectModelWithOneOfSchema(model, schema) {
|
|
101
|
+
return schema.oneOf
|
|
102
|
+
.map(function (nestedSchema) { return (0, model_validators_1.getValidObjectModelParts)(model, nestedSchema); })
|
|
103
|
+
.reduce(function (combined, current) {
|
|
104
|
+
// If we didn't find anything valid yet, and current is good, return it
|
|
105
|
+
if ((0, type_validators_1.isNull)(combined)) {
|
|
106
|
+
return current;
|
|
107
|
+
}
|
|
108
|
+
// If we're dealing with two objects, deep merge them into one
|
|
109
|
+
if ((0, types_1.isObjectModel)(combined) && (0, types_1.isObjectModel)(current)) {
|
|
110
|
+
return deepMergeObject(combined, current);
|
|
111
|
+
}
|
|
112
|
+
// If the current one is null, return what we already had
|
|
113
|
+
if ((0, type_validators_1.isNull)(current)) {
|
|
114
|
+
return combined;
|
|
115
|
+
}
|
|
116
|
+
return current;
|
|
117
|
+
}, null);
|
|
118
|
+
}
|
|
119
|
+
exports.cleanObjectModelWithOneOfSchema = cleanObjectModelWithOneOfSchema;
|
|
120
|
+
function deepMergeObject(object1, object2) {
|
|
121
|
+
return Object.keys(object2).reduce(function (acc, property) {
|
|
122
|
+
var _a, _b;
|
|
123
|
+
var object1Property = object1[property];
|
|
124
|
+
var object2Property = object2[property];
|
|
125
|
+
if ((0, types_1.isObjectModel)(object1Property) && (0, types_1.isObjectModel)(object2Property)) {
|
|
126
|
+
return __assign(__assign({}, acc), (_a = {}, _a[property] = deepMergeObject(object1Property, object2Property), _a));
|
|
127
|
+
}
|
|
128
|
+
return __assign(__assign({}, acc), (_b = {}, _b[property] = object2[property], _b));
|
|
129
|
+
}, __assign({}, object1));
|
|
130
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.isValidSchema = void 0;
|
|
4
|
+
var types_1 = require("../../../types");
|
|
5
|
+
var type_validators_1 = require("../types/type-validators");
|
|
6
|
+
var validation_failures_1 = require("../validationFailures/validation-failures");
|
|
7
|
+
function isValidStringSchema(value, schema) {
|
|
8
|
+
return !(0, validation_failures_1.getStringValidationFailures)(value, schema).length;
|
|
9
|
+
}
|
|
10
|
+
function isValidNumberSchema(value, schema) {
|
|
11
|
+
return !(0, validation_failures_1.getNumberValidationFailures)(value, schema).length;
|
|
12
|
+
}
|
|
13
|
+
function isValidIntegerSchema(value, schema) {
|
|
14
|
+
return !(0, validation_failures_1.getIntegerValidationFailures)(value, schema).length;
|
|
15
|
+
}
|
|
16
|
+
function isValidBooleanSchema(value, schema) {
|
|
17
|
+
return !(0, validation_failures_1.getBooleanValidationFailures)(value, schema).length;
|
|
18
|
+
}
|
|
19
|
+
function isValidConstSchema(value, schema) {
|
|
20
|
+
return !(0, validation_failures_1.getConstValidationFailures)(value, schema).length;
|
|
21
|
+
}
|
|
22
|
+
function isValidObjectSchema(value, schema) {
|
|
23
|
+
if (!(0, type_validators_1.isObject)(value) || schema.type !== 'object' || !(0, type_validators_1.isObject)(schema.properties)) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
return Object.keys(schema.properties)
|
|
27
|
+
.map(function (propertyName) {
|
|
28
|
+
return isObjectPropertyValid(value[propertyName], schema.properties[propertyName], schema.required && schema.required.includes(propertyName));
|
|
29
|
+
})
|
|
30
|
+
.every(function (property) { return property; });
|
|
31
|
+
}
|
|
32
|
+
function isObjectPropertyValid(propertyValue, propertySchema, isRequired) {
|
|
33
|
+
if (typeof propertyValue === 'undefined') {
|
|
34
|
+
return !isRequired;
|
|
35
|
+
}
|
|
36
|
+
return isValidSchema(propertyValue, propertySchema);
|
|
37
|
+
}
|
|
38
|
+
function isValidArraySchema(value, schema) {
|
|
39
|
+
if (schema.type !== 'array' || !(0, type_validators_1.isObject)(schema.items)) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
if ((0, validation_failures_1.getArrayValidationFailures)(value, schema).length > 0) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
return (Array.isArray(value) &&
|
|
46
|
+
(0, types_1.isListArraySchema)(schema) && // TupleArraySchema not yet supported
|
|
47
|
+
value.map(function (item) { return isValidSchema(item, schema.items); }).every(function (valid) { return valid; }));
|
|
48
|
+
}
|
|
49
|
+
function isValidOneOfSchema(value, schema) {
|
|
50
|
+
if (!(0, type_validators_1.isArray)(schema.oneOf)) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
return schema.oneOf.some(function (childSchema) { return isValidSchema(value, childSchema); });
|
|
54
|
+
}
|
|
55
|
+
function isValidAllOfSchema(value, schema) {
|
|
56
|
+
if (!(0, type_validators_1.isArray)(schema.allOf)) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
return schema.allOf
|
|
60
|
+
.map(function (childSchema) { return isValidSchema(value, childSchema); })
|
|
61
|
+
.every(function (valid) { return valid; });
|
|
62
|
+
}
|
|
63
|
+
function isValidBlobSchema(value, schema) {
|
|
64
|
+
return !(0, validation_failures_1.getBlobValidationFailures)(value, schema).length;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Validate any value against a given schema
|
|
68
|
+
*
|
|
69
|
+
* @param value
|
|
70
|
+
* @param schema
|
|
71
|
+
*/
|
|
72
|
+
function isValidSchema(value, schema) {
|
|
73
|
+
if (schema.oneOf) {
|
|
74
|
+
return isValidOneOfSchema(value, schema);
|
|
75
|
+
}
|
|
76
|
+
if (schema.allOf) {
|
|
77
|
+
return isValidAllOfSchema(value, schema);
|
|
78
|
+
}
|
|
79
|
+
if (schema["const"]) {
|
|
80
|
+
return isValidConstSchema(value, schema);
|
|
81
|
+
}
|
|
82
|
+
switch (schema.type) {
|
|
83
|
+
case 'string':
|
|
84
|
+
return isValidStringSchema(value, schema);
|
|
85
|
+
case 'number':
|
|
86
|
+
return isValidNumberSchema(value, schema);
|
|
87
|
+
case 'integer':
|
|
88
|
+
return isValidIntegerSchema(value, schema);
|
|
89
|
+
case 'boolean':
|
|
90
|
+
return isValidBooleanSchema(value, schema);
|
|
91
|
+
case 'array':
|
|
92
|
+
return isValidArraySchema(value, schema);
|
|
93
|
+
case 'object':
|
|
94
|
+
return isValidObjectSchema(value, schema);
|
|
95
|
+
case 'blob':
|
|
96
|
+
return isValidBlobSchema(value, schema);
|
|
97
|
+
default:
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.isValidSchema = isValidSchema;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.isUndefined = exports.isNull = exports.isArray = exports.isObject = exports.isBoolean = exports.isInteger = exports.isNumber = exports.isString = void 0;
|
|
4
|
+
var isString = function (value) { return typeof value === 'string'; };
|
|
5
|
+
exports.isString = isString;
|
|
6
|
+
var isNumber = function (value) {
|
|
7
|
+
return typeof value === 'number' && !Number.isNaN(value);
|
|
8
|
+
};
|
|
9
|
+
exports.isNumber = isNumber;
|
|
10
|
+
var isInteger = function (value) {
|
|
11
|
+
return (0, exports.isNumber)(value) && Math.floor(value) === value;
|
|
12
|
+
};
|
|
13
|
+
exports.isInteger = isInteger;
|
|
14
|
+
var isBoolean = function (value) { return typeof value === 'boolean'; };
|
|
15
|
+
exports.isBoolean = isBoolean;
|
|
16
|
+
var isObject = function (value) {
|
|
17
|
+
return !(0, exports.isNull)(value) && !(0, exports.isUndefined)(value) && (value === null || value === void 0 ? void 0 : value.constructor) === Object;
|
|
18
|
+
};
|
|
19
|
+
exports.isObject = isObject;
|
|
20
|
+
var isArray = function (value) { return Array.isArray(value); };
|
|
21
|
+
exports.isArray = isArray;
|
|
22
|
+
var isNull = function (value) { return value === null; };
|
|
23
|
+
exports.isNull = isNull;
|
|
24
|
+
var isUndefined = function (value) { return typeof value === 'undefined'; };
|
|
25
|
+
exports.isUndefined = isUndefined;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.getBlobValidationFailures = exports.getObjectValidationFailures = exports.getArrayValidationFailures = exports.getConstValidationFailures = exports.getBooleanValidationFailures = exports.getIntegerValidationFailures = exports.getNumberValidationFailures = exports.getStringValidationFailures = exports.getValidationFailures = void 0;
|
|
4
|
+
var types_1 = require("../../../types");
|
|
5
|
+
var Schema_1 = require("../../../types/specification/Schema");
|
|
6
|
+
var type_validators_1 = require("../types/type-validators");
|
|
7
|
+
var validation_failures_utils_1 = require("./validation-failures.utils");
|
|
8
|
+
function getValidationFailures(value, schema, isRequired) {
|
|
9
|
+
if (schema["const"]) {
|
|
10
|
+
return getConstValidationFailures(value, schema, isRequired);
|
|
11
|
+
}
|
|
12
|
+
if ((0, type_validators_1.isNull)(value)) {
|
|
13
|
+
return isRequired ? ['required'] : [];
|
|
14
|
+
}
|
|
15
|
+
if ((0, Schema_1.isStringSchema)(schema)) {
|
|
16
|
+
return getStringValidationFailures(value, schema, isRequired);
|
|
17
|
+
}
|
|
18
|
+
switch (schema.type) {
|
|
19
|
+
case 'number':
|
|
20
|
+
return getNumberValidationFailures(value, schema, isRequired);
|
|
21
|
+
case 'integer':
|
|
22
|
+
return getIntegerValidationFailures(value, schema, isRequired);
|
|
23
|
+
case 'boolean':
|
|
24
|
+
return getBooleanValidationFailures(value, schema, isRequired);
|
|
25
|
+
case 'array':
|
|
26
|
+
return getArrayValidationFailures(value, schema, isRequired);
|
|
27
|
+
case 'object':
|
|
28
|
+
return getObjectValidationFailures(value, schema);
|
|
29
|
+
default:
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.getValidationFailures = getValidationFailures;
|
|
34
|
+
function getStringValidationFailures(value, schema, isRequired) {
|
|
35
|
+
if (!(0, type_validators_1.isString)(value) && !(0, type_validators_1.isNull)(value)) {
|
|
36
|
+
return ['type'];
|
|
37
|
+
}
|
|
38
|
+
if (value === '' && isRequired) {
|
|
39
|
+
return ['required'];
|
|
40
|
+
}
|
|
41
|
+
var failures = [];
|
|
42
|
+
if (!(0, validation_failures_utils_1.isValidRequired)(value, isRequired)) {
|
|
43
|
+
failures.push('required');
|
|
44
|
+
}
|
|
45
|
+
if (!(0, validation_failures_utils_1.isValidMinLength)(value, schema.minLength)) {
|
|
46
|
+
failures.push('minLength');
|
|
47
|
+
}
|
|
48
|
+
if (!(0, validation_failures_utils_1.isValidMaxLength)(value, schema.maxLength)) {
|
|
49
|
+
failures.push('maxLength');
|
|
50
|
+
}
|
|
51
|
+
if (!(0, validation_failures_utils_1.isValidPattern)(value, schema.pattern)) {
|
|
52
|
+
failures.push('pattern');
|
|
53
|
+
}
|
|
54
|
+
if (!(0, validation_failures_utils_1.isValidMinimum)(value, schema.minimum)) {
|
|
55
|
+
failures.push('minimum');
|
|
56
|
+
}
|
|
57
|
+
if (!(0, validation_failures_utils_1.isValidMaximum)(value, schema.maximum)) {
|
|
58
|
+
failures.push('maximum');
|
|
59
|
+
}
|
|
60
|
+
return failures;
|
|
61
|
+
}
|
|
62
|
+
exports.getStringValidationFailures = getStringValidationFailures;
|
|
63
|
+
function getNumberValidationFailures(value, schema, isRequired) {
|
|
64
|
+
if (!(0, type_validators_1.isNumber)(value) && !(0, type_validators_1.isNull)(value)) {
|
|
65
|
+
return ['type'];
|
|
66
|
+
}
|
|
67
|
+
var failures = [];
|
|
68
|
+
if (!(0, validation_failures_utils_1.isValidRequired)(value, isRequired)) {
|
|
69
|
+
failures.push('required');
|
|
70
|
+
}
|
|
71
|
+
if (!(0, validation_failures_utils_1.isValidMinimum)(value, schema.minimum)) {
|
|
72
|
+
failures.push('minimum');
|
|
73
|
+
}
|
|
74
|
+
if (!(0, validation_failures_utils_1.isValidMaximum)(value, schema.maximum)) {
|
|
75
|
+
failures.push('maximum');
|
|
76
|
+
}
|
|
77
|
+
return failures;
|
|
78
|
+
}
|
|
79
|
+
exports.getNumberValidationFailures = getNumberValidationFailures;
|
|
80
|
+
function getIntegerValidationFailures(value, schema, isRequired) {
|
|
81
|
+
if (!(0, type_validators_1.isInteger)(value)) {
|
|
82
|
+
return ['type'];
|
|
83
|
+
}
|
|
84
|
+
return getNumberValidationFailures(value, schema, isRequired);
|
|
85
|
+
}
|
|
86
|
+
exports.getIntegerValidationFailures = getIntegerValidationFailures;
|
|
87
|
+
function getBooleanValidationFailures(value, _schema, isRequired) {
|
|
88
|
+
if (!(0, type_validators_1.isBoolean)(value) && !(0, type_validators_1.isNull)(value)) {
|
|
89
|
+
return ['type'];
|
|
90
|
+
}
|
|
91
|
+
var failures = [];
|
|
92
|
+
if (!(0, validation_failures_utils_1.isValidRequired)(value, isRequired)) {
|
|
93
|
+
failures.push('required');
|
|
94
|
+
}
|
|
95
|
+
return failures;
|
|
96
|
+
}
|
|
97
|
+
exports.getBooleanValidationFailures = getBooleanValidationFailures;
|
|
98
|
+
function getConstValidationFailures(value, schema, isRequired) {
|
|
99
|
+
if (!(0, validation_failures_utils_1.isValidRequired)(value, isRequired)) {
|
|
100
|
+
return ['required'];
|
|
101
|
+
}
|
|
102
|
+
if (value !== schema["const"]) {
|
|
103
|
+
return ['const'];
|
|
104
|
+
}
|
|
105
|
+
return [];
|
|
106
|
+
}
|
|
107
|
+
exports.getConstValidationFailures = getConstValidationFailures;
|
|
108
|
+
function getArrayValidationFailures(value, schema, isRequired) {
|
|
109
|
+
if (!(0, type_validators_1.isArray)(value) && !(0, type_validators_1.isNull)(value)) {
|
|
110
|
+
return ['type'];
|
|
111
|
+
}
|
|
112
|
+
if (!(0, validation_failures_utils_1.isValidRequiredArray)(value, isRequired)) {
|
|
113
|
+
return ['required'];
|
|
114
|
+
}
|
|
115
|
+
var failures = [];
|
|
116
|
+
if (!(0, validation_failures_utils_1.isValidMinItems)(value, schema.minItems)) {
|
|
117
|
+
failures.push('minItems');
|
|
118
|
+
}
|
|
119
|
+
if (!(0, validation_failures_utils_1.isValidMaxItems)(value, schema.maxItems)) {
|
|
120
|
+
failures.push('maxItems');
|
|
121
|
+
}
|
|
122
|
+
return failures;
|
|
123
|
+
}
|
|
124
|
+
exports.getArrayValidationFailures = getArrayValidationFailures;
|
|
125
|
+
function getBlobValidationFailures(value, _schema) {
|
|
126
|
+
if ((0, type_validators_1.isNull)(value)) {
|
|
127
|
+
return ['type'];
|
|
128
|
+
}
|
|
129
|
+
return [];
|
|
130
|
+
}
|
|
131
|
+
exports.getBlobValidationFailures = getBlobValidationFailures;
|
|
132
|
+
/**
|
|
133
|
+
* When validating an object we only checking that it is an object and that it
|
|
134
|
+
* has the required properties, we do not check if the properties are valid.
|
|
135
|
+
*
|
|
136
|
+
* @param value
|
|
137
|
+
* @param schema
|
|
138
|
+
*/
|
|
139
|
+
function getObjectValidationFailures(value, schema) {
|
|
140
|
+
if (!(0, types_1.isObjectModel)(value)) {
|
|
141
|
+
return ['type'];
|
|
142
|
+
}
|
|
143
|
+
if (!(0, type_validators_1.isArray)(schema.required)) {
|
|
144
|
+
return [];
|
|
145
|
+
}
|
|
146
|
+
var allPresent = schema.required
|
|
147
|
+
.map(function (property) { return typeof value[property] !== 'undefined'; })
|
|
148
|
+
.reduce(function (propertyInModel, validSoFar) { return propertyInModel && validSoFar; }, true);
|
|
149
|
+
return allPresent ? [] : ['required'];
|
|
150
|
+
}
|
|
151
|
+
exports.getObjectValidationFailures = getObjectValidationFailures;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.isValidRequiredArray = exports.isValidMaxItems = exports.isValidMinItems = exports.isValidMinimum = exports.isValidMaximum = exports.isValidPattern = exports.isValidMaxLength = exports.isValidMinLength = exports.isValidRequired = void 0;
|
|
4
|
+
var validators_1 = require("../../validators");
|
|
5
|
+
function isValidRequired(value, isRequired) {
|
|
6
|
+
if (isRequired === void 0) { isRequired = false; }
|
|
7
|
+
return !isRequired || !(0, validators_1.isUndefined)(value);
|
|
8
|
+
}
|
|
9
|
+
exports.isValidRequired = isValidRequired;
|
|
10
|
+
function isValidRequiredArray(value, isRequired) {
|
|
11
|
+
if (isRequired === void 0) { isRequired = false; }
|
|
12
|
+
return !isRequired || (0, validators_1.isArray)(value);
|
|
13
|
+
}
|
|
14
|
+
exports.isValidRequiredArray = isValidRequiredArray;
|
|
15
|
+
function isValidMinLength(value, minLength) {
|
|
16
|
+
return !(0, validators_1.isNumber)(minLength) || ((0, validators_1.isString)(value) && value.length >= minLength);
|
|
17
|
+
}
|
|
18
|
+
exports.isValidMinLength = isValidMinLength;
|
|
19
|
+
function isValidMaxLength(value, maxLength) {
|
|
20
|
+
return !(0, validators_1.isNumber)(maxLength) || ((0, validators_1.isString)(value) && value.length <= maxLength);
|
|
21
|
+
}
|
|
22
|
+
exports.isValidMaxLength = isValidMaxLength;
|
|
23
|
+
function isValidPattern(value, pattern) {
|
|
24
|
+
if (pattern === undefined) {
|
|
25
|
+
return true; // no pattern, therefore the value is valid
|
|
26
|
+
}
|
|
27
|
+
if (value === undefined || value === null) {
|
|
28
|
+
return false; // no value, but there's a pattern, therefore the value is NOT valid
|
|
29
|
+
}
|
|
30
|
+
var regex = new RegExp(pattern);
|
|
31
|
+
return !!regex.test(value);
|
|
32
|
+
}
|
|
33
|
+
exports.isValidPattern = isValidPattern;
|
|
34
|
+
function isValidMaximum(value, maximum) {
|
|
35
|
+
return ((!(0, validators_1.isNumber)(maximum) && !(0, validators_1.isString)(maximum)) ||
|
|
36
|
+
(((0, validators_1.isNumber)(value) || (0, validators_1.isString)(value)) && value <= maximum));
|
|
37
|
+
}
|
|
38
|
+
exports.isValidMaximum = isValidMaximum;
|
|
39
|
+
function isValidMinimum(value, minimum) {
|
|
40
|
+
return ((!(0, validators_1.isNumber)(minimum) && !(0, validators_1.isString)(minimum)) ||
|
|
41
|
+
(((0, validators_1.isNumber)(value) || (0, validators_1.isString)(value)) && value >= minimum));
|
|
42
|
+
}
|
|
43
|
+
exports.isValidMinimum = isValidMinimum;
|
|
44
|
+
function isValidMinItems(value, minItems) {
|
|
45
|
+
return !(0, validators_1.isNumber)(minItems) || ((0, validators_1.isArray)(value) && value.length >= minItems);
|
|
46
|
+
}
|
|
47
|
+
exports.isValidMinItems = isValidMinItems;
|
|
48
|
+
function isValidMaxItems(value, maxItems) {
|
|
49
|
+
return !(0, validators_1.isNumber)(maxItems) || ((0, validators_1.isArray)(value) && value.length <= maxItems);
|
|
50
|
+
}
|
|
51
|
+
exports.isValidMaxItems = isValidMaxItems;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.isEmpty = void 0;
|
|
4
|
+
var type_validators_1 = require("../types/type-validators");
|
|
5
|
+
var isEmpty = function (value) {
|
|
6
|
+
return ((0, type_validators_1.isString)(value) && value.length === 0) ||
|
|
7
|
+
(((0, type_validators_1.isObject)(value) || (0, type_validators_1.isArray)(value)) && Object.keys(value).length === 0);
|
|
8
|
+
};
|
|
9
|
+
exports.isEmpty = isEmpty;
|