@justifi/webcomponents 5.4.3 → 5.5.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/dist/cjs/Api-KMweahmp.js +74 -0
- package/dist/cjs/{Business-d88b77fd.js → Business-DyiDiIuO.js} +1 -1
- package/dist/cjs/{Checkout-5352009d.js → Checkout-RAGvjVPj.js} +1 -1
- package/dist/cjs/{ComponentError-233ac749.js → ComponentError-C4MdBBMe.js} +1 -0
- package/dist/cjs/{Payment-bccd8f7d.js → Payment-CQCmj3Ck.js} +2 -2
- package/dist/cjs/{SubAccount-2a302ead.js → Refund-DpKGhW3o.js} +25 -1
- package/dist/cjs/_commonjsHelpers-BJu3ubxk.js +10 -0
- package/dist/cjs/additional-questions-details_5.cjs.entry.js +5 -11
- package/dist/cjs/{badge-364e6311.js → badge-BXpCpcer.js} +2 -2
- package/dist/cjs/bank-account-document-form-inputs_4.cjs.entry.js +25 -43
- package/dist/cjs/bank-account-form_9.cjs.entry.js +93 -97
- package/dist/cjs/{business-additional-questions-schema-8568cb79.js → business-additional-questions-schema-mzZ2gYHQ.js} +2 -2
- package/dist/cjs/business-details-core.cjs.entry.js +6 -10
- package/dist/cjs/{business-form-options-62e9c8ab.js → business-form-options-BCj0efiD.js} +1 -1
- package/dist/cjs/{business-identity-schema-518ab6eb.js → business-identity-schema-dt0zCW0R.js} +2 -2
- package/dist/cjs/{business.service-6e8a29a2.js → business.service-Crmkeulk.js} +23 -8
- package/dist/cjs/{button-4a9fd41e.js → button-KWTLx2LP.js} +2 -2
- package/dist/cjs/{check-pkg-version-64d3381a.js → check-pkg-version-CLsX6cK5.js} +3 -3
- package/dist/cjs/{checkout.service-0a7835dc.js → checkout.service-r90INf2g.js} +13 -10
- package/dist/cjs/checkouts-list-core.cjs.entry.js +25 -31
- package/dist/cjs/{payments-list-params-state-442d9944.js → checkouts-list-params-state-Cmfy_CND.js} +1 -1
- package/dist/cjs/{checkouts-table-8a1b49ff.js → checkouts-table-5jU4JUcM.js} +4 -4
- package/dist/cjs/custom-popper_4.cjs.entry.js +27 -52
- package/dist/cjs/{dispute.service-6efc7d7f.js → dispute.service-CGgfmGU-.js} +20 -11
- package/dist/cjs/{event-types-5a6ce2b0.js → event-types-CJapDsYA.js} +3 -3
- package/dist/cjs/form-alert_5.cjs.entry.js +10 -19
- package/dist/cjs/form-control-checkbox.cjs.entry.js +9 -18
- package/dist/cjs/form-control-date.cjs.entry.js +9 -19
- package/dist/cjs/{form-control-error-text-3cff9b7b.js → form-control-error-text-D19AMaOO.js} +2 -2
- package/dist/cjs/form-control-file-v2_2.cjs.entry.js +11 -30
- package/dist/cjs/{form-control-help-text-94ffed2c.js → form-control-help-text-CbrDvt9D.js} +2 -2
- package/dist/cjs/form-control-help-text.cjs.entry.js +1 -5
- package/dist/cjs/form-control-monetary-provisioning.cjs.entry.js +13 -22
- package/dist/cjs/form-control-monetary.cjs.entry.js +13 -22
- package/dist/cjs/form-control-number-masked_2.cjs.entry.js +12 -25
- package/dist/cjs/form-control-number.cjs.entry.js +9 -18
- package/dist/cjs/form-control-radio.cjs.entry.js +7 -17
- package/dist/cjs/{get-business-d8f5db51.js → get-business-BBzGEPBG.js} +3 -3
- package/dist/cjs/get-payment-details-CKg1Lb3_.js +42 -0
- package/dist/cjs/{get-payout-csv-7607c71e.js → get-payout-csv-DD9C5yMw.js} +11 -11
- package/dist/cjs/{get-subaccounts-ae5b35a8.js → get-subaccounts-YlFT-fBr.js} +11 -10
- package/dist/cjs/gross-payment-chart-core.cjs.entry.js +262 -270
- package/dist/cjs/{header-1-43b2b905.js → header-1-ZNnpq6yT.js} +2 -2
- package/dist/cjs/{header-3-eb250a04.js → header-3-D6LxdW_A.js} +2 -2
- package/dist/cjs/{helpers-602962eb.js → helpers-B5OCqlIM.js} +1 -1
- package/dist/cjs/{iframe-input-styles-state-d0de0b24.js → iframe-input-styles-state-CQL59u0d.js} +2 -2
- package/dist/cjs/iframe-input.cjs.entry.js +1640 -0
- package/dist/cjs/{index-750475a3.js → index-1MT3Z4XI.js} +1 -1
- package/dist/cjs/{index-d2d0b181.js → index-DhcqPIbT.js} +4 -5
- package/dist/cjs/{index-5b9a3b5f.js → index-DtkhH7sB.js} +460 -271
- package/dist/cjs/index.esm-CVuJLXJZ.js +11807 -0
- package/dist/cjs/{input-handlers-cff032bb.js → input-handlers-DYl_0IwC.js} +1 -1
- package/dist/cjs/{insurance-state-71f8b653.js → insurance-state-q5eNmjIK.js} +3 -3
- package/dist/cjs/justifi-additional-questions-form-step-core_6.cjs.entry.js +64 -94
- package/dist/cjs/justifi-additional-questions-form-step_9.cjs.entry.js +36 -86
- package/dist/cjs/justifi-additional-statement_8.cjs.entry.js +36 -54
- package/dist/cjs/justifi-business-details.cjs.entry.js +16 -20
- package/dist/cjs/justifi-business-form.cjs.entry.js +34 -38
- package/dist/cjs/justifi-business-representative-form-inputs.cjs.entry.js +6 -11
- package/dist/cjs/justifi-checkout-core.cjs.entry.js +31 -34
- package/dist/cjs/justifi-checkout.cjs.entry.js +23 -29
- package/dist/cjs/justifi-checkouts-list-filters.cjs.entry.js +15 -18
- package/dist/cjs/justifi-checkouts-list.cjs.entry.js +25 -30
- package/dist/cjs/justifi-details.cjs.entry.js +3 -6
- package/dist/cjs/justifi-dispute-management-core.cjs.entry.js +5 -11
- package/dist/cjs/justifi-dispute-management.cjs.entry.js +19 -23
- package/dist/cjs/justifi-dispute-notification_3.cjs.entry.js +38 -52
- package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +13 -16
- package/dist/cjs/justifi-order-terminals.cjs.entry.js +30 -39
- package/dist/cjs/justifi-owner-form_3.cjs.entry.js +29 -52
- package/dist/cjs/justifi-payment-details.cjs.entry.js +24 -52
- package/dist/cjs/justifi-payment-provisioning-core.cjs.entry.js +15 -23
- package/dist/cjs/justifi-payment-provisioning.cjs.entry.js +15 -16
- package/dist/cjs/justifi-payments-list-filters.cjs.entry.js +11 -17
- package/dist/cjs/justifi-payments-list.cjs.entry.js +25 -29
- package/dist/cjs/justifi-payout-details.cjs.entry.js +21 -26
- package/dist/cjs/justifi-payouts-list-filters.cjs.entry.js +9 -12
- package/dist/cjs/justifi-payouts-list.cjs.entry.js +27 -33
- package/dist/cjs/justifi-refund-payment.cjs.entry.js +189 -69
- package/dist/cjs/justifi-season-interruption-insurance-core.cjs.entry.js +10 -27
- package/dist/cjs/justifi-season-interruption-insurance.cjs.entry.js +24 -35
- package/dist/cjs/justifi-terminal-orders-list-filters.cjs.entry.js +24 -26
- package/dist/cjs/justifi-terminal-orders-list.cjs.entry.js +29 -29
- package/dist/cjs/justifi-terminals-list-filters.cjs.entry.js +21 -25
- package/dist/cjs/justifi-terminals-list.cjs.entry.js +26 -31
- package/dist/cjs/justifi-tokenize-payment-method.cjs.entry.js +24 -28
- package/dist/cjs/loader.cjs.js +3 -5
- package/dist/cjs/lodash-CvSCBJ_8.js +17216 -0
- package/dist/cjs/package-5B4P3NpD.js +9 -0
- package/dist/cjs/pagination-menu.cjs.entry.js +3 -5
- package/dist/cjs/{parts-5ca90f9a.js → parts-D_uKOPFe.js} +3 -1
- package/dist/cjs/payment-details-core.cjs.entry.js +19 -22
- package/dist/cjs/{payment-provisioning-actions-382ab48c.js → payment-provisioning-actions-BkWSDJQQ.js} +2 -2
- package/dist/cjs/payment.service-BrHUGHYs.js +23 -0
- package/dist/cjs/payments-list-core.cjs.entry.js +25 -30
- package/dist/cjs/{terminal-orders-list-params-state-c419078f.js → payments-list-params-state-Cmfy_CND.js} +1 -1
- package/dist/cjs/{payments-status-075aad0a.js → payments-status-DAzq_Z13.js} +2 -2
- package/dist/cjs/{payments-table-a076755a.js → payments-table-BEpL6oJQ.js} +4 -4
- package/dist/cjs/payout-details-core.cjs.entry.js +14 -18
- package/dist/cjs/payouts-list-core.cjs.entry.js +26 -33
- package/dist/cjs/{checkouts-list-params-state-644d3639.js → payouts-list-params-state-Cmfy_CND.js} +1 -1
- package/dist/cjs/{payouts-status-ced97c2b.js → payouts-status-CYrKPRld.js} +2 -2
- package/dist/cjs/{payouts-table-aedce326.js → payouts-table-Bbi23U5v.js} +4 -4
- package/dist/cjs/{schema-validations-a7cefbdf.js → schema-validations-p4OCdblz.js} +4 -4
- package/dist/cjs/{skeleton-e8aa41d0.js → skeleton-C59M0QK2.js} +2 -2
- package/dist/cjs/{spinner-580453f2.js → spinner-736baCoH.js} +2 -2
- package/dist/cjs/{styled-host-94309bab.js → styled-host-JifnTMIV.js} +2 -3
- package/dist/cjs/table-filters-menu.cjs.entry.js +4 -10
- package/dist/cjs/terminal-orders-list-core.cjs.entry.js +24 -29
- package/dist/cjs/{payouts-list-params-state-033b76d6.js → terminal-orders-list-params-state-Cmfy_CND.js} +1 -1
- package/dist/cjs/{terminal-orders-table-3b247193.js → terminal-orders-table-w4Yaf83b.js} +35 -5
- package/dist/cjs/terminal-quantity-selector.cjs.entry.js +6 -12
- package/dist/cjs/{terminal.service-ab62c344.js → terminal.service-BjSo5Cm4.js} +11 -11
- package/dist/cjs/terminals-list-core.cjs.entry.js +25 -31
- package/dist/cjs/terminals-list-params-state-Cmfy_CND.js +22 -0
- package/dist/cjs/{terminals-table-6710a76c.js → terminals-table-F6pkR97i.js} +6 -6
- package/dist/cjs/{utils-f8714daa.js → utils-D3seTk2e.js} +2 -2
- package/dist/cjs/utils-DmZ8Dia3.js +23987 -0
- package/dist/cjs/{utils-7a478c37.js → utils-l0veqT9y.js} +1 -1
- package/dist/cjs/webcomponents.cjs.js +7 -7
- package/dist/collection/actions/payment/get-payment-details.js +5 -2
- package/dist/collection/actions/refund/refund-actions.js +31 -0
- package/dist/collection/api/Api.js +32 -13
- package/dist/collection/api/ComponentError.js +1 -0
- package/dist/collection/api/Refund.js +32 -0
- package/dist/collection/api/TerminalOrder.js +3 -0
- package/dist/collection/api/index.js +1 -0
- package/dist/collection/api/services/analytics.service.js +1 -1
- package/dist/collection/api/services/business.service.js +22 -7
- package/dist/collection/api/services/checkout.service.js +6 -3
- package/dist/collection/api/services/dispute.service.js +13 -4
- package/dist/collection/api/services/insurance.service.js +8 -2
- package/dist/collection/api/services/payment.service.js +3 -3
- package/dist/collection/api/services/payout.service.js +3 -3
- package/dist/collection/api/services/provision.service.js +4 -1
- package/dist/collection/api/services/refund.service.js +10 -0
- package/dist/collection/api/services/reports.service.js +1 -1
- package/dist/collection/api/services/subaccounts.service.js +1 -1
- package/dist/collection/api/services/terminal.service.js +4 -4
- package/dist/collection/api/services/terminal_orders.service.js +5 -1
- package/dist/collection/collection-manifest.json +3 -5
- package/dist/collection/components/business-details/additional-questions-details/additional-questions-details.js +4 -4
- package/dist/collection/components/business-details/business-details-core.js +4 -3
- package/dist/collection/components/business-details/business-details.js +6 -8
- package/dist/collection/components/business-details/generic-info-details/generic-info-details.js +4 -4
- package/dist/collection/components/business-details/legal-address-details/legal-address-details.js +4 -4
- package/dist/collection/components/business-details/owner-details/owner-details.js +4 -4
- package/dist/collection/components/business-details/representative-details/representative-details.js +4 -4
- package/dist/collection/components/business-forms/business-form/additional-questions/additional-questions.js +4 -2
- package/dist/collection/components/business-forms/business-form/business-core-info/business-core-info.js +4 -2
- package/dist/collection/components/business-forms/business-form/business-form.js +20 -13
- package/dist/collection/components/business-forms/business-form/business-representative/business-representative.js +6 -4
- package/dist/collection/components/business-forms/business-form/legal-address-form/legal-address-form.js +4 -3
- package/dist/collection/components/business-forms/owner-form/identity-address/identity-address-form.js +11 -7
- package/dist/collection/components/business-forms/owner-form/owner-form-core.js +34 -22
- package/dist/collection/components/business-forms/owner-form/owner-form-inputs.js +10 -6
- package/dist/collection/components/business-forms/owner-form/owner-form.js +22 -19
- package/dist/collection/components/business-forms/payment-provisioning/additional-questions/business-additional-questions-form-step-core.js +15 -11
- package/dist/collection/components/business-forms/payment-provisioning/additional-questions/business-additional-questions-form-step.js +9 -10
- package/dist/collection/components/business-forms/payment-provisioning/bank-account/bank-account-document-inputs.js +11 -8
- package/dist/collection/components/business-forms/payment-provisioning/bank-account/bank-account-form-inputs.js +13 -10
- package/dist/collection/components/business-forms/payment-provisioning/bank-account/business-bank-account-form-step-core.js +23 -16
- package/dist/collection/components/business-forms/payment-provisioning/bank-account/business-bank-account-form-step.js +9 -12
- package/dist/collection/components/business-forms/payment-provisioning/bank-account/business-documents-on-file.js +6 -2
- package/dist/collection/components/business-forms/payment-provisioning/business-core-info/business-core-info-form-step-core.js +17 -12
- package/dist/collection/components/business-forms/payment-provisioning/business-core-info/business-core-info-form-step.js +9 -10
- package/dist/collection/components/business-forms/payment-provisioning/business-owners/business-owners-form-step-core.js +20 -14
- package/dist/collection/components/business-forms/payment-provisioning/business-owners/business-owners-form-step.js +9 -10
- package/dist/collection/components/business-forms/payment-provisioning/business-representative/business-representative-form-inputs.js +10 -6
- package/dist/collection/components/business-forms/payment-provisioning/business-representative/business-representative-form-step-core.js +14 -10
- package/dist/collection/components/business-forms/payment-provisioning/business-representative/business-representative-form-step.js +9 -10
- package/dist/collection/components/business-forms/payment-provisioning/form-control-monetary-provisioning.js +31 -21
- package/dist/collection/components/business-forms/payment-provisioning/legal-address-form/legal-address-form-step-core.js +14 -10
- package/dist/collection/components/business-forms/payment-provisioning/legal-address-form/legal-address-form-step.js +9 -10
- package/dist/collection/components/business-forms/payment-provisioning/payment-provisioning-core.js +24 -16
- package/dist/collection/components/business-forms/payment-provisioning/payment-provisioning-form-buttons.js +20 -14
- package/dist/collection/components/business-forms/payment-provisioning/payment-provisioning-form-steps.js +21 -12
- package/dist/collection/components/business-forms/payment-provisioning/payment-provisioning.js +12 -8
- package/dist/collection/components/business-forms/payment-provisioning/terms-and-conditions/business-terms-conditions-form-step.js +13 -13
- package/dist/collection/components/checkout/bank-account-form/bank-account-form.js +3 -2
- package/dist/collection/components/checkout/billing-form/billing-form-schema.js +21 -0
- package/dist/collection/components/checkout/billing-form/billing-form.js +203 -0
- package/dist/collection/components/checkout/card-form/card-form.js +5 -4
- package/dist/collection/components/checkout/checkout-core.js +88 -37
- package/dist/collection/components/checkout/checkout.js +70 -28
- package/dist/collection/components/checkout/new-payment-method.js +110 -30
- package/dist/collection/components/checkout/payment-method-options.js +91 -36
- package/dist/collection/components/checkout/saved-payment-method.js +7 -4
- package/dist/collection/components/checkout/sezzle-payment-method.js +19 -15
- package/dist/collection/components/checkouts-list/checkouts-list-core.js +17 -14
- package/dist/collection/components/checkouts-list/checkouts-list-filters.js +7 -5
- package/dist/collection/components/checkouts-list/checkouts-list.js +16 -12
- package/dist/collection/components/dispute-management/dispute-management-core.js +11 -8
- package/dist/collection/components/dispute-management/dispute-management.js +12 -9
- package/dist/collection/components/dispute-management/dispute-notification.js +11 -9
- package/dist/collection/components/dispute-management/dispute-response/additional-statement.js +10 -9
- package/dist/collection/components/dispute-management/dispute-response/cancellation-policy.js +10 -8
- package/dist/collection/components/dispute-management/dispute-response/customer-details.js +10 -8
- package/dist/collection/components/dispute-management/dispute-response/dispute-response-core.js +21 -14
- package/dist/collection/components/dispute-management/dispute-response/dispute-response.js +16 -13
- package/dist/collection/components/dispute-management/dispute-response/duplicate-charge.js +10 -8
- package/dist/collection/components/dispute-management/dispute-response/electronic-evidence.js +10 -8
- package/dist/collection/components/dispute-management/dispute-response/product-or-service.js +10 -8
- package/dist/collection/components/dispute-management/dispute-response/refund-policy.js +10 -8
- package/dist/collection/components/dispute-management/dispute-response/shipping-details.js +10 -8
- package/dist/collection/components/gross-payment-chart/gross-payment-chart-core.js +5 -4
- package/dist/collection/components/gross-payment-chart/gross-payment-chart.js +7 -6
- package/dist/collection/components/insurance/season-interruption/season-interruption-insurance-core.js +44 -30
- package/dist/collection/components/insurance/season-interruption/season-interruption-insurance.js +40 -32
- package/dist/collection/components/order-terminals/order-terminals.js +20 -16
- package/dist/collection/components/order-terminals/terminal-quantity-selector/terminal-quantity-selector.js +19 -13
- package/dist/collection/components/payment-details/payment-details-core.js +13 -12
- package/dist/collection/components/payment-details/payment-details.js +29 -6
- package/dist/collection/components/payments-list/payments-list-core.js +12 -11
- package/dist/collection/components/payments-list/payments-list-filters.js +17 -12
- package/dist/collection/components/payments-list/payments-list.js +16 -11
- package/dist/collection/components/payout-details/payout-details-core.js +11 -8
- package/dist/collection/components/payout-details/payout-details.js +11 -9
- package/dist/collection/components/payouts-list/payouts-list-core.js +21 -16
- package/dist/collection/components/payouts-list/payouts-list-filters.js +8 -6
- package/dist/collection/components/payouts-list/payouts-list.js +16 -13
- package/dist/collection/components/refund-payment/refund-loading.js +6 -0
- package/dist/collection/components/refund-payment/refund-payment-schema.js +26 -11
- package/dist/collection/components/refund-payment/refund-payment.js +157 -57
- package/dist/collection/components/terminal-orders-list/terminal-order-status.js +15 -0
- package/dist/collection/components/terminal-orders-list/terminal-orders-list-core.js +12 -11
- package/dist/collection/components/terminal-orders-list/terminal-orders-list-filters.js +18 -11
- package/dist/collection/components/terminal-orders-list/terminal-orders-list.js +16 -11
- package/dist/collection/components/terminal-orders-list/terminal-orders-table.js +11 -1
- package/dist/collection/components/terminals-list/terminals-list-core.js +17 -14
- package/dist/collection/components/terminals-list/terminals-list-filters.js +10 -7
- package/dist/collection/components/terminals-list/terminals-list.js +16 -12
- package/dist/collection/components/terminals-list/terminals-table.js +2 -2
- package/dist/collection/components/tokenize-payment-method/tokenize-payment-method.js +71 -19
- package/dist/collection/styles/parts.js +2 -1
- package/dist/collection/ui-components/custom-popper/custom-popper.js +19 -8
- package/dist/collection/ui-components/details/details.js +3 -4
- package/dist/collection/ui-components/filters/table-filters-menu.js +8 -7
- package/dist/collection/ui-components/form/form-control-checkbox.js +25 -17
- package/dist/collection/ui-components/form/form-control-date.js +32 -21
- package/dist/collection/ui-components/form/form-control-file-v2.js +23 -18
- package/dist/collection/ui-components/form/form-control-file.js +28 -21
- package/dist/collection/ui-components/form/form-control-monetary.js +35 -23
- package/dist/collection/ui-components/form/form-control-number-masked.js +28 -19
- package/dist/collection/ui-components/form/form-control-number.js +25 -17
- package/dist/collection/ui-components/form/form-control-radio.js +28 -19
- package/dist/collection/ui-components/form/form-control-select.js +29 -19
- package/dist/collection/ui-components/form/form-control-text.js +32 -21
- package/dist/collection/ui-components/form/form-control-textarea.js +32 -21
- package/dist/collection/ui-components/form/form-helpers/form-alert/form-alert.js +6 -6
- package/dist/collection/ui-components/form/form-helpers/form-control-help-text/form-control-help-text.js +6 -6
- package/dist/collection/ui-components/form/form-helpers/form-control-tooltip/form-control-tooltip.js +3 -6
- package/dist/collection/ui-components/form/hidden-input.js +1 -1
- package/dist/collection/ui-components/form/iframe-input.js +14 -12
- package/dist/collection/ui-components/pagination-menu/pagination-menu.js +6 -0
- package/dist/collection/utils/utils.js +8 -0
- package/dist/docs.d.ts +8 -0
- package/dist/docs.json +1844 -905
- package/dist/esm/Api-C9CDE-UM.js +72 -0
- package/dist/esm/{Business-0855931c.js → Business-D6XNzizo.js} +2 -2
- package/dist/esm/{Checkout-18d8bf94.js → Checkout-Dfpql997.js} +1 -1
- package/dist/esm/{ComponentError-c61dce41.js → ComponentError-SdntD1xf.js} +2 -1
- package/dist/esm/{Document-1907c0d4.js → Document-Ct-uNz2r.js} +1 -1
- package/dist/esm/{Payment-806af354.js → Payment-BADkZFaz.js} +2 -2
- package/dist/esm/{SubAccount-7520271c.js → Refund-t_P1yy9d.js} +25 -2
- package/dist/esm/_commonjsHelpers-BFTU3MAI.js +7 -0
- package/dist/esm/additional-questions-details_5.entry.js +5 -9
- package/dist/esm/{badge-1be14e8c.js → badge-C4TzL9CB.js} +3 -3
- package/dist/esm/bank-account-document-form-inputs_4.entry.js +25 -41
- package/dist/esm/bank-account-form_9.entry.js +91 -93
- package/dist/esm/{business-additional-questions-schema-56308a54.js → business-additional-questions-schema-W6okG5Xu.js} +2 -2
- package/dist/esm/business-details-core.entry.js +6 -8
- package/dist/esm/{business-form-options-86a13078.js → business-form-options-Bn05PRR4.js} +1 -1
- package/dist/esm/{business-identity-schema-24fcc4ef.js → business-identity-schema-lqdJS3MT.js} +2 -2
- package/dist/esm/{business.service-999196a4.js → business.service-B136meVo.js} +23 -8
- package/dist/esm/{button-fcee4da7.js → button-CI85Rqy5.js} +2 -2
- package/dist/esm/{check-pkg-version-bbd75fa0.js → check-pkg-version-Wd4E_Njt.js} +3 -3
- package/dist/esm/{checkout.service-e38e477f.js → checkout.service-4tnXBKGq.js} +13 -10
- package/dist/esm/checkouts-list-core.entry.js +25 -29
- package/dist/esm/{checkouts-list-params-state-7bdf00bd.js → checkouts-list-params-state-Gbxdxjoi.js} +1 -1
- package/dist/esm/{checkouts-table-39a031a0.js → checkouts-table-CHM4YCCZ.js} +4 -4
- package/dist/esm/custom-popper_4.entry.js +27 -50
- package/dist/esm/{dispute.service-7ba6d5a4.js → dispute.service-Bwh8pBe9.js} +20 -11
- package/dist/esm/{event-types-1bc52f1f.js → event-types-CooIFpFI.js} +3 -3
- package/dist/esm/form-alert_5.entry.js +10 -17
- package/dist/esm/form-control-checkbox.entry.js +9 -16
- package/dist/esm/form-control-date.entry.js +9 -17
- package/dist/esm/{form-control-error-text-176d20d8.js → form-control-error-text-3q5yVuMQ.js} +2 -2
- package/dist/esm/form-control-file-v2_2.entry.js +11 -28
- package/dist/esm/{form-control-help-text-83764e14.js → form-control-help-text-BplkZkPF.js} +2 -2
- package/dist/esm/form-control-help-text.entry.js +1 -3
- package/dist/esm/form-control-monetary-provisioning.entry.js +13 -20
- package/dist/esm/form-control-monetary.entry.js +13 -20
- package/dist/esm/form-control-number-masked_2.entry.js +12 -23
- package/dist/esm/form-control-number.entry.js +9 -16
- package/dist/esm/form-control-radio.entry.js +7 -15
- package/dist/esm/{get-business-b7511690.js → get-business-B3c5gg1D.js} +3 -3
- package/dist/esm/get-payment-details-BbZmEGge.js +40 -0
- package/dist/esm/{get-payout-csv-fa34f40b.js → get-payout-csv-BKq22mOI.js} +11 -11
- package/dist/esm/{get-subaccounts-3c6b9e84.js → get-subaccounts-58LQOtEI.js} +10 -9
- package/dist/esm/gross-payment-chart-core.entry.js +262 -268
- package/dist/esm/{header-1-215a146f.js → header-1-BX6i3__G.js} +2 -2
- package/dist/esm/{header-3-afd16f23.js → header-3-D0Sy-7DJ.js} +2 -2
- package/dist/esm/{helpers-96ea3464.js → helpers-Mu7LQT-w.js} +2 -2
- package/dist/esm/{iframe-input-styles-state-ff730fe5.js → iframe-input-styles-state-DyXIZw1A.js} +3 -3
- package/dist/esm/iframe-input.entry.js +1638 -0
- package/dist/esm/{index-29fcfdf5.js → index-BUM1DfV9.js} +459 -250
- package/dist/esm/{index-d9a73ce3.js → index-Ce_F4E0f.js} +1 -1
- package/dist/esm/{index-a47fdc7f.js → index-Cuk6aIda.js} +4 -5
- package/dist/esm/index.esm-BCNUj0Dx.js +11801 -0
- package/dist/esm/{input-handlers-270ac806.js → input-handlers-CX6mSvOM.js} +1 -1
- package/dist/esm/{insurance-state-d2df8e88.js → insurance-state-BhklYgGK.js} +3 -3
- package/dist/esm/justifi-additional-questions-form-step-core_6.entry.js +64 -92
- package/dist/esm/justifi-additional-questions-form-step_9.entry.js +36 -84
- package/dist/esm/justifi-additional-statement_8.entry.js +36 -52
- package/dist/esm/justifi-business-details.entry.js +16 -18
- package/dist/esm/justifi-business-form.entry.js +34 -36
- package/dist/esm/justifi-business-representative-form-inputs.entry.js +6 -9
- package/dist/esm/justifi-checkout-core.entry.js +31 -32
- package/dist/esm/justifi-checkout.entry.js +23 -27
- package/dist/esm/justifi-checkouts-list-filters.entry.js +15 -16
- package/dist/esm/justifi-checkouts-list.entry.js +25 -28
- package/dist/esm/justifi-details.entry.js +3 -4
- package/dist/esm/justifi-dispute-management-core.entry.js +5 -9
- package/dist/esm/justifi-dispute-management.entry.js +19 -21
- package/dist/esm/justifi-dispute-notification_3.entry.js +38 -50
- package/dist/esm/justifi-gross-payment-chart.entry.js +13 -14
- package/dist/esm/justifi-order-terminals.entry.js +27 -34
- package/dist/esm/justifi-owner-form_3.entry.js +29 -50
- package/dist/esm/justifi-payment-details.entry.js +22 -48
- package/dist/esm/justifi-payment-provisioning-core.entry.js +15 -21
- package/dist/esm/justifi-payment-provisioning.entry.js +15 -14
- package/dist/esm/justifi-payments-list-filters.entry.js +11 -15
- package/dist/esm/justifi-payments-list.entry.js +25 -27
- package/dist/esm/justifi-payout-details.entry.js +20 -23
- package/dist/esm/justifi-payouts-list-filters.entry.js +9 -10
- package/dist/esm/justifi-payouts-list.entry.js +26 -30
- package/dist/esm/justifi-refund-payment.entry.js +189 -67
- package/dist/esm/justifi-season-interruption-insurance-core.entry.js +10 -25
- package/dist/esm/justifi-season-interruption-insurance.entry.js +24 -33
- package/dist/esm/justifi-terminal-orders-list-filters.entry.js +19 -19
- package/dist/esm/justifi-terminal-orders-list.entry.js +28 -26
- package/dist/esm/justifi-terminals-list-filters.entry.js +17 -19
- package/dist/esm/justifi-terminals-list.entry.js +25 -28
- package/dist/esm/justifi-tokenize-payment-method.entry.js +24 -26
- package/dist/esm/loader.js +4 -4
- package/dist/esm/lodash-BqWxUrkh.js +17214 -0
- package/dist/esm/package-gAO-RwrF.js +7 -0
- package/dist/esm/pagination-menu.entry.js +3 -3
- package/dist/esm/{parts-fd740f54.js → parts-CB88j97I.js} +3 -2
- package/dist/esm/payment-details-core.entry.js +19 -20
- package/dist/esm/{payment-provisioning-actions-beadac34.js → payment-provisioning-actions-CZYFFdTf.js} +3 -3
- package/dist/esm/payment.service-Co_fPTvK.js +21 -0
- package/dist/esm/payments-list-core.entry.js +25 -28
- package/dist/esm/{payments-list-params-state-d05b24aa.js → payments-list-params-state-Gbxdxjoi.js} +1 -1
- package/dist/esm/{payments-status-74d22728.js → payments-status-BLhcMfnC.js} +2 -2
- package/dist/esm/{payments-table-8134f5e1.js → payments-table-VcaC77NC.js} +4 -4
- package/dist/esm/payout-details-core.entry.js +14 -16
- package/dist/esm/payouts-list-core.entry.js +26 -31
- package/dist/esm/{payouts-list-params-state-ebcee300.js → payouts-list-params-state-Gbxdxjoi.js} +1 -1
- package/dist/esm/{payouts-status-29d31099.js → payouts-status-B9SSljnL.js} +2 -2
- package/dist/esm/{payouts-table-c1ced46a.js → payouts-table-DWBaNPmV.js} +4 -4
- package/dist/esm/{schema-validations-5af4266a.js → schema-validations-BsbYeDDR.js} +5 -5
- package/dist/esm/{skeleton-ab3f676e.js → skeleton-B-oFGeeG.js} +2 -2
- package/dist/esm/{spinner-27479716.js → spinner-ptEcaLdc.js} +2 -2
- package/dist/esm/{styled-host-32228b45.js → styled-host-BHVh70Zk.js} +2 -3
- package/dist/esm/table-filters-menu.entry.js +4 -8
- package/dist/esm/terminal-orders-list-core.entry.js +24 -27
- package/dist/esm/{terminal-orders-list-params-state-8fec0a0b.js → terminal-orders-list-params-state-Gbxdxjoi.js} +1 -1
- package/dist/esm/{terminal-orders-table-93e84d25.js → terminal-orders-table-fuxIpfJ2.js} +35 -5
- package/dist/esm/terminal-quantity-selector.entry.js +6 -10
- package/dist/esm/{terminal.service-d173566d.js → terminal.service-BLOZ-ZlR.js} +11 -11
- package/dist/esm/terminals-list-core.entry.js +25 -29
- package/dist/esm/terminals-list-params-state-Gbxdxjoi.js +16 -0
- package/dist/esm/{terminals-table-5eb287ca.js → terminals-table-Dn71oQMb.js} +6 -6
- package/dist/esm/{utils-96d9c205.js → utils-B4pV3GWr.js} +2 -2
- package/dist/esm/utils-BWcTxbSg.js +23969 -0
- package/dist/esm/{utils-fd99b806.js → utils-Dccsn9BY.js} +2 -2
- package/dist/esm/webcomponents.js +6 -5
- package/dist/module/Api.js +32 -76
- package/dist/module/Business.js +2 -2
- package/dist/module/ComponentError.js +2 -1
- package/dist/module/Document.js +1 -1
- package/dist/module/{SubAccount.js → Refund.js} +24 -1
- package/dist/module/_commonjsHelpers.js +7 -0
- package/dist/module/additional-questions-details2.js +1 -2
- package/dist/module/additional-questions.js +2 -3
- package/dist/module/additional-statement.js +6 -9
- package/dist/module/badge.js +1 -1
- package/dist/module/bank-account-document-inputs.js +4 -6
- package/dist/module/bank-account-form-inputs2.js +1 -5
- package/dist/module/bank-account-form2.js +0 -1
- package/dist/module/billing-form.js +122 -4
- package/dist/module/business-additional-questions-form-step-core.js +7 -11
- package/dist/module/business-additional-questions-form-step.js +1 -6
- package/dist/module/business-additional-questions-schema.js +1 -1
- package/dist/module/business-address-schema.js +1 -1
- package/dist/module/business-bank-account-form-step-core.js +13 -18
- package/dist/module/business-bank-account-form-step.js +3 -9
- package/dist/module/business-core-info-form-step-core.js +6 -11
- package/dist/module/business-core-info-form-step.js +1 -6
- package/dist/module/business-core-info-schema.js +1 -1
- package/dist/module/business-core-info.js +2 -3
- package/dist/module/business-details-core2.js +1 -3
- package/dist/module/business-documents-on-file2.js +1 -1
- package/dist/module/business-form-options.js +1 -1
- package/dist/module/business-identity-schema.js +1 -1
- package/dist/module/business-owners-form-step-core.js +5 -11
- package/dist/module/business-owners-form-step.js +1 -6
- package/dist/module/business-representative-form-inputs.js +1 -4
- package/dist/module/business-representative-form-step-core.js +5 -9
- package/dist/module/business-representative-form-step.js +1 -6
- package/dist/module/business-representative.js +3 -4
- package/dist/module/business-terms-conditions-form-step.js +6 -12
- package/dist/module/business.service.js +22 -7
- package/dist/module/button.js +1 -1
- package/dist/module/cancellation-policy.js +6 -8
- package/dist/module/card-form2.js +2 -3
- package/dist/module/check-pkg-version.js +1 -1
- package/dist/module/checkout-core.js +57 -69
- package/dist/module/checkout.service.js +7 -4
- package/dist/module/checkouts-list-core2.js +12 -17
- package/dist/module/custom-popper2.js +13 -16
- package/dist/module/customer-details.js +6 -8
- package/dist/module/details.js +0 -1
- package/dist/module/dispute-management-core.js +4 -8
- package/dist/module/dispute-notification.js +3 -6
- package/dist/module/dispute-response-actions.js +16 -7
- package/dist/module/dispute-response-core.js +12 -16
- package/dist/module/dispute-response.js +6 -12
- package/dist/module/duplicate-charge.js +6 -8
- package/dist/module/electronic-evidence.js +5 -7
- package/dist/module/event-types2.js +21 -61
- package/dist/module/event-types3.js +61 -21
- package/dist/module/form-alert2.js +1 -3
- package/dist/module/form-control-checkbox2.js +6 -13
- package/dist/module/form-control-date2.js +6 -14
- package/dist/module/form-control-file-v22.js +2 -10
- package/dist/module/form-control-file2.js +5 -15
- package/dist/module/form-control-help-text.js +1 -1
- package/dist/module/form-control-help-text2.js +30 -9
- package/dist/module/form-control-help-text3.js +9 -32
- package/dist/module/form-control-monetary-provisioning2.js +8 -15
- package/dist/module/form-control-monetary2.js +9 -17
- package/dist/module/form-control-number-masked2.js +4 -12
- package/dist/module/form-control-number.js +6 -13
- package/dist/module/form-control-radio2.js +6 -14
- package/dist/module/form-control-select2.js +5 -13
- package/dist/module/form-control-text2.js +5 -14
- package/dist/module/form-control-textarea2.js +7 -16
- package/dist/module/form-control-tooltip2.js +0 -3
- package/dist/module/form.js +9773 -903
- package/dist/module/generic-info-details2.js +0 -1
- package/dist/module/get-business.js +2 -2
- package/dist/module/get-payment-details.js +40 -0
- package/dist/module/get-payout-csv.js +6 -6
- package/dist/module/get-subaccounts.js +5 -4
- package/dist/module/gross-payment-chart-core2.js +257 -264
- package/dist/module/helpers.js +1 -1
- package/dist/module/hidden-input2.js +3 -3
- package/dist/module/identity-address-form.js +2 -5
- package/dist/module/iframe-input-styles-state.js +2 -2
- package/dist/module/iframe-input2.js +1481 -1478
- package/dist/module/index2.js +3 -4
- package/dist/module/index3.js +1 -1
- package/dist/module/{billing-form.d.ts → justifi-billing-form.d.ts} +4 -4
- package/dist/module/justifi-billing-form.js +6 -0
- package/dist/module/justifi-business-details.js +1 -5
- package/dist/module/justifi-business-form.js +7 -10
- package/dist/module/justifi-checkout.js +47 -62
- package/dist/module/justifi-checkouts-list-filters.js +4 -5
- package/dist/module/justifi-checkouts-list.js +8 -11
- package/dist/module/justifi-dispute-management.js +6 -9
- package/dist/module/justifi-gross-payment-chart.js +4 -7
- package/dist/module/justifi-order-terminals.js +7 -15
- package/dist/module/justifi-payment-details.js +6 -38
- package/dist/module/justifi-payment-provisioning.js +5 -6
- package/dist/module/justifi-payments-list-filters.js +6 -11
- package/dist/module/justifi-payments-list.js +8 -10
- package/dist/module/justifi-payout-details.js +6 -9
- package/dist/module/justifi-payouts-list-filters.js +4 -6
- package/dist/module/justifi-payouts-list.js +8 -12
- package/dist/module/justifi-refund-payment.js +184 -61
- package/dist/module/justifi-season-interruption-insurance.js +13 -23
- package/dist/module/justifi-terminal-orders-list-filters.js +8 -9
- package/dist/module/justifi-terminal-orders-list.js +13 -11
- package/dist/module/justifi-terminals-list-filters.js +6 -8
- package/dist/module/justifi-terminals-list.js +8 -11
- package/dist/module/justifi-tokenize-payment-method.js +46 -58
- package/dist/module/legal-address-details2.js +1 -2
- package/dist/module/legal-address-form-step-core.js +6 -10
- package/dist/module/legal-address-form-step.js +1 -6
- package/dist/module/legal-address-form.js +1 -3
- package/dist/module/lodash.js +17201 -17191
- package/dist/module/new-payment-method.js +43 -55
- package/dist/module/owner-details2.js +0 -1
- package/dist/module/owner-form-core2.js +8 -18
- package/dist/module/owner-form-inputs2.js +1 -4
- package/dist/module/owner-form.js +1 -11
- package/dist/module/package.js +3 -77
- package/dist/module/pagination-menu2.js +1 -1
- package/dist/module/parts.js +3 -2
- package/dist/module/payment-details-core2.js +11 -13
- package/dist/module/payment-method-options.js +43 -61
- package/dist/module/payment-provisioning-actions.js +2 -2
- package/dist/module/payment-provisioning-core.js +8 -14
- package/dist/module/payment-provisioning-form-buttons.js +2 -8
- package/dist/module/payment-provisioning-form-steps.js +2 -7
- package/dist/module/payment.service.js +4 -4
- package/dist/module/payments-list-core2.js +10 -14
- package/dist/module/payout-details-core2.js +6 -9
- package/dist/module/payouts-list-core2.js +14 -20
- package/dist/module/product-or-service.js +5 -7
- package/dist/module/refund-policy.js +6 -8
- package/dist/module/representative-details2.js +0 -1
- package/dist/module/saved-payment-method.js +4 -6
- package/dist/module/schema-validations.js +2 -2
- package/dist/module/season-interruption-insurance-core.js +4 -20
- package/dist/module/sezzle-payment-method.js +3 -12
- package/dist/module/shipping-details.js +6 -8
- package/dist/module/spinner.js +1 -1
- package/dist/module/styled-host.js +1 -2
- package/dist/module/table-filters-menu2.js +3 -7
- package/dist/module/terminal-orders-list-core2.js +35 -15
- package/dist/module/terminal-quantity-selector2.js +4 -8
- package/dist/module/terminal.service.js +5 -5
- package/dist/module/terminals-list-core2.js +14 -19
- package/dist/module/utils.js +1 -1
- package/dist/module/utils2.js +23787 -3819
- package/dist/module/utils4.js +2 -2
- package/dist/types/actions/payment/get-payment-details.d.ts +4 -2
- package/dist/types/actions/refund/refund-actions.d.ts +12 -0
- package/dist/types/api/Api.d.ts +30 -5
- package/dist/types/api/ComponentError.d.ts +2 -1
- package/dist/types/api/Payment.d.ts +1 -11
- package/dist/types/api/Refund.d.ts +45 -0
- package/dist/types/api/TerminalOrder.d.ts +4 -1
- package/dist/types/api/index.d.ts +1 -0
- package/dist/types/api/services/payment.service.d.ts +2 -2
- package/dist/types/api/services/refund.service.d.ts +7 -0
- package/dist/types/components/business-forms/payment-provisioning/form-control-monetary-provisioning.d.ts +1 -1
- package/dist/types/components/business-forms/schemas/business-form-schema.d.ts +3 -3
- package/dist/types/components/business-forms/schemas/business-identity-schema.d.ts +1 -1
- package/dist/types/components/checkout/{billing-forms → billing-form}/billing-form-schema.d.ts +1 -11
- package/dist/types/components/checkout/{billing-forms/billing-form → billing-form}/billing-form.d.ts +8 -6
- package/dist/types/components/checkout/checkout-core.d.ts +6 -2
- package/dist/types/components/checkout/checkout.d.ts +6 -2
- package/dist/types/components/checkout/new-payment-method.d.ts +7 -3
- package/dist/types/components/checkout/payment-method-options.d.ts +6 -2
- package/dist/types/components/order-terminals/order-terminals.d.ts +0 -1
- package/dist/types/components/payment-details/payment-details.d.ts +1 -0
- package/dist/types/components/refund-payment/refund-loading.d.ts +1 -0
- package/dist/types/components/refund-payment/refund-payment-schema.d.ts +6 -6
- package/dist/types/components/refund-payment/refund-payment.d.ts +18 -12
- package/dist/types/components/terminal-orders-list/terminal-orders-list-filters.d.ts +1 -1
- package/dist/types/components/terminals-list/terminals-table.d.ts +2 -2
- package/dist/types/components/tokenize-payment-method/tokenize-payment-method.d.ts +4 -0
- package/dist/types/components.d.ts +45 -74
- package/dist/types/stencil-public-runtime.d.ts +9 -0
- package/dist/types/styles/parts.d.ts +6 -5
- package/dist/types/ui-components/form/form-control-monetary.d.ts +1 -1
- package/dist/types/utils/utils.d.ts +1 -0
- package/dist/webcomponents/{p-701a13ca.js → p-01wziNa9.js} +1 -1
- package/dist/webcomponents/p-063dd981.entry.js +1 -0
- package/dist/webcomponents/p-08d5b491.entry.js +1 -0
- package/dist/webcomponents/p-0czqizJW.js +1 -0
- package/dist/webcomponents/p-1049c0c5.entry.js +1 -0
- package/dist/webcomponents/p-1ydcg9ti.js +1 -0
- package/dist/webcomponents/p-2c2f6743.entry.js +1 -0
- package/dist/webcomponents/p-2d80f427.entry.js +1 -0
- package/dist/webcomponents/p-2f6c0a07.entry.js +1 -0
- package/dist/webcomponents/p-2fe9576b.entry.js +1 -0
- package/dist/webcomponents/p-307a0db6.entry.js +1 -0
- package/dist/webcomponents/p-3147bfe2.entry.js +1 -0
- package/dist/webcomponents/p-332ce001.entry.js +1 -0
- package/dist/webcomponents/p-34cfafed.entry.js +1 -0
- package/dist/webcomponents/p-3995c8b8.entry.js +1 -0
- package/dist/webcomponents/p-3e084a0e.entry.js +1 -0
- package/dist/webcomponents/p-43c1c278.entry.js +1 -0
- package/dist/webcomponents/p-456f8c0a.entry.js +1 -0
- package/dist/webcomponents/p-4addd069.entry.js +1 -0
- package/dist/webcomponents/p-4ee6482d.entry.js +1 -0
- package/dist/webcomponents/p-507f7a31.entry.js +1 -0
- package/dist/webcomponents/p-50aa4e4d.entry.js +1 -0
- package/dist/webcomponents/p-5a07a84c.entry.js +1 -0
- package/dist/webcomponents/p-5dc3a795.entry.js +1 -0
- package/dist/webcomponents/p-62bdcca1.entry.js +1 -0
- package/dist/webcomponents/p-65345bd4.entry.js +1 -0
- package/dist/webcomponents/p-6a54d69b.entry.js +1 -0
- package/dist/webcomponents/p-6c4927e7.entry.js +1 -0
- package/dist/webcomponents/p-6d2a48f5.entry.js +1 -0
- package/dist/webcomponents/p-7414b942.entry.js +1 -0
- package/dist/webcomponents/p-7ddd7122.entry.js +20 -0
- package/dist/webcomponents/p-80dca817.entry.js +1 -0
- package/dist/webcomponents/p-815937bb.entry.js +1 -0
- package/dist/webcomponents/p-86fdc0a1.entry.js +1 -0
- package/dist/webcomponents/p-98111d03.entry.js +1 -0
- package/dist/webcomponents/p-9a9bb294.entry.js +1 -0
- package/dist/webcomponents/p-9bbfde16.entry.js +1 -0
- package/dist/webcomponents/p-B7ErpLYA.js +1 -0
- package/dist/webcomponents/p-BBsCnePk.js +1 -0
- package/dist/webcomponents/p-BFTU3MAI.js +1 -0
- package/dist/webcomponents/p-BHHWVg32.js +1 -0
- package/dist/webcomponents/p-BHbsXXRt.js +1 -0
- package/dist/webcomponents/p-BM61p7vG.js +1 -0
- package/dist/webcomponents/p-BODr6HXb.js +1 -0
- package/dist/webcomponents/p-BUM1DfV9.js +2 -0
- package/dist/webcomponents/p-BVwkHwTc.js +1 -0
- package/dist/webcomponents/p-BWFriesi.js +1 -0
- package/dist/webcomponents/p-Bde7dY9t.js +9 -0
- package/dist/webcomponents/{p-1366a019.js → p-BjB_yKBJ.js} +1 -1
- package/dist/webcomponents/p-Bo92MHrs.js +1 -0
- package/dist/webcomponents/p-BoPxMyJA.js +1 -0
- package/dist/webcomponents/{p-5d1d2fd7.js → p-BrvbVMVq.js} +1 -1
- package/dist/webcomponents/{p-a5579f53.js → p-BuYnqWwT.js} +1 -1
- package/dist/webcomponents/p-BxPlB-C5.js +1 -0
- package/dist/webcomponents/{p-3f5e6602.js → p-Bxs6fi7a.js} +1 -1
- package/dist/webcomponents/{p-bfe9748b.js → p-C3nDCvFQ.js} +1 -1
- package/dist/webcomponents/{p-87f8c596.js → p-C5RuuShs.js} +1 -1
- package/dist/webcomponents/p-CB88j97I.js +1 -0
- package/dist/webcomponents/p-CGz3XHQc.js +1 -0
- package/dist/webcomponents/p-CLBRsaLx.js +1 -0
- package/dist/webcomponents/{p-4cc3c7f9.js → p-CTBH4Lj9.js} +1 -1
- package/dist/webcomponents/p-CYsU0lEI.js +1 -0
- package/dist/webcomponents/p-CjunQqer.js +1 -0
- package/dist/webcomponents/{p-12074378.js → p-CnyMKcfC.js} +1 -1
- package/dist/webcomponents/p-CpTwq2jw.js +1 -0
- package/dist/webcomponents/{p-61f0a2ce.js → p-Ct-uNz2r.js} +1 -1
- package/dist/webcomponents/p-CwHcfOV7.js +1 -0
- package/dist/webcomponents/p-Cy4aIACq.js +1 -0
- package/dist/webcomponents/p-D7s2671S.js +1 -0
- package/dist/webcomponents/{p-ca6cdfe6.js → p-D89x2FYg.js} +1 -1
- package/dist/webcomponents/p-D9t-X0IY.js +1 -0
- package/dist/webcomponents/p-DLpKiPxJ.js +1 -0
- package/dist/webcomponents/p-DVnVdicA.js +1 -0
- package/dist/webcomponents/p-DhEfW-kS.js +1 -0
- package/dist/webcomponents/p-DhQ2XlhY.js +1 -0
- package/dist/webcomponents/p-Dna7whFY.js +1 -0
- package/dist/webcomponents/p-DoH48u6u.js +1 -0
- package/dist/webcomponents/p-Dt-vy9Le.js +1 -0
- package/dist/webcomponents/p-DzPbgN8M.js +1 -0
- package/dist/webcomponents/{p-c9b78275.js → p-IA90llLO.js} +1 -1
- package/dist/webcomponents/p-JcczGkik.js +1 -0
- package/dist/webcomponents/p-QYQ4VLoz.js +1 -0
- package/dist/webcomponents/{p-9dd8685c.js → p-SdntD1xf.js} +1 -1
- package/dist/webcomponents/p-ZUQEru6m.js +1 -0
- package/dist/webcomponents/p-a22974fd.entry.js +1 -0
- package/dist/webcomponents/p-a2bf5919.entry.js +1 -0
- package/dist/webcomponents/p-a9eff0f2.entry.js +1 -0
- package/dist/webcomponents/p-ab99e4c6.entry.js +1 -0
- package/dist/webcomponents/p-b7053613.entry.js +1 -0
- package/dist/webcomponents/p-bb8f7062.entry.js +1 -0
- package/dist/webcomponents/p-be04a09c.entry.js +1 -0
- package/dist/webcomponents/p-bplwtwD3.js +1 -0
- package/dist/webcomponents/p-c38c742e.entry.js +1 -0
- package/dist/webcomponents/p-c558725e.entry.js +1 -0
- package/dist/webcomponents/p-c6534f5f.entry.js +1 -0
- package/dist/webcomponents/p-c6cf707c.entry.js +1 -0
- package/dist/webcomponents/p-c70dcec1.entry.js +1 -0
- package/dist/webcomponents/p-c8d608a1.entry.js +1 -0
- package/dist/webcomponents/p-ce20d709.entry.js +1 -0
- package/dist/webcomponents/p-cf8f69de.entry.js +1 -0
- package/dist/webcomponents/p-d5675bf5.entry.js +1 -0
- package/dist/webcomponents/p-def42fc7.entry.js +1 -0
- package/dist/webcomponents/p-dfcf19f2.entry.js +1 -0
- package/dist/webcomponents/p-e0896deb.entry.js +1 -0
- package/dist/webcomponents/p-e3962860.entry.js +1 -0
- package/dist/webcomponents/p-e3cd72ad.entry.js +1 -0
- package/dist/webcomponents/p-e52d5ead.entry.js +1 -0
- package/dist/webcomponents/p-eYaGyUvS.js +1 -0
- package/dist/webcomponents/p-eb31e5c7.entry.js +1 -0
- package/dist/webcomponents/p-eb677eb2.entry.js +1 -0
- package/dist/webcomponents/p-f0301d11.entry.js +1 -0
- package/dist/webcomponents/p-f51e4213.entry.js +1 -0
- package/dist/webcomponents/p-gAO-RwrF.js +1 -0
- package/dist/webcomponents/p-hkXaxw9l.js +1 -0
- package/dist/webcomponents/p-p7aAf5_m.js +1 -0
- package/dist/webcomponents/p-sXe3gn-5.js +1 -0
- package/dist/webcomponents/p-y-Ys7Rd-.js +1 -0
- package/dist/webcomponents/p-z1GJDdMW.js +1 -0
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/package.json +6 -7
- package/dist/cjs/Api-83d93333.js +0 -118
- package/dist/cjs/billing-form_3.cjs.entry.js +0 -1733
- package/dist/cjs/index.esm-544c08fd.js +0 -2937
- package/dist/cjs/lodash-dbf6a6a4.js +0 -17206
- package/dist/cjs/package-99f9fc82.js +0 -83
- package/dist/cjs/payment.service-537e049d.js +0 -23
- package/dist/cjs/terminals-list-params-state-236f06f6.js +0 -22
- package/dist/cjs/utils-4120664c.js +0 -4018
- package/dist/collection/components/checkout/billing-forms/billing-form/billing-form.js +0 -137
- package/dist/collection/components/checkout/billing-forms/billing-form-schema.js +0 -26
- package/dist/collection/components/checkout/billing-forms/billing-form-wrapper.js +0 -183
- package/dist/collection/components/checkout/billing-forms/postal-form/postal-form.js +0 -136
- package/dist/esm/Api-52242eb0.js +0 -116
- package/dist/esm/billing-form_3.entry.js +0 -1727
- package/dist/esm/index.esm-feedf26f.js +0 -2931
- package/dist/esm/lodash-faeb5a52.js +0 -17204
- package/dist/esm/package-01997353.js +0 -81
- package/dist/esm/payment.service-af5bd8be.js +0 -21
- package/dist/esm/terminals-list-params-state-e4b2ec23.js +0 -16
- package/dist/esm/utils-ec50661e.js +0 -4001
- package/dist/loader/package.json +0 -11
- package/dist/module/billing-form-schema.js +0 -16
- package/dist/module/billing-form-wrapper.js +0 -114
- package/dist/module/billing-form2.js +0 -90
- package/dist/module/justifi-billing-form-wrapper.d.ts +0 -11
- package/dist/module/justifi-billing-form-wrapper.js +0 -6
- package/dist/module/postal-form.d.ts +0 -11
- package/dist/module/postal-form.js +0 -6
- package/dist/module/postal-form2.js +0 -83
- package/dist/types/components/checkout/billing-forms/billing-form-wrapper.d.ts +0 -19
- package/dist/types/components/checkout/billing-forms/postal-form/postal-form.d.ts +0 -20
- package/dist/webcomponents/p-01033194.js +0 -1
- package/dist/webcomponents/p-07fbeff3.entry.js +0 -1
- package/dist/webcomponents/p-092515e0.js +0 -1
- package/dist/webcomponents/p-0b61d4d3.entry.js +0 -1
- package/dist/webcomponents/p-0c7ec110.entry.js +0 -1
- package/dist/webcomponents/p-0f0020e1.entry.js +0 -1
- package/dist/webcomponents/p-0fa216eb.entry.js +0 -1
- package/dist/webcomponents/p-0fc1d3bb.entry.js +0 -1
- package/dist/webcomponents/p-1134e1d3.entry.js +0 -1
- package/dist/webcomponents/p-13717638.entry.js +0 -1
- package/dist/webcomponents/p-142bfae3.js +0 -1
- package/dist/webcomponents/p-1c38ec65.entry.js +0 -1
- package/dist/webcomponents/p-1ce63001.entry.js +0 -1
- package/dist/webcomponents/p-1ff8810b.js +0 -1
- package/dist/webcomponents/p-2123c150.js +0 -1
- package/dist/webcomponents/p-23cd76af.entry.js +0 -1
- package/dist/webcomponents/p-25b82529.entry.js +0 -1
- package/dist/webcomponents/p-27546fa9.entry.js +0 -1
- package/dist/webcomponents/p-275c3dc9.js +0 -1
- package/dist/webcomponents/p-2783e363.js +0 -2
- package/dist/webcomponents/p-290fa30d.entry.js +0 -1
- package/dist/webcomponents/p-2a9d7f6b.js +0 -1
- package/dist/webcomponents/p-2b8aaa7d.entry.js +0 -1
- package/dist/webcomponents/p-3188f72a.js +0 -1
- package/dist/webcomponents/p-31dcaeaf.entry.js +0 -1
- package/dist/webcomponents/p-373a19fe.entry.js +0 -1
- package/dist/webcomponents/p-375657fe.entry.js +0 -1
- package/dist/webcomponents/p-3cc7527a.entry.js +0 -1
- package/dist/webcomponents/p-3cf317d3.entry.js +0 -1
- package/dist/webcomponents/p-4598482c.entry.js +0 -1
- package/dist/webcomponents/p-536497fe.entry.js +0 -1
- package/dist/webcomponents/p-536fb8e2.js +0 -1
- package/dist/webcomponents/p-537bce77.js +0 -1
- package/dist/webcomponents/p-54556fc6.js +0 -1
- package/dist/webcomponents/p-56c7fc8d.js +0 -1
- package/dist/webcomponents/p-58ee6ce9.js +0 -1
- package/dist/webcomponents/p-5a9d7ca0.entry.js +0 -1
- package/dist/webcomponents/p-5b76dbe1.entry.js +0 -1
- package/dist/webcomponents/p-5f6b4bc9.js +0 -1
- package/dist/webcomponents/p-645db2cb.entry.js +0 -1
- package/dist/webcomponents/p-65cb72e4.entry.js +0 -1
- package/dist/webcomponents/p-673c1bca.js +0 -1
- package/dist/webcomponents/p-6a5eab1f.entry.js +0 -1
- package/dist/webcomponents/p-753d983c.entry.js +0 -1
- package/dist/webcomponents/p-76549a24.js +0 -1
- package/dist/webcomponents/p-7b793901.entry.js +0 -1
- package/dist/webcomponents/p-7c333590.entry.js +0 -1
- package/dist/webcomponents/p-7d85af5c.js +0 -1
- package/dist/webcomponents/p-81a6c3e2.entry.js +0 -1
- package/dist/webcomponents/p-86605101.js +0 -1
- package/dist/webcomponents/p-87a4fb5b.js +0 -1
- package/dist/webcomponents/p-88a37837.js +0 -1
- package/dist/webcomponents/p-8a6a06e6.entry.js +0 -1
- package/dist/webcomponents/p-8d4a0192.entry.js +0 -1
- package/dist/webcomponents/p-927cb6df.js +0 -1
- package/dist/webcomponents/p-953e9dba.js +0 -1
- package/dist/webcomponents/p-96c23cda.entry.js +0 -1
- package/dist/webcomponents/p-9a9732e1.js +0 -1
- package/dist/webcomponents/p-9fecad5a.js +0 -1
- package/dist/webcomponents/p-a07e021f.entry.js +0 -1
- package/dist/webcomponents/p-a3cced75.entry.js +0 -1
- package/dist/webcomponents/p-a5f5cc2e.entry.js +0 -1
- package/dist/webcomponents/p-a6976c9c.entry.js +0 -1
- package/dist/webcomponents/p-a8c69f51.entry.js +0 -1
- package/dist/webcomponents/p-ab3a8004.entry.js +0 -1
- package/dist/webcomponents/p-ab45511e.js +0 -1
- package/dist/webcomponents/p-adecb91a.entry.js +0 -1
- package/dist/webcomponents/p-ae7edce5.js +0 -1
- package/dist/webcomponents/p-ae891abb.entry.js +0 -1
- package/dist/webcomponents/p-af3315b5.entry.js +0 -1
- package/dist/webcomponents/p-b082f07a.entry.js +0 -1
- package/dist/webcomponents/p-b218af87.entry.js +0 -1
- package/dist/webcomponents/p-b84ee6d8.js +0 -1
- package/dist/webcomponents/p-b979fcb0.entry.js +0 -1
- package/dist/webcomponents/p-bb4b3f79.entry.js +0 -1
- package/dist/webcomponents/p-beec0b60.js +0 -1
- package/dist/webcomponents/p-bf12999f.js +0 -1
- package/dist/webcomponents/p-bf195b35.js +0 -1
- package/dist/webcomponents/p-bfc2d88a.js +0 -1
- package/dist/webcomponents/p-c6be72b0.js +0 -10
- package/dist/webcomponents/p-c8b78136.js +0 -1
- package/dist/webcomponents/p-caa29469.entry.js +0 -1
- package/dist/webcomponents/p-cbad44b7.js +0 -1
- package/dist/webcomponents/p-cc2f75a3.entry.js +0 -1
- package/dist/webcomponents/p-ccb9ee53.js +0 -1
- package/dist/webcomponents/p-cd93c62b.entry.js +0 -19
- package/dist/webcomponents/p-d757fcf5.js +0 -1
- package/dist/webcomponents/p-dbc1a95b.js +0 -1
- package/dist/webcomponents/p-dd2938d3.entry.js +0 -1
- package/dist/webcomponents/p-dec18cc4.js +0 -1
- package/dist/webcomponents/p-e3855f51.entry.js +0 -1
- package/dist/webcomponents/p-e73be1b9.entry.js +0 -1
- package/dist/webcomponents/p-e817d131.entry.js +0 -1
- package/dist/webcomponents/p-e9867f8b.entry.js +0 -1
- package/dist/webcomponents/p-f20466f7.entry.js +0 -1
- package/dist/webcomponents/p-f20b6ce1.js +0 -1
- package/dist/webcomponents/p-f4739d31.js +0 -1
- package/dist/webcomponents/p-f4aeb100.js +0 -1
- package/dist/webcomponents/p-f8fccf44.js +0 -1
- package/dist/webcomponents/p-f930504f.entry.js +0 -1
- package/dist/webcomponents/p-faa35b47.entry.js +0 -1
- package/dist/webcomponents/p-fb2db8da.entry.js +0 -1
- package/dist/webcomponents/p-fca89e9b.entry.js +0 -1
- /package/dist/cjs/{Dispute-eb6bad54.js → Dispute-CruQTF6_.js} +0 -0
- /package/dist/cjs/{Document-0b828345.js → Document-rXGBUaOh.js} +0 -0
- /package/dist/cjs/{Pagination-0da8f095.js → Pagination-Dediz133.js} +0 -0
- /package/dist/cjs/{app-globals-3a1e7e63.js → app-globals-V2Kpy_OQ.js} +0 -0
- /package/dist/cjs/{event-types-8edaabbb.js → event-types-BWQT2lwu.js} +0 -0
- /package/dist/cjs/{event-types-180a85a9.js → event-types-DNOUef41.js} +0 -0
- /package/dist/cjs/{form-input-masks-0879c139.js → form-input-masks-DgXd0f4V.js} +0 -0
- /package/dist/cjs/{state-options-4fbcb48a.js → state-options-CIT9xdTz.js} +0 -0
- /package/dist/cjs/{utils-bc03ca40.js → utils-DAyWinG2.js} +0 -0
- /package/dist/esm/{Dispute-5fd28ec9.js → Dispute-7MWRbTXI.js} +0 -0
- /package/dist/esm/{Pagination-afc8f96d.js → Pagination-CLHwhyvu.js} +0 -0
- /package/dist/esm/{app-globals-0f993ce5.js → app-globals-DQuL1Twl.js} +0 -0
- /package/dist/esm/{event-types-07cdb9a0.js → event-types-Bg2SZArf.js} +0 -0
- /package/dist/esm/{event-types-5c87de02.js → event-types-XYgDHrVL.js} +0 -0
- /package/dist/esm/{form-input-masks-0e18300f.js → form-input-masks-B-iV5cYd.js} +0 -0
- /package/dist/esm/{state-options-a356fb11.js → state-options-BX8GieXu.js} +0 -0
- /package/dist/esm/{utils-20cdf321.js → utils-BnjCmwMr.js} +0 -0
- /package/dist/webcomponents/{p-abdbcd8e.js → p-7MWRbTXI.js} +0 -0
- /package/dist/webcomponents/{p-525db3e8.js → p-B-iV5cYd.js} +0 -0
- /package/dist/webcomponents/{p-6078a370.js → p-BX8GieXu.js} +0 -0
- /package/dist/webcomponents/{p-667ebd79.js → p-Bg2SZArf.js} +0 -0
- /package/dist/webcomponents/{p-e3c22aa9.js → p-BnjCmwMr.js} +0 -0
- /package/dist/webcomponents/{p-56f6ce4c.js → p-CLHwhyvu.js} +0 -0
- /package/dist/webcomponents/{p-1ad5995e.js → p-Ce_F4E0f.js} +0 -0
- /package/dist/webcomponents/{p-e1255160.js → p-DQuL1Twl.js} +0 -0
- /package/dist/webcomponents/{p-73f9be7c.js → p-XYgDHrVL.js} +0 -0
|
@@ -1,2937 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function isFunction(value) {
|
|
4
|
-
return typeof value === 'function';
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
function createErrorClass(createImpl) {
|
|
8
|
-
const _super = (instance) => {
|
|
9
|
-
Error.call(instance);
|
|
10
|
-
instance.stack = new Error().stack;
|
|
11
|
-
};
|
|
12
|
-
const ctorFunc = createImpl(_super);
|
|
13
|
-
ctorFunc.prototype = Object.create(Error.prototype);
|
|
14
|
-
ctorFunc.prototype.constructor = ctorFunc;
|
|
15
|
-
return ctorFunc;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const UnsubscriptionError = createErrorClass((_super) => function UnsubscriptionErrorImpl(errors) {
|
|
19
|
-
_super(this);
|
|
20
|
-
this.message = errors
|
|
21
|
-
? `${errors.length} errors occurred during unsubscription:
|
|
22
|
-
${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\n ')}`
|
|
23
|
-
: '';
|
|
24
|
-
this.name = 'UnsubscriptionError';
|
|
25
|
-
this.errors = errors;
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
function arrRemove(arr, item) {
|
|
29
|
-
if (arr) {
|
|
30
|
-
const index = arr.indexOf(item);
|
|
31
|
-
0 <= index && arr.splice(index, 1);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
class Subscription {
|
|
36
|
-
constructor(initialTeardown) {
|
|
37
|
-
this.initialTeardown = initialTeardown;
|
|
38
|
-
this.closed = false;
|
|
39
|
-
this._parentage = null;
|
|
40
|
-
this._finalizers = null;
|
|
41
|
-
}
|
|
42
|
-
unsubscribe() {
|
|
43
|
-
let errors;
|
|
44
|
-
if (!this.closed) {
|
|
45
|
-
this.closed = true;
|
|
46
|
-
const { _parentage } = this;
|
|
47
|
-
if (_parentage) {
|
|
48
|
-
this._parentage = null;
|
|
49
|
-
if (Array.isArray(_parentage)) {
|
|
50
|
-
for (const parent of _parentage) {
|
|
51
|
-
parent.remove(this);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
_parentage.remove(this);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
const { initialTeardown: initialFinalizer } = this;
|
|
59
|
-
if (isFunction(initialFinalizer)) {
|
|
60
|
-
try {
|
|
61
|
-
initialFinalizer();
|
|
62
|
-
}
|
|
63
|
-
catch (e) {
|
|
64
|
-
errors = e instanceof UnsubscriptionError ? e.errors : [e];
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
const { _finalizers } = this;
|
|
68
|
-
if (_finalizers) {
|
|
69
|
-
this._finalizers = null;
|
|
70
|
-
for (const finalizer of _finalizers) {
|
|
71
|
-
try {
|
|
72
|
-
execFinalizer(finalizer);
|
|
73
|
-
}
|
|
74
|
-
catch (err) {
|
|
75
|
-
errors = errors !== null && errors !== void 0 ? errors : [];
|
|
76
|
-
if (err instanceof UnsubscriptionError) {
|
|
77
|
-
errors = [...errors, ...err.errors];
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
errors.push(err);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
if (errors) {
|
|
86
|
-
throw new UnsubscriptionError(errors);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
add(teardown) {
|
|
91
|
-
var _a;
|
|
92
|
-
if (teardown && teardown !== this) {
|
|
93
|
-
if (this.closed) {
|
|
94
|
-
execFinalizer(teardown);
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
if (teardown instanceof Subscription) {
|
|
98
|
-
if (teardown.closed || teardown._hasParent(this)) {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
teardown._addParent(this);
|
|
102
|
-
}
|
|
103
|
-
(this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
_hasParent(parent) {
|
|
108
|
-
const { _parentage } = this;
|
|
109
|
-
return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));
|
|
110
|
-
}
|
|
111
|
-
_addParent(parent) {
|
|
112
|
-
const { _parentage } = this;
|
|
113
|
-
this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
|
|
114
|
-
}
|
|
115
|
-
_removeParent(parent) {
|
|
116
|
-
const { _parentage } = this;
|
|
117
|
-
if (_parentage === parent) {
|
|
118
|
-
this._parentage = null;
|
|
119
|
-
}
|
|
120
|
-
else if (Array.isArray(_parentage)) {
|
|
121
|
-
arrRemove(_parentage, parent);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
remove(teardown) {
|
|
125
|
-
const { _finalizers } = this;
|
|
126
|
-
_finalizers && arrRemove(_finalizers, teardown);
|
|
127
|
-
if (teardown instanceof Subscription) {
|
|
128
|
-
teardown._removeParent(this);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
Subscription.EMPTY = (() => {
|
|
133
|
-
const empty = new Subscription();
|
|
134
|
-
empty.closed = true;
|
|
135
|
-
return empty;
|
|
136
|
-
})();
|
|
137
|
-
const EMPTY_SUBSCRIPTION = Subscription.EMPTY;
|
|
138
|
-
function isSubscription(value) {
|
|
139
|
-
return (value instanceof Subscription ||
|
|
140
|
-
(value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe)));
|
|
141
|
-
}
|
|
142
|
-
function execFinalizer(finalizer) {
|
|
143
|
-
if (isFunction(finalizer)) {
|
|
144
|
-
finalizer();
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
finalizer.unsubscribe();
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
const config = {
|
|
152
|
-
onUnhandledError: null,
|
|
153
|
-
onStoppedNotification: null,
|
|
154
|
-
Promise: undefined,
|
|
155
|
-
useDeprecatedSynchronousErrorHandling: false,
|
|
156
|
-
useDeprecatedNextContext: false,
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
const timeoutProvider = {
|
|
160
|
-
setTimeout(handler, timeout, ...args) {
|
|
161
|
-
const { delegate } = timeoutProvider;
|
|
162
|
-
if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
|
|
163
|
-
return delegate.setTimeout(handler, timeout, ...args);
|
|
164
|
-
}
|
|
165
|
-
return setTimeout(handler, timeout, ...args);
|
|
166
|
-
},
|
|
167
|
-
clearTimeout(handle) {
|
|
168
|
-
const { delegate } = timeoutProvider;
|
|
169
|
-
return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
|
|
170
|
-
},
|
|
171
|
-
delegate: undefined,
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
function reportUnhandledError(err) {
|
|
175
|
-
timeoutProvider.setTimeout(() => {
|
|
176
|
-
const { onUnhandledError } = config;
|
|
177
|
-
if (onUnhandledError) {
|
|
178
|
-
onUnhandledError(err);
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
throw err;
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
function noop() { }
|
|
187
|
-
|
|
188
|
-
const COMPLETE_NOTIFICATION = (() => createNotification('C', undefined, undefined))();
|
|
189
|
-
function errorNotification(error) {
|
|
190
|
-
return createNotification('E', undefined, error);
|
|
191
|
-
}
|
|
192
|
-
function nextNotification(value) {
|
|
193
|
-
return createNotification('N', value, undefined);
|
|
194
|
-
}
|
|
195
|
-
function createNotification(kind, value, error) {
|
|
196
|
-
return {
|
|
197
|
-
kind,
|
|
198
|
-
value,
|
|
199
|
-
error,
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
let context = null;
|
|
204
|
-
function errorContext(cb) {
|
|
205
|
-
if (config.useDeprecatedSynchronousErrorHandling) {
|
|
206
|
-
const isRoot = !context;
|
|
207
|
-
if (isRoot) {
|
|
208
|
-
context = { errorThrown: false, error: null };
|
|
209
|
-
}
|
|
210
|
-
cb();
|
|
211
|
-
if (isRoot) {
|
|
212
|
-
const { errorThrown, error } = context;
|
|
213
|
-
context = null;
|
|
214
|
-
if (errorThrown) {
|
|
215
|
-
throw error;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
else {
|
|
220
|
-
cb();
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
class Subscriber extends Subscription {
|
|
225
|
-
constructor(destination) {
|
|
226
|
-
super();
|
|
227
|
-
this.isStopped = false;
|
|
228
|
-
if (destination) {
|
|
229
|
-
this.destination = destination;
|
|
230
|
-
if (isSubscription(destination)) {
|
|
231
|
-
destination.add(this);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
else {
|
|
235
|
-
this.destination = EMPTY_OBSERVER;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
static create(next, error, complete) {
|
|
239
|
-
return new SafeSubscriber(next, error, complete);
|
|
240
|
-
}
|
|
241
|
-
next(value) {
|
|
242
|
-
if (this.isStopped) {
|
|
243
|
-
handleStoppedNotification(nextNotification(value), this);
|
|
244
|
-
}
|
|
245
|
-
else {
|
|
246
|
-
this._next(value);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
error(err) {
|
|
250
|
-
if (this.isStopped) {
|
|
251
|
-
handleStoppedNotification(errorNotification(err), this);
|
|
252
|
-
}
|
|
253
|
-
else {
|
|
254
|
-
this.isStopped = true;
|
|
255
|
-
this._error(err);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
complete() {
|
|
259
|
-
if (this.isStopped) {
|
|
260
|
-
handleStoppedNotification(COMPLETE_NOTIFICATION, this);
|
|
261
|
-
}
|
|
262
|
-
else {
|
|
263
|
-
this.isStopped = true;
|
|
264
|
-
this._complete();
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
unsubscribe() {
|
|
268
|
-
if (!this.closed) {
|
|
269
|
-
this.isStopped = true;
|
|
270
|
-
super.unsubscribe();
|
|
271
|
-
this.destination = null;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
_next(value) {
|
|
275
|
-
this.destination.next(value);
|
|
276
|
-
}
|
|
277
|
-
_error(err) {
|
|
278
|
-
try {
|
|
279
|
-
this.destination.error(err);
|
|
280
|
-
}
|
|
281
|
-
finally {
|
|
282
|
-
this.unsubscribe();
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
_complete() {
|
|
286
|
-
try {
|
|
287
|
-
this.destination.complete();
|
|
288
|
-
}
|
|
289
|
-
finally {
|
|
290
|
-
this.unsubscribe();
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
const _bind = Function.prototype.bind;
|
|
295
|
-
function bind(fn, thisArg) {
|
|
296
|
-
return _bind.call(fn, thisArg);
|
|
297
|
-
}
|
|
298
|
-
class ConsumerObserver {
|
|
299
|
-
constructor(partialObserver) {
|
|
300
|
-
this.partialObserver = partialObserver;
|
|
301
|
-
}
|
|
302
|
-
next(value) {
|
|
303
|
-
const { partialObserver } = this;
|
|
304
|
-
if (partialObserver.next) {
|
|
305
|
-
try {
|
|
306
|
-
partialObserver.next(value);
|
|
307
|
-
}
|
|
308
|
-
catch (error) {
|
|
309
|
-
handleUnhandledError(error);
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
error(err) {
|
|
314
|
-
const { partialObserver } = this;
|
|
315
|
-
if (partialObserver.error) {
|
|
316
|
-
try {
|
|
317
|
-
partialObserver.error(err);
|
|
318
|
-
}
|
|
319
|
-
catch (error) {
|
|
320
|
-
handleUnhandledError(error);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
else {
|
|
324
|
-
handleUnhandledError(err);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
complete() {
|
|
328
|
-
const { partialObserver } = this;
|
|
329
|
-
if (partialObserver.complete) {
|
|
330
|
-
try {
|
|
331
|
-
partialObserver.complete();
|
|
332
|
-
}
|
|
333
|
-
catch (error) {
|
|
334
|
-
handleUnhandledError(error);
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
class SafeSubscriber extends Subscriber {
|
|
340
|
-
constructor(observerOrNext, error, complete) {
|
|
341
|
-
super();
|
|
342
|
-
let partialObserver;
|
|
343
|
-
if (isFunction(observerOrNext) || !observerOrNext) {
|
|
344
|
-
partialObserver = {
|
|
345
|
-
next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
|
|
346
|
-
error: error !== null && error !== void 0 ? error : undefined,
|
|
347
|
-
complete: complete !== null && complete !== void 0 ? complete : undefined,
|
|
348
|
-
};
|
|
349
|
-
}
|
|
350
|
-
else {
|
|
351
|
-
let context;
|
|
352
|
-
if (this && config.useDeprecatedNextContext) {
|
|
353
|
-
context = Object.create(observerOrNext);
|
|
354
|
-
context.unsubscribe = () => this.unsubscribe();
|
|
355
|
-
partialObserver = {
|
|
356
|
-
next: observerOrNext.next && bind(observerOrNext.next, context),
|
|
357
|
-
error: observerOrNext.error && bind(observerOrNext.error, context),
|
|
358
|
-
complete: observerOrNext.complete && bind(observerOrNext.complete, context),
|
|
359
|
-
};
|
|
360
|
-
}
|
|
361
|
-
else {
|
|
362
|
-
partialObserver = observerOrNext;
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
this.destination = new ConsumerObserver(partialObserver);
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
function handleUnhandledError(error) {
|
|
369
|
-
{
|
|
370
|
-
reportUnhandledError(error);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
function defaultErrorHandler(err) {
|
|
374
|
-
throw err;
|
|
375
|
-
}
|
|
376
|
-
function handleStoppedNotification(notification, subscriber) {
|
|
377
|
-
const { onStoppedNotification } = config;
|
|
378
|
-
onStoppedNotification && timeoutProvider.setTimeout(() => onStoppedNotification(notification, subscriber));
|
|
379
|
-
}
|
|
380
|
-
const EMPTY_OBSERVER = {
|
|
381
|
-
closed: true,
|
|
382
|
-
next: noop,
|
|
383
|
-
error: defaultErrorHandler,
|
|
384
|
-
complete: noop,
|
|
385
|
-
};
|
|
386
|
-
|
|
387
|
-
const observable = (() => (typeof Symbol === 'function' && Symbol.observable) || '@@observable')();
|
|
388
|
-
|
|
389
|
-
function identity(x) {
|
|
390
|
-
return x;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
function pipeFromArray(fns) {
|
|
394
|
-
if (fns.length === 0) {
|
|
395
|
-
return identity;
|
|
396
|
-
}
|
|
397
|
-
if (fns.length === 1) {
|
|
398
|
-
return fns[0];
|
|
399
|
-
}
|
|
400
|
-
return function piped(input) {
|
|
401
|
-
return fns.reduce((prev, fn) => fn(prev), input);
|
|
402
|
-
};
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
class Observable {
|
|
406
|
-
constructor(subscribe) {
|
|
407
|
-
if (subscribe) {
|
|
408
|
-
this._subscribe = subscribe;
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
lift(operator) {
|
|
412
|
-
const observable = new Observable();
|
|
413
|
-
observable.source = this;
|
|
414
|
-
observable.operator = operator;
|
|
415
|
-
return observable;
|
|
416
|
-
}
|
|
417
|
-
subscribe(observerOrNext, error, complete) {
|
|
418
|
-
const subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
|
|
419
|
-
errorContext(() => {
|
|
420
|
-
const { operator, source } = this;
|
|
421
|
-
subscriber.add(operator
|
|
422
|
-
?
|
|
423
|
-
operator.call(subscriber, source)
|
|
424
|
-
: source
|
|
425
|
-
?
|
|
426
|
-
this._subscribe(subscriber)
|
|
427
|
-
:
|
|
428
|
-
this._trySubscribe(subscriber));
|
|
429
|
-
});
|
|
430
|
-
return subscriber;
|
|
431
|
-
}
|
|
432
|
-
_trySubscribe(sink) {
|
|
433
|
-
try {
|
|
434
|
-
return this._subscribe(sink);
|
|
435
|
-
}
|
|
436
|
-
catch (err) {
|
|
437
|
-
sink.error(err);
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
forEach(next, promiseCtor) {
|
|
441
|
-
promiseCtor = getPromiseCtor(promiseCtor);
|
|
442
|
-
return new promiseCtor((resolve, reject) => {
|
|
443
|
-
const subscriber = new SafeSubscriber({
|
|
444
|
-
next: (value) => {
|
|
445
|
-
try {
|
|
446
|
-
next(value);
|
|
447
|
-
}
|
|
448
|
-
catch (err) {
|
|
449
|
-
reject(err);
|
|
450
|
-
subscriber.unsubscribe();
|
|
451
|
-
}
|
|
452
|
-
},
|
|
453
|
-
error: reject,
|
|
454
|
-
complete: resolve,
|
|
455
|
-
});
|
|
456
|
-
this.subscribe(subscriber);
|
|
457
|
-
});
|
|
458
|
-
}
|
|
459
|
-
_subscribe(subscriber) {
|
|
460
|
-
var _a;
|
|
461
|
-
return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
|
|
462
|
-
}
|
|
463
|
-
[observable]() {
|
|
464
|
-
return this;
|
|
465
|
-
}
|
|
466
|
-
pipe(...operations) {
|
|
467
|
-
return pipeFromArray(operations)(this);
|
|
468
|
-
}
|
|
469
|
-
toPromise(promiseCtor) {
|
|
470
|
-
promiseCtor = getPromiseCtor(promiseCtor);
|
|
471
|
-
return new promiseCtor((resolve, reject) => {
|
|
472
|
-
let value;
|
|
473
|
-
this.subscribe((x) => (value = x), (err) => reject(err), () => resolve(value));
|
|
474
|
-
});
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
Observable.create = (subscribe) => {
|
|
478
|
-
return new Observable(subscribe);
|
|
479
|
-
};
|
|
480
|
-
function getPromiseCtor(promiseCtor) {
|
|
481
|
-
var _a;
|
|
482
|
-
return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
|
|
483
|
-
}
|
|
484
|
-
function isObserver(value) {
|
|
485
|
-
return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
|
|
486
|
-
}
|
|
487
|
-
function isSubscriber(value) {
|
|
488
|
-
return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
const ObjectUnsubscribedError = createErrorClass((_super) => function ObjectUnsubscribedErrorImpl() {
|
|
492
|
-
_super(this);
|
|
493
|
-
this.name = 'ObjectUnsubscribedError';
|
|
494
|
-
this.message = 'object unsubscribed';
|
|
495
|
-
});
|
|
496
|
-
|
|
497
|
-
class Subject extends Observable {
|
|
498
|
-
constructor() {
|
|
499
|
-
super();
|
|
500
|
-
this.closed = false;
|
|
501
|
-
this.currentObservers = null;
|
|
502
|
-
this.observers = [];
|
|
503
|
-
this.isStopped = false;
|
|
504
|
-
this.hasError = false;
|
|
505
|
-
this.thrownError = null;
|
|
506
|
-
}
|
|
507
|
-
lift(operator) {
|
|
508
|
-
const subject = new AnonymousSubject(this, this);
|
|
509
|
-
subject.operator = operator;
|
|
510
|
-
return subject;
|
|
511
|
-
}
|
|
512
|
-
_throwIfClosed() {
|
|
513
|
-
if (this.closed) {
|
|
514
|
-
throw new ObjectUnsubscribedError();
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
next(value) {
|
|
518
|
-
errorContext(() => {
|
|
519
|
-
this._throwIfClosed();
|
|
520
|
-
if (!this.isStopped) {
|
|
521
|
-
if (!this.currentObservers) {
|
|
522
|
-
this.currentObservers = Array.from(this.observers);
|
|
523
|
-
}
|
|
524
|
-
for (const observer of this.currentObservers) {
|
|
525
|
-
observer.next(value);
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
});
|
|
529
|
-
}
|
|
530
|
-
error(err) {
|
|
531
|
-
errorContext(() => {
|
|
532
|
-
this._throwIfClosed();
|
|
533
|
-
if (!this.isStopped) {
|
|
534
|
-
this.hasError = this.isStopped = true;
|
|
535
|
-
this.thrownError = err;
|
|
536
|
-
const { observers } = this;
|
|
537
|
-
while (observers.length) {
|
|
538
|
-
observers.shift().error(err);
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
});
|
|
542
|
-
}
|
|
543
|
-
complete() {
|
|
544
|
-
errorContext(() => {
|
|
545
|
-
this._throwIfClosed();
|
|
546
|
-
if (!this.isStopped) {
|
|
547
|
-
this.isStopped = true;
|
|
548
|
-
const { observers } = this;
|
|
549
|
-
while (observers.length) {
|
|
550
|
-
observers.shift().complete();
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
});
|
|
554
|
-
}
|
|
555
|
-
unsubscribe() {
|
|
556
|
-
this.isStopped = this.closed = true;
|
|
557
|
-
this.observers = this.currentObservers = null;
|
|
558
|
-
}
|
|
559
|
-
get observed() {
|
|
560
|
-
var _a;
|
|
561
|
-
return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
562
|
-
}
|
|
563
|
-
_trySubscribe(subscriber) {
|
|
564
|
-
this._throwIfClosed();
|
|
565
|
-
return super._trySubscribe(subscriber);
|
|
566
|
-
}
|
|
567
|
-
_subscribe(subscriber) {
|
|
568
|
-
this._throwIfClosed();
|
|
569
|
-
this._checkFinalizedStatuses(subscriber);
|
|
570
|
-
return this._innerSubscribe(subscriber);
|
|
571
|
-
}
|
|
572
|
-
_innerSubscribe(subscriber) {
|
|
573
|
-
const { hasError, isStopped, observers } = this;
|
|
574
|
-
if (hasError || isStopped) {
|
|
575
|
-
return EMPTY_SUBSCRIPTION;
|
|
576
|
-
}
|
|
577
|
-
this.currentObservers = null;
|
|
578
|
-
observers.push(subscriber);
|
|
579
|
-
return new Subscription(() => {
|
|
580
|
-
this.currentObservers = null;
|
|
581
|
-
arrRemove(observers, subscriber);
|
|
582
|
-
});
|
|
583
|
-
}
|
|
584
|
-
_checkFinalizedStatuses(subscriber) {
|
|
585
|
-
const { hasError, thrownError, isStopped } = this;
|
|
586
|
-
if (hasError) {
|
|
587
|
-
subscriber.error(thrownError);
|
|
588
|
-
}
|
|
589
|
-
else if (isStopped) {
|
|
590
|
-
subscriber.complete();
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
asObservable() {
|
|
594
|
-
const observable = new Observable();
|
|
595
|
-
observable.source = this;
|
|
596
|
-
return observable;
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
Subject.create = (destination, source) => {
|
|
600
|
-
return new AnonymousSubject(destination, source);
|
|
601
|
-
};
|
|
602
|
-
class AnonymousSubject extends Subject {
|
|
603
|
-
constructor(destination, source) {
|
|
604
|
-
super();
|
|
605
|
-
this.destination = destination;
|
|
606
|
-
this.source = source;
|
|
607
|
-
}
|
|
608
|
-
next(value) {
|
|
609
|
-
var _a, _b;
|
|
610
|
-
(_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
|
|
611
|
-
}
|
|
612
|
-
error(err) {
|
|
613
|
-
var _a, _b;
|
|
614
|
-
(_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
|
|
615
|
-
}
|
|
616
|
-
complete() {
|
|
617
|
-
var _a, _b;
|
|
618
|
-
(_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
619
|
-
}
|
|
620
|
-
_subscribe(subscriber) {
|
|
621
|
-
var _a, _b;
|
|
622
|
-
return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
class BehaviorSubject extends Subject {
|
|
627
|
-
constructor(_value) {
|
|
628
|
-
super();
|
|
629
|
-
this._value = _value;
|
|
630
|
-
}
|
|
631
|
-
get value() {
|
|
632
|
-
return this.getValue();
|
|
633
|
-
}
|
|
634
|
-
_subscribe(subscriber) {
|
|
635
|
-
const subscription = super._subscribe(subscriber);
|
|
636
|
-
!subscription.closed && subscriber.next(this._value);
|
|
637
|
-
return subscription;
|
|
638
|
-
}
|
|
639
|
-
getValue() {
|
|
640
|
-
const { hasError, thrownError, _value } = this;
|
|
641
|
-
if (hasError) {
|
|
642
|
-
throw thrownError;
|
|
643
|
-
}
|
|
644
|
-
this._throwIfClosed();
|
|
645
|
-
return _value;
|
|
646
|
-
}
|
|
647
|
-
next(value) {
|
|
648
|
-
super.next((this._value = value));
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
class FormController {
|
|
653
|
-
constructor(schema) {
|
|
654
|
-
this.values = new BehaviorSubject({});
|
|
655
|
-
this.errors = new BehaviorSubject({});
|
|
656
|
-
this._initialValues = {};
|
|
657
|
-
this._values = {};
|
|
658
|
-
this._errors = {};
|
|
659
|
-
this._isValid = true;
|
|
660
|
-
this._schema = schema;
|
|
661
|
-
}
|
|
662
|
-
processArrayError(obj, property, remainingProperties, message) {
|
|
663
|
-
// Extract array name and index from the property string
|
|
664
|
-
const [arrayName, indexStr] = property
|
|
665
|
-
.match(/^([a-zA-Z0-9]+)\[(\d+)\]/)
|
|
666
|
-
.slice(1);
|
|
667
|
-
const index = parseInt(indexStr, 10);
|
|
668
|
-
// Ensure the array exists and has an entry at the given index
|
|
669
|
-
obj[arrayName] = obj[arrayName] || [];
|
|
670
|
-
obj[arrayName][index] = obj[arrayName][index] || {};
|
|
671
|
-
// Recursively set the error if there are remaining properties, else set the error message
|
|
672
|
-
if (remainingProperties.length) {
|
|
673
|
-
this.setNestedError(obj[arrayName][index], remainingProperties, message);
|
|
674
|
-
}
|
|
675
|
-
else {
|
|
676
|
-
obj[arrayName][index] = message;
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
processRegularError(obj, property, remainingProperties, message) {
|
|
680
|
-
// Ensure the property exists
|
|
681
|
-
obj[property] = obj[property] || {};
|
|
682
|
-
// Recursively set the error if there are remaining properties, else set the error message
|
|
683
|
-
if (remainingProperties.length) {
|
|
684
|
-
this.setNestedError(obj[property], remainingProperties, message);
|
|
685
|
-
}
|
|
686
|
-
else {
|
|
687
|
-
obj[property] = message;
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
setNestedError(obj, properties, message) {
|
|
691
|
-
const property = properties.shift();
|
|
692
|
-
const isArrayError = property.includes('[');
|
|
693
|
-
if (isArrayError) {
|
|
694
|
-
this.processArrayError(obj, property, properties, message);
|
|
695
|
-
}
|
|
696
|
-
else {
|
|
697
|
-
this.processRegularError(obj, property, properties, message);
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
setError(obj, path, message) {
|
|
701
|
-
// Convert path to properties array
|
|
702
|
-
const properties = Array.isArray(path) ? path : path.split('.');
|
|
703
|
-
this.setNestedError(obj, properties, message);
|
|
704
|
-
}
|
|
705
|
-
async validate(context) {
|
|
706
|
-
this._isValid = true;
|
|
707
|
-
this._errors = {};
|
|
708
|
-
try {
|
|
709
|
-
await this._schema.validate(this._values, { context, abortEarly: false });
|
|
710
|
-
}
|
|
711
|
-
catch (err) {
|
|
712
|
-
this._isValid = false;
|
|
713
|
-
err.inner.forEach((item) => {
|
|
714
|
-
this.setError(this._errors, item.path, item.message);
|
|
715
|
-
});
|
|
716
|
-
}
|
|
717
|
-
this.errors.next(this._errors);
|
|
718
|
-
return this._isValid;
|
|
719
|
-
}
|
|
720
|
-
async validateAndSubmit(submitHandler, context) {
|
|
721
|
-
const isValid = await this.validate(context || {});
|
|
722
|
-
if (isValid) {
|
|
723
|
-
submitHandler(this._values);
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
setInitialValues(values) {
|
|
727
|
-
this._initialValues = values;
|
|
728
|
-
this._values = values;
|
|
729
|
-
this.values.next(this._values);
|
|
730
|
-
}
|
|
731
|
-
setValues(values) {
|
|
732
|
-
this._values = Object.assign(Object.assign({}, this._values), values);
|
|
733
|
-
this.values.next(this._values);
|
|
734
|
-
}
|
|
735
|
-
resetValues() {
|
|
736
|
-
this._values = this._initialValues;
|
|
737
|
-
this.values.next(this._values);
|
|
738
|
-
}
|
|
739
|
-
getInitialValues() {
|
|
740
|
-
return this._initialValues;
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
/**
|
|
745
|
-
* Based on Kendo UI Core expression code <https://github.com/telerik/kendo-ui-core#license-information>
|
|
746
|
-
*/
|
|
747
|
-
|
|
748
|
-
function Cache(maxSize) {
|
|
749
|
-
this._maxSize = maxSize;
|
|
750
|
-
this.clear();
|
|
751
|
-
}
|
|
752
|
-
Cache.prototype.clear = function () {
|
|
753
|
-
this._size = 0;
|
|
754
|
-
this._values = Object.create(null);
|
|
755
|
-
};
|
|
756
|
-
Cache.prototype.get = function (key) {
|
|
757
|
-
return this._values[key]
|
|
758
|
-
};
|
|
759
|
-
Cache.prototype.set = function (key, value) {
|
|
760
|
-
this._size >= this._maxSize && this.clear();
|
|
761
|
-
if (!(key in this._values)) this._size++;
|
|
762
|
-
|
|
763
|
-
return (this._values[key] = value)
|
|
764
|
-
};
|
|
765
|
-
|
|
766
|
-
var SPLIT_REGEX = /[^.^\]^[]+|(?=\[\]|\.\.)/g,
|
|
767
|
-
DIGIT_REGEX = /^\d+$/,
|
|
768
|
-
LEAD_DIGIT_REGEX = /^\d/,
|
|
769
|
-
SPEC_CHAR_REGEX = /[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,
|
|
770
|
-
CLEAN_QUOTES_REGEX = /^\s*(['"]?)(.*?)(\1)\s*$/,
|
|
771
|
-
MAX_CACHE_SIZE = 512;
|
|
772
|
-
|
|
773
|
-
var pathCache = new Cache(MAX_CACHE_SIZE),
|
|
774
|
-
setCache = new Cache(MAX_CACHE_SIZE),
|
|
775
|
-
getCache = new Cache(MAX_CACHE_SIZE);
|
|
776
|
-
|
|
777
|
-
var propertyExpr = {
|
|
778
|
-
Cache: Cache,
|
|
779
|
-
|
|
780
|
-
split: split,
|
|
781
|
-
|
|
782
|
-
normalizePath: normalizePath,
|
|
783
|
-
|
|
784
|
-
setter: function (path) {
|
|
785
|
-
var parts = normalizePath(path);
|
|
786
|
-
|
|
787
|
-
return (
|
|
788
|
-
setCache.get(path) ||
|
|
789
|
-
setCache.set(path, function setter(obj, value) {
|
|
790
|
-
var index = 0;
|
|
791
|
-
var len = parts.length;
|
|
792
|
-
var data = obj;
|
|
793
|
-
|
|
794
|
-
while (index < len - 1) {
|
|
795
|
-
var part = parts[index];
|
|
796
|
-
if (
|
|
797
|
-
part === '__proto__' ||
|
|
798
|
-
part === 'constructor' ||
|
|
799
|
-
part === 'prototype'
|
|
800
|
-
) {
|
|
801
|
-
return obj
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
data = data[parts[index++]];
|
|
805
|
-
}
|
|
806
|
-
data[parts[index]] = value;
|
|
807
|
-
})
|
|
808
|
-
)
|
|
809
|
-
},
|
|
810
|
-
|
|
811
|
-
getter: function (path, safe) {
|
|
812
|
-
var parts = normalizePath(path);
|
|
813
|
-
return (
|
|
814
|
-
getCache.get(path) ||
|
|
815
|
-
getCache.set(path, function getter(data) {
|
|
816
|
-
var index = 0,
|
|
817
|
-
len = parts.length;
|
|
818
|
-
while (index < len) {
|
|
819
|
-
if (data != null || !safe) data = data[parts[index++]];
|
|
820
|
-
else return
|
|
821
|
-
}
|
|
822
|
-
return data
|
|
823
|
-
})
|
|
824
|
-
)
|
|
825
|
-
},
|
|
826
|
-
|
|
827
|
-
join: function (segments) {
|
|
828
|
-
return segments.reduce(function (path, part) {
|
|
829
|
-
return (
|
|
830
|
-
path +
|
|
831
|
-
(isQuoted(part) || DIGIT_REGEX.test(part)
|
|
832
|
-
? '[' + part + ']'
|
|
833
|
-
: (path ? '.' : '') + part)
|
|
834
|
-
)
|
|
835
|
-
}, '')
|
|
836
|
-
},
|
|
837
|
-
|
|
838
|
-
forEach: function (path, cb, thisArg) {
|
|
839
|
-
forEach(Array.isArray(path) ? path : split(path), cb, thisArg);
|
|
840
|
-
},
|
|
841
|
-
};
|
|
842
|
-
|
|
843
|
-
function normalizePath(path) {
|
|
844
|
-
return (
|
|
845
|
-
pathCache.get(path) ||
|
|
846
|
-
pathCache.set(
|
|
847
|
-
path,
|
|
848
|
-
split(path).map(function (part) {
|
|
849
|
-
return part.replace(CLEAN_QUOTES_REGEX, '$2')
|
|
850
|
-
})
|
|
851
|
-
)
|
|
852
|
-
)
|
|
853
|
-
}
|
|
854
|
-
|
|
855
|
-
function split(path) {
|
|
856
|
-
return path.match(SPLIT_REGEX) || ['']
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
function forEach(parts, iter, thisArg) {
|
|
860
|
-
var len = parts.length,
|
|
861
|
-
part,
|
|
862
|
-
idx,
|
|
863
|
-
isArray,
|
|
864
|
-
isBracket;
|
|
865
|
-
|
|
866
|
-
for (idx = 0; idx < len; idx++) {
|
|
867
|
-
part = parts[idx];
|
|
868
|
-
|
|
869
|
-
if (part) {
|
|
870
|
-
if (shouldBeQuoted(part)) {
|
|
871
|
-
part = '"' + part + '"';
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
isBracket = isQuoted(part);
|
|
875
|
-
isArray = !isBracket && /^\d+$/.test(part);
|
|
876
|
-
|
|
877
|
-
iter.call(thisArg, part, isBracket, isArray, idx, parts);
|
|
878
|
-
}
|
|
879
|
-
}
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
function isQuoted(str) {
|
|
883
|
-
return (
|
|
884
|
-
typeof str === 'string' && str && ["'", '"'].indexOf(str.charAt(0)) !== -1
|
|
885
|
-
)
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
function hasLeadingNumber(part) {
|
|
889
|
-
return part.match(LEAD_DIGIT_REGEX) && !part.match(DIGIT_REGEX)
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
function hasSpecialChars(part) {
|
|
893
|
-
return SPEC_CHAR_REGEX.test(part)
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
function shouldBeQuoted(part) {
|
|
897
|
-
return !isQuoted(part) && (hasLeadingNumber(part) || hasSpecialChars(part))
|
|
898
|
-
}
|
|
899
|
-
|
|
900
|
-
const reWords = /[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g;
|
|
901
|
-
|
|
902
|
-
const words = (str) => str.match(reWords) || [];
|
|
903
|
-
|
|
904
|
-
const upperFirst = (str) => str[0].toUpperCase() + str.slice(1);
|
|
905
|
-
|
|
906
|
-
const join = (str, d) => words(str).join(d).toLowerCase();
|
|
907
|
-
|
|
908
|
-
const camelCase = (str) =>
|
|
909
|
-
words(str).reduce(
|
|
910
|
-
(acc, next) =>
|
|
911
|
-
`${acc}${
|
|
912
|
-
!acc
|
|
913
|
-
? next.toLowerCase()
|
|
914
|
-
: next[0].toUpperCase() + next.slice(1).toLowerCase()
|
|
915
|
-
}`,
|
|
916
|
-
'',
|
|
917
|
-
);
|
|
918
|
-
|
|
919
|
-
const pascalCase = (str) => upperFirst(camelCase(str));
|
|
920
|
-
|
|
921
|
-
const snakeCase = (str) => join(str, '_');
|
|
922
|
-
|
|
923
|
-
const kebabCase = (str) => join(str, '-');
|
|
924
|
-
|
|
925
|
-
const sentenceCase = (str) => upperFirst(join(str, ' '));
|
|
926
|
-
|
|
927
|
-
const titleCase = (str) => words(str).map(upperFirst).join(' ');
|
|
928
|
-
|
|
929
|
-
var tinyCase = {
|
|
930
|
-
words,
|
|
931
|
-
upperFirst,
|
|
932
|
-
camelCase,
|
|
933
|
-
pascalCase,
|
|
934
|
-
snakeCase,
|
|
935
|
-
kebabCase,
|
|
936
|
-
sentenceCase,
|
|
937
|
-
titleCase,
|
|
938
|
-
};
|
|
939
|
-
|
|
940
|
-
var toposort$2 = {exports: {}};
|
|
941
|
-
|
|
942
|
-
/**
|
|
943
|
-
* Topological sorting function
|
|
944
|
-
*
|
|
945
|
-
* @param {Array} edges
|
|
946
|
-
* @returns {Array}
|
|
947
|
-
*/
|
|
948
|
-
|
|
949
|
-
toposort$2.exports = function(edges) {
|
|
950
|
-
return toposort(uniqueNodes(edges), edges)
|
|
951
|
-
};
|
|
952
|
-
|
|
953
|
-
toposort$2.exports.array = toposort;
|
|
954
|
-
|
|
955
|
-
function toposort(nodes, edges) {
|
|
956
|
-
var cursor = nodes.length
|
|
957
|
-
, sorted = new Array(cursor)
|
|
958
|
-
, visited = {}
|
|
959
|
-
, i = cursor
|
|
960
|
-
// Better data structures make algorithm much faster.
|
|
961
|
-
, outgoingEdges = makeOutgoingEdges(edges)
|
|
962
|
-
, nodesHash = makeNodesHash(nodes);
|
|
963
|
-
|
|
964
|
-
// check for unknown nodes
|
|
965
|
-
edges.forEach(function(edge) {
|
|
966
|
-
if (!nodesHash.has(edge[0]) || !nodesHash.has(edge[1])) {
|
|
967
|
-
throw new Error('Unknown node. There is an unknown node in the supplied edges.')
|
|
968
|
-
}
|
|
969
|
-
});
|
|
970
|
-
|
|
971
|
-
while (i--) {
|
|
972
|
-
if (!visited[i]) visit(nodes[i], i, new Set());
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
return sorted
|
|
976
|
-
|
|
977
|
-
function visit(node, i, predecessors) {
|
|
978
|
-
if(predecessors.has(node)) {
|
|
979
|
-
var nodeRep;
|
|
980
|
-
try {
|
|
981
|
-
nodeRep = ", node was:" + JSON.stringify(node);
|
|
982
|
-
} catch(e) {
|
|
983
|
-
nodeRep = "";
|
|
984
|
-
}
|
|
985
|
-
throw new Error('Cyclic dependency' + nodeRep)
|
|
986
|
-
}
|
|
987
|
-
|
|
988
|
-
if (!nodesHash.has(node)) {
|
|
989
|
-
throw new Error('Found unknown node. Make sure to provided all involved nodes. Unknown node: '+JSON.stringify(node))
|
|
990
|
-
}
|
|
991
|
-
|
|
992
|
-
if (visited[i]) return;
|
|
993
|
-
visited[i] = true;
|
|
994
|
-
|
|
995
|
-
var outgoing = outgoingEdges.get(node) || new Set();
|
|
996
|
-
outgoing = Array.from(outgoing);
|
|
997
|
-
|
|
998
|
-
if (i = outgoing.length) {
|
|
999
|
-
predecessors.add(node);
|
|
1000
|
-
do {
|
|
1001
|
-
var child = outgoing[--i];
|
|
1002
|
-
visit(child, nodesHash.get(child), predecessors);
|
|
1003
|
-
} while (i)
|
|
1004
|
-
predecessors.delete(node);
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
|
-
sorted[--cursor] = node;
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
function uniqueNodes(arr){
|
|
1012
|
-
var res = new Set();
|
|
1013
|
-
for (var i = 0, len = arr.length; i < len; i++) {
|
|
1014
|
-
var edge = arr[i];
|
|
1015
|
-
res.add(edge[0]);
|
|
1016
|
-
res.add(edge[1]);
|
|
1017
|
-
}
|
|
1018
|
-
return Array.from(res)
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
function makeOutgoingEdges(arr){
|
|
1022
|
-
var edges = new Map();
|
|
1023
|
-
for (var i = 0, len = arr.length; i < len; i++) {
|
|
1024
|
-
var edge = arr[i];
|
|
1025
|
-
if (!edges.has(edge[0])) edges.set(edge[0], new Set());
|
|
1026
|
-
if (!edges.has(edge[1])) edges.set(edge[1], new Set());
|
|
1027
|
-
edges.get(edge[0]).add(edge[1]);
|
|
1028
|
-
}
|
|
1029
|
-
return edges
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
function makeNodesHash(arr){
|
|
1033
|
-
var res = new Map();
|
|
1034
|
-
for (var i = 0, len = arr.length; i < len; i++) {
|
|
1035
|
-
res.set(arr[i], i);
|
|
1036
|
-
}
|
|
1037
|
-
return res
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
|
-
const toposort$1 = toposort$2.exports;
|
|
1041
|
-
|
|
1042
|
-
const toString = Object.prototype.toString;
|
|
1043
|
-
const errorToString = Error.prototype.toString;
|
|
1044
|
-
const regExpToString = RegExp.prototype.toString;
|
|
1045
|
-
const symbolToString = typeof Symbol !== 'undefined' ? Symbol.prototype.toString : () => '';
|
|
1046
|
-
const SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
|
|
1047
|
-
function printNumber(val) {
|
|
1048
|
-
if (val != +val) return 'NaN';
|
|
1049
|
-
const isNegativeZero = val === 0 && 1 / val < 0;
|
|
1050
|
-
return isNegativeZero ? '-0' : '' + val;
|
|
1051
|
-
}
|
|
1052
|
-
function printSimpleValue(val, quoteStrings = false) {
|
|
1053
|
-
if (val == null || val === true || val === false) return '' + val;
|
|
1054
|
-
const typeOf = typeof val;
|
|
1055
|
-
if (typeOf === 'number') return printNumber(val);
|
|
1056
|
-
if (typeOf === 'string') return quoteStrings ? `"${val}"` : val;
|
|
1057
|
-
if (typeOf === 'function') return '[Function ' + (val.name || 'anonymous') + ']';
|
|
1058
|
-
if (typeOf === 'symbol') return symbolToString.call(val).replace(SYMBOL_REGEXP, 'Symbol($1)');
|
|
1059
|
-
const tag = toString.call(val).slice(8, -1);
|
|
1060
|
-
if (tag === 'Date') return isNaN(val.getTime()) ? '' + val : val.toISOString(val);
|
|
1061
|
-
if (tag === 'Error' || val instanceof Error) return '[' + errorToString.call(val) + ']';
|
|
1062
|
-
if (tag === 'RegExp') return regExpToString.call(val);
|
|
1063
|
-
return null;
|
|
1064
|
-
}
|
|
1065
|
-
function printValue(value, quoteStrings) {
|
|
1066
|
-
let result = printSimpleValue(value, quoteStrings);
|
|
1067
|
-
if (result !== null) return result;
|
|
1068
|
-
return JSON.stringify(value, function (key, value) {
|
|
1069
|
-
let result = printSimpleValue(this[key], quoteStrings);
|
|
1070
|
-
if (result !== null) return result;
|
|
1071
|
-
return value;
|
|
1072
|
-
}, 2);
|
|
1073
|
-
}
|
|
1074
|
-
|
|
1075
|
-
function toArray(value) {
|
|
1076
|
-
return value == null ? [] : [].concat(value);
|
|
1077
|
-
}
|
|
1078
|
-
|
|
1079
|
-
let _Symbol$toStringTag, _Symbol$hasInstance, _Symbol$toStringTag2;
|
|
1080
|
-
let strReg = /\$\{\s*(\w+)\s*\}/g;
|
|
1081
|
-
_Symbol$toStringTag = Symbol.toStringTag;
|
|
1082
|
-
class ValidationErrorNoStack {
|
|
1083
|
-
constructor(errorOrErrors, value, field, type) {
|
|
1084
|
-
this.name = void 0;
|
|
1085
|
-
this.message = void 0;
|
|
1086
|
-
this.value = void 0;
|
|
1087
|
-
this.path = void 0;
|
|
1088
|
-
this.type = void 0;
|
|
1089
|
-
this.params = void 0;
|
|
1090
|
-
this.errors = void 0;
|
|
1091
|
-
this.inner = void 0;
|
|
1092
|
-
this[_Symbol$toStringTag] = 'Error';
|
|
1093
|
-
this.name = 'ValidationError';
|
|
1094
|
-
this.value = value;
|
|
1095
|
-
this.path = field;
|
|
1096
|
-
this.type = type;
|
|
1097
|
-
this.errors = [];
|
|
1098
|
-
this.inner = [];
|
|
1099
|
-
toArray(errorOrErrors).forEach(err => {
|
|
1100
|
-
if (ValidationError.isError(err)) {
|
|
1101
|
-
this.errors.push(...err.errors);
|
|
1102
|
-
const innerErrors = err.inner.length ? err.inner : [err];
|
|
1103
|
-
this.inner.push(...innerErrors);
|
|
1104
|
-
} else {
|
|
1105
|
-
this.errors.push(err);
|
|
1106
|
-
}
|
|
1107
|
-
});
|
|
1108
|
-
this.message = this.errors.length > 1 ? `${this.errors.length} errors occurred` : this.errors[0];
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1111
|
-
_Symbol$hasInstance = Symbol.hasInstance;
|
|
1112
|
-
_Symbol$toStringTag2 = Symbol.toStringTag;
|
|
1113
|
-
class ValidationError extends Error {
|
|
1114
|
-
static formatError(message, params) {
|
|
1115
|
-
const path = params.label || params.path || 'this';
|
|
1116
|
-
if (path !== params.path) params = Object.assign({}, params, {
|
|
1117
|
-
path
|
|
1118
|
-
});
|
|
1119
|
-
if (typeof message === 'string') return message.replace(strReg, (_, key) => printValue(params[key]));
|
|
1120
|
-
if (typeof message === 'function') return message(params);
|
|
1121
|
-
return message;
|
|
1122
|
-
}
|
|
1123
|
-
static isError(err) {
|
|
1124
|
-
return err && err.name === 'ValidationError';
|
|
1125
|
-
}
|
|
1126
|
-
constructor(errorOrErrors, value, field, type, disableStack) {
|
|
1127
|
-
const errorNoStack = new ValidationErrorNoStack(errorOrErrors, value, field, type);
|
|
1128
|
-
if (disableStack) {
|
|
1129
|
-
return errorNoStack;
|
|
1130
|
-
}
|
|
1131
|
-
super();
|
|
1132
|
-
this.value = void 0;
|
|
1133
|
-
this.path = void 0;
|
|
1134
|
-
this.type = void 0;
|
|
1135
|
-
this.params = void 0;
|
|
1136
|
-
this.errors = [];
|
|
1137
|
-
this.inner = [];
|
|
1138
|
-
this[_Symbol$toStringTag2] = 'Error';
|
|
1139
|
-
this.name = errorNoStack.name;
|
|
1140
|
-
this.message = errorNoStack.message;
|
|
1141
|
-
this.type = errorNoStack.type;
|
|
1142
|
-
this.value = errorNoStack.value;
|
|
1143
|
-
this.path = errorNoStack.path;
|
|
1144
|
-
this.errors = errorNoStack.errors;
|
|
1145
|
-
this.inner = errorNoStack.inner;
|
|
1146
|
-
if (Error.captureStackTrace) {
|
|
1147
|
-
Error.captureStackTrace(this, ValidationError);
|
|
1148
|
-
}
|
|
1149
|
-
}
|
|
1150
|
-
static [_Symbol$hasInstance](inst) {
|
|
1151
|
-
return ValidationErrorNoStack[Symbol.hasInstance](inst) || super[Symbol.hasInstance](inst);
|
|
1152
|
-
}
|
|
1153
|
-
}
|
|
1154
|
-
|
|
1155
|
-
let mixed = {
|
|
1156
|
-
default: '${path} is invalid',
|
|
1157
|
-
required: '${path} is a required field',
|
|
1158
|
-
defined: '${path} must be defined',
|
|
1159
|
-
notNull: '${path} cannot be null',
|
|
1160
|
-
oneOf: '${path} must be one of the following values: ${values}',
|
|
1161
|
-
notOneOf: '${path} must not be one of the following values: ${values}',
|
|
1162
|
-
notType: ({
|
|
1163
|
-
path,
|
|
1164
|
-
type,
|
|
1165
|
-
value,
|
|
1166
|
-
originalValue
|
|
1167
|
-
}) => {
|
|
1168
|
-
const castMsg = originalValue != null && originalValue !== value ? ` (cast from the value \`${printValue(originalValue, true)}\`).` : '.';
|
|
1169
|
-
return type !== 'mixed' ? `${path} must be a \`${type}\` type, ` + `but the final value was: \`${printValue(value, true)}\`` + castMsg : `${path} must match the configured type. ` + `The validated value was: \`${printValue(value, true)}\`` + castMsg;
|
|
1170
|
-
}
|
|
1171
|
-
};
|
|
1172
|
-
let string = {
|
|
1173
|
-
length: '${path} must be exactly ${length} characters',
|
|
1174
|
-
min: '${path} must be at least ${min} characters',
|
|
1175
|
-
max: '${path} must be at most ${max} characters',
|
|
1176
|
-
matches: '${path} must match the following: "${regex}"',
|
|
1177
|
-
email: '${path} must be a valid email',
|
|
1178
|
-
url: '${path} must be a valid URL',
|
|
1179
|
-
uuid: '${path} must be a valid UUID',
|
|
1180
|
-
datetime: '${path} must be a valid ISO date-time',
|
|
1181
|
-
datetime_precision: '${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits',
|
|
1182
|
-
datetime_offset: '${path} must be a valid ISO date-time with UTC "Z" timezone',
|
|
1183
|
-
trim: '${path} must be a trimmed string',
|
|
1184
|
-
lowercase: '${path} must be a lowercase string',
|
|
1185
|
-
uppercase: '${path} must be a upper case string'
|
|
1186
|
-
};
|
|
1187
|
-
let number = {
|
|
1188
|
-
min: '${path} must be greater than or equal to ${min}',
|
|
1189
|
-
max: '${path} must be less than or equal to ${max}',
|
|
1190
|
-
lessThan: '${path} must be less than ${less}',
|
|
1191
|
-
moreThan: '${path} must be greater than ${more}',
|
|
1192
|
-
positive: '${path} must be a positive number',
|
|
1193
|
-
negative: '${path} must be a negative number',
|
|
1194
|
-
integer: '${path} must be an integer'
|
|
1195
|
-
};
|
|
1196
|
-
let date = {
|
|
1197
|
-
min: '${path} field must be later than ${min}',
|
|
1198
|
-
max: '${path} field must be at earlier than ${max}'
|
|
1199
|
-
};
|
|
1200
|
-
let boolean = {
|
|
1201
|
-
isValue: '${path} field must be ${value}'
|
|
1202
|
-
};
|
|
1203
|
-
let object = {
|
|
1204
|
-
noUnknown: '${path} field has unspecified keys: ${unknown}'
|
|
1205
|
-
};
|
|
1206
|
-
let array = {
|
|
1207
|
-
min: '${path} field must have at least ${min} items',
|
|
1208
|
-
max: '${path} field must have less than or equal to ${max} items',
|
|
1209
|
-
length: '${path} must have ${length} items'
|
|
1210
|
-
};
|
|
1211
|
-
let tuple = {
|
|
1212
|
-
notType: params => {
|
|
1213
|
-
const {
|
|
1214
|
-
path,
|
|
1215
|
-
value,
|
|
1216
|
-
spec
|
|
1217
|
-
} = params;
|
|
1218
|
-
const typeLen = spec.types.length;
|
|
1219
|
-
if (Array.isArray(value)) {
|
|
1220
|
-
if (value.length < typeLen) return `${path} tuple value has too few items, expected a length of ${typeLen} but got ${value.length} for value: \`${printValue(value, true)}\``;
|
|
1221
|
-
if (value.length > typeLen) return `${path} tuple value has too many items, expected a length of ${typeLen} but got ${value.length} for value: \`${printValue(value, true)}\``;
|
|
1222
|
-
}
|
|
1223
|
-
return ValidationError.formatError(mixed.notType, params);
|
|
1224
|
-
}
|
|
1225
|
-
};
|
|
1226
|
-
Object.assign(Object.create(null), {
|
|
1227
|
-
mixed,
|
|
1228
|
-
string,
|
|
1229
|
-
number,
|
|
1230
|
-
date,
|
|
1231
|
-
object,
|
|
1232
|
-
array,
|
|
1233
|
-
boolean,
|
|
1234
|
-
tuple
|
|
1235
|
-
});
|
|
1236
|
-
|
|
1237
|
-
const isSchema = obj => obj && obj.__isYupSchema__;
|
|
1238
|
-
|
|
1239
|
-
class Condition {
|
|
1240
|
-
static fromOptions(refs, config) {
|
|
1241
|
-
if (!config.then && !config.otherwise) throw new TypeError('either `then:` or `otherwise:` is required for `when()` conditions');
|
|
1242
|
-
let {
|
|
1243
|
-
is,
|
|
1244
|
-
then,
|
|
1245
|
-
otherwise
|
|
1246
|
-
} = config;
|
|
1247
|
-
let check = typeof is === 'function' ? is : (...values) => values.every(value => value === is);
|
|
1248
|
-
return new Condition(refs, (values, schema) => {
|
|
1249
|
-
var _branch;
|
|
1250
|
-
let branch = check(...values) ? then : otherwise;
|
|
1251
|
-
return (_branch = branch == null ? void 0 : branch(schema)) != null ? _branch : schema;
|
|
1252
|
-
});
|
|
1253
|
-
}
|
|
1254
|
-
constructor(refs, builder) {
|
|
1255
|
-
this.fn = void 0;
|
|
1256
|
-
this.refs = refs;
|
|
1257
|
-
this.refs = refs;
|
|
1258
|
-
this.fn = builder;
|
|
1259
|
-
}
|
|
1260
|
-
resolve(base, options) {
|
|
1261
|
-
let values = this.refs.map(ref =>
|
|
1262
|
-
// TODO: ? operator here?
|
|
1263
|
-
ref.getValue(options == null ? void 0 : options.value, options == null ? void 0 : options.parent, options == null ? void 0 : options.context));
|
|
1264
|
-
let schema = this.fn(values, base, options);
|
|
1265
|
-
if (schema === undefined ||
|
|
1266
|
-
// @ts-ignore this can be base
|
|
1267
|
-
schema === base) {
|
|
1268
|
-
return base;
|
|
1269
|
-
}
|
|
1270
|
-
if (!isSchema(schema)) throw new TypeError('conditions must return a schema object');
|
|
1271
|
-
return schema.resolve(options);
|
|
1272
|
-
}
|
|
1273
|
-
}
|
|
1274
|
-
|
|
1275
|
-
const prefixes = {
|
|
1276
|
-
context: '$',
|
|
1277
|
-
value: '.'
|
|
1278
|
-
};
|
|
1279
|
-
class Reference {
|
|
1280
|
-
constructor(key, options = {}) {
|
|
1281
|
-
this.key = void 0;
|
|
1282
|
-
this.isContext = void 0;
|
|
1283
|
-
this.isValue = void 0;
|
|
1284
|
-
this.isSibling = void 0;
|
|
1285
|
-
this.path = void 0;
|
|
1286
|
-
this.getter = void 0;
|
|
1287
|
-
this.map = void 0;
|
|
1288
|
-
if (typeof key !== 'string') throw new TypeError('ref must be a string, got: ' + key);
|
|
1289
|
-
this.key = key.trim();
|
|
1290
|
-
if (key === '') throw new TypeError('ref must be a non-empty string');
|
|
1291
|
-
this.isContext = this.key[0] === prefixes.context;
|
|
1292
|
-
this.isValue = this.key[0] === prefixes.value;
|
|
1293
|
-
this.isSibling = !this.isContext && !this.isValue;
|
|
1294
|
-
let prefix = this.isContext ? prefixes.context : this.isValue ? prefixes.value : '';
|
|
1295
|
-
this.path = this.key.slice(prefix.length);
|
|
1296
|
-
this.getter = this.path && propertyExpr.getter(this.path, true);
|
|
1297
|
-
this.map = options.map;
|
|
1298
|
-
}
|
|
1299
|
-
getValue(value, parent, context) {
|
|
1300
|
-
let result = this.isContext ? context : this.isValue ? value : parent;
|
|
1301
|
-
if (this.getter) result = this.getter(result || {});
|
|
1302
|
-
if (this.map) result = this.map(result);
|
|
1303
|
-
return result;
|
|
1304
|
-
}
|
|
1305
|
-
|
|
1306
|
-
/**
|
|
1307
|
-
*
|
|
1308
|
-
* @param {*} value
|
|
1309
|
-
* @param {Object} options
|
|
1310
|
-
* @param {Object=} options.context
|
|
1311
|
-
* @param {Object=} options.parent
|
|
1312
|
-
*/
|
|
1313
|
-
cast(value, options) {
|
|
1314
|
-
return this.getValue(value, options == null ? void 0 : options.parent, options == null ? void 0 : options.context);
|
|
1315
|
-
}
|
|
1316
|
-
resolve() {
|
|
1317
|
-
return this;
|
|
1318
|
-
}
|
|
1319
|
-
describe() {
|
|
1320
|
-
return {
|
|
1321
|
-
type: 'ref',
|
|
1322
|
-
key: this.key
|
|
1323
|
-
};
|
|
1324
|
-
}
|
|
1325
|
-
toString() {
|
|
1326
|
-
return `Ref(${this.key})`;
|
|
1327
|
-
}
|
|
1328
|
-
static isRef(value) {
|
|
1329
|
-
return value && value.__isYupRef;
|
|
1330
|
-
}
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
// @ts-ignore
|
|
1334
|
-
Reference.prototype.__isYupRef = true;
|
|
1335
|
-
|
|
1336
|
-
const isAbsent = value => value == null;
|
|
1337
|
-
|
|
1338
|
-
function createValidation(config) {
|
|
1339
|
-
function validate({
|
|
1340
|
-
value,
|
|
1341
|
-
path = '',
|
|
1342
|
-
options,
|
|
1343
|
-
originalValue,
|
|
1344
|
-
schema
|
|
1345
|
-
}, panic, next) {
|
|
1346
|
-
const {
|
|
1347
|
-
name,
|
|
1348
|
-
test,
|
|
1349
|
-
params,
|
|
1350
|
-
message,
|
|
1351
|
-
skipAbsent
|
|
1352
|
-
} = config;
|
|
1353
|
-
let {
|
|
1354
|
-
parent,
|
|
1355
|
-
context,
|
|
1356
|
-
abortEarly = schema.spec.abortEarly,
|
|
1357
|
-
disableStackTrace = schema.spec.disableStackTrace
|
|
1358
|
-
} = options;
|
|
1359
|
-
function resolve(item) {
|
|
1360
|
-
return Reference.isRef(item) ? item.getValue(value, parent, context) : item;
|
|
1361
|
-
}
|
|
1362
|
-
function createError(overrides = {}) {
|
|
1363
|
-
const nextParams = Object.assign({
|
|
1364
|
-
value,
|
|
1365
|
-
originalValue,
|
|
1366
|
-
label: schema.spec.label,
|
|
1367
|
-
path: overrides.path || path,
|
|
1368
|
-
spec: schema.spec,
|
|
1369
|
-
disableStackTrace: overrides.disableStackTrace || disableStackTrace
|
|
1370
|
-
}, params, overrides.params);
|
|
1371
|
-
for (const key of Object.keys(nextParams)) nextParams[key] = resolve(nextParams[key]);
|
|
1372
|
-
const error = new ValidationError(ValidationError.formatError(overrides.message || message, nextParams), value, nextParams.path, overrides.type || name, nextParams.disableStackTrace);
|
|
1373
|
-
error.params = nextParams;
|
|
1374
|
-
return error;
|
|
1375
|
-
}
|
|
1376
|
-
const invalid = abortEarly ? panic : next;
|
|
1377
|
-
let ctx = {
|
|
1378
|
-
path,
|
|
1379
|
-
parent,
|
|
1380
|
-
type: name,
|
|
1381
|
-
from: options.from,
|
|
1382
|
-
createError,
|
|
1383
|
-
resolve,
|
|
1384
|
-
options,
|
|
1385
|
-
originalValue,
|
|
1386
|
-
schema
|
|
1387
|
-
};
|
|
1388
|
-
const handleResult = validOrError => {
|
|
1389
|
-
if (ValidationError.isError(validOrError)) invalid(validOrError);else if (!validOrError) invalid(createError());else next(null);
|
|
1390
|
-
};
|
|
1391
|
-
const handleError = err => {
|
|
1392
|
-
if (ValidationError.isError(err)) invalid(err);else panic(err);
|
|
1393
|
-
};
|
|
1394
|
-
const shouldSkip = skipAbsent && isAbsent(value);
|
|
1395
|
-
if (shouldSkip) {
|
|
1396
|
-
return handleResult(true);
|
|
1397
|
-
}
|
|
1398
|
-
let result;
|
|
1399
|
-
try {
|
|
1400
|
-
var _result;
|
|
1401
|
-
result = test.call(ctx, value, ctx);
|
|
1402
|
-
if (typeof ((_result = result) == null ? void 0 : _result.then) === 'function') {
|
|
1403
|
-
if (options.sync) {
|
|
1404
|
-
throw new Error(`Validation test of type: "${ctx.type}" returned a Promise during a synchronous validate. ` + `This test will finish after the validate call has returned`);
|
|
1405
|
-
}
|
|
1406
|
-
return Promise.resolve(result).then(handleResult, handleError);
|
|
1407
|
-
}
|
|
1408
|
-
} catch (err) {
|
|
1409
|
-
handleError(err);
|
|
1410
|
-
return;
|
|
1411
|
-
}
|
|
1412
|
-
handleResult(result);
|
|
1413
|
-
}
|
|
1414
|
-
validate.OPTIONS = config;
|
|
1415
|
-
return validate;
|
|
1416
|
-
}
|
|
1417
|
-
|
|
1418
|
-
function getIn(schema, path, value, context = value) {
|
|
1419
|
-
let parent, lastPart, lastPartDebug;
|
|
1420
|
-
|
|
1421
|
-
// root path: ''
|
|
1422
|
-
if (!path) return {
|
|
1423
|
-
parent,
|
|
1424
|
-
parentPath: path,
|
|
1425
|
-
schema
|
|
1426
|
-
};
|
|
1427
|
-
propertyExpr.forEach(path, (_part, isBracket, isArray) => {
|
|
1428
|
-
let part = isBracket ? _part.slice(1, _part.length - 1) : _part;
|
|
1429
|
-
schema = schema.resolve({
|
|
1430
|
-
context,
|
|
1431
|
-
parent,
|
|
1432
|
-
value
|
|
1433
|
-
});
|
|
1434
|
-
let isTuple = schema.type === 'tuple';
|
|
1435
|
-
let idx = isArray ? parseInt(part, 10) : 0;
|
|
1436
|
-
if (schema.innerType || isTuple) {
|
|
1437
|
-
if (isTuple && !isArray) throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${lastPartDebug}" must contain an index to the tuple element, e.g. "${lastPartDebug}[0]"`);
|
|
1438
|
-
if (value && idx >= value.length) {
|
|
1439
|
-
throw new Error(`Yup.reach cannot resolve an array item at index: ${_part}, in the path: ${path}. ` + `because there is no value at that index. `);
|
|
1440
|
-
}
|
|
1441
|
-
parent = value;
|
|
1442
|
-
value = value && value[idx];
|
|
1443
|
-
schema = isTuple ? schema.spec.types[idx] : schema.innerType;
|
|
1444
|
-
}
|
|
1445
|
-
|
|
1446
|
-
// sometimes the array index part of a path doesn't exist: "nested.arr.child"
|
|
1447
|
-
// in these cases the current part is the next schema and should be processed
|
|
1448
|
-
// in this iteration. For cases where the index signature is included this
|
|
1449
|
-
// check will fail and we'll handle the `child` part on the next iteration like normal
|
|
1450
|
-
if (!isArray) {
|
|
1451
|
-
if (!schema.fields || !schema.fields[part]) throw new Error(`The schema does not contain the path: ${path}. ` + `(failed at: ${lastPartDebug} which is a type: "${schema.type}")`);
|
|
1452
|
-
parent = value;
|
|
1453
|
-
value = value && value[part];
|
|
1454
|
-
schema = schema.fields[part];
|
|
1455
|
-
}
|
|
1456
|
-
lastPart = part;
|
|
1457
|
-
lastPartDebug = isBracket ? '[' + _part + ']' : '.' + _part;
|
|
1458
|
-
});
|
|
1459
|
-
return {
|
|
1460
|
-
schema,
|
|
1461
|
-
parent,
|
|
1462
|
-
parentPath: lastPart
|
|
1463
|
-
};
|
|
1464
|
-
}
|
|
1465
|
-
|
|
1466
|
-
class ReferenceSet extends Set {
|
|
1467
|
-
describe() {
|
|
1468
|
-
const description = [];
|
|
1469
|
-
for (const item of this.values()) {
|
|
1470
|
-
description.push(Reference.isRef(item) ? item.describe() : item);
|
|
1471
|
-
}
|
|
1472
|
-
return description;
|
|
1473
|
-
}
|
|
1474
|
-
resolveAll(resolve) {
|
|
1475
|
-
let result = [];
|
|
1476
|
-
for (const item of this.values()) {
|
|
1477
|
-
result.push(resolve(item));
|
|
1478
|
-
}
|
|
1479
|
-
return result;
|
|
1480
|
-
}
|
|
1481
|
-
clone() {
|
|
1482
|
-
return new ReferenceSet(this.values());
|
|
1483
|
-
}
|
|
1484
|
-
merge(newItems, removeItems) {
|
|
1485
|
-
const next = this.clone();
|
|
1486
|
-
newItems.forEach(value => next.add(value));
|
|
1487
|
-
removeItems.forEach(value => next.delete(value));
|
|
1488
|
-
return next;
|
|
1489
|
-
}
|
|
1490
|
-
}
|
|
1491
|
-
|
|
1492
|
-
// tweaked from https://github.com/Kelin2025/nanoclone/blob/0abeb7635bda9b68ef2277093f76dbe3bf3948e1/src/index.js
|
|
1493
|
-
function clone(src, seen = new Map()) {
|
|
1494
|
-
if (isSchema(src) || !src || typeof src !== 'object') return src;
|
|
1495
|
-
if (seen.has(src)) return seen.get(src);
|
|
1496
|
-
let copy;
|
|
1497
|
-
if (src instanceof Date) {
|
|
1498
|
-
// Date
|
|
1499
|
-
copy = new Date(src.getTime());
|
|
1500
|
-
seen.set(src, copy);
|
|
1501
|
-
} else if (src instanceof RegExp) {
|
|
1502
|
-
// RegExp
|
|
1503
|
-
copy = new RegExp(src);
|
|
1504
|
-
seen.set(src, copy);
|
|
1505
|
-
} else if (Array.isArray(src)) {
|
|
1506
|
-
// Array
|
|
1507
|
-
copy = new Array(src.length);
|
|
1508
|
-
seen.set(src, copy);
|
|
1509
|
-
for (let i = 0; i < src.length; i++) copy[i] = clone(src[i], seen);
|
|
1510
|
-
} else if (src instanceof Map) {
|
|
1511
|
-
// Map
|
|
1512
|
-
copy = new Map();
|
|
1513
|
-
seen.set(src, copy);
|
|
1514
|
-
for (const [k, v] of src.entries()) copy.set(k, clone(v, seen));
|
|
1515
|
-
} else if (src instanceof Set) {
|
|
1516
|
-
// Set
|
|
1517
|
-
copy = new Set();
|
|
1518
|
-
seen.set(src, copy);
|
|
1519
|
-
for (const v of src) copy.add(clone(v, seen));
|
|
1520
|
-
} else if (src instanceof Object) {
|
|
1521
|
-
// Object
|
|
1522
|
-
copy = {};
|
|
1523
|
-
seen.set(src, copy);
|
|
1524
|
-
for (const [k, v] of Object.entries(src)) copy[k] = clone(v, seen);
|
|
1525
|
-
} else {
|
|
1526
|
-
throw Error(`Unable to clone ${src}`);
|
|
1527
|
-
}
|
|
1528
|
-
return copy;
|
|
1529
|
-
}
|
|
1530
|
-
|
|
1531
|
-
// If `CustomSchemaMeta` isn't extended with any keys, we'll fall back to a
|
|
1532
|
-
// loose Record definition allowing free form usage.
|
|
1533
|
-
class Schema {
|
|
1534
|
-
constructor(options) {
|
|
1535
|
-
this.type = void 0;
|
|
1536
|
-
this.deps = [];
|
|
1537
|
-
this.tests = void 0;
|
|
1538
|
-
this.transforms = void 0;
|
|
1539
|
-
this.conditions = [];
|
|
1540
|
-
this._mutate = void 0;
|
|
1541
|
-
this.internalTests = {};
|
|
1542
|
-
this._whitelist = new ReferenceSet();
|
|
1543
|
-
this._blacklist = new ReferenceSet();
|
|
1544
|
-
this.exclusiveTests = Object.create(null);
|
|
1545
|
-
this._typeCheck = void 0;
|
|
1546
|
-
this.spec = void 0;
|
|
1547
|
-
this.tests = [];
|
|
1548
|
-
this.transforms = [];
|
|
1549
|
-
this.withMutation(() => {
|
|
1550
|
-
this.typeError(mixed.notType);
|
|
1551
|
-
});
|
|
1552
|
-
this.type = options.type;
|
|
1553
|
-
this._typeCheck = options.check;
|
|
1554
|
-
this.spec = Object.assign({
|
|
1555
|
-
strip: false,
|
|
1556
|
-
strict: false,
|
|
1557
|
-
abortEarly: true,
|
|
1558
|
-
recursive: true,
|
|
1559
|
-
disableStackTrace: false,
|
|
1560
|
-
nullable: false,
|
|
1561
|
-
optional: true,
|
|
1562
|
-
coerce: true
|
|
1563
|
-
}, options == null ? void 0 : options.spec);
|
|
1564
|
-
this.withMutation(s => {
|
|
1565
|
-
s.nonNullable();
|
|
1566
|
-
});
|
|
1567
|
-
}
|
|
1568
|
-
|
|
1569
|
-
// TODO: remove
|
|
1570
|
-
get _type() {
|
|
1571
|
-
return this.type;
|
|
1572
|
-
}
|
|
1573
|
-
clone(spec) {
|
|
1574
|
-
if (this._mutate) {
|
|
1575
|
-
if (spec) Object.assign(this.spec, spec);
|
|
1576
|
-
return this;
|
|
1577
|
-
}
|
|
1578
|
-
|
|
1579
|
-
// if the nested value is a schema we can skip cloning, since
|
|
1580
|
-
// they are already immutable
|
|
1581
|
-
const next = Object.create(Object.getPrototypeOf(this));
|
|
1582
|
-
|
|
1583
|
-
// @ts-expect-error this is readonly
|
|
1584
|
-
next.type = this.type;
|
|
1585
|
-
next._typeCheck = this._typeCheck;
|
|
1586
|
-
next._whitelist = this._whitelist.clone();
|
|
1587
|
-
next._blacklist = this._blacklist.clone();
|
|
1588
|
-
next.internalTests = Object.assign({}, this.internalTests);
|
|
1589
|
-
next.exclusiveTests = Object.assign({}, this.exclusiveTests);
|
|
1590
|
-
|
|
1591
|
-
// @ts-expect-error this is readonly
|
|
1592
|
-
next.deps = [...this.deps];
|
|
1593
|
-
next.conditions = [...this.conditions];
|
|
1594
|
-
next.tests = [...this.tests];
|
|
1595
|
-
next.transforms = [...this.transforms];
|
|
1596
|
-
next.spec = clone(Object.assign({}, this.spec, spec));
|
|
1597
|
-
return next;
|
|
1598
|
-
}
|
|
1599
|
-
label(label) {
|
|
1600
|
-
let next = this.clone();
|
|
1601
|
-
next.spec.label = label;
|
|
1602
|
-
return next;
|
|
1603
|
-
}
|
|
1604
|
-
meta(...args) {
|
|
1605
|
-
if (args.length === 0) return this.spec.meta;
|
|
1606
|
-
let next = this.clone();
|
|
1607
|
-
next.spec.meta = Object.assign(next.spec.meta || {}, args[0]);
|
|
1608
|
-
return next;
|
|
1609
|
-
}
|
|
1610
|
-
withMutation(fn) {
|
|
1611
|
-
let before = this._mutate;
|
|
1612
|
-
this._mutate = true;
|
|
1613
|
-
let result = fn(this);
|
|
1614
|
-
this._mutate = before;
|
|
1615
|
-
return result;
|
|
1616
|
-
}
|
|
1617
|
-
concat(schema) {
|
|
1618
|
-
if (!schema || schema === this) return this;
|
|
1619
|
-
if (schema.type !== this.type && this.type !== 'mixed') throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${schema.type}`);
|
|
1620
|
-
let base = this;
|
|
1621
|
-
let combined = schema.clone();
|
|
1622
|
-
const mergedSpec = Object.assign({}, base.spec, combined.spec);
|
|
1623
|
-
combined.spec = mergedSpec;
|
|
1624
|
-
combined.internalTests = Object.assign({}, base.internalTests, combined.internalTests);
|
|
1625
|
-
|
|
1626
|
-
// manually merge the blacklist/whitelist (the other `schema` takes
|
|
1627
|
-
// precedence in case of conflicts)
|
|
1628
|
-
combined._whitelist = base._whitelist.merge(schema._whitelist, schema._blacklist);
|
|
1629
|
-
combined._blacklist = base._blacklist.merge(schema._blacklist, schema._whitelist);
|
|
1630
|
-
|
|
1631
|
-
// start with the current tests
|
|
1632
|
-
combined.tests = base.tests;
|
|
1633
|
-
combined.exclusiveTests = base.exclusiveTests;
|
|
1634
|
-
|
|
1635
|
-
// manually add the new tests to ensure
|
|
1636
|
-
// the deduping logic is consistent
|
|
1637
|
-
combined.withMutation(next => {
|
|
1638
|
-
schema.tests.forEach(fn => {
|
|
1639
|
-
next.test(fn.OPTIONS);
|
|
1640
|
-
});
|
|
1641
|
-
});
|
|
1642
|
-
combined.transforms = [...base.transforms, ...combined.transforms];
|
|
1643
|
-
return combined;
|
|
1644
|
-
}
|
|
1645
|
-
isType(v) {
|
|
1646
|
-
if (v == null) {
|
|
1647
|
-
if (this.spec.nullable && v === null) return true;
|
|
1648
|
-
if (this.spec.optional && v === undefined) return true;
|
|
1649
|
-
return false;
|
|
1650
|
-
}
|
|
1651
|
-
return this._typeCheck(v);
|
|
1652
|
-
}
|
|
1653
|
-
resolve(options) {
|
|
1654
|
-
let schema = this;
|
|
1655
|
-
if (schema.conditions.length) {
|
|
1656
|
-
let conditions = schema.conditions;
|
|
1657
|
-
schema = schema.clone();
|
|
1658
|
-
schema.conditions = [];
|
|
1659
|
-
schema = conditions.reduce((prevSchema, condition) => condition.resolve(prevSchema, options), schema);
|
|
1660
|
-
schema = schema.resolve(options);
|
|
1661
|
-
}
|
|
1662
|
-
return schema;
|
|
1663
|
-
}
|
|
1664
|
-
resolveOptions(options) {
|
|
1665
|
-
var _options$strict, _options$abortEarly, _options$recursive, _options$disableStack;
|
|
1666
|
-
return Object.assign({}, options, {
|
|
1667
|
-
from: options.from || [],
|
|
1668
|
-
strict: (_options$strict = options.strict) != null ? _options$strict : this.spec.strict,
|
|
1669
|
-
abortEarly: (_options$abortEarly = options.abortEarly) != null ? _options$abortEarly : this.spec.abortEarly,
|
|
1670
|
-
recursive: (_options$recursive = options.recursive) != null ? _options$recursive : this.spec.recursive,
|
|
1671
|
-
disableStackTrace: (_options$disableStack = options.disableStackTrace) != null ? _options$disableStack : this.spec.disableStackTrace
|
|
1672
|
-
});
|
|
1673
|
-
}
|
|
1674
|
-
|
|
1675
|
-
/**
|
|
1676
|
-
* Run the configured transform pipeline over an input value.
|
|
1677
|
-
*/
|
|
1678
|
-
|
|
1679
|
-
cast(value, options = {}) {
|
|
1680
|
-
let resolvedSchema = this.resolve(Object.assign({
|
|
1681
|
-
value
|
|
1682
|
-
}, options));
|
|
1683
|
-
let allowOptionality = options.assert === 'ignore-optionality';
|
|
1684
|
-
let result = resolvedSchema._cast(value, options);
|
|
1685
|
-
if (options.assert !== false && !resolvedSchema.isType(result)) {
|
|
1686
|
-
if (allowOptionality && isAbsent(result)) {
|
|
1687
|
-
return result;
|
|
1688
|
-
}
|
|
1689
|
-
let formattedValue = printValue(value);
|
|
1690
|
-
let formattedResult = printValue(result);
|
|
1691
|
-
throw new TypeError(`The value of ${options.path || 'field'} could not be cast to a value ` + `that satisfies the schema type: "${resolvedSchema.type}". \n\n` + `attempted value: ${formattedValue} \n` + (formattedResult !== formattedValue ? `result of cast: ${formattedResult}` : ''));
|
|
1692
|
-
}
|
|
1693
|
-
return result;
|
|
1694
|
-
}
|
|
1695
|
-
_cast(rawValue, options) {
|
|
1696
|
-
let value = rawValue === undefined ? rawValue : this.transforms.reduce((prevValue, fn) => fn.call(this, prevValue, rawValue, this), rawValue);
|
|
1697
|
-
if (value === undefined) {
|
|
1698
|
-
value = this.getDefault(options);
|
|
1699
|
-
}
|
|
1700
|
-
return value;
|
|
1701
|
-
}
|
|
1702
|
-
_validate(_value, options = {}, panic, next) {
|
|
1703
|
-
let {
|
|
1704
|
-
path,
|
|
1705
|
-
originalValue = _value,
|
|
1706
|
-
strict = this.spec.strict
|
|
1707
|
-
} = options;
|
|
1708
|
-
let value = _value;
|
|
1709
|
-
if (!strict) {
|
|
1710
|
-
value = this._cast(value, Object.assign({
|
|
1711
|
-
assert: false
|
|
1712
|
-
}, options));
|
|
1713
|
-
}
|
|
1714
|
-
let initialTests = [];
|
|
1715
|
-
for (let test of Object.values(this.internalTests)) {
|
|
1716
|
-
if (test) initialTests.push(test);
|
|
1717
|
-
}
|
|
1718
|
-
this.runTests({
|
|
1719
|
-
path,
|
|
1720
|
-
value,
|
|
1721
|
-
originalValue,
|
|
1722
|
-
options,
|
|
1723
|
-
tests: initialTests
|
|
1724
|
-
}, panic, initialErrors => {
|
|
1725
|
-
// even if we aren't ending early we can't proceed further if the types aren't correct
|
|
1726
|
-
if (initialErrors.length) {
|
|
1727
|
-
return next(initialErrors, value);
|
|
1728
|
-
}
|
|
1729
|
-
this.runTests({
|
|
1730
|
-
path,
|
|
1731
|
-
value,
|
|
1732
|
-
originalValue,
|
|
1733
|
-
options,
|
|
1734
|
-
tests: this.tests
|
|
1735
|
-
}, panic, next);
|
|
1736
|
-
});
|
|
1737
|
-
}
|
|
1738
|
-
|
|
1739
|
-
/**
|
|
1740
|
-
* Executes a set of validations, either schema, produced Tests or a nested
|
|
1741
|
-
* schema validate result.
|
|
1742
|
-
*/
|
|
1743
|
-
runTests(runOptions, panic, next) {
|
|
1744
|
-
let fired = false;
|
|
1745
|
-
let {
|
|
1746
|
-
tests,
|
|
1747
|
-
value,
|
|
1748
|
-
originalValue,
|
|
1749
|
-
path,
|
|
1750
|
-
options
|
|
1751
|
-
} = runOptions;
|
|
1752
|
-
let panicOnce = arg => {
|
|
1753
|
-
if (fired) return;
|
|
1754
|
-
fired = true;
|
|
1755
|
-
panic(arg, value);
|
|
1756
|
-
};
|
|
1757
|
-
let nextOnce = arg => {
|
|
1758
|
-
if (fired) return;
|
|
1759
|
-
fired = true;
|
|
1760
|
-
next(arg, value);
|
|
1761
|
-
};
|
|
1762
|
-
let count = tests.length;
|
|
1763
|
-
let nestedErrors = [];
|
|
1764
|
-
if (!count) return nextOnce([]);
|
|
1765
|
-
let args = {
|
|
1766
|
-
value,
|
|
1767
|
-
originalValue,
|
|
1768
|
-
path,
|
|
1769
|
-
options,
|
|
1770
|
-
schema: this
|
|
1771
|
-
};
|
|
1772
|
-
for (let i = 0; i < tests.length; i++) {
|
|
1773
|
-
const test = tests[i];
|
|
1774
|
-
test(args, panicOnce, function finishTestRun(err) {
|
|
1775
|
-
if (err) {
|
|
1776
|
-
Array.isArray(err) ? nestedErrors.push(...err) : nestedErrors.push(err);
|
|
1777
|
-
}
|
|
1778
|
-
if (--count <= 0) {
|
|
1779
|
-
nextOnce(nestedErrors);
|
|
1780
|
-
}
|
|
1781
|
-
});
|
|
1782
|
-
}
|
|
1783
|
-
}
|
|
1784
|
-
asNestedTest({
|
|
1785
|
-
key,
|
|
1786
|
-
index,
|
|
1787
|
-
parent,
|
|
1788
|
-
parentPath,
|
|
1789
|
-
originalParent,
|
|
1790
|
-
options
|
|
1791
|
-
}) {
|
|
1792
|
-
const k = key != null ? key : index;
|
|
1793
|
-
if (k == null) {
|
|
1794
|
-
throw TypeError('Must include `key` or `index` for nested validations');
|
|
1795
|
-
}
|
|
1796
|
-
const isIndex = typeof k === 'number';
|
|
1797
|
-
let value = parent[k];
|
|
1798
|
-
const testOptions = Object.assign({}, options, {
|
|
1799
|
-
// Nested validations fields are always strict:
|
|
1800
|
-
// 1. parent isn't strict so the casting will also have cast inner values
|
|
1801
|
-
// 2. parent is strict in which case the nested values weren't cast either
|
|
1802
|
-
strict: true,
|
|
1803
|
-
parent,
|
|
1804
|
-
value,
|
|
1805
|
-
originalValue: originalParent[k],
|
|
1806
|
-
// FIXME: tests depend on `index` being passed around deeply,
|
|
1807
|
-
// we should not let the options.key/index bleed through
|
|
1808
|
-
key: undefined,
|
|
1809
|
-
// index: undefined,
|
|
1810
|
-
[isIndex ? 'index' : 'key']: k,
|
|
1811
|
-
path: isIndex || k.includes('.') ? `${parentPath || ''}[${isIndex ? k : `"${k}"`}]` : (parentPath ? `${parentPath}.` : '') + key
|
|
1812
|
-
});
|
|
1813
|
-
return (_, panic, next) => this.resolve(testOptions)._validate(value, testOptions, panic, next);
|
|
1814
|
-
}
|
|
1815
|
-
validate(value, options) {
|
|
1816
|
-
var _options$disableStack2;
|
|
1817
|
-
let schema = this.resolve(Object.assign({}, options, {
|
|
1818
|
-
value
|
|
1819
|
-
}));
|
|
1820
|
-
let disableStackTrace = (_options$disableStack2 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack2 : schema.spec.disableStackTrace;
|
|
1821
|
-
return new Promise((resolve, reject) => schema._validate(value, options, (error, parsed) => {
|
|
1822
|
-
if (ValidationError.isError(error)) error.value = parsed;
|
|
1823
|
-
reject(error);
|
|
1824
|
-
}, (errors, validated) => {
|
|
1825
|
-
if (errors.length) reject(new ValidationError(errors, validated, undefined, undefined, disableStackTrace));else resolve(validated);
|
|
1826
|
-
}));
|
|
1827
|
-
}
|
|
1828
|
-
validateSync(value, options) {
|
|
1829
|
-
var _options$disableStack3;
|
|
1830
|
-
let schema = this.resolve(Object.assign({}, options, {
|
|
1831
|
-
value
|
|
1832
|
-
}));
|
|
1833
|
-
let result;
|
|
1834
|
-
let disableStackTrace = (_options$disableStack3 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack3 : schema.spec.disableStackTrace;
|
|
1835
|
-
schema._validate(value, Object.assign({}, options, {
|
|
1836
|
-
sync: true
|
|
1837
|
-
}), (error, parsed) => {
|
|
1838
|
-
if (ValidationError.isError(error)) error.value = parsed;
|
|
1839
|
-
throw error;
|
|
1840
|
-
}, (errors, validated) => {
|
|
1841
|
-
if (errors.length) throw new ValidationError(errors, value, undefined, undefined, disableStackTrace);
|
|
1842
|
-
result = validated;
|
|
1843
|
-
});
|
|
1844
|
-
return result;
|
|
1845
|
-
}
|
|
1846
|
-
isValid(value, options) {
|
|
1847
|
-
return this.validate(value, options).then(() => true, err => {
|
|
1848
|
-
if (ValidationError.isError(err)) return false;
|
|
1849
|
-
throw err;
|
|
1850
|
-
});
|
|
1851
|
-
}
|
|
1852
|
-
isValidSync(value, options) {
|
|
1853
|
-
try {
|
|
1854
|
-
this.validateSync(value, options);
|
|
1855
|
-
return true;
|
|
1856
|
-
} catch (err) {
|
|
1857
|
-
if (ValidationError.isError(err)) return false;
|
|
1858
|
-
throw err;
|
|
1859
|
-
}
|
|
1860
|
-
}
|
|
1861
|
-
_getDefault(options) {
|
|
1862
|
-
let defaultValue = this.spec.default;
|
|
1863
|
-
if (defaultValue == null) {
|
|
1864
|
-
return defaultValue;
|
|
1865
|
-
}
|
|
1866
|
-
return typeof defaultValue === 'function' ? defaultValue.call(this, options) : clone(defaultValue);
|
|
1867
|
-
}
|
|
1868
|
-
getDefault(options
|
|
1869
|
-
// If schema is defaulted we know it's at least not undefined
|
|
1870
|
-
) {
|
|
1871
|
-
let schema = this.resolve(options || {});
|
|
1872
|
-
return schema._getDefault(options);
|
|
1873
|
-
}
|
|
1874
|
-
default(def) {
|
|
1875
|
-
if (arguments.length === 0) {
|
|
1876
|
-
return this._getDefault();
|
|
1877
|
-
}
|
|
1878
|
-
let next = this.clone({
|
|
1879
|
-
default: def
|
|
1880
|
-
});
|
|
1881
|
-
return next;
|
|
1882
|
-
}
|
|
1883
|
-
strict(isStrict = true) {
|
|
1884
|
-
return this.clone({
|
|
1885
|
-
strict: isStrict
|
|
1886
|
-
});
|
|
1887
|
-
}
|
|
1888
|
-
nullability(nullable, message) {
|
|
1889
|
-
const next = this.clone({
|
|
1890
|
-
nullable
|
|
1891
|
-
});
|
|
1892
|
-
next.internalTests.nullable = createValidation({
|
|
1893
|
-
message,
|
|
1894
|
-
name: 'nullable',
|
|
1895
|
-
test(value) {
|
|
1896
|
-
return value === null ? this.schema.spec.nullable : true;
|
|
1897
|
-
}
|
|
1898
|
-
});
|
|
1899
|
-
return next;
|
|
1900
|
-
}
|
|
1901
|
-
optionality(optional, message) {
|
|
1902
|
-
const next = this.clone({
|
|
1903
|
-
optional
|
|
1904
|
-
});
|
|
1905
|
-
next.internalTests.optionality = createValidation({
|
|
1906
|
-
message,
|
|
1907
|
-
name: 'optionality',
|
|
1908
|
-
test(value) {
|
|
1909
|
-
return value === undefined ? this.schema.spec.optional : true;
|
|
1910
|
-
}
|
|
1911
|
-
});
|
|
1912
|
-
return next;
|
|
1913
|
-
}
|
|
1914
|
-
optional() {
|
|
1915
|
-
return this.optionality(true);
|
|
1916
|
-
}
|
|
1917
|
-
defined(message = mixed.defined) {
|
|
1918
|
-
return this.optionality(false, message);
|
|
1919
|
-
}
|
|
1920
|
-
nullable() {
|
|
1921
|
-
return this.nullability(true);
|
|
1922
|
-
}
|
|
1923
|
-
nonNullable(message = mixed.notNull) {
|
|
1924
|
-
return this.nullability(false, message);
|
|
1925
|
-
}
|
|
1926
|
-
required(message = mixed.required) {
|
|
1927
|
-
return this.clone().withMutation(next => next.nonNullable(message).defined(message));
|
|
1928
|
-
}
|
|
1929
|
-
notRequired() {
|
|
1930
|
-
return this.clone().withMutation(next => next.nullable().optional());
|
|
1931
|
-
}
|
|
1932
|
-
transform(fn) {
|
|
1933
|
-
let next = this.clone();
|
|
1934
|
-
next.transforms.push(fn);
|
|
1935
|
-
return next;
|
|
1936
|
-
}
|
|
1937
|
-
|
|
1938
|
-
/**
|
|
1939
|
-
* Adds a test function to the schema's queue of tests.
|
|
1940
|
-
* tests can be exclusive or non-exclusive.
|
|
1941
|
-
*
|
|
1942
|
-
* - exclusive tests, will replace any existing tests of the same name.
|
|
1943
|
-
* - non-exclusive: can be stacked
|
|
1944
|
-
*
|
|
1945
|
-
* If a non-exclusive test is added to a schema with an exclusive test of the same name
|
|
1946
|
-
* the exclusive test is removed and further tests of the same name will be stacked.
|
|
1947
|
-
*
|
|
1948
|
-
* If an exclusive test is added to a schema with non-exclusive tests of the same name
|
|
1949
|
-
* the previous tests are removed and further tests of the same name will replace each other.
|
|
1950
|
-
*/
|
|
1951
|
-
|
|
1952
|
-
test(...args) {
|
|
1953
|
-
let opts;
|
|
1954
|
-
if (args.length === 1) {
|
|
1955
|
-
if (typeof args[0] === 'function') {
|
|
1956
|
-
opts = {
|
|
1957
|
-
test: args[0]
|
|
1958
|
-
};
|
|
1959
|
-
} else {
|
|
1960
|
-
opts = args[0];
|
|
1961
|
-
}
|
|
1962
|
-
} else if (args.length === 2) {
|
|
1963
|
-
opts = {
|
|
1964
|
-
name: args[0],
|
|
1965
|
-
test: args[1]
|
|
1966
|
-
};
|
|
1967
|
-
} else {
|
|
1968
|
-
opts = {
|
|
1969
|
-
name: args[0],
|
|
1970
|
-
message: args[1],
|
|
1971
|
-
test: args[2]
|
|
1972
|
-
};
|
|
1973
|
-
}
|
|
1974
|
-
if (opts.message === undefined) opts.message = mixed.default;
|
|
1975
|
-
if (typeof opts.test !== 'function') throw new TypeError('`test` is a required parameters');
|
|
1976
|
-
let next = this.clone();
|
|
1977
|
-
let validate = createValidation(opts);
|
|
1978
|
-
let isExclusive = opts.exclusive || opts.name && next.exclusiveTests[opts.name] === true;
|
|
1979
|
-
if (opts.exclusive) {
|
|
1980
|
-
if (!opts.name) throw new TypeError('Exclusive tests must provide a unique `name` identifying the test');
|
|
1981
|
-
}
|
|
1982
|
-
if (opts.name) next.exclusiveTests[opts.name] = !!opts.exclusive;
|
|
1983
|
-
next.tests = next.tests.filter(fn => {
|
|
1984
|
-
if (fn.OPTIONS.name === opts.name) {
|
|
1985
|
-
if (isExclusive) return false;
|
|
1986
|
-
if (fn.OPTIONS.test === validate.OPTIONS.test) return false;
|
|
1987
|
-
}
|
|
1988
|
-
return true;
|
|
1989
|
-
});
|
|
1990
|
-
next.tests.push(validate);
|
|
1991
|
-
return next;
|
|
1992
|
-
}
|
|
1993
|
-
when(keys, options) {
|
|
1994
|
-
if (!Array.isArray(keys) && typeof keys !== 'string') {
|
|
1995
|
-
options = keys;
|
|
1996
|
-
keys = '.';
|
|
1997
|
-
}
|
|
1998
|
-
let next = this.clone();
|
|
1999
|
-
let deps = toArray(keys).map(key => new Reference(key));
|
|
2000
|
-
deps.forEach(dep => {
|
|
2001
|
-
// @ts-ignore readonly array
|
|
2002
|
-
if (dep.isSibling) next.deps.push(dep.key);
|
|
2003
|
-
});
|
|
2004
|
-
next.conditions.push(typeof options === 'function' ? new Condition(deps, options) : Condition.fromOptions(deps, options));
|
|
2005
|
-
return next;
|
|
2006
|
-
}
|
|
2007
|
-
typeError(message) {
|
|
2008
|
-
let next = this.clone();
|
|
2009
|
-
next.internalTests.typeError = createValidation({
|
|
2010
|
-
message,
|
|
2011
|
-
name: 'typeError',
|
|
2012
|
-
skipAbsent: true,
|
|
2013
|
-
test(value) {
|
|
2014
|
-
if (!this.schema._typeCheck(value)) return this.createError({
|
|
2015
|
-
params: {
|
|
2016
|
-
type: this.schema.type
|
|
2017
|
-
}
|
|
2018
|
-
});
|
|
2019
|
-
return true;
|
|
2020
|
-
}
|
|
2021
|
-
});
|
|
2022
|
-
return next;
|
|
2023
|
-
}
|
|
2024
|
-
oneOf(enums, message = mixed.oneOf) {
|
|
2025
|
-
let next = this.clone();
|
|
2026
|
-
enums.forEach(val => {
|
|
2027
|
-
next._whitelist.add(val);
|
|
2028
|
-
next._blacklist.delete(val);
|
|
2029
|
-
});
|
|
2030
|
-
next.internalTests.whiteList = createValidation({
|
|
2031
|
-
message,
|
|
2032
|
-
name: 'oneOf',
|
|
2033
|
-
skipAbsent: true,
|
|
2034
|
-
test(value) {
|
|
2035
|
-
let valids = this.schema._whitelist;
|
|
2036
|
-
let resolved = valids.resolveAll(this.resolve);
|
|
2037
|
-
return resolved.includes(value) ? true : this.createError({
|
|
2038
|
-
params: {
|
|
2039
|
-
values: Array.from(valids).join(', '),
|
|
2040
|
-
resolved
|
|
2041
|
-
}
|
|
2042
|
-
});
|
|
2043
|
-
}
|
|
2044
|
-
});
|
|
2045
|
-
return next;
|
|
2046
|
-
}
|
|
2047
|
-
notOneOf(enums, message = mixed.notOneOf) {
|
|
2048
|
-
let next = this.clone();
|
|
2049
|
-
enums.forEach(val => {
|
|
2050
|
-
next._blacklist.add(val);
|
|
2051
|
-
next._whitelist.delete(val);
|
|
2052
|
-
});
|
|
2053
|
-
next.internalTests.blacklist = createValidation({
|
|
2054
|
-
message,
|
|
2055
|
-
name: 'notOneOf',
|
|
2056
|
-
test(value) {
|
|
2057
|
-
let invalids = this.schema._blacklist;
|
|
2058
|
-
let resolved = invalids.resolveAll(this.resolve);
|
|
2059
|
-
if (resolved.includes(value)) return this.createError({
|
|
2060
|
-
params: {
|
|
2061
|
-
values: Array.from(invalids).join(', '),
|
|
2062
|
-
resolved
|
|
2063
|
-
}
|
|
2064
|
-
});
|
|
2065
|
-
return true;
|
|
2066
|
-
}
|
|
2067
|
-
});
|
|
2068
|
-
return next;
|
|
2069
|
-
}
|
|
2070
|
-
strip(strip = true) {
|
|
2071
|
-
let next = this.clone();
|
|
2072
|
-
next.spec.strip = strip;
|
|
2073
|
-
return next;
|
|
2074
|
-
}
|
|
2075
|
-
|
|
2076
|
-
/**
|
|
2077
|
-
* Return a serialized description of the schema including validations, flags, types etc.
|
|
2078
|
-
*
|
|
2079
|
-
* @param options Provide any needed context for resolving runtime schema alterations (lazy, when conditions, etc).
|
|
2080
|
-
*/
|
|
2081
|
-
describe(options) {
|
|
2082
|
-
const next = (options ? this.resolve(options) : this).clone();
|
|
2083
|
-
const {
|
|
2084
|
-
label,
|
|
2085
|
-
meta,
|
|
2086
|
-
optional,
|
|
2087
|
-
nullable
|
|
2088
|
-
} = next.spec;
|
|
2089
|
-
const description = {
|
|
2090
|
-
meta,
|
|
2091
|
-
label,
|
|
2092
|
-
optional,
|
|
2093
|
-
nullable,
|
|
2094
|
-
default: next.getDefault(options),
|
|
2095
|
-
type: next.type,
|
|
2096
|
-
oneOf: next._whitelist.describe(),
|
|
2097
|
-
notOneOf: next._blacklist.describe(),
|
|
2098
|
-
tests: next.tests.map(fn => ({
|
|
2099
|
-
name: fn.OPTIONS.name,
|
|
2100
|
-
params: fn.OPTIONS.params
|
|
2101
|
-
})).filter((n, idx, list) => list.findIndex(c => c.name === n.name) === idx)
|
|
2102
|
-
};
|
|
2103
|
-
return description;
|
|
2104
|
-
}
|
|
2105
|
-
}
|
|
2106
|
-
// @ts-expect-error
|
|
2107
|
-
Schema.prototype.__isYupSchema__ = true;
|
|
2108
|
-
for (const method of ['validate', 'validateSync']) Schema.prototype[`${method}At`] = function (path, value, options = {}) {
|
|
2109
|
-
const {
|
|
2110
|
-
parent,
|
|
2111
|
-
parentPath,
|
|
2112
|
-
schema
|
|
2113
|
-
} = getIn(this, path, value, options.context);
|
|
2114
|
-
return schema[method](parent && parent[parentPath], Object.assign({}, options, {
|
|
2115
|
-
parent,
|
|
2116
|
-
path
|
|
2117
|
-
}));
|
|
2118
|
-
};
|
|
2119
|
-
for (const alias of ['equals', 'is']) Schema.prototype[alias] = Schema.prototype.oneOf;
|
|
2120
|
-
for (const alias of ['not', 'nope']) Schema.prototype[alias] = Schema.prototype.notOneOf;
|
|
2121
|
-
|
|
2122
|
-
const returnsTrue = () => true;
|
|
2123
|
-
function create$8(spec) {
|
|
2124
|
-
return new MixedSchema(spec);
|
|
2125
|
-
}
|
|
2126
|
-
class MixedSchema extends Schema {
|
|
2127
|
-
constructor(spec) {
|
|
2128
|
-
super(typeof spec === 'function' ? {
|
|
2129
|
-
type: 'mixed',
|
|
2130
|
-
check: spec
|
|
2131
|
-
} : Object.assign({
|
|
2132
|
-
type: 'mixed',
|
|
2133
|
-
check: returnsTrue
|
|
2134
|
-
}, spec));
|
|
2135
|
-
}
|
|
2136
|
-
}
|
|
2137
|
-
create$8.prototype = MixedSchema.prototype;
|
|
2138
|
-
|
|
2139
|
-
function create$7() {
|
|
2140
|
-
return new BooleanSchema();
|
|
2141
|
-
}
|
|
2142
|
-
class BooleanSchema extends Schema {
|
|
2143
|
-
constructor() {
|
|
2144
|
-
super({
|
|
2145
|
-
type: 'boolean',
|
|
2146
|
-
check(v) {
|
|
2147
|
-
if (v instanceof Boolean) v = v.valueOf();
|
|
2148
|
-
return typeof v === 'boolean';
|
|
2149
|
-
}
|
|
2150
|
-
});
|
|
2151
|
-
this.withMutation(() => {
|
|
2152
|
-
this.transform((value, _raw, ctx) => {
|
|
2153
|
-
if (ctx.spec.coerce && !ctx.isType(value)) {
|
|
2154
|
-
if (/^(true|1)$/i.test(String(value))) return true;
|
|
2155
|
-
if (/^(false|0)$/i.test(String(value))) return false;
|
|
2156
|
-
}
|
|
2157
|
-
return value;
|
|
2158
|
-
});
|
|
2159
|
-
});
|
|
2160
|
-
}
|
|
2161
|
-
isTrue(message = boolean.isValue) {
|
|
2162
|
-
return this.test({
|
|
2163
|
-
message,
|
|
2164
|
-
name: 'is-value',
|
|
2165
|
-
exclusive: true,
|
|
2166
|
-
params: {
|
|
2167
|
-
value: 'true'
|
|
2168
|
-
},
|
|
2169
|
-
test(value) {
|
|
2170
|
-
return isAbsent(value) || value === true;
|
|
2171
|
-
}
|
|
2172
|
-
});
|
|
2173
|
-
}
|
|
2174
|
-
isFalse(message = boolean.isValue) {
|
|
2175
|
-
return this.test({
|
|
2176
|
-
message,
|
|
2177
|
-
name: 'is-value',
|
|
2178
|
-
exclusive: true,
|
|
2179
|
-
params: {
|
|
2180
|
-
value: 'false'
|
|
2181
|
-
},
|
|
2182
|
-
test(value) {
|
|
2183
|
-
return isAbsent(value) || value === false;
|
|
2184
|
-
}
|
|
2185
|
-
});
|
|
2186
|
-
}
|
|
2187
|
-
default(def) {
|
|
2188
|
-
return super.default(def);
|
|
2189
|
-
}
|
|
2190
|
-
defined(msg) {
|
|
2191
|
-
return super.defined(msg);
|
|
2192
|
-
}
|
|
2193
|
-
optional() {
|
|
2194
|
-
return super.optional();
|
|
2195
|
-
}
|
|
2196
|
-
required(msg) {
|
|
2197
|
-
return super.required(msg);
|
|
2198
|
-
}
|
|
2199
|
-
notRequired() {
|
|
2200
|
-
return super.notRequired();
|
|
2201
|
-
}
|
|
2202
|
-
nullable() {
|
|
2203
|
-
return super.nullable();
|
|
2204
|
-
}
|
|
2205
|
-
nonNullable(msg) {
|
|
2206
|
-
return super.nonNullable(msg);
|
|
2207
|
-
}
|
|
2208
|
-
strip(v) {
|
|
2209
|
-
return super.strip(v);
|
|
2210
|
-
}
|
|
2211
|
-
}
|
|
2212
|
-
create$7.prototype = BooleanSchema.prototype;
|
|
2213
|
-
|
|
2214
|
-
/**
|
|
2215
|
-
* This file is a modified version of the file from the following repository:
|
|
2216
|
-
* Date.parse with progressive enhancement for ISO 8601 <https://github.com/csnover/js-iso8601>
|
|
2217
|
-
* NON-CONFORMANT EDITION.
|
|
2218
|
-
* © 2011 Colin Snover <http://zetafleet.com>
|
|
2219
|
-
* Released under MIT license.
|
|
2220
|
-
*/
|
|
2221
|
-
|
|
2222
|
-
// prettier-ignore
|
|
2223
|
-
// 1 YYYY 2 MM 3 DD 4 HH 5 mm 6 ss 7 msec 8 Z 9 ± 10 tzHH 11 tzmm
|
|
2224
|
-
const isoReg = /^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;
|
|
2225
|
-
function parseIsoDate(date) {
|
|
2226
|
-
const struct = parseDateStruct(date);
|
|
2227
|
-
if (!struct) return Date.parse ? Date.parse(date) : Number.NaN;
|
|
2228
|
-
|
|
2229
|
-
// timestamps without timezone identifiers should be considered local time
|
|
2230
|
-
if (struct.z === undefined && struct.plusMinus === undefined) {
|
|
2231
|
-
return new Date(struct.year, struct.month, struct.day, struct.hour, struct.minute, struct.second, struct.millisecond).valueOf();
|
|
2232
|
-
}
|
|
2233
|
-
let totalMinutesOffset = 0;
|
|
2234
|
-
if (struct.z !== 'Z' && struct.plusMinus !== undefined) {
|
|
2235
|
-
totalMinutesOffset = struct.hourOffset * 60 + struct.minuteOffset;
|
|
2236
|
-
if (struct.plusMinus === '+') totalMinutesOffset = 0 - totalMinutesOffset;
|
|
2237
|
-
}
|
|
2238
|
-
return Date.UTC(struct.year, struct.month, struct.day, struct.hour, struct.minute + totalMinutesOffset, struct.second, struct.millisecond);
|
|
2239
|
-
}
|
|
2240
|
-
function parseDateStruct(date) {
|
|
2241
|
-
var _regexResult$7$length, _regexResult$;
|
|
2242
|
-
const regexResult = isoReg.exec(date);
|
|
2243
|
-
if (!regexResult) return null;
|
|
2244
|
-
|
|
2245
|
-
// use of toNumber() avoids NaN timestamps caused by “undefined”
|
|
2246
|
-
// values being passed to Date constructor
|
|
2247
|
-
return {
|
|
2248
|
-
year: toNumber(regexResult[1]),
|
|
2249
|
-
month: toNumber(regexResult[2], 1) - 1,
|
|
2250
|
-
day: toNumber(regexResult[3], 1),
|
|
2251
|
-
hour: toNumber(regexResult[4]),
|
|
2252
|
-
minute: toNumber(regexResult[5]),
|
|
2253
|
-
second: toNumber(regexResult[6]),
|
|
2254
|
-
millisecond: regexResult[7] ?
|
|
2255
|
-
// allow arbitrary sub-second precision beyond milliseconds
|
|
2256
|
-
toNumber(regexResult[7].substring(0, 3)) : 0,
|
|
2257
|
-
precision: (_regexResult$7$length = (_regexResult$ = regexResult[7]) == null ? void 0 : _regexResult$.length) != null ? _regexResult$7$length : undefined,
|
|
2258
|
-
z: regexResult[8] || undefined,
|
|
2259
|
-
plusMinus: regexResult[9] || undefined,
|
|
2260
|
-
hourOffset: toNumber(regexResult[10]),
|
|
2261
|
-
minuteOffset: toNumber(regexResult[11])
|
|
2262
|
-
};
|
|
2263
|
-
}
|
|
2264
|
-
function toNumber(str, defaultValue = 0) {
|
|
2265
|
-
return Number(str) || defaultValue;
|
|
2266
|
-
}
|
|
2267
|
-
|
|
2268
|
-
// Taken from HTML spec: https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address
|
|
2269
|
-
let rEmail =
|
|
2270
|
-
// eslint-disable-next-line
|
|
2271
|
-
/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
|
|
2272
|
-
let rUrl =
|
|
2273
|
-
// eslint-disable-next-line
|
|
2274
|
-
/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i;
|
|
2275
|
-
|
|
2276
|
-
// eslint-disable-next-line
|
|
2277
|
-
let rUUID = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
2278
|
-
let yearMonthDay = '^\\d{4}-\\d{2}-\\d{2}';
|
|
2279
|
-
let hourMinuteSecond = '\\d{2}:\\d{2}:\\d{2}';
|
|
2280
|
-
let zOrOffset = '(([+-]\\d{2}(:?\\d{2})?)|Z)';
|
|
2281
|
-
let rIsoDateTime = new RegExp(`${yearMonthDay}T${hourMinuteSecond}(\\.\\d+)?${zOrOffset}$`);
|
|
2282
|
-
let isTrimmed = value => isAbsent(value) || value === value.trim();
|
|
2283
|
-
let objStringTag = {}.toString();
|
|
2284
|
-
function create$6() {
|
|
2285
|
-
return new StringSchema();
|
|
2286
|
-
}
|
|
2287
|
-
class StringSchema extends Schema {
|
|
2288
|
-
constructor() {
|
|
2289
|
-
super({
|
|
2290
|
-
type: 'string',
|
|
2291
|
-
check(value) {
|
|
2292
|
-
if (value instanceof String) value = value.valueOf();
|
|
2293
|
-
return typeof value === 'string';
|
|
2294
|
-
}
|
|
2295
|
-
});
|
|
2296
|
-
this.withMutation(() => {
|
|
2297
|
-
this.transform((value, _raw, ctx) => {
|
|
2298
|
-
if (!ctx.spec.coerce || ctx.isType(value)) return value;
|
|
2299
|
-
|
|
2300
|
-
// don't ever convert arrays
|
|
2301
|
-
if (Array.isArray(value)) return value;
|
|
2302
|
-
const strValue = value != null && value.toString ? value.toString() : value;
|
|
2303
|
-
|
|
2304
|
-
// no one wants plain objects converted to [Object object]
|
|
2305
|
-
if (strValue === objStringTag) return value;
|
|
2306
|
-
return strValue;
|
|
2307
|
-
});
|
|
2308
|
-
});
|
|
2309
|
-
}
|
|
2310
|
-
required(message) {
|
|
2311
|
-
return super.required(message).withMutation(schema => schema.test({
|
|
2312
|
-
message: message || mixed.required,
|
|
2313
|
-
name: 'required',
|
|
2314
|
-
skipAbsent: true,
|
|
2315
|
-
test: value => !!value.length
|
|
2316
|
-
}));
|
|
2317
|
-
}
|
|
2318
|
-
notRequired() {
|
|
2319
|
-
return super.notRequired().withMutation(schema => {
|
|
2320
|
-
schema.tests = schema.tests.filter(t => t.OPTIONS.name !== 'required');
|
|
2321
|
-
return schema;
|
|
2322
|
-
});
|
|
2323
|
-
}
|
|
2324
|
-
length(length, message = string.length) {
|
|
2325
|
-
return this.test({
|
|
2326
|
-
message,
|
|
2327
|
-
name: 'length',
|
|
2328
|
-
exclusive: true,
|
|
2329
|
-
params: {
|
|
2330
|
-
length
|
|
2331
|
-
},
|
|
2332
|
-
skipAbsent: true,
|
|
2333
|
-
test(value) {
|
|
2334
|
-
return value.length === this.resolve(length);
|
|
2335
|
-
}
|
|
2336
|
-
});
|
|
2337
|
-
}
|
|
2338
|
-
min(min, message = string.min) {
|
|
2339
|
-
return this.test({
|
|
2340
|
-
message,
|
|
2341
|
-
name: 'min',
|
|
2342
|
-
exclusive: true,
|
|
2343
|
-
params: {
|
|
2344
|
-
min
|
|
2345
|
-
},
|
|
2346
|
-
skipAbsent: true,
|
|
2347
|
-
test(value) {
|
|
2348
|
-
return value.length >= this.resolve(min);
|
|
2349
|
-
}
|
|
2350
|
-
});
|
|
2351
|
-
}
|
|
2352
|
-
max(max, message = string.max) {
|
|
2353
|
-
return this.test({
|
|
2354
|
-
name: 'max',
|
|
2355
|
-
exclusive: true,
|
|
2356
|
-
message,
|
|
2357
|
-
params: {
|
|
2358
|
-
max
|
|
2359
|
-
},
|
|
2360
|
-
skipAbsent: true,
|
|
2361
|
-
test(value) {
|
|
2362
|
-
return value.length <= this.resolve(max);
|
|
2363
|
-
}
|
|
2364
|
-
});
|
|
2365
|
-
}
|
|
2366
|
-
matches(regex, options) {
|
|
2367
|
-
let excludeEmptyString = false;
|
|
2368
|
-
let message;
|
|
2369
|
-
let name;
|
|
2370
|
-
if (options) {
|
|
2371
|
-
if (typeof options === 'object') {
|
|
2372
|
-
({
|
|
2373
|
-
excludeEmptyString = false,
|
|
2374
|
-
message,
|
|
2375
|
-
name
|
|
2376
|
-
} = options);
|
|
2377
|
-
} else {
|
|
2378
|
-
message = options;
|
|
2379
|
-
}
|
|
2380
|
-
}
|
|
2381
|
-
return this.test({
|
|
2382
|
-
name: name || 'matches',
|
|
2383
|
-
message: message || string.matches,
|
|
2384
|
-
params: {
|
|
2385
|
-
regex
|
|
2386
|
-
},
|
|
2387
|
-
skipAbsent: true,
|
|
2388
|
-
test: value => value === '' && excludeEmptyString || value.search(regex) !== -1
|
|
2389
|
-
});
|
|
2390
|
-
}
|
|
2391
|
-
email(message = string.email) {
|
|
2392
|
-
return this.matches(rEmail, {
|
|
2393
|
-
name: 'email',
|
|
2394
|
-
message,
|
|
2395
|
-
excludeEmptyString: true
|
|
2396
|
-
});
|
|
2397
|
-
}
|
|
2398
|
-
url(message = string.url) {
|
|
2399
|
-
return this.matches(rUrl, {
|
|
2400
|
-
name: 'url',
|
|
2401
|
-
message,
|
|
2402
|
-
excludeEmptyString: true
|
|
2403
|
-
});
|
|
2404
|
-
}
|
|
2405
|
-
uuid(message = string.uuid) {
|
|
2406
|
-
return this.matches(rUUID, {
|
|
2407
|
-
name: 'uuid',
|
|
2408
|
-
message,
|
|
2409
|
-
excludeEmptyString: false
|
|
2410
|
-
});
|
|
2411
|
-
}
|
|
2412
|
-
datetime(options) {
|
|
2413
|
-
let message = '';
|
|
2414
|
-
let allowOffset;
|
|
2415
|
-
let precision;
|
|
2416
|
-
if (options) {
|
|
2417
|
-
if (typeof options === 'object') {
|
|
2418
|
-
({
|
|
2419
|
-
message = '',
|
|
2420
|
-
allowOffset = false,
|
|
2421
|
-
precision = undefined
|
|
2422
|
-
} = options);
|
|
2423
|
-
} else {
|
|
2424
|
-
message = options;
|
|
2425
|
-
}
|
|
2426
|
-
}
|
|
2427
|
-
return this.matches(rIsoDateTime, {
|
|
2428
|
-
name: 'datetime',
|
|
2429
|
-
message: message || string.datetime,
|
|
2430
|
-
excludeEmptyString: true
|
|
2431
|
-
}).test({
|
|
2432
|
-
name: 'datetime_offset',
|
|
2433
|
-
message: message || string.datetime_offset,
|
|
2434
|
-
params: {
|
|
2435
|
-
allowOffset
|
|
2436
|
-
},
|
|
2437
|
-
skipAbsent: true,
|
|
2438
|
-
test: value => {
|
|
2439
|
-
if (!value || allowOffset) return true;
|
|
2440
|
-
const struct = parseDateStruct(value);
|
|
2441
|
-
if (!struct) return false;
|
|
2442
|
-
return !!struct.z;
|
|
2443
|
-
}
|
|
2444
|
-
}).test({
|
|
2445
|
-
name: 'datetime_precision',
|
|
2446
|
-
message: message || string.datetime_precision,
|
|
2447
|
-
params: {
|
|
2448
|
-
precision
|
|
2449
|
-
},
|
|
2450
|
-
skipAbsent: true,
|
|
2451
|
-
test: value => {
|
|
2452
|
-
if (!value || precision == undefined) return true;
|
|
2453
|
-
const struct = parseDateStruct(value);
|
|
2454
|
-
if (!struct) return false;
|
|
2455
|
-
return struct.precision === precision;
|
|
2456
|
-
}
|
|
2457
|
-
});
|
|
2458
|
-
}
|
|
2459
|
-
|
|
2460
|
-
//-- transforms --
|
|
2461
|
-
ensure() {
|
|
2462
|
-
return this.default('').transform(val => val === null ? '' : val);
|
|
2463
|
-
}
|
|
2464
|
-
trim(message = string.trim) {
|
|
2465
|
-
return this.transform(val => val != null ? val.trim() : val).test({
|
|
2466
|
-
message,
|
|
2467
|
-
name: 'trim',
|
|
2468
|
-
test: isTrimmed
|
|
2469
|
-
});
|
|
2470
|
-
}
|
|
2471
|
-
lowercase(message = string.lowercase) {
|
|
2472
|
-
return this.transform(value => !isAbsent(value) ? value.toLowerCase() : value).test({
|
|
2473
|
-
message,
|
|
2474
|
-
name: 'string_case',
|
|
2475
|
-
exclusive: true,
|
|
2476
|
-
skipAbsent: true,
|
|
2477
|
-
test: value => isAbsent(value) || value === value.toLowerCase()
|
|
2478
|
-
});
|
|
2479
|
-
}
|
|
2480
|
-
uppercase(message = string.uppercase) {
|
|
2481
|
-
return this.transform(value => !isAbsent(value) ? value.toUpperCase() : value).test({
|
|
2482
|
-
message,
|
|
2483
|
-
name: 'string_case',
|
|
2484
|
-
exclusive: true,
|
|
2485
|
-
skipAbsent: true,
|
|
2486
|
-
test: value => isAbsent(value) || value === value.toUpperCase()
|
|
2487
|
-
});
|
|
2488
|
-
}
|
|
2489
|
-
}
|
|
2490
|
-
create$6.prototype = StringSchema.prototype;
|
|
2491
|
-
|
|
2492
|
-
//
|
|
2493
|
-
// Number Interfaces
|
|
2494
|
-
//
|
|
2495
|
-
|
|
2496
|
-
let invalidDate = new Date('');
|
|
2497
|
-
let isDate = obj => Object.prototype.toString.call(obj) === '[object Date]';
|
|
2498
|
-
class DateSchema extends Schema {
|
|
2499
|
-
constructor() {
|
|
2500
|
-
super({
|
|
2501
|
-
type: 'date',
|
|
2502
|
-
check(v) {
|
|
2503
|
-
return isDate(v) && !isNaN(v.getTime());
|
|
2504
|
-
}
|
|
2505
|
-
});
|
|
2506
|
-
this.withMutation(() => {
|
|
2507
|
-
this.transform((value, _raw, ctx) => {
|
|
2508
|
-
// null -> InvalidDate isn't useful; treat all nulls as null and let it fail on
|
|
2509
|
-
// nullability check vs TypeErrors
|
|
2510
|
-
if (!ctx.spec.coerce || ctx.isType(value) || value === null) return value;
|
|
2511
|
-
value = parseIsoDate(value);
|
|
2512
|
-
|
|
2513
|
-
// 0 is a valid timestamp equivalent to 1970-01-01T00:00:00Z(unix epoch) or before.
|
|
2514
|
-
return !isNaN(value) ? new Date(value) : DateSchema.INVALID_DATE;
|
|
2515
|
-
});
|
|
2516
|
-
});
|
|
2517
|
-
}
|
|
2518
|
-
prepareParam(ref, name) {
|
|
2519
|
-
let param;
|
|
2520
|
-
if (!Reference.isRef(ref)) {
|
|
2521
|
-
let cast = this.cast(ref);
|
|
2522
|
-
if (!this._typeCheck(cast)) throw new TypeError(`\`${name}\` must be a Date or a value that can be \`cast()\` to a Date`);
|
|
2523
|
-
param = cast;
|
|
2524
|
-
} else {
|
|
2525
|
-
param = ref;
|
|
2526
|
-
}
|
|
2527
|
-
return param;
|
|
2528
|
-
}
|
|
2529
|
-
min(min, message = date.min) {
|
|
2530
|
-
let limit = this.prepareParam(min, 'min');
|
|
2531
|
-
return this.test({
|
|
2532
|
-
message,
|
|
2533
|
-
name: 'min',
|
|
2534
|
-
exclusive: true,
|
|
2535
|
-
params: {
|
|
2536
|
-
min
|
|
2537
|
-
},
|
|
2538
|
-
skipAbsent: true,
|
|
2539
|
-
test(value) {
|
|
2540
|
-
return value >= this.resolve(limit);
|
|
2541
|
-
}
|
|
2542
|
-
});
|
|
2543
|
-
}
|
|
2544
|
-
max(max, message = date.max) {
|
|
2545
|
-
let limit = this.prepareParam(max, 'max');
|
|
2546
|
-
return this.test({
|
|
2547
|
-
message,
|
|
2548
|
-
name: 'max',
|
|
2549
|
-
exclusive: true,
|
|
2550
|
-
params: {
|
|
2551
|
-
max
|
|
2552
|
-
},
|
|
2553
|
-
skipAbsent: true,
|
|
2554
|
-
test(value) {
|
|
2555
|
-
return value <= this.resolve(limit);
|
|
2556
|
-
}
|
|
2557
|
-
});
|
|
2558
|
-
}
|
|
2559
|
-
}
|
|
2560
|
-
DateSchema.INVALID_DATE = invalidDate;
|
|
2561
|
-
|
|
2562
|
-
// @ts-expect-error
|
|
2563
|
-
function sortFields(fields, excludedEdges = []) {
|
|
2564
|
-
let edges = [];
|
|
2565
|
-
let nodes = new Set();
|
|
2566
|
-
let excludes = new Set(excludedEdges.map(([a, b]) => `${a}-${b}`));
|
|
2567
|
-
function addNode(depPath, key) {
|
|
2568
|
-
let node = propertyExpr.split(depPath)[0];
|
|
2569
|
-
nodes.add(node);
|
|
2570
|
-
if (!excludes.has(`${key}-${node}`)) edges.push([key, node]);
|
|
2571
|
-
}
|
|
2572
|
-
for (const key of Object.keys(fields)) {
|
|
2573
|
-
let value = fields[key];
|
|
2574
|
-
nodes.add(key);
|
|
2575
|
-
if (Reference.isRef(value) && value.isSibling) addNode(value.path, key);else if (isSchema(value) && 'deps' in value) value.deps.forEach(path => addNode(path, key));
|
|
2576
|
-
}
|
|
2577
|
-
return toposort$1.array(Array.from(nodes), edges).reverse();
|
|
2578
|
-
}
|
|
2579
|
-
|
|
2580
|
-
function findIndex(arr, err) {
|
|
2581
|
-
let idx = Infinity;
|
|
2582
|
-
arr.some((key, ii) => {
|
|
2583
|
-
var _err$path;
|
|
2584
|
-
if ((_err$path = err.path) != null && _err$path.includes(key)) {
|
|
2585
|
-
idx = ii;
|
|
2586
|
-
return true;
|
|
2587
|
-
}
|
|
2588
|
-
});
|
|
2589
|
-
return idx;
|
|
2590
|
-
}
|
|
2591
|
-
function sortByKeyOrder(keys) {
|
|
2592
|
-
return (a, b) => {
|
|
2593
|
-
return findIndex(keys, a) - findIndex(keys, b);
|
|
2594
|
-
};
|
|
2595
|
-
}
|
|
2596
|
-
|
|
2597
|
-
const parseJson = (value, _, ctx) => {
|
|
2598
|
-
if (typeof value !== 'string') {
|
|
2599
|
-
return value;
|
|
2600
|
-
}
|
|
2601
|
-
let parsed = value;
|
|
2602
|
-
try {
|
|
2603
|
-
parsed = JSON.parse(value);
|
|
2604
|
-
} catch (err) {
|
|
2605
|
-
/* */
|
|
2606
|
-
}
|
|
2607
|
-
return ctx.isType(parsed) ? parsed : value;
|
|
2608
|
-
};
|
|
2609
|
-
|
|
2610
|
-
// @ts-ignore
|
|
2611
|
-
function deepPartial(schema) {
|
|
2612
|
-
if ('fields' in schema) {
|
|
2613
|
-
const partial = {};
|
|
2614
|
-
for (const [key, fieldSchema] of Object.entries(schema.fields)) {
|
|
2615
|
-
partial[key] = deepPartial(fieldSchema);
|
|
2616
|
-
}
|
|
2617
|
-
return schema.setFields(partial);
|
|
2618
|
-
}
|
|
2619
|
-
if (schema.type === 'array') {
|
|
2620
|
-
const nextArray = schema.optional();
|
|
2621
|
-
if (nextArray.innerType) nextArray.innerType = deepPartial(nextArray.innerType);
|
|
2622
|
-
return nextArray;
|
|
2623
|
-
}
|
|
2624
|
-
if (schema.type === 'tuple') {
|
|
2625
|
-
return schema.optional().clone({
|
|
2626
|
-
types: schema.spec.types.map(deepPartial)
|
|
2627
|
-
});
|
|
2628
|
-
}
|
|
2629
|
-
if ('optional' in schema) {
|
|
2630
|
-
return schema.optional();
|
|
2631
|
-
}
|
|
2632
|
-
return schema;
|
|
2633
|
-
}
|
|
2634
|
-
const deepHas = (obj, p) => {
|
|
2635
|
-
const path = [...propertyExpr.normalizePath(p)];
|
|
2636
|
-
if (path.length === 1) return path[0] in obj;
|
|
2637
|
-
let last = path.pop();
|
|
2638
|
-
let parent = propertyExpr.getter(propertyExpr.join(path), true)(obj);
|
|
2639
|
-
return !!(parent && last in parent);
|
|
2640
|
-
};
|
|
2641
|
-
let isObject = obj => Object.prototype.toString.call(obj) === '[object Object]';
|
|
2642
|
-
function unknown(ctx, value) {
|
|
2643
|
-
let known = Object.keys(ctx.fields);
|
|
2644
|
-
return Object.keys(value).filter(key => known.indexOf(key) === -1);
|
|
2645
|
-
}
|
|
2646
|
-
const defaultSort = sortByKeyOrder([]);
|
|
2647
|
-
function create$3(spec) {
|
|
2648
|
-
return new ObjectSchema(spec);
|
|
2649
|
-
}
|
|
2650
|
-
class ObjectSchema extends Schema {
|
|
2651
|
-
constructor(spec) {
|
|
2652
|
-
super({
|
|
2653
|
-
type: 'object',
|
|
2654
|
-
check(value) {
|
|
2655
|
-
return isObject(value) || typeof value === 'function';
|
|
2656
|
-
}
|
|
2657
|
-
});
|
|
2658
|
-
this.fields = Object.create(null);
|
|
2659
|
-
this._sortErrors = defaultSort;
|
|
2660
|
-
this._nodes = [];
|
|
2661
|
-
this._excludedEdges = [];
|
|
2662
|
-
this.withMutation(() => {
|
|
2663
|
-
if (spec) {
|
|
2664
|
-
this.shape(spec);
|
|
2665
|
-
}
|
|
2666
|
-
});
|
|
2667
|
-
}
|
|
2668
|
-
_cast(_value, options = {}) {
|
|
2669
|
-
var _options$stripUnknown;
|
|
2670
|
-
let value = super._cast(_value, options);
|
|
2671
|
-
|
|
2672
|
-
//should ignore nulls here
|
|
2673
|
-
if (value === undefined) return this.getDefault(options);
|
|
2674
|
-
if (!this._typeCheck(value)) return value;
|
|
2675
|
-
let fields = this.fields;
|
|
2676
|
-
let strip = (_options$stripUnknown = options.stripUnknown) != null ? _options$stripUnknown : this.spec.noUnknown;
|
|
2677
|
-
let props = [].concat(this._nodes, Object.keys(value).filter(v => !this._nodes.includes(v)));
|
|
2678
|
-
let intermediateValue = {}; // is filled during the transform below
|
|
2679
|
-
let innerOptions = Object.assign({}, options, {
|
|
2680
|
-
parent: intermediateValue,
|
|
2681
|
-
__validating: options.__validating || false
|
|
2682
|
-
});
|
|
2683
|
-
let isChanged = false;
|
|
2684
|
-
for (const prop of props) {
|
|
2685
|
-
let field = fields[prop];
|
|
2686
|
-
let exists = (prop in value);
|
|
2687
|
-
if (field) {
|
|
2688
|
-
let fieldValue;
|
|
2689
|
-
let inputValue = value[prop];
|
|
2690
|
-
|
|
2691
|
-
// safe to mutate since this is fired in sequence
|
|
2692
|
-
innerOptions.path = (options.path ? `${options.path}.` : '') + prop;
|
|
2693
|
-
field = field.resolve({
|
|
2694
|
-
value: inputValue,
|
|
2695
|
-
context: options.context,
|
|
2696
|
-
parent: intermediateValue
|
|
2697
|
-
});
|
|
2698
|
-
let fieldSpec = field instanceof Schema ? field.spec : undefined;
|
|
2699
|
-
let strict = fieldSpec == null ? void 0 : fieldSpec.strict;
|
|
2700
|
-
if (fieldSpec != null && fieldSpec.strip) {
|
|
2701
|
-
isChanged = isChanged || prop in value;
|
|
2702
|
-
continue;
|
|
2703
|
-
}
|
|
2704
|
-
fieldValue = !options.__validating || !strict ?
|
|
2705
|
-
// TODO: use _cast, this is double resolving
|
|
2706
|
-
field.cast(value[prop], innerOptions) : value[prop];
|
|
2707
|
-
if (fieldValue !== undefined) {
|
|
2708
|
-
intermediateValue[prop] = fieldValue;
|
|
2709
|
-
}
|
|
2710
|
-
} else if (exists && !strip) {
|
|
2711
|
-
intermediateValue[prop] = value[prop];
|
|
2712
|
-
}
|
|
2713
|
-
if (exists !== prop in intermediateValue || intermediateValue[prop] !== value[prop]) {
|
|
2714
|
-
isChanged = true;
|
|
2715
|
-
}
|
|
2716
|
-
}
|
|
2717
|
-
return isChanged ? intermediateValue : value;
|
|
2718
|
-
}
|
|
2719
|
-
_validate(_value, options = {}, panic, next) {
|
|
2720
|
-
let {
|
|
2721
|
-
from = [],
|
|
2722
|
-
originalValue = _value,
|
|
2723
|
-
recursive = this.spec.recursive
|
|
2724
|
-
} = options;
|
|
2725
|
-
options.from = [{
|
|
2726
|
-
schema: this,
|
|
2727
|
-
value: originalValue
|
|
2728
|
-
}, ...from];
|
|
2729
|
-
// this flag is needed for handling `strict` correctly in the context of
|
|
2730
|
-
// validation vs just casting. e.g strict() on a field is only used when validating
|
|
2731
|
-
options.__validating = true;
|
|
2732
|
-
options.originalValue = originalValue;
|
|
2733
|
-
super._validate(_value, options, panic, (objectErrors, value) => {
|
|
2734
|
-
if (!recursive || !isObject(value)) {
|
|
2735
|
-
next(objectErrors, value);
|
|
2736
|
-
return;
|
|
2737
|
-
}
|
|
2738
|
-
originalValue = originalValue || value;
|
|
2739
|
-
let tests = [];
|
|
2740
|
-
for (let key of this._nodes) {
|
|
2741
|
-
let field = this.fields[key];
|
|
2742
|
-
if (!field || Reference.isRef(field)) {
|
|
2743
|
-
continue;
|
|
2744
|
-
}
|
|
2745
|
-
tests.push(field.asNestedTest({
|
|
2746
|
-
options,
|
|
2747
|
-
key,
|
|
2748
|
-
parent: value,
|
|
2749
|
-
parentPath: options.path,
|
|
2750
|
-
originalParent: originalValue
|
|
2751
|
-
}));
|
|
2752
|
-
}
|
|
2753
|
-
this.runTests({
|
|
2754
|
-
tests,
|
|
2755
|
-
value,
|
|
2756
|
-
originalValue,
|
|
2757
|
-
options
|
|
2758
|
-
}, panic, fieldErrors => {
|
|
2759
|
-
next(fieldErrors.sort(this._sortErrors).concat(objectErrors), value);
|
|
2760
|
-
});
|
|
2761
|
-
});
|
|
2762
|
-
}
|
|
2763
|
-
clone(spec) {
|
|
2764
|
-
const next = super.clone(spec);
|
|
2765
|
-
next.fields = Object.assign({}, this.fields);
|
|
2766
|
-
next._nodes = this._nodes;
|
|
2767
|
-
next._excludedEdges = this._excludedEdges;
|
|
2768
|
-
next._sortErrors = this._sortErrors;
|
|
2769
|
-
return next;
|
|
2770
|
-
}
|
|
2771
|
-
concat(schema) {
|
|
2772
|
-
let next = super.concat(schema);
|
|
2773
|
-
let nextFields = next.fields;
|
|
2774
|
-
for (let [field, schemaOrRef] of Object.entries(this.fields)) {
|
|
2775
|
-
const target = nextFields[field];
|
|
2776
|
-
nextFields[field] = target === undefined ? schemaOrRef : target;
|
|
2777
|
-
}
|
|
2778
|
-
return next.withMutation(s =>
|
|
2779
|
-
// XXX: excludes here is wrong
|
|
2780
|
-
s.setFields(nextFields, [...this._excludedEdges, ...schema._excludedEdges]));
|
|
2781
|
-
}
|
|
2782
|
-
_getDefault(options) {
|
|
2783
|
-
if ('default' in this.spec) {
|
|
2784
|
-
return super._getDefault(options);
|
|
2785
|
-
}
|
|
2786
|
-
|
|
2787
|
-
// if there is no default set invent one
|
|
2788
|
-
if (!this._nodes.length) {
|
|
2789
|
-
return undefined;
|
|
2790
|
-
}
|
|
2791
|
-
let dft = {};
|
|
2792
|
-
this._nodes.forEach(key => {
|
|
2793
|
-
var _innerOptions;
|
|
2794
|
-
const field = this.fields[key];
|
|
2795
|
-
let innerOptions = options;
|
|
2796
|
-
if ((_innerOptions = innerOptions) != null && _innerOptions.value) {
|
|
2797
|
-
innerOptions = Object.assign({}, innerOptions, {
|
|
2798
|
-
parent: innerOptions.value,
|
|
2799
|
-
value: innerOptions.value[key]
|
|
2800
|
-
});
|
|
2801
|
-
}
|
|
2802
|
-
dft[key] = field && 'getDefault' in field ? field.getDefault(innerOptions) : undefined;
|
|
2803
|
-
});
|
|
2804
|
-
return dft;
|
|
2805
|
-
}
|
|
2806
|
-
setFields(shape, excludedEdges) {
|
|
2807
|
-
let next = this.clone();
|
|
2808
|
-
next.fields = shape;
|
|
2809
|
-
next._nodes = sortFields(shape, excludedEdges);
|
|
2810
|
-
next._sortErrors = sortByKeyOrder(Object.keys(shape));
|
|
2811
|
-
// XXX: this carries over edges which may not be what you want
|
|
2812
|
-
if (excludedEdges) next._excludedEdges = excludedEdges;
|
|
2813
|
-
return next;
|
|
2814
|
-
}
|
|
2815
|
-
shape(additions, excludes = []) {
|
|
2816
|
-
return this.clone().withMutation(next => {
|
|
2817
|
-
let edges = next._excludedEdges;
|
|
2818
|
-
if (excludes.length) {
|
|
2819
|
-
if (!Array.isArray(excludes[0])) excludes = [excludes];
|
|
2820
|
-
edges = [...next._excludedEdges, ...excludes];
|
|
2821
|
-
}
|
|
2822
|
-
|
|
2823
|
-
// XXX: excludes here is wrong
|
|
2824
|
-
return next.setFields(Object.assign(next.fields, additions), edges);
|
|
2825
|
-
});
|
|
2826
|
-
}
|
|
2827
|
-
partial() {
|
|
2828
|
-
const partial = {};
|
|
2829
|
-
for (const [key, schema] of Object.entries(this.fields)) {
|
|
2830
|
-
partial[key] = 'optional' in schema && schema.optional instanceof Function ? schema.optional() : schema;
|
|
2831
|
-
}
|
|
2832
|
-
return this.setFields(partial);
|
|
2833
|
-
}
|
|
2834
|
-
deepPartial() {
|
|
2835
|
-
const next = deepPartial(this);
|
|
2836
|
-
return next;
|
|
2837
|
-
}
|
|
2838
|
-
pick(keys) {
|
|
2839
|
-
const picked = {};
|
|
2840
|
-
for (const key of keys) {
|
|
2841
|
-
if (this.fields[key]) picked[key] = this.fields[key];
|
|
2842
|
-
}
|
|
2843
|
-
return this.setFields(picked, this._excludedEdges.filter(([a, b]) => keys.includes(a) && keys.includes(b)));
|
|
2844
|
-
}
|
|
2845
|
-
omit(keys) {
|
|
2846
|
-
const remaining = [];
|
|
2847
|
-
for (const key of Object.keys(this.fields)) {
|
|
2848
|
-
if (keys.includes(key)) continue;
|
|
2849
|
-
remaining.push(key);
|
|
2850
|
-
}
|
|
2851
|
-
return this.pick(remaining);
|
|
2852
|
-
}
|
|
2853
|
-
from(from, to, alias) {
|
|
2854
|
-
let fromGetter = propertyExpr.getter(from, true);
|
|
2855
|
-
return this.transform(obj => {
|
|
2856
|
-
if (!obj) return obj;
|
|
2857
|
-
let newObj = obj;
|
|
2858
|
-
if (deepHas(obj, from)) {
|
|
2859
|
-
newObj = Object.assign({}, obj);
|
|
2860
|
-
if (!alias) delete newObj[from];
|
|
2861
|
-
newObj[to] = fromGetter(obj);
|
|
2862
|
-
}
|
|
2863
|
-
return newObj;
|
|
2864
|
-
});
|
|
2865
|
-
}
|
|
2866
|
-
|
|
2867
|
-
/** Parse an input JSON string to an object */
|
|
2868
|
-
json() {
|
|
2869
|
-
return this.transform(parseJson);
|
|
2870
|
-
}
|
|
2871
|
-
noUnknown(noAllow = true, message = object.noUnknown) {
|
|
2872
|
-
if (typeof noAllow !== 'boolean') {
|
|
2873
|
-
message = noAllow;
|
|
2874
|
-
noAllow = true;
|
|
2875
|
-
}
|
|
2876
|
-
let next = this.test({
|
|
2877
|
-
name: 'noUnknown',
|
|
2878
|
-
exclusive: true,
|
|
2879
|
-
message: message,
|
|
2880
|
-
test(value) {
|
|
2881
|
-
if (value == null) return true;
|
|
2882
|
-
const unknownKeys = unknown(this.schema, value);
|
|
2883
|
-
return !noAllow || unknownKeys.length === 0 || this.createError({
|
|
2884
|
-
params: {
|
|
2885
|
-
unknown: unknownKeys.join(', ')
|
|
2886
|
-
}
|
|
2887
|
-
});
|
|
2888
|
-
}
|
|
2889
|
-
});
|
|
2890
|
-
next.spec.noUnknown = noAllow;
|
|
2891
|
-
return next;
|
|
2892
|
-
}
|
|
2893
|
-
unknown(allow = true, message = object.noUnknown) {
|
|
2894
|
-
return this.noUnknown(!allow, message);
|
|
2895
|
-
}
|
|
2896
|
-
transformKeys(fn) {
|
|
2897
|
-
return this.transform(obj => {
|
|
2898
|
-
if (!obj) return obj;
|
|
2899
|
-
const result = {};
|
|
2900
|
-
for (const key of Object.keys(obj)) result[fn(key)] = obj[key];
|
|
2901
|
-
return result;
|
|
2902
|
-
});
|
|
2903
|
-
}
|
|
2904
|
-
camelCase() {
|
|
2905
|
-
return this.transformKeys(tinyCase.camelCase);
|
|
2906
|
-
}
|
|
2907
|
-
snakeCase() {
|
|
2908
|
-
return this.transformKeys(tinyCase.snakeCase);
|
|
2909
|
-
}
|
|
2910
|
-
constantCase() {
|
|
2911
|
-
return this.transformKeys(key => tinyCase.snakeCase(key).toUpperCase());
|
|
2912
|
-
}
|
|
2913
|
-
describe(options) {
|
|
2914
|
-
const next = (options ? this.resolve(options) : this).clone();
|
|
2915
|
-
const base = super.describe(options);
|
|
2916
|
-
base.fields = {};
|
|
2917
|
-
for (const [key, value] of Object.entries(next.fields)) {
|
|
2918
|
-
var _innerOptions2;
|
|
2919
|
-
let innerOptions = options;
|
|
2920
|
-
if ((_innerOptions2 = innerOptions) != null && _innerOptions2.value) {
|
|
2921
|
-
innerOptions = Object.assign({}, innerOptions, {
|
|
2922
|
-
parent: innerOptions.value,
|
|
2923
|
-
value: innerOptions.value[key]
|
|
2924
|
-
});
|
|
2925
|
-
}
|
|
2926
|
-
base.fields[key] = value.describe(innerOptions);
|
|
2927
|
-
}
|
|
2928
|
-
return base;
|
|
2929
|
-
}
|
|
2930
|
-
}
|
|
2931
|
-
create$3.prototype = ObjectSchema.prototype;
|
|
2932
|
-
|
|
2933
|
-
exports.FormController = FormController;
|
|
2934
|
-
exports.create$3 = create$3;
|
|
2935
|
-
exports.create$6 = create$6;
|
|
2936
|
-
exports.create$7 = create$7;
|
|
2937
|
-
exports.create$8 = create$8;
|