@wise/dynamic-flow-client 0.1.1 → 0.1.3
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/api/utils.d.ts +4 -0
- package/build/common/api/utils.js +13 -0
- package/build/common/contexts/dynamicFlowContext/dynamicFlowContext.d.ts +11 -0
- package/build/common/contexts/dynamicFlowContext/dynamicFlowContext.js +36 -0
- package/build/common/contexts/dynamicFlowContext/usePendingPromiseCounter.d.ts +4 -0
- package/build/common/contexts/dynamicFlowContext/usePendingPromiseCounter.js +13 -0
- package/build/common/contexts/fetcherContext/fetcherContext.d.ts +18 -0
- package/build/common/contexts/fetcherContext/fetcherContext.js +35 -0
- package/build/common/contexts/fetcherContext/index.d.ts +2 -0
- package/build/common/contexts/fetcherContext/index.js +2 -0
- package/build/common/contexts/fetcherContext/makeFetcher.d.ts +2 -0
- package/build/common/contexts/fetcherContext/makeFetcher.js +33 -0
- package/build/common/general/index.d.ts +2 -0
- package/build/common/general/index.js +22 -0
- package/build/common/hooks/useDebouncedFunction.d.ts +2 -0
- package/build/common/hooks/useDebouncedFunction.js +9 -0
- package/build/common/hooks/useDebouncedFunction.test.d.ts +1 -0
- package/build/common/hooks/useDebouncedFunction.test.js +59 -0
- package/build/common/hooks/usePersistAsync.d.ts +7 -0
- package/build/common/hooks/usePersistAsync.js +170 -0
- package/build/common/hooks/usePolling.d.ts +11 -0
- package/build/common/hooks/usePolling.js +48 -0
- package/build/common/hooks/usePrevious.d.ts +2 -0
- package/build/common/hooks/usePrevious.js +9 -0
- package/build/common/index.d.ts +4 -0
- package/build/common/index.js +4 -0
- package/build/common/logging/index.d.ts +22 -0
- package/build/common/logging/index.js +39 -0
- package/build/common/logging/spec.d.ts +1 -0
- package/build/common/logging/spec.js +45 -0
- package/build/common/messages.d.ts +8 -0
- package/build/common/messages.js +8 -0
- package/build/common/propsValues/dateMode.d.ts +4 -0
- package/build/common/propsValues/dateMode.js +4 -0
- package/build/common/propsValues/formControlType.d.ts +17 -0
- package/build/common/propsValues/formControlType.js +17 -0
- package/build/common/propsValues/monthFormat.d.ts +4 -0
- package/build/common/propsValues/monthFormat.js +4 -0
- package/build/common/propsValues/size.d.ts +7 -0
- package/build/common/propsValues/size.js +7 -0
- package/build/common/requirements.d.ts +10 -0
- package/build/common/requirements.js +50 -0
- package/build/common/schemaTypes/schemaTypes.d.ts +23 -0
- package/build/common/schemaTypes/schemaTypes.js +53 -0
- package/build/common/schemaTypes/shouldDebounceSchema.d.ts +2 -0
- package/build/common/schemaTypes/shouldDebounceSchema.js +6 -0
- package/build/common/stepTypes/stepTypes.d.ts +7 -0
- package/build/common/stepTypes/stepTypes.js +42 -0
- package/build/common/tracking/index.d.ts +15 -0
- package/build/common/tracking/index.js +33 -0
- package/build/common/tracking/spec.d.ts +1 -0
- package/build/common/tracking/spec.js +49 -0
- package/build/common/utils/file-utils.d.ts +4 -0
- package/build/common/utils/file-utils.js +45 -0
- package/build/common/utils/generate-random-id.d.ts +1 -0
- package/build/common/utils/generate-random-id.js +5 -0
- package/build/common/utils/generate-random-id.test.d.ts +1 -0
- package/build/common/utils/generate-random-id.test.js +12 -0
- package/build/common/validation/rule-validators/index.d.ts +10 -0
- package/build/common/validation/rule-validators/index.js +40 -0
- package/build/common/validation/rule-validators/spec.d.ts +1 -0
- package/build/common/validation/rule-validators/spec.js +145 -0
- package/build/common/validation/schema-validators/index.d.ts +9 -0
- package/build/common/validation/schema-validators/index.js +98 -0
- package/build/common/validation/schema-validators/spec.d.ts +1 -0
- package/build/common/validation/schema-validators/spec.js +137 -0
- package/build/common/validation/valid-model/index.d.ts +5 -0
- package/build/common/validation/valid-model/index.js +64 -0
- package/build/common/validation/valid-model/spec.d.ts +1 -0
- package/build/common/validation/valid-model/spec.js +605 -0
- package/build/common/validation/valid-model/utils.d.ts +11 -0
- package/build/common/validation/valid-model/utils.js +118 -0
- package/build/common/validation/validation-failures/index.d.ts +23 -0
- package/build/common/validation/validation-failures/index.js +140 -0
- package/build/common/validation/validation-failures/spec.d.ts +1 -0
- package/build/common/validation/validation-failures/spec.js +185 -0
- package/build/dynamic-flow-types/Action.d.ts +19 -0
- package/build/dynamic-flow-types/Action.js +1 -0
- package/build/dynamic-flow-types/FileUploadSchema.d.ts +23 -0
- package/build/dynamic-flow-types/FileUploadSchema.js +3 -0
- package/build/dynamic-flow-types/LayoutComponent.d.ts +129 -0
- package/build/dynamic-flow-types/LayoutComponent.js +1 -0
- package/build/dynamic-flow-types/Model.d.ts +12 -0
- package/build/dynamic-flow-types/Model.js +28 -0
- package/build/dynamic-flow-types/PersistAsync.d.ts +8 -0
- package/build/dynamic-flow-types/PersistAsync.js +1 -0
- package/build/dynamic-flow-types/Polling.d.ts +12 -0
- package/build/dynamic-flow-types/Polling.js +1 -0
- package/build/dynamic-flow-types/Promotion.d.ts +20 -0
- package/build/dynamic-flow-types/Promotion.js +1 -0
- package/build/dynamic-flow-types/Schema.d.ts +184 -0
- package/build/dynamic-flow-types/Schema.js +49 -0
- package/build/dynamic-flow-types/Step.d.ts +127 -0
- package/build/dynamic-flow-types/Step.js +4 -0
- package/build/dynamic-flow-types/ValidationAsync.d.ts +6 -0
- package/build/dynamic-flow-types/ValidationAsync.js +1 -0
- package/build/dynamic-flow-types/core.d.ts +29 -0
- package/build/dynamic-flow-types/core.js +1 -0
- package/build/dynamic-flow-types/index.d.ts +14 -0
- package/build/dynamic-flow-types/index.js +12 -0
- package/build/field/Field.d.ts +69 -0
- package/build/field/Field.js +311 -0
- package/build/field/index.d.ts +2 -0
- package/build/field/index.js +2 -0
- package/build/flow/DynamicFlow.d.ts +4 -0
- package/build/flow/DynamicFlow.js +368 -0
- package/build/flow/DynamicFlowStep.d.ts +9 -0
- package/build/flow/DynamicFlowStep.js +32 -0
- package/build/flow/errorBoundary/ErrorBoundary.d.ts +20 -0
- package/build/flow/errorBoundary/ErrorBoundary.js +45 -0
- package/build/flow/errorBoundary/ErrorBoundary.messages.d.ts +13 -0
- package/build/flow/errorBoundary/ErrorBoundary.messages.js +13 -0
- package/build/flow/errorBoundary/ErrorBoundaryAlert.d.ts +6 -0
- package/build/flow/errorBoundary/ErrorBoundaryAlert.js +12 -0
- package/build/flow/errorBoundary/index.d.ts +1 -0
- package/build/flow/errorBoundary/index.js +1 -0
- package/build/flow/fixtures/components/alert.d.ts +3 -0
- package/build/flow/fixtures/components/alert.js +31 -0
- package/build/flow/fixtures/components/box.d.ts +3 -0
- package/build/flow/fixtures/components/box.js +20 -0
- package/build/flow/fixtures/components/button.d.ts +3 -0
- package/build/flow/fixtures/components/button.js +65 -0
- package/build/flow/fixtures/components/columns.d.ts +3 -0
- package/build/flow/fixtures/components/columns.js +36 -0
- package/build/flow/fixtures/components/copyable.d.ts +3 -0
- package/build/flow/fixtures/components/copyable.js +22 -0
- package/build/flow/fixtures/components/decision.d.ts +3 -0
- package/build/flow/fixtures/components/decision.js +54 -0
- package/build/flow/fixtures/components/heading.d.ts +3 -0
- package/build/flow/fixtures/components/heading.js +14 -0
- package/build/flow/fixtures/components/image.d.ts +3 -0
- package/build/flow/fixtures/components/image.js +22 -0
- package/build/flow/fixtures/components/info.d.ts +3 -0
- package/build/flow/fixtures/components/info.js +17 -0
- package/build/flow/fixtures/components/list.d.ts +3 -0
- package/build/flow/fixtures/components/list.js +34 -0
- package/build/flow/fixtures/components/loading-indicator.d.ts +3 -0
- package/build/flow/fixtures/components/loading-indicator.js +16 -0
- package/build/flow/fixtures/components/paragraph.d.ts +3 -0
- package/build/flow/fixtures/components/paragraph.js +28 -0
- package/build/flow/fixtures/components/review.d.ts +3 -0
- package/build/flow/fixtures/components/review.js +60 -0
- package/build/flow/fixtures/examples/camera-capture.d.ts +3 -0
- package/build/flow/fixtures/examples/camera-capture.js +121 -0
- package/build/flow/fixtures/examples/recipient-update.d.ts +3 -0
- package/build/flow/fixtures/examples/recipient-update.js +250 -0
- package/build/flow/fixtures/examples/recipient.d.ts +3 -0
- package/build/flow/fixtures/examples/recipient.js +313 -0
- package/build/flow/fixtures/examples/single-file-upload.d.ts +3 -0
- package/build/flow/fixtures/examples/single-file-upload.js +96 -0
- package/build/flow/fixtures/examples/step-validation-errors.d.ts +3 -0
- package/build/flow/fixtures/examples/step-validation-errors.js +75 -0
- package/build/flow/fixtures/features/action-response.d.ts +3 -0
- package/build/flow/fixtures/features/action-response.js +29 -0
- package/build/flow/fixtures/features/external.d.ts +3 -0
- package/build/flow/fixtures/features/external.js +31 -0
- package/build/flow/fixtures/features/persist-async.d.ts +3 -0
- package/build/flow/fixtures/features/persist-async.js +44 -0
- package/build/flow/fixtures/features/polling.d.ts +3 -0
- package/build/flow/fixtures/features/polling.js +33 -0
- package/build/flow/fixtures/index.d.ts +42 -0
- package/build/flow/fixtures/index.js +66 -0
- package/build/flow/fixtures/responses/action-response-final.d.ts +3 -0
- package/build/flow/fixtures/responses/action-response-final.js +24 -0
- package/build/flow/fixtures/responses/action.d.ts +5 -0
- package/build/flow/fixtures/responses/action.js +2 -0
- package/build/flow/fixtures/responses/exit.d.ts +6 -0
- package/build/flow/fixtures/responses/exit.js +2 -0
- package/build/flow/fixtures/responses/recipient-update-final.d.ts +3 -0
- package/build/flow/fixtures/responses/recipient-update-final.js +24 -0
- package/build/flow/fixtures/schemas/basic-form.d.ts +3 -0
- package/build/flow/fixtures/schemas/basic-form.js +39 -0
- package/build/flow/fixtures/schemas/number-and-integer.d.ts +3 -0
- package/build/flow/fixtures/schemas/number-and-integer.js +41 -0
- package/build/flow/fixtures/schemas/one-of.d.ts +3 -0
- package/build/flow/fixtures/schemas/one-of.js +223 -0
- package/build/flow/fixtures/schemas/string-formats.d.ts +3 -0
- package/build/flow/fixtures/schemas/string-formats.js +58 -0
- package/build/flow/index.d.ts +1 -0
- package/build/flow/index.js +1 -0
- package/build/flow/response-parsers/index.d.ts +17 -0
- package/build/flow/response-parsers/index.js +112 -0
- package/build/flow/response-parsers/spec.d.ts +1 -0
- package/build/flow/response-parsers/spec.js +263 -0
- package/build/flow/stories/EditableDynamicFlow.d.ts +5 -0
- package/build/flow/stories/EditableDynamicFlow.js +61 -0
- package/build/flow/types.d.ts +77 -0
- package/build/flow/types.js +3 -0
- package/build/flow/useDebouncedRefresh/index.d.ts +1 -0
- package/build/flow/useDebouncedRefresh/index.js +1 -0
- package/build/flow/useDebouncedRefresh/useDebouncedRefresh.d.ts +5 -0
- package/build/flow/useDebouncedRefresh/useDebouncedRefresh.js +24 -0
- package/build/flow/useDynamicFlowState.d.ts +18 -0
- package/build/flow/useDynamicFlowState.js +111 -0
- package/build/flow/useLoader.d.ts +9 -0
- package/build/flow/useLoader.js +22 -0
- package/build/formControl/FormControl.d.ts +86 -0
- package/build/formControl/FormControl.js +241 -0
- package/build/formControl/index.d.ts +1 -0
- package/build/formControl/index.js +1 -0
- package/build/formControl/types.d.ts +57 -0
- package/build/formControl/types.js +1 -0
- package/build/formControl/value-utils.d.ts +9 -0
- package/build/formControl/value-utils.js +108 -0
- package/build/i18n/cs.json +8 -0
- package/build/i18n/de.json +34 -0
- package/build/i18n/en.json +38 -0
- package/build/i18n/es.json +34 -0
- package/build/i18n/fr.json +34 -0
- package/build/i18n/hu.json +34 -0
- package/build/i18n/id.json +34 -0
- package/build/i18n/index.d.ts +2 -0
- package/build/i18n/index.js +31 -0
- package/build/i18n/it.json +34 -0
- package/build/i18n/ja.json +34 -0
- package/build/i18n/pl.json +11 -0
- package/build/i18n/pt.json +34 -0
- package/build/i18n/ro.json +34 -0
- package/build/i18n/ru.json +34 -0
- package/build/i18n/th.json +34 -0
- package/build/i18n/tr.json +11 -0
- package/build/i18n/uk.json +8 -0
- package/build/i18n/zh-CN.json +34 -0
- package/build/i18n/zh.json +34 -0
- package/build/index.d.ts +12 -0
- package/build/index.js +11 -0
- package/build/jsonSchemaForm/JsonSchemaForm.d.ts +66 -0
- package/build/jsonSchemaForm/JsonSchemaForm.js +31 -0
- package/build/jsonSchemaForm/allOfSchema/AllOfSchema.d.ts +14 -0
- package/build/jsonSchemaForm/allOfSchema/AllOfSchema.js +54 -0
- package/build/jsonSchemaForm/allOfSchema/index.d.ts +2 -0
- package/build/jsonSchemaForm/allOfSchema/index.js +1 -0
- package/build/jsonSchemaForm/arrayTypeSchema/ArraySchema.d.ts +15 -0
- package/build/jsonSchemaForm/arrayTypeSchema/ArraySchema.js +25 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.d.ts +16 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.js +26 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/index.d.ts +1 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/index.js +1 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.d.ts +18 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.js +141 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.d.ts +24 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.js +18 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.d.ts +1 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.js +1 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/useFormattedDefaultErrorMessages.d.ts +9 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/useFormattedDefaultErrorMessages.js +14 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils.d.ts +6 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils.js +85 -0
- package/build/jsonSchemaForm/arrayTypeSchema/index.d.ts +2 -0
- package/build/jsonSchemaForm/arrayTypeSchema/index.js +1 -0
- package/build/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.d.ts +22 -0
- package/build/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.js +105 -0
- package/build/jsonSchemaForm/basicTypeSchema/index.d.ts +2 -0
- package/build/jsonSchemaForm/basicTypeSchema/index.js +1 -0
- package/build/jsonSchemaForm/controlFeedback/ControlFeedback.d.ts +31 -0
- package/build/jsonSchemaForm/controlFeedback/ControlFeedback.js +79 -0
- package/build/jsonSchemaForm/controlFeedback/ControlFeedback.messages.d.ts +53 -0
- package/build/jsonSchemaForm/controlFeedback/ControlFeedback.messages.js +53 -0
- package/build/jsonSchemaForm/controlFeedback/index.d.ts +1 -0
- package/build/jsonSchemaForm/controlFeedback/index.js +1 -0
- package/build/jsonSchemaForm/genericSchema/GenericSchema.d.ts +19 -0
- package/build/jsonSchemaForm/genericSchema/GenericSchema.js +122 -0
- package/build/jsonSchemaForm/genericSchema/index.d.ts +1 -0
- package/build/jsonSchemaForm/genericSchema/index.js +1 -0
- package/build/jsonSchemaForm/help/Help.d.ts +8 -0
- package/build/jsonSchemaForm/help/Help.js +9 -0
- package/build/jsonSchemaForm/help/Help.messages.d.ts +8 -0
- package/build/jsonSchemaForm/help/Help.messages.js +8 -0
- package/build/jsonSchemaForm/help/index.d.ts +1 -0
- package/build/jsonSchemaForm/help/index.js +1 -0
- package/build/jsonSchemaForm/index.d.ts +1 -0
- package/build/jsonSchemaForm/index.js +1 -0
- package/build/jsonSchemaForm/objectSchema/ObjectSchema.d.ts +16 -0
- package/build/jsonSchemaForm/objectSchema/ObjectSchema.js +78 -0
- package/build/jsonSchemaForm/objectSchema/index.d.ts +2 -0
- package/build/jsonSchemaForm/objectSchema/index.js +1 -0
- package/build/jsonSchemaForm/oneOfSchema/OneOfSchema.d.ts +15 -0
- package/build/jsonSchemaForm/oneOfSchema/OneOfSchema.js +153 -0
- package/build/jsonSchemaForm/oneOfSchema/getActiveSchemaIndex.d.ts +3 -0
- package/build/jsonSchemaForm/oneOfSchema/getActiveSchemaIndex.js +40 -0
- package/build/jsonSchemaForm/oneOfSchema/getBestMatchingSchemaIndexForValue.d.ts +2 -0
- package/build/jsonSchemaForm/oneOfSchema/getBestMatchingSchemaIndexForValue.js +27 -0
- package/build/jsonSchemaForm/oneOfSchema/index.d.ts +2 -0
- package/build/jsonSchemaForm/oneOfSchema/index.js +1 -0
- package/build/jsonSchemaForm/oneOfSchema/isConstSchema.d.ts +3 -0
- package/build/jsonSchemaForm/oneOfSchema/isConstSchema.js +7 -0
- package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.d.ts +16 -0
- package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.js +26 -0
- package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.d.ts +8 -0
- package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.js +8 -0
- package/build/jsonSchemaForm/persistAsyncSchema/basic/PersistAsyncBasicSchema.d.ts +21 -0
- package/build/jsonSchemaForm/persistAsyncSchema/basic/PersistAsyncBasicSchema.js +168 -0
- package/build/jsonSchemaForm/persistAsyncSchema/basic/index.d.ts +1 -0
- package/build/jsonSchemaForm/persistAsyncSchema/basic/index.js +1 -0
- package/build/jsonSchemaForm/persistAsyncSchema/blob/PersistAsyncBlobSchema.d.ts +20 -0
- package/build/jsonSchemaForm/persistAsyncSchema/blob/PersistAsyncBlobSchema.js +127 -0
- package/build/jsonSchemaForm/persistAsyncSchema/blob/UploadInputAdapter.d.ts +17 -0
- package/build/jsonSchemaForm/persistAsyncSchema/blob/UploadInputAdapter.js +32 -0
- package/build/jsonSchemaForm/persistAsyncSchema/blob/index.d.ts +1 -0
- package/build/jsonSchemaForm/persistAsyncSchema/blob/index.js +1 -0
- package/build/jsonSchemaForm/persistAsyncSchema/index.d.ts +2 -0
- package/build/jsonSchemaForm/persistAsyncSchema/index.js +1 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.d.ts +9 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.js +72 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchemaModelMatcher.d.ts +2 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchemaModelMatcher.js +8 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/control/PromotedOneOfCheckboxControl.d.ts +7 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/control/PromotedOneOfCheckboxControl.js +27 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/control/PromotedOneOfControl.d.ts +23 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/control/PromotedOneOfControl.js +31 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/control/PromotedOneOfRadioControl.d.ts +9 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/control/PromotedOneOfRadioControl.js +32 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/index.d.ts +2 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/index.js +1 -0
- package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.d.ts +8 -0
- package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.js +55 -0
- package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.d.ts +16 -0
- package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js +13 -0
- package/build/jsonSchemaForm/readOnlySchema/index.d.ts +1 -0
- package/build/jsonSchemaForm/readOnlySchema/index.js +1 -0
- package/build/jsonSchemaForm/schemaFormControl/SchemaFormControl.d.ts +25 -0
- package/build/jsonSchemaForm/schemaFormControl/SchemaFormControl.js +106 -0
- package/build/jsonSchemaForm/schemaFormControl/availableCurrencyFlags.d.ts +3 -0
- package/build/jsonSchemaForm/schemaFormControl/availableCurrencyFlags.js +73 -0
- package/build/jsonSchemaForm/schemaFormControl/index.d.ts +1 -0
- package/build/jsonSchemaForm/schemaFormControl/index.js +1 -0
- package/build/jsonSchemaForm/schemaFormControl/optionMapper.d.ts +40 -0
- package/build/jsonSchemaForm/schemaFormControl/optionMapper.js +89 -0
- package/build/jsonSchemaForm/schemas/allOf.json.d.ts +3 -0
- package/build/jsonSchemaForm/schemas/allOf.json.js +119 -0
- package/build/jsonSchemaForm/schemas/audRecipient.json.d.ts +3 -0
- package/build/jsonSchemaForm/schemas/audRecipient.json.js +1104 -0
- package/build/jsonSchemaForm/schemas/base64Url_MultipleFileUpload.json.d.ts +3 -0
- package/build/jsonSchemaForm/schemas/base64Url_MultipleFileUpload.json.js +37 -0
- package/build/jsonSchemaForm/schemas/blob_MultipleFileUpload.json.d.ts +3 -0
- package/build/jsonSchemaForm/schemas/blob_MultipleFileUpload.json.js +36 -0
- package/build/jsonSchemaForm/schemas/currency.json.d.ts +3 -0
- package/build/jsonSchemaForm/schemas/currency.json.js +48 -0
- package/build/jsonSchemaForm/schemas/oneOf.json.d.ts +3 -0
- package/build/jsonSchemaForm/schemas/oneOf.json.js +119 -0
- package/build/jsonSchemaForm/schemas/oneOfTabs.json.d.ts +3 -0
- package/build/jsonSchemaForm/schemas/oneOfTabs.json.js +53 -0
- package/build/jsonSchemaForm/schemas/promotedOneOf.json.d.ts +3 -0
- package/build/jsonSchemaForm/schemas/promotedOneOf.json.js +56 -0
- package/build/jsonSchemaForm/schemas/promotedOneOfCheckbox.json.d.ts +3 -0
- package/build/jsonSchemaForm/schemas/promotedOneOfCheckbox.json.js +102 -0
- package/build/jsonSchemaForm/schemas/simple.json.d.ts +3 -0
- package/build/jsonSchemaForm/schemas/simple.json.js +48 -0
- package/build/jsonSchemaForm/schemas/uploadPersistAsync.json.d.ts +3 -0
- package/build/jsonSchemaForm/schemas/uploadPersistAsync.json.js +71 -0
- package/build/jsonSchemaForm/schemas/validationAsync.json.d.ts +3 -0
- package/build/jsonSchemaForm/schemas/validationAsync.json.js +23 -0
- package/build/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.d.ts +17 -0
- package/build/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.js +149 -0
- package/build/jsonSchemaForm/validationAsyncSchema/index.d.ts +2 -0
- package/build/jsonSchemaForm/validationAsyncSchema/index.js +1 -0
- package/build/layout/DynamicLayout.d.ts +17 -0
- package/build/layout/DynamicLayout.js +75 -0
- package/build/layout/alert/index.d.ts +6 -0
- package/build/layout/alert/index.js +29 -0
- package/build/layout/box/index.d.ts +8 -0
- package/build/layout/box/index.js +41 -0
- package/build/layout/button/index.d.ts +8 -0
- package/build/layout/button/index.js +58 -0
- package/build/layout/columns/index.d.ts +8 -0
- package/build/layout/columns/index.js +38 -0
- package/build/layout/decision/index.d.ts +9 -0
- package/build/layout/decision/index.js +38 -0
- package/build/layout/divider/index.d.ts +7 -0
- package/build/layout/divider/index.js +9 -0
- package/build/layout/external/DynamicExternal.d.ts +8 -0
- package/build/layout/external/DynamicExternal.js +30 -0
- package/build/layout/external/DynamicExternal.messages.d.ts +8 -0
- package/build/layout/external/DynamicExternal.messages.js +8 -0
- package/build/layout/external/index.d.ts +1 -0
- package/build/layout/external/index.js +1 -0
- package/build/layout/external/useExternalStepPolling.d.ts +11 -0
- package/build/layout/external/useExternalStepPolling.js +68 -0
- package/build/layout/form/index.d.ts +8 -0
- package/build/layout/form/index.js +22 -0
- package/build/layout/heading/index.d.ts +6 -0
- package/build/layout/heading/index.js +31 -0
- package/build/layout/icon/index.d.ts +7 -0
- package/build/layout/icon/index.js +22 -0
- package/build/layout/image/index.d.ts +6 -0
- package/build/layout/image/index.js +126 -0
- package/build/layout/index.d.ts +1 -0
- package/build/layout/index.js +1 -0
- package/build/layout/info/index.d.ts +7 -0
- package/build/layout/info/index.js +19 -0
- package/build/layout/layouts/all.json.d.ts +3 -0
- package/build/layout/layouts/all.json.js +176 -0
- package/build/layout/layouts/final-step-layout.json.d.ts +3 -0
- package/build/layout/layouts/final-step-layout.json.js +39 -0
- package/build/layout/layouts/finalStep.json.d.ts +3 -0
- package/build/layout/layouts/finalStep.json.js +24 -0
- package/build/layout/layouts/list.json.d.ts +3 -0
- package/build/layout/layouts/list.json.js +33 -0
- package/build/layout/layouts/pay-in.json.d.ts +3 -0
- package/build/layout/layouts/pay-in.json.js +97 -0
- package/build/layout/layouts/review.json.d.ts +3 -0
- package/build/layout/layouts/review.json.js +160 -0
- package/build/layout/layouts/success.json.d.ts +3 -0
- package/build/layout/layouts/success.json.js +66 -0
- package/build/layout/list/index.d.ts +8 -0
- package/build/layout/list/index.js +30 -0
- package/build/layout/loading-indicator/index.d.ts +7 -0
- package/build/layout/loading-indicator/index.js +10 -0
- package/build/layout/loading-indicator/spec.d.ts +1 -0
- package/build/layout/loading-indicator/spec.js +11 -0
- package/build/layout/paragraph/DynamicParagraph.d.ts +7 -0
- package/build/layout/paragraph/DynamicParagraph.js +42 -0
- package/build/layout/paragraph/DynamicParagraph.messages.d.ts +13 -0
- package/build/layout/paragraph/DynamicParagraph.messages.js +13 -0
- package/build/layout/paragraph/index.d.ts +1 -0
- package/build/layout/paragraph/index.js +1 -0
- package/build/layout/paragraph/useSnackBarIfAvailable.d.ts +10 -0
- package/build/layout/paragraph/useSnackBarIfAvailable.js +9 -0
- package/build/layout/review/index.d.ts +9 -0
- package/build/layout/review/index.js +33 -0
- package/build/layout/utils.d.ts +7 -0
- package/build/layout/utils.js +31 -0
- package/build/main.css +143 -0
- package/build/schema.d.ts +1 -0
- package/build/schema.js +1 -0
- package/build/step/cameraStep/CameraStep.d.ts +8 -0
- package/build/step/cameraStep/CameraStep.js +125 -0
- package/build/step/cameraStep/cameraCapture/CameraCapture.d.ts +16 -0
- package/build/step/cameraStep/cameraCapture/CameraCapture.js +122 -0
- package/build/step/cameraStep/cameraCapture/CameraCapture.messages.d.ts +18 -0
- package/build/step/cameraStep/cameraCapture/CameraCapture.messages.js +18 -0
- package/build/step/cameraStep/cameraCapture/components/index.d.ts +8 -0
- package/build/step/cameraStep/cameraCapture/components/index.js +28 -0
- package/build/step/cameraStep/cameraCapture/hooks/index.d.ts +4 -0
- package/build/step/cameraStep/cameraCapture/hooks/index.js +80 -0
- package/build/step/cameraStep/cameraCapture/index.d.ts +1 -0
- package/build/step/cameraStep/cameraCapture/index.js +1 -0
- package/build/step/cameraStep/cameraCapture/overlay/Overlay.d.ts +11 -0
- package/build/step/cameraStep/cameraCapture/overlay/Overlay.js +78 -0
- package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.d.ts +3 -0
- package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.js +19 -0
- package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.d.ts +13 -0
- package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.js +13 -0
- package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.d.ts +6 -0
- package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.js +21 -0
- package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.d.ts +18 -0
- package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.js +18 -0
- package/build/step/cameraStep/cameraCapture/screens/index.d.ts +2 -0
- package/build/step/cameraStep/cameraCapture/screens/index.js +2 -0
- package/build/step/cameraStep/cameraCapture/tracking/index.d.ts +7 -0
- package/build/step/cameraStep/cameraCapture/tracking/index.js +101 -0
- package/build/step/cameraStep/cameraCapture/utils/index.d.ts +8 -0
- package/build/step/cameraStep/cameraCapture/utils/index.js +103 -0
- package/build/step/cameraStep/index.d.ts +1 -0
- package/build/step/cameraStep/index.js +1 -0
- package/build/step/externalConfirmationStep/ExternalConfirmationStep.d.ts +7 -0
- package/build/step/externalConfirmationStep/ExternalConfirmationStep.js +64 -0
- package/build/step/externalConfirmationStep/ExternalConfirmationStep.messages.d.ts +23 -0
- package/build/step/externalConfirmationStep/ExternalConfirmationStep.messages.js +23 -0
- package/build/step/externalConfirmationStep/index.d.ts +1 -0
- package/build/step/externalConfirmationStep/index.js +1 -0
- package/build/step/features/external/useExternal.d.ts +4 -0
- package/build/step/features/external/useExternal.js +15 -0
- package/build/step/features/index.d.ts +2 -0
- package/build/step/features/index.js +2 -0
- package/build/step/features/polling/useStepPolling.d.ts +2 -0
- package/build/step/features/polling/useStepPolling.js +44 -0
- package/build/step/index.d.ts +3 -0
- package/build/step/index.js +3 -0
- package/build/step/layoutStep/LayoutStep.d.ts +11 -0
- package/build/step/layoutStep/LayoutStep.js +34 -0
- package/build/step/layoutStep/index.d.ts +1 -0
- package/build/step/layoutStep/index.js +1 -0
- package/build/step/layoutStep/layoutService/convertStepToLayout.d.ts +8 -0
- package/build/step/layoutStep/layoutService/convertStepToLayout.js +217 -0
- package/build/step/layoutStep/layoutService/index.d.ts +2 -0
- package/build/step/layoutStep/layoutService/index.js +2 -0
- package/build/step/layoutStep/layoutService/inlineReferences.d.ts +7 -0
- package/build/step/layoutStep/layoutService/inlineReferences.js +91 -0
- package/package.json +1 -1
|
@@ -0,0 +1,605 @@
|
|
|
1
|
+
import { getValidModelParts } from '.';
|
|
2
|
+
describe('Given a library for returning the valid parts of a model based on a schema', function () {
|
|
3
|
+
describe('when cleaning a string schema', function () {
|
|
4
|
+
var schema = { type: 'string' };
|
|
5
|
+
describe('with a string model', function () {
|
|
6
|
+
it('should return the original string', function () {
|
|
7
|
+
var result = getValidModelParts('string', schema);
|
|
8
|
+
expect(result).toBe('string');
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
describe('with a non string model', function () {
|
|
12
|
+
it('should return null', function () {
|
|
13
|
+
expect(getValidModelParts(null, schema)).toBeNull();
|
|
14
|
+
expect(getValidModelParts(123, schema)).toBeNull();
|
|
15
|
+
expect(getValidModelParts(true, schema)).toBeNull();
|
|
16
|
+
expect(getValidModelParts(false, schema)).toBeNull();
|
|
17
|
+
expect(getValidModelParts([123, 456], schema)).toBeNull();
|
|
18
|
+
expect(getValidModelParts(['a', 'b'], schema)).toBeNull();
|
|
19
|
+
expect(getValidModelParts([true, false], schema)).toBeNull();
|
|
20
|
+
expect(getValidModelParts({ a: 1 }, schema)).toBeNull();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
describe('when cleaning a number schema', function () {
|
|
25
|
+
var schema = { type: 'number' };
|
|
26
|
+
describe('with an integer model', function () {
|
|
27
|
+
it('should return the original integer', function () {
|
|
28
|
+
var result = getValidModelParts(12345, schema);
|
|
29
|
+
expect(result).toBe(12345);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
describe('with any float model', function () {
|
|
33
|
+
it('should return the original model', function () {
|
|
34
|
+
var result = getValidModelParts(12.34, schema);
|
|
35
|
+
expect(result).toBe(12.34);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
describe('with any non number model', function () {
|
|
39
|
+
it('should return null', function () {
|
|
40
|
+
expect(getValidModelParts(null, schema)).toBeNull();
|
|
41
|
+
expect(getValidModelParts('abc', schema)).toBeNull();
|
|
42
|
+
expect(getValidModelParts(true, schema)).toBeNull();
|
|
43
|
+
expect(getValidModelParts(false, schema)).toBeNull();
|
|
44
|
+
expect(getValidModelParts([123, 456], schema)).toBeNull();
|
|
45
|
+
expect(getValidModelParts(['a', 'b'], schema)).toBeNull();
|
|
46
|
+
expect(getValidModelParts([true, false], schema)).toBeNull();
|
|
47
|
+
expect(getValidModelParts({ a: 1 }, schema)).toBeNull();
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
describe('when cleaning an integer schema', function () {
|
|
52
|
+
var schema = { type: 'integer' };
|
|
53
|
+
describe('with an integer model', function () {
|
|
54
|
+
it('should return the original integer', function () {
|
|
55
|
+
var result = getValidModelParts(12345, schema);
|
|
56
|
+
expect(result).toBe(12345);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
describe('with any float model', function () {
|
|
60
|
+
it('should return the original model', function () {
|
|
61
|
+
var result = getValidModelParts(12.34, schema);
|
|
62
|
+
expect(result).toBe(12.34);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
describe('with any non number model', function () {
|
|
66
|
+
it('should return null', function () {
|
|
67
|
+
expect(getValidModelParts(null, schema)).toBeNull();
|
|
68
|
+
expect(getValidModelParts('abc', schema)).toBeNull();
|
|
69
|
+
expect(getValidModelParts(true, schema)).toBeNull();
|
|
70
|
+
expect(getValidModelParts(false, schema)).toBeNull();
|
|
71
|
+
expect(getValidModelParts([123, 456], schema)).toBeNull();
|
|
72
|
+
expect(getValidModelParts(['a', 'b'], schema)).toBeNull();
|
|
73
|
+
expect(getValidModelParts([true, false], schema)).toBeNull();
|
|
74
|
+
expect(getValidModelParts({ a: 1 }, schema)).toBeNull();
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
describe('when cleaning a boolean schema', function () {
|
|
79
|
+
var schema = { type: 'boolean' };
|
|
80
|
+
describe('with a boolean model', function () {
|
|
81
|
+
it('should return the original boolean', function () {
|
|
82
|
+
expect(getValidModelParts(true, schema)).toBe(true);
|
|
83
|
+
expect(getValidModelParts(false, schema)).toBe(false);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
describe('with any non boolean model', function () {
|
|
87
|
+
it('should return null', function () {
|
|
88
|
+
expect(getValidModelParts(null, schema)).toBeNull();
|
|
89
|
+
expect(getValidModelParts('abc', schema)).toBeNull();
|
|
90
|
+
expect(getValidModelParts(123, schema)).toBeNull();
|
|
91
|
+
expect(getValidModelParts([123, 456], schema)).toBeNull();
|
|
92
|
+
expect(getValidModelParts(['a', 'b'], schema)).toBeNull();
|
|
93
|
+
expect(getValidModelParts([true, false], schema)).toBeNull();
|
|
94
|
+
expect(getValidModelParts({ a: 1 }, schema)).toBeNull();
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
describe('when cleaning a const schema', function () {
|
|
99
|
+
describe('when the const is a number', function () {
|
|
100
|
+
var schema = { "const": 1 };
|
|
101
|
+
describe('if the model matches the const', function () {
|
|
102
|
+
it('should return the original model', function () {
|
|
103
|
+
var result = getValidModelParts(1, schema);
|
|
104
|
+
expect(result).toBe(1);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
describe('if the model does not match the const', function () {
|
|
108
|
+
it('should return null', function () {
|
|
109
|
+
expect(getValidModelParts(2, schema)).toBeNull();
|
|
110
|
+
expect(getValidModelParts(null, schema)).toBeNull();
|
|
111
|
+
expect(getValidModelParts('abc', schema)).toBeNull();
|
|
112
|
+
expect(getValidModelParts(true, schema)).toBeNull();
|
|
113
|
+
expect(getValidModelParts(false, schema)).toBeNull();
|
|
114
|
+
expect(getValidModelParts([123, 456], schema)).toBeNull();
|
|
115
|
+
expect(getValidModelParts(['one', 'two'], schema)).toBeNull();
|
|
116
|
+
expect(getValidModelParts([true, false], schema)).toBeNull();
|
|
117
|
+
expect(getValidModelParts({ a: 1 }, schema)).toBeNull();
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
describe('if the const evaluates to false', function () {
|
|
121
|
+
it('should still return matches', function () {
|
|
122
|
+
var result = getValidModelParts(0, { "const": 0 });
|
|
123
|
+
expect(result).toBe(0);
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
describe('when the const is a string', function () {
|
|
128
|
+
var schema = { "const": 'one' };
|
|
129
|
+
describe('if the model matches the const', function () {
|
|
130
|
+
it('should return the original model', function () {
|
|
131
|
+
var result = getValidModelParts('one', schema);
|
|
132
|
+
expect(result).toBe('one');
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
describe('if the model does not match the const', function () {
|
|
136
|
+
it('should return null', function () {
|
|
137
|
+
expect(getValidModelParts('two', schema)).toBeNull();
|
|
138
|
+
expect(getValidModelParts(null, schema)).toBeNull();
|
|
139
|
+
expect(getValidModelParts(123, schema)).toBeNull();
|
|
140
|
+
expect(getValidModelParts(true, schema)).toBeNull();
|
|
141
|
+
expect(getValidModelParts(false, schema)).toBeNull();
|
|
142
|
+
expect(getValidModelParts([123, 456], schema)).toBeNull();
|
|
143
|
+
expect(getValidModelParts(['one', 'two'], schema)).toBeNull();
|
|
144
|
+
expect(getValidModelParts([true, false], schema)).toBeNull();
|
|
145
|
+
expect(getValidModelParts({ a: 1 }, schema)).toBeNull();
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
describe('if the const evaluates to false', function () {
|
|
149
|
+
it('should still return matches', function () {
|
|
150
|
+
var result = getValidModelParts('', { "const": '' });
|
|
151
|
+
expect(result).toBe('');
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
describe('when the const is a boolean', function () {
|
|
156
|
+
var schema = { "const": true };
|
|
157
|
+
describe('if the model matches the const', function () {
|
|
158
|
+
it('should return the original model', function () {
|
|
159
|
+
var result = getValidModelParts(true, schema);
|
|
160
|
+
expect(result).toBe(true);
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
describe('if the model does not match the const', function () {
|
|
164
|
+
it('should return null', function () {
|
|
165
|
+
expect(getValidModelParts(false, schema)).toBeNull();
|
|
166
|
+
expect(getValidModelParts('abc', schema)).toBeNull();
|
|
167
|
+
expect(getValidModelParts(null, schema)).toBeNull();
|
|
168
|
+
expect(getValidModelParts(123, schema)).toBeNull();
|
|
169
|
+
expect(getValidModelParts([123, 456], schema)).toBeNull();
|
|
170
|
+
expect(getValidModelParts(['one', 'two'], schema)).toBeNull();
|
|
171
|
+
expect(getValidModelParts([true, false], schema)).toBeNull();
|
|
172
|
+
expect(getValidModelParts({ a: 1 }, schema)).toBeNull();
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
describe('if the const evaluates to false', function () {
|
|
176
|
+
it('should still return matches', function () {
|
|
177
|
+
var result = getValidModelParts(false, { "const": false });
|
|
178
|
+
expect(result).toBe(false);
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
describe('when cleaning a simple object schema', function () {
|
|
184
|
+
var schema = {
|
|
185
|
+
type: 'object',
|
|
186
|
+
properties: {
|
|
187
|
+
a: {
|
|
188
|
+
type: 'number'
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
displayOrder: ['a']
|
|
192
|
+
};
|
|
193
|
+
describe('if the model has a property with the correct name and the correct type', function () {
|
|
194
|
+
it('should return the property', function () {
|
|
195
|
+
var result = getValidModelParts({ a: 1 }, schema);
|
|
196
|
+
expect(result).toStrictEqual({ a: 1 });
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
describe('if the model has a property with the correct name but an incorrect type', function () {
|
|
200
|
+
it('should return an empty object', function () {
|
|
201
|
+
var result = getValidModelParts({ a: 'one' }, schema);
|
|
202
|
+
expect(result).toStrictEqual({});
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
describe('if the model contains properties not in the schema', function () {
|
|
206
|
+
it('should return the object without those properties', function () {
|
|
207
|
+
var result = getValidModelParts({ a: 1, b: 2 }, schema);
|
|
208
|
+
expect(result).toStrictEqual({ a: 1 });
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
describe('if the model is not an object', function () {
|
|
212
|
+
it('should return null', function () {
|
|
213
|
+
expect(getValidModelParts(false, schema)).toBeNull();
|
|
214
|
+
expect(getValidModelParts('abc', schema)).toBeNull();
|
|
215
|
+
expect(getValidModelParts(null, schema)).toBeNull();
|
|
216
|
+
expect(getValidModelParts(123, schema)).toBeNull();
|
|
217
|
+
expect(getValidModelParts([123, 456], schema)).toBeNull();
|
|
218
|
+
expect(getValidModelParts(['one', 'two'], schema)).toBeNull();
|
|
219
|
+
expect(getValidModelParts([true, false], schema)).toBeNull();
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
describe('when cleaning an object schema with nested objects', function () {
|
|
224
|
+
var schema = {
|
|
225
|
+
type: 'object',
|
|
226
|
+
properties: {
|
|
227
|
+
a: {
|
|
228
|
+
type: 'number'
|
|
229
|
+
},
|
|
230
|
+
b: {
|
|
231
|
+
type: 'object',
|
|
232
|
+
properties: {
|
|
233
|
+
c: {
|
|
234
|
+
type: 'number'
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
displayOrder: ['c']
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
displayOrder: ['a', 'b']
|
|
241
|
+
};
|
|
242
|
+
describe('if the nested model is valid', function () {
|
|
243
|
+
it('should be returned', function () {
|
|
244
|
+
var result = getValidModelParts({ a: 1, b: { c: 2 } }, schema);
|
|
245
|
+
expect(result).toStrictEqual({ a: 1, b: { c: 2 } });
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
describe('if the nested model contains invalid properties', function () {
|
|
249
|
+
it('should remove them', function () {
|
|
250
|
+
var result = getValidModelParts({ a: 1, b: { c: 2, d: 3 }, e: 4 }, schema);
|
|
251
|
+
expect(result).toStrictEqual({ a: 1, b: { c: 2 } });
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
describe('when cleaning a oneOf schema of object schemas', function () {
|
|
256
|
+
var schema = {
|
|
257
|
+
oneOf: [
|
|
258
|
+
{
|
|
259
|
+
type: 'object',
|
|
260
|
+
properties: {
|
|
261
|
+
a: {
|
|
262
|
+
type: 'number'
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
displayOrder: ['a']
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
type: 'object',
|
|
269
|
+
properties: {
|
|
270
|
+
b: {
|
|
271
|
+
type: 'number'
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
displayOrder: ['b']
|
|
275
|
+
},
|
|
276
|
+
]
|
|
277
|
+
};
|
|
278
|
+
describe('if all of the properties are valid', function () {
|
|
279
|
+
it('should return them', function () {
|
|
280
|
+
var result = getValidModelParts({ a: 1, b: 2 }, schema);
|
|
281
|
+
expect(result).toStrictEqual({ a: 1, b: 2 });
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
describe('if the nested model contains invalid properties', function () {
|
|
285
|
+
it('should remove them', function () {
|
|
286
|
+
var result = getValidModelParts({ a: 1, b: 'two' }, schema);
|
|
287
|
+
expect(result).toStrictEqual({ a: 1 });
|
|
288
|
+
});
|
|
289
|
+
});
|
|
290
|
+
describe('if the nested model contains ALL invalid properties', function () {
|
|
291
|
+
it('should remove them', function () {
|
|
292
|
+
var result = getValidModelParts({ a: 'one', b: 'two' }, schema);
|
|
293
|
+
expect(result).toStrictEqual({});
|
|
294
|
+
});
|
|
295
|
+
});
|
|
296
|
+
describe('if the model contains undocumented properties', function () {
|
|
297
|
+
it('should remove them', function () {
|
|
298
|
+
var result = getValidModelParts({ a: 1, b: 2, c: 3 }, schema);
|
|
299
|
+
expect(result).toStrictEqual({ a: 1, b: 2 });
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
describe('if the model is not an object', function () {
|
|
303
|
+
it('should return null', function () {
|
|
304
|
+
expect(getValidModelParts(false, schema)).toBeNull();
|
|
305
|
+
expect(getValidModelParts('abc', schema)).toBeNull();
|
|
306
|
+
expect(getValidModelParts(null, schema)).toBeNull();
|
|
307
|
+
expect(getValidModelParts(123, schema)).toBeNull();
|
|
308
|
+
expect(getValidModelParts([123, 456], schema)).toBeNull();
|
|
309
|
+
expect(getValidModelParts(['one', 'two'], schema)).toBeNull();
|
|
310
|
+
expect(getValidModelParts([true, false], schema)).toBeNull();
|
|
311
|
+
});
|
|
312
|
+
});
|
|
313
|
+
});
|
|
314
|
+
describe('when cleaning a oneOf schema of const', function () {
|
|
315
|
+
describe('when the consts are numbers', function () {
|
|
316
|
+
var schema = {
|
|
317
|
+
oneOf: [{ "const": 0 }, { "const": 1 }, { "const": 2 }]
|
|
318
|
+
};
|
|
319
|
+
describe('when the value is in the const collection', function () {
|
|
320
|
+
it('should return the value', function () {
|
|
321
|
+
expect(getValidModelParts(0, schema)).toBe(0);
|
|
322
|
+
expect(getValidModelParts(1, schema)).toBe(1);
|
|
323
|
+
expect(getValidModelParts(2, schema)).toBe(2);
|
|
324
|
+
});
|
|
325
|
+
});
|
|
326
|
+
describe('when the value is not in the const collection', function () {
|
|
327
|
+
it('should return null', function () {
|
|
328
|
+
expect(getValidModelParts(3, schema)).toBeNull();
|
|
329
|
+
expect(getValidModelParts(null, schema)).toBeNull();
|
|
330
|
+
expect(getValidModelParts(true, schema)).toBeNull();
|
|
331
|
+
expect(getValidModelParts(false, schema)).toBeNull();
|
|
332
|
+
expect(getValidModelParts('abc', schema)).toBeNull();
|
|
333
|
+
expect(getValidModelParts(123, schema)).toBeNull();
|
|
334
|
+
expect(getValidModelParts([123, 456], schema)).toBeNull();
|
|
335
|
+
expect(getValidModelParts(['one', 'two'], schema)).toBeNull();
|
|
336
|
+
expect(getValidModelParts([true, false], schema)).toBeNull();
|
|
337
|
+
expect(getValidModelParts({}, schema)).toBeNull();
|
|
338
|
+
});
|
|
339
|
+
});
|
|
340
|
+
});
|
|
341
|
+
describe('when the consts are strings', function () {
|
|
342
|
+
var schema = {
|
|
343
|
+
oneOf: [{ "const": 'zero' }, { "const": 'one' }, { "const": 'two' }]
|
|
344
|
+
};
|
|
345
|
+
describe('when the value is in the const collection', function () {
|
|
346
|
+
it('should return the value', function () {
|
|
347
|
+
expect(getValidModelParts('zero', schema)).toBe('zero');
|
|
348
|
+
expect(getValidModelParts('one', schema)).toBe('one');
|
|
349
|
+
expect(getValidModelParts('two', schema)).toBe('two');
|
|
350
|
+
});
|
|
351
|
+
});
|
|
352
|
+
describe('when the value is not in the const collection', function () {
|
|
353
|
+
it('should return null', function () {
|
|
354
|
+
expect(getValidModelParts('three', schema)).toBeNull();
|
|
355
|
+
expect(getValidModelParts(null, schema)).toBeNull();
|
|
356
|
+
expect(getValidModelParts(true, schema)).toBeNull();
|
|
357
|
+
expect(getValidModelParts(false, schema)).toBeNull();
|
|
358
|
+
expect(getValidModelParts(123, schema)).toBeNull();
|
|
359
|
+
expect(getValidModelParts([123, 456], schema)).toBeNull();
|
|
360
|
+
expect(getValidModelParts(['one', 'two'], schema)).toBeNull();
|
|
361
|
+
expect(getValidModelParts([true, false], schema)).toBeNull();
|
|
362
|
+
expect(getValidModelParts({}, schema)).toBeNull();
|
|
363
|
+
});
|
|
364
|
+
});
|
|
365
|
+
});
|
|
366
|
+
describe('when the consts are booleans', function () {
|
|
367
|
+
var schema = {
|
|
368
|
+
oneOf: [{ "const": false }, { "const": true }]
|
|
369
|
+
};
|
|
370
|
+
describe('when the value is in the const collection', function () {
|
|
371
|
+
it('should return the value', function () {
|
|
372
|
+
expect(getValidModelParts(false, schema)).toBe(false);
|
|
373
|
+
expect(getValidModelParts(true, schema)).toBe(true);
|
|
374
|
+
});
|
|
375
|
+
});
|
|
376
|
+
describe('when the value is not in the const collection', function () {
|
|
377
|
+
it('should return null', function () {
|
|
378
|
+
expect(getValidModelParts(null, schema)).toBeNull();
|
|
379
|
+
expect(getValidModelParts('abc', schema)).toBeNull();
|
|
380
|
+
expect(getValidModelParts(123, schema)).toBeNull();
|
|
381
|
+
expect(getValidModelParts([123, 456], schema)).toBeNull();
|
|
382
|
+
expect(getValidModelParts(['one', 'two'], schema)).toBeNull();
|
|
383
|
+
expect(getValidModelParts([true, false], schema)).toBeNull();
|
|
384
|
+
expect(getValidModelParts({}, schema)).toBeNull();
|
|
385
|
+
});
|
|
386
|
+
});
|
|
387
|
+
});
|
|
388
|
+
});
|
|
389
|
+
describe('when cleaning a oneOf schema of array schemas', function () {
|
|
390
|
+
var schema = {
|
|
391
|
+
oneOf: [
|
|
392
|
+
{
|
|
393
|
+
type: 'array',
|
|
394
|
+
items: { type: 'string' }
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
type: 'array',
|
|
398
|
+
items: { type: 'number' }
|
|
399
|
+
},
|
|
400
|
+
]
|
|
401
|
+
};
|
|
402
|
+
describe('when the model is valid for one of the one-ofs', function () {
|
|
403
|
+
it('should return the model', function () {
|
|
404
|
+
expect(getValidModelParts(['a', 'b', 'c'], schema)).toStrictEqual(['a', 'b', 'c']);
|
|
405
|
+
expect(getValidModelParts([1, 2, 3], schema)).toStrictEqual([1, 2, 3]);
|
|
406
|
+
});
|
|
407
|
+
});
|
|
408
|
+
describe('when the model is NOT valid for any of the one-ofs', function () {
|
|
409
|
+
it('should return null', function () {
|
|
410
|
+
expect(getValidModelParts([true, false, true], schema)).toStrictEqual([null, null, null]);
|
|
411
|
+
expect(getValidModelParts(['a', 'b', 123], schema)).toStrictEqual([null, null, null]);
|
|
412
|
+
expect(getValidModelParts([123, 456, 'abc'], schema)).toStrictEqual([null, null, null]);
|
|
413
|
+
expect(getValidModelParts(null, schema)).toBeNull();
|
|
414
|
+
expect(getValidModelParts('abc', schema)).toBeNull();
|
|
415
|
+
expect(getValidModelParts(123, schema)).toBeNull();
|
|
416
|
+
expect(getValidModelParts({ a: 1 }, schema)).toBeNull();
|
|
417
|
+
});
|
|
418
|
+
});
|
|
419
|
+
});
|
|
420
|
+
describe('when cleaning an allOf schema of object schemas', function () {
|
|
421
|
+
var schema = {
|
|
422
|
+
allOf: [
|
|
423
|
+
{
|
|
424
|
+
type: 'object',
|
|
425
|
+
properties: {
|
|
426
|
+
a: {
|
|
427
|
+
type: 'number'
|
|
428
|
+
}
|
|
429
|
+
},
|
|
430
|
+
displayOrder: ['a']
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
type: 'object',
|
|
434
|
+
properties: {
|
|
435
|
+
b: {
|
|
436
|
+
type: 'number'
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
displayOrder: ['b']
|
|
440
|
+
},
|
|
441
|
+
]
|
|
442
|
+
};
|
|
443
|
+
describe('if all of the properties are valid', function () {
|
|
444
|
+
it('should return them', function () {
|
|
445
|
+
var result = getValidModelParts({ a: 1, b: 2 }, schema);
|
|
446
|
+
expect(result).toStrictEqual({ a: 1, b: 2 });
|
|
447
|
+
});
|
|
448
|
+
});
|
|
449
|
+
describe('if the model contains invalid properties', function () {
|
|
450
|
+
it('should remove them', function () {
|
|
451
|
+
var result = getValidModelParts({ a: 1, b: '2' }, schema);
|
|
452
|
+
expect(result).toStrictEqual({ a: 1 });
|
|
453
|
+
});
|
|
454
|
+
});
|
|
455
|
+
describe('if the model contains undocumented properties', function () {
|
|
456
|
+
it('should remove them', function () {
|
|
457
|
+
var result = getValidModelParts({ a: 1, b: 2, c: 3 }, schema);
|
|
458
|
+
expect(result).toStrictEqual({ a: 1, b: 2 });
|
|
459
|
+
});
|
|
460
|
+
});
|
|
461
|
+
describe('if the models is not an object', function () {
|
|
462
|
+
it('should return null', function () {
|
|
463
|
+
expect(getValidModelParts(null, schema)).toBeNull();
|
|
464
|
+
expect(getValidModelParts(true, schema)).toBeNull();
|
|
465
|
+
expect(getValidModelParts(false, schema)).toBeNull();
|
|
466
|
+
expect(getValidModelParts('abc', schema)).toBeNull();
|
|
467
|
+
expect(getValidModelParts(123, schema)).toBeNull();
|
|
468
|
+
expect(getValidModelParts(['a', 'b', 123], schema)).toBeNull();
|
|
469
|
+
expect(getValidModelParts([true, false], schema)).toBeNull();
|
|
470
|
+
});
|
|
471
|
+
});
|
|
472
|
+
});
|
|
473
|
+
describe('when schemas both contain the same nested object', function () {
|
|
474
|
+
var schema = {
|
|
475
|
+
oneOf: [
|
|
476
|
+
{
|
|
477
|
+
type: 'object',
|
|
478
|
+
properties: {
|
|
479
|
+
nested: {
|
|
480
|
+
type: 'object',
|
|
481
|
+
properties: {
|
|
482
|
+
a: { type: 'string' }
|
|
483
|
+
},
|
|
484
|
+
displayOrder: ['a']
|
|
485
|
+
}
|
|
486
|
+
},
|
|
487
|
+
displayOrder: ['nested']
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
type: 'object',
|
|
491
|
+
properties: {
|
|
492
|
+
nested: {
|
|
493
|
+
type: 'object',
|
|
494
|
+
properties: {
|
|
495
|
+
b: { type: 'string' }
|
|
496
|
+
},
|
|
497
|
+
displayOrder: ['b']
|
|
498
|
+
}
|
|
499
|
+
},
|
|
500
|
+
displayOrder: ['nested']
|
|
501
|
+
},
|
|
502
|
+
]
|
|
503
|
+
};
|
|
504
|
+
it('should deep merge the content of the nested objects', function () {
|
|
505
|
+
var model = { nested: { a: 'one', b: 'two' } };
|
|
506
|
+
var result = getValidModelParts(model, schema);
|
|
507
|
+
expect(result).toStrictEqual(model);
|
|
508
|
+
});
|
|
509
|
+
});
|
|
510
|
+
describe('when cleaning file array schema', function () {
|
|
511
|
+
var schema = {
|
|
512
|
+
type: 'array',
|
|
513
|
+
items: {
|
|
514
|
+
type: 'string',
|
|
515
|
+
persistAsync: {
|
|
516
|
+
url: 'http://localhost:3001/v1/save-file/',
|
|
517
|
+
method: 'POST',
|
|
518
|
+
param: 'bodyAttribute',
|
|
519
|
+
idProperty: 'responseKey',
|
|
520
|
+
schema: {
|
|
521
|
+
type: 'string',
|
|
522
|
+
format: 'base64url',
|
|
523
|
+
maxSize: 5242000,
|
|
524
|
+
title: 'Invoice (optional)'
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
it('should deep merge the content of the nested objects', function () {
|
|
530
|
+
var result = getValidModelParts(['file-123', 'file-234'], schema);
|
|
531
|
+
expect(result).toStrictEqual(['file-123', 'file-234']);
|
|
532
|
+
});
|
|
533
|
+
});
|
|
534
|
+
describe('when cleaning an array schema of number schemas', function () {
|
|
535
|
+
var schema = {
|
|
536
|
+
type: 'array',
|
|
537
|
+
items: { type: 'number' }
|
|
538
|
+
};
|
|
539
|
+
describe('when the model is an array of numbers', function () {
|
|
540
|
+
var model = [1, 2, 3];
|
|
541
|
+
it('should return the model', function () {
|
|
542
|
+
var result = getValidModelParts(model, schema);
|
|
543
|
+
expect(result).toStrictEqual(model);
|
|
544
|
+
});
|
|
545
|
+
});
|
|
546
|
+
describe('when the model is NOT and array of numbers', function () {
|
|
547
|
+
it('should return null', function () {
|
|
548
|
+
expect(getValidModelParts(['a', 'b', 'c'], schema)).toStrictEqual([null, null, null]);
|
|
549
|
+
expect(getValidModelParts([true, false], schema)).toStrictEqual([null, null]);
|
|
550
|
+
expect(getValidModelParts(['a', 'b', 123], schema)).toStrictEqual([null, null, null]);
|
|
551
|
+
expect(getValidModelParts(null, schema)).toBeNull();
|
|
552
|
+
expect(getValidModelParts('abc', schema)).toBeNull();
|
|
553
|
+
expect(getValidModelParts(123, schema)).toBeNull();
|
|
554
|
+
expect(getValidModelParts({ a: 1 }, schema)).toBeNull();
|
|
555
|
+
});
|
|
556
|
+
});
|
|
557
|
+
});
|
|
558
|
+
describe('when cleaning an array schema of string schemas', function () {
|
|
559
|
+
var schema = {
|
|
560
|
+
type: 'array',
|
|
561
|
+
items: { type: 'string' }
|
|
562
|
+
};
|
|
563
|
+
describe('when the model is an array of strings', function () {
|
|
564
|
+
var model = ['a', 'b', 'c'];
|
|
565
|
+
it('should return the model', function () {
|
|
566
|
+
var result = getValidModelParts(model, schema);
|
|
567
|
+
expect(result).toStrictEqual(model);
|
|
568
|
+
});
|
|
569
|
+
});
|
|
570
|
+
describe('when the model is NOT and array of strings', function () {
|
|
571
|
+
it('should return null', function () {
|
|
572
|
+
expect(getValidModelParts(['a', 'b', 123], schema)).toStrictEqual([null, null, null]);
|
|
573
|
+
expect(getValidModelParts([true, false], schema)).toStrictEqual([null, null]);
|
|
574
|
+
expect(getValidModelParts([1, 2, 3], schema)).toStrictEqual([null, null, null]);
|
|
575
|
+
expect(getValidModelParts(null, schema)).toBeNull();
|
|
576
|
+
expect(getValidModelParts('abc', schema)).toBeNull();
|
|
577
|
+
expect(getValidModelParts(123, schema)).toBeNull();
|
|
578
|
+
expect(getValidModelParts({ a: 1 }, schema)).toBeNull();
|
|
579
|
+
});
|
|
580
|
+
});
|
|
581
|
+
});
|
|
582
|
+
describe('when cleaning an array schema of boolean schemas', function () {
|
|
583
|
+
var schema = {
|
|
584
|
+
type: 'array',
|
|
585
|
+
items: { type: 'boolean' }
|
|
586
|
+
};
|
|
587
|
+
describe('when the model is an array of booleans', function () {
|
|
588
|
+
var model = [true, false, true];
|
|
589
|
+
it('should return the model', function () {
|
|
590
|
+
var result = getValidModelParts(model, schema);
|
|
591
|
+
expect(result).toStrictEqual(model);
|
|
592
|
+
});
|
|
593
|
+
});
|
|
594
|
+
describe('when the model is NOT and array of booleans', function () {
|
|
595
|
+
it('should return null', function () {
|
|
596
|
+
expect(getValidModelParts(['a', 'b', 123], schema)).toStrictEqual([null, null, null]);
|
|
597
|
+
expect(getValidModelParts([1, 2, 3], schema)).toStrictEqual([null, null, null]);
|
|
598
|
+
expect(getValidModelParts(null, schema)).toBeNull();
|
|
599
|
+
expect(getValidModelParts('abc', schema)).toBeNull();
|
|
600
|
+
expect(getValidModelParts(123, schema)).toBeNull();
|
|
601
|
+
expect(getValidModelParts({ a: 1 }, schema)).toBeNull();
|
|
602
|
+
});
|
|
603
|
+
});
|
|
604
|
+
});
|
|
605
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AllOfSchema, ArrayModel, ArraySchema, BasicModel, Model, ObjectModel, ObjectSchema, OneOfSchema } from '../../../dynamic-flow-types';
|
|
2
|
+
export declare function cleanBasicModelWithOneOfSchema(model: BasicModel, schema: OneOfSchema): BasicModel | null;
|
|
3
|
+
export declare function cleanArrayModelWithOneOfSchema(model: ArrayModel, schema: OneOfSchema): ArrayModel | null;
|
|
4
|
+
export declare function cleanModelWithStringSchema(model: Model): string | null;
|
|
5
|
+
export declare function cleanModelWithNumberSchema(model: Model): number | null;
|
|
6
|
+
export declare function cleanModelWithBooleanSchema(model: Model): boolean | null;
|
|
7
|
+
export declare function cleanModelWithArraySchema(model: Model, schema: ArraySchema): ArrayModel | null;
|
|
8
|
+
export declare function cleanObjectModelWithObjectSchema(model: ObjectModel, schema: ObjectSchema): ObjectModel;
|
|
9
|
+
export declare function cleanObjectModelWithAllOfSchema(model: ObjectModel, schema: AllOfSchema): ObjectModel;
|
|
10
|
+
export declare function cleanObjectModelWithOneOfSchema(model: ObjectModel, schema: OneOfSchema): ObjectModel | null;
|
|
11
|
+
export declare function filterOutNull<T>(array: (T | null)[]): T[];
|