@verdocs/web-sdk 1.9.10 → 1.9.14
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/{Envelopes-22a0c02f.js → Envelopes-aec4ee3d.js} +4 -15
- package/dist/cjs/Envelopes-aec4ee3d.js.map +1 -0
- package/dist/cjs/{Templates-399073ea.js → Templates-0051d647.js} +2 -2
- package/dist/cjs/{Templates-399073ea.js.map → Templates-0051d647.js.map} +1 -1
- package/dist/cjs/VerdocsEndpoint-8c408e5b.js +3569 -0
- package/dist/cjs/VerdocsEndpoint-8c408e5b.js.map +1 -0
- package/dist/cjs/{templateStore-92828c3c.js → index-eb130f52.js} +2 -41
- package/dist/cjs/index-eb130f52.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/templateStore-974781a8.js +46 -0
- package/dist/cjs/templateStore-974781a8.js.map +1 -0
- package/dist/cjs/{utils-84236321.js → utils-e0f38696.js} +23 -3
- package/dist/cjs/utils-e0f38696.js.map +1 -0
- package/dist/cjs/verdocs-auth.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-build.cjs.entry.js +5 -4
- package/dist/cjs/verdocs-build.cjs.entry.js.map +1 -1
- package/dist/cjs/verdocs-contact-picker.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-document-page_2.cjs.entry.js +94 -0
- package/dist/cjs/verdocs-document-page_2.cjs.entry.js.map +1 -0
- package/dist/cjs/verdocs-dropdown_3.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-field-date.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-field-dropdown.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-field-initial.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-field-payment.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-field-signature_3.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-field-textarea.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-field-textbox.cjs.entry.js +3 -2
- package/dist/cjs/verdocs-field-textbox.cjs.entry.js.map +1 -1
- package/dist/cjs/verdocs-field-timestamp.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-preview.cjs.entry.js +17 -11
- package/dist/cjs/verdocs-preview.cjs.entry.js.map +1 -1
- package/dist/cjs/verdocs-quick-functions_3.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-search.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-send.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-sign.cjs.entry.js +91 -22
- package/dist/cjs/verdocs-sign.cjs.entry.js.map +1 -1
- package/dist/cjs/verdocs-template-create_4.cjs.entry.js +52 -36
- package/dist/cjs/verdocs-template-create_4.cjs.entry.js.map +1 -1
- package/dist/cjs/verdocs-view.cjs.entry.js +331 -0
- package/dist/cjs/verdocs-view.cjs.entry.js.map +1 -0
- package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -3
- package/dist/collection/components/elements/verdocs-document-page/verdocs-document-page.js +1 -4
- package/dist/collection/components/elements/verdocs-document-page/verdocs-document-page.js.map +1 -1
- package/dist/collection/components/elements/verdocs-template-fields/verdocs-template-fields.css +14 -1
- package/dist/collection/components/elements/verdocs-template-fields/verdocs-template-fields.js +17 -30
- package/dist/collection/components/elements/verdocs-template-fields/verdocs-template-fields.js.map +1 -1
- package/dist/collection/components/embeds/verdocs-preview/verdocs-preview.css +15 -0
- package/dist/collection/components/embeds/verdocs-preview/verdocs-preview.js +14 -7
- package/dist/collection/components/embeds/verdocs-preview/verdocs-preview.js.map +1 -1
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +124 -47
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js.map +1 -1
- package/dist/collection/components/embeds/verdocs-view/verdocs-view.js +122 -175
- package/dist/collection/components/embeds/verdocs-view/verdocs-view.js.map +1 -1
- package/dist/collection/components/embeds/verdocs-view/verdocs-view.stories.js +2 -3
- package/dist/collection/components/embeds/verdocs-view/verdocs-view.stories.js.map +1 -1
- package/dist/collection/utils/Envelopes.js +31 -0
- package/dist/collection/utils/Envelopes.js.map +1 -0
- package/dist/collection/utils/envelopeStore.js +28 -0
- package/dist/collection/utils/envelopeStore.js.map +1 -0
- package/dist/collection/utils/utils.js +21 -2
- package/dist/collection/utils/utils.js.map +1 -1
- package/dist/{esm/Envelopes-df05b3c7.js → components/Envelopes.js} +5 -15
- package/dist/components/Envelopes.js.map +1 -0
- package/dist/components/VerdocsEndpoint.js +2185 -1051
- package/dist/components/VerdocsEndpoint.js.map +1 -1
- package/dist/components/index.d.ts +0 -2
- package/dist/components/index.js +0 -2
- package/dist/components/index.js.map +1 -1
- package/dist/components/index2.js +196 -0
- package/dist/components/index2.js.map +1 -0
- package/dist/components/templateStore.js +1 -192
- package/dist/components/templateStore.js.map +1 -1
- package/dist/components/utils.js +22 -3
- package/dist/components/utils.js.map +1 -1
- package/dist/components/verdocs-build.js +34 -52
- package/dist/components/verdocs-build.js.map +1 -1
- package/dist/components/verdocs-document-page2.js +1 -4
- package/dist/components/verdocs-document-page2.js.map +1 -1
- package/dist/components/verdocs-preview.js +16 -29
- package/dist/components/verdocs-preview.js.map +1 -1
- package/dist/components/verdocs-sign.js +100 -57
- package/dist/components/verdocs-sign.js.map +1 -1
- package/dist/components/verdocs-template-create2.js +29 -1
- package/dist/components/verdocs-template-create2.js.map +1 -1
- package/dist/components/verdocs-template-fields2.js +36 -67
- package/dist/components/verdocs-template-fields2.js.map +1 -1
- package/dist/components/verdocs-view.js +353 -1
- package/dist/components/verdocs-view.js.map +1 -1
- package/dist/docs.json +38 -568
- package/dist/esm/Envelopes-b031f847.js +93 -0
- package/dist/esm/Envelopes-b031f847.js.map +1 -0
- package/dist/esm/{Templates-91922342.js → Templates-1034fade.js} +2 -2
- package/dist/esm/{Templates-91922342.js.map → Templates-1034fade.js.map} +1 -1
- package/dist/esm/VerdocsEndpoint-dac04424.js +3566 -0
- package/dist/esm/VerdocsEndpoint-dac04424.js.map +1 -0
- package/dist/esm/{templateStore-3b26e38d.js → index-fd7b8a34.js} +2 -41
- package/dist/esm/index-fd7b8a34.js.map +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/templateStore-96a39844.js +44 -0
- package/dist/esm/templateStore-96a39844.js.map +1 -0
- package/dist/esm/{utils-3f23facc.js → utils-99a3c1f0.js} +23 -4
- package/dist/esm/utils-99a3c1f0.js.map +1 -0
- package/dist/esm/verdocs-auth.entry.js +1 -1
- package/dist/esm/verdocs-build.entry.js +5 -4
- package/dist/esm/verdocs-build.entry.js.map +1 -1
- package/dist/esm/verdocs-contact-picker.entry.js +1 -1
- package/dist/esm/verdocs-document-page_2.entry.js +89 -0
- package/dist/esm/verdocs-document-page_2.entry.js.map +1 -0
- package/dist/esm/verdocs-dropdown_3.entry.js +1 -1
- package/dist/esm/verdocs-field-date.entry.js +1 -1
- package/dist/esm/verdocs-field-dropdown.entry.js +1 -1
- package/dist/esm/verdocs-field-initial.entry.js +1 -1
- package/dist/esm/verdocs-field-payment.entry.js +1 -1
- package/dist/esm/verdocs-field-signature_3.entry.js +1 -1
- package/dist/esm/verdocs-field-textarea.entry.js +1 -1
- package/dist/esm/verdocs-field-textbox.entry.js +3 -2
- package/dist/esm/verdocs-field-textbox.entry.js.map +1 -1
- package/dist/esm/verdocs-field-timestamp.entry.js +1 -1
- package/dist/esm/verdocs-preview.entry.js +17 -11
- package/dist/esm/verdocs-preview.entry.js.map +1 -1
- package/dist/esm/verdocs-quick-functions_3.entry.js +1 -1
- package/dist/esm/verdocs-search.entry.js +1 -1
- package/dist/esm/verdocs-send.entry.js +2 -2
- package/dist/esm/verdocs-sign.entry.js +92 -23
- package/dist/esm/verdocs-sign.entry.js.map +1 -1
- package/dist/esm/verdocs-template-create_4.entry.js +50 -34
- package/dist/esm/verdocs-template-create_4.entry.js.map +1 -1
- package/dist/esm/verdocs-view.entry.js +327 -0
- package/dist/esm/verdocs-view.entry.js.map +1 -0
- package/dist/esm/verdocs-web-sdk.js +1 -1
- package/dist/esm-es5/Envelopes-b031f847.js +2 -0
- package/dist/esm-es5/Envelopes-b031f847.js.map +1 -0
- package/dist/esm-es5/{Templates-91922342.js → Templates-1034fade.js} +2 -2
- package/dist/esm-es5/{Templates-91922342.js.map → Templates-1034fade.js.map} +0 -0
- package/dist/esm-es5/VerdocsEndpoint-dac04424.js +2 -0
- package/dist/esm-es5/VerdocsEndpoint-dac04424.js.map +1 -0
- package/dist/esm-es5/index-fd7b8a34.js +2 -0
- package/dist/esm-es5/index-fd7b8a34.js.map +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/loader.js.map +1 -1
- package/dist/esm-es5/templateStore-96a39844.js +2 -0
- package/dist/esm-es5/templateStore-96a39844.js.map +1 -0
- package/dist/esm-es5/utils-99a3c1f0.js +2 -0
- package/dist/esm-es5/utils-99a3c1f0.js.map +1 -0
- package/dist/esm-es5/verdocs-auth.entry.js +1 -1
- package/dist/esm-es5/verdocs-build.entry.js +1 -1
- package/dist/esm-es5/verdocs-build.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-contact-picker.entry.js +1 -1
- package/dist/esm-es5/verdocs-document-page_2.entry.js +2 -0
- package/dist/esm-es5/verdocs-document-page_2.entry.js.map +1 -0
- package/dist/esm-es5/verdocs-dropdown_3.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-date.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-dropdown.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-initial.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-payment.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-signature_3.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-textarea.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-textbox.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-textbox.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-field-timestamp.entry.js +1 -1
- package/dist/esm-es5/verdocs-preview.entry.js +1 -1
- package/dist/esm-es5/verdocs-preview.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-quick-functions_3.entry.js +1 -1
- package/dist/esm-es5/verdocs-search.entry.js +1 -1
- package/dist/esm-es5/verdocs-send.entry.js +1 -1
- package/dist/esm-es5/verdocs-sign.entry.js +1 -1
- package/dist/esm-es5/verdocs-sign.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-template-create_4.entry.js +1 -1
- package/dist/esm-es5/verdocs-template-create_4.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-view.entry.js +2 -0
- package/dist/esm-es5/verdocs-view.entry.js.map +1 -0
- package/dist/esm-es5/verdocs-web-sdk.js +1 -1
- package/dist/esm-es5/verdocs-web-sdk.js.map +1 -1
- package/dist/types/components/embeds/verdocs-preview/verdocs-preview.d.ts +3 -1
- package/dist/types/components/embeds/verdocs-sign/verdocs-sign.d.ts +23 -8
- package/dist/types/components/embeds/verdocs-view/verdocs-view.d.ts +5 -40
- package/dist/types/components/embeds/verdocs-view/verdocs-view.stories.d.ts +1 -2
- package/dist/types/components.d.ts +6 -219
- package/dist/types/utils/Envelopes.d.ts +2 -0
- package/dist/types/utils/envelopeStore.d.ts +10 -0
- package/dist/types/utils/utils.d.ts +10 -2
- package/dist/verdocs-web-sdk/{p-ff4840d2.system.entry.js → p-0a2efec0.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-ff4840d2.system.entry.js.map → p-0a2efec0.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-0a3d0ca9.js +2 -0
- package/dist/verdocs-web-sdk/{p-36700fe4.js.map → p-0a3d0ca9.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-0f6da8c7.system.js +2 -0
- package/dist/verdocs-web-sdk/p-0f6da8c7.system.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-d2d3b56d.system.entry.js → p-112c8e05.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-d2d3b56d.system.entry.js.map → p-112c8e05.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-1cd2f7dc.system.js +2 -0
- package/dist/verdocs-web-sdk/p-1cd2f7dc.system.js.map +1 -0
- package/dist/verdocs-web-sdk/p-21ec6ff0.system.js +2 -0
- package/dist/verdocs-web-sdk/p-21ec6ff0.system.js.map +1 -0
- package/dist/verdocs-web-sdk/p-2cf3843a.entry.js +2 -0
- package/dist/verdocs-web-sdk/{p-e47e3154.entry.js.map → p-2cf3843a.entry.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-f11b14a1.entry.js → p-2fe5b678.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-f11b14a1.entry.js.map → p-2fe5b678.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-30424967.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-30424967.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-32c7bce8.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-32c7bce8.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-63d01d16.system.js → p-32da34af.system.js} +2 -2
- package/dist/verdocs-web-sdk/{p-63d01d16.system.js.map → p-32da34af.system.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-2510c268.entry.js → p-32e3a428.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-2510c268.entry.js.map → p-32e3a428.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-f5eb353f.system.entry.js → p-3585534a.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-f5eb353f.system.entry.js.map → p-3585534a.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-c37ea778.system.entry.js → p-35fec075.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-c37ea778.system.entry.js.map → p-35fec075.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-ab23a9d1.entry.js → p-4b4c610f.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-ab23a9d1.entry.js.map → p-4b4c610f.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-8c549b7f.entry.js → p-5b636344.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-8c549b7f.entry.js.map → p-5b636344.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-5bb42252.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/{p-508192bb.system.entry.js.map → p-5bb42252.system.entry.js.map} +1 -1
- package/dist/verdocs-web-sdk/p-5d341c89.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-5d341c89.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-5ea05a1d.js +2 -0
- package/dist/verdocs-web-sdk/p-5ea05a1d.js.map +1 -0
- package/dist/verdocs-web-sdk/p-6802bdd2.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/{p-ccf983c7.system.entry.js.map → p-6802bdd2.system.entry.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-dee9037d.system.entry.js → p-6a8ac53e.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-dee9037d.system.entry.js.map → p-6a8ac53e.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-2bb98709.system.entry.js → p-78ec7db1.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-2bb98709.system.entry.js.map → p-78ec7db1.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-04708900.system.entry.js → p-8095fab3.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-04708900.system.entry.js.map → p-8095fab3.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-036fc9f9.entry.js → p-868f497f.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-036fc9f9.entry.js.map → p-868f497f.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-9236d9df.entry.js +2 -0
- package/dist/verdocs-web-sdk/{p-f06218ed.entry.js.map → p-9236d9df.entry.js.map} +1 -1
- package/dist/verdocs-web-sdk/p-92b0fc42.js +2 -0
- package/dist/verdocs-web-sdk/p-92b0fc42.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-d6390915.entry.js → p-a59f1f82.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-d6390915.entry.js.map → p-a59f1f82.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-a760546b.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-a760546b.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-a7ac4da8.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-a7ac4da8.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-8574c48b.system.entry.js → p-a8c25a4a.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-8574c48b.system.entry.js.map → p-a8c25a4a.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-bcae2278.entry.js → p-a9068845.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-bcae2278.entry.js.map → p-a9068845.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-0d12be64.system.entry.js → p-aa2d9932.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-0d12be64.system.entry.js.map → p-aa2d9932.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-ffff808d.entry.js → p-af1063e3.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-ffff808d.entry.js.map → p-af1063e3.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-cf8ecaaf.system.entry.js → p-b5882803.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-cf8ecaaf.system.entry.js.map → p-b5882803.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-68319ca5.system.entry.js → p-b6c24f97.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-68319ca5.system.entry.js.map → p-b6c24f97.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-2da21c85.entry.js → p-baa985a4.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-2da21c85.entry.js.map → p-baa985a4.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-650e0b71.entry.js → p-be8004c0.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-650e0b71.entry.js.map → p-be8004c0.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-becd8d7e.js +2 -0
- package/dist/verdocs-web-sdk/p-becd8d7e.js.map +1 -0
- package/dist/verdocs-web-sdk/p-c16b6ca4.system.js +1 -1
- package/dist/verdocs-web-sdk/p-c16b6ca4.system.js.map +1 -1
- package/dist/verdocs-web-sdk/p-c4357387.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-c4357387.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-6f1440dd.js → p-c5a43bb3.js} +2 -2
- package/dist/verdocs-web-sdk/p-c5a43bb3.js.map +1 -0
- package/dist/verdocs-web-sdk/p-cb7d9ff5.js +2 -0
- package/dist/verdocs-web-sdk/p-cb7d9ff5.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-f9901184.system.js → p-cd7b475a.system.js} +2 -2
- package/dist/verdocs-web-sdk/p-cd7b475a.system.js.map +1 -0
- package/dist/verdocs-web-sdk/p-d1a97a03.system.js +2 -0
- package/dist/verdocs-web-sdk/p-d1a97a03.system.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-473165ae.system.entry.js → p-dd864f36.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-473165ae.system.entry.js.map → p-dd864f36.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-e4569806.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-e4569806.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-e4fa4969.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-e4fa4969.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-932571a1.entry.js → p-f19e600e.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-932571a1.entry.js.map → p-f19e600e.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-f8c49765.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-f8c49765.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-6f938ce3.entry.js → p-f9a9b3a2.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-6f938ce3.entry.js.map → p-f9a9b3a2.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-259fd8de.entry.js → p-fac05414.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-259fd8de.entry.js.map → p-fac05414.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-fc93f2f3.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-fc93f2f3.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-ed8e3256.system.entry.js → p-ff0b44f9.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-ed8e3256.system.entry.js.map → p-ff0b44f9.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js.map +1 -1
- package/package.json +2 -2
- package/dist/cjs/Envelopes-22a0c02f.js.map +0 -1
- package/dist/cjs/TemplateDocuments-01c6e570.js +0 -45
- package/dist/cjs/TemplateDocuments-01c6e570.js.map +0 -1
- package/dist/cjs/VerdocsEndpoint-db38e942.js +0 -2435
- package/dist/cjs/VerdocsEndpoint-db38e942.js.map +0 -1
- package/dist/cjs/templateStore-92828c3c.js.map +0 -1
- package/dist/cjs/utils-84236321.js.map +0 -1
- package/dist/cjs/verdocs-document-page.cjs.entry.js +0 -84
- package/dist/cjs/verdocs-document-page.cjs.entry.js.map +0 -1
- package/dist/cjs/verdocs-loader_4.cjs.entry.js +0 -553
- package/dist/cjs/verdocs-loader_4.cjs.entry.js.map +0 -1
- package/dist/collection/components/elements/verdocs-view-envelope-document/verdocs-view-envelope-document.css +0 -16
- package/dist/collection/components/elements/verdocs-view-envelope-document/verdocs-view-envelope-document.js +0 -390
- package/dist/collection/components/elements/verdocs-view-envelope-document/verdocs-view-envelope-document.js.map +0 -1
- package/dist/collection/components/elements/verdocs-view-envelope-document/verdocs-view-envelope-document.stories.js +0 -15
- package/dist/collection/components/elements/verdocs-view-envelope-document/verdocs-view-envelope-document.stories.js.map +0 -1
- package/dist/collection/components/elements/verdocs-view-template-document/verdocs-view-template-document.css +0 -16
- package/dist/collection/components/elements/verdocs-view-template-document/verdocs-view-template-document.js +0 -388
- package/dist/collection/components/elements/verdocs-view-template-document/verdocs-view-template-document.js.map +0 -1
- package/dist/collection/components/elements/verdocs-view-template-document/verdocs-view-template-document.stories.js +0 -15
- package/dist/collection/components/elements/verdocs-view-template-document/verdocs-view-template-document.stories.js.map +0 -1
- package/dist/components/TemplateDocuments.js +0 -42
- package/dist/components/TemplateDocuments.js.map +0 -1
- package/dist/components/verdocs-view-envelope-document.d.ts +0 -11
- package/dist/components/verdocs-view-envelope-document.js +0 -8
- package/dist/components/verdocs-view-envelope-document.js.map +0 -1
- package/dist/components/verdocs-view-envelope-document2.js +0 -306
- package/dist/components/verdocs-view-envelope-document2.js.map +0 -1
- package/dist/components/verdocs-view-template-document.d.ts +0 -11
- package/dist/components/verdocs-view-template-document.js +0 -8
- package/dist/components/verdocs-view-template-document.js.map +0 -1
- package/dist/components/verdocs-view-template-document2.js +0 -209
- package/dist/components/verdocs-view-template-document2.js.map +0 -1
- package/dist/components/verdocs-view2.js +0 -229
- package/dist/components/verdocs-view2.js.map +0 -1
- package/dist/esm/Envelopes-df05b3c7.js.map +0 -1
- package/dist/esm/TemplateDocuments-89ba2276.js +0 -42
- package/dist/esm/TemplateDocuments-89ba2276.js.map +0 -1
- package/dist/esm/VerdocsEndpoint-82f4600d.js +0 -2432
- package/dist/esm/VerdocsEndpoint-82f4600d.js.map +0 -1
- package/dist/esm/templateStore-3b26e38d.js.map +0 -1
- package/dist/esm/utils-3f23facc.js.map +0 -1
- package/dist/esm/verdocs-document-page.entry.js +0 -80
- package/dist/esm/verdocs-document-page.entry.js.map +0 -1
- package/dist/esm/verdocs-loader_4.entry.js +0 -546
- package/dist/esm/verdocs-loader_4.entry.js.map +0 -1
- package/dist/esm-es5/Envelopes-df05b3c7.js +0 -2
- package/dist/esm-es5/Envelopes-df05b3c7.js.map +0 -1
- package/dist/esm-es5/TemplateDocuments-89ba2276.js +0 -2
- package/dist/esm-es5/TemplateDocuments-89ba2276.js.map +0 -1
- package/dist/esm-es5/VerdocsEndpoint-82f4600d.js +0 -2
- package/dist/esm-es5/VerdocsEndpoint-82f4600d.js.map +0 -1
- package/dist/esm-es5/templateStore-3b26e38d.js +0 -2
- package/dist/esm-es5/templateStore-3b26e38d.js.map +0 -1
- package/dist/esm-es5/utils-3f23facc.js +0 -2
- package/dist/esm-es5/utils-3f23facc.js.map +0 -1
- package/dist/esm-es5/verdocs-document-page.entry.js +0 -2
- package/dist/esm-es5/verdocs-document-page.entry.js.map +0 -1
- package/dist/esm-es5/verdocs-loader_4.entry.js +0 -2
- package/dist/esm-es5/verdocs-loader_4.entry.js.map +0 -1
- package/dist/types/components/elements/verdocs-view-envelope-document/verdocs-view-envelope-document.d.ts +0 -79
- package/dist/types/components/elements/verdocs-view-envelope-document/verdocs-view-envelope-document.stories.d.ts +0 -7
- package/dist/types/components/elements/verdocs-view-template-document/verdocs-view-template-document.d.ts +0 -77
- package/dist/types/components/elements/verdocs-view-template-document/verdocs-view-template-document.stories.d.ts +0 -7
- package/dist/verdocs-web-sdk/p-142295dd.system.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-142295dd.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-2fbd4e25.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-2fbd4e25.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-3035b6c5.system.js +0 -2
- package/dist/verdocs-web-sdk/p-3035b6c5.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-36700fe4.js +0 -2
- package/dist/verdocs-web-sdk/p-3a4126d5.system.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-3a4126d5.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-48d9e0d6.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-48d9e0d6.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-508192bb.system.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-629237fc.js +0 -2
- package/dist/verdocs-web-sdk/p-629237fc.js.map +0 -1
- package/dist/verdocs-web-sdk/p-6e1ada33.system.js +0 -2
- package/dist/verdocs-web-sdk/p-6e1ada33.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-6f1440dd.js.map +0 -1
- package/dist/verdocs-web-sdk/p-70c732b7.js +0 -2
- package/dist/verdocs-web-sdk/p-70c732b7.js.map +0 -1
- package/dist/verdocs-web-sdk/p-7ce27ce2.js +0 -2
- package/dist/verdocs-web-sdk/p-7ce27ce2.js.map +0 -1
- package/dist/verdocs-web-sdk/p-8fd9dc5a.js +0 -2
- package/dist/verdocs-web-sdk/p-8fd9dc5a.js.map +0 -1
- package/dist/verdocs-web-sdk/p-a4041773.system.js +0 -2
- package/dist/verdocs-web-sdk/p-a4041773.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-b348e0ee.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-b348e0ee.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-b95cb372.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-b95cb372.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-c827cc19.system.js +0 -2
- package/dist/verdocs-web-sdk/p-c827cc19.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-ca6a1398.system.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-ca6a1398.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-ccf983c7.system.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-cf2d7761.system.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-cf2d7761.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-e47e3154.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-f06218ed.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-f9901184.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-fc3a0e2d.system.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-fc3a0e2d.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-fe512c19.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-fe512c19.entry.js.map +0 -1
|
@@ -66,85 +66,78 @@ var decodeAccessTokenBody = function (token) {
|
|
|
66
66
|
return decoded;
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
function bind(fn, thisArg) {
|
|
70
70
|
return function wrap() {
|
|
71
|
-
|
|
72
|
-
for (var i = 0; i < args.length; i++) {
|
|
73
|
-
args[i] = arguments[i];
|
|
74
|
-
}
|
|
75
|
-
return fn.apply(thisArg, args);
|
|
71
|
+
return fn.apply(thisArg, arguments);
|
|
76
72
|
};
|
|
77
|
-
}
|
|
73
|
+
}
|
|
78
74
|
|
|
79
75
|
// utils is a library of generic helper functions non-specific to axios
|
|
80
76
|
|
|
81
|
-
|
|
77
|
+
const {toString} = Object.prototype;
|
|
78
|
+
const {getPrototypeOf} = Object;
|
|
82
79
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
// eslint-disable-next-line func-names
|
|
86
|
-
return function(thing) {
|
|
87
|
-
var str = toString.call(thing);
|
|
80
|
+
const kindOf = (cache => thing => {
|
|
81
|
+
const str = toString.call(thing);
|
|
88
82
|
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
89
|
-
};
|
|
90
83
|
})(Object.create(null));
|
|
91
84
|
|
|
92
|
-
|
|
85
|
+
const kindOfTest = (type) => {
|
|
93
86
|
type = type.toLowerCase();
|
|
94
|
-
return
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
87
|
+
return (thing) => kindOf(thing) === type
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const typeOfTest = type => thing => typeof thing === type;
|
|
98
91
|
|
|
99
92
|
/**
|
|
100
93
|
* Determine if a value is an Array
|
|
101
94
|
*
|
|
102
95
|
* @param {Object} val The value to test
|
|
96
|
+
*
|
|
103
97
|
* @returns {boolean} True if value is an Array, otherwise false
|
|
104
98
|
*/
|
|
105
|
-
|
|
106
|
-
return Array.isArray(val);
|
|
107
|
-
}
|
|
99
|
+
const {isArray} = Array;
|
|
108
100
|
|
|
109
101
|
/**
|
|
110
102
|
* Determine if a value is undefined
|
|
111
103
|
*
|
|
112
|
-
* @param {
|
|
104
|
+
* @param {*} val The value to test
|
|
105
|
+
*
|
|
113
106
|
* @returns {boolean} True if the value is undefined, otherwise false
|
|
114
107
|
*/
|
|
115
|
-
|
|
116
|
-
return typeof val === 'undefined';
|
|
117
|
-
}
|
|
108
|
+
const isUndefined = typeOfTest('undefined');
|
|
118
109
|
|
|
119
110
|
/**
|
|
120
111
|
* Determine if a value is a Buffer
|
|
121
112
|
*
|
|
122
|
-
* @param {
|
|
113
|
+
* @param {*} val The value to test
|
|
114
|
+
*
|
|
123
115
|
* @returns {boolean} True if value is a Buffer, otherwise false
|
|
124
116
|
*/
|
|
125
117
|
function isBuffer(val) {
|
|
126
118
|
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
|
|
127
|
-
&&
|
|
119
|
+
&& isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
128
120
|
}
|
|
129
121
|
|
|
130
122
|
/**
|
|
131
123
|
* Determine if a value is an ArrayBuffer
|
|
132
124
|
*
|
|
133
|
-
* @
|
|
134
|
-
*
|
|
125
|
+
* @param {*} val The value to test
|
|
126
|
+
*
|
|
135
127
|
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
|
136
128
|
*/
|
|
137
|
-
|
|
129
|
+
const isArrayBuffer = kindOfTest('ArrayBuffer');
|
|
138
130
|
|
|
139
131
|
|
|
140
132
|
/**
|
|
141
133
|
* Determine if a value is a view on an ArrayBuffer
|
|
142
134
|
*
|
|
143
|
-
* @param {
|
|
135
|
+
* @param {*} val The value to test
|
|
136
|
+
*
|
|
144
137
|
* @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
|
|
145
138
|
*/
|
|
146
139
|
function isArrayBufferView(val) {
|
|
147
|
-
|
|
140
|
+
let result;
|
|
148
141
|
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
|
|
149
142
|
result = ArrayBuffer.isView(val);
|
|
150
143
|
} else {
|
|
@@ -156,163 +149,141 @@ function isArrayBufferView(val) {
|
|
|
156
149
|
/**
|
|
157
150
|
* Determine if a value is a String
|
|
158
151
|
*
|
|
159
|
-
* @param {
|
|
152
|
+
* @param {*} val The value to test
|
|
153
|
+
*
|
|
160
154
|
* @returns {boolean} True if value is a String, otherwise false
|
|
161
155
|
*/
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
156
|
+
const isString = typeOfTest('string');
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Determine if a value is a Function
|
|
160
|
+
*
|
|
161
|
+
* @param {*} val The value to test
|
|
162
|
+
* @returns {boolean} True if value is a Function, otherwise false
|
|
163
|
+
*/
|
|
164
|
+
const isFunction = typeOfTest('function');
|
|
165
165
|
|
|
166
166
|
/**
|
|
167
167
|
* Determine if a value is a Number
|
|
168
168
|
*
|
|
169
|
-
* @param {
|
|
169
|
+
* @param {*} val The value to test
|
|
170
|
+
*
|
|
170
171
|
* @returns {boolean} True if value is a Number, otherwise false
|
|
171
172
|
*/
|
|
172
|
-
|
|
173
|
-
return typeof val === 'number';
|
|
174
|
-
}
|
|
173
|
+
const isNumber = typeOfTest('number');
|
|
175
174
|
|
|
176
175
|
/**
|
|
177
176
|
* Determine if a value is an Object
|
|
178
177
|
*
|
|
179
|
-
* @param {
|
|
178
|
+
* @param {*} thing The value to test
|
|
179
|
+
*
|
|
180
180
|
* @returns {boolean} True if value is an Object, otherwise false
|
|
181
181
|
*/
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
182
|
+
const isObject = (thing) => thing !== null && typeof thing === 'object';
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Determine if a value is a Boolean
|
|
186
|
+
*
|
|
187
|
+
* @param {*} thing The value to test
|
|
188
|
+
* @returns {boolean} True if value is a Boolean, otherwise false
|
|
189
|
+
*/
|
|
190
|
+
const isBoolean = thing => thing === true || thing === false;
|
|
185
191
|
|
|
186
192
|
/**
|
|
187
193
|
* Determine if a value is a plain Object
|
|
188
194
|
*
|
|
189
|
-
* @param {
|
|
190
|
-
*
|
|
195
|
+
* @param {*} val The value to test
|
|
196
|
+
*
|
|
197
|
+
* @returns {boolean} True if value is a plain Object, otherwise false
|
|
191
198
|
*/
|
|
192
|
-
|
|
199
|
+
const isPlainObject = (val) => {
|
|
193
200
|
if (kindOf(val) !== 'object') {
|
|
194
201
|
return false;
|
|
195
202
|
}
|
|
196
203
|
|
|
197
|
-
|
|
198
|
-
return prototype === null || prototype === Object.prototype;
|
|
199
|
-
}
|
|
204
|
+
const prototype = getPrototypeOf(val);
|
|
205
|
+
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
|
|
206
|
+
};
|
|
200
207
|
|
|
201
208
|
/**
|
|
202
209
|
* Determine if a value is a Date
|
|
203
210
|
*
|
|
204
|
-
* @
|
|
205
|
-
*
|
|
211
|
+
* @param {*} val The value to test
|
|
212
|
+
*
|
|
206
213
|
* @returns {boolean} True if value is a Date, otherwise false
|
|
207
214
|
*/
|
|
208
|
-
|
|
215
|
+
const isDate = kindOfTest('Date');
|
|
209
216
|
|
|
210
217
|
/**
|
|
211
218
|
* Determine if a value is a File
|
|
212
219
|
*
|
|
213
|
-
* @
|
|
214
|
-
*
|
|
220
|
+
* @param {*} val The value to test
|
|
221
|
+
*
|
|
215
222
|
* @returns {boolean} True if value is a File, otherwise false
|
|
216
223
|
*/
|
|
217
|
-
|
|
224
|
+
const isFile = kindOfTest('File');
|
|
218
225
|
|
|
219
226
|
/**
|
|
220
227
|
* Determine if a value is a Blob
|
|
221
228
|
*
|
|
222
|
-
* @
|
|
223
|
-
*
|
|
229
|
+
* @param {*} val The value to test
|
|
230
|
+
*
|
|
224
231
|
* @returns {boolean} True if value is a Blob, otherwise false
|
|
225
232
|
*/
|
|
226
|
-
|
|
233
|
+
const isBlob = kindOfTest('Blob');
|
|
227
234
|
|
|
228
235
|
/**
|
|
229
236
|
* Determine if a value is a FileList
|
|
230
237
|
*
|
|
231
|
-
* @
|
|
232
|
-
* @param {Object} val The value to test
|
|
233
|
-
* @returns {boolean} True if value is a File, otherwise false
|
|
234
|
-
*/
|
|
235
|
-
var isFileList = kindOfTest('FileList');
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* Determine if a value is a Function
|
|
238
|
+
* @param {*} val The value to test
|
|
239
239
|
*
|
|
240
|
-
* @
|
|
241
|
-
* @returns {boolean} True if value is a Function, otherwise false
|
|
240
|
+
* @returns {boolean} True if value is a File, otherwise false
|
|
242
241
|
*/
|
|
243
|
-
|
|
244
|
-
return toString.call(val) === '[object Function]';
|
|
245
|
-
}
|
|
242
|
+
const isFileList = kindOfTest('FileList');
|
|
246
243
|
|
|
247
244
|
/**
|
|
248
245
|
* Determine if a value is a Stream
|
|
249
246
|
*
|
|
250
|
-
* @param {
|
|
247
|
+
* @param {*} val The value to test
|
|
248
|
+
*
|
|
251
249
|
* @returns {boolean} True if value is a Stream, otherwise false
|
|
252
250
|
*/
|
|
253
|
-
|
|
254
|
-
return isObject(val) && isFunction(val.pipe);
|
|
255
|
-
}
|
|
251
|
+
const isStream = (val) => isObject(val) && isFunction(val.pipe);
|
|
256
252
|
|
|
257
253
|
/**
|
|
258
254
|
* Determine if a value is a FormData
|
|
259
255
|
*
|
|
260
|
-
* @param {
|
|
256
|
+
* @param {*} thing The value to test
|
|
257
|
+
*
|
|
261
258
|
* @returns {boolean} True if value is an FormData, otherwise false
|
|
262
259
|
*/
|
|
263
|
-
|
|
264
|
-
|
|
260
|
+
const isFormData = (thing) => {
|
|
261
|
+
const pattern = '[object FormData]';
|
|
265
262
|
return thing && (
|
|
266
263
|
(typeof FormData === 'function' && thing instanceof FormData) ||
|
|
267
264
|
toString.call(thing) === pattern ||
|
|
268
265
|
(isFunction(thing.toString) && thing.toString() === pattern)
|
|
269
266
|
);
|
|
270
|
-
}
|
|
267
|
+
};
|
|
271
268
|
|
|
272
269
|
/**
|
|
273
270
|
* Determine if a value is a URLSearchParams object
|
|
274
|
-
*
|
|
275
|
-
* @param {
|
|
271
|
+
*
|
|
272
|
+
* @param {*} val The value to test
|
|
273
|
+
*
|
|
276
274
|
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
|
277
275
|
*/
|
|
278
|
-
|
|
276
|
+
const isURLSearchParams = kindOfTest('URLSearchParams');
|
|
279
277
|
|
|
280
278
|
/**
|
|
281
279
|
* Trim excess whitespace off the beginning and end of a string
|
|
282
280
|
*
|
|
283
281
|
* @param {String} str The String to trim
|
|
284
|
-
* @returns {String} The String freed of excess whitespace
|
|
285
|
-
*/
|
|
286
|
-
function trim(str) {
|
|
287
|
-
return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, '');
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* Determine if we're running in a standard browser environment
|
|
292
|
-
*
|
|
293
|
-
* This allows axios to run in a web worker, and react-native.
|
|
294
|
-
* Both environments support XMLHttpRequest, but not fully standard globals.
|
|
295
|
-
*
|
|
296
|
-
* web workers:
|
|
297
|
-
* typeof window -> undefined
|
|
298
|
-
* typeof document -> undefined
|
|
299
282
|
*
|
|
300
|
-
*
|
|
301
|
-
* navigator.product -> 'ReactNative'
|
|
302
|
-
* nativescript
|
|
303
|
-
* navigator.product -> 'NativeScript' or 'NS'
|
|
283
|
+
* @returns {String} The String freed of excess whitespace
|
|
304
284
|
*/
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
navigator.product === 'NativeScript' ||
|
|
308
|
-
navigator.product === 'NS')) {
|
|
309
|
-
return false;
|
|
310
|
-
}
|
|
311
|
-
return (
|
|
312
|
-
typeof window !== 'undefined' &&
|
|
313
|
-
typeof document !== 'undefined'
|
|
314
|
-
);
|
|
315
|
-
}
|
|
285
|
+
const trim = (str) => str.trim ?
|
|
286
|
+
str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
|
316
287
|
|
|
317
288
|
/**
|
|
318
289
|
* Iterate over an Array or an Object invoking a function for each item.
|
|
@@ -325,13 +296,19 @@ function isStandardBrowserEnv() {
|
|
|
325
296
|
*
|
|
326
297
|
* @param {Object|Array} obj The object to iterate
|
|
327
298
|
* @param {Function} fn The callback to invoke for each item
|
|
299
|
+
*
|
|
300
|
+
* @param {Boolean} [allOwnKeys = false]
|
|
301
|
+
* @returns {any}
|
|
328
302
|
*/
|
|
329
|
-
function forEach(obj, fn) {
|
|
303
|
+
function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
330
304
|
// Don't bother if no value provided
|
|
331
305
|
if (obj === null || typeof obj === 'undefined') {
|
|
332
306
|
return;
|
|
333
307
|
}
|
|
334
308
|
|
|
309
|
+
let i;
|
|
310
|
+
let l;
|
|
311
|
+
|
|
335
312
|
// Force an array if not already something iterable
|
|
336
313
|
if (typeof obj !== 'object') {
|
|
337
314
|
/*eslint no-param-reassign:0*/
|
|
@@ -340,19 +317,44 @@ function forEach(obj, fn) {
|
|
|
340
317
|
|
|
341
318
|
if (isArray(obj)) {
|
|
342
319
|
// Iterate over array values
|
|
343
|
-
for (
|
|
320
|
+
for (i = 0, l = obj.length; i < l; i++) {
|
|
344
321
|
fn.call(null, obj[i], i, obj);
|
|
345
322
|
}
|
|
346
323
|
} else {
|
|
347
324
|
// Iterate over object keys
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
325
|
+
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
326
|
+
const len = keys.length;
|
|
327
|
+
let key;
|
|
328
|
+
|
|
329
|
+
for (i = 0; i < len; i++) {
|
|
330
|
+
key = keys[i];
|
|
331
|
+
fn.call(null, obj[key], key, obj);
|
|
352
332
|
}
|
|
353
333
|
}
|
|
354
334
|
}
|
|
355
335
|
|
|
336
|
+
function findKey(obj, key) {
|
|
337
|
+
key = key.toLowerCase();
|
|
338
|
+
const keys = Object.keys(obj);
|
|
339
|
+
let i = keys.length;
|
|
340
|
+
let _key;
|
|
341
|
+
while (i-- > 0) {
|
|
342
|
+
_key = keys[i];
|
|
343
|
+
if (key === _key.toLowerCase()) {
|
|
344
|
+
return _key;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
return null;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
const _global = (() => {
|
|
351
|
+
/*eslint no-undef:0*/
|
|
352
|
+
if (typeof globalThis !== "undefined") return globalThis;
|
|
353
|
+
return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global)
|
|
354
|
+
})();
|
|
355
|
+
|
|
356
|
+
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
|
357
|
+
|
|
356
358
|
/**
|
|
357
359
|
* Accepts varargs expecting each argument to be an object, then
|
|
358
360
|
* immutably merges the properties of each object and returns result.
|
|
@@ -368,24 +370,27 @@ function forEach(obj, fn) {
|
|
|
368
370
|
* ```
|
|
369
371
|
*
|
|
370
372
|
* @param {Object} obj1 Object to merge
|
|
373
|
+
*
|
|
371
374
|
* @returns {Object} Result of all merge properties
|
|
372
375
|
*/
|
|
373
376
|
function merge(/* obj1, obj2, obj3, ... */) {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
377
|
+
const {caseless} = isContextDefined(this) && this || {};
|
|
378
|
+
const result = {};
|
|
379
|
+
const assignValue = (val, key) => {
|
|
380
|
+
const targetKey = caseless && findKey(result, key) || key;
|
|
381
|
+
if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
|
|
382
|
+
result[targetKey] = merge(result[targetKey], val);
|
|
378
383
|
} else if (isPlainObject(val)) {
|
|
379
|
-
result[
|
|
384
|
+
result[targetKey] = merge({}, val);
|
|
380
385
|
} else if (isArray(val)) {
|
|
381
|
-
result[
|
|
386
|
+
result[targetKey] = val.slice();
|
|
382
387
|
} else {
|
|
383
|
-
result[
|
|
388
|
+
result[targetKey] = val;
|
|
384
389
|
}
|
|
385
|
-
}
|
|
390
|
+
};
|
|
386
391
|
|
|
387
|
-
for (
|
|
388
|
-
forEach(arguments[i], assignValue);
|
|
392
|
+
for (let i = 0, l = arguments.length; i < l; i++) {
|
|
393
|
+
arguments[i] && forEach(arguments[i], assignValue);
|
|
389
394
|
}
|
|
390
395
|
return result;
|
|
391
396
|
}
|
|
@@ -396,31 +401,34 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
396
401
|
* @param {Object} a The object to be extended
|
|
397
402
|
* @param {Object} b The object to copy properties from
|
|
398
403
|
* @param {Object} thisArg The object to bind function to
|
|
399
|
-
*
|
|
404
|
+
*
|
|
405
|
+
* @param {Boolean} [allOwnKeys]
|
|
406
|
+
* @returns {Object} The resulting value of object a
|
|
400
407
|
*/
|
|
401
|
-
|
|
402
|
-
forEach(b,
|
|
403
|
-
if (thisArg &&
|
|
408
|
+
const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
|
409
|
+
forEach(b, (val, key) => {
|
|
410
|
+
if (thisArg && isFunction(val)) {
|
|
404
411
|
a[key] = bind(val, thisArg);
|
|
405
412
|
} else {
|
|
406
413
|
a[key] = val;
|
|
407
414
|
}
|
|
408
|
-
});
|
|
415
|
+
}, {allOwnKeys});
|
|
409
416
|
return a;
|
|
410
|
-
}
|
|
417
|
+
};
|
|
411
418
|
|
|
412
419
|
/**
|
|
413
420
|
* Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
|
|
414
421
|
*
|
|
415
422
|
* @param {string} content with BOM
|
|
416
|
-
*
|
|
423
|
+
*
|
|
424
|
+
* @returns {string} content value without BOM
|
|
417
425
|
*/
|
|
418
|
-
|
|
426
|
+
const stripBOM = (content) => {
|
|
419
427
|
if (content.charCodeAt(0) === 0xFEFF) {
|
|
420
428
|
content = content.slice(1);
|
|
421
429
|
}
|
|
422
430
|
return content;
|
|
423
|
-
}
|
|
431
|
+
};
|
|
424
432
|
|
|
425
433
|
/**
|
|
426
434
|
* Inherit the prototype methods from one constructor into another
|
|
@@ -428,246 +436,314 @@ function stripBOM(content) {
|
|
|
428
436
|
* @param {function} superConstructor
|
|
429
437
|
* @param {object} [props]
|
|
430
438
|
* @param {object} [descriptors]
|
|
439
|
+
*
|
|
440
|
+
* @returns {void}
|
|
431
441
|
*/
|
|
432
|
-
|
|
433
|
-
function inherits(constructor, superConstructor, props, descriptors) {
|
|
442
|
+
const inherits = (constructor, superConstructor, props, descriptors) => {
|
|
434
443
|
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
435
444
|
constructor.prototype.constructor = constructor;
|
|
445
|
+
Object.defineProperty(constructor, 'super', {
|
|
446
|
+
value: superConstructor.prototype
|
|
447
|
+
});
|
|
436
448
|
props && Object.assign(constructor.prototype, props);
|
|
437
|
-
}
|
|
449
|
+
};
|
|
438
450
|
|
|
439
451
|
/**
|
|
440
452
|
* Resolve object with deep prototype chain to a flat object
|
|
441
453
|
* @param {Object} sourceObj source object
|
|
442
454
|
* @param {Object} [destObj]
|
|
443
|
-
* @param {Function} [filter]
|
|
455
|
+
* @param {Function|Boolean} [filter]
|
|
456
|
+
* @param {Function} [propFilter]
|
|
457
|
+
*
|
|
444
458
|
* @returns {Object}
|
|
445
459
|
*/
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
var merged = {};
|
|
460
|
+
const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
|
|
461
|
+
let props;
|
|
462
|
+
let i;
|
|
463
|
+
let prop;
|
|
464
|
+
const merged = {};
|
|
452
465
|
|
|
453
466
|
destObj = destObj || {};
|
|
467
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
468
|
+
if (sourceObj == null) return destObj;
|
|
454
469
|
|
|
455
470
|
do {
|
|
456
471
|
props = Object.getOwnPropertyNames(sourceObj);
|
|
457
472
|
i = props.length;
|
|
458
473
|
while (i-- > 0) {
|
|
459
474
|
prop = props[i];
|
|
460
|
-
if (!merged[prop]) {
|
|
475
|
+
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
|
|
461
476
|
destObj[prop] = sourceObj[prop];
|
|
462
477
|
merged[prop] = true;
|
|
463
478
|
}
|
|
464
479
|
}
|
|
465
|
-
sourceObj =
|
|
480
|
+
sourceObj = filter !== false && getPrototypeOf(sourceObj);
|
|
466
481
|
} while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
|
467
482
|
|
|
468
483
|
return destObj;
|
|
469
|
-
}
|
|
484
|
+
};
|
|
470
485
|
|
|
471
|
-
|
|
472
|
-
*
|
|
486
|
+
/**
|
|
487
|
+
* Determines whether a string ends with the characters of a specified string
|
|
488
|
+
*
|
|
473
489
|
* @param {String} str
|
|
474
490
|
* @param {String} searchString
|
|
475
491
|
* @param {Number} [position= 0]
|
|
492
|
+
*
|
|
476
493
|
* @returns {boolean}
|
|
477
494
|
*/
|
|
478
|
-
|
|
495
|
+
const endsWith = (str, searchString, position) => {
|
|
479
496
|
str = String(str);
|
|
480
497
|
if (position === undefined || position > str.length) {
|
|
481
498
|
position = str.length;
|
|
482
499
|
}
|
|
483
500
|
position -= searchString.length;
|
|
484
|
-
|
|
501
|
+
const lastIndex = str.indexOf(searchString, position);
|
|
485
502
|
return lastIndex !== -1 && lastIndex === position;
|
|
486
|
-
}
|
|
503
|
+
};
|
|
487
504
|
|
|
488
505
|
|
|
489
506
|
/**
|
|
490
|
-
* Returns new array from array like object
|
|
507
|
+
* Returns new array from array like object or null if failed
|
|
508
|
+
*
|
|
491
509
|
* @param {*} [thing]
|
|
492
|
-
*
|
|
510
|
+
*
|
|
511
|
+
* @returns {?Array}
|
|
493
512
|
*/
|
|
494
|
-
|
|
513
|
+
const toArray = (thing) => {
|
|
495
514
|
if (!thing) return null;
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
515
|
+
if (isArray(thing)) return thing;
|
|
516
|
+
let i = thing.length;
|
|
517
|
+
if (!isNumber(i)) return null;
|
|
518
|
+
const arr = new Array(i);
|
|
499
519
|
while (i-- > 0) {
|
|
500
520
|
arr[i] = thing[i];
|
|
501
521
|
}
|
|
502
522
|
return arr;
|
|
503
|
-
}
|
|
523
|
+
};
|
|
504
524
|
|
|
525
|
+
/**
|
|
526
|
+
* Checking if the Uint8Array exists and if it does, it returns a function that checks if the
|
|
527
|
+
* thing passed in is an instance of Uint8Array
|
|
528
|
+
*
|
|
529
|
+
* @param {TypedArray}
|
|
530
|
+
*
|
|
531
|
+
* @returns {Array}
|
|
532
|
+
*/
|
|
505
533
|
// eslint-disable-next-line func-names
|
|
506
|
-
|
|
534
|
+
const isTypedArray = (TypedArray => {
|
|
507
535
|
// eslint-disable-next-line func-names
|
|
508
|
-
return
|
|
536
|
+
return thing => {
|
|
509
537
|
return TypedArray && thing instanceof TypedArray;
|
|
510
538
|
};
|
|
511
|
-
})(typeof Uint8Array !== 'undefined' &&
|
|
512
|
-
|
|
513
|
-
var utils = {
|
|
514
|
-
isArray: isArray,
|
|
515
|
-
isArrayBuffer: isArrayBuffer,
|
|
516
|
-
isBuffer: isBuffer,
|
|
517
|
-
isFormData: isFormData,
|
|
518
|
-
isArrayBufferView: isArrayBufferView,
|
|
519
|
-
isString: isString,
|
|
520
|
-
isNumber: isNumber,
|
|
521
|
-
isObject: isObject,
|
|
522
|
-
isPlainObject: isPlainObject,
|
|
523
|
-
isUndefined: isUndefined,
|
|
524
|
-
isDate: isDate,
|
|
525
|
-
isFile: isFile,
|
|
526
|
-
isBlob: isBlob,
|
|
527
|
-
isFunction: isFunction,
|
|
528
|
-
isStream: isStream,
|
|
529
|
-
isURLSearchParams: isURLSearchParams,
|
|
530
|
-
isStandardBrowserEnv: isStandardBrowserEnv,
|
|
531
|
-
forEach: forEach,
|
|
532
|
-
merge: merge,
|
|
533
|
-
extend: extend,
|
|
534
|
-
trim: trim,
|
|
535
|
-
stripBOM: stripBOM,
|
|
536
|
-
inherits: inherits,
|
|
537
|
-
toFlatObject: toFlatObject,
|
|
538
|
-
kindOf: kindOf,
|
|
539
|
-
kindOfTest: kindOfTest,
|
|
540
|
-
endsWith: endsWith,
|
|
541
|
-
toArray: toArray,
|
|
542
|
-
isTypedArray: isTypedArray,
|
|
543
|
-
isFileList: isFileList
|
|
544
|
-
};
|
|
545
|
-
|
|
546
|
-
function encode(val) {
|
|
547
|
-
return encodeURIComponent(val).
|
|
548
|
-
replace(/%3A/gi, ':').
|
|
549
|
-
replace(/%24/g, '$').
|
|
550
|
-
replace(/%2C/gi, ',').
|
|
551
|
-
replace(/%20/g, '+').
|
|
552
|
-
replace(/%5B/gi, '[').
|
|
553
|
-
replace(/%5D/gi, ']');
|
|
554
|
-
}
|
|
539
|
+
})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
|
|
555
540
|
|
|
556
541
|
/**
|
|
557
|
-
*
|
|
542
|
+
* For each entry in the object, call the function with the key and value.
|
|
558
543
|
*
|
|
559
|
-
* @param {
|
|
560
|
-
* @param {
|
|
561
|
-
*
|
|
544
|
+
* @param {Object<any, any>} obj - The object to iterate over.
|
|
545
|
+
* @param {Function} fn - The function to call for each entry.
|
|
546
|
+
*
|
|
547
|
+
* @returns {void}
|
|
562
548
|
*/
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
if (!params) {
|
|
566
|
-
return url;
|
|
567
|
-
}
|
|
549
|
+
const forEachEntry = (obj, fn) => {
|
|
550
|
+
const generator = obj && obj[Symbol.iterator];
|
|
568
551
|
|
|
569
|
-
|
|
570
|
-
if (paramsSerializer) {
|
|
571
|
-
serializedParams = paramsSerializer(params);
|
|
572
|
-
} else if (utils.isURLSearchParams(params)) {
|
|
573
|
-
serializedParams = params.toString();
|
|
574
|
-
} else {
|
|
575
|
-
var parts = [];
|
|
552
|
+
const iterator = generator.call(obj);
|
|
576
553
|
|
|
577
|
-
|
|
578
|
-
if (val === null || typeof val === 'undefined') {
|
|
579
|
-
return;
|
|
580
|
-
}
|
|
554
|
+
let result;
|
|
581
555
|
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
556
|
+
while ((result = iterator.next()) && !result.done) {
|
|
557
|
+
const pair = result.value;
|
|
558
|
+
fn.call(obj, pair[0], pair[1]);
|
|
559
|
+
}
|
|
560
|
+
};
|
|
587
561
|
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
562
|
+
/**
|
|
563
|
+
* It takes a regular expression and a string, and returns an array of all the matches
|
|
564
|
+
*
|
|
565
|
+
* @param {string} regExp - The regular expression to match against.
|
|
566
|
+
* @param {string} str - The string to search.
|
|
567
|
+
*
|
|
568
|
+
* @returns {Array<boolean>}
|
|
569
|
+
*/
|
|
570
|
+
const matchAll = (regExp, str) => {
|
|
571
|
+
let matches;
|
|
572
|
+
const arr = [];
|
|
597
573
|
|
|
598
|
-
|
|
574
|
+
while ((matches = regExp.exec(str)) !== null) {
|
|
575
|
+
arr.push(matches);
|
|
599
576
|
}
|
|
600
577
|
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
if (hashmarkIndex !== -1) {
|
|
604
|
-
url = url.slice(0, hashmarkIndex);
|
|
605
|
-
}
|
|
578
|
+
return arr;
|
|
579
|
+
};
|
|
606
580
|
|
|
607
|
-
|
|
608
|
-
|
|
581
|
+
/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
|
|
582
|
+
const isHTMLForm = kindOfTest('HTMLFormElement');
|
|
609
583
|
|
|
610
|
-
|
|
584
|
+
const toCamelCase = str => {
|
|
585
|
+
return str.toLowerCase().replace(/[_-\s]([a-z\d])(\w*)/g,
|
|
586
|
+
function replacer(m, p1, p2) {
|
|
587
|
+
return p1.toUpperCase() + p2;
|
|
588
|
+
}
|
|
589
|
+
);
|
|
611
590
|
};
|
|
612
591
|
|
|
613
|
-
function
|
|
614
|
-
|
|
615
|
-
}
|
|
592
|
+
/* Creating a function that will check if an object has a property. */
|
|
593
|
+
const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
|
|
616
594
|
|
|
617
595
|
/**
|
|
618
|
-
*
|
|
596
|
+
* Determine if a value is a RegExp object
|
|
619
597
|
*
|
|
620
|
-
* @param {
|
|
621
|
-
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
598
|
+
* @param {*} val The value to test
|
|
622
599
|
*
|
|
623
|
-
* @
|
|
600
|
+
* @returns {boolean} True if value is a RegExp object, otherwise false
|
|
624
601
|
*/
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
602
|
+
const isRegExp = kindOfTest('RegExp');
|
|
603
|
+
|
|
604
|
+
const reduceDescriptors = (obj, reducer) => {
|
|
605
|
+
const descriptors = Object.getOwnPropertyDescriptors(obj);
|
|
606
|
+
const reducedDescriptors = {};
|
|
607
|
+
|
|
608
|
+
forEach(descriptors, (descriptor, name) => {
|
|
609
|
+
if (reducer(descriptor, name, obj) !== false) {
|
|
610
|
+
reducedDescriptors[name] = descriptor;
|
|
611
|
+
}
|
|
631
612
|
});
|
|
632
|
-
return this.handlers.length - 1;
|
|
633
|
-
};
|
|
634
613
|
|
|
635
|
-
|
|
636
|
-
* Remove an interceptor from the stack
|
|
637
|
-
*
|
|
638
|
-
* @param {Number} id The ID that was returned by `use`
|
|
639
|
-
*/
|
|
640
|
-
InterceptorManager.prototype.eject = function eject(id) {
|
|
641
|
-
if (this.handlers[id]) {
|
|
642
|
-
this.handlers[id] = null;
|
|
643
|
-
}
|
|
614
|
+
Object.defineProperties(obj, reducedDescriptors);
|
|
644
615
|
};
|
|
645
616
|
|
|
646
617
|
/**
|
|
647
|
-
*
|
|
648
|
-
*
|
|
649
|
-
* This method is particularly useful for skipping over any
|
|
650
|
-
* interceptors that may have become `null` calling `eject`.
|
|
651
|
-
*
|
|
652
|
-
* @param {Function} fn The function to call for each interceptor
|
|
618
|
+
* Makes all methods read-only
|
|
619
|
+
* @param {Object} obj
|
|
653
620
|
*/
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
621
|
+
|
|
622
|
+
const freezeMethods = (obj) => {
|
|
623
|
+
reduceDescriptors(obj, (descriptor, name) => {
|
|
624
|
+
// skip restricted props in strict mode
|
|
625
|
+
if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
|
626
|
+
return false;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
const value = obj[name];
|
|
630
|
+
|
|
631
|
+
if (!isFunction(value)) return;
|
|
632
|
+
|
|
633
|
+
descriptor.enumerable = false;
|
|
634
|
+
|
|
635
|
+
if ('writable' in descriptor) {
|
|
636
|
+
descriptor.writable = false;
|
|
637
|
+
return;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
if (!descriptor.set) {
|
|
641
|
+
descriptor.set = () => {
|
|
642
|
+
throw Error('Can not rewrite read-only method \'' + name + '\'');
|
|
643
|
+
};
|
|
658
644
|
}
|
|
659
645
|
});
|
|
660
646
|
};
|
|
661
647
|
|
|
662
|
-
|
|
648
|
+
const toObjectSet = (arrayOrString, delimiter) => {
|
|
649
|
+
const obj = {};
|
|
650
|
+
|
|
651
|
+
const define = (arr) => {
|
|
652
|
+
arr.forEach(value => {
|
|
653
|
+
obj[value] = true;
|
|
654
|
+
});
|
|
655
|
+
};
|
|
656
|
+
|
|
657
|
+
isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
|
|
658
|
+
|
|
659
|
+
return obj;
|
|
660
|
+
};
|
|
661
|
+
|
|
662
|
+
const noop = () => {};
|
|
663
|
+
|
|
664
|
+
const toFiniteNumber = (value, defaultValue) => {
|
|
665
|
+
value = +value;
|
|
666
|
+
return Number.isFinite(value) ? value : defaultValue;
|
|
667
|
+
};
|
|
668
|
+
|
|
669
|
+
const toJSONObject = (obj) => {
|
|
670
|
+
const stack = new Array(10);
|
|
671
|
+
|
|
672
|
+
const visit = (source, i) => {
|
|
673
|
+
|
|
674
|
+
if (isObject(source)) {
|
|
675
|
+
if (stack.indexOf(source) >= 0) {
|
|
676
|
+
return;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
if(!('toJSON' in source)) {
|
|
680
|
+
stack[i] = source;
|
|
681
|
+
const target = isArray(source) ? [] : {};
|
|
682
|
+
|
|
683
|
+
forEach(source, (value, key) => {
|
|
684
|
+
const reducedValue = visit(value, i + 1);
|
|
685
|
+
!isUndefined(reducedValue) && (target[key] = reducedValue);
|
|
686
|
+
});
|
|
687
|
+
|
|
688
|
+
stack[i] = undefined;
|
|
663
689
|
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
|
|
667
|
-
headers[normalizedName] = value;
|
|
668
|
-
delete headers[name];
|
|
690
|
+
return target;
|
|
691
|
+
}
|
|
669
692
|
}
|
|
670
|
-
|
|
693
|
+
|
|
694
|
+
return source;
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
return visit(obj, 0);
|
|
698
|
+
};
|
|
699
|
+
|
|
700
|
+
const utils = {
|
|
701
|
+
isArray,
|
|
702
|
+
isArrayBuffer,
|
|
703
|
+
isBuffer,
|
|
704
|
+
isFormData,
|
|
705
|
+
isArrayBufferView,
|
|
706
|
+
isString,
|
|
707
|
+
isNumber,
|
|
708
|
+
isBoolean,
|
|
709
|
+
isObject,
|
|
710
|
+
isPlainObject,
|
|
711
|
+
isUndefined,
|
|
712
|
+
isDate,
|
|
713
|
+
isFile,
|
|
714
|
+
isBlob,
|
|
715
|
+
isRegExp,
|
|
716
|
+
isFunction,
|
|
717
|
+
isStream,
|
|
718
|
+
isURLSearchParams,
|
|
719
|
+
isTypedArray,
|
|
720
|
+
isFileList,
|
|
721
|
+
forEach,
|
|
722
|
+
merge,
|
|
723
|
+
extend,
|
|
724
|
+
trim,
|
|
725
|
+
stripBOM,
|
|
726
|
+
inherits,
|
|
727
|
+
toFlatObject,
|
|
728
|
+
kindOf,
|
|
729
|
+
kindOfTest,
|
|
730
|
+
endsWith,
|
|
731
|
+
toArray,
|
|
732
|
+
forEachEntry,
|
|
733
|
+
matchAll,
|
|
734
|
+
isHTMLForm,
|
|
735
|
+
hasOwnProperty,
|
|
736
|
+
hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
|
|
737
|
+
reduceDescriptors,
|
|
738
|
+
freezeMethods,
|
|
739
|
+
toObjectSet,
|
|
740
|
+
toCamelCase,
|
|
741
|
+
noop,
|
|
742
|
+
toFiniteNumber,
|
|
743
|
+
findKey,
|
|
744
|
+
global: _global,
|
|
745
|
+
isContextDefined,
|
|
746
|
+
toJSONObject
|
|
671
747
|
};
|
|
672
748
|
|
|
673
749
|
/**
|
|
@@ -678,10 +754,18 @@ var normalizeHeaderName = function normalizeHeaderName(headers, normalizedName)
|
|
|
678
754
|
* @param {Object} [config] The config.
|
|
679
755
|
* @param {Object} [request] The request.
|
|
680
756
|
* @param {Object} [response] The response.
|
|
757
|
+
*
|
|
681
758
|
* @returns {Error} The created error.
|
|
682
759
|
*/
|
|
683
760
|
function AxiosError(message, code, config, request, response) {
|
|
684
761
|
Error.call(this);
|
|
762
|
+
|
|
763
|
+
if (Error.captureStackTrace) {
|
|
764
|
+
Error.captureStackTrace(this, this.constructor);
|
|
765
|
+
} else {
|
|
766
|
+
this.stack = (new Error()).stack;
|
|
767
|
+
}
|
|
768
|
+
|
|
685
769
|
this.message = message;
|
|
686
770
|
this.name = 'AxiosError';
|
|
687
771
|
code && (this.code = code);
|
|
@@ -705,15 +789,15 @@ utils.inherits(AxiosError, Error, {
|
|
|
705
789
|
columnNumber: this.columnNumber,
|
|
706
790
|
stack: this.stack,
|
|
707
791
|
// Axios
|
|
708
|
-
config: this.config,
|
|
792
|
+
config: utils.toJSONObject(this.config),
|
|
709
793
|
code: this.code,
|
|
710
794
|
status: this.response && this.response.status ? this.response.status : null
|
|
711
795
|
};
|
|
712
796
|
}
|
|
713
797
|
});
|
|
714
798
|
|
|
715
|
-
|
|
716
|
-
|
|
799
|
+
const prototype$1 = AxiosError.prototype;
|
|
800
|
+
const descriptors = {};
|
|
717
801
|
|
|
718
802
|
[
|
|
719
803
|
'ERR_BAD_OPTION_VALUE',
|
|
@@ -725,25 +809,31 @@ var descriptors = {};
|
|
|
725
809
|
'ERR_DEPRECATED',
|
|
726
810
|
'ERR_BAD_RESPONSE',
|
|
727
811
|
'ERR_BAD_REQUEST',
|
|
728
|
-
'ERR_CANCELED'
|
|
812
|
+
'ERR_CANCELED',
|
|
813
|
+
'ERR_NOT_SUPPORT',
|
|
814
|
+
'ERR_INVALID_URL'
|
|
729
815
|
// eslint-disable-next-line func-names
|
|
730
|
-
].forEach(
|
|
816
|
+
].forEach(code => {
|
|
731
817
|
descriptors[code] = {value: code};
|
|
732
818
|
});
|
|
733
819
|
|
|
734
820
|
Object.defineProperties(AxiosError, descriptors);
|
|
735
|
-
Object.defineProperty(prototype, 'isAxiosError', {value: true});
|
|
821
|
+
Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
|
|
736
822
|
|
|
737
823
|
// eslint-disable-next-line func-names
|
|
738
|
-
AxiosError.from =
|
|
739
|
-
|
|
824
|
+
AxiosError.from = (error, code, config, request, response, customProps) => {
|
|
825
|
+
const axiosError = Object.create(prototype$1);
|
|
740
826
|
|
|
741
827
|
utils.toFlatObject(error, axiosError, function filter(obj) {
|
|
742
828
|
return obj !== Error.prototype;
|
|
829
|
+
}, prop => {
|
|
830
|
+
return prop !== 'isAxiosError';
|
|
743
831
|
});
|
|
744
832
|
|
|
745
833
|
AxiosError.call(axiosError, error.message, code, config, request, response);
|
|
746
834
|
|
|
835
|
+
axiosError.cause = error;
|
|
836
|
+
|
|
747
837
|
axiosError.name = error.name;
|
|
748
838
|
|
|
749
839
|
customProps && Object.assign(axiosError, customProps);
|
|
@@ -751,82 +841,1099 @@ AxiosError.from = function(error, code, config, request, response, customProps)
|
|
|
751
841
|
return axiosError;
|
|
752
842
|
};
|
|
753
843
|
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
var transitional = {
|
|
757
|
-
silentJSONParsing: true,
|
|
758
|
-
forcedJSONParsing: true,
|
|
759
|
-
clarifyTimeoutError: false
|
|
760
|
-
};
|
|
844
|
+
/* eslint-env browser */
|
|
845
|
+
var browser = typeof self == 'object' ? self.FormData : window.FormData;
|
|
761
846
|
|
|
762
847
|
/**
|
|
763
|
-
*
|
|
764
|
-
*
|
|
765
|
-
* @param {
|
|
766
|
-
*
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
function
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
848
|
+
* Determines if the given thing is a array or js object.
|
|
849
|
+
*
|
|
850
|
+
* @param {string} thing - The object or array to be visited.
|
|
851
|
+
*
|
|
852
|
+
* @returns {boolean}
|
|
853
|
+
*/
|
|
854
|
+
function isVisitable(thing) {
|
|
855
|
+
return utils.isPlainObject(thing) || utils.isArray(thing);
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
/**
|
|
859
|
+
* It removes the brackets from the end of a string
|
|
860
|
+
*
|
|
861
|
+
* @param {string} key - The key of the parameter.
|
|
862
|
+
*
|
|
863
|
+
* @returns {string} the key without the brackets.
|
|
864
|
+
*/
|
|
865
|
+
function removeBrackets(key) {
|
|
866
|
+
return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
/**
|
|
870
|
+
* It takes a path, a key, and a boolean, and returns a string
|
|
871
|
+
*
|
|
872
|
+
* @param {string} path - The path to the current key.
|
|
873
|
+
* @param {string} key - The key of the current object being iterated over.
|
|
874
|
+
* @param {string} dots - If true, the key will be rendered with dots instead of brackets.
|
|
875
|
+
*
|
|
876
|
+
* @returns {string} The path to the current key.
|
|
877
|
+
*/
|
|
878
|
+
function renderKey(path, key, dots) {
|
|
879
|
+
if (!path) return key;
|
|
880
|
+
return path.concat(key).map(function each(token, i) {
|
|
881
|
+
// eslint-disable-next-line no-param-reassign
|
|
882
|
+
token = removeBrackets(token);
|
|
883
|
+
return !dots && i ? '[' + token + ']' : token;
|
|
884
|
+
}).join(dots ? '.' : '');
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
/**
|
|
888
|
+
* If the array is an array and none of its elements are visitable, then it's a flat array.
|
|
889
|
+
*
|
|
890
|
+
* @param {Array<any>} arr - The array to check
|
|
891
|
+
*
|
|
892
|
+
* @returns {boolean}
|
|
893
|
+
*/
|
|
894
|
+
function isFlatArray(arr) {
|
|
895
|
+
return utils.isArray(arr) && !arr.some(isVisitable);
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
|
|
899
|
+
return /^is[A-Z]/.test(prop);
|
|
900
|
+
});
|
|
901
|
+
|
|
902
|
+
/**
|
|
903
|
+
* If the thing is a FormData object, return true, otherwise return false.
|
|
904
|
+
*
|
|
905
|
+
* @param {unknown} thing - The thing to check.
|
|
906
|
+
*
|
|
907
|
+
* @returns {boolean}
|
|
908
|
+
*/
|
|
909
|
+
function isSpecCompliant(thing) {
|
|
910
|
+
return thing && utils.isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator];
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
/**
|
|
914
|
+
* Convert a data object to FormData
|
|
915
|
+
*
|
|
916
|
+
* @param {Object} obj
|
|
917
|
+
* @param {?Object} [formData]
|
|
918
|
+
* @param {?Object} [options]
|
|
919
|
+
* @param {Function} [options.visitor]
|
|
920
|
+
* @param {Boolean} [options.metaTokens = true]
|
|
921
|
+
* @param {Boolean} [options.dots = false]
|
|
922
|
+
* @param {?Boolean} [options.indexes = false]
|
|
923
|
+
*
|
|
924
|
+
* @returns {Object}
|
|
925
|
+
**/
|
|
926
|
+
|
|
927
|
+
/**
|
|
928
|
+
* It converts an object into a FormData object
|
|
929
|
+
*
|
|
930
|
+
* @param {Object<any, any>} obj - The object to convert to form data.
|
|
931
|
+
* @param {string} formData - The FormData object to append to.
|
|
932
|
+
* @param {Object<string, any>} options
|
|
933
|
+
*
|
|
934
|
+
* @returns
|
|
935
|
+
*/
|
|
936
|
+
function toFormData(obj, formData, options) {
|
|
937
|
+
if (!utils.isObject(obj)) {
|
|
938
|
+
throw new TypeError('target must be an object');
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
// eslint-disable-next-line no-param-reassign
|
|
942
|
+
formData = formData || new (browser || FormData)();
|
|
943
|
+
|
|
944
|
+
// eslint-disable-next-line no-param-reassign
|
|
945
|
+
options = utils.toFlatObject(options, {
|
|
946
|
+
metaTokens: true,
|
|
947
|
+
dots: false,
|
|
948
|
+
indexes: false
|
|
949
|
+
}, false, function defined(option, source) {
|
|
950
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
951
|
+
return !utils.isUndefined(source[option]);
|
|
952
|
+
});
|
|
953
|
+
|
|
954
|
+
const metaTokens = options.metaTokens;
|
|
955
|
+
// eslint-disable-next-line no-use-before-define
|
|
956
|
+
const visitor = options.visitor || defaultVisitor;
|
|
957
|
+
const dots = options.dots;
|
|
958
|
+
const indexes = options.indexes;
|
|
959
|
+
const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
|
|
960
|
+
const useBlob = _Blob && isSpecCompliant(formData);
|
|
961
|
+
|
|
962
|
+
if (!utils.isFunction(visitor)) {
|
|
963
|
+
throw new TypeError('visitor must be a function');
|
|
964
|
+
}
|
|
774
965
|
|
|
775
966
|
function convertValue(value) {
|
|
776
967
|
if (value === null) return '';
|
|
777
968
|
|
|
778
|
-
if (utils.isDate(value)) {
|
|
779
|
-
return value.toISOString();
|
|
780
|
-
}
|
|
969
|
+
if (utils.isDate(value)) {
|
|
970
|
+
return value.toISOString();
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
if (!useBlob && utils.isBlob(value)) {
|
|
974
|
+
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
|
|
978
|
+
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
return value;
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
/**
|
|
985
|
+
* Default visitor.
|
|
986
|
+
*
|
|
987
|
+
* @param {*} value
|
|
988
|
+
* @param {String|Number} key
|
|
989
|
+
* @param {Array<String|Number>} path
|
|
990
|
+
* @this {FormData}
|
|
991
|
+
*
|
|
992
|
+
* @returns {boolean} return true to visit the each prop of the value recursively
|
|
993
|
+
*/
|
|
994
|
+
function defaultVisitor(value, key, path) {
|
|
995
|
+
let arr = value;
|
|
996
|
+
|
|
997
|
+
if (value && !path && typeof value === 'object') {
|
|
998
|
+
if (utils.endsWith(key, '{}')) {
|
|
999
|
+
// eslint-disable-next-line no-param-reassign
|
|
1000
|
+
key = metaTokens ? key : key.slice(0, -2);
|
|
1001
|
+
// eslint-disable-next-line no-param-reassign
|
|
1002
|
+
value = JSON.stringify(value);
|
|
1003
|
+
} else if (
|
|
1004
|
+
(utils.isArray(value) && isFlatArray(value)) ||
|
|
1005
|
+
(utils.isFileList(value) || utils.endsWith(key, '[]') && (arr = utils.toArray(value))
|
|
1006
|
+
)) {
|
|
1007
|
+
// eslint-disable-next-line no-param-reassign
|
|
1008
|
+
key = removeBrackets(key);
|
|
1009
|
+
|
|
1010
|
+
arr.forEach(function each(el, index) {
|
|
1011
|
+
!(utils.isUndefined(el) || el === null) && formData.append(
|
|
1012
|
+
// eslint-disable-next-line no-nested-ternary
|
|
1013
|
+
indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
|
|
1014
|
+
convertValue(el)
|
|
1015
|
+
);
|
|
1016
|
+
});
|
|
1017
|
+
return false;
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
if (isVisitable(value)) {
|
|
1022
|
+
return true;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
1026
|
+
|
|
1027
|
+
return false;
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
const stack = [];
|
|
1031
|
+
|
|
1032
|
+
const exposedHelpers = Object.assign(predicates, {
|
|
1033
|
+
defaultVisitor,
|
|
1034
|
+
convertValue,
|
|
1035
|
+
isVisitable
|
|
1036
|
+
});
|
|
1037
|
+
|
|
1038
|
+
function build(value, path) {
|
|
1039
|
+
if (utils.isUndefined(value)) return;
|
|
1040
|
+
|
|
1041
|
+
if (stack.indexOf(value) !== -1) {
|
|
1042
|
+
throw Error('Circular reference detected in ' + path.join('.'));
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
stack.push(value);
|
|
1046
|
+
|
|
1047
|
+
utils.forEach(value, function each(el, key) {
|
|
1048
|
+
const result = !(utils.isUndefined(el) || el === null) && visitor.call(
|
|
1049
|
+
formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
|
|
1050
|
+
);
|
|
1051
|
+
|
|
1052
|
+
if (result === true) {
|
|
1053
|
+
build(el, path ? path.concat(key) : [key]);
|
|
1054
|
+
}
|
|
1055
|
+
});
|
|
1056
|
+
|
|
1057
|
+
stack.pop();
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
if (!utils.isObject(obj)) {
|
|
1061
|
+
throw new TypeError('data must be an object');
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
build(obj);
|
|
1065
|
+
|
|
1066
|
+
return formData;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
/**
|
|
1070
|
+
* It encodes a string by replacing all characters that are not in the unreserved set with
|
|
1071
|
+
* their percent-encoded equivalents
|
|
1072
|
+
*
|
|
1073
|
+
* @param {string} str - The string to encode.
|
|
1074
|
+
*
|
|
1075
|
+
* @returns {string} The encoded string.
|
|
1076
|
+
*/
|
|
1077
|
+
function encode$1(str) {
|
|
1078
|
+
const charMap = {
|
|
1079
|
+
'!': '%21',
|
|
1080
|
+
"'": '%27',
|
|
1081
|
+
'(': '%28',
|
|
1082
|
+
')': '%29',
|
|
1083
|
+
'~': '%7E',
|
|
1084
|
+
'%20': '+',
|
|
1085
|
+
'%00': '\x00'
|
|
1086
|
+
};
|
|
1087
|
+
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
1088
|
+
return charMap[match];
|
|
1089
|
+
});
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
/**
|
|
1093
|
+
* It takes a params object and converts it to a FormData object
|
|
1094
|
+
*
|
|
1095
|
+
* @param {Object<string, any>} params - The parameters to be converted to a FormData object.
|
|
1096
|
+
* @param {Object<string, any>} options - The options object passed to the Axios constructor.
|
|
1097
|
+
*
|
|
1098
|
+
* @returns {void}
|
|
1099
|
+
*/
|
|
1100
|
+
function AxiosURLSearchParams(params, options) {
|
|
1101
|
+
this._pairs = [];
|
|
1102
|
+
|
|
1103
|
+
params && toFormData(params, this, options);
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
const prototype = AxiosURLSearchParams.prototype;
|
|
1107
|
+
|
|
1108
|
+
prototype.append = function append(name, value) {
|
|
1109
|
+
this._pairs.push([name, value]);
|
|
1110
|
+
};
|
|
1111
|
+
|
|
1112
|
+
prototype.toString = function toString(encoder) {
|
|
1113
|
+
const _encode = encoder ? function(value) {
|
|
1114
|
+
return encoder.call(this, value, encode$1);
|
|
1115
|
+
} : encode$1;
|
|
1116
|
+
|
|
1117
|
+
return this._pairs.map(function each(pair) {
|
|
1118
|
+
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
1119
|
+
}, '').join('&');
|
|
1120
|
+
};
|
|
1121
|
+
|
|
1122
|
+
/**
|
|
1123
|
+
* It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
|
|
1124
|
+
* URI encoded counterparts
|
|
1125
|
+
*
|
|
1126
|
+
* @param {string} val The value to be encoded.
|
|
1127
|
+
*
|
|
1128
|
+
* @returns {string} The encoded value.
|
|
1129
|
+
*/
|
|
1130
|
+
function encode(val) {
|
|
1131
|
+
return encodeURIComponent(val).
|
|
1132
|
+
replace(/%3A/gi, ':').
|
|
1133
|
+
replace(/%24/g, '$').
|
|
1134
|
+
replace(/%2C/gi, ',').
|
|
1135
|
+
replace(/%20/g, '+').
|
|
1136
|
+
replace(/%5B/gi, '[').
|
|
1137
|
+
replace(/%5D/gi, ']');
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
/**
|
|
1141
|
+
* Build a URL by appending params to the end
|
|
1142
|
+
*
|
|
1143
|
+
* @param {string} url The base of the url (e.g., http://www.google.com)
|
|
1144
|
+
* @param {object} [params] The params to be appended
|
|
1145
|
+
* @param {?object} options
|
|
1146
|
+
*
|
|
1147
|
+
* @returns {string} The formatted url
|
|
1148
|
+
*/
|
|
1149
|
+
function buildURL(url, params, options) {
|
|
1150
|
+
/*eslint no-param-reassign:0*/
|
|
1151
|
+
if (!params) {
|
|
1152
|
+
return url;
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
const _encode = options && options.encode || encode;
|
|
1156
|
+
|
|
1157
|
+
const serializeFn = options && options.serialize;
|
|
1158
|
+
|
|
1159
|
+
let serializedParams;
|
|
1160
|
+
|
|
1161
|
+
if (serializeFn) {
|
|
1162
|
+
serializedParams = serializeFn(params, options);
|
|
1163
|
+
} else {
|
|
1164
|
+
serializedParams = utils.isURLSearchParams(params) ?
|
|
1165
|
+
params.toString() :
|
|
1166
|
+
new AxiosURLSearchParams(params, options).toString(_encode);
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
if (serializedParams) {
|
|
1170
|
+
const hashmarkIndex = url.indexOf("#");
|
|
1171
|
+
|
|
1172
|
+
if (hashmarkIndex !== -1) {
|
|
1173
|
+
url = url.slice(0, hashmarkIndex);
|
|
1174
|
+
}
|
|
1175
|
+
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
return url;
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
class InterceptorManager {
|
|
1182
|
+
constructor() {
|
|
1183
|
+
this.handlers = [];
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
/**
|
|
1187
|
+
* Add a new interceptor to the stack
|
|
1188
|
+
*
|
|
1189
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
1190
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
1191
|
+
*
|
|
1192
|
+
* @return {Number} An ID used to remove interceptor later
|
|
1193
|
+
*/
|
|
1194
|
+
use(fulfilled, rejected, options) {
|
|
1195
|
+
this.handlers.push({
|
|
1196
|
+
fulfilled,
|
|
1197
|
+
rejected,
|
|
1198
|
+
synchronous: options ? options.synchronous : false,
|
|
1199
|
+
runWhen: options ? options.runWhen : null
|
|
1200
|
+
});
|
|
1201
|
+
return this.handlers.length - 1;
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
/**
|
|
1205
|
+
* Remove an interceptor from the stack
|
|
1206
|
+
*
|
|
1207
|
+
* @param {Number} id The ID that was returned by `use`
|
|
1208
|
+
*
|
|
1209
|
+
* @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
|
|
1210
|
+
*/
|
|
1211
|
+
eject(id) {
|
|
1212
|
+
if (this.handlers[id]) {
|
|
1213
|
+
this.handlers[id] = null;
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
/**
|
|
1218
|
+
* Clear all interceptors from the stack
|
|
1219
|
+
*
|
|
1220
|
+
* @returns {void}
|
|
1221
|
+
*/
|
|
1222
|
+
clear() {
|
|
1223
|
+
if (this.handlers) {
|
|
1224
|
+
this.handlers = [];
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
/**
|
|
1229
|
+
* Iterate over all the registered interceptors
|
|
1230
|
+
*
|
|
1231
|
+
* This method is particularly useful for skipping over any
|
|
1232
|
+
* interceptors that may have become `null` calling `eject`.
|
|
1233
|
+
*
|
|
1234
|
+
* @param {Function} fn The function to call for each interceptor
|
|
1235
|
+
*
|
|
1236
|
+
* @returns {void}
|
|
1237
|
+
*/
|
|
1238
|
+
forEach(fn) {
|
|
1239
|
+
utils.forEach(this.handlers, function forEachHandler(h) {
|
|
1240
|
+
if (h !== null) {
|
|
1241
|
+
fn(h);
|
|
1242
|
+
}
|
|
1243
|
+
});
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
const transitionalDefaults = {
|
|
1248
|
+
silentJSONParsing: true,
|
|
1249
|
+
forcedJSONParsing: true,
|
|
1250
|
+
clarifyTimeoutError: false
|
|
1251
|
+
};
|
|
1252
|
+
|
|
1253
|
+
const URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
|
|
1254
|
+
|
|
1255
|
+
const FormData$1 = FormData;
|
|
1256
|
+
|
|
1257
|
+
/**
|
|
1258
|
+
* Determine if we're running in a standard browser environment
|
|
1259
|
+
*
|
|
1260
|
+
* This allows axios to run in a web worker, and react-native.
|
|
1261
|
+
* Both environments support XMLHttpRequest, but not fully standard globals.
|
|
1262
|
+
*
|
|
1263
|
+
* web workers:
|
|
1264
|
+
* typeof window -> undefined
|
|
1265
|
+
* typeof document -> undefined
|
|
1266
|
+
*
|
|
1267
|
+
* react-native:
|
|
1268
|
+
* navigator.product -> 'ReactNative'
|
|
1269
|
+
* nativescript
|
|
1270
|
+
* navigator.product -> 'NativeScript' or 'NS'
|
|
1271
|
+
*
|
|
1272
|
+
* @returns {boolean}
|
|
1273
|
+
*/
|
|
1274
|
+
const isStandardBrowserEnv = (() => {
|
|
1275
|
+
let product;
|
|
1276
|
+
if (typeof navigator !== 'undefined' && (
|
|
1277
|
+
(product = navigator.product) === 'ReactNative' ||
|
|
1278
|
+
product === 'NativeScript' ||
|
|
1279
|
+
product === 'NS')
|
|
1280
|
+
) {
|
|
1281
|
+
return false;
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
return typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
1285
|
+
})();
|
|
1286
|
+
|
|
1287
|
+
/**
|
|
1288
|
+
* Determine if we're running in a standard browser webWorker environment
|
|
1289
|
+
*
|
|
1290
|
+
* Although the `isStandardBrowserEnv` method indicates that
|
|
1291
|
+
* `allows axios to run in a web worker`, the WebWorker will still be
|
|
1292
|
+
* filtered out due to its judgment standard
|
|
1293
|
+
* `typeof window !== 'undefined' && typeof document !== 'undefined'`.
|
|
1294
|
+
* This leads to a problem when axios post `FormData` in webWorker
|
|
1295
|
+
*/
|
|
1296
|
+
const isStandardBrowserWebWorkerEnv = (() => {
|
|
1297
|
+
return (
|
|
1298
|
+
typeof WorkerGlobalScope !== 'undefined' &&
|
|
1299
|
+
// eslint-disable-next-line no-undef
|
|
1300
|
+
self instanceof WorkerGlobalScope &&
|
|
1301
|
+
typeof self.importScripts === 'function'
|
|
1302
|
+
);
|
|
1303
|
+
})();
|
|
1304
|
+
|
|
1305
|
+
|
|
1306
|
+
const platform = {
|
|
1307
|
+
isBrowser: true,
|
|
1308
|
+
classes: {
|
|
1309
|
+
URLSearchParams: URLSearchParams$1,
|
|
1310
|
+
FormData: FormData$1,
|
|
1311
|
+
Blob
|
|
1312
|
+
},
|
|
1313
|
+
isStandardBrowserEnv,
|
|
1314
|
+
isStandardBrowserWebWorkerEnv,
|
|
1315
|
+
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
|
|
1316
|
+
};
|
|
1317
|
+
|
|
1318
|
+
function toURLEncodedForm(data, options) {
|
|
1319
|
+
return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
|
|
1320
|
+
visitor: function(value, key, path, helpers) {
|
|
1321
|
+
|
|
1322
|
+
return helpers.defaultVisitor.apply(this, arguments);
|
|
1323
|
+
}
|
|
1324
|
+
}, options));
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
/**
|
|
1328
|
+
* It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
|
|
1329
|
+
*
|
|
1330
|
+
* @param {string} name - The name of the property to get.
|
|
1331
|
+
*
|
|
1332
|
+
* @returns An array of strings.
|
|
1333
|
+
*/
|
|
1334
|
+
function parsePropPath(name) {
|
|
1335
|
+
// foo[x][y][z]
|
|
1336
|
+
// foo.x.y.z
|
|
1337
|
+
// foo-x-y-z
|
|
1338
|
+
// foo x y z
|
|
1339
|
+
return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
|
|
1340
|
+
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
1341
|
+
});
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
/**
|
|
1345
|
+
* Convert an array to an object.
|
|
1346
|
+
*
|
|
1347
|
+
* @param {Array<any>} arr - The array to convert to an object.
|
|
1348
|
+
*
|
|
1349
|
+
* @returns An object with the same keys and values as the array.
|
|
1350
|
+
*/
|
|
1351
|
+
function arrayToObject(arr) {
|
|
1352
|
+
const obj = {};
|
|
1353
|
+
const keys = Object.keys(arr);
|
|
1354
|
+
let i;
|
|
1355
|
+
const len = keys.length;
|
|
1356
|
+
let key;
|
|
1357
|
+
for (i = 0; i < len; i++) {
|
|
1358
|
+
key = keys[i];
|
|
1359
|
+
obj[key] = arr[key];
|
|
1360
|
+
}
|
|
1361
|
+
return obj;
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
/**
|
|
1365
|
+
* It takes a FormData object and returns a JavaScript object
|
|
1366
|
+
*
|
|
1367
|
+
* @param {string} formData The FormData object to convert to JSON.
|
|
1368
|
+
*
|
|
1369
|
+
* @returns {Object<string, any> | null} The converted object.
|
|
1370
|
+
*/
|
|
1371
|
+
function formDataToJSON(formData) {
|
|
1372
|
+
function buildPath(path, value, target, index) {
|
|
1373
|
+
let name = path[index++];
|
|
1374
|
+
const isNumericKey = Number.isFinite(+name);
|
|
1375
|
+
const isLast = index >= path.length;
|
|
1376
|
+
name = !name && utils.isArray(target) ? target.length : name;
|
|
1377
|
+
|
|
1378
|
+
if (isLast) {
|
|
1379
|
+
if (utils.hasOwnProp(target, name)) {
|
|
1380
|
+
target[name] = [target[name], value];
|
|
1381
|
+
} else {
|
|
1382
|
+
target[name] = value;
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
return !isNumericKey;
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
if (!target[name] || !utils.isObject(target[name])) {
|
|
1389
|
+
target[name] = [];
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
const result = buildPath(path, value, target[name], index);
|
|
1393
|
+
|
|
1394
|
+
if (result && utils.isArray(target[name])) {
|
|
1395
|
+
target[name] = arrayToObject(target[name]);
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
return !isNumericKey;
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
|
|
1402
|
+
const obj = {};
|
|
1403
|
+
|
|
1404
|
+
utils.forEachEntry(formData, (name, value) => {
|
|
1405
|
+
buildPath(parsePropPath(name), value, obj, 0);
|
|
1406
|
+
});
|
|
1407
|
+
|
|
1408
|
+
return obj;
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
return null;
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
const DEFAULT_CONTENT_TYPE = {
|
|
1415
|
+
'Content-Type': undefined
|
|
1416
|
+
};
|
|
1417
|
+
|
|
1418
|
+
/**
|
|
1419
|
+
* It takes a string, tries to parse it, and if it fails, it returns the stringified version
|
|
1420
|
+
* of the input
|
|
1421
|
+
*
|
|
1422
|
+
* @param {any} rawValue - The value to be stringified.
|
|
1423
|
+
* @param {Function} parser - A function that parses a string into a JavaScript object.
|
|
1424
|
+
* @param {Function} encoder - A function that takes a value and returns a string.
|
|
1425
|
+
*
|
|
1426
|
+
* @returns {string} A stringified version of the rawValue.
|
|
1427
|
+
*/
|
|
1428
|
+
function stringifySafely(rawValue, parser, encoder) {
|
|
1429
|
+
if (utils.isString(rawValue)) {
|
|
1430
|
+
try {
|
|
1431
|
+
(parser || JSON.parse)(rawValue);
|
|
1432
|
+
return utils.trim(rawValue);
|
|
1433
|
+
} catch (e) {
|
|
1434
|
+
if (e.name !== 'SyntaxError') {
|
|
1435
|
+
throw e;
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
return (encoder || JSON.stringify)(rawValue);
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
const defaults = {
|
|
1444
|
+
|
|
1445
|
+
transitional: transitionalDefaults,
|
|
1446
|
+
|
|
1447
|
+
adapter: ['xhr', 'http'],
|
|
1448
|
+
|
|
1449
|
+
transformRequest: [function transformRequest(data, headers) {
|
|
1450
|
+
const contentType = headers.getContentType() || '';
|
|
1451
|
+
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
1452
|
+
const isObjectPayload = utils.isObject(data);
|
|
1453
|
+
|
|
1454
|
+
if (isObjectPayload && utils.isHTMLForm(data)) {
|
|
1455
|
+
data = new FormData(data);
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
const isFormData = utils.isFormData(data);
|
|
1459
|
+
|
|
1460
|
+
if (isFormData) {
|
|
1461
|
+
if (!hasJSONContentType) {
|
|
1462
|
+
return data;
|
|
1463
|
+
}
|
|
1464
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
if (utils.isArrayBuffer(data) ||
|
|
1468
|
+
utils.isBuffer(data) ||
|
|
1469
|
+
utils.isStream(data) ||
|
|
1470
|
+
utils.isFile(data) ||
|
|
1471
|
+
utils.isBlob(data)
|
|
1472
|
+
) {
|
|
1473
|
+
return data;
|
|
1474
|
+
}
|
|
1475
|
+
if (utils.isArrayBufferView(data)) {
|
|
1476
|
+
return data.buffer;
|
|
1477
|
+
}
|
|
1478
|
+
if (utils.isURLSearchParams(data)) {
|
|
1479
|
+
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
1480
|
+
return data.toString();
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
let isFileList;
|
|
1484
|
+
|
|
1485
|
+
if (isObjectPayload) {
|
|
1486
|
+
if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
|
|
1487
|
+
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
|
|
1491
|
+
const _FormData = this.env && this.env.FormData;
|
|
1492
|
+
|
|
1493
|
+
return toFormData(
|
|
1494
|
+
isFileList ? {'files[]': data} : data,
|
|
1495
|
+
_FormData && new _FormData(),
|
|
1496
|
+
this.formSerializer
|
|
1497
|
+
);
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
if (isObjectPayload || hasJSONContentType ) {
|
|
1502
|
+
headers.setContentType('application/json', false);
|
|
1503
|
+
return stringifySafely(data);
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
return data;
|
|
1507
|
+
}],
|
|
1508
|
+
|
|
1509
|
+
transformResponse: [function transformResponse(data) {
|
|
1510
|
+
const transitional = this.transitional || defaults.transitional;
|
|
1511
|
+
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
1512
|
+
const JSONRequested = this.responseType === 'json';
|
|
1513
|
+
|
|
1514
|
+
if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
|
1515
|
+
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
1516
|
+
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
1517
|
+
|
|
1518
|
+
try {
|
|
1519
|
+
return JSON.parse(data);
|
|
1520
|
+
} catch (e) {
|
|
1521
|
+
if (strictJSONParsing) {
|
|
1522
|
+
if (e.name === 'SyntaxError') {
|
|
1523
|
+
throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
|
|
1524
|
+
}
|
|
1525
|
+
throw e;
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
return data;
|
|
1531
|
+
}],
|
|
1532
|
+
|
|
1533
|
+
/**
|
|
1534
|
+
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
1535
|
+
* timeout is not created.
|
|
1536
|
+
*/
|
|
1537
|
+
timeout: 0,
|
|
1538
|
+
|
|
1539
|
+
xsrfCookieName: 'XSRF-TOKEN',
|
|
1540
|
+
xsrfHeaderName: 'X-XSRF-TOKEN',
|
|
1541
|
+
|
|
1542
|
+
maxContentLength: -1,
|
|
1543
|
+
maxBodyLength: -1,
|
|
1544
|
+
|
|
1545
|
+
env: {
|
|
1546
|
+
FormData: platform.classes.FormData,
|
|
1547
|
+
Blob: platform.classes.Blob
|
|
1548
|
+
},
|
|
1549
|
+
|
|
1550
|
+
validateStatus: function validateStatus(status) {
|
|
1551
|
+
return status >= 200 && status < 300;
|
|
1552
|
+
},
|
|
1553
|
+
|
|
1554
|
+
headers: {
|
|
1555
|
+
common: {
|
|
1556
|
+
'Accept': 'application/json, text/plain, */*'
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
};
|
|
1560
|
+
|
|
1561
|
+
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
|
|
1562
|
+
defaults.headers[method] = {};
|
|
1563
|
+
});
|
|
1564
|
+
|
|
1565
|
+
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
1566
|
+
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
|
1567
|
+
});
|
|
1568
|
+
|
|
1569
|
+
// RawAxiosHeaders whose duplicates are ignored by node
|
|
1570
|
+
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
1571
|
+
const ignoreDuplicateOf = utils.toObjectSet([
|
|
1572
|
+
'age', 'authorization', 'content-length', 'content-type', 'etag',
|
|
1573
|
+
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
|
|
1574
|
+
'last-modified', 'location', 'max-forwards', 'proxy-authorization',
|
|
1575
|
+
'referer', 'retry-after', 'user-agent'
|
|
1576
|
+
]);
|
|
1577
|
+
|
|
1578
|
+
/**
|
|
1579
|
+
* Parse headers into an object
|
|
1580
|
+
*
|
|
1581
|
+
* ```
|
|
1582
|
+
* Date: Wed, 27 Aug 2014 08:58:49 GMT
|
|
1583
|
+
* Content-Type: application/json
|
|
1584
|
+
* Connection: keep-alive
|
|
1585
|
+
* Transfer-Encoding: chunked
|
|
1586
|
+
* ```
|
|
1587
|
+
*
|
|
1588
|
+
* @param {String} rawHeaders Headers needing to be parsed
|
|
1589
|
+
*
|
|
1590
|
+
* @returns {Object} Headers parsed into an object
|
|
1591
|
+
*/
|
|
1592
|
+
const parseHeaders = rawHeaders => {
|
|
1593
|
+
const parsed = {};
|
|
1594
|
+
let key;
|
|
1595
|
+
let val;
|
|
1596
|
+
let i;
|
|
1597
|
+
|
|
1598
|
+
rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
|
|
1599
|
+
i = line.indexOf(':');
|
|
1600
|
+
key = line.substring(0, i).trim().toLowerCase();
|
|
1601
|
+
val = line.substring(i + 1).trim();
|
|
1602
|
+
|
|
1603
|
+
if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
|
|
1604
|
+
return;
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
if (key === 'set-cookie') {
|
|
1608
|
+
if (parsed[key]) {
|
|
1609
|
+
parsed[key].push(val);
|
|
1610
|
+
} else {
|
|
1611
|
+
parsed[key] = [val];
|
|
1612
|
+
}
|
|
1613
|
+
} else {
|
|
1614
|
+
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
1615
|
+
}
|
|
1616
|
+
});
|
|
1617
|
+
|
|
1618
|
+
return parsed;
|
|
1619
|
+
};
|
|
1620
|
+
|
|
1621
|
+
const $internals = Symbol('internals');
|
|
1622
|
+
|
|
1623
|
+
function normalizeHeader(header) {
|
|
1624
|
+
return header && String(header).trim().toLowerCase();
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
function normalizeValue(value) {
|
|
1628
|
+
if (value === false || value == null) {
|
|
1629
|
+
return value;
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
return utils.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
function parseTokens(str) {
|
|
1636
|
+
const tokens = Object.create(null);
|
|
1637
|
+
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
1638
|
+
let match;
|
|
1639
|
+
|
|
1640
|
+
while ((match = tokensRE.exec(str))) {
|
|
1641
|
+
tokens[match[1]] = match[2];
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1644
|
+
return tokens;
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1647
|
+
function isValidHeaderName(str) {
|
|
1648
|
+
return /^[-_a-zA-Z]+$/.test(str.trim());
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
function matchHeaderValue(context, value, header, filter) {
|
|
1652
|
+
if (utils.isFunction(filter)) {
|
|
1653
|
+
return filter.call(this, value, header);
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
if (!utils.isString(value)) return;
|
|
1657
|
+
|
|
1658
|
+
if (utils.isString(filter)) {
|
|
1659
|
+
return value.indexOf(filter) !== -1;
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
if (utils.isRegExp(filter)) {
|
|
1663
|
+
return filter.test(value);
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
function formatHeader(header) {
|
|
1668
|
+
return header.trim()
|
|
1669
|
+
.toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
1670
|
+
return char.toUpperCase() + str;
|
|
1671
|
+
});
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
function buildAccessors(obj, header) {
|
|
1675
|
+
const accessorName = utils.toCamelCase(' ' + header);
|
|
1676
|
+
|
|
1677
|
+
['get', 'set', 'has'].forEach(methodName => {
|
|
1678
|
+
Object.defineProperty(obj, methodName + accessorName, {
|
|
1679
|
+
value: function(arg1, arg2, arg3) {
|
|
1680
|
+
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
1681
|
+
},
|
|
1682
|
+
configurable: true
|
|
1683
|
+
});
|
|
1684
|
+
});
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
class AxiosHeaders {
|
|
1688
|
+
constructor(headers) {
|
|
1689
|
+
headers && this.set(headers);
|
|
1690
|
+
}
|
|
1691
|
+
|
|
1692
|
+
set(header, valueOrRewrite, rewrite) {
|
|
1693
|
+
const self = this;
|
|
1694
|
+
|
|
1695
|
+
function setHeader(_value, _header, _rewrite) {
|
|
1696
|
+
const lHeader = normalizeHeader(_header);
|
|
1697
|
+
|
|
1698
|
+
if (!lHeader) {
|
|
1699
|
+
throw new Error('header name must be a non-empty string');
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
const key = utils.findKey(self, lHeader);
|
|
1703
|
+
|
|
1704
|
+
if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
|
|
1705
|
+
self[key || _header] = normalizeValue(_value);
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
const setHeaders = (headers, _rewrite) =>
|
|
1710
|
+
utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
1711
|
+
|
|
1712
|
+
if (utils.isPlainObject(header) || header instanceof this.constructor) {
|
|
1713
|
+
setHeaders(header, valueOrRewrite);
|
|
1714
|
+
} else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
1715
|
+
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
1716
|
+
} else {
|
|
1717
|
+
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
1718
|
+
}
|
|
1719
|
+
|
|
1720
|
+
return this;
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
get(header, parser) {
|
|
1724
|
+
header = normalizeHeader(header);
|
|
1725
|
+
|
|
1726
|
+
if (header) {
|
|
1727
|
+
const key = utils.findKey(this, header);
|
|
1728
|
+
|
|
1729
|
+
if (key) {
|
|
1730
|
+
const value = this[key];
|
|
1731
|
+
|
|
1732
|
+
if (!parser) {
|
|
1733
|
+
return value;
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
if (parser === true) {
|
|
1737
|
+
return parseTokens(value);
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
if (utils.isFunction(parser)) {
|
|
1741
|
+
return parser.call(this, value, key);
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
if (utils.isRegExp(parser)) {
|
|
1745
|
+
return parser.exec(value);
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1748
|
+
throw new TypeError('parser must be boolean|regexp|function');
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
has(header, matcher) {
|
|
1754
|
+
header = normalizeHeader(header);
|
|
1755
|
+
|
|
1756
|
+
if (header) {
|
|
1757
|
+
const key = utils.findKey(this, header);
|
|
1758
|
+
|
|
1759
|
+
return !!(key && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
return false;
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1765
|
+
delete(header, matcher) {
|
|
1766
|
+
const self = this;
|
|
1767
|
+
let deleted = false;
|
|
1768
|
+
|
|
1769
|
+
function deleteHeader(_header) {
|
|
1770
|
+
_header = normalizeHeader(_header);
|
|
1771
|
+
|
|
1772
|
+
if (_header) {
|
|
1773
|
+
const key = utils.findKey(self, _header);
|
|
1774
|
+
|
|
1775
|
+
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
|
1776
|
+
delete self[key];
|
|
1777
|
+
|
|
1778
|
+
deleted = true;
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1783
|
+
if (utils.isArray(header)) {
|
|
1784
|
+
header.forEach(deleteHeader);
|
|
1785
|
+
} else {
|
|
1786
|
+
deleteHeader(header);
|
|
1787
|
+
}
|
|
1788
|
+
|
|
1789
|
+
return deleted;
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
clear() {
|
|
1793
|
+
return Object.keys(this).forEach(this.delete.bind(this));
|
|
1794
|
+
}
|
|
1795
|
+
|
|
1796
|
+
normalize(format) {
|
|
1797
|
+
const self = this;
|
|
1798
|
+
const headers = {};
|
|
1799
|
+
|
|
1800
|
+
utils.forEach(this, (value, header) => {
|
|
1801
|
+
const key = utils.findKey(headers, header);
|
|
1802
|
+
|
|
1803
|
+
if (key) {
|
|
1804
|
+
self[key] = normalizeValue(value);
|
|
1805
|
+
delete self[header];
|
|
1806
|
+
return;
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1809
|
+
const normalized = format ? formatHeader(header) : String(header).trim();
|
|
1810
|
+
|
|
1811
|
+
if (normalized !== header) {
|
|
1812
|
+
delete self[header];
|
|
1813
|
+
}
|
|
1814
|
+
|
|
1815
|
+
self[normalized] = normalizeValue(value);
|
|
1816
|
+
|
|
1817
|
+
headers[normalized] = true;
|
|
1818
|
+
});
|
|
1819
|
+
|
|
1820
|
+
return this;
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
concat(...targets) {
|
|
1824
|
+
return this.constructor.concat(this, ...targets);
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
toJSON(asStrings) {
|
|
1828
|
+
const obj = Object.create(null);
|
|
1829
|
+
|
|
1830
|
+
utils.forEach(this, (value, header) => {
|
|
1831
|
+
value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
|
|
1832
|
+
});
|
|
1833
|
+
|
|
1834
|
+
return obj;
|
|
1835
|
+
}
|
|
781
1836
|
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
1837
|
+
[Symbol.iterator]() {
|
|
1838
|
+
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
1839
|
+
}
|
|
785
1840
|
|
|
786
|
-
|
|
1841
|
+
toString() {
|
|
1842
|
+
return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
|
|
787
1843
|
}
|
|
788
1844
|
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
throw Error('Circular reference detected in ' + parentKey);
|
|
793
|
-
}
|
|
1845
|
+
get [Symbol.toStringTag]() {
|
|
1846
|
+
return 'AxiosHeaders';
|
|
1847
|
+
}
|
|
794
1848
|
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
if (utils.isUndefined(value)) return;
|
|
799
|
-
var fullKey = parentKey ? parentKey + '.' + key : key;
|
|
800
|
-
var arr;
|
|
801
|
-
|
|
802
|
-
if (value && !parentKey && typeof value === 'object') {
|
|
803
|
-
if (utils.endsWith(key, '{}')) {
|
|
804
|
-
// eslint-disable-next-line no-param-reassign
|
|
805
|
-
value = JSON.stringify(value);
|
|
806
|
-
} else if (utils.endsWith(key, '[]') && (arr = utils.toArray(value))) {
|
|
807
|
-
// eslint-disable-next-line func-names
|
|
808
|
-
arr.forEach(function(el) {
|
|
809
|
-
!utils.isUndefined(el) && formData.append(fullKey, convertValue(el));
|
|
810
|
-
});
|
|
811
|
-
return;
|
|
812
|
-
}
|
|
813
|
-
}
|
|
1849
|
+
static from(thing) {
|
|
1850
|
+
return thing instanceof this ? thing : new this(thing);
|
|
1851
|
+
}
|
|
814
1852
|
|
|
815
|
-
|
|
816
|
-
|
|
1853
|
+
static concat(first, ...targets) {
|
|
1854
|
+
const computed = new this(first);
|
|
817
1855
|
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
1856
|
+
targets.forEach((target) => computed.set(target));
|
|
1857
|
+
|
|
1858
|
+
return computed;
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
static accessor(header) {
|
|
1862
|
+
const internals = this[$internals] = (this[$internals] = {
|
|
1863
|
+
accessors: {}
|
|
1864
|
+
});
|
|
1865
|
+
|
|
1866
|
+
const accessors = internals.accessors;
|
|
1867
|
+
const prototype = this.prototype;
|
|
1868
|
+
|
|
1869
|
+
function defineAccessor(_header) {
|
|
1870
|
+
const lHeader = normalizeHeader(_header);
|
|
1871
|
+
|
|
1872
|
+
if (!accessors[lHeader]) {
|
|
1873
|
+
buildAccessors(prototype, _header);
|
|
1874
|
+
accessors[lHeader] = true;
|
|
1875
|
+
}
|
|
821
1876
|
}
|
|
1877
|
+
|
|
1878
|
+
utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
1879
|
+
|
|
1880
|
+
return this;
|
|
822
1881
|
}
|
|
1882
|
+
}
|
|
823
1883
|
|
|
824
|
-
|
|
1884
|
+
AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent']);
|
|
825
1885
|
|
|
826
|
-
|
|
1886
|
+
utils.freezeMethods(AxiosHeaders.prototype);
|
|
1887
|
+
utils.freezeMethods(AxiosHeaders);
|
|
1888
|
+
|
|
1889
|
+
/**
|
|
1890
|
+
* Transform the data for a request or a response
|
|
1891
|
+
*
|
|
1892
|
+
* @param {Array|Function} fns A single function or Array of functions
|
|
1893
|
+
* @param {?Object} response The response object
|
|
1894
|
+
*
|
|
1895
|
+
* @returns {*} The resulting transformed data
|
|
1896
|
+
*/
|
|
1897
|
+
function transformData(fns, response) {
|
|
1898
|
+
const config = this || defaults;
|
|
1899
|
+
const context = response || config;
|
|
1900
|
+
const headers = AxiosHeaders.from(context.headers);
|
|
1901
|
+
let data = context.data;
|
|
1902
|
+
|
|
1903
|
+
utils.forEach(fns, function transform(fn) {
|
|
1904
|
+
data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
|
|
1905
|
+
});
|
|
1906
|
+
|
|
1907
|
+
headers.normalize();
|
|
1908
|
+
|
|
1909
|
+
return data;
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
function isCancel(value) {
|
|
1913
|
+
return !!(value && value.__CANCEL__);
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1916
|
+
/**
|
|
1917
|
+
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
|
1918
|
+
*
|
|
1919
|
+
* @param {string=} message The message.
|
|
1920
|
+
* @param {Object=} config The config.
|
|
1921
|
+
* @param {Object=} request The request.
|
|
1922
|
+
*
|
|
1923
|
+
* @returns {CanceledError} The created error.
|
|
1924
|
+
*/
|
|
1925
|
+
function CanceledError(message, config, request) {
|
|
1926
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
1927
|
+
AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
|
|
1928
|
+
this.name = 'CanceledError';
|
|
827
1929
|
}
|
|
828
1930
|
|
|
829
|
-
|
|
1931
|
+
utils.inherits(CanceledError, AxiosError, {
|
|
1932
|
+
__CANCEL__: true
|
|
1933
|
+
});
|
|
1934
|
+
|
|
1935
|
+
// eslint-disable-next-line strict
|
|
1936
|
+
const httpAdapter = null;
|
|
830
1937
|
|
|
831
1938
|
/**
|
|
832
1939
|
* Resolve or reject a Promise based on response status.
|
|
@@ -834,97 +1941,99 @@ var toFormData_1 = toFormData;
|
|
|
834
1941
|
* @param {Function} resolve A function that resolves the promise.
|
|
835
1942
|
* @param {Function} reject A function that rejects the promise.
|
|
836
1943
|
* @param {object} response The response.
|
|
1944
|
+
*
|
|
1945
|
+
* @returns {object} The response.
|
|
837
1946
|
*/
|
|
838
|
-
|
|
839
|
-
|
|
1947
|
+
function settle(resolve, reject, response) {
|
|
1948
|
+
const validateStatus = response.config.validateStatus;
|
|
840
1949
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
841
1950
|
resolve(response);
|
|
842
1951
|
} else {
|
|
843
|
-
reject(new
|
|
1952
|
+
reject(new AxiosError(
|
|
844
1953
|
'Request failed with status code ' + response.status,
|
|
845
|
-
[
|
|
1954
|
+
[AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
|
846
1955
|
response.config,
|
|
847
1956
|
response.request,
|
|
848
1957
|
response
|
|
849
1958
|
));
|
|
850
1959
|
}
|
|
851
|
-
}
|
|
1960
|
+
}
|
|
852
1961
|
|
|
853
|
-
|
|
854
|
-
utils.isStandardBrowserEnv() ?
|
|
1962
|
+
const cookies = platform.isStandardBrowserEnv ?
|
|
855
1963
|
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
1964
|
+
// Standard browser envs support document.cookie
|
|
1965
|
+
(function standardBrowserEnv() {
|
|
1966
|
+
return {
|
|
1967
|
+
write: function write(name, value, expires, path, domain, secure) {
|
|
1968
|
+
const cookie = [];
|
|
1969
|
+
cookie.push(name + '=' + encodeURIComponent(value));
|
|
862
1970
|
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
1971
|
+
if (utils.isNumber(expires)) {
|
|
1972
|
+
cookie.push('expires=' + new Date(expires).toGMTString());
|
|
1973
|
+
}
|
|
866
1974
|
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
1975
|
+
if (utils.isString(path)) {
|
|
1976
|
+
cookie.push('path=' + path);
|
|
1977
|
+
}
|
|
870
1978
|
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
1979
|
+
if (utils.isString(domain)) {
|
|
1980
|
+
cookie.push('domain=' + domain);
|
|
1981
|
+
}
|
|
874
1982
|
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
1983
|
+
if (secure === true) {
|
|
1984
|
+
cookie.push('secure');
|
|
1985
|
+
}
|
|
878
1986
|
|
|
879
|
-
|
|
880
|
-
|
|
1987
|
+
document.cookie = cookie.join('; ');
|
|
1988
|
+
},
|
|
881
1989
|
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
1990
|
+
read: function read(name) {
|
|
1991
|
+
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
|
1992
|
+
return (match ? decodeURIComponent(match[3]) : null);
|
|
1993
|
+
},
|
|
886
1994
|
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
1995
|
+
remove: function remove(name) {
|
|
1996
|
+
this.write(name, '', Date.now() - 86400000);
|
|
1997
|
+
}
|
|
1998
|
+
};
|
|
1999
|
+
})() :
|
|
892
2000
|
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
);
|
|
2001
|
+
// Non standard browser env (web workers, react-native) lack needed support.
|
|
2002
|
+
(function nonStandardBrowserEnv() {
|
|
2003
|
+
return {
|
|
2004
|
+
write: function write() {},
|
|
2005
|
+
read: function read() { return null; },
|
|
2006
|
+
remove: function remove() {}
|
|
2007
|
+
};
|
|
2008
|
+
})();
|
|
902
2009
|
|
|
903
2010
|
/**
|
|
904
2011
|
* Determines whether the specified URL is absolute
|
|
905
2012
|
*
|
|
906
2013
|
* @param {string} url The URL to test
|
|
2014
|
+
*
|
|
907
2015
|
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
|
908
2016
|
*/
|
|
909
|
-
|
|
2017
|
+
function isAbsoluteURL(url) {
|
|
910
2018
|
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
|
911
2019
|
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
|
912
2020
|
// by any combination of letters, digits, plus, period, or hyphen.
|
|
913
2021
|
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
914
|
-
}
|
|
2022
|
+
}
|
|
915
2023
|
|
|
916
2024
|
/**
|
|
917
2025
|
* Creates a new URL by combining the specified URLs
|
|
918
2026
|
*
|
|
919
2027
|
* @param {string} baseURL The base URL
|
|
920
2028
|
* @param {string} relativeURL The relative URL
|
|
2029
|
+
*
|
|
921
2030
|
* @returns {string} The combined URL
|
|
922
2031
|
*/
|
|
923
|
-
|
|
2032
|
+
function combineURLs(baseURL, relativeURL) {
|
|
924
2033
|
return relativeURL
|
|
925
2034
|
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
|
926
2035
|
: baseURL;
|
|
927
|
-
}
|
|
2036
|
+
}
|
|
928
2037
|
|
|
929
2038
|
/**
|
|
930
2039
|
* Creates a new URL by combining the baseURL with the requestedURL,
|
|
@@ -933,159 +2042,173 @@ var combineURLs = function combineURLs(baseURL, relativeURL) {
|
|
|
933
2042
|
*
|
|
934
2043
|
* @param {string} baseURL The base URL
|
|
935
2044
|
* @param {string} requestedURL Absolute or relative URL to combine
|
|
2045
|
+
*
|
|
936
2046
|
* @returns {string} The combined full path
|
|
937
2047
|
*/
|
|
938
|
-
|
|
2048
|
+
function buildFullPath(baseURL, requestedURL) {
|
|
939
2049
|
if (baseURL && !isAbsoluteURL(requestedURL)) {
|
|
940
2050
|
return combineURLs(baseURL, requestedURL);
|
|
941
2051
|
}
|
|
942
2052
|
return requestedURL;
|
|
943
|
-
}
|
|
944
|
-
|
|
945
|
-
// Headers whose duplicates are ignored by node
|
|
946
|
-
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
947
|
-
var ignoreDuplicateOf = [
|
|
948
|
-
'age', 'authorization', 'content-length', 'content-type', 'etag',
|
|
949
|
-
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
|
|
950
|
-
'last-modified', 'location', 'max-forwards', 'proxy-authorization',
|
|
951
|
-
'referer', 'retry-after', 'user-agent'
|
|
952
|
-
];
|
|
953
|
-
|
|
954
|
-
/**
|
|
955
|
-
* Parse headers into an object
|
|
956
|
-
*
|
|
957
|
-
* ```
|
|
958
|
-
* Date: Wed, 27 Aug 2014 08:58:49 GMT
|
|
959
|
-
* Content-Type: application/json
|
|
960
|
-
* Connection: keep-alive
|
|
961
|
-
* Transfer-Encoding: chunked
|
|
962
|
-
* ```
|
|
963
|
-
*
|
|
964
|
-
* @param {String} headers Headers needing to be parsed
|
|
965
|
-
* @returns {Object} Headers parsed into an object
|
|
966
|
-
*/
|
|
967
|
-
var parseHeaders = function parseHeaders(headers) {
|
|
968
|
-
var parsed = {};
|
|
969
|
-
var key;
|
|
970
|
-
var val;
|
|
971
|
-
var i;
|
|
972
|
-
|
|
973
|
-
if (!headers) { return parsed; }
|
|
974
|
-
|
|
975
|
-
utils.forEach(headers.split('\n'), function parser(line) {
|
|
976
|
-
i = line.indexOf(':');
|
|
977
|
-
key = utils.trim(line.substr(0, i)).toLowerCase();
|
|
978
|
-
val = utils.trim(line.substr(i + 1));
|
|
979
|
-
|
|
980
|
-
if (key) {
|
|
981
|
-
if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
|
|
982
|
-
return;
|
|
983
|
-
}
|
|
984
|
-
if (key === 'set-cookie') {
|
|
985
|
-
parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
|
|
986
|
-
} else {
|
|
987
|
-
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
988
|
-
}
|
|
989
|
-
}
|
|
990
|
-
});
|
|
991
|
-
|
|
992
|
-
return parsed;
|
|
993
|
-
};
|
|
2053
|
+
}
|
|
994
2054
|
|
|
995
|
-
|
|
996
|
-
utils.isStandardBrowserEnv() ?
|
|
2055
|
+
const isURLSameOrigin = platform.isStandardBrowserEnv ?
|
|
997
2056
|
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
2057
|
+
// Standard browser envs have full support of the APIs needed to test
|
|
2058
|
+
// whether the request URL is of the same origin as current location.
|
|
2059
|
+
(function standardBrowserEnv() {
|
|
2060
|
+
const msie = /(msie|trident)/i.test(navigator.userAgent);
|
|
2061
|
+
const urlParsingNode = document.createElement('a');
|
|
2062
|
+
let originURL;
|
|
1004
2063
|
|
|
1005
|
-
|
|
2064
|
+
/**
|
|
1006
2065
|
* Parse a URL to discover it's components
|
|
1007
2066
|
*
|
|
1008
2067
|
* @param {String} url The URL to be parsed
|
|
1009
2068
|
* @returns {Object}
|
|
1010
2069
|
*/
|
|
1011
|
-
|
|
1012
|
-
|
|
2070
|
+
function resolveURL(url) {
|
|
2071
|
+
let href = url;
|
|
1013
2072
|
|
|
1014
|
-
|
|
2073
|
+
if (msie) {
|
|
1015
2074
|
// IE needs attribute set twice to normalize properties
|
|
1016
|
-
urlParsingNode.setAttribute('href', href);
|
|
1017
|
-
href = urlParsingNode.href;
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1020
2075
|
urlParsingNode.setAttribute('href', href);
|
|
1021
|
-
|
|
1022
|
-
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
|
|
1023
|
-
return {
|
|
1024
|
-
href: urlParsingNode.href,
|
|
1025
|
-
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
|
|
1026
|
-
host: urlParsingNode.host,
|
|
1027
|
-
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
|
|
1028
|
-
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
|
|
1029
|
-
hostname: urlParsingNode.hostname,
|
|
1030
|
-
port: urlParsingNode.port,
|
|
1031
|
-
pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
|
|
1032
|
-
urlParsingNode.pathname :
|
|
1033
|
-
'/' + urlParsingNode.pathname
|
|
1034
|
-
};
|
|
2076
|
+
href = urlParsingNode.href;
|
|
1035
2077
|
}
|
|
1036
2078
|
|
|
1037
|
-
|
|
2079
|
+
urlParsingNode.setAttribute('href', href);
|
|
2080
|
+
|
|
2081
|
+
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
|
|
2082
|
+
return {
|
|
2083
|
+
href: urlParsingNode.href,
|
|
2084
|
+
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
|
|
2085
|
+
host: urlParsingNode.host,
|
|
2086
|
+
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
|
|
2087
|
+
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
|
|
2088
|
+
hostname: urlParsingNode.hostname,
|
|
2089
|
+
port: urlParsingNode.port,
|
|
2090
|
+
pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
|
|
2091
|
+
urlParsingNode.pathname :
|
|
2092
|
+
'/' + urlParsingNode.pathname
|
|
2093
|
+
};
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2096
|
+
originURL = resolveURL(window.location.href);
|
|
1038
2097
|
|
|
1039
|
-
|
|
2098
|
+
/**
|
|
1040
2099
|
* Determine if a URL shares the same origin as the current location
|
|
1041
2100
|
*
|
|
1042
2101
|
* @param {String} requestURL The URL to test
|
|
1043
2102
|
* @returns {boolean} True if URL shares the same origin, otherwise false
|
|
1044
2103
|
*/
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
2104
|
+
return function isURLSameOrigin(requestURL) {
|
|
2105
|
+
const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
|
|
2106
|
+
return (parsed.protocol === originURL.protocol &&
|
|
2107
|
+
parsed.host === originURL.host);
|
|
2108
|
+
};
|
|
2109
|
+
})() :
|
|
1051
2110
|
|
|
1052
2111
|
// Non standard browser envs (web workers, react-native) lack needed support.
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
2112
|
+
(function nonStandardBrowserEnv() {
|
|
2113
|
+
return function isURLSameOrigin() {
|
|
2114
|
+
return true;
|
|
2115
|
+
};
|
|
2116
|
+
})();
|
|
2117
|
+
|
|
2118
|
+
function parseProtocol(url) {
|
|
2119
|
+
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
2120
|
+
return match && match[1] || '';
|
|
2121
|
+
}
|
|
1059
2122
|
|
|
1060
2123
|
/**
|
|
1061
|
-
*
|
|
1062
|
-
*
|
|
1063
|
-
* @
|
|
1064
|
-
* @
|
|
2124
|
+
* Calculate data maxRate
|
|
2125
|
+
* @param {Number} [samplesCount= 10]
|
|
2126
|
+
* @param {Number} [min= 1000]
|
|
2127
|
+
* @returns {Function}
|
|
1065
2128
|
*/
|
|
1066
|
-
function
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
2129
|
+
function speedometer(samplesCount, min) {
|
|
2130
|
+
samplesCount = samplesCount || 10;
|
|
2131
|
+
const bytes = new Array(samplesCount);
|
|
2132
|
+
const timestamps = new Array(samplesCount);
|
|
2133
|
+
let head = 0;
|
|
2134
|
+
let tail = 0;
|
|
2135
|
+
let firstSampleTS;
|
|
2136
|
+
|
|
2137
|
+
min = min !== undefined ? min : 1000;
|
|
2138
|
+
|
|
2139
|
+
return function push(chunkLength) {
|
|
2140
|
+
const now = Date.now();
|
|
2141
|
+
|
|
2142
|
+
const startedAt = timestamps[tail];
|
|
2143
|
+
|
|
2144
|
+
if (!firstSampleTS) {
|
|
2145
|
+
firstSampleTS = now;
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
bytes[head] = chunkLength;
|
|
2149
|
+
timestamps[head] = now;
|
|
2150
|
+
|
|
2151
|
+
let i = tail;
|
|
2152
|
+
let bytesCount = 0;
|
|
2153
|
+
|
|
2154
|
+
while (i !== head) {
|
|
2155
|
+
bytesCount += bytes[i++];
|
|
2156
|
+
i = i % samplesCount;
|
|
2157
|
+
}
|
|
2158
|
+
|
|
2159
|
+
head = (head + 1) % samplesCount;
|
|
2160
|
+
|
|
2161
|
+
if (head === tail) {
|
|
2162
|
+
tail = (tail + 1) % samplesCount;
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
if (now - firstSampleTS < min) {
|
|
2166
|
+
return;
|
|
2167
|
+
}
|
|
2168
|
+
|
|
2169
|
+
const passed = startedAt && now - startedAt;
|
|
2170
|
+
|
|
2171
|
+
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
|
2172
|
+
};
|
|
1070
2173
|
}
|
|
1071
2174
|
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
2175
|
+
function progressEventReducer(listener, isDownloadStream) {
|
|
2176
|
+
let bytesNotified = 0;
|
|
2177
|
+
const _speedometer = speedometer(50, 250);
|
|
2178
|
+
|
|
2179
|
+
return e => {
|
|
2180
|
+
const loaded = e.loaded;
|
|
2181
|
+
const total = e.lengthComputable ? e.total : undefined;
|
|
2182
|
+
const progressBytes = loaded - bytesNotified;
|
|
2183
|
+
const rate = _speedometer(progressBytes);
|
|
2184
|
+
const inRange = loaded <= total;
|
|
2185
|
+
|
|
2186
|
+
bytesNotified = loaded;
|
|
2187
|
+
|
|
2188
|
+
const data = {
|
|
2189
|
+
loaded,
|
|
2190
|
+
total,
|
|
2191
|
+
progress: total ? (loaded / total) : undefined,
|
|
2192
|
+
bytes: progressBytes,
|
|
2193
|
+
rate: rate ? rate : undefined,
|
|
2194
|
+
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
|
2195
|
+
event: e
|
|
2196
|
+
};
|
|
1075
2197
|
|
|
1076
|
-
|
|
2198
|
+
data[isDownloadStream ? 'download' : 'upload'] = true;
|
|
1077
2199
|
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
2200
|
+
listener(data);
|
|
2201
|
+
};
|
|
2202
|
+
}
|
|
2203
|
+
|
|
2204
|
+
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
|
1082
2205
|
|
|
1083
|
-
|
|
2206
|
+
const xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
1084
2207
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
2208
|
+
let requestData = config.data;
|
|
2209
|
+
const requestHeaders = AxiosHeaders.from(config.headers).normalize();
|
|
2210
|
+
const responseType = config.responseType;
|
|
2211
|
+
let onCanceled;
|
|
1089
2212
|
function done() {
|
|
1090
2213
|
if (config.cancelToken) {
|
|
1091
2214
|
config.cancelToken.unsubscribe(onCanceled);
|
|
@@ -1096,20 +2219,20 @@ var xhr = function xhrAdapter(config) {
|
|
|
1096
2219
|
}
|
|
1097
2220
|
}
|
|
1098
2221
|
|
|
1099
|
-
if (utils.isFormData(requestData) &&
|
|
1100
|
-
|
|
2222
|
+
if (utils.isFormData(requestData) && (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv)) {
|
|
2223
|
+
requestHeaders.setContentType(false); // Let the browser set it
|
|
1101
2224
|
}
|
|
1102
2225
|
|
|
1103
|
-
|
|
2226
|
+
let request = new XMLHttpRequest();
|
|
1104
2227
|
|
|
1105
2228
|
// HTTP basic authentication
|
|
1106
2229
|
if (config.auth) {
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
requestHeaders.Authorization
|
|
2230
|
+
const username = config.auth.username || '';
|
|
2231
|
+
const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
|
|
2232
|
+
requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
|
|
1110
2233
|
}
|
|
1111
2234
|
|
|
1112
|
-
|
|
2235
|
+
const fullPath = buildFullPath(config.baseURL, config.url);
|
|
1113
2236
|
|
|
1114
2237
|
request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
|
|
1115
2238
|
|
|
@@ -1121,16 +2244,18 @@ var xhr = function xhrAdapter(config) {
|
|
|
1121
2244
|
return;
|
|
1122
2245
|
}
|
|
1123
2246
|
// Prepare the response
|
|
1124
|
-
|
|
1125
|
-
|
|
2247
|
+
const responseHeaders = AxiosHeaders.from(
|
|
2248
|
+
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
|
2249
|
+
);
|
|
2250
|
+
const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
|
1126
2251
|
request.responseText : request.response;
|
|
1127
|
-
|
|
2252
|
+
const response = {
|
|
1128
2253
|
data: responseData,
|
|
1129
2254
|
status: request.status,
|
|
1130
2255
|
statusText: request.statusText,
|
|
1131
2256
|
headers: responseHeaders,
|
|
1132
|
-
config
|
|
1133
|
-
request
|
|
2257
|
+
config,
|
|
2258
|
+
request
|
|
1134
2259
|
};
|
|
1135
2260
|
|
|
1136
2261
|
settle(function _resolve(value) {
|
|
@@ -1174,7 +2299,7 @@ var xhr = function xhrAdapter(config) {
|
|
|
1174
2299
|
return;
|
|
1175
2300
|
}
|
|
1176
2301
|
|
|
1177
|
-
reject(new
|
|
2302
|
+
reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
|
|
1178
2303
|
|
|
1179
2304
|
// Clean up request
|
|
1180
2305
|
request = null;
|
|
@@ -1184,7 +2309,7 @@ var xhr = function xhrAdapter(config) {
|
|
|
1184
2309
|
request.onerror = function handleError() {
|
|
1185
2310
|
// Real errors are hidden from us by the browser
|
|
1186
2311
|
// onerror should only fire if it's a network error
|
|
1187
|
-
reject(new
|
|
2312
|
+
reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
|
|
1188
2313
|
|
|
1189
2314
|
// Clean up request
|
|
1190
2315
|
request = null;
|
|
@@ -1192,14 +2317,14 @@ var xhr = function xhrAdapter(config) {
|
|
|
1192
2317
|
|
|
1193
2318
|
// Handle timeout
|
|
1194
2319
|
request.ontimeout = function handleTimeout() {
|
|
1195
|
-
|
|
1196
|
-
|
|
2320
|
+
let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
2321
|
+
const transitional = config.transitional || transitionalDefaults;
|
|
1197
2322
|
if (config.timeoutErrorMessage) {
|
|
1198
2323
|
timeoutErrorMessage = config.timeoutErrorMessage;
|
|
1199
2324
|
}
|
|
1200
|
-
reject(new
|
|
2325
|
+
reject(new AxiosError(
|
|
1201
2326
|
timeoutErrorMessage,
|
|
1202
|
-
transitional
|
|
2327
|
+
transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
|
1203
2328
|
config,
|
|
1204
2329
|
request));
|
|
1205
2330
|
|
|
@@ -1210,27 +2335,23 @@ var xhr = function xhrAdapter(config) {
|
|
|
1210
2335
|
// Add xsrf header
|
|
1211
2336
|
// This is only done if running in a standard browser environment.
|
|
1212
2337
|
// Specifically not if we're in a web worker, or react-native.
|
|
1213
|
-
if (
|
|
2338
|
+
if (platform.isStandardBrowserEnv) {
|
|
1214
2339
|
// Add xsrf header
|
|
1215
|
-
|
|
1216
|
-
cookies.read(config.xsrfCookieName)
|
|
1217
|
-
undefined;
|
|
2340
|
+
const xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath))
|
|
2341
|
+
&& config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
|
1218
2342
|
|
|
1219
2343
|
if (xsrfValue) {
|
|
1220
|
-
requestHeaders
|
|
2344
|
+
requestHeaders.set(config.xsrfHeaderName, xsrfValue);
|
|
1221
2345
|
}
|
|
1222
2346
|
}
|
|
1223
2347
|
|
|
2348
|
+
// Remove Content-Type if data is undefined
|
|
2349
|
+
requestData === undefined && requestHeaders.setContentType(null);
|
|
2350
|
+
|
|
1224
2351
|
// Add headers to the request
|
|
1225
2352
|
if ('setRequestHeader' in request) {
|
|
1226
|
-
utils.forEach(requestHeaders, function setRequestHeader(val, key) {
|
|
1227
|
-
|
|
1228
|
-
// Remove Content-Type if data is undefined
|
|
1229
|
-
delete requestHeaders[key];
|
|
1230
|
-
} else {
|
|
1231
|
-
// Otherwise add header to the request
|
|
1232
|
-
request.setRequestHeader(key, val);
|
|
1233
|
-
}
|
|
2353
|
+
utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
|
2354
|
+
request.setRequestHeader(key, val);
|
|
1234
2355
|
});
|
|
1235
2356
|
}
|
|
1236
2357
|
|
|
@@ -1246,215 +2367,106 @@ var xhr = function xhrAdapter(config) {
|
|
|
1246
2367
|
|
|
1247
2368
|
// Handle progress if needed
|
|
1248
2369
|
if (typeof config.onDownloadProgress === 'function') {
|
|
1249
|
-
request.addEventListener('progress', config.onDownloadProgress);
|
|
1250
|
-
}
|
|
1251
|
-
|
|
1252
|
-
// Not all browsers support upload events
|
|
1253
|
-
if (typeof config.onUploadProgress === 'function' && request.upload) {
|
|
1254
|
-
request.upload.addEventListener('progress', config.onUploadProgress);
|
|
1255
|
-
}
|
|
1256
|
-
|
|
1257
|
-
if (config.cancelToken || config.signal) {
|
|
1258
|
-
// Handle cancellation
|
|
1259
|
-
// eslint-disable-next-line func-names
|
|
1260
|
-
onCanceled = function(cancel) {
|
|
1261
|
-
if (!request) {
|
|
1262
|
-
return;
|
|
1263
|
-
}
|
|
1264
|
-
reject(!cancel || (cancel && cancel.type) ? new CanceledError_1() : cancel);
|
|
1265
|
-
request.abort();
|
|
1266
|
-
request = null;
|
|
1267
|
-
};
|
|
1268
|
-
|
|
1269
|
-
config.cancelToken && config.cancelToken.subscribe(onCanceled);
|
|
1270
|
-
if (config.signal) {
|
|
1271
|
-
config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
|
|
1272
|
-
}
|
|
1273
|
-
}
|
|
1274
|
-
|
|
1275
|
-
if (!requestData) {
|
|
1276
|
-
requestData = null;
|
|
1277
|
-
}
|
|
1278
|
-
|
|
1279
|
-
var protocol = parseProtocol(fullPath);
|
|
1280
|
-
|
|
1281
|
-
if (protocol && [ 'http', 'https', 'file' ].indexOf(protocol) === -1) {
|
|
1282
|
-
reject(new AxiosError_1('Unsupported protocol ' + protocol + ':', AxiosError_1.ERR_BAD_REQUEST, config));
|
|
1283
|
-
return;
|
|
1284
|
-
}
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
// Send the request
|
|
1288
|
-
request.send(requestData);
|
|
1289
|
-
});
|
|
1290
|
-
};
|
|
1291
|
-
|
|
1292
|
-
// eslint-disable-next-line strict
|
|
1293
|
-
var _null = null;
|
|
1294
|
-
|
|
1295
|
-
var DEFAULT_CONTENT_TYPE = {
|
|
1296
|
-
'Content-Type': 'application/x-www-form-urlencoded'
|
|
1297
|
-
};
|
|
1298
|
-
|
|
1299
|
-
function setContentTypeIfUnset(headers, value) {
|
|
1300
|
-
if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
|
|
1301
|
-
headers['Content-Type'] = value;
|
|
1302
|
-
}
|
|
1303
|
-
}
|
|
1304
|
-
|
|
1305
|
-
function getDefaultAdapter() {
|
|
1306
|
-
var adapter;
|
|
1307
|
-
if (typeof XMLHttpRequest !== 'undefined') {
|
|
1308
|
-
// For browsers use XHR adapter
|
|
1309
|
-
adapter = xhr;
|
|
1310
|
-
} else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
|
|
1311
|
-
// For node use HTTP adapter
|
|
1312
|
-
adapter = xhr;
|
|
1313
|
-
}
|
|
1314
|
-
return adapter;
|
|
1315
|
-
}
|
|
1316
|
-
|
|
1317
|
-
function stringifySafely(rawValue, parser, encoder) {
|
|
1318
|
-
if (utils.isString(rawValue)) {
|
|
1319
|
-
try {
|
|
1320
|
-
(parser || JSON.parse)(rawValue);
|
|
1321
|
-
return utils.trim(rawValue);
|
|
1322
|
-
} catch (e) {
|
|
1323
|
-
if (e.name !== 'SyntaxError') {
|
|
1324
|
-
throw e;
|
|
1325
|
-
}
|
|
1326
|
-
}
|
|
1327
|
-
}
|
|
1328
|
-
|
|
1329
|
-
return (encoder || JSON.stringify)(rawValue);
|
|
1330
|
-
}
|
|
1331
|
-
|
|
1332
|
-
var defaults = {
|
|
1333
|
-
|
|
1334
|
-
transitional: transitional,
|
|
1335
|
-
|
|
1336
|
-
adapter: getDefaultAdapter(),
|
|
1337
|
-
|
|
1338
|
-
transformRequest: [function transformRequest(data, headers) {
|
|
1339
|
-
normalizeHeaderName(headers, 'Accept');
|
|
1340
|
-
normalizeHeaderName(headers, 'Content-Type');
|
|
1341
|
-
|
|
1342
|
-
if (utils.isFormData(data) ||
|
|
1343
|
-
utils.isArrayBuffer(data) ||
|
|
1344
|
-
utils.isBuffer(data) ||
|
|
1345
|
-
utils.isStream(data) ||
|
|
1346
|
-
utils.isFile(data) ||
|
|
1347
|
-
utils.isBlob(data)
|
|
1348
|
-
) {
|
|
1349
|
-
return data;
|
|
1350
|
-
}
|
|
1351
|
-
if (utils.isArrayBufferView(data)) {
|
|
1352
|
-
return data.buffer;
|
|
1353
|
-
}
|
|
1354
|
-
if (utils.isURLSearchParams(data)) {
|
|
1355
|
-
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
|
|
1356
|
-
return data.toString();
|
|
1357
|
-
}
|
|
1358
|
-
|
|
1359
|
-
var isObjectPayload = utils.isObject(data);
|
|
1360
|
-
var contentType = headers && headers['Content-Type'];
|
|
1361
|
-
|
|
1362
|
-
var isFileList;
|
|
1363
|
-
|
|
1364
|
-
if ((isFileList = utils.isFileList(data)) || (isObjectPayload && contentType === 'multipart/form-data')) {
|
|
1365
|
-
var _FormData = this.env && this.env.FormData;
|
|
1366
|
-
return toFormData_1(isFileList ? {'files[]': data} : data, _FormData && new _FormData());
|
|
1367
|
-
} else if (isObjectPayload || contentType === 'application/json') {
|
|
1368
|
-
setContentTypeIfUnset(headers, 'application/json');
|
|
1369
|
-
return stringifySafely(data);
|
|
2370
|
+
request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
|
|
1370
2371
|
}
|
|
1371
2372
|
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
var transitional = this.transitional || defaults.transitional;
|
|
1377
|
-
var silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
1378
|
-
var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
1379
|
-
var strictJSONParsing = !silentJSONParsing && this.responseType === 'json';
|
|
2373
|
+
// Not all browsers support upload events
|
|
2374
|
+
if (typeof config.onUploadProgress === 'function' && request.upload) {
|
|
2375
|
+
request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
|
|
2376
|
+
}
|
|
1380
2377
|
|
|
1381
|
-
if (
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
if (
|
|
1386
|
-
|
|
1387
|
-
throw AxiosError_1.from(e, AxiosError_1.ERR_BAD_RESPONSE, this, null, this.response);
|
|
1388
|
-
}
|
|
1389
|
-
throw e;
|
|
2378
|
+
if (config.cancelToken || config.signal) {
|
|
2379
|
+
// Handle cancellation
|
|
2380
|
+
// eslint-disable-next-line func-names
|
|
2381
|
+
onCanceled = cancel => {
|
|
2382
|
+
if (!request) {
|
|
2383
|
+
return;
|
|
1390
2384
|
}
|
|
2385
|
+
reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
|
|
2386
|
+
request.abort();
|
|
2387
|
+
request = null;
|
|
2388
|
+
};
|
|
2389
|
+
|
|
2390
|
+
config.cancelToken && config.cancelToken.subscribe(onCanceled);
|
|
2391
|
+
if (config.signal) {
|
|
2392
|
+
config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
|
|
1391
2393
|
}
|
|
1392
2394
|
}
|
|
1393
2395
|
|
|
1394
|
-
|
|
1395
|
-
}],
|
|
1396
|
-
|
|
1397
|
-
/**
|
|
1398
|
-
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
1399
|
-
* timeout is not created.
|
|
1400
|
-
*/
|
|
1401
|
-
timeout: 0,
|
|
2396
|
+
const protocol = parseProtocol(fullPath);
|
|
1402
2397
|
|
|
1403
|
-
|
|
1404
|
-
|
|
2398
|
+
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
2399
|
+
reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
|
|
2400
|
+
return;
|
|
2401
|
+
}
|
|
1405
2402
|
|
|
1406
|
-
maxContentLength: -1,
|
|
1407
|
-
maxBodyLength: -1,
|
|
1408
2403
|
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
}
|
|
2404
|
+
// Send the request
|
|
2405
|
+
request.send(requestData || null);
|
|
2406
|
+
});
|
|
2407
|
+
};
|
|
1412
2408
|
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
2409
|
+
const knownAdapters = {
|
|
2410
|
+
http: httpAdapter,
|
|
2411
|
+
xhr: xhrAdapter
|
|
2412
|
+
};
|
|
1416
2413
|
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
2414
|
+
utils.forEach(knownAdapters, (fn, value) => {
|
|
2415
|
+
if(fn) {
|
|
2416
|
+
try {
|
|
2417
|
+
Object.defineProperty(fn, 'name', {value});
|
|
2418
|
+
} catch (e) {
|
|
2419
|
+
// eslint-disable-next-line no-empty
|
|
1420
2420
|
}
|
|
2421
|
+
Object.defineProperty(fn, 'adapterName', {value});
|
|
1421
2422
|
}
|
|
1422
|
-
};
|
|
1423
|
-
|
|
1424
|
-
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
|
|
1425
|
-
defaults.headers[method] = {};
|
|
1426
2423
|
});
|
|
1427
2424
|
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
2425
|
+
const adapters = {
|
|
2426
|
+
getAdapter: (adapters) => {
|
|
2427
|
+
adapters = utils.isArray(adapters) ? adapters : [adapters];
|
|
1431
2428
|
|
|
1432
|
-
|
|
2429
|
+
const {length} = adapters;
|
|
2430
|
+
let nameOrAdapter;
|
|
2431
|
+
let adapter;
|
|
1433
2432
|
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
* @returns {*} The resulting transformed data
|
|
1441
|
-
*/
|
|
1442
|
-
var transformData = function transformData(data, headers, fns) {
|
|
1443
|
-
var context = this || defaults_1;
|
|
1444
|
-
/*eslint no-param-reassign:0*/
|
|
1445
|
-
utils.forEach(fns, function transform(fn) {
|
|
1446
|
-
data = fn.call(context, data, headers);
|
|
1447
|
-
});
|
|
2433
|
+
for (let i = 0; i < length; i++) {
|
|
2434
|
+
nameOrAdapter = adapters[i];
|
|
2435
|
+
if((adapter = utils.isString(nameOrAdapter) ? knownAdapters[nameOrAdapter.toLowerCase()] : nameOrAdapter)) {
|
|
2436
|
+
break;
|
|
2437
|
+
}
|
|
2438
|
+
}
|
|
1448
2439
|
|
|
1449
|
-
|
|
1450
|
-
|
|
2440
|
+
if (!adapter) {
|
|
2441
|
+
if (adapter === false) {
|
|
2442
|
+
throw new AxiosError(
|
|
2443
|
+
`Adapter ${nameOrAdapter} is not supported by the environment`,
|
|
2444
|
+
'ERR_NOT_SUPPORT'
|
|
2445
|
+
);
|
|
2446
|
+
}
|
|
1451
2447
|
|
|
1452
|
-
|
|
1453
|
-
|
|
2448
|
+
throw new Error(
|
|
2449
|
+
utils.hasOwnProp(knownAdapters, nameOrAdapter) ?
|
|
2450
|
+
`Adapter '${nameOrAdapter}' is not available in the build` :
|
|
2451
|
+
`Unknown adapter '${nameOrAdapter}'`
|
|
2452
|
+
);
|
|
2453
|
+
}
|
|
2454
|
+
|
|
2455
|
+
if (!utils.isFunction(adapter)) {
|
|
2456
|
+
throw new TypeError('adapter is not a function');
|
|
2457
|
+
}
|
|
2458
|
+
|
|
2459
|
+
return adapter;
|
|
2460
|
+
},
|
|
2461
|
+
adapters: knownAdapters
|
|
1454
2462
|
};
|
|
1455
2463
|
|
|
1456
2464
|
/**
|
|
1457
2465
|
* Throws a `CanceledError` if cancellation has been requested.
|
|
2466
|
+
*
|
|
2467
|
+
* @param {Object} config The config that is to be used for the request
|
|
2468
|
+
*
|
|
2469
|
+
* @returns {void}
|
|
1458
2470
|
*/
|
|
1459
2471
|
function throwIfCancellationRequested(config) {
|
|
1460
2472
|
if (config.cancelToken) {
|
|
@@ -1462,7 +2474,7 @@ function throwIfCancellationRequested(config) {
|
|
|
1462
2474
|
}
|
|
1463
2475
|
|
|
1464
2476
|
if (config.signal && config.signal.aborted) {
|
|
1465
|
-
throw new
|
|
2477
|
+
throw new CanceledError(null, config);
|
|
1466
2478
|
}
|
|
1467
2479
|
}
|
|
1468
2480
|
|
|
@@ -1470,37 +2482,25 @@ function throwIfCancellationRequested(config) {
|
|
|
1470
2482
|
* Dispatch a request to the server using the configured adapter.
|
|
1471
2483
|
*
|
|
1472
2484
|
* @param {object} config The config that is to be used for the request
|
|
2485
|
+
*
|
|
1473
2486
|
* @returns {Promise} The Promise to be fulfilled
|
|
1474
2487
|
*/
|
|
1475
|
-
|
|
2488
|
+
function dispatchRequest(config) {
|
|
1476
2489
|
throwIfCancellationRequested(config);
|
|
1477
2490
|
|
|
1478
|
-
|
|
1479
|
-
config.headers = config.headers || {};
|
|
2491
|
+
config.headers = AxiosHeaders.from(config.headers);
|
|
1480
2492
|
|
|
1481
2493
|
// Transform request data
|
|
1482
2494
|
config.data = transformData.call(
|
|
1483
2495
|
config,
|
|
1484
|
-
config.data,
|
|
1485
|
-
config.headers,
|
|
1486
2496
|
config.transformRequest
|
|
1487
2497
|
);
|
|
1488
2498
|
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
config.headers[config.method] || {},
|
|
1493
|
-
config.headers
|
|
1494
|
-
);
|
|
1495
|
-
|
|
1496
|
-
utils.forEach(
|
|
1497
|
-
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
|
1498
|
-
function cleanHeaderConfig(method) {
|
|
1499
|
-
delete config.headers[method];
|
|
1500
|
-
}
|
|
1501
|
-
);
|
|
2499
|
+
if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
|
|
2500
|
+
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
|
2501
|
+
}
|
|
1502
2502
|
|
|
1503
|
-
|
|
2503
|
+
const adapter = adapters.getAdapter(config.adapter || defaults.adapter);
|
|
1504
2504
|
|
|
1505
2505
|
return adapter(config).then(function onAdapterResolution(response) {
|
|
1506
2506
|
throwIfCancellationRequested(config);
|
|
@@ -1508,11 +2508,12 @@ var dispatchRequest = function dispatchRequest(config) {
|
|
|
1508
2508
|
// Transform response data
|
|
1509
2509
|
response.data = transformData.call(
|
|
1510
2510
|
config,
|
|
1511
|
-
|
|
1512
|
-
response
|
|
1513
|
-
config.transformResponse
|
|
2511
|
+
config.transformResponse,
|
|
2512
|
+
response
|
|
1514
2513
|
);
|
|
1515
2514
|
|
|
2515
|
+
response.headers = AxiosHeaders.from(response.headers);
|
|
2516
|
+
|
|
1516
2517
|
return response;
|
|
1517
2518
|
}, function onAdapterRejection(reason) {
|
|
1518
2519
|
if (!isCancel(reason)) {
|
|
@@ -1522,16 +2523,18 @@ var dispatchRequest = function dispatchRequest(config) {
|
|
|
1522
2523
|
if (reason && reason.response) {
|
|
1523
2524
|
reason.response.data = transformData.call(
|
|
1524
2525
|
config,
|
|
1525
|
-
|
|
1526
|
-
reason.response
|
|
1527
|
-
config.transformResponse
|
|
2526
|
+
config.transformResponse,
|
|
2527
|
+
reason.response
|
|
1528
2528
|
);
|
|
2529
|
+
reason.response.headers = AxiosHeaders.from(reason.response.headers);
|
|
1529
2530
|
}
|
|
1530
2531
|
}
|
|
1531
2532
|
|
|
1532
2533
|
return Promise.reject(reason);
|
|
1533
2534
|
});
|
|
1534
|
-
}
|
|
2535
|
+
}
|
|
2536
|
+
|
|
2537
|
+
const headersToObject = (thing) => thing instanceof AxiosHeaders ? thing.toJSON() : thing;
|
|
1535
2538
|
|
|
1536
2539
|
/**
|
|
1537
2540
|
* Config-specific merge-function which creates a new config-object
|
|
@@ -1539,16 +2542,17 @@ var dispatchRequest = function dispatchRequest(config) {
|
|
|
1539
2542
|
*
|
|
1540
2543
|
* @param {Object} config1
|
|
1541
2544
|
* @param {Object} config2
|
|
2545
|
+
*
|
|
1542
2546
|
* @returns {Object} New object resulting from merging config2 to config1
|
|
1543
2547
|
*/
|
|
1544
|
-
|
|
2548
|
+
function mergeConfig(config1, config2) {
|
|
1545
2549
|
// eslint-disable-next-line no-param-reassign
|
|
1546
2550
|
config2 = config2 || {};
|
|
1547
|
-
|
|
2551
|
+
const config = {};
|
|
1548
2552
|
|
|
1549
|
-
function getMergedValue(target, source) {
|
|
2553
|
+
function getMergedValue(target, source, caseless) {
|
|
1550
2554
|
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
|
1551
|
-
return utils.merge(target, source);
|
|
2555
|
+
return utils.merge.call({caseless}, target, source);
|
|
1552
2556
|
} else if (utils.isPlainObject(source)) {
|
|
1553
2557
|
return utils.merge({}, source);
|
|
1554
2558
|
} else if (utils.isArray(source)) {
|
|
@@ -1558,101 +2562,99 @@ var mergeConfig = function mergeConfig(config1, config2) {
|
|
|
1558
2562
|
}
|
|
1559
2563
|
|
|
1560
2564
|
// eslint-disable-next-line consistent-return
|
|
1561
|
-
function mergeDeepProperties(
|
|
1562
|
-
if (!utils.isUndefined(
|
|
1563
|
-
return getMergedValue(
|
|
1564
|
-
} else if (!utils.isUndefined(
|
|
1565
|
-
return getMergedValue(undefined,
|
|
2565
|
+
function mergeDeepProperties(a, b, caseless) {
|
|
2566
|
+
if (!utils.isUndefined(b)) {
|
|
2567
|
+
return getMergedValue(a, b, caseless);
|
|
2568
|
+
} else if (!utils.isUndefined(a)) {
|
|
2569
|
+
return getMergedValue(undefined, a, caseless);
|
|
1566
2570
|
}
|
|
1567
2571
|
}
|
|
1568
2572
|
|
|
1569
2573
|
// eslint-disable-next-line consistent-return
|
|
1570
|
-
function valueFromConfig2(
|
|
1571
|
-
if (!utils.isUndefined(
|
|
1572
|
-
return getMergedValue(undefined,
|
|
2574
|
+
function valueFromConfig2(a, b) {
|
|
2575
|
+
if (!utils.isUndefined(b)) {
|
|
2576
|
+
return getMergedValue(undefined, b);
|
|
1573
2577
|
}
|
|
1574
2578
|
}
|
|
1575
2579
|
|
|
1576
2580
|
// eslint-disable-next-line consistent-return
|
|
1577
|
-
function defaultToConfig2(
|
|
1578
|
-
if (!utils.isUndefined(
|
|
1579
|
-
return getMergedValue(undefined,
|
|
1580
|
-
} else if (!utils.isUndefined(
|
|
1581
|
-
return getMergedValue(undefined,
|
|
2581
|
+
function defaultToConfig2(a, b) {
|
|
2582
|
+
if (!utils.isUndefined(b)) {
|
|
2583
|
+
return getMergedValue(undefined, b);
|
|
2584
|
+
} else if (!utils.isUndefined(a)) {
|
|
2585
|
+
return getMergedValue(undefined, a);
|
|
1582
2586
|
}
|
|
1583
2587
|
}
|
|
1584
2588
|
|
|
1585
2589
|
// eslint-disable-next-line consistent-return
|
|
1586
|
-
function mergeDirectKeys(prop) {
|
|
2590
|
+
function mergeDirectKeys(a, b, prop) {
|
|
1587
2591
|
if (prop in config2) {
|
|
1588
|
-
return getMergedValue(
|
|
2592
|
+
return getMergedValue(a, b);
|
|
1589
2593
|
} else if (prop in config1) {
|
|
1590
|
-
return getMergedValue(undefined,
|
|
1591
|
-
}
|
|
1592
|
-
}
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
2594
|
+
return getMergedValue(undefined, a);
|
|
2595
|
+
}
|
|
2596
|
+
}
|
|
2597
|
+
|
|
2598
|
+
const mergeMap = {
|
|
2599
|
+
url: valueFromConfig2,
|
|
2600
|
+
method: valueFromConfig2,
|
|
2601
|
+
data: valueFromConfig2,
|
|
2602
|
+
baseURL: defaultToConfig2,
|
|
2603
|
+
transformRequest: defaultToConfig2,
|
|
2604
|
+
transformResponse: defaultToConfig2,
|
|
2605
|
+
paramsSerializer: defaultToConfig2,
|
|
2606
|
+
timeout: defaultToConfig2,
|
|
2607
|
+
timeoutMessage: defaultToConfig2,
|
|
2608
|
+
withCredentials: defaultToConfig2,
|
|
2609
|
+
adapter: defaultToConfig2,
|
|
2610
|
+
responseType: defaultToConfig2,
|
|
2611
|
+
xsrfCookieName: defaultToConfig2,
|
|
2612
|
+
xsrfHeaderName: defaultToConfig2,
|
|
2613
|
+
onUploadProgress: defaultToConfig2,
|
|
2614
|
+
onDownloadProgress: defaultToConfig2,
|
|
2615
|
+
decompress: defaultToConfig2,
|
|
2616
|
+
maxContentLength: defaultToConfig2,
|
|
2617
|
+
maxBodyLength: defaultToConfig2,
|
|
2618
|
+
beforeRedirect: defaultToConfig2,
|
|
2619
|
+
transport: defaultToConfig2,
|
|
2620
|
+
httpAgent: defaultToConfig2,
|
|
2621
|
+
httpsAgent: defaultToConfig2,
|
|
2622
|
+
cancelToken: defaultToConfig2,
|
|
2623
|
+
socketPath: defaultToConfig2,
|
|
2624
|
+
responseEncoding: defaultToConfig2,
|
|
2625
|
+
validateStatus: mergeDirectKeys,
|
|
2626
|
+
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
|
1622
2627
|
};
|
|
1623
2628
|
|
|
1624
2629
|
utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
|
|
1625
|
-
|
|
1626
|
-
|
|
2630
|
+
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
2631
|
+
const configValue = merge(config1[prop], config2[prop], prop);
|
|
1627
2632
|
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
1628
2633
|
});
|
|
1629
2634
|
|
|
1630
2635
|
return config;
|
|
1631
|
-
}
|
|
1632
|
-
|
|
1633
|
-
var data = {
|
|
1634
|
-
"version": "0.27.2"
|
|
1635
|
-
};
|
|
1636
|
-
|
|
1637
|
-
var VERSION = data.version;
|
|
2636
|
+
}
|
|
1638
2637
|
|
|
2638
|
+
const VERSION = "1.2.2";
|
|
1639
2639
|
|
|
1640
|
-
|
|
2640
|
+
const validators$1 = {};
|
|
1641
2641
|
|
|
1642
2642
|
// eslint-disable-next-line func-names
|
|
1643
|
-
['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(
|
|
2643
|
+
['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {
|
|
1644
2644
|
validators$1[type] = function validator(thing) {
|
|
1645
2645
|
return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
|
|
1646
2646
|
};
|
|
1647
2647
|
});
|
|
1648
2648
|
|
|
1649
|
-
|
|
2649
|
+
const deprecatedWarnings = {};
|
|
1650
2650
|
|
|
1651
2651
|
/**
|
|
1652
2652
|
* Transitional option validator
|
|
2653
|
+
*
|
|
1653
2654
|
* @param {function|boolean?} validator - set to false if the transitional option has been removed
|
|
1654
2655
|
* @param {string?} version - deprecated version / removed since version
|
|
1655
2656
|
* @param {string?} message - some message with additional info
|
|
2657
|
+
*
|
|
1656
2658
|
* @returns {function}
|
|
1657
2659
|
*/
|
|
1658
2660
|
validators$1.transitional = function transitional(validator, version, message) {
|
|
@@ -1661,11 +2663,11 @@ validators$1.transitional = function transitional(validator, version, message) {
|
|
|
1661
2663
|
}
|
|
1662
2664
|
|
|
1663
2665
|
// eslint-disable-next-line func-names
|
|
1664
|
-
return
|
|
2666
|
+
return (value, opt, opts) => {
|
|
1665
2667
|
if (validator === false) {
|
|
1666
|
-
throw new
|
|
2668
|
+
throw new AxiosError(
|
|
1667
2669
|
formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
|
|
1668
|
-
|
|
2670
|
+
AxiosError.ERR_DEPRECATED
|
|
1669
2671
|
);
|
|
1670
2672
|
}
|
|
1671
2673
|
|
|
@@ -1686,162 +2688,201 @@ validators$1.transitional = function transitional(validator, version, message) {
|
|
|
1686
2688
|
|
|
1687
2689
|
/**
|
|
1688
2690
|
* Assert object's properties type
|
|
2691
|
+
*
|
|
1689
2692
|
* @param {object} options
|
|
1690
2693
|
* @param {object} schema
|
|
1691
2694
|
* @param {boolean?} allowUnknown
|
|
2695
|
+
*
|
|
2696
|
+
* @returns {object}
|
|
1692
2697
|
*/
|
|
1693
2698
|
|
|
1694
2699
|
function assertOptions(options, schema, allowUnknown) {
|
|
1695
2700
|
if (typeof options !== 'object') {
|
|
1696
|
-
throw new
|
|
2701
|
+
throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
|
|
1697
2702
|
}
|
|
1698
|
-
|
|
1699
|
-
|
|
2703
|
+
const keys = Object.keys(options);
|
|
2704
|
+
let i = keys.length;
|
|
1700
2705
|
while (i-- > 0) {
|
|
1701
|
-
|
|
1702
|
-
|
|
2706
|
+
const opt = keys[i];
|
|
2707
|
+
const validator = schema[opt];
|
|
1703
2708
|
if (validator) {
|
|
1704
|
-
|
|
1705
|
-
|
|
2709
|
+
const value = options[opt];
|
|
2710
|
+
const result = value === undefined || validator(value, opt, options);
|
|
1706
2711
|
if (result !== true) {
|
|
1707
|
-
throw new
|
|
2712
|
+
throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
|
|
1708
2713
|
}
|
|
1709
2714
|
continue;
|
|
1710
2715
|
}
|
|
1711
2716
|
if (allowUnknown !== true) {
|
|
1712
|
-
throw new
|
|
2717
|
+
throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
|
|
1713
2718
|
}
|
|
1714
2719
|
}
|
|
1715
2720
|
}
|
|
1716
2721
|
|
|
1717
|
-
|
|
1718
|
-
assertOptions
|
|
2722
|
+
const validator = {
|
|
2723
|
+
assertOptions,
|
|
1719
2724
|
validators: validators$1
|
|
1720
2725
|
};
|
|
1721
2726
|
|
|
1722
|
-
|
|
2727
|
+
const validators = validator.validators;
|
|
2728
|
+
|
|
1723
2729
|
/**
|
|
1724
2730
|
* Create a new instance of Axios
|
|
1725
2731
|
*
|
|
1726
2732
|
* @param {Object} instanceConfig The default config for the instance
|
|
1727
|
-
*/
|
|
1728
|
-
function Axios(instanceConfig) {
|
|
1729
|
-
this.defaults = instanceConfig;
|
|
1730
|
-
this.interceptors = {
|
|
1731
|
-
request: new InterceptorManager_1(),
|
|
1732
|
-
response: new InterceptorManager_1()
|
|
1733
|
-
};
|
|
1734
|
-
}
|
|
1735
|
-
|
|
1736
|
-
/**
|
|
1737
|
-
* Dispatch a request
|
|
1738
2733
|
*
|
|
1739
|
-
* @
|
|
2734
|
+
* @return {Axios} A new instance of Axios
|
|
1740
2735
|
*/
|
|
1741
|
-
Axios
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
config = configOrUrl || {};
|
|
2736
|
+
class Axios {
|
|
2737
|
+
constructor(instanceConfig) {
|
|
2738
|
+
this.defaults = instanceConfig;
|
|
2739
|
+
this.interceptors = {
|
|
2740
|
+
request: new InterceptorManager(),
|
|
2741
|
+
response: new InterceptorManager()
|
|
2742
|
+
};
|
|
1749
2743
|
}
|
|
1750
2744
|
|
|
1751
|
-
|
|
2745
|
+
/**
|
|
2746
|
+
* Dispatch a request
|
|
2747
|
+
*
|
|
2748
|
+
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
|
|
2749
|
+
* @param {?Object} config
|
|
2750
|
+
*
|
|
2751
|
+
* @returns {Promise} The Promise to be fulfilled
|
|
2752
|
+
*/
|
|
2753
|
+
request(configOrUrl, config) {
|
|
2754
|
+
/*eslint no-param-reassign:0*/
|
|
2755
|
+
// Allow for axios('example/url'[, config]) a la fetch API
|
|
2756
|
+
if (typeof configOrUrl === 'string') {
|
|
2757
|
+
config = config || {};
|
|
2758
|
+
config.url = configOrUrl;
|
|
2759
|
+
} else {
|
|
2760
|
+
config = configOrUrl || {};
|
|
2761
|
+
}
|
|
1752
2762
|
|
|
1753
|
-
|
|
1754
|
-
if (config.method) {
|
|
1755
|
-
config.method = config.method.toLowerCase();
|
|
1756
|
-
} else if (this.defaults.method) {
|
|
1757
|
-
config.method = this.defaults.method.toLowerCase();
|
|
1758
|
-
} else {
|
|
1759
|
-
config.method = 'get';
|
|
1760
|
-
}
|
|
2763
|
+
config = mergeConfig(this.defaults, config);
|
|
1761
2764
|
|
|
1762
|
-
|
|
2765
|
+
const {transitional, paramsSerializer, headers} = config;
|
|
1763
2766
|
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
2767
|
+
if (transitional !== undefined) {
|
|
2768
|
+
validator.assertOptions(transitional, {
|
|
2769
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
|
2770
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
2771
|
+
clarifyTimeoutError: validators.transitional(validators.boolean)
|
|
2772
|
+
}, false);
|
|
2773
|
+
}
|
|
1771
2774
|
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
return;
|
|
2775
|
+
if (paramsSerializer !== undefined) {
|
|
2776
|
+
validator.assertOptions(paramsSerializer, {
|
|
2777
|
+
encode: validators.function,
|
|
2778
|
+
serialize: validators.function
|
|
2779
|
+
}, true);
|
|
1778
2780
|
}
|
|
1779
2781
|
|
|
1780
|
-
|
|
2782
|
+
// Set config.method
|
|
2783
|
+
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
|
1781
2784
|
|
|
1782
|
-
|
|
1783
|
-
});
|
|
2785
|
+
let contextHeaders;
|
|
1784
2786
|
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
2787
|
+
// Flatten headers
|
|
2788
|
+
contextHeaders = headers && utils.merge(
|
|
2789
|
+
headers.common,
|
|
2790
|
+
headers[config.method]
|
|
2791
|
+
);
|
|
2792
|
+
|
|
2793
|
+
contextHeaders && utils.forEach(
|
|
2794
|
+
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
|
2795
|
+
(method) => {
|
|
2796
|
+
delete headers[method];
|
|
2797
|
+
}
|
|
2798
|
+
);
|
|
2799
|
+
|
|
2800
|
+
config.headers = AxiosHeaders.concat(contextHeaders, headers);
|
|
2801
|
+
|
|
2802
|
+
// filter out skipped interceptors
|
|
2803
|
+
const requestInterceptorChain = [];
|
|
2804
|
+
let synchronousRequestInterceptors = true;
|
|
2805
|
+
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
2806
|
+
if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
|
|
2807
|
+
return;
|
|
2808
|
+
}
|
|
2809
|
+
|
|
2810
|
+
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
2811
|
+
|
|
2812
|
+
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
2813
|
+
});
|
|
2814
|
+
|
|
2815
|
+
const responseInterceptorChain = [];
|
|
2816
|
+
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
2817
|
+
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
2818
|
+
});
|
|
1789
2819
|
|
|
1790
|
-
|
|
2820
|
+
let promise;
|
|
2821
|
+
let i = 0;
|
|
2822
|
+
let len;
|
|
1791
2823
|
|
|
1792
|
-
|
|
1793
|
-
|
|
2824
|
+
if (!synchronousRequestInterceptors) {
|
|
2825
|
+
const chain = [dispatchRequest.bind(this), undefined];
|
|
2826
|
+
chain.unshift.apply(chain, requestInterceptorChain);
|
|
2827
|
+
chain.push.apply(chain, responseInterceptorChain);
|
|
2828
|
+
len = chain.length;
|
|
1794
2829
|
|
|
1795
|
-
|
|
1796
|
-
chain = chain.concat(responseInterceptorChain);
|
|
2830
|
+
promise = Promise.resolve(config);
|
|
1797
2831
|
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
2832
|
+
while (i < len) {
|
|
2833
|
+
promise = promise.then(chain[i++], chain[i++]);
|
|
2834
|
+
}
|
|
2835
|
+
|
|
2836
|
+
return promise;
|
|
1801
2837
|
}
|
|
1802
2838
|
|
|
1803
|
-
|
|
1804
|
-
}
|
|
2839
|
+
len = requestInterceptorChain.length;
|
|
1805
2840
|
|
|
2841
|
+
let newConfig = config;
|
|
2842
|
+
|
|
2843
|
+
i = 0;
|
|
2844
|
+
|
|
2845
|
+
while (i < len) {
|
|
2846
|
+
const onFulfilled = requestInterceptorChain[i++];
|
|
2847
|
+
const onRejected = requestInterceptorChain[i++];
|
|
2848
|
+
try {
|
|
2849
|
+
newConfig = onFulfilled(newConfig);
|
|
2850
|
+
} catch (error) {
|
|
2851
|
+
onRejected.call(this, error);
|
|
2852
|
+
break;
|
|
2853
|
+
}
|
|
2854
|
+
}
|
|
1806
2855
|
|
|
1807
|
-
var newConfig = config;
|
|
1808
|
-
while (requestInterceptorChain.length) {
|
|
1809
|
-
var onFulfilled = requestInterceptorChain.shift();
|
|
1810
|
-
var onRejected = requestInterceptorChain.shift();
|
|
1811
2856
|
try {
|
|
1812
|
-
|
|
2857
|
+
promise = dispatchRequest.call(this, newConfig);
|
|
1813
2858
|
} catch (error) {
|
|
1814
|
-
|
|
1815
|
-
break;
|
|
2859
|
+
return Promise.reject(error);
|
|
1816
2860
|
}
|
|
1817
|
-
}
|
|
1818
2861
|
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
} catch (error) {
|
|
1822
|
-
return Promise.reject(error);
|
|
1823
|
-
}
|
|
2862
|
+
i = 0;
|
|
2863
|
+
len = responseInterceptorChain.length;
|
|
1824
2864
|
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
2865
|
+
while (i < len) {
|
|
2866
|
+
promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
|
|
2867
|
+
}
|
|
1828
2868
|
|
|
1829
|
-
|
|
1830
|
-
}
|
|
2869
|
+
return promise;
|
|
2870
|
+
}
|
|
1831
2871
|
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
}
|
|
2872
|
+
getUri(config) {
|
|
2873
|
+
config = mergeConfig(this.defaults, config);
|
|
2874
|
+
const fullPath = buildFullPath(config.baseURL, config.url);
|
|
2875
|
+
return buildURL(fullPath, config.params, config.paramsSerializer);
|
|
2876
|
+
}
|
|
2877
|
+
}
|
|
1837
2878
|
|
|
1838
2879
|
// Provide aliases for supported request methods
|
|
1839
2880
|
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
|
1840
2881
|
/*eslint func-names:0*/
|
|
1841
2882
|
Axios.prototype[method] = function(url, config) {
|
|
1842
2883
|
return this.request(mergeConfig(config || {}, {
|
|
1843
|
-
method
|
|
1844
|
-
url
|
|
2884
|
+
method,
|
|
2885
|
+
url,
|
|
1845
2886
|
data: (config || {}).data
|
|
1846
2887
|
}));
|
|
1847
2888
|
};
|
|
@@ -1853,12 +2894,12 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
|
1853
2894
|
function generateHTTPMethod(isForm) {
|
|
1854
2895
|
return function httpMethod(url, data, config) {
|
|
1855
2896
|
return this.request(mergeConfig(config || {}, {
|
|
1856
|
-
method
|
|
2897
|
+
method,
|
|
1857
2898
|
headers: isForm ? {
|
|
1858
2899
|
'Content-Type': 'multipart/form-data'
|
|
1859
2900
|
} : {},
|
|
1860
|
-
url
|
|
1861
|
-
data
|
|
2901
|
+
url,
|
|
2902
|
+
data
|
|
1862
2903
|
}));
|
|
1863
2904
|
};
|
|
1864
2905
|
}
|
|
@@ -1868,123 +2909,121 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
|
1868
2909
|
Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
|
|
1869
2910
|
});
|
|
1870
2911
|
|
|
1871
|
-
var Axios_1 = Axios;
|
|
1872
|
-
|
|
1873
2912
|
/**
|
|
1874
2913
|
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
|
1875
2914
|
*
|
|
1876
|
-
* @class
|
|
1877
2915
|
* @param {Function} executor The executor function.
|
|
2916
|
+
*
|
|
2917
|
+
* @returns {CancelToken}
|
|
1878
2918
|
*/
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
2919
|
+
class CancelToken {
|
|
2920
|
+
constructor(executor) {
|
|
2921
|
+
if (typeof executor !== 'function') {
|
|
2922
|
+
throw new TypeError('executor must be a function.');
|
|
2923
|
+
}
|
|
1883
2924
|
|
|
1884
|
-
|
|
2925
|
+
let resolvePromise;
|
|
1885
2926
|
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
2927
|
+
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
2928
|
+
resolvePromise = resolve;
|
|
2929
|
+
});
|
|
1889
2930
|
|
|
1890
|
-
|
|
2931
|
+
const token = this;
|
|
1891
2932
|
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
2933
|
+
// eslint-disable-next-line func-names
|
|
2934
|
+
this.promise.then(cancel => {
|
|
2935
|
+
if (!token._listeners) return;
|
|
1895
2936
|
|
|
1896
|
-
|
|
1897
|
-
var l = token._listeners.length;
|
|
2937
|
+
let i = token._listeners.length;
|
|
1898
2938
|
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
2939
|
+
while (i-- > 0) {
|
|
2940
|
+
token._listeners[i](cancel);
|
|
2941
|
+
}
|
|
2942
|
+
token._listeners = null;
|
|
2943
|
+
});
|
|
1904
2944
|
|
|
1905
|
-
// eslint-disable-next-line func-names
|
|
1906
|
-
this.promise.then = function(onfulfilled) {
|
|
1907
|
-
var _resolve;
|
|
1908
2945
|
// eslint-disable-next-line func-names
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
2946
|
+
this.promise.then = onfulfilled => {
|
|
2947
|
+
let _resolve;
|
|
2948
|
+
// eslint-disable-next-line func-names
|
|
2949
|
+
const promise = new Promise(resolve => {
|
|
2950
|
+
token.subscribe(resolve);
|
|
2951
|
+
_resolve = resolve;
|
|
2952
|
+
}).then(onfulfilled);
|
|
1913
2953
|
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
2954
|
+
promise.cancel = function reject() {
|
|
2955
|
+
token.unsubscribe(_resolve);
|
|
2956
|
+
};
|
|
1917
2957
|
|
|
1918
|
-
|
|
1919
|
-
|
|
2958
|
+
return promise;
|
|
2959
|
+
};
|
|
1920
2960
|
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
2961
|
+
executor(function cancel(message, config, request) {
|
|
2962
|
+
if (token.reason) {
|
|
2963
|
+
// Cancellation has already been requested
|
|
2964
|
+
return;
|
|
2965
|
+
}
|
|
1926
2966
|
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
}
|
|
2967
|
+
token.reason = new CanceledError(message, config, request);
|
|
2968
|
+
resolvePromise(token.reason);
|
|
2969
|
+
});
|
|
2970
|
+
}
|
|
1931
2971
|
|
|
1932
|
-
/**
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
2972
|
+
/**
|
|
2973
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
|
2974
|
+
*/
|
|
2975
|
+
throwIfRequested() {
|
|
2976
|
+
if (this.reason) {
|
|
2977
|
+
throw this.reason;
|
|
2978
|
+
}
|
|
1938
2979
|
}
|
|
1939
|
-
};
|
|
1940
2980
|
|
|
1941
|
-
/**
|
|
1942
|
-
|
|
1943
|
-
|
|
2981
|
+
/**
|
|
2982
|
+
* Subscribe to the cancel signal
|
|
2983
|
+
*/
|
|
1944
2984
|
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
2985
|
+
subscribe(listener) {
|
|
2986
|
+
if (this.reason) {
|
|
2987
|
+
listener(this.reason);
|
|
2988
|
+
return;
|
|
2989
|
+
}
|
|
1950
2990
|
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
2991
|
+
if (this._listeners) {
|
|
2992
|
+
this._listeners.push(listener);
|
|
2993
|
+
} else {
|
|
2994
|
+
this._listeners = [listener];
|
|
2995
|
+
}
|
|
1955
2996
|
}
|
|
1956
|
-
};
|
|
1957
2997
|
|
|
1958
|
-
/**
|
|
1959
|
-
|
|
1960
|
-
|
|
2998
|
+
/**
|
|
2999
|
+
* Unsubscribe from the cancel signal
|
|
3000
|
+
*/
|
|
1961
3001
|
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
3002
|
+
unsubscribe(listener) {
|
|
3003
|
+
if (!this._listeners) {
|
|
3004
|
+
return;
|
|
3005
|
+
}
|
|
3006
|
+
const index = this._listeners.indexOf(listener);
|
|
3007
|
+
if (index !== -1) {
|
|
3008
|
+
this._listeners.splice(index, 1);
|
|
3009
|
+
}
|
|
1969
3010
|
}
|
|
1970
|
-
};
|
|
1971
|
-
|
|
1972
|
-
/**
|
|
1973
|
-
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
1974
|
-
* cancels the `CancelToken`.
|
|
1975
|
-
*/
|
|
1976
|
-
CancelToken.source = function source() {
|
|
1977
|
-
var cancel;
|
|
1978
|
-
var token = new CancelToken(function executor(c) {
|
|
1979
|
-
cancel = c;
|
|
1980
|
-
});
|
|
1981
|
-
return {
|
|
1982
|
-
token: token,
|
|
1983
|
-
cancel: cancel
|
|
1984
|
-
};
|
|
1985
|
-
};
|
|
1986
3011
|
|
|
1987
|
-
|
|
3012
|
+
/**
|
|
3013
|
+
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
3014
|
+
* cancels the `CancelToken`.
|
|
3015
|
+
*/
|
|
3016
|
+
static source() {
|
|
3017
|
+
let cancel;
|
|
3018
|
+
const token = new CancelToken(function executor(c) {
|
|
3019
|
+
cancel = c;
|
|
3020
|
+
});
|
|
3021
|
+
return {
|
|
3022
|
+
token,
|
|
3023
|
+
cancel
|
|
3024
|
+
};
|
|
3025
|
+
}
|
|
3026
|
+
}
|
|
1988
3027
|
|
|
1989
3028
|
/**
|
|
1990
3029
|
* Syntactic sugar for invoking a function and expanding an array for arguments.
|
|
@@ -2004,39 +3043,112 @@ var CancelToken_1 = CancelToken;
|
|
|
2004
3043
|
* ```
|
|
2005
3044
|
*
|
|
2006
3045
|
* @param {Function} callback
|
|
3046
|
+
*
|
|
2007
3047
|
* @returns {Function}
|
|
2008
3048
|
*/
|
|
2009
|
-
|
|
3049
|
+
function spread(callback) {
|
|
2010
3050
|
return function wrap(arr) {
|
|
2011
3051
|
return callback.apply(null, arr);
|
|
2012
3052
|
};
|
|
2013
|
-
}
|
|
3053
|
+
}
|
|
2014
3054
|
|
|
2015
3055
|
/**
|
|
2016
3056
|
* Determines whether the payload is an error thrown by Axios
|
|
2017
3057
|
*
|
|
2018
3058
|
* @param {*} payload The value to test
|
|
3059
|
+
*
|
|
2019
3060
|
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
|
2020
3061
|
*/
|
|
2021
|
-
|
|
3062
|
+
function isAxiosError(payload) {
|
|
2022
3063
|
return utils.isObject(payload) && (payload.isAxiosError === true);
|
|
3064
|
+
}
|
|
3065
|
+
|
|
3066
|
+
const HttpStatusCode = {
|
|
3067
|
+
Continue: 100,
|
|
3068
|
+
SwitchingProtocols: 101,
|
|
3069
|
+
Processing: 102,
|
|
3070
|
+
EarlyHints: 103,
|
|
3071
|
+
Ok: 200,
|
|
3072
|
+
Created: 201,
|
|
3073
|
+
Accepted: 202,
|
|
3074
|
+
NonAuthoritativeInformation: 203,
|
|
3075
|
+
NoContent: 204,
|
|
3076
|
+
ResetContent: 205,
|
|
3077
|
+
PartialContent: 206,
|
|
3078
|
+
MultiStatus: 207,
|
|
3079
|
+
AlreadyReported: 208,
|
|
3080
|
+
ImUsed: 226,
|
|
3081
|
+
MultipleChoices: 300,
|
|
3082
|
+
MovedPermanently: 301,
|
|
3083
|
+
Found: 302,
|
|
3084
|
+
SeeOther: 303,
|
|
3085
|
+
NotModified: 304,
|
|
3086
|
+
UseProxy: 305,
|
|
3087
|
+
Unused: 306,
|
|
3088
|
+
TemporaryRedirect: 307,
|
|
3089
|
+
PermanentRedirect: 308,
|
|
3090
|
+
BadRequest: 400,
|
|
3091
|
+
Unauthorized: 401,
|
|
3092
|
+
PaymentRequired: 402,
|
|
3093
|
+
Forbidden: 403,
|
|
3094
|
+
NotFound: 404,
|
|
3095
|
+
MethodNotAllowed: 405,
|
|
3096
|
+
NotAcceptable: 406,
|
|
3097
|
+
ProxyAuthenticationRequired: 407,
|
|
3098
|
+
RequestTimeout: 408,
|
|
3099
|
+
Conflict: 409,
|
|
3100
|
+
Gone: 410,
|
|
3101
|
+
LengthRequired: 411,
|
|
3102
|
+
PreconditionFailed: 412,
|
|
3103
|
+
PayloadTooLarge: 413,
|
|
3104
|
+
UriTooLong: 414,
|
|
3105
|
+
UnsupportedMediaType: 415,
|
|
3106
|
+
RangeNotSatisfiable: 416,
|
|
3107
|
+
ExpectationFailed: 417,
|
|
3108
|
+
ImATeapot: 418,
|
|
3109
|
+
MisdirectedRequest: 421,
|
|
3110
|
+
UnprocessableEntity: 422,
|
|
3111
|
+
Locked: 423,
|
|
3112
|
+
FailedDependency: 424,
|
|
3113
|
+
TooEarly: 425,
|
|
3114
|
+
UpgradeRequired: 426,
|
|
3115
|
+
PreconditionRequired: 428,
|
|
3116
|
+
TooManyRequests: 429,
|
|
3117
|
+
RequestHeaderFieldsTooLarge: 431,
|
|
3118
|
+
UnavailableForLegalReasons: 451,
|
|
3119
|
+
InternalServerError: 500,
|
|
3120
|
+
NotImplemented: 501,
|
|
3121
|
+
BadGateway: 502,
|
|
3122
|
+
ServiceUnavailable: 503,
|
|
3123
|
+
GatewayTimeout: 504,
|
|
3124
|
+
HttpVersionNotSupported: 505,
|
|
3125
|
+
VariantAlsoNegotiates: 506,
|
|
3126
|
+
InsufficientStorage: 507,
|
|
3127
|
+
LoopDetected: 508,
|
|
3128
|
+
NotExtended: 510,
|
|
3129
|
+
NetworkAuthenticationRequired: 511,
|
|
2023
3130
|
};
|
|
2024
3131
|
|
|
3132
|
+
Object.entries(HttpStatusCode).forEach(([key, value]) => {
|
|
3133
|
+
HttpStatusCode[value] = key;
|
|
3134
|
+
});
|
|
3135
|
+
|
|
2025
3136
|
/**
|
|
2026
3137
|
* Create an instance of Axios
|
|
2027
3138
|
*
|
|
2028
3139
|
* @param {Object} defaultConfig The default config for the instance
|
|
2029
|
-
*
|
|
3140
|
+
*
|
|
3141
|
+
* @returns {Axios} A new instance of Axios
|
|
2030
3142
|
*/
|
|
2031
3143
|
function createInstance(defaultConfig) {
|
|
2032
|
-
|
|
2033
|
-
|
|
3144
|
+
const context = new Axios(defaultConfig);
|
|
3145
|
+
const instance = bind(Axios.prototype.request, context);
|
|
2034
3146
|
|
|
2035
3147
|
// Copy axios.prototype to instance
|
|
2036
|
-
utils.extend(instance,
|
|
3148
|
+
utils.extend(instance, Axios.prototype, context, {allOwnKeys: true});
|
|
2037
3149
|
|
|
2038
3150
|
// Copy context to instance
|
|
2039
|
-
utils.extend(instance, context);
|
|
3151
|
+
utils.extend(instance, context, null, {allOwnKeys: true});
|
|
2040
3152
|
|
|
2041
3153
|
// Factory for creating new instances
|
|
2042
3154
|
instance.create = function create(instanceConfig) {
|
|
@@ -2047,40 +3159,44 @@ function createInstance(defaultConfig) {
|
|
|
2047
3159
|
}
|
|
2048
3160
|
|
|
2049
3161
|
// Create the default instance to be exported
|
|
2050
|
-
|
|
3162
|
+
const axios = createInstance(defaults);
|
|
2051
3163
|
|
|
2052
3164
|
// Expose Axios class to allow class inheritance
|
|
2053
|
-
axios
|
|
3165
|
+
axios.Axios = Axios;
|
|
2054
3166
|
|
|
2055
3167
|
// Expose Cancel & CancelToken
|
|
2056
|
-
axios
|
|
2057
|
-
axios
|
|
2058
|
-
axios
|
|
2059
|
-
axios
|
|
2060
|
-
axios
|
|
3168
|
+
axios.CanceledError = CanceledError;
|
|
3169
|
+
axios.CancelToken = CancelToken;
|
|
3170
|
+
axios.isCancel = isCancel;
|
|
3171
|
+
axios.VERSION = VERSION;
|
|
3172
|
+
axios.toFormData = toFormData;
|
|
2061
3173
|
|
|
2062
3174
|
// Expose AxiosError class
|
|
2063
|
-
axios
|
|
3175
|
+
axios.AxiosError = AxiosError;
|
|
2064
3176
|
|
|
2065
3177
|
// alias for CanceledError for backward compatibility
|
|
2066
|
-
axios
|
|
3178
|
+
axios.Cancel = axios.CanceledError;
|
|
2067
3179
|
|
|
2068
3180
|
// Expose all/spread
|
|
2069
|
-
axios
|
|
3181
|
+
axios.all = function all(promises) {
|
|
2070
3182
|
return Promise.all(promises);
|
|
2071
3183
|
};
|
|
2072
|
-
|
|
3184
|
+
|
|
3185
|
+
axios.spread = spread;
|
|
2073
3186
|
|
|
2074
3187
|
// Expose isAxiosError
|
|
2075
|
-
axios
|
|
3188
|
+
axios.isAxiosError = isAxiosError;
|
|
3189
|
+
|
|
3190
|
+
// Expose mergeConfig
|
|
3191
|
+
axios.mergeConfig = mergeConfig;
|
|
2076
3192
|
|
|
2077
|
-
|
|
3193
|
+
axios.AxiosHeaders = AxiosHeaders;
|
|
2078
3194
|
|
|
2079
|
-
|
|
2080
|
-
var _default = axios$1;
|
|
2081
|
-
axios_1.default = _default;
|
|
3195
|
+
axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
2082
3196
|
|
|
2083
|
-
|
|
3197
|
+
axios.HttpStatusCode = HttpStatusCode;
|
|
3198
|
+
|
|
3199
|
+
axios.default = axios;
|
|
2084
3200
|
|
|
2085
3201
|
// This file provides a polyfill for managing globals in both NodeJS and browser environments. This is
|
|
2086
3202
|
// an anti-pattern we'd hoped to avoid, but we have several projects dependending on one common library
|
|
@@ -2185,7 +3301,7 @@ var VerdocsEndpoint = /** @class */ (function () {
|
|
|
2185
3301
|
/**
|
|
2186
3302
|
* The current user session, or null if not authenticated. May be either a User or Signing session. If set, the
|
|
2187
3303
|
* presence of the `document_id` field can be used to differentiate the types. Only signing sessions are associated
|
|
2188
|
-
* with
|
|
3304
|
+
* with Envelopes.
|
|
2189
3305
|
*/
|
|
2190
3306
|
this.session = null;
|
|
2191
3307
|
this.baseURL = (options === null || options === void 0 ? void 0 : options.baseURL) || 'https://api.verdocs.com';
|
|
@@ -2359,11 +3475,17 @@ var VerdocsEndpoint = /** @class */ (function () {
|
|
|
2359
3475
|
}
|
|
2360
3476
|
var session = decodeAccessTokenBody(token);
|
|
2361
3477
|
if (session === null || (session.exp && session.exp * 1000 < new Date().getTime())) {
|
|
3478
|
+
window.console.warn('[JS_SDK] Ignoring attempt to use expired session token');
|
|
2362
3479
|
return this.clearSession();
|
|
2363
3480
|
}
|
|
2364
3481
|
this.token = token;
|
|
2365
3482
|
this.session = session;
|
|
2366
|
-
this.
|
|
3483
|
+
if (this.sessionType === 'user') {
|
|
3484
|
+
this.api.defaults.headers.common.Authorization = "Bearer ".concat(token);
|
|
3485
|
+
}
|
|
3486
|
+
else {
|
|
3487
|
+
this.api.defaults.headers.common.signer = "Bearer ".concat(token);
|
|
3488
|
+
}
|
|
2367
3489
|
localStorage.setItem(this.sessionStorageKey(), token);
|
|
2368
3490
|
this.notifySessionListeners();
|
|
2369
3491
|
return this;
|
|
@@ -2382,6 +3504,18 @@ var VerdocsEndpoint = /** @class */ (function () {
|
|
|
2382
3504
|
* Clear the active session.
|
|
2383
3505
|
*/
|
|
2384
3506
|
VerdocsEndpoint.prototype.clearSession = function () {
|
|
3507
|
+
localStorage.removeItem(this.sessionStorageKey());
|
|
3508
|
+
delete this.api.defaults.headers.common.Authorization;
|
|
3509
|
+
delete this.api.defaults.headers.common.signer;
|
|
3510
|
+
this.session = null;
|
|
3511
|
+
this.token = null;
|
|
3512
|
+
this.notifySessionListeners();
|
|
3513
|
+
return this;
|
|
3514
|
+
};
|
|
3515
|
+
/**
|
|
3516
|
+
* Clear the active signing session.
|
|
3517
|
+
*/
|
|
3518
|
+
VerdocsEndpoint.prototype.clearSignerSession = function () {
|
|
2385
3519
|
localStorage.removeItem(this.sessionStorageKey());
|
|
2386
3520
|
delete this.api.defaults.headers.common.Authorization;
|
|
2387
3521
|
this.session = null;
|