diff --git a/README.md b/README.md index e5b1934d3..95e4f74ae 100644 --- a/README.md +++ b/README.md @@ -246,3 +246,4 @@ You can learn more about the Rollup API and configuration [here](https://github. - Any changes to this project must be reviewed and approved by the repository owner. For more information about contributing, see the [Contribution Guide](https://github.com/moltin/gatsby-demo-store/blob/master/.github/CONTRIBUTING.md). - For more information about the license, see [MIT License](https://github.com/moltin/js-sdk/blob/master/LICENSE). + diff --git a/package-lock.json b/package-lock.json index 26c23254b..3588d770f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2382,9 +2382,9 @@ "dev": true }, "@types/mocha": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.0.1.tgz", - "integrity": "sha512-TBZ6YdX7IZz4U9/mBoB8zCMRN1vXw8QdihRcZxD3I0Cv/r8XF8RggZ8WiXFws4aj5atzRR5hJrYer7g8nXwpnQ==", + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.2.2.tgz", + "integrity": "sha512-Lwh0lzzqT5Pqh6z61P3c3P5nm6fzQK/MMHl9UKeneAeInVflBSz1O2EkX6gM6xfJd7FBXBY5purtLx7fUiZ7Hw==", "dev": true }, "@types/node": { @@ -2393,6 +2393,12 @@ "integrity": "sha512-g+f/qj/cNcqKkc3tFqlXOYjrmZA+jNBiDzbP3kH+B+otKFqAdPgVTGP1IeKRdMml/aE69as5S4FqtxAbl+LaMw==", "dev": true }, + "@ungap/promise-all-settled": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", + "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", + "dev": true + }, "acorn": { "version": "5.7.4", "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.4.tgz", @@ -2510,9 +2516,9 @@ "dev": true }, "anymatch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", - "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", "dev": true, "requires": { "normalize-path": "^3.0.0", @@ -2569,19 +2575,6 @@ "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", "dev": true }, - "array.prototype.map": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/array.prototype.map/-/array.prototype.map-1.0.3.tgz", - "integrity": "sha512-nNcb30v0wfDyIe26Yif3PcV1JXQp4zEeEfupG7L4SRjnD6HLbO5b2a7eVSba53bOx4YCHYMBHt+Fp4vYstneRA==", - "dev": true, - "requires": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.1", - "es-array-method-boxes-properly": "^1.0.0", - "is-string": "^1.0.5" - } - }, "assertion-error": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", @@ -3231,9 +3224,9 @@ "dev": true }, "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", + "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", "dev": true }, "caniuse-lite": { @@ -3286,19 +3279,19 @@ "dev": true }, "chokidar": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.1.tgz", - "integrity": "sha512-4QYCEWOcK3OJrxwvyyAOxFuhpvOVCYkr33LPfFNBjAD/w3sEzWsp2BUOkI4l9bHvWioAd0rc6NlHUOEaWkTeqg==", + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz", + "integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==", "dev": true, "requires": { "anymatch": "~3.1.1", "braces": "~3.0.2", - "fsevents": "~2.1.2", + "fsevents": "~2.3.1", "glob-parent": "~5.1.0", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", - "readdirp": "~3.3.0" + "readdirp": "~3.5.0" }, "dependencies": { "braces": { @@ -3320,9 +3313,9 @@ } }, "glob-parent": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", - "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, "requires": { "is-glob": "^4.0.1" @@ -3447,57 +3440,81 @@ "dev": true }, "cliui": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", - "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", "dev": true, "requires": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" }, "dependencies": { "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true }, "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", + "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", "dev": true, "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" } }, "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", "dev": true, "requires": { - "ansi-regex": "^4.1.0" + "ansi-regex": "^5.0.0" } }, "wrap-ansi": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", - "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, "requires": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" } } } @@ -3800,9 +3817,9 @@ } }, "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", "dev": true }, "decode-uri-component": { @@ -3955,9 +3972,9 @@ "dev": true }, "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, "encoding": { @@ -3999,36 +4016,6 @@ "string.prototype.trimstart": "^1.0.3" } }, - "es-array-method-boxes-properly": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz", - "integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==", - "dev": true - }, - "es-get-iterator": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.1.tgz", - "integrity": "sha512-qorBw8Y7B15DVLaJWy6WdEV/ZkieBcu6QCq/xzWzGOKJqgG1j754vXRfZ3NY7HSShneqU43mPB4OkQBTkvHhFw==", - "dev": true, - "requires": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.1", - "has-symbols": "^1.0.1", - "is-arguments": "^1.0.4", - "is-map": "^2.0.1", - "is-set": "^2.0.1", - "is-string": "^1.0.5", - "isarray": "^2.0.5" - }, - "dependencies": { - "isarray": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", - "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", - "dev": true - } - } - }, "es-to-primitive": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", @@ -4045,6 +4032,12 @@ "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true + }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -4712,21 +4705,10 @@ } }, "flat": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.1.tgz", - "integrity": "sha512-FmTtBsHskrU6FJ2VxCnsDb84wu9zhmO3cUX2kGFb5tuwhfXxGciiT0oRY+cck35QmG+NmGh5eLz6lLCpWTqwpA==", - "dev": true, - "requires": { - "is-buffer": "~2.0.3" - }, - "dependencies": { - "is-buffer": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", - "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", - "dev": true - } - } + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true }, "flat-cache": { "version": "1.3.4", @@ -4794,9 +4776,9 @@ "dev": true }, "fsevents": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", - "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", "dev": true, "optional": true }, @@ -5228,15 +5210,6 @@ "kind-of": "^3.0.2" } }, - "is-arguments": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.0.tgz", - "integrity": "sha512-1Ij4lOMPl/xB5kBDn7I+b2ttPMKa8szhEIrXDuXQD/oe3HJLTLhqhgGspwgyGd6MOywBUqVvYicF72lkgDnIHg==", - "dev": true, - "requires": { - "call-bind": "^1.0.0" - } - }, "is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", @@ -5373,12 +5346,6 @@ "is-extglob": "^1.0.0" } }, - "is-map": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz", - "integrity": "sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==", - "dev": true - }, "is-module": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", @@ -5416,9 +5383,9 @@ } }, "is-plain-obj": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", - "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", "dev": true }, "is-plain-object": { @@ -5477,23 +5444,11 @@ "integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==", "dev": true }, - "is-set": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.2.tgz", - "integrity": "sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==", - "dev": true - }, "is-stream": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" }, - "is-string": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz", - "integrity": "sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==", - "dev": true - }, "is-symbol": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", @@ -5530,22 +5485,6 @@ "isarray": "1.0.0" } }, - "iterate-iterator": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/iterate-iterator/-/iterate-iterator-1.0.1.tgz", - "integrity": "sha512-3Q6tudGN05kbkDQDI4CqjaBf4qf85w6W6GnuZDtUVYwKgtC1q8yxYX7CZed7N+tLzQqS6roujWvszf13T+n9aw==", - "dev": true - }, - "iterate-value": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/iterate-value/-/iterate-value-1.0.2.tgz", - "integrity": "sha512-A6fMAio4D2ot2r/TYzr4yUWrmwNdsN5xL7+HUiyACE4DXm+q8HtPcnFTp+NnW3k4N05tZ7FVYFFb2CR13NxyHQ==", - "dev": true, - "requires": { - "es-get-iterator": "^1.0.2", - "iterate-iterator": "^1.0.1" - } - }, "jest-docblock": { "version": "21.2.0", "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-21.2.0.tgz", @@ -6800,54 +6739,108 @@ } }, "mocha": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.1.1.tgz", - "integrity": "sha512-p7FuGlYH8t7gaiodlFreseLxEmxTgvyG9RgPHODFPySNhwUehu8NIb0vdSt3WFckSneswZ0Un5typYcWElk7HQ==", + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.3.2.tgz", + "integrity": "sha512-UdmISwr/5w+uXLPKspgoV7/RXZwKRTiTjJ2/AC5ZiEztIoOYdfKb19+9jNmEInzx5pBsCyJQzarAxqIGBNYJhg==", "dev": true, "requires": { + "@ungap/promise-all-settled": "1.1.2", "ansi-colors": "4.1.1", "browser-stdout": "1.3.1", - "chokidar": "3.3.1", - "debug": "3.2.6", - "diff": "4.0.2", - "escape-string-regexp": "1.0.5", - "find-up": "4.1.0", + "chokidar": "3.5.1", + "debug": "4.3.1", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", "glob": "7.1.6", "growl": "1.10.5", "he": "1.2.0", - "js-yaml": "3.13.1", - "log-symbols": "3.0.0", + "js-yaml": "4.0.0", + "log-symbols": "4.0.0", "minimatch": "3.0.4", - "ms": "2.1.2", - "object.assign": "4.1.0", - "promise.allsettled": "1.0.2", - "serialize-javascript": "4.0.0", - "strip-json-comments": "3.0.1", - "supports-color": "7.1.0", + "ms": "2.1.3", + "nanoid": "3.1.20", + "serialize-javascript": "5.0.1", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", "which": "2.0.2", "wide-align": "1.1.3", - "workerpool": "6.0.0", - "yargs": "13.3.2", - "yargs-parser": "13.1.2", - "yargs-unparser": "1.6.1" + "workerpool": "6.1.0", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" }, "dependencies": { - "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, "requires": { - "ms": "^2.1.1" + "color-convert": "^2.0.1" + } + }, + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "chalk": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", + "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "dependencies": { + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" } }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "diff": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "dev": true + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", "dev": true, "requires": { - "locate-path": "^5.0.0", + "locate-path": "^6.0.0", "path-exists": "^4.0.0" } }, @@ -6872,69 +6865,56 @@ "dev": true }, "js-yaml": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", - "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.0.0.tgz", + "integrity": "sha512-pqon0s+4ScYUvX30wxQi3PogGFAlUyH0awepWvwkj4jD4v+ova3RiYw8bmA6x2rDrEaj8i/oWKoRxpVNW+Re8Q==", "dev": true, "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "argparse": "^2.0.1" } }, "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dev": true, "requires": { - "p-locate": "^4.1.0" + "p-locate": "^5.0.0" } }, "log-symbols": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", - "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz", + "integrity": "sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA==", "dev": true, "requires": { - "chalk": "^2.4.2" + "chalk": "^4.0.0" } }, - "object.assign": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", - "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", - "dev": true, - "requires": { - "define-properties": "^1.1.2", - "function-bind": "^1.1.1", - "has-symbols": "^1.0.0", - "object-keys": "^1.0.11" - } + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true }, "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", "dev": true, "requires": { - "p-try": "^2.0.0" + "yocto-queue": "^0.1.0" } }, "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", "dev": true, "requires": { - "p-limit": "^2.2.0" + "p-limit": "^3.0.2" } }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, "path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -6942,15 +6922,15 @@ "dev": true }, "strip-json-comments": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", - "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true }, "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "dev": true, "requires": { "has-flag": "^4.0.0" @@ -7031,6 +7011,12 @@ "dev": true, "optional": true }, + "nanoid": { + "version": "3.1.20", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.20.tgz", + "integrity": "sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw==", + "dev": true + }, "nanomatch": { "version": "1.2.13", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", @@ -7676,9 +7662,9 @@ "dev": true }, "picomatch": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", - "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", + "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", "dev": true }, "pify": { @@ -7795,40 +7781,6 @@ "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", "dev": true }, - "promise.allsettled": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/promise.allsettled/-/promise.allsettled-1.0.2.tgz", - "integrity": "sha512-UpcYW5S1RaNKT6pd+s9jp9K9rlQge1UXKskec0j6Mmuq7UJCvlS2J2/s/yuPN8ehftf9HXMxWlKiPbGGUzpoRg==", - "dev": true, - "requires": { - "array.prototype.map": "^1.0.1", - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1", - "function-bind": "^1.1.1", - "iterate-value": "^1.0.0" - }, - "dependencies": { - "es-abstract": { - "version": "1.17.7", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz", - "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } - } - }, "propagate": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/propagate/-/propagate-2.0.1.tgz", @@ -7918,12 +7870,12 @@ } }, "readdirp": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.3.0.tgz", - "integrity": "sha512-zz0pAkSPOXXm1viEwygWIPSPkcBYjW1xU5j/JBh5t9bGCJwa6f9+BJa6VaB2g+b55yVrmXzqkyLf4xaWYM0IkQ==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", + "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", "dev": true, "requires": { - "picomatch": "^2.0.7" + "picomatch": "^2.2.1" } }, "rechoir": { @@ -8060,12 +8012,6 @@ "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", "dev": true }, - "require-main-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", - "dev": true - }, "require-uncached": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", @@ -8942,20 +8888,14 @@ "dev": true }, "serialize-javascript": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz", - "integrity": "sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-5.0.1.tgz", + "integrity": "sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA==", "dev": true, "requires": { "randombytes": "^2.1.0" } }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true - }, "set-value": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", @@ -9758,12 +9698,6 @@ "isexe": "^2.0.0" } }, - "which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true - }, "wide-align": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", @@ -9822,9 +9756,9 @@ "dev": true }, "workerpool": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.0.0.tgz", - "integrity": "sha512-fU2OcNA/GVAJLLyKUoHkAgIhKb0JoCpSjLC/G2vYKxUjVmQwGbRVeoPJ1a8U4pnVofz4AQV5Y/NEw8oKqxEBtA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.0.tgz", + "integrity": "sha512-toV7q9rWNYha963Pl/qyeZ6wG+3nnsyvolaNUS8+R5Wtw6qJPTxIlOP1ZSvcGhEJw+l3HMMmtiNo9Gl61G4GVg==", "dev": true }, "wrap-ansi": { @@ -9912,9 +9846,9 @@ "dev": true }, "y18n": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz", - "integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==", + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", "dev": true }, "yallist": { @@ -9924,227 +9858,70 @@ "dev": true }, "yargs": { - "version": "13.3.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", - "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", "dev": true, "requires": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^13.1.2" + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" }, "dependencies": { "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", "dev": true }, - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, - "requires": { - "locate-path": "^3.0.0" - } - }, "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dev": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dev": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true }, "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", + "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", "dev": true, "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" } }, "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", "dev": true, "requires": { - "ansi-regex": "^4.1.0" + "ansi-regex": "^5.0.0" } } } }, "yargs-parser": { - "version": "13.1.2", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", - "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } + "version": "20.2.4", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "dev": true }, "yargs-unparser": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.1.tgz", - "integrity": "sha512-qZV14lK9MWsGCmcr7u5oXGH0dbGqZAIxTDrWXZDo5zUr6b6iUmelNKO6x6R1dQT24AH3LgRxJpr8meWy2unolA==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", "dev": true, "requires": { - "camelcase": "^5.3.1", - "decamelize": "^1.2.0", - "flat": "^4.1.0", - "is-plain-obj": "^1.1.0", - "yargs": "^14.2.3" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, - "requires": { - "locate-path": "^3.0.0" - } - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dev": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dev": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - }, - "yargs": { - "version": "14.2.3", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-14.2.3.tgz", - "integrity": "sha512-ZbotRWhF+lkjijC/VhmOT9wSgyBQ7+zr13+YLkhfsSiTriYsMzkTUFP18pFhWwBeMa5gUc1MzbhrO6/VB7c9Xg==", - "dev": true, - "requires": { - "cliui": "^5.0.0", - "decamelize": "^1.2.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^15.0.1" - } - }, - "yargs-parser": { - "version": "15.0.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-15.0.1.tgz", - "integrity": "sha512-0OAMV2mAZQrs3FkNpDQcBk1x5HXb8X4twADss4S0Iuk+2dGnLOE/fRHrsYm542GduMveyA77OF4wrNJuanRCWw==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - } + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" } }, "yn": { @@ -10152,6 +9929,12 @@ "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", "dev": true + }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true } } } diff --git a/playground/account-addresses.ts b/playground/account-addresses.ts new file mode 100644 index 000000000..89dbf99af --- /dev/null +++ b/playground/account-addresses.ts @@ -0,0 +1,69 @@ +import * as moltin from '..' + +async function main() { + const gateway = moltin.gateway({ + host: 'epcc-integration.global.ssl.fastly.net', + client_id: 'R7paB5xa2ngzuEM8N6PkTOGpO9jTcAgW1DO2U2KzOl', + client_secret: 'lsKTS0hKMzbxpNBAVjX0NoXt8FeALVPcQxh4lgofWD', + headers: { + 'EP-Beta-Features': 'account-management,accounts' + } + }) + // await gateway.Authenticate() + // console.log('=======account created successfully') + // await gateway.Accounts.Create({ + // email: 'email@email.com', + // password: 'pwd', + // name: 'name', + // type: 'account' + // }) + const accounts = await gateway.Accounts.All() + // console.log(accounts) + await gateway.AccountAddresses.Create({ + body: { + type: 'account-address', + first_name: 'first_name', + last_name: 'last_name', + line_1: 'line_1', + postcode: 'postcode', + county: 'county', + country: 'RU' + }, + account: accounts.data[0].id + }) + console.log('=======account address created successfully') + const addresses = await gateway.AccountAddresses.All({ + account: accounts.data[0].id + }) + console.log(addresses) + const fetchAddresses = await gateway.AccountAddresses.Get({ + address: addresses.data[0].id, + account: accounts.data[0].id + }) + console.log('=======Account address fetched successfully:') + console.log(fetchAddresses) + + const updated = await gateway.AccountAddresses.Update({ + address: addresses.data[0].id, + body: { + id: addresses.data[0].id, + type: 'account-address', + first_name: 'first_name22', + last_name: 'last_name22', + line_1: 'line_122', + postcode: 'postcode22', + county: 'county22', + country: 'US' + }, + account: accounts.data[0].id + }) + console.log('=======Account address updated successfully:') + console.log(updated) + const deleted = await gateway.AccountAddresses.Delete({ + address: addresses.data[0].id, + account: accounts.data[0].id + }) + console.log('=======Deleted successfully:') + console.log(deleted) +} +main().catch(console.error) diff --git a/playground/customer-addresses.ts b/playground/customer-addresses.ts new file mode 100644 index 000000000..e49ea8df0 --- /dev/null +++ b/playground/customer-addresses.ts @@ -0,0 +1,69 @@ +import * as moltin from '..' + +async function main() { + const gateway = moltin.gateway({ + host: 'epcc-integration.global.ssl.fastly.net', + client_id: 'R7paB5xa2ngzuEM8N6PkTOGpO9jTcAgW1DO2U2KzOl', + client_secret: 'lsKTS0hKMzbxpNBAVjX0NoXt8FeALVPcQxh4lgofWD', + headers: { + 'EP-Beta-Features': 'account-management,accounts' + } + }) + // await gateway.Authenticate() + // console.log('=======customer created successfully') + await gateway.Customers.Create({ + email: 'email@email.com', + password: 'pwd', + name: 'name', + type: 'customer' + }) + const customers = await gateway.Customers.All() + console.log(customers) + await gateway.CustomerAddresses.Create({ + body: { + type: 'customer-address', + first_name: 'first_name', + last_name: 'last_name', + line_1: 'line_1', + postcode: 'postcode', + county: 'county', + country: 'RU' + }, + customer: customers.data[0].id + }) + console.log('=======customer address created successfully') + const addresses = await gateway.CustomerAddresses.All({ + customer: customers.data[0].id + }) + console.log(addresses) + const fetchAddresses = await gateway.CustomerAddresses.Get({ + address: addresses.data[0].id, + customer: customers.data[0].id + }) + console.log('=======Customer address fetched successfully:') + console.log(fetchAddresses) + + const updated = await gateway.CustomerAddresses.Update({ + address: addresses.data[0].id, + body: { + id: addresses.data[0].id, + type: 'customer-address', + first_name: 'first_name22', + last_name: 'last_name22', + line_1: 'line_122', + postcode: 'postcode22', + county: 'county22', + country: 'US' + }, + customer: customers.data[0].id + }) + console.log('=======Customer address updated successfully:') + console.log(updated) + const deleted = await gateway.CustomerAddresses.Delete({ + address: addresses.data[0].id, + customer: customers.data[0].id + }) + console.log('=======Deleted successfully:') + console.log(deleted) +} +main().catch(console.error) diff --git a/src/endpoints/account-addresses.js b/src/endpoints/account-addresses.js new file mode 100644 index 000000000..4fc18929c --- /dev/null +++ b/src/endpoints/account-addresses.js @@ -0,0 +1,63 @@ +import { singularize } from 'inflected' + +import BaseExtend from '../extends/base' + +class AccountAddressesEndpoint extends BaseExtend { + constructor(endpoint) { + super(endpoint) + + this.endpoint = 'addresses' + } + + All({ account, token = null }) { + return this.request.send( + `accounts/${account}/${this.endpoint}`, + 'GET', + undefined, + undefined, + token + ) + } + + Get({ account, address, token = null }) { + return this.request.send( + `accounts/${account}/${this.endpoint}/${address}`, + 'GET', + undefined, + undefined, + token + ) + } + + Create({ account, body, token = null }) { + return this.request.send( + `accounts/${account}/${this.endpoint}`, + 'POST', + { ...body, type: singularize(this.endpoint) }, + undefined, + token + ) + } + + Delete({ account, address, token = null }) { + return this.request.send( + `accounts/${account}/${this.endpoint}/${address}`, + 'DELETE', + undefined, + undefined, + token + ) + } + + Update({ account, address, body, token = null }) { + return this.request.send( + `accounts/${account}/${this.endpoint}/${address}`, + 'PUT', + { ...body, type: singularize(this.endpoint) }, + undefined, + token + ) + } +} + +export default AccountAddressesEndpoint diff --git a/src/endpoints/account-members.js b/src/endpoints/account-members.js index 175ea3b1c..2e982a42c 100644 --- a/src/endpoints/account-members.js +++ b/src/endpoints/account-members.js @@ -27,6 +27,7 @@ class AccountMembersEndpoint extends BaseExtend { 'GET', undefined, token, + undefined, this, headers ) diff --git a/src/endpoints/account-memberships.js b/src/endpoints/account-memberships.js index 4a1a99f8c..225b7f3a1 100644 --- a/src/endpoints/account-memberships.js +++ b/src/endpoints/account-memberships.js @@ -22,6 +22,7 @@ class AccountMembershipsEndpoint extends BaseExtend { 'GET', undefined, token, + undefined, this ) diff --git a/src/endpoints/accounts.js b/src/endpoints/accounts.js index 4d91dcc26..d34c98ffe 100644 --- a/src/endpoints/accounts.js +++ b/src/endpoints/accounts.js @@ -22,6 +22,7 @@ class AccountsEndpoint extends CRUDExtend { 'GET', undefined, token, + undefined, this, headers ) diff --git a/src/endpoints/authentication-realm.js b/src/endpoints/authentication-realm.js index 4d1670803..8e7c0bf1f 100644 --- a/src/endpoints/authentication-realm.js +++ b/src/endpoints/authentication-realm.js @@ -21,6 +21,7 @@ class AuthenticationRealmsEndpoint extends CRUDExtend { 'GET', undefined, token, + undefined, this, headers ) diff --git a/src/endpoints/catalog.js b/src/endpoints/catalog.js index 2f6332715..91939d1fd 100644 --- a/src/endpoints/catalog.js +++ b/src/endpoints/catalog.js @@ -205,6 +205,7 @@ class CatalogEndpoint extends CatalogQuery { 'GET', undefined, token, + undefined, this ) diff --git a/src/endpoints/addresses.js b/src/endpoints/customer-addresses.js similarity index 92% rename from src/endpoints/addresses.js rename to src/endpoints/customer-addresses.js index da03c1430..2f0da444d 100644 --- a/src/endpoints/addresses.js +++ b/src/endpoints/customer-addresses.js @@ -2,7 +2,7 @@ import { singularize } from 'inflected' import BaseExtend from '../extends/base' -class AddressesEndpoint extends BaseExtend { +class CustomerAddressesEndpoint extends BaseExtend { constructor(endpoint) { super(endpoint) @@ -55,4 +55,4 @@ class AddressesEndpoint extends BaseExtend { } } -export default AddressesEndpoint +export default CustomerAddressesEndpoint diff --git a/src/endpoints/customers.js b/src/endpoints/customers.js index cde231a10..7a3b3b60f 100644 --- a/src/endpoints/customers.js +++ b/src/endpoints/customers.js @@ -12,6 +12,7 @@ class CustomersEndpoint extends CRUDExtend { 'POST', tokenRequestBody, null, + undefined, { ...headers } diff --git a/src/endpoints/merchant-realm-mappings.js b/src/endpoints/merchant-realm-mappings.js index dbe561454..09e4e0a4d 100644 --- a/src/endpoints/merchant-realm-mappings.js +++ b/src/endpoints/merchant-realm-mappings.js @@ -8,7 +8,14 @@ class MerchantRealmMappings { } All(token = null) { - this.call = this.request.send(this.endpoint, 'GET', undefined, token, this) + this.call = this.request.send( + this.endpoint, + 'GET', + undefined, + token, + undefined, + this + ) return this.call } diff --git a/src/endpoints/node-relationships.js b/src/endpoints/node-relationships.js index ca197a9fd..493d3c69c 100644 --- a/src/endpoints/node-relationships.js +++ b/src/endpoints/node-relationships.js @@ -32,7 +32,10 @@ class NodeRelationshipsEndpoint { return this.request.send( `hierarchies/${hierarchyId}/nodes/${nodeId}/relationships/parent`, 'PUT', - { ...body, type: singularize(this.endpoint) }, + { + ...body, + type: singularize(this.endpoint) + }, token ) } diff --git a/src/endpoints/oidc-profile.js b/src/endpoints/oidc-profile.js index 2be2ba518..7906767d9 100644 --- a/src/endpoints/oidc-profile.js +++ b/src/endpoints/oidc-profile.js @@ -21,6 +21,7 @@ class OidcProfileEndpoint extends CRUDExtend { 'GET', undefined, token, + undefined, this, headers ) @@ -42,6 +43,7 @@ class OidcProfileEndpoint extends CRUDExtend { 'GET', undefined, token, + undefined, this, headers ) diff --git a/src/endpoints/price-book-prices.js b/src/endpoints/price-book-prices.js index 85c9a1f5c..dfa45366b 100644 --- a/src/endpoints/price-book-prices.js +++ b/src/endpoints/price-book-prices.js @@ -20,6 +20,7 @@ class PriceBookPricesEndpoint { 'GET', undefined, token, + undefined, this ) } diff --git a/src/extends/base.js b/src/extends/base.js index e372a9a3a..eda0c37b1 100644 --- a/src/extends/base.js +++ b/src/extends/base.js @@ -21,6 +21,7 @@ class BaseExtend { 'GET', undefined, token, + undefined, this ) @@ -35,6 +36,7 @@ class BaseExtend { 'GET', undefined, token, + undefined, this ) diff --git a/src/factories/request.js b/src/factories/request.js index ef9118cce..d5048160f 100644 --- a/src/factories/request.js +++ b/src/factories/request.js @@ -82,7 +82,8 @@ class RequestFactory { uri, method, body = undefined, - token = undefined, + customerToken = undefined, + accountToken = undefined, instance, wrapBody = true, version = null @@ -121,8 +122,11 @@ class RequestFactory { headers['X-MOLTIN-LANGUAGE'] = config.language } - if (token) { - headers['X-MOLTIN-CUSTOMER-TOKEN'] = token + if (customerToken) { + headers['X-MOLTIN-CUSTOMER-TOKEN'] = customerToken + } + if (accountToken) { + headers['EP-ACCOUNT-MANAGEMENT-AUTHENTICATION-TOKEN'] = accountToken } if (config.headers) { diff --git a/src/moltin.d.ts b/src/moltin.d.ts index 1de43fd16..7e92c08bf 100644 --- a/src/moltin.d.ts +++ b/src/moltin.d.ts @@ -17,7 +17,7 @@ import { JobEndpoint } from './types/job' import { FileEndpoint } from './types/file' import { FlowEndpoint } from './types/flow' import { FieldsEndpoint } from './types/field' -import { AddressesEndpoint } from './types/address' +import { CustomerAddressesEndpoint } from './types/customer-address' import { TransactionEndpoint } from './types/transaction' import { SettingsEndpoint } from './types/settings' import { PromotionsEndpoint } from './types/promotions' @@ -36,6 +36,7 @@ import { AccountEndpoint } from './types/accounts' import { AccountMembersEndpoint } from './types/account-members' import { AccountAuthenticationSettingsEndpoint } from './types/account-authentication-settings' import { AccountMembershipsEndpoint } from './types/account-memberships' +import {AccountAddressesEndpoint} from "./types/account-address"; export * from './types/config' export * from './types/storage' @@ -45,7 +46,8 @@ export * from './types/core' export * from './types/customer' export * from './types/order' export * from './types/cart' -export * from './types/address' +export * from './types/customer-address' +export * from './types/account-address' export * from './types/inventory' export * from './types/field' export * from './types/nodes' @@ -108,7 +110,8 @@ export class Moltin { Files: FileEndpoint Flows: FlowEndpoint Fields: FieldsEndpoint - Addresses: AddressesEndpoint + CustomerAddresses: CustomerAddressesEndpoint + AccountAddresses: AccountAddressesEndpoint Transactions: TransactionEndpoint Settings: SettingsEndpoint Promotions: PromotionsEndpoint diff --git a/src/moltin.js b/src/moltin.js index 4351988ed..c0ed4d3d1 100644 --- a/src/moltin.js +++ b/src/moltin.js @@ -20,7 +20,8 @@ import FlowsEndpoint from './endpoints/flows' import PriceBooksEndpoint from './endpoints/price-books' import FieldsEndpoint from './endpoints/fields' import FilesEndpoint from './endpoints/files' -import AddressesEndpoint from './endpoints/addresses' +import CustomerAddressesEndpoint from './endpoints/customer-addresses' +import AccountAddressesEndpoint from './endpoints/account-addresses' import TransactionsEndpoint from './endpoints/transactions' import SettingsEndpoint from './endpoints/settings' import LocalStorageFactory from './factories/local-storage' @@ -72,7 +73,8 @@ export default class Moltin { this.Files = new FilesEndpoint(config) this.Flows = new FlowsEndpoint(config) this.Fields = new FieldsEndpoint(config) - this.Addresses = new AddressesEndpoint(config) + this.CustomerAddresses = new CustomerAddressesEndpoint(config) + this.AccountAddresses = new AccountAddressesEndpoint(config) this.Transactions = new TransactionsEndpoint(config) this.Settings = new SettingsEndpoint(config) this.Promotions = new PromotionsEndpoint(config) diff --git a/src/types/account-address.d.ts b/src/types/account-address.d.ts new file mode 100644 index 000000000..980a59f01 --- /dev/null +++ b/src/types/account-address.d.ts @@ -0,0 +1,90 @@ +/** + * Addresses + * Description: The Addresses API allows you to organize customer addresses. Addresses are a sub-resource of a Customer. + * A Customer may have multiple addresses, such as home, work and neighbor. You are able to use a customer with an + * implicitBearer token. This is recommend for client-side interactions. Or you can use a client_credentials Bearer + * token. This is recommended for back end interactions. + * DOCS: https://documentation.elasticpath.com/commerce-cloud/docs/api/orders-and-customers/addresses/index.html + */ +import { Attributes, Identifiable, Resource, ResourceList } from './core' +import { WithRequired } from './util' + +/** + * Core Address Base Interface + * For custom flows, extend this interface + * DOCS: https://documentation.elasticpath.com/commerce-cloud/docs/api/catalog/addresss/index.html + */ +export interface AccountAddressBase { + type: 'account-address' + first_name: string + last_name: string + name: string + phone_number: string + instructions: string + company_name: string + line_1: string + line_2: string + city: string + county: string + postcode: string + country: string +} + +export interface AccountAddress extends Identifiable, AccountAddressBase {} + +interface AccountAddressEdit + extends WithRequired< + AccountAddress, + | 'type' + | 'first_name' + | 'last_name' + | 'line_1' + | 'postcode' + | 'county' + | 'country' + > {} + +/** + * Address Endpoints + * DOCS: https://documentation.elasticpath.com/commerce-cloud/docs/api/orders-and-customers/addresss/index.html + * Get DOCS: https://documentation.elasticpath.com/commerce-cloud/docs/api/orders-and-customers/addresses/get-an-address.html + * Get All DOCS: https://documentation.elasticpath.com/commerce-cloud/docs/api/orders-and-customers/addresses/get-all-addresses.html + * Create DOCS: https://documentation.elasticpath.com/commerce-cloud/docs/api/orders-and-customers/addresses/create-an-address.html + * Update DOCS: https://documentation.elasticpath.com/commerce-cloud/docs/api/orders-and-customers/addresses/update-an-address.html + * Delete DOCS: https://documentation.elasticpath.com/commerce-cloud/docs/api/orders-and-customers/addresses/delete-an-address.html + */ +export interface AccountAddressesEndpoint { + endpoint: 'addresses' + + Get(options: { + account: string + address: string + token?: string + }): Promise> + + All(options: { + account: string + token?: string + }): Promise> + + Create(options: { + account: string + body: AccountAddressEdit + token?: string + }): Promise> + + Update(options: { + account: string + address: string + body: Identifiable & AccountAddressEdit + token?: string + }): Promise> + + Delete(options: { + account: string + address: string + token?: string + }): Promise<{}> + + Attributes(token?: string): Promise +} diff --git a/src/types/authentication-realm.d.ts b/src/types/authentication-realm.d.ts index 00d3d1684..238f213eb 100644 --- a/src/types/authentication-realm.d.ts +++ b/src/types/authentication-realm.d.ts @@ -34,9 +34,18 @@ export interface RealmBase { name: string duplicate_email_policy: string redirect_uris: string[] + type: 'authentication-realm' } export interface RealmCreateBody extends RealmBase { + relationships: { + origin: { + data: { + id: string, + type: string + } + } + } } export interface RealmUpdateBody extends Partial { @@ -57,7 +66,7 @@ export interface AuthenticationRealmEndpoint never, never >, - 'All' | 'Create' | 'Get' + 'All' | 'Create' | 'Update' | 'Get' > { endpoint: 'authentication-realm' storage: Storage @@ -80,5 +89,10 @@ export interface AuthenticationRealmEndpoint /** * Create an Authentication Realm */ - Create(body: { data: Partial }): Promise> + Create(body: { data: Partial }): Promise> + + /** + * Update an Authentication Realm + */ + Update(id: string, body: { data: Partial }): Promise> } diff --git a/src/types/address.d.ts b/src/types/customer-address.d.ts similarity index 83% rename from src/types/address.d.ts rename to src/types/customer-address.d.ts index 551e54c05..a459fed58 100644 --- a/src/types/address.d.ts +++ b/src/types/customer-address.d.ts @@ -14,8 +14,8 @@ import { WithRequired } from './util' * For custom flows, extend this interface * DOCS: https://documentation.elasticpath.com/commerce-cloud/docs/api/catalog/addresss/index.html */ -export interface AddressBase { - type: 'address' +export interface CustomerAddressBase { + type: 'customer-address' first_name: string last_name: string name: string @@ -30,11 +30,11 @@ export interface AddressBase { country: string } -export interface Address extends Identifiable, AddressBase {} +export interface CustomerAddress extends Identifiable, CustomerAddressBase {} -interface AddressEdit +interface CustomerAddressEdit extends WithRequired< - Address, + CustomerAddress, | 'type' | 'first_name' | 'last_name' @@ -53,32 +53,32 @@ interface AddressEdit * Update DOCS: https://documentation.elasticpath.com/commerce-cloud/docs/api/orders-and-customers/addresses/update-an-address.html * Delete DOCS: https://documentation.elasticpath.com/commerce-cloud/docs/api/orders-and-customers/addresses/delete-an-address.html */ -export interface AddressesEndpoint { +export interface CustomerAddressesEndpoint { endpoint: 'addresses' Get(options: { customer: string address: string token?: string - }): Promise> + }): Promise> All(options: { customer: string token?: string - }): Promise> + }): Promise> Create(options: { customer: string - body: AddressEdit + body: CustomerAddressEdit token?: string - }): Promise> + }): Promise> Update(options: { customer: string address: string - body: Identifiable & AddressEdit + body: Identifiable & CustomerAddressEdit token?: string - }): Promise> + }): Promise> Delete(options: { customer: string diff --git a/src/types/oidc-profile.d.ts b/src/types/oidc-profile.d.ts index 0d53d8adb..42ee412fd 100644 --- a/src/types/oidc-profile.d.ts +++ b/src/types/oidc-profile.d.ts @@ -14,14 +14,18 @@ export interface ProfileBase { name: string discovery_url: string client_id: string - client_secret: string + client_secret: string, + type: 'oidc-profile' } -export interface ProfileBody extends Partial { - type: string +export interface ProfileResponseBody extends Partial { + id: string +} + +export interface ProfileCreateUpdateBody extends Partial { + } export interface Profile extends ProfileBase, Identifiable { - type: string meta: { timestamps: { created_at: string @@ -39,7 +43,7 @@ export interface ProfileListItem extends Profile { } } -export interface ProfileResponse extends Resource { +export interface ProfileResponse extends Resource { links: { 'authorization-endpoint': string 'client-discovery-url': string @@ -74,7 +78,7 @@ export interface OidcProfileEndpoint { * @param realmId - The ID for the authentication-realm containing the OpenID Connect profiles. * @param body - The OpenID Connect Profile object */ - Create(realmId: string, body: { data: ProfileBody }): Promise + Create(realmId: string, body: { data: ProfileCreateUpdateBody }): Promise /** * Update an OpenID Connect Profile @@ -86,7 +90,7 @@ export interface OidcProfileEndpoint { Update( realmId: string, profileId: string, - body: { data: ProfileBody } + body: { data: ProfileCreateUpdateBody } ): Promise /** diff --git a/src/types/order.d.ts b/src/types/order.d.ts index 87e89bc9d..1f2aa9227 100644 --- a/src/types/order.d.ts +++ b/src/types/order.d.ts @@ -23,11 +23,15 @@ export interface OrderBase { type: string status: string payment: string - shipping: string + shipping?: string customer: { name: string email: string } + contact?: { + name: string + email: string + } shipping_address: AddressBase billing_address: AddressBase } diff --git a/test/factories.ts b/test/factories.ts index b1573f4eb..414855dfe 100644 --- a/test/factories.ts +++ b/test/factories.ts @@ -1,5 +1,6 @@ import { - Address, + CustomerAddress, + AccountAddress, Brand, BrandBase, CustomAuthenticatorResponseBody, @@ -446,9 +447,9 @@ export const flowEntriesArray = [ } ] -export const addressesArray: Address[] = [ +export const customerAddressesArray: CustomerAddress[] = [ { - type: 'address' as const, + type: 'customer-address' as const, id: 'address-1', first_name: 'Jonathan', last_name: 'Steele', @@ -464,7 +465,42 @@ export const addressesArray: Address[] = [ country: 'GB' }, { - type: 'address' as const, + type: 'customer-address' as const, + id: 'address-2', + first_name: 'Jamie', + last_name: 'Barton', + name: 'Office', + phone_number: '(555) 555-1234', + instructions: 'Instruction 2', + company_name: 'Moltin', + line_1: 'British India House', + line_2: '15 Carliol Square', + city: 'Newcastle upon Tyne', + county: 'Tyne & Wear', + postcode: 'NE1 6UF', + country: 'GB' + } +] + +export const accountAddressesArray: AccountAddress[] = [ + { + type: 'account-address' as const, + id: 'address-1', + first_name: 'Jonathan', + last_name: 'Steele', + name: 'Office', + phone_number: '(555) 555-1234', + instructions: 'Instruction 1', + company_name: 'Moltin', + line_1: 'British India House', + line_2: '15 Carliol Square', + city: 'Newcastle upon Tyne', + county: 'Tyne & Wear', + postcode: 'NE1 6UF', + country: 'GB' + }, + { + type: 'account-address' as const, id: 'address-2', first_name: 'Jamie', last_name: 'Barton', diff --git a/test/tests.ts b/test/tests.ts index 1989d0f14..011d2bc23 100644 --- a/test/tests.ts +++ b/test/tests.ts @@ -2,7 +2,8 @@ require('./unit/config') require('./unit/authentication') // Classes -require('./unit/addresses') +require('./unit/customer-addresses') +require('./unit/account-addresses') require('./unit/brands') require('./unit/cart') require('./unit/categories') diff --git a/test/unit/account-addresses.ts b/test/unit/account-addresses.ts new file mode 100644 index 000000000..c556850bd --- /dev/null +++ b/test/unit/account-addresses.ts @@ -0,0 +1,273 @@ +import { assert } from 'chai' +import nock from 'nock' +import { gateway as MoltinGateway } from '../../src/moltin' +import { + accountAddressesArray as addresses, + addressUpdate, + attributeResponse +} from '../factories' + +const apiUrl = 'https://api.moltin.com/v2' + +describe('Moltin addresses', () => { + const Moltin = MoltinGateway({ + client_id: 'XXX' + }) + + it('should return an array of account addresses', () => { + // Intercept the API request + nock(apiUrl, { + reqheaders: { + Authorization: 'Bearer a550d8cbd4a4627013452359ab69694cd446615a' + } + }) + .get('/accounts/account-1/addresses') + .reply(200, { data: addresses }) + + return Moltin.AccountAddresses.All({ account: 'account-1' }).then( + response => { + assert.lengthOf(response.data, 2) + } + ) + }) + + it('should return an array of account addresses using a JWT', () => { + // Intercept the API request + nock(apiUrl, { + reqheaders: { + Authorization: 'Bearer a550d8cbd4a4627013452359ab69694cd446615a', + 'EP-ACCOUNT-MANAGEMENT-AUTHENTICATION-TOKEN': 'testtoken' + } + }) + .get('/accounts/account-1/addresses') + .reply(200, { data: addresses }) + + return Moltin.AccountAddresses.All({ + account: 'account-1', + token: 'testtoken' + }).then(response => { + assert.lengthOf(response.data, 2) + }) + }) + + it('should return a single account address', () => { + // Intercept the API request + nock(apiUrl, { + reqheaders: { + Authorization: 'Bearer a550d8cbd4a4627013452359ab69694cd446615a' + } + }) + .get('/accounts/account-1/addresses/address-1') + .reply(200, { data: addresses[0] }) + + return Moltin.AccountAddresses.Get({ + account: 'account-1', + address: 'address-1' + }).then(response => { + assert.propertyVal(response.data, 'id', 'address-1') + }) + }) + + it('should return a single account address using a JWT', () => { + // Intercept the API request + nock(apiUrl, { + reqheaders: { + Authorization: 'Bearer a550d8cbd4a4627013452359ab69694cd446615a', + 'EP-ACCOUNT-MANAGEMENT-AUTHENTICATION-TOKEN': 'testtoken' + } + }) + .get('/accounts/account-1/addresses/address-1') + .reply(200, { data: addresses[0] }) + + return Moltin.AccountAddresses.Get({ + account: 'account-1', + address: 'address-1', + token: 'testtoken' + }).then(response => { + assert.propertyVal(response.data, 'id', 'address-1') + }) + }) + + it('should create a new account address', () => { + // Intercept the API request + nock(apiUrl, { + reqheaders: { + Authorization: 'Bearer a550d8cbd4a4627013452359ab69694cd446615a' + } + }) + .post('/accounts/account-1/addresses') + .reply(201, { data: { ...addresses[0], id: undefined } }) + + return Moltin.AccountAddresses.Create({ + account: 'account-1', + body: addresses[0] + }).then(response => { + assert.equal(response.data.type, addresses[0].type) + assert.equal(response.data.first_name, addresses[0].first_name) + assert.equal(response.data.last_name, addresses[0].last_name) + assert.equal(response.data.name, addresses[0].name) + assert.equal(response.data.phone_number, addresses[0].phone_number) + assert.equal(response.data.instructions, addresses[0].instructions) + assert.equal(response.data.company_name, addresses[0].company_name) + assert.equal(response.data.line_1, addresses[0].line_1) + assert.equal(response.data.line_2, addresses[0].line_2) + assert.equal(response.data.city, addresses[0].city) + assert.equal(response.data.county, addresses[0].county) + assert.equal(response.data.postcode, addresses[0].postcode) + assert.equal(response.data.country, addresses[0].country) + }) + }) + + it('should create a new account address using a JWT', () => { + // Intercept the API request + nock(apiUrl, { + reqheaders: { + Authorization: 'Bearer a550d8cbd4a4627013452359ab69694cd446615a', + 'EP-ACCOUNT-MANAGEMENT-AUTHENTICATION-TOKEN': 'testtoken' + } + }) + .post('/accounts/account-1/addresses') + .reply(201, { data: addresses[0] }) + + return Moltin.AccountAddresses.Create({ + account: 'account-1', + body: addresses[0], + token: 'testtoken' + }).then(response => { + assert.equal(response.data.id, addresses[0].id) + assert.equal(response.data.type, addresses[0].type) + assert.equal(response.data.first_name, addresses[0].first_name) + assert.equal(response.data.last_name, addresses[0].last_name) + assert.equal(response.data.name, addresses[0].name) + assert.equal(response.data.phone_number, addresses[0].phone_number) + assert.equal(response.data.instructions, addresses[0].instructions) + assert.equal(response.data.company_name, addresses[0].company_name) + assert.equal(response.data.line_1, addresses[0].line_1) + assert.equal(response.data.line_2, addresses[0].line_2) + assert.equal(response.data.city, addresses[0].city) + assert.equal(response.data.county, addresses[0].county) + assert.equal(response.data.postcode, addresses[0].postcode) + assert.equal(response.data.country, addresses[0].country) + }) + }) + + it('should update a account address', () => { + // Intercept the API request + nock(apiUrl, { + reqheaders: { + Authorization: 'Bearer a550d8cbd4a4627013452359ab69694cd446615a' + } + }) + .put('/accounts/account-1/addresses/address-1') + .reply(200, { data: { ...addresses[0], ...addressUpdate } }) + + return Moltin.AccountAddresses.Update({ + account: 'account-1', + address: 'address-1', + body: { ...addresses[0], ...addressUpdate } + }).then(response => { + assert.equal(response.data.id, addresses[0].id) + assert.equal(response.data.type, addresses[0].type) + assert.equal(response.data.first_name, addresses[0].first_name) + assert.equal(response.data.name, addresses[0].name) + assert.equal(response.data.phone_number, addresses[0].phone_number) + assert.equal(response.data.instructions, addresses[0].instructions) + assert.equal(response.data.company_name, addresses[0].company_name) + assert.equal(response.data.line_1, addresses[0].line_1) + assert.equal(response.data.line_2, addresses[0].line_2) + assert.equal(response.data.county, addresses[0].county) + assert.equal(response.data.postcode, addresses[0].postcode) + assert.equal(response.data.country, addresses[0].country) + + assert.equal(response.data.last_name, addressUpdate.last_name) + assert.equal(response.data.city, addressUpdate.city) + }) + }) + + it('should update a account address using a JWT', () => { + // Intercept the API request + nock(apiUrl, { + reqheaders: { + Authorization: 'Bearer a550d8cbd4a4627013452359ab69694cd446615a', + 'EP-ACCOUNT-MANAGEMENT-AUTHENTICATION-TOKEN': 'testtoken' + } + }) + .put('/accounts/account-1/addresses/address-1') + .reply(200, { data: { ...addresses[0], ...addressUpdate } }) + + return Moltin.AccountAddresses.Update({ + account: 'account-1', + address: 'address-1', + token: 'testtoken', + body: { ...addresses[0], ...addressUpdate } + }).then(response => { + assert.equal(response.data.id, addresses[0].id) + assert.equal(response.data.type, addresses[0].type) + assert.equal(response.data.first_name, addresses[0].first_name) + assert.equal(response.data.name, addresses[0].name) + assert.equal(response.data.phone_number, addresses[0].phone_number) + assert.equal(response.data.instructions, addresses[0].instructions) + assert.equal(response.data.company_name, addresses[0].company_name) + assert.equal(response.data.line_1, addresses[0].line_1) + assert.equal(response.data.line_2, addresses[0].line_2) + assert.equal(response.data.county, addresses[0].county) + assert.equal(response.data.postcode, addresses[0].postcode) + assert.equal(response.data.country, addresses[0].country) + + assert.equal(response.data.last_name, addressUpdate.last_name) + assert.equal(response.data.city, addressUpdate.city) + }) + }) + + it('should delete a account address', () => { + // Intercept the API request + nock(apiUrl, { + reqheaders: { + Authorization: 'Bearer a550d8cbd4a4627013452359ab69694cd446615a' + } + }) + .delete('/accounts/account-1/addresses/address-1') + .reply(204) + + return Moltin.AccountAddresses.Delete({ + account: 'account-1', + address: 'address-1' + }).then(response => { + assert.equal(response, '{}') + }) + }) + + it('should delete a account address using a JWT', () => { + // Intercept the API request + nock(apiUrl, { + reqheaders: { + Authorization: 'Bearer a550d8cbd4a4627013452359ab69694cd446615a', + 'EP-ACCOUNT-MANAGEMENT-AUTHENTICATION-TOKEN': 'testtoken' + } + }) + .delete('/accounts/account-1/addresses/address-1') + .reply(204) + + return Moltin.AccountAddresses.Delete({ + account: 'account-1', + address: 'address-1', + token: 'testtoken' + }).then(response => { + assert.equal(response, '{}') + }) + }) + + it('should return an array of attributes', () => { + nock(apiUrl, { + reqheaders: { + Authorization: 'Bearer a550d8cbd4a4627013452359ab69694cd446615a' + } + }) + .get('/addresses/attributes') + .reply(200, attributeResponse) + + return Moltin.AccountAddresses.Attributes('testtoken').then(response => { + assert.lengthOf(response.data, 3) + }) + }) +}) diff --git a/test/unit/addresses.ts b/test/unit/customer-addresses.ts similarity index 91% rename from test/unit/addresses.ts rename to test/unit/customer-addresses.ts index 2707b7ca2..86a045270 100644 --- a/test/unit/addresses.ts +++ b/test/unit/customer-addresses.ts @@ -1,11 +1,7 @@ -import { assert } from 'chai' +import {assert} from 'chai' import nock from 'nock' -import { gateway as MoltinGateway } from '../../src/moltin' -import { - addressesArray as addresses, - addressUpdate, - attributeResponse -} from '../factories' +import {gateway as MoltinGateway} from '../../src/moltin' +import {customerAddressesArray as addresses, addressUpdate, attributeResponse} from '../factories' const apiUrl = 'https://api.moltin.com/v2' @@ -24,9 +20,11 @@ describe('Moltin addresses', () => { .get('/customers/customer-1/addresses') .reply(200, { data: addresses }) - return Moltin.Addresses.All({ customer: 'customer-1' }).then(response => { - assert.lengthOf(response.data, 2) - }) + return Moltin.CustomerAddresses.All({customer: 'customer-1'}).then( + response => { + assert.lengthOf(response.data, 2) + } + ) }) it('should return an array of customer addresses using a JWT', () => { @@ -40,7 +38,7 @@ describe('Moltin addresses', () => { .get('/customers/customer-1/addresses') .reply(200, { data: addresses }) - return Moltin.Addresses.All({ + return Moltin.CustomerAddresses.All({ customer: 'customer-1', token: 'testtoken' }).then(response => { @@ -58,7 +56,7 @@ describe('Moltin addresses', () => { .get('/customers/customer-1/addresses/address-1') .reply(200, { data: addresses[0] }) - return Moltin.Addresses.Get({ + return Moltin.CustomerAddresses.Get({ customer: 'customer-1', address: 'address-1' }).then(response => { @@ -77,7 +75,7 @@ describe('Moltin addresses', () => { .get('/customers/customer-1/addresses/address-1') .reply(200, { data: addresses[0] }) - return Moltin.Addresses.Get({ + return Moltin.CustomerAddresses.Get({ customer: 'customer-1', address: 'address-1', token: 'testtoken' @@ -96,7 +94,7 @@ describe('Moltin addresses', () => { .post('/customers/customer-1/addresses') .reply(201, { data: { ...addresses[0], id: undefined } }) - return Moltin.Addresses.Create({ + return Moltin.CustomerAddresses.Create({ customer: 'customer-1', body: addresses[0] }).then(response => { @@ -127,7 +125,7 @@ describe('Moltin addresses', () => { .post('/customers/customer-1/addresses') .reply(201, { data: addresses[0] }) - return Moltin.Addresses.Create({ + return Moltin.CustomerAddresses.Create({ customer: 'customer-1', body: addresses[0], token: 'testtoken' @@ -159,7 +157,7 @@ describe('Moltin addresses', () => { .put('/customers/customer-1/addresses/address-1') .reply(200, { data: { ...addresses[0], ...addressUpdate } }) - return Moltin.Addresses.Update({ + return Moltin.CustomerAddresses.Update({ customer: 'customer-1', address: 'address-1', body: { ...addresses[0], ...addressUpdate } @@ -193,7 +191,7 @@ describe('Moltin addresses', () => { .put('/customers/customer-1/addresses/address-1') .reply(200, { data: { ...addresses[0], ...addressUpdate } }) - return Moltin.Addresses.Update({ + return Moltin.CustomerAddresses.Update({ customer: 'customer-1', address: 'address-1', token: 'testtoken', @@ -227,7 +225,7 @@ describe('Moltin addresses', () => { .delete('/customers/customer-1/addresses/address-1') .reply(204) - return Moltin.Addresses.Delete({ + return Moltin.CustomerAddresses.Delete({ customer: 'customer-1', address: 'address-1' }).then(response => { @@ -246,7 +244,7 @@ describe('Moltin addresses', () => { .delete('/customers/customer-1/addresses/address-1') .reply(204) - return Moltin.Addresses.Delete({ + return Moltin.CustomerAddresses.Delete({ customer: 'customer-1', address: 'address-1', token: 'testtoken' @@ -264,7 +262,7 @@ describe('Moltin addresses', () => { .get('/addresses/attributes') .reply(200, attributeResponse) - return Moltin.Addresses.Attributes('testtoken').then(response => { + return Moltin.CustomerAddresses.Attributes('testtoken').then(response => { assert.lengthOf(response.data, 3) }) })