diff --git a/package-lock.json b/package-lock.json index f719d049..836ab61a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,6 @@ "license": "MIT", "dependencies": { "ajv": "^6.12.6", - "auth0": "^3.0.0", "dot-prop": "^5.2.0", "fs-extra": "^10.1.0", "global-agent": "^2.1.12", @@ -32,6 +31,7 @@ "@types/mocha": "^10.0.0", "@types/nconf": "^0.10.3", "@typescript-eslint/parser": "^5.30.3", + "auth0": "^4.0.0-beta.9", "chai": "^4.3.7", "chai-as-promised": "^7.1.1", "eslint": "^7.28.0", @@ -42,6 +42,7 @@ "kacl": "^1.1.1", "mocha": "^10.1.0", "nock": "^13.2.9", + "node-fetch": "^2.7.0", "nyc": "^15.0.1", "prettier": "^2.6.2", "pretty-quick": "^3.1.3", @@ -835,44 +836,6 @@ "integrity": "sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==", "dev": true }, - "node_modules/@types/body-parser": { - "version": "1.19.2", - "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz", - "integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==", - "dependencies": { - "@types/connect": "*", - "@types/node": "*" - } - }, - "node_modules/@types/connect": { - "version": "3.4.35", - "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", - "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/express": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.15.tgz", - "integrity": "sha512-Yv0k4bXGOH+8a+7bELd2PqHQsuiANB+A8a4gnQrkRWzrkKlb6KHaVvyXhqs04sVW/OWlbPyYxRgYlIXLfrufMQ==", - "dependencies": { - "@types/body-parser": "*", - "@types/express-serve-static-core": "^4.17.31", - "@types/qs": "*", - "@types/serve-static": "*" - } - }, - "node_modules/@types/express-serve-static-core": { - "version": "4.17.32", - "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.32.tgz", - "integrity": "sha512-aI5h/VOkxOF2Z1saPy0Zsxs5avets/iaiAJYznQFm5By/pamU31xWKL//epiF4OfUA2qTOc9PV6tCUjhO8wlZA==", - "dependencies": { - "@types/node": "*", - "@types/qs": "*", - "@types/range-parser": "*" - } - }, "node_modules/@types/fs-extra": { "version": "9.0.13", "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz", @@ -888,25 +851,12 @@ "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, - "node_modules/@types/jsonwebtoken": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-9.0.1.tgz", - "integrity": "sha512-c5ltxazpWabia/4UzhIoaDcIza4KViOQhdbjRlfcIGVnsE3c3brkz9Z+F/EeJIECOQP7W7US2hNE930cWWkPiw==", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/lodash": { "version": "4.14.187", "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.187.tgz", "integrity": "sha512-MrO/xLXCaUgZy3y96C/iOsaIqZSeupyTImKClHunL5GrmaiII2VwvWmLBu2hwa0Kp0sV19CsyjtrTc/Fx8rg/A==", "dev": true }, - "node_modules/@types/mime": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@types/mime/-/mime-3.0.1.tgz", - "integrity": "sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA==" - }, "node_modules/@types/minimatch": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz", @@ -928,26 +878,8 @@ "node_modules/@types/node": { "version": "18.7.2", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.2.tgz", - "integrity": "sha512-ce7MIiaYWCFv6A83oEultwhBXb22fxwNOQf5DIxWA4WXvDQ7K+L0fbWl/YOfCzlR5B/uFkSnVBhPcOfOECcWvA==" - }, - "node_modules/@types/qs": { - "version": "6.9.7", - "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", - "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==" - }, - "node_modules/@types/range-parser": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz", - "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==" - }, - "node_modules/@types/serve-static": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.0.tgz", - "integrity": "sha512-z5xyF6uh8CbjAu9760KDKsH2FcDxZ2tFCsA4HIMWE6IkiYMXfVoa+4f9KX+FN0ZLsaMw1WNG2ETLA6N+/YA+cg==", - "dependencies": { - "@types/mime": "*", - "@types/node": "*" - } + "integrity": "sha512-ce7MIiaYWCFv6A83oEultwhBXb22fxwNOQf5DIxWA4WXvDQ7K+L0fbWl/YOfCzlR5B/uFkSnVBhPcOfOECcWvA==", + "dev": true }, "node_modules/@typescript-eslint/parser": { "version": "5.62.0", @@ -1323,48 +1255,24 @@ "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==" }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" - }, "node_modules/auth0": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/auth0/-/auth0-3.7.0.tgz", - "integrity": "sha512-Ai1T+ltEvcoZdIKbZ5TnLHMkioKxU/j01ZsDWKx55/toqFJXOWypw37kQNdqvHgteFGE142k4MjSt5u1wlOi3A==", - "dependencies": { - "axios": "^0.27.2", - "form-data": "^3.0.1", - "jsonwebtoken": "^9.0.0", - "jwks-rsa": "^3.0.1", - "lru-memoizer": "^2.1.4", - "rest-facade": "^1.16.3", - "retry": "^0.13.1", - "uuid": "^9.0.0" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/auth0/node_modules/jsonwebtoken": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.0.tgz", - "integrity": "sha512-tuGfYXxkQGDPnLJ7SibiQgVgeDgfbPq2k2ICcbgqW8WxWLBAxKQM/ZCu/IT8SOSwmaYl4dpTFCW5xZv7YbbWUw==", + "version": "4.0.0-beta.9", + "resolved": "https://registry.npmjs.org/auth0/-/auth0-4.0.0-beta.9.tgz", + "integrity": "sha512-OE91SmGUZLP6pyR3ynfeJTgOnqd22Igyawe8pWNQgxgsGyszRbNjzVJ/bdsYaTELYsoGscGNfOWO4DFfBRv5TQ==", + "dev": true, "dependencies": { - "jws": "^3.2.2", - "lodash": "^4.17.21", - "ms": "^2.1.1", - "semver": "^7.3.8" + "jose": "^4.13.2", + "uuid": "^9.0.0" }, "engines": { - "node": ">=12", - "npm": ">=6" + "node": ">=18" } }, "node_modules/auth0/node_modules/uuid": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", + "dev": true, "bin": { "uuid": "dist/bin/uuid" } @@ -1381,28 +1289,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/axios": { - "version": "0.27.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", - "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", - "dependencies": { - "follow-redirects": "^1.14.9", - "form-data": "^4.0.0" - } - }, - "node_modules/axios/node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -1479,11 +1365,6 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, - "node_modules/buffer-equal-constant-time": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", - "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" - }, "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", @@ -1509,6 +1390,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, "dependencies": { "function-bind": "^1.1.1", "get-intrinsic": "^1.0.2" @@ -1526,15 +1408,6 @@ "node": ">=6" } }, - "node_modules/camel-case": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-1.2.2.tgz", - "integrity": "sha512-rUug78lL8mqStaLehmH2F0LxMJ2TM9fnPFxb+gFkgyUjUM/1o2wKTQtalypHnkb2cFwH/DENBw7YEAOYLgSMxQ==", - "dependencies": { - "sentence-case": "^1.1.1", - "upper-case": "^1.1.1" - } - }, "node_modules/camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", @@ -1605,29 +1478,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/change-case": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/change-case/-/change-case-2.3.1.tgz", - "integrity": "sha512-3HE5jrTqqn9jeKzD0+yWi7FU4OMicLbwB57ph4bpwEn5jGi3hZug5WjZjnBD2RY7YyTKAAck86ACfShXUWJKLg==", - "dependencies": { - "camel-case": "^1.1.1", - "constant-case": "^1.1.0", - "dot-case": "^1.1.0", - "is-lower-case": "^1.1.0", - "is-upper-case": "^1.1.0", - "lower-case": "^1.1.1", - "lower-case-first": "^1.0.0", - "param-case": "^1.1.0", - "pascal-case": "^1.1.0", - "path-case": "^1.1.0", - "sentence-case": "^1.1.1", - "snake-case": "^1.1.0", - "swap-case": "^1.1.0", - "title-case": "^1.1.0", - "upper-case": "^1.1.1", - "upper-case-first": "^1.1.0" - } - }, "node_modules/check-error": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", @@ -1739,28 +1589,12 @@ "text-hex": "1.0.x" } }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, "node_modules/commondir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", "dev": true }, - "node_modules/component-emitter": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", - "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" - }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -1773,15 +1607,6 @@ "integrity": "sha512-JsPKdmh8ZkmnHxDk55FZ1TqVLvEQTvoByJZRN9jzI0UjxK/QgAmsphz7PGtqgPieQZ/CQcHWXCR7ATDNhGe+YA==", "dev": true }, - "node_modules/constant-case": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/constant-case/-/constant-case-1.1.2.tgz", - "integrity": "sha512-FQ/HuOuSnX6nIF8OnofRWj+KnOpGAHXQpOKHmsL1sAnuLwu6r5mHGK+mJc0SkHkbmNfcU/SauqXLTEOL1JQfJA==", - "dependencies": { - "snake-case": "^1.1.0", - "upper-case": "^1.1.1" - } - }, "node_modules/convert-source-map": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", @@ -1797,11 +1622,6 @@ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true }, - "node_modules/cookiejar": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.4.tgz", - "integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==" - }, "node_modules/core-js": { "version": "3.24.1", "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.24.1.tgz", @@ -1816,6 +1636,7 @@ "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, "dependencies": { "ms": "2.1.2" }, @@ -1854,14 +1675,6 @@ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, - "node_modules/deepmerge": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-3.3.0.tgz", - "integrity": "sha512-GRQOafGHwMHpjPx9iCvTgpu9NojZ49q794EEL94JVEw6VaeA8XTUyBKvAkOOjBX9oJNiV6G3P+T+tihFjo2TqA==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/default-require-extensions": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-3.0.0.tgz", @@ -1889,14 +1702,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/detect-node": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz", @@ -1935,14 +1740,6 @@ "node": ">=6.0.0" } }, - "node_modules/dot-case": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-1.1.2.tgz", - "integrity": "sha512-NzEIt12UjECXi6JZ/R/nBey6EE1qCN0yUTEFaPIaKW0AcOEwlKqujtcJVbtSfLNnj3CDoXLQyli79vAaqohyvw==", - "dependencies": { - "sentence-case": "^1.1.2" - } - }, "node_modules/dot-prop": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", @@ -1954,14 +1751,6 @@ "node": ">=8" } }, - "node_modules/ecdsa-sig-formatter": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", - "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", - "dependencies": { - "safe-buffer": "^5.0.1" - } - }, "node_modules/electron-to-chromium": { "version": "1.4.215", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.215.tgz", @@ -2648,11 +2437,6 @@ "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", "dev": true }, - "node_modules/fast-safe-stringify": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", - "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==" - }, "node_modules/fastq": { "version": "1.15.0", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", @@ -2741,25 +2525,6 @@ "resolved": "https://registry.npmjs.org/fn.name/-/fn.name-1.1.0.tgz", "integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==" }, - "node_modules/follow-redirects": { - "version": "1.15.1", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz", - "integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], - "engines": { - "node": ">=4.0" - }, - "peerDependenciesMeta": { - "debug": { - "optional": true - } - } - }, "node_modules/for-each": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", @@ -2832,28 +2597,6 @@ "node": ">= 8" } }, - "node_modules/form-data": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", - "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/formidable": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.6.tgz", - "integrity": "sha512-KcpbcpuLNOwrEjnbpMC0gS+X8ciDoZE1kkqzat4a8vrprf+s9pKNQ/QIwWfbfs4ltgmFl3MD177SNTkve3BwGQ==", - "deprecated": "Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau", - "funding": { - "url": "https://ko-fi.com/tunnckoCore/commissions" - } - }, "node_modules/fromentries": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/fromentries/-/fromentries-1.3.2.tgz", @@ -3497,14 +3240,6 @@ "node": ">=0.10.0" } }, - "node_modules/is-lower-case": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/is-lower-case/-/is-lower-case-1.1.3.tgz", - "integrity": "sha512-+5A1e/WJpLLXZEDlgz4G//WYSHyQBD32qa4Jd3Lw06qQlv3fJHnp3YIHjTQSGzHMgzmVKz2ZP3rBxTHkPw/lxA==", - "dependencies": { - "lower-case": "^1.1.0" - } - }, "node_modules/is-negative-zero": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", @@ -3664,14 +3399,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-upper-case": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/is-upper-case/-/is-upper-case-1.1.2.tgz", - "integrity": "sha512-GQYSJMgfeAmVwh9ixyk888l7OIhNAGKtY6QA+IrWlu9MDTCaXmeozOZ2S9Knj7bQwBO/H6J2kb+pbyTUiMNbsw==", - "dependencies": { - "upper-case": "^1.1.0" - } - }, "node_modules/is-weakref": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", @@ -3859,9 +3586,10 @@ } }, "node_modules/jose": { - "version": "4.11.2", - "resolved": "https://registry.npmjs.org/jose/-/jose-4.11.2.tgz", - "integrity": "sha512-njj0VL2TsIxCtgzhO+9RRobBvws4oYyCM8TpvoUQwl/MbIM3NFJRR9+e6x0sS5xXaP1t6OCBkaBME98OV9zU5A==", + "version": "4.14.4", + "resolved": "https://registry.npmjs.org/jose/-/jose-4.14.4.tgz", + "integrity": "sha512-j8GhLiKmUAh+dsFXlX1aJCbt5KMibuKb+d7j1JaOJG6s2UjX1PQlW+OKB/sD4a/5ZYF4RcmYmLSndOoU3Lt/3g==", + "dev": true, "funding": { "url": "https://github.com/sponsors/panva" } @@ -3940,41 +3668,6 @@ "integrity": "sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg==", "dev": true }, - "node_modules/jwa": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", - "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", - "dependencies": { - "buffer-equal-constant-time": "1.0.1", - "ecdsa-sig-formatter": "1.0.11", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/jwks-rsa": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/jwks-rsa/-/jwks-rsa-3.0.1.tgz", - "integrity": "sha512-UUOZ0CVReK1QVU3rbi9bC7N5/le8ziUj0A2ef1Q0M7OPD2KvjEYizptqIxGIo6fSLYDkqBrazILS18tYuRc8gw==", - "dependencies": { - "@types/express": "^4.17.14", - "@types/jsonwebtoken": "^9.0.0", - "debug": "^4.3.4", - "jose": "^4.10.4", - "limiter": "^1.1.5", - "lru-memoizer": "^2.1.4" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/jws": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", - "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", - "dependencies": { - "jwa": "^1.4.1", - "safe-buffer": "^5.0.1" - } - }, "node_modules/kacl": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/kacl/-/kacl-1.1.1.tgz", @@ -4005,21 +3698,11 @@ "node": ">= 0.8.0" } }, - "node_modules/limiter": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/limiter/-/limiter-1.1.5.tgz", - "integrity": "sha512-FWWMIEOxz3GwUI4Ts/IvgVy6LPvoMPgjMdQ185nN6psJyBJ4yOpzqm695/h5umdLJg2vW3GR5iG11MAkR2AzJA==" - }, "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, - "node_modules/lodash.clonedeep": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", - "integrity": "sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==" - }, "node_modules/lodash.flattendeep": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", @@ -4029,7 +3712,8 @@ "node_modules/lodash.get": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", - "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==" + "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==", + "dev": true }, "node_modules/lodash.merge": { "version": "4.6.2", @@ -4080,37 +3764,6 @@ "get-func-name": "^2.0.0" } }, - "node_modules/lower-case": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz", - "integrity": "sha512-2Fgx1Ycm599x+WGpIYwJOvsjmXFzTSc34IwDWALRA/8AopUKAVPwfJ+h5+f85BCp0PWmmJcWzEpxOpoXycMpdA==" - }, - "node_modules/lower-case-first": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/lower-case-first/-/lower-case-first-1.0.2.tgz", - "integrity": "sha512-UuxaYakO7XeONbKrZf5FEgkantPf5DUqDayzP5VXZrtRPdH86s4kN47I8B3TW10S4QKiE3ziHNf3kRN//okHjA==", - "dependencies": { - "lower-case": "^1.1.2" - } - }, - "node_modules/lru-cache": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.0.2.tgz", - "integrity": "sha512-uQw9OqphAGiZhkuPlpFGmdTU2tEuhxTourM/19qGJrxBPHAr/f8BT1a0i/lOclESnGatdJG/UCkP9kZB/Lh1iw==", - "dependencies": { - "pseudomap": "^1.0.1", - "yallist": "^2.0.0" - } - }, - "node_modules/lru-memoizer": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/lru-memoizer/-/lru-memoizer-2.1.4.tgz", - "integrity": "sha512-IXAq50s4qwrOBrXJklY+KhgZF+5y98PDaNo0gi/v2KQBFLyWr+JyFvijZXkGKjQj/h9c0OwoE+JZbwUXce76hQ==", - "dependencies": { - "lodash.clonedeep": "^4.5.0", - "lru-cache": "~4.0.0" - } - }, "node_modules/make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -4167,14 +3820,6 @@ "node": ">= 8" } }, - "node_modules/methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", - "engines": { - "node": ">= 0.6" - } - }, "node_modules/micromatch": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", @@ -4188,36 +3833,6 @@ "node": ">=8.6" } }, - "node_modules/mime": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz", - "integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, "node_modules/mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", @@ -4618,6 +4233,26 @@ "node": ">= 10.13" } }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dev": true, + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, "node_modules/node-preload": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/node-preload/-/node-preload-0.2.1.tgz", @@ -4781,6 +4416,7 @@ "version": "1.12.3", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", + "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -4955,14 +4591,6 @@ "node": ">=8" } }, - "node_modules/param-case": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/param-case/-/param-case-1.1.2.tgz", - "integrity": "sha512-gksk6zeZQxwBm1AHsKh+XDFsTGf1LvdZSkkpSIkfDtzW+EQj/P2PBgNb3Cs0Y9Xxqmbciv2JZe3fWU6Xbher+Q==", - "dependencies": { - "sentence-case": "^1.1.2" - } - }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -4975,23 +4603,6 @@ "node": ">=6" } }, - "node_modules/pascal-case": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/pascal-case/-/pascal-case-1.1.2.tgz", - "integrity": "sha512-QWlbdQHdKWlcyTEuv/M0noJtlCa7qTmg5QFAqhx5X9xjAfCU1kXucL+rcOmd2HliESuRLIOz8521RAW/yhuQog==", - "dependencies": { - "camel-case": "^1.1.1", - "upper-case-first": "^1.1.0" - } - }, - "node_modules/path-case": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/path-case/-/path-case-1.1.2.tgz", - "integrity": "sha512-2snAGA6xVRqTuTPa40bn0iEpYtVK6gEqeyS/63dqpm5pGlesOv6EmRcnB9Rr6eAnAC2Wqlbz0tqgJZryttxhxg==", - "dependencies": { - "sentence-case": "^1.1.2" - } - }, "node_modules/path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -5353,11 +4964,6 @@ "node": ">= 8" } }, - "node_modules/pseudomap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==" - }, "node_modules/pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", @@ -5376,20 +4982,6 @@ "node": ">=6" } }, - "node_modules/qs": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", - "dependencies": { - "side-channel": "^1.0.4" - }, - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -5533,33 +5125,6 @@ "node": ">=4" } }, - "node_modules/rest-facade": { - "version": "1.16.3", - "resolved": "https://registry.npmjs.org/rest-facade/-/rest-facade-1.16.3.tgz", - "integrity": "sha512-9BQTPLiwg23XZwcWi0ys1wTizfc//0b2G3U6vBWcgqh56ozs2K6CD+Jw4DYcw3AqdPQN7jj8nzRUcUXFVGzb0Q==", - "dependencies": { - "change-case": "^2.3.0", - "deepmerge": "^3.2.0", - "lodash.get": "^4.4.2", - "superagent": "^5.1.1" - }, - "peerDependencies": { - "superagent-proxy": "^3.0.0" - }, - "peerDependenciesMeta": { - "superagent-proxy": { - "optional": true - } - } - }, - "node_modules/retry": { - "version": "0.13.1", - "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", - "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", - "engines": { - "node": ">= 4" - } - }, "node_modules/reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -5743,14 +5308,6 @@ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, - "node_modules/sentence-case": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/sentence-case/-/sentence-case-1.1.3.tgz", - "integrity": "sha512-laa/UDTPXsrQnoN/Kc8ZO7gTeEjMsuPiDgUCk9N0iINRZvqAMCTXjGl8+tD27op1eF/JHbdUlEUmovDh6AX7sA==", - "dependencies": { - "lower-case": "^1.1.1" - } - }, "node_modules/serialize-error": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-7.0.1.tgz", @@ -5794,6 +5351,7 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, "dependencies": { "call-bind": "^1.0.0", "get-intrinsic": "^1.0.2", @@ -5871,14 +5429,6 @@ "url": "https://github.com/chalk/slice-ansi?sponsor=1" } }, - "node_modules/snake-case": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-1.1.2.tgz", - "integrity": "sha512-oapUKC+qulnUIN+/O7Tbl2msi9PQvJeivGN9RNbygxzI2EOY0gA96i8BJLYnGUWSLGcYtyW4YYqnGTZEySU/gg==", - "dependencies": { - "sentence-case": "^1.1.2" - } - }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -6050,28 +5600,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/superagent": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/superagent/-/superagent-5.3.1.tgz", - "integrity": "sha512-wjJ/MoTid2/RuGCOFtlacyGNxN9QLMgcpYLDQlWFIhhdJ93kNscFonGvrpAHSCVjRVj++DGCglocF7Aej1KHvQ==", - "deprecated": "Please upgrade to v7.0.2+ of superagent. We have fixed numerous issues with streams, form-data, attach(), filesystem errors not bubbling up (ENOENT on attach()), and all tests are now passing. See the releases tab for more information at .", - "dependencies": { - "component-emitter": "^1.3.0", - "cookiejar": "^2.1.2", - "debug": "^4.1.1", - "fast-safe-stringify": "^2.0.7", - "form-data": "^3.0.0", - "formidable": "^1.2.2", - "methods": "^1.1.2", - "mime": "^2.4.6", - "qs": "^6.9.4", - "readable-stream": "^3.6.0", - "semver": "^7.3.2" - }, - "engines": { - "node": ">= 7.0.0" - } - }, "node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -6096,15 +5624,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/swap-case": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/swap-case/-/swap-case-1.1.2.tgz", - "integrity": "sha512-BAmWG6/bx8syfc6qXPprof3Mn5vQgf5dwdUNJhsNqU9WdPt5P+ES/wQ5bxfijy8zwZgZZHslC3iAsxsuQMCzJQ==", - "dependencies": { - "lower-case": "^1.1.1", - "upper-case": "^1.1.1" - } - }, "node_modules/table": { "version": "6.8.0", "resolved": "https://registry.npmjs.org/table/-/table-6.8.0.tgz", @@ -6168,15 +5687,6 @@ "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", "dev": true }, - "node_modules/title-case": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/title-case/-/title-case-1.1.2.tgz", - "integrity": "sha512-xYbo5Um5MBgn24xJSK+x5hZ8ehuGXTVhgx32KJCThHRHwpyIb1lmABi1DH5VvN9E7rNEquPjz//rF/tZQd7mjQ==", - "dependencies": { - "sentence-case": "^1.1.1", - "upper-case": "^1.0.3" - } - }, "node_modules/to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", @@ -6198,6 +5708,12 @@ "node": ">=8.0" } }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "dev": true + }, "node_modules/triple-beam": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz", @@ -6507,19 +6023,6 @@ "browserslist": ">= 4.21.0" } }, - "node_modules/upper-case": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/upper-case/-/upper-case-1.1.3.tgz", - "integrity": "sha512-WRbjgmYzgXkCV7zNVpy5YgrHgbBv126rMALQQMrmzOVC4GM2waQ9x7xtm8VU+1yF2kWyPzI9zbZ48n4vSxwfSA==" - }, - "node_modules/upper-case-first": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/upper-case-first/-/upper-case-first-1.1.2.tgz", - "integrity": "sha512-wINKYvI3Db8dtjikdAqoBbZoP6Q+PZUyfMR7pmwHzjC2quzSkUq5DmPrTtPEqHaz8AGtmsB4TqwapMTM1QAQOQ==", - "dependencies": { - "upper-case": "^1.1.1" - } - }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -6553,6 +6056,22 @@ "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", "dev": true }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "dev": true + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dev": true, + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/which-boxed-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", @@ -6678,11 +6197,6 @@ "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==" }, - "node_modules/yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==" - }, "node_modules/yargs": { "version": "15.4.1", "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", @@ -7485,44 +6999,6 @@ "integrity": "sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==", "dev": true }, - "@types/body-parser": { - "version": "1.19.2", - "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz", - "integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==", - "requires": { - "@types/connect": "*", - "@types/node": "*" - } - }, - "@types/connect": { - "version": "3.4.35", - "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", - "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==", - "requires": { - "@types/node": "*" - } - }, - "@types/express": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.15.tgz", - "integrity": "sha512-Yv0k4bXGOH+8a+7bELd2PqHQsuiANB+A8a4gnQrkRWzrkKlb6KHaVvyXhqs04sVW/OWlbPyYxRgYlIXLfrufMQ==", - "requires": { - "@types/body-parser": "*", - "@types/express-serve-static-core": "^4.17.31", - "@types/qs": "*", - "@types/serve-static": "*" - } - }, - "@types/express-serve-static-core": { - "version": "4.17.32", - "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.32.tgz", - "integrity": "sha512-aI5h/VOkxOF2Z1saPy0Zsxs5avets/iaiAJYznQFm5By/pamU31xWKL//epiF4OfUA2qTOc9PV6tCUjhO8wlZA==", - "requires": { - "@types/node": "*", - "@types/qs": "*", - "@types/range-parser": "*" - } - }, "@types/fs-extra": { "version": "9.0.13", "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz", @@ -7538,25 +7014,12 @@ "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, - "@types/jsonwebtoken": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-9.0.1.tgz", - "integrity": "sha512-c5ltxazpWabia/4UzhIoaDcIza4KViOQhdbjRlfcIGVnsE3c3brkz9Z+F/EeJIECOQP7W7US2hNE930cWWkPiw==", - "requires": { - "@types/node": "*" - } - }, "@types/lodash": { "version": "4.14.187", "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.187.tgz", "integrity": "sha512-MrO/xLXCaUgZy3y96C/iOsaIqZSeupyTImKClHunL5GrmaiII2VwvWmLBu2hwa0Kp0sV19CsyjtrTc/Fx8rg/A==", "dev": true }, - "@types/mime": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@types/mime/-/mime-3.0.1.tgz", - "integrity": "sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA==" - }, "@types/minimatch": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz", @@ -7578,26 +7041,8 @@ "@types/node": { "version": "18.7.2", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.2.tgz", - "integrity": "sha512-ce7MIiaYWCFv6A83oEultwhBXb22fxwNOQf5DIxWA4WXvDQ7K+L0fbWl/YOfCzlR5B/uFkSnVBhPcOfOECcWvA==" - }, - "@types/qs": { - "version": "6.9.7", - "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", - "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==" - }, - "@types/range-parser": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz", - "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==" - }, - "@types/serve-static": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.0.tgz", - "integrity": "sha512-z5xyF6uh8CbjAu9760KDKsH2FcDxZ2tFCsA4HIMWE6IkiYMXfVoa+4f9KX+FN0ZLsaMw1WNG2ETLA6N+/YA+cg==", - "requires": { - "@types/mime": "*", - "@types/node": "*" - } + "integrity": "sha512-ce7MIiaYWCFv6A83oEultwhBXb22fxwNOQf5DIxWA4WXvDQ7K+L0fbWl/YOfCzlR5B/uFkSnVBhPcOfOECcWvA==", + "dev": true }, "@typescript-eslint/parser": { "version": "5.62.0", @@ -7844,41 +7289,21 @@ "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==" }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" - }, "auth0": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/auth0/-/auth0-3.7.0.tgz", - "integrity": "sha512-Ai1T+ltEvcoZdIKbZ5TnLHMkioKxU/j01ZsDWKx55/toqFJXOWypw37kQNdqvHgteFGE142k4MjSt5u1wlOi3A==", - "requires": { - "axios": "^0.27.2", - "form-data": "^3.0.1", - "jsonwebtoken": "^9.0.0", - "jwks-rsa": "^3.0.1", - "lru-memoizer": "^2.1.4", - "rest-facade": "^1.16.3", - "retry": "^0.13.1", + "version": "4.0.0-beta.9", + "resolved": "https://registry.npmjs.org/auth0/-/auth0-4.0.0-beta.9.tgz", + "integrity": "sha512-OE91SmGUZLP6pyR3ynfeJTgOnqd22Igyawe8pWNQgxgsGyszRbNjzVJ/bdsYaTELYsoGscGNfOWO4DFfBRv5TQ==", + "dev": true, + "requires": { + "jose": "^4.13.2", "uuid": "^9.0.0" }, "dependencies": { - "jsonwebtoken": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.0.tgz", - "integrity": "sha512-tuGfYXxkQGDPnLJ7SibiQgVgeDgfbPq2k2ICcbgqW8WxWLBAxKQM/ZCu/IT8SOSwmaYl4dpTFCW5xZv7YbbWUw==", - "requires": { - "jws": "^3.2.2", - "lodash": "^4.17.21", - "ms": "^2.1.1", - "semver": "^7.3.8" - } - }, "uuid": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", - "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==" + "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", + "dev": true } } }, @@ -7888,27 +7313,6 @@ "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", "dev": true }, - "axios": { - "version": "0.27.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", - "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", - "requires": { - "follow-redirects": "^1.14.9", - "form-data": "^4.0.0" - }, - "dependencies": { - "form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - } - } - } - }, "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -7963,11 +7367,6 @@ "update-browserslist-db": "^1.0.5" } }, - "buffer-equal-constant-time": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", - "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" - }, "buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", @@ -7990,6 +7389,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, "requires": { "function-bind": "^1.1.1", "get-intrinsic": "^1.0.2" @@ -8001,15 +7401,6 @@ "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", "dev": true }, - "camel-case": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-1.2.2.tgz", - "integrity": "sha512-rUug78lL8mqStaLehmH2F0LxMJ2TM9fnPFxb+gFkgyUjUM/1o2wKTQtalypHnkb2cFwH/DENBw7YEAOYLgSMxQ==", - "requires": { - "sentence-case": "^1.1.1", - "upper-case": "^1.1.1" - } - }, "camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", @@ -8055,29 +7446,6 @@ "supports-color": "^7.1.0" } }, - "change-case": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/change-case/-/change-case-2.3.1.tgz", - "integrity": "sha512-3HE5jrTqqn9jeKzD0+yWi7FU4OMicLbwB57ph4bpwEn5jGi3hZug5WjZjnBD2RY7YyTKAAck86ACfShXUWJKLg==", - "requires": { - "camel-case": "^1.1.1", - "constant-case": "^1.1.0", - "dot-case": "^1.1.0", - "is-lower-case": "^1.1.0", - "is-upper-case": "^1.1.0", - "lower-case": "^1.1.1", - "lower-case-first": "^1.0.0", - "param-case": "^1.1.0", - "pascal-case": "^1.1.0", - "path-case": "^1.1.0", - "sentence-case": "^1.1.1", - "snake-case": "^1.1.0", - "swap-case": "^1.1.0", - "title-case": "^1.1.0", - "upper-case": "^1.1.1", - "upper-case-first": "^1.1.0" - } - }, "check-error": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", @@ -8171,25 +7539,12 @@ "text-hex": "1.0.x" } }, - "combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "requires": { - "delayed-stream": "~1.0.0" - } - }, "commondir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", "dev": true }, - "component-emitter": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", - "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" - }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -8202,15 +7557,6 @@ "integrity": "sha512-JsPKdmh8ZkmnHxDk55FZ1TqVLvEQTvoByJZRN9jzI0UjxK/QgAmsphz7PGtqgPieQZ/CQcHWXCR7ATDNhGe+YA==", "dev": true }, - "constant-case": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/constant-case/-/constant-case-1.1.2.tgz", - "integrity": "sha512-FQ/HuOuSnX6nIF8OnofRWj+KnOpGAHXQpOKHmsL1sAnuLwu6r5mHGK+mJc0SkHkbmNfcU/SauqXLTEOL1JQfJA==", - "requires": { - "snake-case": "^1.1.0", - "upper-case": "^1.1.1" - } - }, "convert-source-map": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", @@ -8228,11 +7574,6 @@ } } }, - "cookiejar": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.4.tgz", - "integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==" - }, "core-js": { "version": "3.24.1", "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.24.1.tgz", @@ -8242,6 +7583,7 @@ "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, "requires": { "ms": "2.1.2" } @@ -8266,11 +7608,6 @@ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, - "deepmerge": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-3.3.0.tgz", - "integrity": "sha512-GRQOafGHwMHpjPx9iCvTgpu9NojZ49q794EEL94JVEw6VaeA8XTUyBKvAkOOjBX9oJNiV6G3P+T+tihFjo2TqA==" - }, "default-require-extensions": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-3.0.0.tgz", @@ -8289,11 +7626,6 @@ "object-keys": "^1.1.1" } }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" - }, "detect-node": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz", @@ -8323,14 +7655,6 @@ "esutils": "^2.0.2" } }, - "dot-case": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-1.1.2.tgz", - "integrity": "sha512-NzEIt12UjECXi6JZ/R/nBey6EE1qCN0yUTEFaPIaKW0AcOEwlKqujtcJVbtSfLNnj3CDoXLQyli79vAaqohyvw==", - "requires": { - "sentence-case": "^1.1.2" - } - }, "dot-prop": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", @@ -8339,14 +7663,6 @@ "is-obj": "^2.0.0" } }, - "ecdsa-sig-formatter": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", - "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", - "requires": { - "safe-buffer": "^5.0.1" - } - }, "electron-to-chromium": { "version": "1.4.215", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.215.tgz", @@ -8889,11 +8205,6 @@ "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", "dev": true }, - "fast-safe-stringify": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", - "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==" - }, "fastq": { "version": "1.15.0", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", @@ -8964,11 +8275,6 @@ "resolved": "https://registry.npmjs.org/fn.name/-/fn.name-1.1.0.tgz", "integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==" }, - "follow-redirects": { - "version": "1.15.1", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz", - "integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==" - }, "for-each": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", @@ -9025,21 +8331,6 @@ } } }, - "form-data": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", - "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - } - }, - "formidable": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.6.tgz", - "integrity": "sha512-KcpbcpuLNOwrEjnbpMC0gS+X8ciDoZE1kkqzat4a8vrprf+s9pKNQ/QIwWfbfs4ltgmFl3MD177SNTkve3BwGQ==" - }, "fromentries": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/fromentries/-/fromentries-1.3.2.tgz", @@ -9477,14 +8768,6 @@ "is-extglob": "^2.1.1" } }, - "is-lower-case": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/is-lower-case/-/is-lower-case-1.1.3.tgz", - "integrity": "sha512-+5A1e/WJpLLXZEDlgz4G//WYSHyQBD32qa4Jd3Lw06qQlv3fJHnp3YIHjTQSGzHMgzmVKz2ZP3rBxTHkPw/lxA==", - "requires": { - "lower-case": "^1.1.0" - } - }, "is-negative-zero": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", @@ -9584,14 +8867,6 @@ "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", "dev": true }, - "is-upper-case": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/is-upper-case/-/is-upper-case-1.1.2.tgz", - "integrity": "sha512-GQYSJMgfeAmVwh9ixyk888l7OIhNAGKtY6QA+IrWlu9MDTCaXmeozOZ2S9Knj7bQwBO/H6J2kb+pbyTUiMNbsw==", - "requires": { - "upper-case": "^1.1.0" - } - }, "is-weakref": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", @@ -9738,9 +9013,10 @@ } }, "jose": { - "version": "4.11.2", - "resolved": "https://registry.npmjs.org/jose/-/jose-4.11.2.tgz", - "integrity": "sha512-njj0VL2TsIxCtgzhO+9RRobBvws4oYyCM8TpvoUQwl/MbIM3NFJRR9+e6x0sS5xXaP1t6OCBkaBME98OV9zU5A==" + "version": "4.14.4", + "resolved": "https://registry.npmjs.org/jose/-/jose-4.14.4.tgz", + "integrity": "sha512-j8GhLiKmUAh+dsFXlX1aJCbt5KMibuKb+d7j1JaOJG6s2UjX1PQlW+OKB/sD4a/5ZYF4RcmYmLSndOoU3Lt/3g==", + "dev": true }, "js-tokens": { "version": "4.0.0", @@ -9799,38 +9075,6 @@ "integrity": "sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg==", "dev": true }, - "jwa": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", - "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", - "requires": { - "buffer-equal-constant-time": "1.0.1", - "ecdsa-sig-formatter": "1.0.11", - "safe-buffer": "^5.0.1" - } - }, - "jwks-rsa": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/jwks-rsa/-/jwks-rsa-3.0.1.tgz", - "integrity": "sha512-UUOZ0CVReK1QVU3rbi9bC7N5/le8ziUj0A2ef1Q0M7OPD2KvjEYizptqIxGIo6fSLYDkqBrazILS18tYuRc8gw==", - "requires": { - "@types/express": "^4.17.14", - "@types/jsonwebtoken": "^9.0.0", - "debug": "^4.3.4", - "jose": "^4.10.4", - "limiter": "^1.1.5", - "lru-memoizer": "^2.1.4" - } - }, - "jws": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", - "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", - "requires": { - "jwa": "^1.4.1", - "safe-buffer": "^5.0.1" - } - }, "kacl": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/kacl/-/kacl-1.1.1.tgz", @@ -9852,21 +9096,11 @@ "type-check": "~0.4.0" } }, - "limiter": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/limiter/-/limiter-1.1.5.tgz", - "integrity": "sha512-FWWMIEOxz3GwUI4Ts/IvgVy6LPvoMPgjMdQ185nN6psJyBJ4yOpzqm695/h5umdLJg2vW3GR5iG11MAkR2AzJA==" - }, "lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, - "lodash.clonedeep": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", - "integrity": "sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==" - }, "lodash.flattendeep": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", @@ -9876,7 +9110,8 @@ "lodash.get": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", - "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==" + "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==", + "dev": true }, "lodash.merge": { "version": "4.6.2", @@ -9921,37 +9156,6 @@ "get-func-name": "^2.0.0" } }, - "lower-case": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz", - "integrity": "sha512-2Fgx1Ycm599x+WGpIYwJOvsjmXFzTSc34IwDWALRA/8AopUKAVPwfJ+h5+f85BCp0PWmmJcWzEpxOpoXycMpdA==" - }, - "lower-case-first": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/lower-case-first/-/lower-case-first-1.0.2.tgz", - "integrity": "sha512-UuxaYakO7XeONbKrZf5FEgkantPf5DUqDayzP5VXZrtRPdH86s4kN47I8B3TW10S4QKiE3ziHNf3kRN//okHjA==", - "requires": { - "lower-case": "^1.1.2" - } - }, - "lru-cache": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.0.2.tgz", - "integrity": "sha512-uQw9OqphAGiZhkuPlpFGmdTU2tEuhxTourM/19qGJrxBPHAr/f8BT1a0i/lOclESnGatdJG/UCkP9kZB/Lh1iw==", - "requires": { - "pseudomap": "^1.0.1", - "yallist": "^2.0.0" - } - }, - "lru-memoizer": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/lru-memoizer/-/lru-memoizer-2.1.4.tgz", - "integrity": "sha512-IXAq50s4qwrOBrXJklY+KhgZF+5y98PDaNo0gi/v2KQBFLyWr+JyFvijZXkGKjQj/h9c0OwoE+JZbwUXce76hQ==", - "requires": { - "lodash.clonedeep": "^4.5.0", - "lru-cache": "~4.0.0" - } - }, "make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -9995,11 +9199,6 @@ "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", "dev": true }, - "methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==" - }, "micromatch": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", @@ -10010,24 +9209,6 @@ "picomatch": "^2.3.1" } }, - "mime": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz", - "integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==" - }, - "mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" - }, - "mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "requires": { - "mime-db": "1.52.0" - } - }, "mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", @@ -10328,6 +9509,15 @@ "propagate": "^2.0.0" } }, + "node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dev": true, + "requires": { + "whatwg-url": "^5.0.0" + } + }, "node-preload": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/node-preload/-/node-preload-0.2.1.tgz", @@ -10453,7 +9643,8 @@ "object-inspect": { "version": "1.12.3", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", - "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==" + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", + "dev": true }, "object-keys": { "version": "1.1.1", @@ -10583,14 +9774,6 @@ "release-zalgo": "^1.0.0" } }, - "param-case": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/param-case/-/param-case-1.1.2.tgz", - "integrity": "sha512-gksk6zeZQxwBm1AHsKh+XDFsTGf1LvdZSkkpSIkfDtzW+EQj/P2PBgNb3Cs0Y9Xxqmbciv2JZe3fWU6Xbher+Q==", - "requires": { - "sentence-case": "^1.1.2" - } - }, "parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -10600,23 +9783,6 @@ "callsites": "^3.0.0" } }, - "pascal-case": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/pascal-case/-/pascal-case-1.1.2.tgz", - "integrity": "sha512-QWlbdQHdKWlcyTEuv/M0noJtlCa7qTmg5QFAqhx5X9xjAfCU1kXucL+rcOmd2HliESuRLIOz8521RAW/yhuQog==", - "requires": { - "camel-case": "^1.1.1", - "upper-case-first": "^1.1.0" - } - }, - "path-case": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/path-case/-/path-case-1.1.2.tgz", - "integrity": "sha512-2snAGA6xVRqTuTPa40bn0iEpYtVK6gEqeyS/63dqpm5pGlesOv6EmRcnB9Rr6eAnAC2Wqlbz0tqgJZryttxhxg==", - "requires": { - "sentence-case": "^1.1.2" - } - }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -10878,11 +10044,6 @@ "integrity": "sha512-vGrhOavPSTz4QVNuBNdcNXePNdNMaO1xj9yBeH1ScQPjk/rhg9sSlCXPhMkFuaNNW/syTvYqsnbIJxMBfRbbag==", "dev": true }, - "pseudomap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==" - }, "pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", @@ -10898,14 +10059,6 @@ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" }, - "qs": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", - "requires": { - "side-channel": "^1.0.4" - } - }, "queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -10999,22 +10152,6 @@ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true }, - "rest-facade": { - "version": "1.16.3", - "resolved": "https://registry.npmjs.org/rest-facade/-/rest-facade-1.16.3.tgz", - "integrity": "sha512-9BQTPLiwg23XZwcWi0ys1wTizfc//0b2G3U6vBWcgqh56ozs2K6CD+Jw4DYcw3AqdPQN7jj8nzRUcUXFVGzb0Q==", - "requires": { - "change-case": "^2.3.0", - "deepmerge": "^3.2.0", - "lodash.get": "^4.4.2", - "superagent": "^5.1.1" - } - }, - "retry": { - "version": "0.13.1", - "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", - "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==" - }, "reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -11140,14 +10277,6 @@ "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz", "integrity": "sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==" }, - "sentence-case": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/sentence-case/-/sentence-case-1.1.3.tgz", - "integrity": "sha512-laa/UDTPXsrQnoN/Kc8ZO7gTeEjMsuPiDgUCk9N0iINRZvqAMCTXjGl8+tD27op1eF/JHbdUlEUmovDh6AX7sA==", - "requires": { - "lower-case": "^1.1.1" - } - }, "serialize-error": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-7.0.1.tgz", @@ -11181,6 +10310,7 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, "requires": { "call-bind": "^1.0.0", "get-intrinsic": "^1.0.2", @@ -11239,14 +10369,6 @@ "is-fullwidth-code-point": "^3.0.0" } }, - "snake-case": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-1.1.2.tgz", - "integrity": "sha512-oapUKC+qulnUIN+/O7Tbl2msi9PQvJeivGN9RNbygxzI2EOY0gA96i8BJLYnGUWSLGcYtyW4YYqnGTZEySU/gg==", - "requires": { - "sentence-case": "^1.1.2" - } - }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -11375,24 +10497,6 @@ "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true }, - "superagent": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/superagent/-/superagent-5.3.1.tgz", - "integrity": "sha512-wjJ/MoTid2/RuGCOFtlacyGNxN9QLMgcpYLDQlWFIhhdJ93kNscFonGvrpAHSCVjRVj++DGCglocF7Aej1KHvQ==", - "requires": { - "component-emitter": "^1.3.0", - "cookiejar": "^2.1.2", - "debug": "^4.1.1", - "fast-safe-stringify": "^2.0.7", - "form-data": "^3.0.0", - "formidable": "^1.2.2", - "methods": "^1.1.2", - "mime": "^2.4.6", - "qs": "^6.9.4", - "readable-stream": "^3.6.0", - "semver": "^7.3.2" - } - }, "supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -11408,15 +10512,6 @@ "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", "dev": true }, - "swap-case": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/swap-case/-/swap-case-1.1.2.tgz", - "integrity": "sha512-BAmWG6/bx8syfc6qXPprof3Mn5vQgf5dwdUNJhsNqU9WdPt5P+ES/wQ5bxfijy8zwZgZZHslC3iAsxsuQMCzJQ==", - "requires": { - "lower-case": "^1.1.1", - "upper-case": "^1.1.1" - } - }, "table": { "version": "6.8.0", "resolved": "https://registry.npmjs.org/table/-/table-6.8.0.tgz", @@ -11472,15 +10567,6 @@ "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", "dev": true }, - "title-case": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/title-case/-/title-case-1.1.2.tgz", - "integrity": "sha512-xYbo5Um5MBgn24xJSK+x5hZ8ehuGXTVhgx32KJCThHRHwpyIb1lmABi1DH5VvN9E7rNEquPjz//rF/tZQd7mjQ==", - "requires": { - "sentence-case": "^1.1.1", - "upper-case": "^1.0.3" - } - }, "to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", @@ -11496,6 +10582,12 @@ "is-number": "^7.0.0" } }, + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "dev": true + }, "triple-beam": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz", @@ -11712,19 +10804,6 @@ "picocolors": "^1.0.0" } }, - "upper-case": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/upper-case/-/upper-case-1.1.3.tgz", - "integrity": "sha512-WRbjgmYzgXkCV7zNVpy5YgrHgbBv126rMALQQMrmzOVC4GM2waQ9x7xtm8VU+1yF2kWyPzI9zbZ48n4vSxwfSA==" - }, - "upper-case-first": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/upper-case-first/-/upper-case-first-1.1.2.tgz", - "integrity": "sha512-wINKYvI3Db8dtjikdAqoBbZoP6Q+PZUyfMR7pmwHzjC2quzSkUq5DmPrTtPEqHaz8AGtmsB4TqwapMTM1QAQOQ==", - "requires": { - "upper-case": "^1.1.1" - } - }, "uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -11755,6 +10834,22 @@ "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", "dev": true }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "dev": true + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dev": true, + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "which-boxed-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", @@ -11859,11 +10954,6 @@ "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==" }, - "yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==" - }, "yargs": { "version": "15.4.1", "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", diff --git a/package.json b/package.json index 5ae1c33b..279b8b34 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,6 @@ "homepage": "https://github.com/auth0/auth0-deploy-cli#readme", "dependencies": { "ajv": "^6.12.6", - "auth0": "^3.0.0", "dot-prop": "^5.2.0", "fs-extra": "^10.1.0", "global-agent": "^2.1.12", @@ -52,6 +51,7 @@ "@types/mocha": "^10.0.0", "@types/nconf": "^0.10.3", "@typescript-eslint/parser": "^5.30.3", + "auth0": "^4.0.0-beta.9", "chai": "^4.3.7", "chai-as-promised": "^7.1.1", "eslint": "^7.28.0", @@ -62,6 +62,7 @@ "kacl": "^1.1.1", "mocha": "^10.1.0", "nock": "^13.2.9", + "node-fetch": "^2.7.0", "nyc": "^15.0.1", "prettier": "^2.6.2", "pretty-quick": "^3.1.3", diff --git a/src/context/directory/handlers/clientGrants.ts b/src/context/directory/handlers/clientGrants.ts index 9e139b8b..91a70bcf 100644 --- a/src/context/directory/handlers/clientGrants.ts +++ b/src/context/directory/handlers/clientGrants.ts @@ -47,13 +47,14 @@ async function dump(context: DirectoryContext): Promise { if (clientGrants.length === 0) return; - const allResourceServers = await context.mgmtClient.resourceServers.getAll({ - paginate: true, + // TODO: Bring back paginate: true + const { data: { resource_servers: allResourceServers } } = await context.mgmtClient.resourceServers.getAll({ include_totals: true, }); - const allClients = await context.mgmtClient.clients.getAll({ - paginate: true, + // TODO: Bring back paginate: true + // @ts-ignore-error TODO: add pagination overload to client.getAll + const { data: { clients: allClients } } = await context.mgmtClient.clients.getAll({ include_totals: true, }); diff --git a/src/context/directory/handlers/index.ts b/src/context/directory/handlers/index.ts index 70797793..d61a6548 100644 --- a/src/context/directory/handlers/index.ts +++ b/src/context/directory/handlers/index.ts @@ -17,7 +17,6 @@ import guardianPhoneFactorMessageTypes from './guardianPhoneFactorMessageTypes'; import guardianPhoneFactorSelectedProvider from './guardianPhoneFactorSelectedProvider'; import guardianPolicies from './guardianPolicies'; import roles from './roles'; -import migrations from './migrations'; import actions from './actions'; import organizations from './organizations'; import triggers from './triggers'; @@ -54,7 +53,6 @@ const directoryHandlers: { guardianFactors, guardianFactorProviders, guardianFactorTemplates, - migrations, guardianPhoneFactorMessageTypes, guardianPhoneFactorSelectedProvider, guardianPolicies, diff --git a/src/context/directory/handlers/migrations.ts b/src/context/directory/handlers/migrations.ts deleted file mode 100644 index 25a70e7e..00000000 --- a/src/context/directory/handlers/migrations.ts +++ /dev/null @@ -1,40 +0,0 @@ -import path from 'path'; -import { existsMustBeDir, isFile, dumpJSON, loadJSON } from '../../../utils'; -import { DirectoryHandler } from '.'; -import DirectoryContext from '..'; -import { Asset, ParsedAsset } from '../../../types'; - -type ParsedMigrations = ParsedAsset<'migrations', Asset[]>; - -function parse(context: DirectoryContext): ParsedMigrations { - const baseFolder = path.join(context.filePath); - if (!existsMustBeDir(baseFolder)) return { migrations: null }; // Skip - - const migrationsFile = path.join(baseFolder, 'migrations.json'); - - if (!isFile(migrationsFile)) return { migrations: null }; - - /* eslint-disable camelcase */ - const migrations = loadJSON(migrationsFile, { - mappings: context.mappings, - disableKeywordReplacement: context.disableKeywordReplacement, - }); - - return { migrations }; -} - -async function dump(context: DirectoryContext): Promise { - const { migrations } = context.assets; - - if (!migrations || Object.keys(migrations).length === 0) return; // Skip, nothing to dump - - const migrationsFile = path.join(context.filePath, 'migrations.json'); - dumpJSON(migrationsFile, migrations); -} - -const migrationsHandler: DirectoryHandler = { - parse, - dump, -}; - -export default migrationsHandler; diff --git a/src/context/directory/handlers/resourceServers.ts b/src/context/directory/handlers/resourceServers.ts index 5e83d574..6a7575bd 100644 --- a/src/context/directory/handlers/resourceServers.ts +++ b/src/context/directory/handlers/resourceServers.ts @@ -1,3 +1,4 @@ +import { ResourceServer } from 'auth0'; import path from 'path'; import fs from 'fs-extra'; import { constants } from '../../../tools'; @@ -5,7 +6,6 @@ import { getFiles, existsMustBeDir, dumpJSON, loadJSON, sanitize } from '../../. import { DirectoryHandler } from '.'; import DirectoryContext from '..'; import { ParsedAsset } from '../../../types'; -import { ResourceServer } from '../../../tools/auth0/handlers/resourceServers'; type ParsedResourceServers = ParsedAsset<'resourceServers', ResourceServer[]>; diff --git a/src/context/directory/index.ts b/src/context/directory/index.ts index c154f10c..802c0427 100644 --- a/src/context/directory/index.ts +++ b/src/context/directory/index.ts @@ -6,7 +6,7 @@ import cleanAssets from '../../readonly'; import log from '../../logger'; import handlers, { DirectoryHandler } from './handlers'; import { isDirectory, isFile, stripIdentifiers, toConfigFn } from '../../utils'; -import { Assets, Auth0APIClient, Config, AssetTypes } from '../../types'; +import { Assets, Auth0APIClient, Config, AssetTypes, BaseAuth0APIClient } from '../../types'; import { filterOnlyIncludedResourceTypes } from '..'; import { preserveKeywords } from '../../keywordPreservation'; @@ -21,7 +21,7 @@ export default class DirectoryContext { assets: Assets; disableKeywordReplacement: boolean; - constructor(config: Config, mgmtClient: Auth0APIClient) { + constructor(config: Config, mgmtClient: BaseAuth0APIClient) { this.filePath = config.AUTH0_INPUT_FILE; this.config = config; this.mappings = config.AUTH0_KEYWORD_REPLACE_MAPPINGS || {}; diff --git a/src/context/index.ts b/src/context/index.ts index 89532db2..37e655c1 100644 --- a/src/context/index.ts +++ b/src/context/index.ts @@ -161,19 +161,19 @@ export const setupContext = async ( return new AuthenticationClient({ domain: AUTH0_DOMAIN, clientId: AUTH0_CLIENT_ID, - clientAssertionSigningKey: readFileSync(AUTH0_CLIENT_SIGNING_KEY_PATH), + clientAssertionSigningKey: readFileSync(AUTH0_CLIENT_SIGNING_KEY_PATH, 'utf8'), clientAssertionSigningAlg: !!AUTH0_CLIENT_SIGNING_ALGORITHM ? AUTH0_CLIENT_SIGNING_ALGORITHM : undefined, }); })(); - const clientCredentials = await authClient.clientCredentialsGrant({ + const clientCredentials = await authClient.oauth.clientCredentialsGrant({ audience: config.AUTH0_AUDIENCE ? config.AUTH0_AUDIENCE : `https://${config.AUTH0_DOMAIN}/api/v2/`, }); - return clientCredentials.access_token; + return clientCredentials.data?.access_token; })(); const mgmtClient = new ManagementClient({ diff --git a/src/context/yaml/handlers/guardianPolicies.ts b/src/context/yaml/handlers/guardianPolicies.ts index e0673eb3..5733477c 100644 --- a/src/context/yaml/handlers/guardianPolicies.ts +++ b/src/context/yaml/handlers/guardianPolicies.ts @@ -1,8 +1,8 @@ import { YAMLHandler } from '.'; import YAMLContext from '..'; -import { Asset, ParsedAsset } from '../../../types'; +import { ParsedAsset } from '../../../types'; -type ParsedGuardianPolicies = ParsedAsset<'guardianPolicies', { policies: Asset[] }>; +type ParsedGuardianPolicies = ParsedAsset<'guardianPolicies', { policies: string[] }>; async function parseAndDump(context: YAMLContext): Promise { const { guardianPolicies } = context.assets; diff --git a/src/context/yaml/handlers/index.ts b/src/context/yaml/handlers/index.ts index 3c470bf9..dd6e5367 100644 --- a/src/context/yaml/handlers/index.ts +++ b/src/context/yaml/handlers/index.ts @@ -18,7 +18,6 @@ import guardianPhoneFactorSelectedProvider from './guardianPhoneFactorSelectedPr import guardianPolicies from './guardianPolicies'; import roles from './roles'; import organizations from './organizations'; -import migrations from './migrations'; import actions from './actions'; import triggers from './triggers'; import attackProtection from './attackProtection'; @@ -53,7 +52,6 @@ const yamlHandlers: { [key in AssetTypes]: YAMLHandler<{ [key: string]: unknown guardianFactorProviders, guardianFactorTemplates, roles, - migrations, guardianPhoneFactorMessageTypes, guardianPhoneFactorSelectedProvider, guardianPolicies, diff --git a/src/context/yaml/handlers/migrations.ts b/src/context/yaml/handlers/migrations.ts deleted file mode 100644 index cc4a1372..00000000 --- a/src/context/yaml/handlers/migrations.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { YAMLHandler } from '.'; -import YAMLContext from '..'; -import { Asset, ParsedAsset } from '../../../types'; - -type ParsedMigrations = ParsedAsset<'migrations', Asset[]>; - -async function parseAndDump(context: YAMLContext): Promise { - const { migrations } = context.assets; - - if (!migrations) return { migrations: null }; - - return { migrations }; -} - -const migrationsHandler: YAMLHandler = { - parse: parseAndDump, - dump: parseAndDump, -}; - -export default migrationsHandler; diff --git a/src/context/yaml/handlers/resourceServers.ts b/src/context/yaml/handlers/resourceServers.ts index c2dce9b3..01a644a7 100644 --- a/src/context/yaml/handlers/resourceServers.ts +++ b/src/context/yaml/handlers/resourceServers.ts @@ -1,7 +1,7 @@ +import { ResourceServer } from 'auth0'; import { YAMLHandler } from '.'; import YAMLContext from '..'; import { ParsedAsset } from '../../../types'; -import { ResourceServer } from '../../../tools/auth0/handlers/resourceServers'; type ParsedResourceServers = ParsedAsset<'resourceServers', ResourceServer[]>; diff --git a/src/tools/auth0/client.ts b/src/tools/auth0/client.ts index fdbaa266..6d9f0c38 100644 --- a/src/tools/auth0/client.ts +++ b/src/tools/auth0/client.ts @@ -167,7 +167,7 @@ export default function pagedClient(client: BaseAuth0APIClient): Auth0APIClient frequencyLimit: API_FREQUENCY_PER_SECOND, frequencyWindow: 1000, // 1 sec }), - }; + } as unknown as Auth0APIClient; return pagedManager(clientWithPooling, clientWithPooling); } diff --git a/src/tools/auth0/handlers/actions.ts b/src/tools/auth0/handlers/actions.ts index a95e01a1..b6e8d111 100644 --- a/src/tools/auth0/handlers/actions.ts +++ b/src/tools/auth0/handlers/actions.ts @@ -1,4 +1,5 @@ import _ from 'lodash'; +import { GetActions200ResponseActionsInner, PostActionRequest } from 'auth0'; import DefaultAPIHandler, { order } from './default'; import log from '../../../logger'; import { areArraysEquals, sleep } from '../../utils'; @@ -92,29 +93,34 @@ export function isMarketplaceAction(action: Action): boolean { } export default class ActionHandler extends DefaultAPIHandler { - existing: Action[] | null; + existing: GetActions200ResponseActionsInner[] | null; constructor(options: DefaultAPIHandler) { super({ ...options, type: 'actions', functions: { - create: (action: Action) => this.createAction(action), + create: (action: PostActionRequest) => this.createAction(action), delete: (action: Action) => this.deleteAction(action), }, stripUpdateFields: ['deployed', 'status'], }); } - async createAction(action: Action) { + async createAction(action: PostActionRequest) { // Strip the deployed flag const addAction = { ...action }; - delete addAction.deployed; - delete addAction.status; - const createdAction = await this.client.actions.create(addAction); + // TODO: Should we keep this? + delete (addAction as any).deployed; + delete (addAction as any).status; + + const { data: createdAction } = await this.client.actions.create(addAction); // Add the action id so we can deploy it later - action.id = createdAction.id; + + // TODO: Should we keep this? + (action as any).id = createdAction.id; + return createdAction; } @@ -202,7 +208,9 @@ export default class ActionHandler extends DefaultAPIHandler { // Actions API does not support include_totals param like the other paginate API's. // So we set it to false otherwise it will fail with "Additional properties not allowed: include_totals" try { - const actions = await this.client.actions.getAll({ paginate: true }); + // TODO: bring back paginate: true + const { data } = await this.client.actions.getAll(); + const { actions } = data; this.existing = actions; return actions; } catch (err) { diff --git a/src/tools/auth0/handlers/attackProtection.ts b/src/tools/auth0/handlers/attackProtection.ts index 909cfcc3..e1ece307 100644 --- a/src/tools/auth0/handlers/attackProtection.ts +++ b/src/tools/auth0/handlers/attackProtection.ts @@ -68,9 +68,9 @@ export default class AttackProtectionHandler extends DefaultAPIHandler { ]); this.existing = { - breachedPasswordDetection, - bruteForceProtection, - suspiciousIpThrottling, + breachedPasswordDetection: breachedPasswordDetection.data, + bruteForceProtection: bruteForceProtection.data, + suspiciousIpThrottling: suspiciousIpThrottling.data, }; return this.existing; diff --git a/src/tools/auth0/handlers/branding.ts b/src/tools/auth0/handlers/branding.ts index 213dd0f5..fe54e93b 100644 --- a/src/tools/auth0/handlers/branding.ts +++ b/src/tools/auth0/handlers/branding.ts @@ -1,3 +1,4 @@ +import { GetBranding200Response, GetUniversalLogin200ResponseOneOf } from 'auth0'; import DefaultHandler, { order } from './default'; import constants from '../../constants'; import log from '../../../logger'; @@ -30,29 +31,25 @@ export default class BrandingHandler extends DefaultHandler { } async getType(): Promise { - let branding: { - templates?: { - template: string; - body: string; - }[]; - } = {}; + let branding: GetBranding200Response = {} as any; try { // in case client version does not support branding if (this.client.branding && typeof this.client.branding.getSettings === 'function') { - branding = await this.client.branding.getSettings(); + const response = await this.client.branding.getSettings(); + branding = response.data; } // in case client version does not custom domains if (this.client.customDomains && typeof this.client.customDomains.getAll === 'function') { - const customDomains = await this.client.customDomains.getAll(); + const { data: customDomains } = await this.client.customDomains.getAll(); // templates are only supported if there's custom domains. if (customDomains && customDomains.length) { - const payload = await this.client.branding.getUniversalLoginTemplate(); + const { data: payload } = await this.client.branding.getUniversalLoginTemplate(); branding.templates = [ { template: constants.UNIVERSAL_LOGIN_TEMPLATE, - body: payload.body, + body: (payload as GetUniversalLogin200ResponseOneOf).body, }, ]; } @@ -80,7 +77,7 @@ export default class BrandingHandler extends DefaultHandler { } if (brandingSettings && Object.keys(brandingSettings).length) { - await this.client.branding.updateSettings({}, brandingSettings); + await this.client.branding.updateSettings(brandingSettings); this.updated += 1; this.didUpdate(brandingSettings); } @@ -104,7 +101,6 @@ export default class BrandingHandler extends DefaultHandler { ); if (templateDefinition && templateDefinition.body) { await this.client.branding.setUniversalLoginTemplate( - {}, { template: templateDefinition.body } ); this.updated += 1; diff --git a/src/tools/auth0/handlers/clientGrants.ts b/src/tools/auth0/handlers/clientGrants.ts index 2b77d379..04694d1b 100644 --- a/src/tools/auth0/handlers/clientGrants.ts +++ b/src/tools/auth0/handlers/clientGrants.ts @@ -1,6 +1,6 @@ import DefaultHandler, { order } from './default'; import { convertClientNamesToIds } from '../../utils'; -import { Asset, Assets, CalculatedChanges } from '../../../types'; +import { Assets, CalculatedChanges } from '../../../types'; import DefaultAPIHandler from './default'; export const schema = { @@ -48,7 +48,9 @@ export default class ClientGrantsHandler extends DefaultHandler { if (this.existing) { return this.existing; } - this.existing = await this.client.clientGrants.getAll({ paginate: true, include_totals: true }); + // TODO: Bring back paginate: true + const { data } = await this.client.clientGrants.getAll({ include_totals: true }); + this.existing = data.client_grants; // Always filter out the client we are using to access Auth0 Management API // As it could cause problems if the grants are deleted or updated etc @@ -67,7 +69,10 @@ export default class ClientGrantsHandler extends DefaultHandler { // Do nothing if not set if (!clientGrants) return; - const clients = await this.client.clients.getAll({ paginate: true, include_totals: true }); + // TODO: Bring back paginate: true + const { data } = await this.client.clients.getAll({ include_totals: true }); + // @ts-ignore-error TODO: add pagination overload to client.getAll + const { clients } = data; const excludedClientsByNames = (assets.exclude && assets.exclude.clients) || []; const excludedClients = convertClientNamesToIds(excludedClientsByNames, clients); diff --git a/src/tools/auth0/handlers/clients.ts b/src/tools/auth0/handlers/clients.ts index 00df6f04..a0c23c7e 100644 --- a/src/tools/auth0/handlers/clients.ts +++ b/src/tools/auth0/handlers/clients.ts @@ -82,11 +82,13 @@ export default class ClientHandler extends DefaultAPIHandler { async getType() { if (this.existing) return this.existing; - this.existing = await this.client.clients.getAll({ - paginate: true, + // TODO: Bring back paginate: true + const { data } = await this.client.clients.getAll({ include_totals: true, is_global: false, }); + // @ts-ignore-error TODO: add pagination overload to client.getAll + this.existing = data.clients; return this.existing; } } diff --git a/src/tools/auth0/handlers/connections.ts b/src/tools/auth0/handlers/connections.ts index bef7832e..caf3eb80 100644 --- a/src/tools/auth0/handlers/connections.ts +++ b/src/tools/auth0/handlers/connections.ts @@ -110,10 +110,11 @@ export default class ConnectionsHandler extends DefaultAPIHandler { async getType(): Promise { if (this.existing) return this.existing; - const connections: Asset[] = await this.client.connections.getAll({ - paginate: true, + // TODO: Bring back paginate: true + const { data } = await this.client.connections.getAll({ include_totals: true, }); + const { connections } = data; // Filter out database connections this.existing = connections.filter((c) => c.strategy !== 'auth0'); if (this.existing === null) return []; @@ -133,9 +134,11 @@ export default class ConnectionsHandler extends DefaultAPIHandler { }; // Convert enabled_clients by name to the id - const clients = await this.client.clients.getAll({ paginate: true, include_totals: true }); - const existingConnections = await this.client.connections.getAll({ - paginate: true, + // TODO: Bring back paginate: true + // @ts-ignore-error TODO: add pagination overload to client.getAll + const { data: { clients } } = await this.client.clients.getAll({ include_totals: true }); + // TODO: Bring back paginate: true + const { data: { connections: existingConnections } } = await this.client.connections.getAll({ include_totals: true, }); const formatted = connections.map((connection) => ({ diff --git a/src/tools/auth0/handlers/customDomains.ts b/src/tools/auth0/handlers/customDomains.ts index f84a7bf8..8a100425 100644 --- a/src/tools/auth0/handlers/customDomains.ts +++ b/src/tools/auth0/handlers/customDomains.ts @@ -48,7 +48,8 @@ export default class CustomDomainsHadnler extends DefaultAPIHandler { return this.existing; } - const customDomains = await this.client.customDomains.getAll({ paginate: false }); + // TODO: Bring back paginate: false + const { data: customDomains } = await this.client.customDomains.getAll(); this.existing = customDomains; diff --git a/src/tools/auth0/handlers/databases.ts b/src/tools/auth0/handlers/databases.ts index 71a04d18..46489f3f 100644 --- a/src/tools/auth0/handlers/databases.ts +++ b/src/tools/auth0/handlers/databases.ts @@ -1,3 +1,4 @@ +import { GetConnectionsStrategyEnum } from 'auth0'; import DefaultAPIHandler, { order } from './default'; import constants from '../../constants'; import { filterExcluded, getEnabledClients } from '../../utils'; @@ -47,7 +48,7 @@ export default class DatabaseHandler extends DefaultAPIHandler { // If we going to update database, we need to get current options first if (fn === 'update') { return (params, payload) => - this.client.connections.get(params).then((connection) => { + this.client.connections.get(params).then(({ data: connection }) => { payload.options = { ...connection.options, ...payload.options }; return this.client.connections.update(params, payload); }); @@ -58,11 +59,12 @@ export default class DatabaseHandler extends DefaultAPIHandler { async getType() { if (this.existing) return this.existing; - this.existing = this.client.connections.getAll({ - strategy: 'auth0', - paginate: true, + // TODO: Bring back paginate: true + const { data: { connections } } = await this.client.connections.getAll({ + strategy: [GetConnectionsStrategyEnum.auth0], include_totals: true, }); + this.existing = connections; return this.existing; } @@ -80,10 +82,12 @@ export default class DatabaseHandler extends DefaultAPIHandler { }; // Convert enabled_clients by name to the id - const clients = await this.client.clients.getAll({ paginate: true, include_totals: true }); - const existingDatabasesConnections = await this.client.connections.getAll({ - strategy: 'auth0', - paginate: true, + // TODO: Bring back paginate: true + // @ts-ignore-error TODO: add pagination overload to client.getAll + const { data: { clients } } = await this.client.clients.getAll({ include_totals: true }); + // TODO: Bring back paginate: true + const { data: { connections: existingDatabasesConnections } } = await this.client.connections.getAll({ + strategy: [GetConnectionsStrategyEnum.auth0], include_totals: true, }); const formatted = databases.map((db) => { diff --git a/src/tools/auth0/handlers/emailProvider.ts b/src/tools/auth0/handlers/emailProvider.ts index 25fefc63..2af52aa5 100644 --- a/src/tools/auth0/handlers/emailProvider.ts +++ b/src/tools/auth0/handlers/emailProvider.ts @@ -1,5 +1,6 @@ import DefaultHandler from './default'; import { Asset, Assets } from '../../../types'; +import { PostProviderRequest } from 'auth0'; export const schema = { type: 'object' }; @@ -16,7 +17,8 @@ export default class EmailProviderHandler extends DefaultHandler { async getType(): Promise { try { - return await this.client.emailProvider.get({ include_fields: true, fields: defaultFields }); + const { data } = await this.client.emails.get({ include_fields: true, fields: defaultFields.join(',') }); + return data; } catch (err) { if (err.statusCode === 404) return {}; throw err; @@ -34,9 +36,10 @@ export default class EmailProviderHandler extends DefaultHandler { let existing = await this.getType(); + // TODO: HTTP DELETE on emails/provider is not public, so not part of our vNext SDK. if (Object.keys(emailProvider).length === 0) { if (this.config('AUTH0_ALLOW_DELETE') === true) { - await this.client.emailProvider.delete(); + // await this.client.emails.delete(); this.didDelete(existing); } return; @@ -45,20 +48,18 @@ export default class EmailProviderHandler extends DefaultHandler { if (existing.name) { if (existing.name !== emailProvider.name) { // Delete the current provider as it's different - await this.client.emailProvider.delete(); + // await this.client.emailProvider.delete(); this.didDelete(existing); existing = {}; } } if (existing.name) { - const provider = { name: emailProvider.name, enabled: emailProvider.enabled }; - const updated = await this.client.emailProvider.update(provider, emailProvider); + const updated = await this.client.emails.update(emailProvider); this.updated += 1; this.didUpdate(updated); } else { - const provider = { name: emailProvider.name, enabled: emailProvider.enabled }; - const created = await this.client.emailProvider.configure(provider, emailProvider); + const created = await this.client.emails.configure(emailProvider as PostProviderRequest); this.created += 1; this.didCreate(created); } diff --git a/src/tools/auth0/handlers/emailTemplates.ts b/src/tools/auth0/handlers/emailTemplates.ts index 3956f128..93904078 100644 --- a/src/tools/auth0/handlers/emailTemplates.ts +++ b/src/tools/auth0/handlers/emailTemplates.ts @@ -29,9 +29,9 @@ export default class EmailTemplateHandler extends DefaultHandler { async getType(): Promise { const emailTemplates = await Promise.all( - constants.EMAIL_TEMPLATES_TYPES.map(async (name) => { + constants.EMAIL_TEMPLATES_TYPES.map(async (templateName) => { try { - const template = await this.client.emailTemplates.get({ name }); + const { data: template } = await this.client.emailTemplates.get({ templateName }); return template; } catch (err) { // Ignore if not found, else throw error @@ -51,16 +51,18 @@ export default class EmailTemplateHandler extends DefaultHandler { try { const identifierField = this.identifiers[0]; - const params = { name: emailTemplate[identifierField] }; - const updated = await this.client.emailTemplates.update(params, emailTemplate); - delete updated.body; + const params = { templateName: emailTemplate[identifierField] }; + const { data: updated } = await this.client.emailTemplates.update(params, emailTemplate); + // TODO: Should we revisit this? + delete (updated as any ).body; this.didUpdate(updated); this.updated += 1; } catch (err) { if (err.statusCode === 404) { // Create if it does not exist - const created = await this.client.emailTemplates.create(emailTemplate); - delete created.body; + const { data: created } = await this.client.emailTemplates.create(emailTemplate); + // TODO: Should we revisit this? + delete (created as any).body; this.didCreate(created); this.created += 1; } else { diff --git a/src/tools/auth0/handlers/guardianFactorProviders.ts b/src/tools/auth0/handlers/guardianFactorProviders.ts index 5f86fead..e34d6051 100644 --- a/src/tools/auth0/handlers/guardianFactorProviders.ts +++ b/src/tools/auth0/handlers/guardianFactorProviders.ts @@ -40,8 +40,19 @@ export default class GuardianFactorProvidersHandler extends DefaultHandler { const data = await Promise.all( mappings.map(async (m) => { - const provider = await this.client.guardian.getFactorProvider(m); - return { ...m, ...provider }; + let provider; + // TODO: This is quite a change, needs to be validated for sure. + if (m.name === 'phone' && m.provider === 'twilio') { + provider = await this.client.guardian.getPhoneFactorProviderTwilio(); + } else if (m.name === 'sms' && m.provider === 'twilio') { + provider = await this.client.guardian.getSmsFactorProviderTwilio(); + } else if (m.name === 'push-notification' && m.provider === 'apns') { + provider = await this.client.guardian.getPushNotificationProviderAPNS(); + } else if (m.name === 'push-notification' && m.provider === 'sns') { + provider = await this.client.guardian.getPushNotificationProviderSNS(); + } + + return { ...m, ...provider.data }; }) ); @@ -59,11 +70,18 @@ export default class GuardianFactorProvidersHandler extends DefaultHandler { // Process each factor await Promise.all( guardianFactorProviders.map(async (factorProvider) => { - const data = { ...factorProvider }; + const { name, provider, ...data } = factorProvider; const params = { name: factorProvider.name, provider: factorProvider.provider }; - delete data.name; - delete data.provider; - await this.client.guardian.updateFactorProvider(params, data); + // TODO: This is quite a change, needs to be validated for sure. + if (name === 'phone' && provider === 'twilio') { + await this.client.guardian.updatePhoneFactorProviderTwilio(data); + } else if (name === 'push-notification' && provider === 'apns') { + await this.client.guardian.updatePushNotificationProviderAPNS(data); + } else if (name === 'push-notification' && provider === 'fcm') { + await this.client.guardian.updatePushNotificationProviderFCM(data); + } else if (name === 'push-notification' && provider === 'sns') { + await this.client.guardian.updatePushNotificationProviderSNS(data); + } this.didUpdate(params); this.updated += 1; }) diff --git a/src/tools/auth0/handlers/guardianFactorTemplates.ts b/src/tools/auth0/handlers/guardianFactorTemplates.ts index 387c5abc..d6cd91f9 100644 --- a/src/tools/auth0/handlers/guardianFactorTemplates.ts +++ b/src/tools/auth0/handlers/guardianFactorTemplates.ts @@ -1,6 +1,7 @@ import DefaultHandler from './default'; import constants from '../../constants'; -import { Assets, Asset, CalculatedChanges } from '../../../types'; +import { Assets, Asset } from '../../../types'; +import { TemplateMessages } from 'auth0'; export const schema = { type: 'array', @@ -29,8 +30,15 @@ export default class GuardianFactorTemplatesHandler extends DefaultHandler { const data = await Promise.all( constants.GUARDIAN_FACTOR_TEMPLATES.map(async (name) => { - const templates = await this.client.guardian.getFactorTemplates({ name }); - return { name, ...templates }; + // TODO: This is quite a change, needs to be validated for sure. + if (name === 'sms') { + const { data: templates } = await this.client.guardian.getSmsFactorTemplates(); + return { name, ...templates }; + // TODO: GUARDIAN_FACTOR_TEMPLATES only contains 'sms'. Is that expected? We also have 'phone'. + } else { + const { data: templates } = await this.client.guardian.getPhoneFactorTemplates(); + return { name, ...templates }; + } }) ); @@ -48,10 +56,14 @@ export default class GuardianFactorTemplatesHandler extends DefaultHandler { // Process each factor templates await Promise.all( guardianFactorTemplates.map(async (fatorTemplates) => { - const data = { ...fatorTemplates }; + const { name, ...data } = fatorTemplates; const params = { name: fatorTemplates.name }; - delete data.name; - await this.client.guardian.updateFactorTemplates(params, data); + // TODO: This is quite a change, needs to be validated for sure. + if (name === 'sms') { + await this.client.guardian.setSmsFactorTemplates(data as TemplateMessages); + } else if (name ==='phone') { + await this.client.guardian.setPhoneFactorTemplates(data as TemplateMessages); + } this.didUpdate(params); this.updated += 1; }) diff --git a/src/tools/auth0/handlers/guardianFactors.ts b/src/tools/auth0/handlers/guardianFactors.ts index 5359dabe..53e37031 100644 --- a/src/tools/auth0/handlers/guardianFactors.ts +++ b/src/tools/auth0/handlers/guardianFactors.ts @@ -1,6 +1,7 @@ import DefaultHandler from './default'; import constants from '../../constants'; import { Asset, Assets } from '../../../types'; +import { Factor, FactorNameEnum } from 'auth0'; export const schema = { type: 'array', @@ -26,7 +27,8 @@ export default class GuardianFactorsHandler extends DefaultHandler { async getType(): Promise { if (this.existing) return this.existing; - this.existing = await this.client.guardian.getFactors(); + const { data } = await this.client.guardian.getFactors(); + this.existing = data; return this.existing; } @@ -39,9 +41,9 @@ export default class GuardianFactorsHandler extends DefaultHandler { // Process each factor await Promise.all( - guardianFactors.map(async (factor) => { + guardianFactors.map(async (factor: Factor) => { const data = { ...factor }; - const params = { name: factor.name }; + const params = { name: factor.name as FactorNameEnum }; delete data.name; await this.client.guardian.updateFactor(params, data); this.didUpdate(params); diff --git a/src/tools/auth0/handlers/guardianPhoneFactorMessageTypes.ts b/src/tools/auth0/handlers/guardianPhoneFactorMessageTypes.ts index 46a4e4e9..e56b4c7f 100644 --- a/src/tools/auth0/handlers/guardianPhoneFactorMessageTypes.ts +++ b/src/tools/auth0/handlers/guardianPhoneFactorMessageTypes.ts @@ -1,6 +1,7 @@ import DefaultHandler from './default'; import constants from '../../constants'; import { Asset, Assets } from '../../../types'; +import { GetMessageTypes200Response } from 'auth0'; export const schema = { type: 'object', @@ -35,7 +36,7 @@ const isFeatureUnavailableError = (err): boolean => { }; export default class GuardianPhoneMessageTypesHandler extends DefaultHandler { - existing: Asset[]; + existing: Asset; constructor(options: DefaultHandler) { super({ @@ -56,7 +57,8 @@ export default class GuardianPhoneMessageTypesHandler extends DefaultHandler { if (this.existing) return this.existing; try { - this.existing = await this.client.guardian.getPhoneFactorMessageTypes(); + const { data } = await this.client.guardian.getPhoneFactorMessageTypes(); + this.existing = data; } catch (e) { if (isFeatureUnavailableError(e)) { // Gracefully skip processing this configuration value. @@ -75,9 +77,8 @@ export default class GuardianPhoneMessageTypesHandler extends DefaultHandler { // Do nothing if not set if (!guardianPhoneFactorMessageTypes || !guardianPhoneFactorMessageTypes.message_types) return; - const params = {}; const data = guardianPhoneFactorMessageTypes; - await this.client.guardian.updatePhoneFactorMessageTypes(params, data); + await this.client.guardian.updatePhoneFactorMessageTypes(data as unknown as GetMessageTypes200Response); this.updated += 1; this.didUpdate(guardianPhoneFactorMessageTypes); } diff --git a/src/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.ts b/src/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.ts index 6f178137..6d050759 100644 --- a/src/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.ts +++ b/src/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.ts @@ -1,6 +1,7 @@ import DefaultHandler from './default'; import constants from '../../constants'; import { Asset, Assets } from '../../../types'; +import { GetPhoneProviders200Response } from 'auth0'; export const schema = { type: 'object', @@ -32,7 +33,7 @@ const isFeatureUnavailableError = (err) => { }; export default class GuardianPhoneSelectedProviderHandler extends DefaultHandler { - existing: Asset[]; + existing: Asset; constructor(options) { super({ @@ -53,7 +54,8 @@ export default class GuardianPhoneSelectedProviderHandler extends DefaultHandler if (this.existing) return this.existing; try { - this.existing = await this.client.guardian.getPhoneFactorSelectedProvider(); + const { data } = await this.client.guardian.getPhoneFactorSelectedProvider(); + this.existing = data; } catch (e) { if (isFeatureUnavailableError(e)) { // Gracefully skip processing this configuration value. @@ -73,9 +75,8 @@ export default class GuardianPhoneSelectedProviderHandler extends DefaultHandler if (!guardianPhoneFactorSelectedProvider || !guardianPhoneFactorSelectedProvider.provider) return; - const params = {}; const data = guardianPhoneFactorSelectedProvider; - await this.client.guardian.updatePhoneFactorSelectedProvider(params, data); + await this.client.guardian.updatePhoneFactorSelectedProvider(data as GetPhoneProviders200Response); this.updated += 1; this.didUpdate(guardianPhoneFactorSelectedProvider); } diff --git a/src/tools/auth0/handlers/guardianPolicies.ts b/src/tools/auth0/handlers/guardianPolicies.ts index 9d81de36..75d5c44a 100644 --- a/src/tools/auth0/handlers/guardianPolicies.ts +++ b/src/tools/auth0/handlers/guardianPolicies.ts @@ -1,6 +1,6 @@ import DefaultHandler from './default'; import constants from '../../constants'; -import { Asset, Assets } from '../../../types'; +import { Assets } from '../../../types'; export const schema = { type: 'object', @@ -18,7 +18,7 @@ export const schema = { export default class GuardianPoliciesHandler extends DefaultHandler { existing: { - policies: Asset[]; + policies: string[]; }; constructor(options) { @@ -36,7 +36,7 @@ export default class GuardianPoliciesHandler extends DefaultHandler { } if (this.existing) return this.existing; - const policies = await this.client.guardian.getPolicies(); + const { data: policies } = await this.client.guardian.getPolicies(); this.existing = { policies }; return this.existing; } @@ -48,9 +48,8 @@ export default class GuardianPoliciesHandler extends DefaultHandler { // Do nothing if not set if (!guardianPolicies || !guardianPolicies.policies) return; - const params = {}; const data = guardianPolicies.policies; - await this.client.guardian.updatePolicies(params, data); + await this.client.guardian.updatePolicies(data); this.updated += 1; this.didUpdate(guardianPolicies); } diff --git a/src/tools/auth0/handlers/hooks.ts b/src/tools/auth0/handlers/hooks.ts index dbdde96e..f27f3d48 100644 --- a/src/tools/auth0/handlers/hooks.ts +++ b/src/tools/auth0/handlers/hooks.ts @@ -142,7 +142,7 @@ export default class HooksHandler extends DefaultHandler { await Promise.all( changes.del.map(async (data) => { - await this.client.hooks.removeSecrets({ id: data.hookId }, data.secrets); + await this.client.hooks.deleteSecrets({ id: data.hookId }, data.secrets); }) ); @@ -171,17 +171,18 @@ export default class HooksHandler extends DefaultHandler { } try { - const hooks = await this.client.hooks.getAll({ paginate: true, include_totals: true }); + // TODO: Bring back paginate: true + const { data: { hooks } } = await this.client.hooks.getAll({ include_totals: true }); // hooks.getAll does not return code and secrets, we have to fetch hooks one-by-one this.existing = await Promise.all( hooks.map((hook: { id: string }) => this.client.hooks .get({ id: hook.id }) - .then((hookWithCode) => + .then(({data: hookWithCode}) => this.client.hooks .getSecrets({ id: hook.id }) - .then((secrets) => ({ ...hookWithCode, secrets })) + .then(({ data: secrets }) => ({ ...hookWithCode, secrets })) ) ) ); diff --git a/src/tools/auth0/handlers/index.ts b/src/tools/auth0/handlers/index.ts index e9e0daa3..5997a390 100644 --- a/src/tools/auth0/handlers/index.ts +++ b/src/tools/auth0/handlers/index.ts @@ -20,7 +20,6 @@ import * as guardianPhoneFactorMessageTypes from './guardianPhoneFactorMessageTy import * as roles from './roles'; import * as branding from './branding'; import * as prompts from './prompts'; -import * as migrations from './migrations'; import * as actions from './actions'; import * as triggers from './triggers'; import * as organizations from './organizations'; @@ -55,7 +54,6 @@ const auth0ApiHandlers: { [key in AssetTypes]: any } = { branding, //@ts-ignore because prompts have not been universally implemented yet prompts, - migrations, actions, triggers, organizations, diff --git a/src/tools/auth0/handlers/logStreams.ts b/src/tools/auth0/handlers/logStreams.ts index 618dbb75..e2c3369a 100644 --- a/src/tools/auth0/handlers/logStreams.ts +++ b/src/tools/auth0/handlers/logStreams.ts @@ -58,9 +58,11 @@ export default class LogStreamsHandler extends DefaultAPIHandler { return this.existing; } - const logStreams = await this.client.logStreams.getAll({ paginate: false }).then((logStreams) => + // TODO: Bring back paginate: false + const logStreams = await this.client.logStreams.getAll().then(({ data: logStreams }) => logStreams.map((logStream) => { - if (logStream.status === 'suspended') delete logStream.status; + // TODO: Do we need to keep this + if (logStream.status === 'suspended') delete (logStream as any).status; return logStream; }) ); diff --git a/src/tools/auth0/handlers/migrations.ts b/src/tools/auth0/handlers/migrations.ts deleted file mode 100644 index 977690e1..00000000 --- a/src/tools/auth0/handlers/migrations.ts +++ /dev/null @@ -1,78 +0,0 @@ -import DefaultHandler, { order } from './default'; -import log from '../../../logger'; -import { Asset, Assets } from '../../../types'; - -export const schema = { - type: 'object', - additionalProperties: { type: 'boolean' }, -}; - -export default class MigrationsHandler extends DefaultHandler { - constructor(options: DefaultHandler) { - super({ - ...options, - type: 'migrations', - }); - } - - //TODO: standardize empty object literal with more intentional empty indicator - async getType(): Promise { - try { - const migrations = await this.client.migrations.getMigrations(); - return migrations.flags; - } catch (err) { - if (err.statusCode === 404) return {}; - throw err; - } - } - - // Run at the end since switching a flag will depend on other applying other changes - @order('150') - async processChanges(assets: Assets): Promise { - const { migrations } = assets; - - if (migrations && Object.keys(migrations).length > 0) { - const flags = await this.removeUnavailableMigrations(migrations); - - if (Object.keys(flags).length > 0) { - await this.client.migrations.updateMigrations({ flags }); - this.updated += 1; - this.didUpdate(flags); - } - } - } - - logUnavailableMigrations(ignoreUnavailableMigrations: boolean, ignoredMigrations: string[]) { - if (ignoreUnavailableMigrations) { - log.info( - `The following migrations are not available '${ignoredMigrations.join( - ',' - )}'. The migrations will be ignored because you have AUTH0_IGNORE_UNAVAILABLE_MIGRATIONS=true in your configuration.` - ); - } else { - log.warn( - `The following disabled migrations are not available '${ignoredMigrations.join( - ',' - )}'. The migrations will be ignored, remove the migrations to avoid future warnings.` - ); - } - } - - async removeUnavailableMigrations(migrations: Asset[]): Promise { - const flags = { ...migrations }; - const ignoreUnavailableMigrations = !!this.config('AUTH0_IGNORE_UNAVAILABLE_MIGRATIONS'); - const existingMigrations = await this.getType(); - const unavailableMigrations = Object.keys(flags).filter( - (flag) => !(flag in existingMigrations) - ); - const ignoredMigrations = unavailableMigrations.filter( - (flag) => ignoreUnavailableMigrations || flags[flag] === false - ); - - if (ignoredMigrations.length > 0) { - this.logUnavailableMigrations(ignoreUnavailableMigrations, ignoredMigrations); - ignoredMigrations.forEach((flag) => delete flags[flag]); - } - return flags; - } -} diff --git a/src/tools/auth0/handlers/organizations.ts b/src/tools/auth0/handlers/organizations.ts index 9e0d826b..6903ee43 100644 --- a/src/tools/auth0/handlers/organizations.ts +++ b/src/tools/auth0/handlers/organizations.ts @@ -1,4 +1,5 @@ import _ from 'lodash'; +import { PostEnabledConnectionsRequest } from 'auth0'; import DefaultHandler, { order } from './default'; import { calculateChanges } from '../../calculateChanges'; import log from '../../../logger'; @@ -72,7 +73,7 @@ export default class OrganizationsHandler extends DefaultHandler { const organization = { ...org }; delete organization.connections; - const created = await this.client.organizations.create(organization); + const { data: created } = await this.client.organizations.create(organization); if (typeof org.connections !== 'undefined' && org.connections.length > 0) { await Promise.all( @@ -135,7 +136,7 @@ export default class OrganizationsHandler extends DefaultHandler { connectionsToUpdate.map((conn) => this.client.organizations .updateEnabledConnection( - { connection_id: conn.connection_id, ...params }, + { connectionId: conn.connection_id, ...params }, { assign_membership_on_login: conn.assign_membership_on_login } ) .catch(() => { @@ -149,7 +150,7 @@ export default class OrganizationsHandler extends DefaultHandler { await Promise.all( connectionsToAdd.map((conn) => this.client.organizations - .addEnabledConnection(params, _.omit(conn, 'connection')) + .addEnabledConnection(params, _.omit(conn, 'connection') as PostEnabledConnectionsRequest) .catch(() => { throw new Error( `Problem adding Enabled Connection ${conn.connection_id} for organizations ${params.id}` @@ -161,7 +162,7 @@ export default class OrganizationsHandler extends DefaultHandler { await Promise.all( connectionsToRemove.map((conn) => this.client.organizations - .removeEnabledConnection({ connection_id: conn.connection_id, ...params }) + .deleteEnabledConnection({ connectionId: conn.connection_id, ...params }) .catch(() => { throw new Error( `Problem removing Enabled Connection ${conn.connection_id} for organizations ${params.id}` @@ -200,12 +201,12 @@ export default class OrganizationsHandler extends DefaultHandler { } try { - const organizations = await this.client.organizations.getAll({ - checkpoint: true, + // TODO: Bring back checkpoint: true + const { data: { organizations } } = await this.client.organizations.getAll({ include_totals: true, }); for (let index = 0; index < organizations.length; index++) { - const connections = await this.client.organizations.connections.get({ + const { data: connections } = await this.client.organizations.getEnabledConnections({ id: organizations[index].id, }); organizations[index].connections = connections; @@ -228,8 +229,8 @@ export default class OrganizationsHandler extends DefaultHandler { if (!organizations) return; // Gets organizations from destination tenant const existing = await this.getType(); - const existingConnections = await this.client.connections.getAll({ - paginate: true, + // TODO: Bring back paginate: true + const { data: { connections: existingConnections } } = await this.client.connections.getAll({ include_totals: true, }); diff --git a/src/tools/auth0/handlers/pages.ts b/src/tools/auth0/handlers/pages.ts index 679441e1..4296a36e 100644 --- a/src/tools/auth0/handlers/pages.ts +++ b/src/tools/auth0/handlers/pages.ts @@ -50,9 +50,10 @@ export default class PagesHandler extends DefaultHandler { } async updateLoginPage(page): Promise { - const globalClient = await this.client.clients.getAll({ + // TODO: Bring back paginate: true + // @ts-ignore-error TODO: add pagination overload to client.getAll + const { data: { clients: globalClient } } = await this.client.clients.getAll({ is_global: true, - paginate: true, include_totals: true, }); @@ -86,7 +87,7 @@ export default class PagesHandler extends DefaultHandler { }, {}); if (Object.keys(update).length) { - await this.client.tenant.updateSettings(update); + await this.client.tenants.updateSettings(update); } toUpdate.forEach((page) => { @@ -103,9 +104,10 @@ export default class PagesHandler extends DefaultHandler { }[] = []; // Login page is handled via the global client - const globalClient = await this.client.clients.getAll({ + // TODO: Bring back paginate: true + // @ts-ignore-error TODO: add pagination overload to client.getAll + const { data: { clients: globalClient } } = await this.client.clients.getAll({ is_global: true, - paginate: true, include_totals: true, }); if (!globalClient[0]) { @@ -120,7 +122,7 @@ export default class PagesHandler extends DefaultHandler { }); } - const tenantSettings = await this.client.tenant.getSettings(); + const { data: tenantSettings } = await this.client.tenants.getSettings(); Object.entries(pageNameMap).forEach(([key, name]) => { const page = tenantSettings[name]; diff --git a/src/tools/auth0/handlers/prompts.ts b/src/tools/auth0/handlers/prompts.ts index b98ce733..b0ac9014 100644 --- a/src/tools/auth0/handlers/prompts.ts +++ b/src/tools/auth0/handlers/prompts.ts @@ -175,7 +175,7 @@ export default class PromptsHandler extends DefaultHandler { } async getType(): Promise { - const promptsSettings = await this.client.prompts.getSettings(); + const { data: promptsSettings } = await this.client.prompts.get(); const customText = await this.getCustomTextSettings(); @@ -186,9 +186,9 @@ export default class PromptsHandler extends DefaultHandler { } async getCustomTextSettings(): Promise { - const supportedLanguages = await this.client.tenant + const supportedLanguages = await this.client.tenants .getSettings() - .then(({ enabled_locales }) => { + .then(({ data: { enabled_locales } }) => { if (enabled_locales === undefined) return []; // In rare cases, private cloud tenants may not have `enabled_locales` defined return enabled_locales; }); @@ -205,7 +205,7 @@ export default class PromptsHandler extends DefaultHandler { prompt: promptType, language, }) - .then((customTextData) => { + .then(({data: customTextData}) => { if (isEmpty(customTextData)) return null; return { language, @@ -244,7 +244,7 @@ export default class PromptsHandler extends DefaultHandler { const { customText, ...promptSettings } = prompts; if (!isEmpty(promptSettings)) { - await this.client.prompts.updateSettings({}, promptSettings); + await this.client.prompts.update(promptSettings); } await this.updateCustomTextSettings(customText); @@ -276,11 +276,7 @@ export default class PromptsHandler extends DefaultHandler { }); }), generator: ({ prompt, language, body }) => - this.client.prompts.updateCustomTextByLanguage({ - prompt, - language, - body, - }), + this.client.prompts.updateCustomTextByLanguage({ prompt, language }, body) }) .promise(); } diff --git a/src/tools/auth0/handlers/resourceServers.ts b/src/tools/auth0/handlers/resourceServers.ts index 5541d775..6951ebfe 100644 --- a/src/tools/auth0/handlers/resourceServers.ts +++ b/src/tools/auth0/handlers/resourceServers.ts @@ -1,3 +1,4 @@ +import { ResourceServer } from 'auth0'; import ValidationError from '../../validationError'; import constants from '../../constants'; @@ -34,12 +35,6 @@ export const schema = { }, }; -export type ResourceServer = { - id: string; - name: string; - identifier: string; - scopes?: { description: string; value: string }[]; -}; export default class ResourceServersHandler extends DefaultHandler { existing: ResourceServer[]; @@ -58,8 +53,8 @@ export default class ResourceServersHandler extends DefaultHandler { async getType(): Promise { if (this.existing) return this.existing; - const resourceServers = await this.client.resourceServers.getAll({ - paginate: true, + // TODO: Bring back paginate: true + const { data: { resource_servers: resourceServers } } = await this.client.resourceServers.getAll({ include_totals: true, }); return resourceServers.filter( diff --git a/src/tools/auth0/handlers/roles.ts b/src/tools/auth0/handlers/roles.ts index 260449c2..ba731ff1 100644 --- a/src/tools/auth0/handlers/roles.ts +++ b/src/tools/auth0/handlers/roles.ts @@ -41,10 +41,10 @@ export default class RolesHandler extends DefaultHandler { const role = { ...data }; delete role.permissions; - const created = await this.client.roles.create(role); + const { data: created } = await this.client.roles.create(role); if (typeof data.permissions !== 'undefined' && data.permissions.length > 0) { - await this.client.roles.permissions.create( + await this.client.roles.addPermissions( { id: created.id }, { permissions: data.permissions } ); @@ -113,11 +113,11 @@ export default class RolesHandler extends DefaultHandler { await this.client.roles.update(params, data); if (typeof existingRole.permissions !== 'undefined' && existingRole.permissions.length > 0) { - await this.client.roles.permissions.delete(params, { permissions: existingRole.permissions }); + await this.client.roles.deletePermissions(params, { permissions: existingRole.permissions }); } if (typeof newPermissions !== 'undefined' && newPermissions.length > 0) { - await this.client.roles.permissions.create(params, { permissions: newPermissions }); + await this.client.roles.addPermissions(params, { permissions: newPermissions }); } return params; @@ -151,10 +151,11 @@ export default class RolesHandler extends DefaultHandler { } try { - const roles = await this.client.roles.getAll({ paginate: true, include_totals: true }); + // TODO: Bring back paginate: true + const { data: { roles } } = await this.client.roles.getAll({ include_totals: true }); for (let index = 0; index < roles.length; index++) { - const permissions = await this.client.roles.permissions.getAll({ - paginate: true, + // TODO: Bring back paginate: true + const { data: { permissions } } = await this.client.roles.getPermissions({ include_totals: true, id: roles[index].id, }); @@ -165,7 +166,8 @@ export default class RolesHandler extends DefaultHandler { return permission; }) ); - roles[index].permissions = strippedPerms; + // TODO: Do we need this? + (roles[index] as any).permissions = strippedPerms; } this.existing = roles; return this.existing; diff --git a/src/tools/auth0/handlers/rules.ts b/src/tools/auth0/handlers/rules.ts index b95d0dbf..95d9661d 100644 --- a/src/tools/auth0/handlers/rules.ts +++ b/src/tools/auth0/handlers/rules.ts @@ -63,7 +63,9 @@ export default class RulesHandler extends DefaultHandler { async getType(): Promise { try { if (this.existing) return this.existing; - this.existing = await this.client.rules.getAll({ paginate: true, include_totals: true }); + // TODO: Bring back paginate: true + const { data } = await this.client.rules.getAll({ include_totals: true }); + this.existing = data.rules; return this.existing; } catch (err) { if (isDeprecatedError(err)) { diff --git a/src/tools/auth0/handlers/rulesConfigs.ts b/src/tools/auth0/handlers/rulesConfigs.ts index 8e430133..170e914b 100644 --- a/src/tools/auth0/handlers/rulesConfigs.ts +++ b/src/tools/auth0/handlers/rulesConfigs.ts @@ -30,7 +30,8 @@ export default class RulesConfigsHandler extends DefaultHandler { async getType(): Promise { try { - return this.client.rulesConfigs.getAll(); + const { data } = await this.client.rulesConfigs.getAll(); + return data; } catch (err) { if (isDeprecatedError(err)) return null; throw err; diff --git a/src/tools/auth0/handlers/tenant.ts b/src/tools/auth0/handlers/tenant.ts index 941ce5d0..42c9c409 100644 --- a/src/tools/auth0/handlers/tenant.ts +++ b/src/tools/auth0/handlers/tenant.ts @@ -1,16 +1,16 @@ +import { TenantSettings, TenantSettingsFlags, TenantSettingsUpdate, TenantSettingsUpdateFlags } from 'auth0'; import ValidationError from '../../validationError'; - import DefaultHandler, { order } from './default'; import { supportedPages, pageNameMap } from './pages'; import { convertJsonToString } from '../../utils'; -import { Asset, Assets, Language } from '../../../types'; +import { Asset, Assets } from '../../../types'; import log from '../../../logger'; export const schema = { type: 'object', }; -export type Tenant = Asset & { enabled_locales?: Language[]; flags: { [key: string]: boolean } }; +export type Tenant = TenantSettings; const blockPageKeys = [ ...Object.keys(pageNameMap), @@ -29,7 +29,7 @@ export default class TenantHandler extends DefaultHandler { } async getType(): Promise { - const tenant = await this.client.tenant.getSettings(); + const { data: tenant } = await this.client.tenants.getSettings(); tenant.flags = removeUnallowedTenantFlags(tenant.flags); @@ -66,19 +66,20 @@ export default class TenantHandler extends DefaultHandler { // Do nothing if not set if (!tenant) return; - const updatedTenant: Partial = { - ...tenant, + const updatedTenant: TenantSettingsUpdate = { + // TODO: What's wrong with the enums? + ...(tenant as any), }; if ('flags' in updatedTenant) { - updatedTenant.flags = removeUnallowedTenantFlags(tenant.flags); + updatedTenant.flags = removeUnallowedTenantFlags(tenant.flags) as TenantSettingsUpdateFlags; if (Object.keys(updatedTenant.flags).length === 0) { delete updatedTenant.flags; } } if (updatedTenant && Object.keys(updatedTenant).length > 0) { - await this.client.tenant.updateSettings(updatedTenant); + await this.client.tenants.updateSettings(updatedTenant); this.updated += 1; this.didUpdate(updatedTenant); } @@ -87,7 +88,7 @@ export default class TenantHandler extends DefaultHandler { /* Tenant flags are used to facilitate a number of functionalities, some - public, some internal. The subset of flags that are allowed to be updated + public, some internal. The subset of flags that are allowed to be updated in the context of the Deploy CLI is based on wether they're publicly exposed in the Auth0 API docs: @@ -122,13 +123,13 @@ export const allowedTenantFlags = [ ]; export const removeUnallowedTenantFlags = ( - proposedFlags: Tenant['flags'] | undefined -): Tenant['flags'] => { - if (proposedFlags === undefined) return {}; + proposedFlags: TenantSettingsFlags +): TenantSettingsFlags => { + if (proposedFlags === undefined) return {} as unknown as TenantSettingsFlags; const removedFlags: string[] = []; const filteredFlags = Object.keys(proposedFlags).reduce( - (acc: Tenant['flags'], proposedKey: string): Tenant['flags'] => { + (acc: TenantSettingsFlags, proposedKey: string): TenantSettingsFlags => { const isAllowedFlag = allowedTenantFlags.includes(proposedKey); if (!isAllowedFlag) { removedFlags.push(proposedKey); @@ -139,7 +140,7 @@ export const removeUnallowedTenantFlags = ( [proposedKey]: proposedFlags[proposedKey], }; }, - {} + {} as unknown as TenantSettingsFlags ); if (removedFlags.length > 0) { diff --git a/src/tools/auth0/handlers/themes.ts b/src/tools/auth0/handlers/themes.ts index 240df915..6ce69a19 100644 --- a/src/tools/auth0/handlers/themes.ts +++ b/src/tools/auth0/handlers/themes.ts @@ -54,7 +54,7 @@ export default class ThemesHandler extends DefaultHandler { } const currentTheme = currentThemes[0]; - await this.client.branding.deleteTheme({ id: currentTheme.themeId }); + await this.client.branding.deleteTheme({ themeId: currentTheme.themeId }); this.deleted += 1; this.didDelete(currentTheme); @@ -81,7 +81,7 @@ export default class ThemesHandler extends DefaultHandler { } else { const currentTheme = currentThemes[0]; // if theme exists, overwrite it otherwise create it - await this.client.branding.updateTheme({ id: currentTheme.themeId }, themeReqPayload); + await this.client.branding.updateTheme({ themeId: currentTheme.themeId }, themeReqPayload); } this.updated += 1; @@ -90,7 +90,7 @@ export default class ThemesHandler extends DefaultHandler { async getThemes(): Promise { try { - const theme = await this.client.branding.getDefaultTheme(); + const { data: theme } = await this.client.branding.getDefaultTheme(); return [theme]; } catch (err) { if (err.statusCode === 404) return []; diff --git a/src/tools/auth0/handlers/triggers.ts b/src/tools/auth0/handlers/triggers.ts index 55f84c16..f2726cc9 100644 --- a/src/tools/auth0/handlers/triggers.ts +++ b/src/tools/auth0/handlers/triggers.ts @@ -58,14 +58,15 @@ export default class TriggersHandler extends DefaultHandler { try { const res = await this.client.actions.getAllTriggers(); - const triggers: string[] = _(res.triggers).map('id').uniq().value(); + const triggers: string[] = _(res.data.triggers).map('id').uniq().value(); for (let i = 0; i < triggers.length; i++) { const triggerId = triggers[i]; - const { bindings } = await this.client.actions.getTriggerBindings({ - trigger_id: triggerId, + const { data } = await this.client.actions.getTriggerBindings({ + triggerId: triggerId, }); - if (bindings.length > 0) { + const { bindings } = data; + if (bindings && bindings.length > 0) { triggerBindings[triggerId] = bindings.map((binding) => ({ action_name: binding.action.name, display_name: binding.display_name, @@ -109,7 +110,7 @@ export default class TriggersHandler extends DefaultHandler { display_name: binding.display_name, })); - await this.client.actions.updateTriggerBindings({ trigger_id: name }, { bindings }); + await this.client.actions.updateTriggerBindings({ triggerId: name }, { bindings }); this.didUpdate({ trigger_id: name }); this.updated += 1; }) diff --git a/src/tools/constants.ts b/src/tools/constants.ts index 4506b46f..03d20511 100644 --- a/src/tools/constants.ts +++ b/src/tools/constants.ts @@ -1,3 +1,5 @@ +import { GetEmailTemplatesByTemplateNameTemplateNameEnum } from 'auth0'; + const PAGE_GUARDIAN_MULTIFACTOR = 'guardian_multifactor'; const PAGE_PASSWORD_RESET = 'password_reset'; const PAGE_LOGIN = 'login'; @@ -53,7 +55,7 @@ const constants = { 'change_password', 'password_reset', 'user_invitation', - ], + ] as GetEmailTemplatesByTemplateNameTemplateNameEnum[], ACTIONS_TRIGGERS: [ 'post-login', 'credentials-exchange', diff --git a/src/types.ts b/src/types.ts index 8fe333ee..70cc58c6 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,10 +1,7 @@ +import { ManagementClient, ResourceServer } from 'auth0'; import { Action } from './tools/auth0/handlers/actions'; import { - PromptTypes, - ScreenTypes, Prompts, - PromptsCustomText, - PromptSettings, } from './tools/auth0/handlers/prompts'; import { Tenant } from './tools/auth0/handlers/tenant'; import { Theme } from './tools/auth0/handlers/themes'; @@ -12,7 +9,6 @@ import { Page } from './tools/auth0/handlers/pages'; import { LogStream } from './tools/auth0/handlers/logStreams'; import { Client } from './tools/auth0/handlers/clients'; import { ClientGrant } from './tools/auth0/handlers/clientGrants'; -import { ResourceServer } from './tools/auth0/handlers/resourceServers'; import { PromisePoolExecutor } from 'promise-pool-executor'; type SharedPaginationParams = { @@ -34,13 +30,6 @@ export type PagePaginationParams = SharedPaginationParams & { per_page: number; }; -type APIClientBaseFunctions = { - getAll: (arg0: SharedPaginationParams) => Promise; - create: (arg0: { id: string }) => Promise; - update: (arg0: {}, arg1: Asset) => Promise; - delete: (arg0: Asset) => Promise; -}; - export type ApiResponse = { start: number; limit: number; @@ -48,144 +37,7 @@ export type ApiResponse = { next?: string; } & { [key in AssetTypes]: Asset[] }; -export type BaseAuth0APIClient = { - actions: { - getAll: (arg0: SharedPaginationParams) => Promise; - create: (arg0: { id: string }) => Promise; - update: (arg0: {}, arg1: Action) => Promise; - delete: (arg0: Asset) => Promise; - deploy: (arg0: { id: string }) => Promise; - getAllTriggers: () => Promise<{ triggers: Asset[] }>; - getTriggerBindings: (arg0: { trigger_id: string }) => Promise<{ bindings: Asset[] }>; - updateTriggerBindings: ( - arg0: { trigger_id: string }, - arg1: { bindings: Object } - ) => Promise<{ bindings: Asset[] }>; - }; - attackProtection: APIClientBaseFunctions & { - getBreachedPasswordDetectionConfig: () => Promise; - getBruteForceConfig: () => Promise; - getSuspiciousIpThrottlingConfig: () => Promise; - updateBreachedPasswordDetectionConfig: ({}, arg1: Asset) => Promise; - updateSuspiciousIpThrottlingConfig: ({}, arg1: Asset) => Promise; - updateBruteForceConfig: ({}, arg1: Asset) => Promise; - }; - branding: APIClientBaseFunctions & { - getSettings: () => Promise; - getUniversalLoginTemplate: () => Promise; - updateSettings: ({}, Asset) => Promise; - setUniversalLoginTemplate: ({}, Asset) => Promise; - getDefaultTheme: () => Promise; - updateTheme: ( - arg0: { id: string }, - arg1: Omit - ) => Promise>; - createTheme: (arg0: Omit) => Promise>; - deleteTheme: (arg0: { id: string }) => Promise; - }; - clients: { - getAll: (arg0: SharedPaginationParams) => Promise; - create: (arg0: { id: string }) => Promise; - update: (arg0: {}, arg1: Partial) => Promise; - delete: (arg0: Asset) => Promise; - }; - clientGrants: { - getAll: (arg0: SharedPaginationParams) => Promise; - create: (arg0: { id: string }) => Promise; - update: (arg0: {}, arg1: Partial) => Promise; - delete: (arg0: Asset) => Promise; - }; - connections: APIClientBaseFunctions & { - get: (arg0: Asset) => Promise; - getAll: (arg0: PagePaginationParams | CheckpointPaginationParams) => Promise; - }; - customDomains: APIClientBaseFunctions & { - getAll: () => Promise; - }; - emailProvider: APIClientBaseFunctions & { - delete: () => Promise; - get: (arg0: Asset) => Promise; - configure: (arg0: Object, arg1: Object) => Promise; - }; - emailTemplates: APIClientBaseFunctions & { - get: (arg0: Asset) => Promise; - }; - guardian: APIClientBaseFunctions & { - getFactorProvider: (arg0: Asset) => Promise; - updateFactorProvider: (arg0: {}, arg1: Asset) => Promise; - getFactors: () => Promise; - updateFactor: (arg0: {}, arg1: Asset) => Promise; - getPolicies: () => Promise; - updatePolicies: (arg0: {}, arg1: Asset) => Promise; - getFactorTemplates: (arg0: { name: string }) => Promise; - updateFactorTemplates: (arg0: {}, arg1: Asset) => Promise; - updatePhoneFactorMessageTypes: (arg0: {}, arg1: Asset) => Promise; - getPhoneFactorSelectedProvider: () => Promise; - getPhoneFactorMessageTypes: () => Promise; - updatePhoneFactorSelectedProvider: (arg0: {}, arg1: Asset) => Promise; - }; - hooks: APIClientBaseFunctions & { - get: (arg0: { id: string }) => Promise; - removeSecrets: (arg0: {}, arg1: Asset) => Promise; - updateSecrets: (arg0: {}, arg1: Asset) => Promise; - getSecrets: (arg0: { id: string }) => Promise>; - addSecrets: (arg0: {}, arg1: Asset) => Promise; - }; - logStreams: { - getAll: (arg0: SharedPaginationParams) => Promise; - create: (arg0: { id: string }) => Promise; - update: (arg0: {}, arg1: Partial) => Promise; - delete: (arg0: Asset) => Promise; - }; - migrations: APIClientBaseFunctions & { - getMigrations: () => Promise<{ flags: Asset[] }>; - updateMigrations: (arg0: { flags: Asset[] }) => Promise; - }; - organizations: APIClientBaseFunctions & { - updateEnabledConnection: (arg0: {}, arg1: Asset) => Promise; - addEnabledConnection: (arg0: {}, arg1: Asset) => Promise; - removeEnabledConnection: (arg0: Asset) => Promise; - connections: { - get: (arg0: Asset) => Promise; - }; - }; - prompts: { - updateCustomTextByLanguage: (arg0: { - prompt: PromptTypes; - language: Language; - body: Partial<{ [key in ScreenTypes]: { [key: string]: string } }>; - }) => Promise; - getCustomTextByLanguage: (arg0: { - prompt: PromptTypes; - language: Language; - }) => Promise>; - getSettings: () => Promise; - updateSettings: (arg0: {}, arg1: Partial) => Promise; - }; - resourceServers: { - getAll: (arg0: SharedPaginationParams) => Promise; - create: (arg0: { id: string }) => Promise; - update: (arg0: {}, arg1: Partial) => Promise; - delete: (arg0: Asset) => Promise; - }; - roles: APIClientBaseFunctions & { - permissions: APIClientBaseFunctions & { - delete: (arg0: { id: string }, arg1: { permissions: Asset[] }) => Promise; - create: (arg0: { id: string }, arg1: { permissions: Asset[] }) => Promise; - }; - }; - rules: APIClientBaseFunctions; - rulesConfigs: APIClientBaseFunctions & { - getAll: () => Promise; - }; - tenant: APIClientBaseFunctions & { - getSettings: () => Promise; - updateSettings: (arg0: Partial) => Promise; - }; - triggers: APIClientBaseFunctions & { - getTriggerBindings: () => Promise; - }; -}; // TODO: replace with a more accurate representation of the Auth0APIClient type +export type BaseAuth0APIClient = ManagementClient; export type Auth0APIClient = BaseAuth0APIClient & { pool: PromisePoolExecutor; @@ -251,7 +103,7 @@ export type Assets = Partial<{ } | null; guardianPhoneFactorSelectedProvider: Asset | null; guardianPolicies: { - policies: Asset[]; //TODO: eliminate this intermediate level for consistency + policies: string[]; //TODO: eliminate this intermediate level for consistency } | null; hooks: Asset[] | null; logStreams: LogStream[] | null; @@ -296,7 +148,6 @@ export type AssetTypes = | 'guardianFactors' | 'guardianFactorProviders' | 'guardianFactorTemplates' - | 'migrations' | 'guardianPhoneFactorMessageTypes' | 'guardianPhoneFactorSelectedProvider' | 'guardianPolicies' diff --git a/test/context/context.test.js b/test/context/context.test.js index 30259ced..e8cca65e 100644 --- a/test/context/context.test.js +++ b/test/context/context.test.js @@ -1,4 +1,5 @@ import path from 'path'; +import { AuthApiError } from 'auth0'; import fs from 'fs-extra'; import chai, { expect } from 'chai'; import sinon from 'sinon'; @@ -20,6 +21,35 @@ const config = { AUTH0_ACCESS_TOKEN: 'fake', }; +const TEST_PRIVATE_KEY = `-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDx+hc8imR4soBV +9WD9bRey14VqzZfCvEAYbSWctLeZz9xhz+kP+mWxHvv07wi3/ZiYcVYgOYIhxbnt +ugNp78oCFUEsdRrdq2juHlqBtjaYpINQSOqNaKUBt3JRkPPxRLyhwCZ6HJVYy5Wp +4bG6c8eimbglDY4ZwTfUxu1wk3TvMJr9H8tSLwox666NDpxx4ga6kJ06wromShQH +bCS8WlQKI7CpMbnUSrgNJO6QOvu0N97Szl7UwHFVTEuSvDvMGuUPE+Bn4zbrQVSV +Go4oqyTchSR7+9xBpzq36OzXM6zSZqmovJuSzMbCXbBjQlo4s61wvnOLhT3D8Z44 +c5VE52frAgMBAAECggEALCx3qXmqNc6AVzDgb+NGfEOT+5dkqQwst0jVoPHswouL +s998sIoJnngFjwVEFjKZdNrb2i4lb3zlIFzg2qoHurGeoDsQmH7+PNoVs7BL7zm5 +LyLgjsgXt2SB3hoULmtZ9D1byNcG/JrNy6GEDIGuZCSj1T/QPStkwdc+6VpB8pgW +E8D7jCt40Tik2neYQkDnY775kGAHGWEqpdPCwm+KOnuE1fHx/jk38lmUgYNjKq0h +JK6Ncjen1X+ZsYfGx4dALWG4cqo3lE0YXXuHuvjJV3aVfzH8t7W4fuZ4+8xvdhhV +F4br5FimWLbTe2qT4lSpadkbLm3aBlSUR7eAP0BlwQKBgQD5ayZpP5OMp1zfa4hA +fM8nVUEaVLkRwFK5NChfjHGiaye2RjrnIorXMsFxXjEscgTn2Ux9CgcBhp1fTBhy +6cmhkp1talAIqLBivNQJT0YTfA+uHrHTTyMfEUgsMzPiiAg7FV7BCG6xd/nsk3yg +ZUfoXefrhq9LIHsJx7cK12VViQKBgQD4XKvwYmX5t7fZFBPd7dv5ZrcMHQnBMHd7 +is3QhgyKuEgVDzKQ9SA004I9iSvcI3dE/npj31P39N5bbuvYTh4WR/SR4VvXavNG +AqUR7wm8jTlbiWEPgF9MxC24zaa07Kbxs+P8XT/7wWuijf6+baSFgxQMb80fUArv +7guKikCo0wKBgCUn3DIDoZRrfj9eQo7wyN9gKPGmO2e0kd47MeSCBI+gjOrvbWjv +UWWbjwu3b3Xiim6LhYR/EOoeRqViraW4xCvIrqEVHFUd5CDhZmj4oUTXz3It6mnD +OUUwiuLiwdD2WNuMZHA3NF5FtDqVAhTW4a5xBtKkXsq/TPT5BoCb8+GZAoGAUWAD +0gpbgTuJ2G10qPWDaq8V8Lke9haMP4VWNCmHuHfy3juRhN9cAxL+DG2CWmmgbZG3 +xjtpRsgLhwfL7J6DyyceYiHltqpLNTgun7ajiQz4qx5TGAImt39bv75aDdOwS2d2 +nrxq93EDdEp0Gi7QhhJRolWLbuQKAV0MmQL9dpMCgYEA5+ug3CDI/jyTHG4ZEVoG +qmIg7QoHrVEmZrvCMiFw8bbuBvoMnvu1o1zfvAkNrDfibZyxYKHzSqgeVPQShvLa +P6JCu67ieCGP8C8CMFiQhJ9n4sYGnkzkz67NpkHSzDPA6DfvG4pYuvBQRIefnhYh +IDGpghhKHMV2DAyzeM4cDU8= +-----END PRIVATE KEY-----`; + describe('#context loader validation', async () => { it('should error on bad file', async () => { await expect(setupContext(config), 'import').to.be.eventually.rejectedWith(Error); @@ -46,9 +76,9 @@ describe('#context loader validation', async () => { const result = await expect( setupContext({ ...tmpConfig, AUTH0_INPUT_FILE: dir }), 'import' - ).to.be.eventually.rejectedWith(Error); + ).to.be.eventually.rejectedWith(AuthApiError); - expect(result).to.be.an('object').that.has.property('name').which.eq('access_denied'); + expect(result).to.be.an('error').that.has.property('error').which.eq('access_denied'); }); it('should error while attempting private key JWT generation, but pass validation with client signing key', async () => { @@ -72,7 +102,7 @@ describe('#context loader validation', async () => { expect(result) .to.be.an('Error') .that.has.property('message') - .which.eq('secretOrPrivateKey must be an asymmetric key when using RS256'); + .which.eq('"pkcs8" must be PKCS#8 formatted string'); }); it('should error while attempting private key JWT generation because of incorrect value for algorithm, but pass validation with client signing key', async () => { @@ -82,7 +112,7 @@ describe('#context loader validation', async () => { cleanThenMkdir(dir); createDir(dir, { '.': { - 'private.pem': 'some-invalid-private-key', + 'private.pem': TEST_PRIVATE_KEY, }, }); @@ -97,7 +127,7 @@ describe('#context loader validation', async () => { expect(result) .to.be.an('Error') .that.has.property('message') - .which.eq('"algorithm" must be a valid string enum value'); + .which.eq('alg bad value for algorithm is not supported either by JOSE or your javascript runtime'); }); it('should error when secret, private key and auth token are all absent', async () => { @@ -155,7 +185,7 @@ describe('#context loader validation', async () => { expect(loaded).to.be.an.instanceof(yamlContext); const userAgent = - loaded.mgmtClient.rules.resource.restClient.restClient.options.headers['User-agent']; + loaded.mgmtClient.configuration.headers['User-agent']; expect(userAgent).to.contain('deploy-cli'); expect(userAgent).to.contain('node.js'); diff --git a/test/context/directory/clientGrants.test.js b/test/context/directory/clientGrants.test.js index 023e128c..14892c84 100644 --- a/test/context/directory/clientGrants.test.js +++ b/test/context/directory/clientGrants.test.js @@ -5,7 +5,7 @@ import { constants } from '../../../src/tools'; import Context from '../../../src/context/directory'; import handler from '../../../src/context/directory/handlers/clientGrants'; -import { cleanThenMkdir, testDataDir, createDir, mockMgmtClient } from '../../utils'; +import { cleanThenMkdir, testDataDir, createDir, mockMgmtClient, mockPagedData } from '../../utils'; import { getFiles, loadJSON } from '../../../src/utils'; describe('#directory context clientGrants', () => { @@ -124,8 +124,8 @@ describe('#directory context clientGrants', () => { { ...mockMgmtClient(), clients: { - getAll: () => [ - [ + getAll: (params) => + mockPagedData(params, 'clients', [ { client_id: 'client-id-1', name: 'Primary M2M', @@ -134,12 +134,11 @@ describe('#directory context clientGrants', () => { client_id: 'client-id-2', name: 'Secondary M2M', }, - ], - ], + ]), }, resourceServers: { - getAll: () => [ - [ + getAll: (params) => + mockPagedData(params, 'resource_servers', [ { id: 'resource-server-1', name: 'Payments Service', @@ -150,8 +149,7 @@ describe('#directory context clientGrants', () => { name: 'Auth0 Management API', identifier: 'https://travel0.us.auth0.com/api/v2', }, - ], - ], + ]), }, } ); diff --git a/test/context/directory/context.test.js b/test/context/directory/context.test.js index 8d9603cf..20c0f602 100644 --- a/test/context/directory/context.test.js +++ b/test/context/directory/context.test.js @@ -156,12 +156,14 @@ describe('#directory context validation', () => { }, }, { - tenant: { + tenants: { getSettings: async () => new Promise((res) => res({ - friendly_name: 'Production Tenant', - enabled_locales: ['en', 'es'], + data: { + friendly_name: 'Production Tenant', + enabled_locales: ['en', 'es'], + } }) ), }, diff --git a/test/context/directory/migrations.test.js b/test/context/directory/migrations.test.js deleted file mode 100644 index 93006fb6..00000000 --- a/test/context/directory/migrations.test.js +++ /dev/null @@ -1,47 +0,0 @@ -import path from 'path'; -import { expect } from 'chai'; - -import Context from '../../../src/context/directory'; -import { testDataDir, createDir, mockMgmtClient, cleanThenMkdir } from '../../utils'; -import handler from '../../../src/context/directory/handlers/migrations'; -import { loadJSON } from '../../../src/utils'; - -const migrationsTest = { - 'migrations.json': `{ - "migration_flag": true - }`, -}; - -const migrationsTarget = { - migration_flag: true, -}; - -describe('#directory context migrations', () => { - it('should process migrations', async () => { - createDir(path.join(testDataDir, 'directory'), { migrations: migrationsTest }); - - const config = { - AUTH0_INPUT_FILE: path.join(testDataDir, 'directory', 'migrations'), - AUTH0_KEYWORD_REPLACE_MAPPINGS: { env: 'test' }, - }; - const context = new Context(config, mockMgmtClient()); - await context.loadAssetsFromLocal(); - - expect(context.assets.migrations).to.deep.equal(migrationsTarget); - }); - - it('should dump migrations', async () => { - const dir = path.join(testDataDir, 'directory', 'migrationsDump'); - cleanThenMkdir(dir); - const context = new Context({ AUTH0_INPUT_FILE: dir }, mockMgmtClient()); - - context.assets.migrations = { - migration_flag: false, - }; - - await handler.dump(context); - const dumped = loadJSON(path.join(dir, 'migrations.json')); - - expect(dumped).to.deep.equal(context.assets.migrations); - }); -}); diff --git a/test/context/yaml/context.test.js b/test/context/yaml/context.test.js index 0d46ce64..1109db43 100644 --- a/test/context/yaml/context.test.js +++ b/test/context/yaml/context.test.js @@ -4,7 +4,7 @@ import jsYaml from 'js-yaml'; import { expect } from 'chai'; import Context from '../../../src/context/yaml'; -import { cleanThenMkdir, testDataDir, mockMgmtClient } from '../../utils'; +import { cleanThenMkdir, testDataDir, mockMgmtClient, mockPagedData } from '../../utils'; describe('#YAML context validation', () => { it('should do nothing on empty yaml', async () => { @@ -247,7 +247,6 @@ describe('#YAML context validation', () => { guardianFactors: [], guardianFactorProviders: [], guardianFactorTemplates: [], - migrations: {}, guardianPhoneFactorMessageTypes: { message_types: ['sms'] }, guardianPhoneFactorSelectedProvider: { provider: 'twilio' }, guardianPolicies: { policies: [] }, @@ -359,7 +358,6 @@ describe('#YAML context validation', () => { guardianFactors: [], guardianFactorProviders: [], guardianFactorTemplates: [], - migrations: {}, guardianPhoneFactorMessageTypes: { message_types: ['sms'] }, guardianPhoneFactorSelectedProvider: { provider: 'twilio' }, guardianPolicies: { policies: [] }, @@ -472,7 +470,6 @@ describe('#YAML context validation', () => { guardianFactors: [], guardianFactorProviders: [], guardianFactorTemplates: [], - migrations: {}, guardianPhoneFactorMessageTypes: { message_types: ['sms'] }, guardianPhoneFactorSelectedProvider: { provider: 'twilio' }, guardianPolicies: { policies: [] }, @@ -565,18 +562,20 @@ describe('#YAML context validation', () => { }, }, { - tenant: { + tenants: { getSettings: async () => new Promise((res) => res({ - friendly_name: 'Production Tenant', - enabled_locales: ['en', 'es'], + data: { + friendly_name: 'Production Tenant', + enabled_locales: ['en', 'es'], + }, }) ), }, connections: { - getAll: () => ({ - connections: [ + getAll: (params) => + mockPagedData(params, 'connections', [ { name: 'connection-1', strategy: 'waad', @@ -584,8 +583,7 @@ describe('#YAML context validation', () => { tenant_domain: 'travel0.com', }, }, - ], - }), + ]), }, } ); diff --git a/test/context/yaml/migrations.test.js b/test/context/yaml/migrations.test.js deleted file mode 100644 index 41b2c727..00000000 --- a/test/context/yaml/migrations.test.js +++ /dev/null @@ -1,58 +0,0 @@ -import path from 'path'; -import fs from 'fs-extra'; -import { expect } from 'chai'; - -import Context from '../../../src/context/yaml'; -import handler from '../../../src/context/yaml/handlers/migrations'; -import { cleanThenMkdir, testDataDir, mockMgmtClient } from '../../utils'; - -describe('#YAML context migrations', () => { - it('should process migrationss', async () => { - const dir = path.join(testDataDir, 'yaml', 'migrations'); - cleanThenMkdir(dir); - - const yaml = ` - migrations: - migration_flag_1: true - migration_flag_2: false - `; - - const yamlFile = path.join(dir, 'config.yaml'); - fs.writeFileSync(yamlFile, yaml); - - const target = { - migration_flag_1: true, - migration_flag_2: false, - }; - - const config = { AUTH0_INPUT_FILE: yamlFile, AUTH0_KEYWORD_REPLACE_MAPPINGS: { ENV: 'test' } }; - const context = new Context(config, mockMgmtClient()); - await context.loadAssetsFromLocal(); - - expect(context.assets.migrations).to.deep.equal(target); - }); - - it('should dump migrations', async () => { - const context = new Context({ AUTH0_INPUT_FILE: './test.yml' }, mockMgmtClient()); - const migrations = { - migration_flags: true, - }; - context.assets.migrations = migrations; - - const dumped = await handler.dump(context); - expect(dumped).to.deep.equal({ migrations }); - }); - - it('should dump tenant without flags', async () => { - const context = new Context({ AUTH0_INPUT_FILE: './test.yml' }, mockMgmtClient()); - const migrations = { - migration_flags: true, - }; - context.assets.migrations = { - migration_flags: true, - }; - - const dumped = await handler.dump(context); - expect(dumped).to.deep.equal({ migrations }); - }); -}); diff --git a/test/e2e/e2e.test.ts b/test/e2e/e2e.test.ts index 5eba2318..970c5937 100644 --- a/test/e2e/e2e.test.ts +++ b/test/e2e/e2e.test.ts @@ -7,6 +7,10 @@ import { load as yamlLoad } from 'js-yaml'; import { setupRecording, testNameToWorkingDirectory } from './e2e-utils'; import { dump, deploy } from '../../src'; import { AssetTypes } from '../../src/types'; +import fetch from 'node-fetch'; + +// Use node.http for recording library +global.fetch = fetch; const shouldUseRecordings = process.env['AUTH0_HTTP_RECORDINGS'] === 'lockdown'; const AUTH0_DOMAIN = shouldUseRecordings diff --git a/test/e2e/recordings/should-deploy-while-deleting-resources-if-AUTH0_ALLOW_DELETE-is-true.json b/test/e2e/recordings/should-deploy-while-deleting-resources-if-AUTH0_ALLOW_DELETE-is-true.json index 7f6958d6..47f6fb1d 100644 --- a/test/e2e/recordings/should-deploy-while-deleting-resources-if-AUTH0_ALLOW_DELETE-is-true.json +++ b/test/e2e/recordings/should-deploy-while-deleting-resources-if-AUTH0_ALLOW_DELETE-is-true.json @@ -2,7 +2,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/rules?include_totals=true&page=0&per_page=100", + "path": "/api/v2/rules?include_totals=true", "body": "", "status": 200, "response": { @@ -26,7 +26,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/rules?include_totals=true&page=0&per_page=100", + "path": "/api/v2/rules?include_totals=true", "body": "", "status": 200, "response": { @@ -72,7 +72,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/hooks?include_totals=true&page=0&per_page=100", + "path": "/api/v2/hooks?include_totals=true", "body": "", "status": 200, "response": { @@ -87,7 +87,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/hooks?include_totals=true&page=0&per_page=100", + "path": "/api/v2/hooks?include_totals=true", "body": "", "status": 200, "response": { @@ -102,7 +102,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?is_global=true&include_totals=true&page=0&per_page=100", + "path": "/api/v2/clients?is_global=true&include_totals=true", "body": "", "status": 200, "response": { @@ -188,6 +188,79 @@ }, "rawHeaders": [], "responseIsBinary": false + }, + { + "scope": "https://deploy-cli-dev.eu.auth0.com:443", + "method": "PATCH", + "path": "/api/v2/clients/GIW99EUCF9DFExh77WPMyTMzT8NN4J3A", + "body": { + "name": "Deploy CLI", + "app_type": "non_interactive", + "cross_origin_auth": false, + "custom_login_page_on": true, + "grant_types": ["client_credentials"], + "is_first_party": true, + "is_token_endpoint_ip_header_trusted": false, + "jwt_configuration": { + "alg": "RS256", + "lifetime_in_seconds": 36000 + }, + "oidc_conformant": true, + "refresh_token": { + "expiration_type": "non-expiring", + "leeway": 0, + "infinite_token_lifetime": true, + "infinite_idle_token_lifetime": true, + "token_lifetime": 31557600, + "idle_token_lifetime": 2592000, + "rotation_type": "non-rotating" + }, + "sso_disabled": false, + "token_endpoint_auth_method": "client_secret_post" + }, + "status": 200, + "response": { + "tenant": "auth0-deploy-cli-e2e", + "global": false, + "is_token_endpoint_ip_header_trusted": false, + "name": "Deploy CLI", + "is_first_party": true, + "oidc_conformant": true, + "sso_disabled": false, + "cross_origin_auth": false, + "refresh_token": { + "expiration_type": "non-expiring", + "leeway": 0, + "infinite_token_lifetime": true, + "infinite_idle_token_lifetime": true, + "token_lifetime": 31557600, + "idle_token_lifetime": 2592000, + "rotation_type": "non-rotating" + }, + "signing_keys": [ + { + "cert": "[REDACTED]", + "pkcs7": "[REDACTED]", + "subject": "deprecated" + } + ], + "client_id": "GIW99EUCF9DFExh77WPMyTMzT8NN4J3A", + "callback_url_template": false, + "client_secret": "[REDACTED]", + "jwt_configuration": { + "alg": "RS256", + "lifetime_in_seconds": 36000, + "secret_encoded": false + }, + "token_endpoint_auth_method": "client_secret_post", + "app_type": "non_interactive", + "grant_types": [ + "client_credentials" + ], + "custom_login_page_on": true + }, + "rawHeaders": [], + "responseIsBinary": false }, { "scope": "https://deploy-cli-dev.eu.auth0.com:443", @@ -274,7 +347,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/resource-servers?include_totals=true&page=0&per_page=100", + "path": "/api/v2/resource-servers?include_totals=true", "body": "", "status": 200, "response": { @@ -863,7 +936,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&is_global=false&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true&is_global=false", "body": "", "status": 200, "response": { @@ -1348,7 +1421,6 @@ "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "DELETE", "path": "/api/v2/clients/xLgpNb56pwyBvNmyd67xtoMb4G2xxy9W", - "body": {}, "status": 204, "response": "", "rawHeaders": [], @@ -2061,7 +2133,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "PATCH", - "path": "/api/v2/emails/provider?enabled=false&name=mandrill", + "path": "/api/v2/emails/provider", "body": { "name": "mandrill", "credentials": { @@ -2324,7 +2396,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/log-streams?paginate=false", + "path": "/api/v2/log-streams", "body": "", "status": 200, "response": [ @@ -2546,7 +2618,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true", "body": "", "status": 200, "response": { @@ -2995,7 +3067,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?strategy=auth0&include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?strategy=auth0&include_totals=true", "body": "", "status": 200, "response": { @@ -3080,7 +3152,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?strategy=auth0&include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?strategy=auth0&include_totals=true", "body": "", "status": 200, "response": { @@ -3166,7 +3238,6 @@ "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "DELETE", "path": "/api/v2/connections/con_FJVIi5jt9aQXvioG", - "body": {}, "status": 202, "response": { "deleted_at": "2023-08-03T13:40:23.710Z" @@ -3335,7 +3406,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true", "body": "", "status": 200, "response": { @@ -3784,7 +3855,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?include_totals=true", "body": "", "status": 200, "response": { @@ -3869,7 +3940,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?include_totals=true", "body": "", "status": 200, "response": { @@ -4052,7 +4123,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true", "body": "", "status": 200, "response": { @@ -4501,7 +4572,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/client-grants?include_totals=true&page=0&per_page=100", + "path": "/api/v2/client-grants?include_totals=true", "body": "", "status": 200, "response": { @@ -5492,7 +5563,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/roles?include_totals=true&page=0&per_page=100", + "path": "/api/v2/roles?include_totals=true", "body": "", "status": 200, "response": { @@ -5528,7 +5599,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/roles/rol_xTLwZuLtKXu0jnMc/permissions?include_totals=true&page=0&per_page=100", + "path": "/api/v2/roles/rol_xTLwZuLtKXu0jnMc/permissions?include_totals=true", "body": "", "status": 200, "response": { @@ -5543,7 +5614,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/roles/rol_ESfW6pVGwB3qwt5U/permissions?include_totals=true&page=0&per_page=100", + "path": "/api/v2/roles/rol_ESfW6pVGwB3qwt5U/permissions?include_totals=true", "body": "", "status": 200, "response": { @@ -5558,7 +5629,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/roles/rol_LVvLNdUbB9j5bxW9/permissions?include_totals=true&page=0&per_page=100", + "path": "/api/v2/roles/rol_LVvLNdUbB9j5bxW9/permissions?include_totals=true", "body": "", "status": 200, "response": { @@ -5573,7 +5644,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/roles/rol_JT0zo8zMuhZlvvnP/permissions?include_totals=true&page=0&per_page=100", + "path": "/api/v2/roles/rol_JT0zo8zMuhZlvvnP/permissions?include_totals=true", "body": "", "status": 200, "response": { @@ -5656,7 +5727,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/actions/actions?page=0&per_page=100", + "path": "/api/v2/actions/actions", "body": "", "status": 200, "response": { @@ -5786,7 +5857,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/actions/actions?page=0&per_page=100", + "path": "/api/v2/actions/actions", "body": "", "status": 200, "response": { @@ -5849,7 +5920,6 @@ "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "POST", "path": "/api/v2/actions/actions/5cb59b2c-b643-414a-b1f6-af7607f1fa08/deploy", - "body": {}, "status": 200, "response": { "code": "/**\n * Handler that will be called during the execution of a PostLogin flow.\n *\n * @param {Event} event - Details about the user and the context in which they are logging in.\n * @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.\n */\nexports.onExecutePostLogin = async (event, api) => {\n console.log('Some custom action!');\n};\n\n/**\n * Handler that will be invoked when this action is resuming after an external redirect. If your\n * onExecutePostLogin function does not perform a redirect, this function can be safely ignored.\n *\n * @param {Event} event - Details about the user and the context in which they are logging in.\n * @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.\n */\n// exports.onContinuePostLogin = async (event, api) => {\n// };\n", @@ -5969,7 +6039,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?include_totals=true", "body": "", "status": 200, "response": { @@ -6199,7 +6269,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/rules?include_totals=true&page=0&per_page=100", + "path": "/api/v2/rules?include_totals=true", "body": "", "status": 200, "response": { @@ -6223,7 +6293,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/rules?include_totals=true&page=0&per_page=100", + "path": "/api/v2/rules?include_totals=true", "body": "", "status": 200, "response": { @@ -6248,7 +6318,6 @@ "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "DELETE", "path": "/api/v2/rules/rul_nJxB8AKfZ0pr4grS", - "body": {}, "status": 204, "response": "", "rawHeaders": [], @@ -6257,7 +6326,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/hooks?include_totals=true&page=0&per_page=100", + "path": "/api/v2/hooks?include_totals=true", "body": "", "status": 200, "response": { @@ -6272,7 +6341,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/hooks?include_totals=true&page=0&per_page=100", + "path": "/api/v2/hooks?include_totals=true", "body": "", "status": 200, "response": { @@ -6287,7 +6356,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/resource-servers?include_totals=true&page=0&per_page=100", + "path": "/api/v2/resource-servers?include_totals=true", "body": "", "status": 200, "response": { @@ -6876,7 +6945,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&is_global=false&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true&is_global=false", "body": "", "status": 200, "response": { @@ -7295,7 +7364,15 @@ "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "DELETE", "path": "/api/v2/clients/uKnnc1YsLCvq2Wsegx1NRcchvFWYnQec", - "body": {}, + "status": 204, + "response": "", + "rawHeaders": [], + "responseIsBinary": false + }, + { + "scope": "https://deploy-cli-dev.eu.auth0.com:443", + "method": "DELETE", + "path": "/api/v2/clients/GIW99EUCF9DFExh77WPMyTMzT8NN4J3A", "status": 204, "response": "", "rawHeaders": [], @@ -7305,7 +7382,6 @@ "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "DELETE", "path": "/api/v2/clients/NxYlj8noJQggPTwWiOwUgPmA3LEIiyaA", - "body": {}, "status": 204, "response": "", "rawHeaders": [], @@ -7315,7 +7391,6 @@ "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "DELETE", "path": "/api/v2/clients/0QC0GcWTpHmnWDrqsDjwfG5hBxq0bGHX", - "body": {}, "status": 204, "response": "", "rawHeaders": [], @@ -7325,7 +7400,6 @@ "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "DELETE", "path": "/api/v2/clients/XGPT8mgzUSbs9GrgnFm8D3QKjp7CZT1n", - "body": {}, "status": 204, "response": "", "rawHeaders": [], @@ -7335,7 +7409,6 @@ "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "DELETE", "path": "/api/v2/clients/3mwBwDe6Y1AwyzC1g7qSto8vmDFKxVC1", - "body": {}, "status": 204, "response": "", "rawHeaders": [], @@ -7345,7 +7418,6 @@ "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "DELETE", "path": "/api/v2/clients/W9DtiKy4raUFQUlYiXLf4eXuzWwneBcp", - "body": {}, "status": 204, "response": "", "rawHeaders": [], @@ -7355,7 +7427,6 @@ "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "DELETE", "path": "/api/v2/clients/kxctQEaRpTc8pb8rq3DL2Eur02OKfaL9", - "body": {}, "status": 204, "response": "", "rawHeaders": [], @@ -7593,7 +7664,21 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "PUT", - "path": "/api/v2/guardian/factors/sms/selected-provider", + "path": "/api/v2/guardian/factors/phone/selected-provider", + "body": { + "provider": "auth0" + }, + "status": 200, + "response": { + "provider": "auth0" + }, + "rawHeaders": [], + "responseIsBinary": false + }, + { + "scope": "https://deploy-cli-dev.eu.auth0.com:443", + "method": "PUT", + "path": "/api/v2/guardian/factors/phone/selected-provider", "body": { "provider": "auth0" }, @@ -7636,7 +7721,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/log-streams?paginate=false", + "path": "/api/v2/log-streams", "body": "", "status": 200, "response": [ @@ -7804,7 +7889,6 @@ "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "DELETE", "path": "/api/v2/log-streams/lst_0000000000011988", - "body": {}, "status": 204, "response": "", "rawHeaders": [], @@ -7814,7 +7898,6 @@ "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "DELETE", "path": "/api/v2/log-streams/lst_0000000000011989", - "body": {}, "status": 204, "response": "", "rawHeaders": [], @@ -7823,7 +7906,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true", "body": "", "status": 200, "response": { @@ -7952,7 +8035,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?strategy=auth0&include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?strategy=auth0&include_totals=true", "body": "", "status": 200, "response": { @@ -8013,7 +8096,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?strategy=auth0&include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?strategy=auth0&include_totals=true", "body": "", "status": 200, "response": { @@ -8075,7 +8158,6 @@ "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "DELETE", "path": "/api/v2/connections/con_WTCElYGe42A3U2wC", - "body": {}, "status": 202, "response": { "deleted_at": "2023-08-03T13:40:38.418Z" @@ -8137,7 +8219,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true", "body": "", "status": 200, "response": { @@ -8266,7 +8348,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?include_totals=true", "body": "", "status": 200, "response": { @@ -8322,7 +8404,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?include_totals=true", "body": "", "status": 200, "response": { @@ -8379,7 +8461,6 @@ "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "DELETE", "path": "/api/v2/connections/con_CYO8cRRtMfH8H2TN", - "body": {}, "status": 202, "response": { "deleted_at": "2023-08-03T13:40:39.353Z" @@ -8390,7 +8471,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true", "body": "", "status": 200, "response": { @@ -8519,7 +8600,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/client-grants?include_totals=true&page=0&per_page=100", + "path": "/api/v2/client-grants?include_totals=true", "body": "", "status": 200, "response": { @@ -8678,7 +8759,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/roles?include_totals=true&page=0&per_page=100", + "path": "/api/v2/roles?include_totals=true", "body": "", "status": 200, "response": { @@ -8714,7 +8795,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/roles/rol_xTLwZuLtKXu0jnMc/permissions?include_totals=true&page=0&per_page=100", + "path": "/api/v2/roles/rol_xTLwZuLtKXu0jnMc/permissions?include_totals=true", "body": "", "status": 200, "response": { @@ -8729,7 +8810,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/roles/rol_ESfW6pVGwB3qwt5U/permissions?include_totals=true&page=0&per_page=100", + "path": "/api/v2/roles/rol_ESfW6pVGwB3qwt5U/permissions?include_totals=true", "body": "", "status": 200, "response": { @@ -8744,7 +8825,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/roles/rol_LVvLNdUbB9j5bxW9/permissions?include_totals=true&page=0&per_page=100", + "path": "/api/v2/roles/rol_LVvLNdUbB9j5bxW9/permissions?include_totals=true", "body": "", "status": 200, "response": { @@ -8759,7 +8840,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/roles/rol_JT0zo8zMuhZlvvnP/permissions?include_totals=true&page=0&per_page=100", + "path": "/api/v2/roles/rol_JT0zo8zMuhZlvvnP/permissions?include_totals=true", "body": "", "status": 200, "response": { @@ -8775,7 +8856,24 @@ "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "DELETE", "path": "/api/v2/roles/rol_xTLwZuLtKXu0jnMc", - "body": {}, + "status": 200, + "response": {}, + "rawHeaders": [], + "responseIsBinary": false + }, + { + "scope": "https://deploy-cli-dev.eu.auth0.com:443", + "method": "DELETE", + "path": "/api/v2/client-grants/cgr_iodSzvwxqm51tLZF", + "status": 200, + "response": {}, + "rawHeaders": [], + "responseIsBinary": false + }, + { + "scope": "https://deploy-cli-dev.eu.auth0.com:443", + "method": "DELETE", + "path": "/api/v2/client-grants/cgr_iodSzvwxqm51tLZF", "status": 200, "response": {}, "rawHeaders": [], @@ -8785,7 +8883,6 @@ "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "DELETE", "path": "/api/v2/roles/rol_ESfW6pVGwB3qwt5U", - "body": {}, "status": 200, "response": {}, "rawHeaders": [], @@ -8795,7 +8892,6 @@ "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "DELETE", "path": "/api/v2/roles/rol_LVvLNdUbB9j5bxW9", - "body": {}, "status": 200, "response": {}, "rawHeaders": [], @@ -8805,7 +8901,6 @@ "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "DELETE", "path": "/api/v2/roles/rol_JT0zo8zMuhZlvvnP", - "body": {}, "status": 200, "response": {}, "rawHeaders": [], @@ -8814,7 +8909,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/actions/actions?page=0&per_page=100", + "path": "/api/v2/actions/actions", "body": "", "status": 200, "response": { @@ -8877,7 +8972,6 @@ "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "DELETE", "path": "/api/v2/actions/actions/5cb59b2c-b643-414a-b1f6-af7607f1fa08?force=true", - "body": {}, "status": 204, "response": "", "rawHeaders": [], @@ -8886,7 +8980,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/actions/actions?page=0&per_page=100", + "path": "/api/v2/actions/actions", "body": "", "status": 200, "response": { @@ -8980,7 +9074,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?include_totals=true", "body": "", "status": 200, "response": { @@ -9019,7 +9113,6 @@ "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "DELETE", "path": "/api/v2/organizations/org_Ni2g2n47tR56fXR8", - "body": {}, "status": 204, "response": "", "rawHeaders": [], @@ -9029,7 +9122,6 @@ "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "DELETE", "path": "/api/v2/organizations/org_z4Jobv6iLGqQROXe", - "body": {}, "status": 204, "response": "", "rawHeaders": [], @@ -9114,7 +9206,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/rules?include_totals=true&page=0&per_page=100", + "path": "/api/v2/rules?include_totals=true", "body": "", "status": 200, "response": { @@ -9139,7 +9231,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/hooks?include_totals=true&page=0&per_page=100", + "path": "/api/v2/hooks?include_totals=true", "body": "", "status": 200, "response": { @@ -9154,7 +9246,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?is_global=true&include_totals=true&page=0&per_page=100", + "path": "/api/v2/clients?is_global=true&include_totals=true", "body": "", "status": 200, "response": { @@ -9272,7 +9364,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/resource-servers?include_totals=true&page=0&per_page=100", + "path": "/api/v2/resource-servers?include_totals=true", "body": "", "status": 200, "response": { @@ -9861,7 +9953,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&is_global=false&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true&is_global=false", "body": "", "status": 200, "response": { @@ -9959,7 +10051,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?strategy=auth0&include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?strategy=auth0&include_totals=true", "body": "", "status": 200, "response": { @@ -9997,7 +10089,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?include_totals=true", "body": "", "status": 200, "response": { @@ -10293,7 +10385,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/client-grants?include_totals=true&page=0&per_page=100", + "path": "/api/v2/client-grants?include_totals=true", "body": "", "status": 200, "response": { @@ -10551,7 +10643,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/guardian/factors/sms/selected-provider", + "path": "/api/v2/guardian/factors/phone/selected-provider", "body": "", "status": 200, "response": { @@ -10575,7 +10667,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/roles?include_totals=true&page=0&per_page=100", + "path": "/api/v2/roles?include_totals=true", "body": "", "status": 200, "response": { @@ -10964,7 +11056,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/actions/actions?page=0&per_page=100", + "path": "/api/v2/actions/actions", "body": "", "status": 200, "response": { @@ -11332,7 +11424,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/log-streams?paginate=false", + "path": "/api/v2/log-streams", "body": "", "status": 200, "response": [], @@ -11342,7 +11434,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/custom-domains?paginate=false", + "path": "/api/v2/custom-domains", "body": "", "status": 200, "response": [], @@ -11364,4 +11456,4 @@ "rawHeaders": [], "responseIsBinary": false } -] \ No newline at end of file +] diff --git a/test/e2e/recordings/should-deploy-without-deleting-resources-if-AUTH0_ALLOW_DELETE-is-false.json b/test/e2e/recordings/should-deploy-without-deleting-resources-if-AUTH0_ALLOW_DELETE-is-false.json index 4527ed49..189cf42b 100644 --- a/test/e2e/recordings/should-deploy-without-deleting-resources-if-AUTH0_ALLOW_DELETE-is-false.json +++ b/test/e2e/recordings/should-deploy-without-deleting-resources-if-AUTH0_ALLOW_DELETE-is-false.json @@ -2,7 +2,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/rules?include_totals=true&page=0&per_page=100", + "path": "/api/v2/rules?include_totals=true", "body": "", "status": 200, "response": { @@ -17,7 +17,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/rules?include_totals=true&page=0&per_page=100", + "path": "/api/v2/rules?include_totals=true", "body": "", "status": 200, "response": { @@ -55,7 +55,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/hooks?include_totals=true&page=0&per_page=100", + "path": "/api/v2/hooks?include_totals=true", "body": "", "status": 200, "response": { @@ -70,7 +70,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/hooks?include_totals=true&page=0&per_page=100", + "path": "/api/v2/hooks?include_totals=true", "body": "", "status": 200, "response": { @@ -85,7 +85,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?is_global=true&include_totals=true&page=0&per_page=100", + "path": "/api/v2/clients?is_global=true&include_totals=true", "body": "", "status": 200, "response": { @@ -257,7 +257,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/resource-servers?include_totals=true&page=0&per_page=100", + "path": "/api/v2/resource-servers?include_totals=true", "body": "", "status": 200, "response": { @@ -846,7 +846,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&is_global=false&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true&is_global=false", "body": "", "status": 200, "response": { @@ -1693,7 +1693,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "POST", - "path": "/api/v2/emails/provider?enabled=false&name=mandrill", + "path": "/api/v2/emails/provider", "body": { "name": "mandrill", "credentials": { @@ -1841,7 +1841,21 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "PUT", - "path": "/api/v2/guardian/factors/sms/selected-provider", + "path": "/api/v2/guardian/factors/phone/selected-provider", + "body": { + "provider": "auth0" + }, + "status": 200, + "response": { + "provider": "auth0" + }, + "rawHeaders": [], + "responseIsBinary": false + }, + { + "scope": "https://deploy-cli-dev.eu.auth0.com:443", + "method": "PUT", + "path": "/api/v2/guardian/factors/phone/selected-provider", "body": { "provider": "auth0" }, @@ -1984,7 +1998,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/log-streams?paginate=false", + "path": "/api/v2/log-streams", "body": "", "status": 200, "response": [], @@ -2123,7 +2137,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true", "body": "", "status": 200, "response": { @@ -2638,7 +2652,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?strategy=auth0&include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?strategy=auth0&include_totals=true", "body": "", "status": 200, "response": { @@ -2676,7 +2690,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?strategy=auth0&include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?strategy=auth0&include_totals=true", "body": "", "status": 200, "response": { @@ -2817,7 +2831,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true", "body": "", "status": 200, "response": { @@ -3332,7 +3346,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?include_totals=true", "body": "", "status": 200, "response": { @@ -3439,7 +3453,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?include_totals=true", "body": "", "status": 200, "response": { @@ -3644,7 +3658,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true", "body": "", "status": 200, "response": { @@ -4159,7 +4173,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/client-grants?include_totals=true&page=0&per_page=100", + "path": "/api/v2/client-grants?include_totals=true", "body": "", "status": 200, "response": { @@ -4880,7 +4894,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/roles?include_totals=true&page=0&per_page=100", + "path": "/api/v2/roles?include_totals=true", "body": "", "status": 200, "response": { @@ -4963,7 +4977,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/actions/actions?page=0&per_page=100", + "path": "/api/v2/actions/actions", "body": "", "status": 200, "response": { @@ -5015,7 +5029,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/actions/actions?page=0&per_page=100", + "path": "/api/v2/actions/actions", "body": "", "status": 200, "response": { @@ -5049,7 +5063,6 @@ "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "POST", "path": "/api/v2/actions/actions/5cb59b2c-b643-414a-b1f6-af7607f1fa08/deploy", - "body": {}, "status": 200, "response": { "code": "/**\n * Handler that will be called during the execution of a PostLogin flow.\n *\n * @param {Event} event - Details about the user and the context in which they are logging in.\n * @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.\n */\nexports.onExecutePostLogin = async (event, api) => {\n console.log('Some custom action!');\n};\n\n/**\n * Handler that will be invoked when this action is resuming after an external redirect. If your\n * onExecutePostLogin function does not perform a redirect, this function can be safely ignored.\n *\n * @param {Event} event - Details about the user and the context in which they are logging in.\n * @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.\n */\n// exports.onContinuePostLogin = async (event, api) => {\n// };\n", @@ -5115,7 +5128,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?include_totals=true", "body": "", "status": 200, "response": { @@ -5369,7 +5382,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/rules?include_totals=true&page=0&per_page=100", + "path": "/api/v2/rules?include_totals=true", "body": "", "status": 200, "response": { @@ -5393,7 +5406,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/rules?include_totals=true&page=0&per_page=100", + "path": "/api/v2/rules?include_totals=true", "body": "", "status": 200, "response": { @@ -5417,7 +5430,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/hooks?include_totals=true&page=0&per_page=100", + "path": "/api/v2/hooks?include_totals=true", "body": "", "status": 200, "response": { @@ -5432,7 +5445,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/hooks?include_totals=true&page=0&per_page=100", + "path": "/api/v2/hooks?include_totals=true", "body": "", "status": 200, "response": { @@ -5447,7 +5460,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/resource-servers?include_totals=true&page=0&per_page=100", + "path": "/api/v2/resource-servers?include_totals=true", "body": "", "status": 200, "response": { @@ -6036,7 +6049,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&is_global=false&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true&is_global=false", "body": "", "status": 200, "response": { @@ -6900,7 +6913,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/log-streams?paginate=false", + "path": "/api/v2/log-streams", "body": "", "status": 200, "response": [ @@ -6970,7 +6983,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true", "body": "", "status": 200, "response": { @@ -7485,7 +7498,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?strategy=auth0&include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?strategy=auth0&include_totals=true", "body": "", "status": 200, "response": { @@ -7571,7 +7584,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?strategy=auth0&include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?strategy=auth0&include_totals=true", "body": "", "status": 200, "response": { @@ -7737,7 +7750,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true", "body": "", "status": 200, "response": { @@ -8252,7 +8265,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?include_totals=true", "body": "", "status": 200, "response": { @@ -8359,7 +8372,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?include_totals=true", "body": "", "status": 200, "response": { @@ -8466,7 +8479,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true", "body": "", "status": 200, "response": { @@ -8981,7 +8994,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/client-grants?include_totals=true&page=0&per_page=100", + "path": "/api/v2/client-grants?include_totals=true", "body": "", "status": 200, "response": { @@ -9414,7 +9427,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/roles?include_totals=true&page=0&per_page=100", + "path": "/api/v2/roles?include_totals=true", "body": "", "status": 200, "response": { @@ -9450,7 +9463,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/roles/rol_xTLwZuLtKXu0jnMc/permissions?include_totals=true&page=0&per_page=100", + "path": "/api/v2/roles/rol_xTLwZuLtKXu0jnMc/permissions?include_totals=true", "body": "", "status": 200, "response": { @@ -9465,7 +9478,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/roles/rol_ESfW6pVGwB3qwt5U/permissions?include_totals=true&page=0&per_page=100", + "path": "/api/v2/roles/rol_ESfW6pVGwB3qwt5U/permissions?include_totals=true", "body": "", "status": 200, "response": { @@ -9480,7 +9493,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/roles/rol_LVvLNdUbB9j5bxW9/permissions?include_totals=true&page=0&per_page=100", + "path": "/api/v2/roles/rol_LVvLNdUbB9j5bxW9/permissions?include_totals=true", "body": "", "status": 200, "response": { @@ -9495,7 +9508,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/roles/rol_JT0zo8zMuhZlvvnP/permissions?include_totals=true&page=0&per_page=100", + "path": "/api/v2/roles/rol_JT0zo8zMuhZlvvnP/permissions?include_totals=true", "body": "", "status": 200, "response": { @@ -9510,7 +9523,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/actions/actions?page=0&per_page=100", + "path": "/api/v2/actions/actions", "body": "", "status": 200, "response": { @@ -9572,7 +9585,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/actions/actions?page=0&per_page=100", + "path": "/api/v2/actions/actions", "body": "", "status": 200, "response": { @@ -9715,7 +9728,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?include_totals=true", "body": "", "status": 200, "response": { @@ -9898,7 +9911,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/rules?include_totals=true&page=0&per_page=100", + "path": "/api/v2/rules?include_totals=true", "body": "", "status": 200, "response": { @@ -9932,7 +9945,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/hooks?include_totals=true&page=0&per_page=100", + "path": "/api/v2/hooks?include_totals=true", "body": "", "status": 200, "response": { @@ -9947,7 +9960,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?is_global=true&include_totals=true&page=0&per_page=100", + "path": "/api/v2/clients?is_global=true&include_totals=true", "body": "", "status": 200, "response": { @@ -10065,7 +10078,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/resource-servers?include_totals=true&page=0&per_page=100", + "path": "/api/v2/resource-servers?include_totals=true", "body": "", "status": 200, "response": { @@ -10654,7 +10667,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&is_global=false&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true&is_global=false", "body": "", "status": 200, "response": { @@ -11138,7 +11151,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?strategy=auth0&include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?strategy=auth0&include_totals=true", "body": "", "status": 200, "response": { @@ -11224,7 +11237,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?include_totals=true", "body": "", "status": 200, "response": { @@ -11589,7 +11602,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/client-grants?include_totals=true&page=0&per_page=100", + "path": "/api/v2/client-grants?include_totals=true", "body": "", "status": 200, "response": { @@ -12121,7 +12134,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/guardian/factors/sms/selected-provider", + "path": "/api/v2/guardian/factors/phone/selected-provider", "body": "", "status": 200, "response": { @@ -12145,7 +12158,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/roles?include_totals=true&page=0&per_page=100", + "path": "/api/v2/roles?include_totals=true", "body": "", "status": 200, "response": { @@ -12181,7 +12194,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/roles/rol_xTLwZuLtKXu0jnMc/permissions?include_totals=true&page=0&per_page=100", + "path": "/api/v2/roles/rol_xTLwZuLtKXu0jnMc/permissions?include_totals=true", "body": "", "status": 200, "response": { @@ -12196,7 +12209,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/roles/rol_ESfW6pVGwB3qwt5U/permissions?include_totals=true&page=0&per_page=100", + "path": "/api/v2/roles/rol_ESfW6pVGwB3qwt5U/permissions?include_totals=true", "body": "", "status": 200, "response": { @@ -12211,7 +12224,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/roles/rol_LVvLNdUbB9j5bxW9/permissions?include_totals=true&page=0&per_page=100", + "path": "/api/v2/roles/rol_LVvLNdUbB9j5bxW9/permissions?include_totals=true", "body": "", "status": 200, "response": { @@ -12226,7 +12239,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/roles/rol_JT0zo8zMuhZlvvnP/permissions?include_totals=true&page=0&per_page=100", + "path": "/api/v2/roles/rol_JT0zo8zMuhZlvvnP/permissions?include_totals=true", "body": "", "status": 200, "response": { @@ -12615,7 +12628,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/actions/actions?page=0&per_page=100", + "path": "/api/v2/actions/actions", "body": "", "status": 200, "response": { @@ -13086,7 +13099,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/log-streams?paginate=false", + "path": "/api/v2/log-streams", "body": "", "status": 200, "response": [ @@ -13156,7 +13169,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/custom-domains?paginate=false", + "path": "/api/v2/custom-domains", "body": "", "status": 200, "response": [], @@ -13177,5 +13190,78 @@ }, "rawHeaders": [], "responseIsBinary": false - } -] \ No newline at end of file + }, + { + "scope": "https://deploy-cli-dev.eu.auth0.com:443", + "method": "PATCH", + "path": "/api/v2/clients/GIW99EUCF9DFExh77WPMyTMzT8NN4J3A", + "body": { + "name": "Deploy CLI", + "app_type": "non_interactive", + "cross_origin_auth": false, + "custom_login_page_on": true, + "grant_types": ["client_credentials"], + "is_first_party": true, + "is_token_endpoint_ip_header_trusted": false, + "jwt_configuration": { + "alg": "RS256", + "lifetime_in_seconds": 36000 + }, + "oidc_conformant": true, + "refresh_token": { + "expiration_type": "non-expiring", + "leeway": 0, + "infinite_token_lifetime": true, + "infinite_idle_token_lifetime": true, + "token_lifetime": 31557600, + "idle_token_lifetime": 2592000, + "rotation_type": "non-rotating" + }, + "sso_disabled": false, + "token_endpoint_auth_method": "client_secret_post" + }, + "status": 200, + "response": { + "tenant": "auth0-deploy-cli-e2e", + "global": false, + "is_token_endpoint_ip_header_trusted": false, + "name": "Deploy CLI", + "is_first_party": true, + "oidc_conformant": true, + "sso_disabled": false, + "cross_origin_auth": false, + "refresh_token": { + "expiration_type": "non-expiring", + "leeway": 0, + "infinite_token_lifetime": true, + "infinite_idle_token_lifetime": true, + "token_lifetime": 31557600, + "idle_token_lifetime": 2592000, + "rotation_type": "non-rotating" + }, + "signing_keys": [ + { + "cert": "[REDACTED]", + "pkcs7": "[REDACTED]", + "subject": "deprecated" + } + ], + "client_id": "GIW99EUCF9DFExh77WPMyTMzT8NN4J3A", + "callback_url_template": false, + "client_secret": "[REDACTED]", + "jwt_configuration": { + "alg": "RS256", + "lifetime_in_seconds": 36000, + "secret_encoded": false + }, + "token_endpoint_auth_method": "client_secret_post", + "app_type": "non_interactive", + "grant_types": [ + "client_credentials" + ], + "custom_login_page_on": true + }, + "rawHeaders": [], + "responseIsBinary": false + } +] diff --git a/test/e2e/recordings/should-deploy-without-throwing-an-error.json b/test/e2e/recordings/should-deploy-without-throwing-an-error.json index 98f28c22..6e1a4dc9 100644 --- a/test/e2e/recordings/should-deploy-without-throwing-an-error.json +++ b/test/e2e/recordings/should-deploy-without-throwing-an-error.json @@ -2,7 +2,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/rules?include_totals=true&page=0&per_page=100", + "path": "/api/v2/rules?include_totals=true", "body": "", "status": 200, "response": { @@ -17,7 +17,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/rules?include_totals=true&page=0&per_page=100", + "path": "/api/v2/rules?include_totals=true", "body": "", "status": 200, "response": { @@ -32,7 +32,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/hooks?include_totals=true&page=0&per_page=100", + "path": "/api/v2/hooks?include_totals=true", "body": "", "status": 200, "response": { @@ -47,7 +47,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/hooks?include_totals=true&page=0&per_page=100", + "path": "/api/v2/hooks?include_totals=true", "body": "", "status": 200, "response": { @@ -62,7 +62,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/resource-servers?include_totals=true&page=0&per_page=100", + "path": "/api/v2/resource-servers?include_totals=true", "body": "", "status": 200, "response": { @@ -651,7 +651,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&is_global=false&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true&is_global=false", "body": "", "status": 200, "response": { @@ -873,6 +873,40 @@ "rawHeaders": [], "responseIsBinary": false }, + { + "scope": "https://deploy-cli-dev.eu.auth0.com:443", + "method": "PATCH", + "path": "/api/v2/clients/GIW99EUCF9DFExh77WPMyTMzT8NN4J3A", + "body": { + "name": "Deploy CLI", + "app_type": "non_interactive", + "cross_origin_auth": false, + "custom_login_page_on": true, + "grant_types": ["client_credentials"], + "is_first_party": true, + "is_token_endpoint_ip_header_trusted": false, + "jwt_configuration": { + "alg": "RS256", + "lifetime_in_seconds": 36000 + }, + "oidc_conformant": true, + "refresh_token": { + "expiration_type": "non-expiring", + "leeway": 0, + "infinite_token_lifetime": true, + "infinite_idle_token_lifetime": true, + "token_lifetime": 31557600, + "idle_token_lifetime": 2592000, + "rotation_type": "non-rotating" + }, + "sso_disabled": false, + "token_endpoint_auth_method": "client_secret_post" + }, + "status": 200, + "response": {}, + "rawHeaders": [], + "responseIsBinary": false + }, { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", @@ -1013,7 +1047,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "PUT", - "path": "/api/v2/guardian/factors/sms/selected-provider", + "path": "/api/v2/guardian/factors/phone/selected-provider", "body": { "provider": "auth0" }, @@ -1153,7 +1187,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/log-streams?paginate=false", + "path": "/api/v2/log-streams", "body": "", "status": 200, "response": [], @@ -1163,7 +1197,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/custom-domains?paginate=false", + "path": "/api/v2/custom-domains", "body": "", "status": 200, "response": [], @@ -1173,7 +1207,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true", "body": "", "status": 200, "response": { @@ -1326,7 +1360,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?strategy=auth0&include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?strategy=auth0&include_totals=true", "body": "", "status": 200, "response": { @@ -1364,7 +1398,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?strategy=auth0&include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?strategy=auth0&include_totals=true", "body": "", "status": 200, "response": { @@ -1482,7 +1516,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true", "body": "", "status": 200, "response": { @@ -1635,7 +1669,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?include_totals=true", "body": "", "status": 200, "response": { @@ -1673,7 +1707,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?include_totals=true", "body": "", "status": 200, "response": { @@ -1757,7 +1791,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true", "body": "", "status": 200, "response": { @@ -1910,7 +1944,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/client-grants?include_totals=true&page=0&per_page=100", + "path": "/api/v2/client-grants?include_totals=true", "body": "", "status": 200, "response": { @@ -2069,7 +2103,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/roles?include_totals=true&page=0&per_page=100", + "path": "/api/v2/roles?include_totals=true", "body": "", "status": 200, "response": { @@ -2084,7 +2118,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/actions/actions?page=0&per_page=100", + "path": "/api/v2/actions/actions", "body": "", "status": 200, "response": { @@ -2097,7 +2131,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/actions/actions?page=0&per_page=100", + "path": "/api/v2/actions/actions", "body": "", "status": 200, "response": { @@ -2137,7 +2171,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?include_totals=true", "body": "", "status": 200, "response": { @@ -2271,4 +2305,4 @@ "rawHeaders": [], "responseIsBinary": false } -] \ No newline at end of file +] diff --git a/test/e2e/recordings/should-dump-and-deploy-without-throwing-an-error.json b/test/e2e/recordings/should-dump-and-deploy-without-throwing-an-error.json index fb4b3f06..ace23ade 100644 --- a/test/e2e/recordings/should-dump-and-deploy-without-throwing-an-error.json +++ b/test/e2e/recordings/should-dump-and-deploy-without-throwing-an-error.json @@ -2,7 +2,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/rules?include_totals=true&page=0&per_page=100", + "path": "/api/v2/rules?include_totals=true", "body": "", "status": 200, "response": { @@ -27,7 +27,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/hooks?include_totals=true&page=0&per_page=100", + "path": "/api/v2/hooks?include_totals=true", "body": "", "status": 200, "response": { @@ -42,7 +42,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?is_global=true&include_totals=true&page=0&per_page=100", + "path": "/api/v2/clients?is_global=true&include_totals=true", "body": "", "status": 200, "response": { @@ -159,7 +159,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/resource-servers?include_totals=true&page=0&per_page=100", + "path": "/api/v2/resource-servers?include_totals=true", "body": "", "status": 200, "response": { @@ -748,7 +748,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&is_global=false&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true&is_global=false", "body": "", "status": 200, "response": { @@ -846,7 +846,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?strategy=auth0&include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?strategy=auth0&include_totals=true", "body": "", "status": 200, "response": { @@ -884,7 +884,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?include_totals=true", "body": "", "status": 200, "response": { @@ -1179,7 +1179,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/client-grants?include_totals=true&page=0&per_page=100", + "path": "/api/v2/client-grants?include_totals=true", "body": "", "status": 200, "response": { @@ -1437,7 +1437,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/guardian/factors/sms/selected-provider", + "path": "/api/v2/guardian/factors/phone/selected-provider", "body": "", "status": 200, "response": { @@ -1461,7 +1461,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/roles?include_totals=true&page=0&per_page=100", + "path": "/api/v2/roles?include_totals=true", "body": "", "status": 200, "response": { @@ -1849,7 +1849,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/actions/actions?page=0&per_page=100", + "path": "/api/v2/actions/actions", "body": "", "status": 200, "response": { @@ -2187,7 +2187,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/log-streams?paginate=false", + "path": "/api/v2/log-streams", "body": "", "status": 200, "response": [], @@ -2197,7 +2197,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/custom-domains?paginate=false", + "path": "/api/v2/custom-domains", "body": "", "status": 200, "response": [], @@ -2222,7 +2222,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/rules?include_totals=true&page=0&per_page=100", + "path": "/api/v2/rules?include_totals=true", "body": "", "status": 200, "response": { @@ -2237,7 +2237,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/rules?include_totals=true&page=0&per_page=100", + "path": "/api/v2/rules?include_totals=true", "body": "", "status": 200, "response": { @@ -2252,7 +2252,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/hooks?include_totals=true&page=0&per_page=100", + "path": "/api/v2/hooks?include_totals=true", "body": "", "status": 200, "response": { @@ -2267,7 +2267,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/hooks?include_totals=true&page=0&per_page=100", + "path": "/api/v2/hooks?include_totals=true", "body": "", "status": 200, "response": { @@ -2282,7 +2282,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?is_global=true&include_totals=true&page=0&per_page=100", + "path": "/api/v2/clients?is_global=true&include_totals=true", "body": "", "status": 200, "response": { @@ -2369,6 +2369,91 @@ "rawHeaders": [], "responseIsBinary": false }, + { + "scope": "https://deploy-cli-dev.eu.auth0.com:443", + "method": "PATCH", + "path": "/api/v2/client-grants/cgr_iodSzvwxqm51tLZF", + "status": 200, + "body": { + "scope": ["read:client_grants", "create:client_grants", "delete:client_grants", "update:client_grants", "read:users", "update:users", "delete:users", "create:users", "read:users_app_metadata", "update:users_app_metadata", "delete:users_app_metadata", "create:users_app_metadata", "read:user_custom_blocks", "create:user_custom_blocks", "delete:user_custom_blocks", "create:user_tickets", "read:clients", "update:clients", "delete:clients", "create:clients", "read:client_keys", "update:client_keys", "delete:client_keys", "create:client_keys", "read:connections", "update:connections", "delete:connections", "create:connections", "read:resource_servers", "update:resource_servers", "delete:resource_servers", "create:resource_servers", "read:device_credentials", "update:device_credentials", "delete:device_credentials", "create:device_credentials", "read:rules", "update:rules", "delete:rules", "create:rules", "read:rules_configs", "update:rules_configs", "delete:rules_configs", "read:hooks", "update:hooks", "delete:hooks", "create:hooks", "read:actions", "update:actions", "delete:actions", "create:actions", "read:email_provider", "update:email_provider", "delete:email_provider", "create:email_provider", "blacklist:tokens", "read:stats", "read:insights", "read:tenant_settings", "update:tenant_settings", "read:logs", "read:logs_users", "read:shields", "create:shields", "update:shields", "delete:shields", "read:anomaly_blocks", "delete:anomaly_blocks", "update:triggers", "read:triggers", "read:grants", "delete:grants", "read:guardian_factors", "update:guardian_factors", "read:guardian_enrollments", "delete:guardian_enrollments", "create:guardian_enrollment_tickets", "read:user_idp_tokens", "create:passwords_checking_job", "delete:passwords_checking_job", "read:custom_domains", "delete:custom_domains", "create:custom_domains", "update:custom_domains", "read:email_templates", "create:email_templates", "update:email_templates", "read:mfa_policies", "update:mfa_policies", "read:roles", "create:roles", "delete:roles", "update:roles", "read:prompts", "update:prompts", "read:branding", "update:branding", "delete:branding", "read:log_streams", "create:log_streams", "delete:log_streams", "update:log_streams", "create:signing_keys", "read:signing_keys", "update:signing_keys", "read:limits", "update:limits", "create:role_members", "read:role_members", "delete:role_members", "read:entitlements", "read:attack_protection", "update:attack_protection", "read:organizations", "update:organizations", "create:organizations", "delete:organizations", "create:organization_members", "read:organization_members", "delete:organization_members", "create:organization_connections", "read:organization_connections", "update:organization_connections", "delete:organization_connections", "create:organization_member_roles", "read:organization_member_roles", "delete:organization_member_roles", "create:organization_invitations", "read:organization_invitations", "delete:organization_invitations", "read:organizations_summary", "create:actions_log_sessions", "create:authentication_methods", "read:authentication_methods", "update:authentication_methods", "delete:authentication_methods"] + }, + "response": {}, + "rawHeaders": [], + "responseIsBinary": false + }, + { + "scope": "https://deploy-cli-dev.eu.auth0.com:443", + "method": "PATCH", + "path": "/api/v2/clients/GIW99EUCF9DFExh77WPMyTMzT8NN4J3A", + "body": { + "name": "Deploy CLI", + "app_type": "non_interactive", + "cross_origin_auth": false, + "custom_login_page_on": true, + "grant_types": ["client_credentials"], + "is_first_party": true, + "is_token_endpoint_ip_header_trusted": false, + "jwt_configuration": { + "alg": "RS256", + "lifetime_in_seconds": 36000 + }, + "oidc_conformant": true, + "refresh_token": { + "expiration_type": "non-expiring", + "leeway": 0, + "infinite_token_lifetime": true, + "infinite_idle_token_lifetime": true, + "token_lifetime": 31557600, + "idle_token_lifetime": 2592000, + "rotation_type": "non-rotating" + }, + "sso_disabled": false, + "token_endpoint_auth_method": "client_secret_post" + }, + "status": 200, + "response": { + "tenant": "auth0-deploy-cli-e2e", + "global": false, + "is_token_endpoint_ip_header_trusted": false, + "name": "Deploy CLI", + "is_first_party": true, + "oidc_conformant": true, + "sso_disabled": false, + "cross_origin_auth": false, + "refresh_token": { + "expiration_type": "non-expiring", + "leeway": 0, + "infinite_token_lifetime": true, + "infinite_idle_token_lifetime": true, + "token_lifetime": 31557600, + "idle_token_lifetime": 2592000, + "rotation_type": "non-rotating" + }, + "signing_keys": [ + { + "cert": "[REDACTED]", + "pkcs7": "[REDACTED]", + "subject": "deprecated" + } + ], + "client_id": "GIW99EUCF9DFExh77WPMyTMzT8NN4J3A", + "callback_url_template": false, + "client_secret": "[REDACTED]", + "jwt_configuration": { + "alg": "RS256", + "lifetime_in_seconds": 36000, + "secret_encoded": false + }, + "token_endpoint_auth_method": "client_secret_post", + "app_type": "non_interactive", + "grant_types": [ + "client_credentials" + ], + "custom_login_page_on": true + }, + "rawHeaders": [], + "responseIsBinary": false + }, { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "PATCH", @@ -2454,7 +2539,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/resource-servers?include_totals=true&page=0&per_page=100", + "path": "/api/v2/resource-servers?include_totals=true", "body": "", "status": 200, "response": { @@ -3043,7 +3128,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&is_global=false&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true&is_global=false", "body": "", "status": 200, "response": { @@ -3393,7 +3478,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "PUT", - "path": "/api/v2/guardian/factors/sms/selected-provider", + "path": "/api/v2/guardian/factors/phone/selected-provider", "body": { "provider": "auth0" }, @@ -3533,7 +3618,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/log-streams?paginate=false", + "path": "/api/v2/log-streams", "body": "", "status": 200, "response": [], @@ -3543,7 +3628,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/custom-domains?paginate=false", + "path": "/api/v2/custom-domains", "body": "", "status": 200, "response": [], @@ -3581,7 +3666,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true", "body": "", "status": 200, "response": { @@ -3710,7 +3795,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?strategy=auth0&include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?strategy=auth0&include_totals=true", "body": "", "status": 200, "response": { @@ -3748,7 +3833,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?strategy=auth0&include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?strategy=auth0&include_totals=true", "body": "", "status": 200, "response": { @@ -3866,7 +3951,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true", "body": "", "status": 200, "response": { @@ -3995,7 +4080,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?include_totals=true", "body": "", "status": 200, "response": { @@ -4033,7 +4118,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?include_totals=true", "body": "", "status": 200, "response": { @@ -4125,7 +4210,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true", "body": "", "status": 200, "response": { @@ -4254,7 +4339,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/client-grants?include_totals=true&page=0&per_page=100", + "path": "/api/v2/client-grants?include_totals=true", "body": "", "status": 200, "response": { @@ -4413,7 +4498,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/roles?include_totals=true&page=0&per_page=100", + "path": "/api/v2/roles?include_totals=true", "body": "", "status": 200, "response": { @@ -4428,7 +4513,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/actions/actions?page=0&per_page=100", + "path": "/api/v2/actions/actions", "body": "", "status": 200, "response": { @@ -4441,7 +4526,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/actions/actions?page=0&per_page=100", + "path": "/api/v2/actions/actions", "body": "", "status": 200, "response": { @@ -4481,7 +4566,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?include_totals=true", "body": "", "status": 200, "response": { @@ -4652,4 +4737,4 @@ "rawHeaders": [], "responseIsBinary": false } -] \ No newline at end of file +] diff --git a/test/e2e/recordings/should-dump-without-throwing-an-error.json b/test/e2e/recordings/should-dump-without-throwing-an-error.json index 555a38e7..e004c2b2 100644 --- a/test/e2e/recordings/should-dump-without-throwing-an-error.json +++ b/test/e2e/recordings/should-dump-without-throwing-an-error.json @@ -2,7 +2,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/rules?include_totals=true&page=0&per_page=100", + "path": "/api/v2/rules?include_totals=true", "body": "", "status": 200, "response": { @@ -27,7 +27,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/hooks?include_totals=true&page=0&per_page=100", + "path": "/api/v2/hooks?include_totals=true", "body": "", "status": 200, "response": { @@ -42,7 +42,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?is_global=true&include_totals=true&page=0&per_page=100", + "path": "/api/v2/clients?is_global=true&include_totals=true", "body": "", "status": 200, "response": { @@ -160,7 +160,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/resource-servers?include_totals=true&page=0&per_page=100", + "path": "/api/v2/resource-servers?include_totals=true", "body": "", "status": 200, "response": { @@ -749,7 +749,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&is_global=false&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true&is_global=false", "body": "", "status": 200, "response": { @@ -871,7 +871,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?strategy=auth0&include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?strategy=auth0&include_totals=true", "body": "", "status": 200, "response": { @@ -909,7 +909,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/connections?include_totals=true&page=0&per_page=100", + "path": "/api/v2/connections?include_totals=true", "body": "", "status": 200, "response": { @@ -1205,7 +1205,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/client-grants?include_totals=true&page=0&per_page=100", + "path": "/api/v2/client-grants?include_totals=true", "body": "", "status": 200, "response": { @@ -1463,7 +1463,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/guardian/factors/sms/selected-provider", + "path": "/api/v2/guardian/factors/phone/selected-provider", "body": "", "status": 200, "response": { @@ -1487,7 +1487,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/roles?include_totals=true&page=0&per_page=100", + "path": "/api/v2/roles?include_totals=true", "body": "", "status": 200, "response": { @@ -1876,7 +1876,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/actions/actions?page=0&per_page=100", + "path": "/api/v2/actions/actions", "body": "", "status": 200, "response": { @@ -2244,7 +2244,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/log-streams?paginate=false", + "path": "/api/v2/log-streams", "body": "", "status": 200, "response": [], @@ -2254,7 +2254,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/custom-domains?paginate=false", + "path": "/api/v2/custom-domains", "body": "", "status": 200, "response": [], @@ -2276,4 +2276,4 @@ "rawHeaders": [], "responseIsBinary": false } -] \ No newline at end of file +] diff --git a/test/e2e/recordings/should-only-dump-the-resources-listed-in-AUTH0_INCLUDED_ONLY.json b/test/e2e/recordings/should-only-dump-the-resources-listed-in-AUTH0_INCLUDED_ONLY.json index 48843cf4..d7a18b39 100644 --- a/test/e2e/recordings/should-only-dump-the-resources-listed-in-AUTH0_INCLUDED_ONLY.json +++ b/test/e2e/recordings/should-only-dump-the-resources-listed-in-AUTH0_INCLUDED_ONLY.json @@ -72,7 +72,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/actions/actions?page=0&per_page=100", + "path": "/api/v2/actions/actions", "body": "", "status": 200, "response": { @@ -82,4 +82,4 @@ "rawHeaders": [], "responseIsBinary": false } -] \ No newline at end of file +] diff --git a/test/e2e/recordings/should-preserve-keywords-for-directory-format.json b/test/e2e/recordings/should-preserve-keywords-for-directory-format.json index 5a68f44d..aeb78fc7 100644 --- a/test/e2e/recordings/should-preserve-keywords-for-directory-format.json +++ b/test/e2e/recordings/should-preserve-keywords-for-directory-format.json @@ -2,7 +2,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&is_global=false&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true&is_global=false", "body": "", "status": 200, "response": { @@ -355,7 +355,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&is_global=false&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true&is_global=false", "body": "", "status": 200, "response": { @@ -747,7 +747,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&is_global=false&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true&is_global=false", "body": "", "status": 200, "response": { @@ -1136,4 +1136,4 @@ "rawHeaders": [], "responseIsBinary": false } -] \ No newline at end of file +] diff --git a/test/e2e/recordings/should-preserve-keywords-for-yaml-format.json b/test/e2e/recordings/should-preserve-keywords-for-yaml-format.json index 0f942ffe..d6e6b232 100644 --- a/test/e2e/recordings/should-preserve-keywords-for-yaml-format.json +++ b/test/e2e/recordings/should-preserve-keywords-for-yaml-format.json @@ -2,7 +2,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&is_global=false&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true&is_global=false", "body": "", "status": 200, "response": { @@ -334,7 +334,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&is_global=false&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true&is_global=false", "body": "", "status": 200, "response": { @@ -726,7 +726,7 @@ { "scope": "https://deploy-cli-dev.eu.auth0.com:443", "method": "GET", - "path": "/api/v2/clients?include_totals=true&is_global=false&page=0&per_page=100", + "path": "/api/v2/clients?include_totals=true&is_global=false", "body": "", "status": 200, "response": { @@ -1115,4 +1115,4 @@ "rawHeaders": [], "responseIsBinary": false } -] \ No newline at end of file +] diff --git a/test/e2e/testdata/empty-tenant/tenant.yaml b/test/e2e/testdata/empty-tenant/tenant.yaml index 2890c0a7..67ddf256 100644 --- a/test/e2e/testdata/empty-tenant/tenant.yaml +++ b/test/e2e/testdata/empty-tenant/tenant.yaml @@ -109,7 +109,6 @@ branding: templates: [] prompts: universal_login_experience: new -migrations: {} actions: [] triggers: {} organizations: [] diff --git a/test/e2e/testdata/lots-of-configuration/tenant.yaml b/test/e2e/testdata/lots-of-configuration/tenant.yaml index a943dc26..58431e5b 100644 --- a/test/e2e/testdata/lots-of-configuration/tenant.yaml +++ b/test/e2e/testdata/lots-of-configuration/tenant.yaml @@ -659,7 +659,6 @@ roles: prompts: universal_login_experience: new identifier_first: true -migrations: {} actions: - name: My Custom Action code: ./actions/My Custom Action/code.js diff --git a/test/e2e/testdata/should-deploy-without-throwing-an-error/tenant.yaml b/test/e2e/testdata/should-deploy-without-throwing-an-error/tenant.yaml index c5dac8f3..405ef36b 100644 --- a/test/e2e/testdata/should-deploy-without-throwing-an-error/tenant.yaml +++ b/test/e2e/testdata/should-deploy-without-throwing-an-error/tenant.yaml @@ -125,7 +125,6 @@ branding: prompts: customText: {} universal_login_experience: new -migrations: {} actions: [] triggers: {} organizations: [] diff --git a/test/tools/auth0/handlers/actions.tests.js b/test/tools/auth0/handlers/actions.tests.js index 58ceaf37..16d48199 100644 --- a/test/tools/auth0/handlers/actions.tests.js +++ b/test/tools/auth0/handlers/actions.tests.js @@ -2,6 +2,7 @@ import chai, { expect } from 'chai'; import chaiAsPromised from 'chai-as-promised'; const actions = require('../../../../src/tools/auth0/handlers/actions'); +const { mockPagedData } = require('../../../utils'); chai.use(chaiAsPromised); @@ -27,7 +28,7 @@ describe('#actions handler', () => { it('should not allow same names', (done) => { const auth0 = { actions: { - getAll: () => [], + getAll: () => ({ data: [] }), }, }; @@ -67,7 +68,7 @@ describe('#actions handler', () => { it('should pass validation', async () => { const auth0 = { actions: { - getAll: () => [], + getAll: () => ({ data: [] }), }, }; @@ -129,7 +130,7 @@ describe('#actions handler', () => { actions: { get: (params) => { expect(params.id).to.equal(actionId); - return Promise.resolve({ ...action, id: actionId }); + return Promise.resolve({ data: { ...action, id: actionId } }); }, create: function (data) { (() => expect(this).to.not.be.undefined)(); @@ -137,27 +138,29 @@ describe('#actions handler', () => { expect(data.name).to.equal('action-test'); expect(data.supported_triggers[0].id).to.equal('post-login'); expect(data.supported_triggers[0].version).to.equal('v1'); - return Promise.resolve({ ...data, id: actionId }); + return Promise.resolve({ data: { ...data, id: actionId } }); }, - update: () => Promise.resolve([]), - delete: () => Promise.resolve([]), + update: () => Promise.resolve({ data: [] }), + delete: () => Promise.resolve({ data: [] }), getAll: () => { if (!auth0.getAllCalled) { auth0.getAllCalled = true; - return Promise.resolve([]); + return Promise.resolve({ data: [] }); } return Promise.resolve({ - actions: [ - { - name: action.name, - supported_triggers: action.supported_triggers, - id: actionId, - }, - ], + data: { + actions: [ + { + name: action.name, + supported_triggers: action.supported_triggers, + id: actionId, + }, + ], + } }); }, - createVersion: () => Promise.resolve(version), + createVersion: () => Promise.resolve({ data: version }), }, pool, getAllCalled: false, @@ -196,26 +199,26 @@ describe('#actions handler', () => { actions: { get: (params) => { expect(params.id).to.equal(actionId); - return Promise.resolve({ ...action, id: actionId }); + return Promise.resolve({ data: { ...action, id: actionId } }); }, - create: (data) => Promise.resolve({ ...data, id: actionId }), - update: () => Promise.resolve([]), - delete: () => Promise.resolve([]), + create: (data) => Promise.resolve({ data: { ...data, id: actionId } }), + update: () => Promise.resolve({ data: [] }), + delete: () => Promise.resolve({ data: [] }), getAll: () => { if (!auth0.getAllCalled) { auth0.getAllCalled = true; - return Promise.resolve([]); + return Promise.resolve(mockPagedData({ include_totals: true }, 'actions', [] )); } - return Promise.resolve([ + return Promise.resolve(mockPagedData({ include_totals: true }, 'actions', [ { name: action.name, supported_triggers: action.supported_triggers, id: actionId, }, - ]); + ] )); }, - createVersion: () => Promise.resolve(version), + createVersion: () => Promise.resolve({ data: version }), deploy: (data) => { expect(data).to.deep.equal({ id: actionId }); didDeployGetCalled = true; @@ -256,7 +259,7 @@ describe('#actions handler', () => { const auth0 = { actions: { - getAll: () => actionsData, + getAll: () => mockPagedData({ include_totals: true }, 'actions', actionsData), }, }; @@ -365,15 +368,15 @@ describe('#actions handler', () => { it('should remove action', async () => { const auth0 = { actions: { - create: () => Promise.resolve([]), - update: () => Promise.resolve([]), + create: () => Promise.resolve({ data: [] }), + update: () => Promise.resolve({ data: [] }), delete: (data) => { expect(data).to.be.an('object'); expect(data.id).to.equal('action-1'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, getAll: () => - Promise.resolve([ + Promise.resolve({ data: [ { id: 'action-1', name: 'action-test', @@ -384,20 +387,22 @@ describe('#actions handler', () => { }, ], }, - ]), + ] }), getVersion: () => Promise.resolve({ - action: {}, - code: "/** @type {PostLoginAction} */\nmodule.exports = async (event, context) => {\n console.log('new version');\n return {};\n };\n ", - dependencies: [], - runtime: 'node12', - id: '0906fe5b-f4d6-44ec-a8f1-3c05fc186483', - deployed: true, - number: 1, - built_at: '2020-12-03T15:20:54.413725492Z', - status: 'built', - created_at: '2020-12-03T15:20:52.094497448Z', - updated_at: '2020-12-03T15:20:54.415669983Z', + data: { + action: {}, + code: "/** @type {PostLoginAction} */\nmodule.exports = async (event, context) => {\n console.log('new version');\n return {};\n };\n ", + dependencies: [], + runtime: 'node12', + id: '0906fe5b-f4d6-44ec-a8f1-3c05fc186483', + deployed: true, + number: 1, + built_at: '2020-12-03T15:20:54.413725492Z', + status: 'built', + created_at: '2020-12-03T15:20:52.094497448Z', + updated_at: '2020-12-03T15:20:54.415669983Z', + } }), }, pool, @@ -444,7 +449,7 @@ describe('#actions handler', () => { const auth0 = { actions: { - getAll: () => Promise.resolve([marketplaceAction]), + getAll: () => Promise.resolve({ data: [marketplaceAction] }), delete: () => { wasDeleteCalled = true; }, diff --git a/test/tools/auth0/handlers/attackProtection.tests.js b/test/tools/auth0/handlers/attackProtection.tests.js index 55ee7357..fee55da7 100644 --- a/test/tools/auth0/handlers/attackProtection.tests.js +++ b/test/tools/auth0/handlers/attackProtection.tests.js @@ -7,31 +7,37 @@ describe('#attackProtection handler', () => { const auth0 = { attackProtection: { getBreachedPasswordDetectionConfig: () => ({ - admin_notification_frequency: [], - enabled: true, - method: 'standard', - shields: [], + data: { + admin_notification_frequency: [], + enabled: true, + method: 'standard', + shields: [], + } }), getBruteForceConfig: () => ({ - allowlist: [], - enabled: true, - max_attempts: 10, - mode: 'count_per_identifier_and_ip', - shields: ['block', 'user_notification'], + data: { + allowlist: [], + enabled: true, + max_attempts: 10, + mode: 'count_per_identifier_and_ip', + shields: ['block', 'user_notification'], + } }), getSuspiciousIpThrottlingConfig: () => ({ - allowlist: ['127.0.0.1'], - enabled: true, - shields: ['block', 'admin_notification'], - stage: { - 'pre-login': { - max_attempts: 100, - rate: 864000, - }, - 'pre-user-registration': { - max_attempts: 50, - rate: 1200, - }, + data: { + allowlist: ['127.0.0.1'], + enabled: true, + shields: ['block', 'admin_notification'], + stage: { + 'pre-login': { + max_attempts: 100, + rate: 864000, + }, + 'pre-user-registration': { + max_attempts: 50, + rate: 1200, + }, + } }, }), }, diff --git a/test/tools/auth0/handlers/branding.tests.js b/test/tools/auth0/handlers/branding.tests.js index 4a650ca8..3fdcef8b 100644 --- a/test/tools/auth0/handlers/branding.tests.js +++ b/test/tools/auth0/handlers/branding.tests.js @@ -9,7 +9,9 @@ describe('#branding handler', () => { const auth0 = { branding: { getSettings: () => ({ - logo_url: 'https://example.com/logo.png', + data: { + logo_url: 'https://example.com/logo.png', + } }), getUniversalLoginTemplate: () => ({ body: html, @@ -31,16 +33,22 @@ describe('#branding handler', () => { const auth0 = { branding: { getSettings: () => ({ - logo_url: 'https://example.com/logo.png', + data: { + logo_url: 'https://example.com/logo.png', + }, }), getUniversalLoginTemplate: () => ({ - body: html, + data: { + body: html, + }, }), }, customDomains: { - getAll: () => [ - {}, // mock one custom domain. - ], + getAll: () => ({ + data: [ + {}, // mock one custom domain. + ], + }), }, }; @@ -61,7 +69,9 @@ describe('#branding handler', () => { const auth0 = { branding: { getSettings: () => ({ - logo_url: 'https://example.com/logo.png', + data: { + logo_url: 'https://example.com/logo.png', + } }), getUniversalLoginTemplate: () => ({ body: html, @@ -86,7 +96,7 @@ describe('#branding handler', () => { it('should update branding settings without templates if no templates set', (done) => { const auth0 = { branding: { - updateSettings: (params, data) => { + updateSettings: (data) => { try { expect(data).to.be.an('object'); expect(data.templates).to.equal(undefined); @@ -117,7 +127,7 @@ describe('#branding handler', () => { it('should update branding settings and templates if templates set', (done) => { const auth0 = { branding: { - updateSettings: (params, data) => { + updateSettings: (data) => { try { expect(data).to.be.an('object'); expect(data.templates).to.equal(undefined); @@ -126,7 +136,7 @@ describe('#branding handler', () => { done(err); } }, - setUniversalLoginTemplate: (params, data) => { + setUniversalLoginTemplate: (data) => { try { expect(data).to.be.an('object'); expect(data.template).to.equal(html); @@ -161,7 +171,7 @@ describe('#branding handler', () => { const auth0 = { branding: { - updateSettings: (_params, data) => { + updateSettings: (data) => { expect(data).to.deep.equal({ colors: { primary: '#F8F8F2', diff --git a/test/tools/auth0/handlers/clientGrants.tests.js b/test/tools/auth0/handlers/clientGrants.tests.js index 5fae08d7..1b8bb36d 100644 --- a/test/tools/auth0/handlers/clientGrants.tests.js +++ b/test/tools/auth0/handlers/clientGrants.tests.js @@ -1,5 +1,6 @@ const { expect } = require('chai'); const clientGrants = require('../../../../src/tools/auth0/handlers/clientGrants'); +const { mockPagedData } = require('../../../utils'); const pool = { addEachTask: (data) => { @@ -62,14 +63,14 @@ describe('#clientGrants handler', () => { (() => expect(this).to.not.be.undefined)(); expect(data).to.be.an('object'); expect(data.name).to.equal('someClientGrant'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - update: () => Promise.resolve([]), - delete: () => Promise.resolve([]), - getAll: () => [], + update: () => Promise.resolve({ data: [] }), + delete: () => Promise.resolve({ data: [] }), + getAll: (params) => mockPagedData(params, 'client_grants', []), }, clients: { - getAll: () => [], + getAll: (params) => mockPagedData(params, 'clients', []), }, pool, }; @@ -95,10 +96,10 @@ describe('#clientGrants handler', () => { }; const auth0 = { clientGrants: { - getAll: () => [clientGrant], + getAll: (params) => mockPagedData(params, 'client_grants', [clientGrant]), }, clients: { - getAll: () => [{ name: 'test client', client_id: clientId }], + getAll: (params) => mockPagedData(params, 'clients', [{ name: 'test client', client_id: clientId }]), }, pool, }; @@ -116,14 +117,14 @@ describe('#clientGrants handler', () => { expect(data).to.be.an('object'); expect(data.name).to.equal('someClientGrant'); expect(data.client_id).to.equal('client_id'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - update: () => Promise.resolve([]), - delete: () => Promise.resolve([]), - getAll: () => [], + update: () => Promise.resolve({ data: [] }), + delete: () => Promise.resolve({ data: [] }), + getAll: (params) => mockPagedData(params, 'client_grants', []), }, clients: { - getAll: () => [{ client_id: 'client_id', name: 'client_name' }], + getAll: (params) => mockPagedData(params, 'clients', [{ client_id: 'client_id', name: 'client_name' }]), }, pool, }; @@ -147,7 +148,7 @@ describe('#clientGrants handler', () => { (() => expect(this).to.not.be.undefined)(); expect(data).to.be.an('object'); expect(data).to.equal({}); - return Promise.resolve(data); + return Promise.resolve({ data }); }, update: function (params, data) { (() => expect(this).to.not.be.undefined)(); @@ -157,13 +158,13 @@ describe('#clientGrants handler', () => { expect(data.scope).to.be.an('array'); expect(data.scope[0]).to.equal('read:messages'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - delete: () => Promise.resolve([]), - getAll: () => [{ id: 'cg1', client_id: 'client1', audience: 'audience' }], + delete: () => Promise.resolve({ data: [] }), + getAll: (params) => mockPagedData(params, 'client_grants', [{ id: 'cg1', client_id: 'client1', audience: 'audience' }]), }, clients: { - getAll: () => [], + getAll: (params) => mockPagedData(params, 'clients', []), }, pool, }; @@ -189,20 +190,20 @@ describe('#clientGrants handler', () => { expect(data).to.be.an('object'); expect(data.name).to.equal('someClientGrant'); expect(data.client_id).to.equal('client2'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - update: () => Promise.resolve([]), + update: () => Promise.resolve({ data: [] }), delete: function (params) { (() => expect(this).to.not.be.undefined)(); expect(params).to.be.an('object'); expect(params.id).to.equal('cg1'); - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, - getAll: () => [{ id: 'cg1', client_id: 'client1', audience: 'audience1' }], + getAll: (params) => mockPagedData(params, 'client_grants', [{ id: 'cg1', client_id: 'client1', audience: 'audience1' }]), }, clients: { - getAll: () => [], + getAll: (params) => mockPagedData(params, 'clients', []), }, pool, }; @@ -226,23 +227,23 @@ describe('#clientGrants handler', () => { create: (params) => { expect(params).to.be.an('undefined'); - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, update: (params) => { expect(params).to.be.an('undefined'); - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, delete: function (params) { (() => expect(this).to.not.be.undefined)(); expect(params).to.be.an('undefined'); - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, - getAll: () => [{ id: 'id', client_id: 'client_id', audience: 'audience' }], + getAll: (params) => mockPagedData(params, 'client_grants', [{ id: 'id', client_id: 'client_id', audience: 'audience' }]), }, clients: { - getAll: () => [], + getAll: (params) => mockPagedData(params, 'clients', []), }, pool, }; @@ -264,19 +265,19 @@ describe('#clientGrants handler', () => { let removed = false; const auth0 = { clientGrants: { - create: () => Promise.resolve([]), - update: () => Promise.resolve([]), + create: () => Promise.resolve({ data: [] }), + update: () => Promise.resolve({ data: [] }), delete: function (params) { (() => expect(this).to.not.be.undefined)(); expect(params).to.be.an('object'); expect(params.id).to.equal('cg1'); removed = true; - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, - getAll: () => [{ id: 'cg1', client_id: 'client1', audience: 'audience1' }], + getAll: (params) => mockPagedData(params, 'client_grants', [{ id: 'cg1', client_id: 'client1', audience: 'audience1' }]), }, clients: { - getAll: () => [], + getAll: (params) => mockPagedData(params, 'clients', []), }, pool, }; @@ -295,18 +296,18 @@ describe('#clientGrants handler', () => { const auth0 = { clientGrants: { - create: () => Promise.resolve([]), - update: () => Promise.resolve([]), + create: () => Promise.resolve({ data: [] }), + update: () => Promise.resolve({ data: [] }), delete: function (params) { (() => expect(this).to.not.be.undefined)(); expect(params).to.be.an('undefined'); - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, - getAll: () => [{ id: 'cg1', client_id: 'client1', audience: 'audience1' }], + getAll: (params) => mockPagedData(params, 'client_grants', [{ id: 'cg1', client_id: 'client1', audience: 'audience1' }]), }, clients: { - getAll: () => [], + getAll: (params) => mockPagedData(params, 'clients', []), }, pool, }; @@ -327,30 +328,30 @@ describe('#clientGrants handler', () => { create: (params) => { expect(params).to.be.an('undefined'); - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, update: (params) => { expect(params).to.be.an('undefined'); - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, delete: function (params) { (() => expect(this).to.not.be.undefined)(); expect(params).to.be.an('undefined'); - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, - getAll: () => [ + getAll: (params) => mockPagedData(params, 'client_grants', [ { id: 'cg1', client_id: 'client1', audience: 'audience1' }, { id: 'cg2', client_id: 'client2', audience: 'audience2' }, - ], + ]), }, clients: { - getAll: () => [ + getAll: (params) => mockPagedData(params, 'clients', [ { name: 'client_delete', client_id: 'client1', audience: 'audience1' }, { name: 'client_update', client_id: 'client2', audience: 'audience2' }, { name: 'client_create', client_id: 'client3', audience: 'audience3' }, - ], + ]), }, pool, }; @@ -383,20 +384,20 @@ describe('#clientGrants handler', () => { create: (params) => { expect(params).to.be.an('undefined'); - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, update: (params) => { expect(params).to.be.an('undefined'); - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, delete: function (params) { (() => expect(this).to.not.be.undefined)(); expect(params).to.be.an('undefined'); - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, - getAll: () => [ + getAll: (params) => mockPagedData(params, 'client_grants', [ { client_id: '123', audience: 'a', @@ -422,10 +423,10 @@ describe('#clientGrants handler', () => { audience: 'a', id: '5', }, - ], + ]), }, clients: { - getAll: () => [ + getAll: (params) => mockPagedData(params, 'clients', [ { name: 'abc', client_id: 'abc', @@ -438,7 +439,7 @@ describe('#clientGrants handler', () => { name: 'foo_client', client_id: '456', }, - ], + ]), }, pool, }; diff --git a/test/tools/auth0/handlers/clients.tests.js b/test/tools/auth0/handlers/clients.tests.js index 174e10b5..0cde218b 100644 --- a/test/tools/auth0/handlers/clients.tests.js +++ b/test/tools/auth0/handlers/clients.tests.js @@ -1,5 +1,6 @@ const { expect } = require('chai'); const clients = require('../../../../src/tools/auth0/handlers/clients'); +const { mockPagedData } = require('../../../utils'); const pool = { addEachTask: (data) => { @@ -62,11 +63,11 @@ describe('#clients handler', () => { (() => expect(this).to.not.be.undefined)(); expect(data).to.be.an('object'); expect(data.name).to.equal('someClient'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - update: () => Promise.resolve([]), - delete: () => Promise.resolve([]), - getAll: () => [], + update: () => Promise.resolve({ data: [] }), + delete: () => Promise.resolve({ data: [] }), + getAll: (params) => mockPagedData(params, 'clients',[]), }, pool, }; @@ -80,10 +81,10 @@ describe('#clients handler', () => { it('should get clients', async () => { const auth0 = { clients: { - getAll: () => [ + getAll: (params) => mockPagedData(params, 'clients', [ { name: 'test client', client_id: 'FMfcgxvzLDvPsgpRFKkLVrnKqGgkHhQV' }, { name: 'deploy client', client_id: 'client_id' }, - ], + ]), }, pool, }; @@ -103,7 +104,7 @@ describe('#clients handler', () => { (() => expect(this).to.not.be.undefined)(); expect(data).to.be.an('array'); expect(data.length).to.equal(0); - return Promise.resolve(data); + return Promise.resolve({ data }); }, update: function (params, data) { (() => expect(this).to.not.be.undefined)(); @@ -112,15 +113,15 @@ describe('#clients handler', () => { expect(data).to.be.an('object'); expect(data.description).to.equal('new description'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - delete: () => Promise.resolve([]), - getAll: () => [ + delete: () => Promise.resolve({ data: [] }), + getAll: (params) => mockPagedData(params, 'clients', [ { client_id: 'client1', name: 'someClient', }, - ], + ]), }, pool, }; @@ -147,19 +148,19 @@ describe('#clients handler', () => { (() => expect(this).to.not.be.undefined)(); expect(data).to.be.an('object'); expect(data.name).to.equal('someClient'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - update: () => Promise.resolve([]), + update: () => Promise.resolve({ data: [] }), delete: function (params) { (() => expect(this).to.not.be.undefined)(); expect(params).to.be.an('object'); expect(params.client_id).to.equal('client1'); - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, - getAll: () => [ + getAll: (params) => mockPagedData(params, 'clients', [ { client_id: 'client1', name: 'existingClient' }, { client_id: 'client_id', name: 'deploy client' }, - ], + ]), }, pool, }; @@ -174,19 +175,19 @@ describe('#clients handler', () => { let removed = false; const auth0 = { clients: { - create: () => Promise.resolve([]), - update: () => Promise.resolve([]), + create: () => Promise.resolve({ data: [] }), + update: () => Promise.resolve({ data: [] }), delete: function (params) { (() => expect(this).to.not.be.undefined)(); expect(params).to.be.an('object'); expect(params.client_id).to.equal('client1'); removed = true; - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, - getAll: () => [ + getAll: (params) => mockPagedData(params, 'clients', [ { client_id: 'client1', name: 'existingClient' }, { client_id: 'client_id', name: 'deploy client' }, - ], + ]), }, pool, }; @@ -202,14 +203,14 @@ describe('#clients handler', () => { config.data.AUTH0_ALLOW_DELETE = false; const auth0 = { clients: { - create: () => Promise.resolve([]), - update: () => Promise.resolve([]), + create: () => Promise.resolve({ data: [] }), + update: () => Promise.resolve({ data: [] }), delete: function (params) { (() => expect(this).to.not.be.undefined)(); expect(params).to.be.an('undefined'); - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, - getAll: () => [{ client_id: 'client1', name: 'existingClient' }], + getAll: (params) => mockPagedData(params, 'clients', [{ client_id: 'client1', name: 'existingClient' }]), }, pool, }; @@ -226,18 +227,18 @@ describe('#clients handler', () => { clients: { create: (params) => { expect(params).to.be.an('undefined'); - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, update: (params) => { expect(params).to.be.an('undefined'); - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, delete: function (params) { (() => expect(this).to.not.be.undefined)(); expect(params).to.be.an('undefined'); - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, - getAll: () => Promise.resolve([]), + getAll: (params) => Promise.resolve(mockPagedData(params, 'clients', [])), }, pool, }; @@ -262,17 +263,17 @@ describe('#clients handler', () => { const auth0 = { clients: { - create: () => Promise.resolve([]), - update: () => Promise.resolve([]), + create: () => Promise.resolve({ data: [] }), + update: () => Promise.resolve({ data: [] }), delete: function (params) { (() => expect(this).to.not.be.undefined)(); expect(params).to.be.an('undefined'); - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, - getAll: () => [ + getAll: (params) => mockPagedData(params, 'clients', [ { client_id: 'client1', name: 'existingClient' }, { client_id: 'client2', name: 'existingClient2' }, - ], + ]), }, pool, }; @@ -294,23 +295,23 @@ describe('#clients handler', () => { (() => expect(this).to.not.be.undefined)(); expect(data).to.be.an('object'); expect(data.name).to.equal('Client 3'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, update: function (data) { wasUpdateCalled = true; (() => expect(this).to.not.be.undefined)(); expect(data).to.be.an('object'); expect(data.client_id).to.equal('client-1'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, delete: function (data) { wasDeleteCalled = true; (() => expect(this).to.not.be.undefined)(); expect(data).to.be.an('object'); expect(data.client_id).to.equal('client-2'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - getAll: () => [ + getAll: (params) => mockPagedData(params, 'clients', [ { client_id: 'client-1', name: 'Client 1', @@ -319,7 +320,7 @@ describe('#clients handler', () => { client_id: 'client-2', name: 'Client 2', }, - ], + ]), }, pool, }; diff --git a/test/tools/auth0/handlers/connections.tests.js b/test/tools/auth0/handlers/connections.tests.js index 92c1882f..afe25190 100644 --- a/test/tools/auth0/handlers/connections.tests.js +++ b/test/tools/auth0/handlers/connections.tests.js @@ -1,6 +1,7 @@ /* eslint-disable consistent-return */ const { expect } = require('chai'); const connections = require('../../../../src/tools/auth0/handlers/connections'); +const { mockPagedData } = require('../../../utils'); const pool = { addEachTask: (data) => { @@ -63,14 +64,14 @@ describe('#connections handler', () => { (() => expect(this).to.not.be.undefined)(); expect(data).to.be.an('object'); expect(data.name).to.equal('someConnection'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - update: () => Promise.resolve([]), - delete: () => Promise.resolve([]), - getAll: () => [], + update: () => Promise.resolve({ data: [] }), + delete: () => Promise.resolve({ data: [] }), + getAll: (params) => mockPagedData(params, 'connections', []), }, clients: { - getAll: () => [], + getAll: (params) => mockPagedData(params, 'clients', []), }, pool, }; @@ -86,13 +87,13 @@ describe('#connections handler', () => { const auth0 = { connections: { - getAll: () => [ + getAll: (params) => mockPagedData(params, 'connections', [ { strategy: 'github', name: 'github', enabled_clients: [clientId] }, { strategy: 'auth0', name: 'db-should-be-ignored', enabled_clients: [] }, - ], + ]), }, clients: { - getAll: () => [{ name: 'test client', client_id: clientId }], + getAll: (params) => mockPagedData(params, 'clients', [{ name: 'test client', client_id: clientId }]), }, pool, }; @@ -110,7 +111,7 @@ describe('#connections handler', () => { create: function (data) { (() => expect(this).to.not.be.undefined)(); expect(data).to.be.an('undefined'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, update: function (params, data) { (() => expect(this).to.not.be.undefined)(); @@ -121,13 +122,13 @@ describe('#connections handler', () => { options: { passwordPolicy: 'testPolicy' }, }); - return Promise.resolve({ ...params, ...data }); + return Promise.resolve({ data: { ...params, ...data } }); }, - delete: () => Promise.resolve([]), - getAll: () => [{ name: 'someConnection', id: 'con1', strategy: 'custom' }], + delete: () => Promise.resolve({ data: [] }), + getAll: (params) => mockPagedData(params, 'connections', [{ name: 'someConnection', id: 'con1', strategy: 'custom' }]), }, clients: { - getAll: () => [{ name: 'client1', client_id: 'YwqVtt8W3pw5AuEz3B2Kse9l2Ruy7Tec' }], + getAll: (params) => mockPagedData(params, 'clients', [{ name: 'client1', client_id: 'YwqVtt8W3pw5AuEz3B2Kse9l2Ruy7Tec' }]), }, pool, }; @@ -166,7 +167,7 @@ describe('#connections handler', () => { }, }, }); - return Promise.resolve(data); + return Promise.resolve({ data }); }, update: function (params, data) { (() => expect(this).to.not.be.undefined)(); @@ -184,16 +185,16 @@ describe('#connections handler', () => { }, }); - return Promise.resolve({ ...params, ...data }); + return Promise.resolve({ data: { ...params, ...data } }); }, - delete: () => Promise.resolve([]), - getAll: () => [{ name: 'someSamlConnection', id: 'con1', strategy: 'samlp' }], + delete: () => Promise.resolve({ data: [] }), + getAll: (params) => mockPagedData(params, 'connections', [{ name: 'someSamlConnection', id: 'con1', strategy: 'samlp' }]), }, clients: { - getAll: () => [ + getAll: (params) => mockPagedData(params, 'clients', [ { name: 'client1', client_id: 'YwqVtt8W3pw5AuEz3B2Kse9l2Ruy7Tec' }, { name: 'idp-one', client_id: 'YwqVtt8W3pw5AuEz3B2Kse9l2Ruy7Teb' }, - ], + ]), }, pool, }; @@ -250,7 +251,7 @@ describe('#connections handler', () => { }, }, }); - return Promise.resolve(data); + return Promise.resolve({ data }); }, update: function (params, data) { (() => expect(this).to.not.be.undefined)(); @@ -268,16 +269,16 @@ describe('#connections handler', () => { }, }); - return Promise.resolve({ ...params, ...data }); + return Promise.resolve({ data: { ...params, ...data } }); }, - delete: () => Promise.resolve([]), - getAll: () => [{ name: 'someSamlConnection', id: 'con1', strategy: 'samlp' }], + delete: () => Promise.resolve({ data: [] }), + getAll: (params) => mockPagedData(params, 'connections', [{ name: 'someSamlConnection', id: 'con1', strategy: 'samlp' }]), }, clients: { - getAll: () => [ + getAll: (params) => mockPagedData(params, 'clients', [ { name: 'client1', client_id: 'YwqVtt8W3pw5AuEz3B2Kse9l2Ruy7Tec' }, { name: 'idp-one', client_id: 'YwqVtt8W3pw5AuEz3B2Kse9l2Ruy7Teb' }, - ], + ]), }, pool, }; @@ -324,7 +325,7 @@ describe('#connections handler', () => { create: function (data) { (() => expect(this).to.not.be.undefined)(); expect(data).to.be.an('undefined'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, update: function (params, data) { (() => expect(this).to.not.be.undefined)(); @@ -335,24 +336,24 @@ describe('#connections handler', () => { options: { passwordPolicy: 'testPolicy' }, }); - return Promise.resolve({ ...params, ...data }); + return Promise.resolve({ data: { ...params, ...data } }); }, - delete: () => Promise.resolve([]), - getAll: () => [ + delete: () => Promise.resolve({ data: [] }), + getAll: (params) => mockPagedData(params, 'connections', [ { name: 'someConnection', id: 'con1', strategy: 'custom', enabled_clients: ['excluded-one-id'], }, - ], + ]), }, clients: { - getAll: () => [ + getAll: (params) => mockPagedData(params, 'clients', [ { name: 'client1', client_id: 'client1-id' }, { name: 'excluded-one', client_id: 'excluded-one-id' }, { name: 'excluded-two', client_id: 'excluded-two-id' }, - ], + ]), }, pool, }; @@ -382,20 +383,20 @@ describe('#connections handler', () => { (() => expect(this).to.not.be.undefined)(); expect(data).to.be.an('object'); expect(data.name).to.equal('someConnection'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - update: () => Promise.resolve([]), + update: () => Promise.resolve({ data: [] }), delete: function (params) { (() => expect(this).to.not.be.undefined)(); expect(params).to.be.an('object'); expect(params.id).to.equal('con1'); - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, - getAll: () => [{ id: 'con1', name: 'existingConnection', strategy: 'custom' }], + getAll: (params) => mockPagedData(params, 'connections', [{ id: 'con1', name: 'existingConnection', strategy: 'custom' }]), }, clients: { - getAll: () => [], + getAll: (params) => mockPagedData(params, 'clients', []), }, pool, }; @@ -416,19 +417,19 @@ describe('#connections handler', () => { let removed = false; const auth0 = { connections: { - create: () => Promise.resolve([]), - update: () => Promise.resolve([]), + create: () => Promise.resolve({ data: [] }), + update: () => Promise.resolve({ data: [] }), delete: function (params) { (() => expect(this).to.not.be.undefined)(); expect(params).to.be.an('object'); expect(params.id).to.equal('con1'); removed = true; - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, - getAll: () => [{ id: 'con1', name: 'existingConnection', strategy: 'custom' }], + getAll: (params) => mockPagedData(params, 'connections', [{ id: 'con1', name: 'existingConnection', strategy: 'custom' }]), }, clients: { - getAll: () => [], + getAll: (params) => mockPagedData(params, 'clients', []), }, pool, }; @@ -446,18 +447,18 @@ describe('#connections handler', () => { connections: { create: function (data) { (() => expect(this).to.not.be.undefined)(); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - update: () => Promise.resolve([]), + update: () => Promise.resolve({ data: [] }), delete: function (params) { (() => expect(this).to.not.be.undefined)(); expect(params).to.be.an('undefined'); - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, - getAll: () => [{ id: 'con1', name: 'existingConnection', strategy: 'custom' }], + getAll: (params) => mockPagedData(params, 'connections', [{ id: 'con1', name: 'existingConnection', strategy: 'custom' }]), }, clients: { - getAll: () => [], + getAll: (params) => mockPagedData(params, 'clients', []), }, pool, }; @@ -480,17 +481,17 @@ describe('#connections handler', () => { }; const auth0 = { connections: { - create: () => Promise.resolve(), - update: () => Promise.resolve([]), + create: () => Promise.resolve({ data: undefined }), + update: () => Promise.resolve({ data: [] }), delete: function (params) { (() => expect(this).to.not.be.undefined)(); expect(params).to.be.an('undefined'); - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, - getAll: () => [{ id: 'con1', name: 'existingConnection', strategy: 'custom' }], + getAll: (params) => mockPagedData(params, 'connections', [{ id: 'con1', name: 'existingConnection', strategy: 'custom' }]), }, clients: { - getAll: () => [], + getAll: (params) => mockPagedData(params, 'clients', []), }, pool, }; @@ -510,24 +511,24 @@ describe('#connections handler', () => { connections: { create: (params) => { expect(params).to.be.an('undefined'); - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, update: (params) => { expect(params).to.be.an('undefined'); - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, delete: function (params) { (() => expect(this).to.not.be.undefined)(); expect(params).to.be.an('undefined'); - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, - getAll: () => [ + getAll: (params) => mockPagedData(params, 'connections', [ { id: 'con1', name: 'existing1', strategy: 'custom' }, { id: 'con2', name: 'existing2', strategy: 'custom' }, - ], + ]), }, clients: { - getAll: () => [], + getAll: (params) => mockPagedData(params, 'clients', []), }, pool, }; diff --git a/test/tools/auth0/handlers/customDomains.test.ts b/test/tools/auth0/handlers/customDomains.test.ts index 455507ad..e6a89ef9 100644 --- a/test/tools/auth0/handlers/customDomains.test.ts +++ b/test/tools/auth0/handlers/customDomains.test.ts @@ -25,10 +25,10 @@ describe('#customDomains handler', () => { it('should get custom domains', async () => { const auth0ApiClientMock = { customDomains: { - getAll: async () => customDomains, - create: async () => customDomains[0], - update: async () => {}, - delete: async () => {}, + getAll: async () => ({ data: customDomains }), + create: async () => ({ data: customDomains[0] }), + update: async () => ({ data: {} }), + delete: async () => ({ data: {} }), }, pool: new PromisePoolExecutor({ concurrencyLimit: 3, @@ -192,7 +192,7 @@ describe('#customDomains handler', () => { const auth0ApiClientMock = { customDomains: { - getAll: async () => customDomains, + getAll: async () => ({ data: customDomains }), create: async () => { didCreateFunctionGetCalled = true; }, diff --git a/test/tools/auth0/handlers/databases.tests.js b/test/tools/auth0/handlers/databases.tests.js index be253338..c31f52ed 100644 --- a/test/tools/auth0/handlers/databases.tests.js +++ b/test/tools/auth0/handlers/databases.tests.js @@ -1,5 +1,6 @@ const { expect } = require('chai'); const databases = require('../../../../src/tools/auth0/handlers/databases'); +const { mockPagedData } = require('../../../utils'); const pool = { addEachTask: (data) => { @@ -57,14 +58,14 @@ describe('#databases handler', () => { (() => expect(this).to.not.be.undefined)(); expect(data).to.be.an('object'); expect(data.name).to.equal('someDatabase'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - update: () => Promise.resolve([]), - delete: () => Promise.resolve([]), - getAll: () => [], + update: () => Promise.resolve({ data: [] }), + delete: () => Promise.resolve({ data: [] }), + getAll: (params) => mockPagedData(params, 'connections', []), }, clients: { - getAll: () => [], + getAll: (params) => mockPagedData(params, 'clients', []), }, pool, }; @@ -79,15 +80,15 @@ describe('#databases handler', () => { const clientId = 'rFeR6vyzQcDEgSUsASPeF4tXr3xbZhxE'; const auth0 = { connections: { - getAll: function () { + getAll: function (params) { (() => expect(this).to.not.be.undefined)(); - return [{ strategy: 'auth0', name: 'db', enabled_clients: [clientId] }]; + return mockPagedData(params, 'connections', [{ strategy: 'auth0', name: 'db', enabled_clients: [clientId] }]); }, }, clients: { - getAll: function () { + getAll: function (params) { (() => expect(this).to.not.be.undefined)(); - return [{ name: 'test client', client_id: clientId }]; + return mockPagedData(params, 'clients', [{ name: 'test client', client_id: clientId }]); }, }, pool, @@ -105,12 +106,12 @@ describe('#databases handler', () => { (() => expect(this).to.not.be.undefined)(); expect(params).to.be.an('object'); expect(params.id).to.equal('con1'); - return Promise.resolve({ options: { someOldOption: true } }); + return Promise.resolve({ data: { options: { someOldOption: true } } }); }, create: function (data) { (() => expect(this).to.not.be.undefined)(); expect(data).to.be.an('undefined'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, update: function (params, data) { (() => expect(this).to.not.be.undefined)(); @@ -121,13 +122,13 @@ describe('#databases handler', () => { options: { passwordPolicy: 'testPolicy', someOldOption: true }, }); - return Promise.resolve({ ...params, ...data }); + return Promise.resolve({ data: { ...params, ...data } }); }, - delete: () => Promise.resolve([]), - getAll: () => [{ name: 'someDatabase', id: 'con1', strategy: 'auth0' }], + delete: () => Promise.resolve({ data: [] }), + getAll: (params) => mockPagedData(params, 'connections', [{ name: 'someDatabase', id: 'con1', strategy: 'auth0' }]), }, clients: { - getAll: () => [{ name: 'client1', client_id: 'YwqVtt8W3pw5AuEz3B2Kse9l2Ruy7Tec' }], + getAll: (params) => mockPagedData(params, 'clients', [{ name: 'client1', client_id: 'YwqVtt8W3pw5AuEz3B2Kse9l2Ruy7Tec' }]), }, pool, }; @@ -154,12 +155,12 @@ describe('#databases handler', () => { get: (params) => { expect(params).to.be.an('object'); expect(params.id).to.equal('con1'); - return Promise.resolve({ options: { someOldOption: true } }); + return Promise.resolve({ data: { options: { someOldOption: true } } }); }, create: function (data) { (() => expect(this).to.not.be.undefined)(); expect(data).to.be.an('undefined'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, update: function (params, data) { (() => expect(this).to.not.be.undefined)(); @@ -170,24 +171,24 @@ describe('#databases handler', () => { options: { passwordPolicy: 'testPolicy', someOldOption: true }, }); - return Promise.resolve({ ...params, ...data }); + return Promise.resolve({ data: { ...params, ...data } }); }, - delete: () => Promise.resolve([]), - getAll: () => [ + delete: () => Promise.resolve({ data: [] }), + getAll: (params) => mockPagedData(params, 'connections', [ { name: 'someDatabase', id: 'con1', strategy: 'auth0', enabled_clients: ['excluded-one-id'], }, - ], + ]), }, clients: { - getAll: () => [ + getAll: (params) => mockPagedData(params, 'clients', [ { name: 'client1', client_id: 'client1-id' }, { name: 'excluded-one', client_id: 'excluded-one-id' }, { name: 'excluded-two', client_id: 'excluded-two-id' }, - ], + ]), }, pool, }; @@ -214,12 +215,12 @@ describe('#databases handler', () => { get: (params) => { expect(params).to.be.an('object'); expect(params.id).to.equal('con1'); - return Promise.resolve({}); + return Promise.resolve({ data: {} }); }, create: function (data) { (() => expect(this).to.not.be.undefined)(); expect(data).to.be.an('undefined'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, update: function (params, data) { (() => expect(this).to.not.be.undefined)(); @@ -229,13 +230,13 @@ describe('#databases handler', () => { options: { passwordPolicy: 'testPolicy' }, }); - return Promise.resolve({ ...params, ...data }); + return Promise.resolve({ data: { ...params, ...data } }); }, delete: () => Promise.resolve([]), - getAll: () => [{ name: 'someDatabase', id: 'con1', strategy: 'auth0' }], + getAll: (params) => mockPagedData(params, 'connections', [{ name: 'someDatabase', id: 'con1', strategy: 'auth0' }]), }, clients: { - getAll: () => [{ name: 'client1', client_id: 'YwqVtt8W3pw5AuEz3B2Kse9l2Ruy7Tec' }], + getAll: (params) => mockPagedData(params, 'clients', [{ name: 'client1', client_id: 'YwqVtt8W3pw5AuEz3B2Kse9l2Ruy7Tec' }]), }, pool, }; @@ -260,7 +261,7 @@ describe('#databases handler', () => { (() => expect(this).to.not.be.undefined)(); expect(data).to.be.an('object'); expect(data.name).to.equal('someDatabase'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, update: () => Promise.resolve([]), delete: function (params) { @@ -268,12 +269,12 @@ describe('#databases handler', () => { expect(params).to.be.an('object'); expect(params.id).to.equal('con1'); - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, - getAll: () => [{ id: 'con1', name: 'existingConnection', strategy: 'auth0' }], + getAll: (params) => mockPagedData(params, 'connections', [{ id: 'con1', name: 'existingConnection', strategy: 'auth0' }]), }, clients: { - getAll: () => [], + getAll: (params) => mockPagedData(params, 'clients', []), }, pool, }; @@ -294,19 +295,19 @@ describe('#databases handler', () => { let removed = false; const auth0 = { connections: { - create: () => Promise.resolve([]), - update: () => Promise.resolve([]), + create: () => Promise.resolve({ data: [] }), + update: () => Promise.resolve({ data: [] }), delete: function (params) { (() => expect(this).to.not.be.undefined)(); expect(params).to.be.an('object'); expect(params.id).to.equal('con1'); removed = true; - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, - getAll: () => [{ id: 'con1', name: 'existingConnection', strategy: 'auth0' }], + getAll: (params) => mockPagedData(params, 'connections', [{ id: 'con1', name: 'existingConnection', strategy: 'auth0' }]), }, clients: { - getAll: () => [], + getAll: (params) => mockPagedData(params, 'clients', []), }, pool, }; @@ -327,12 +328,12 @@ describe('#databases handler', () => { delete: function (params) { (() => expect(this).to.not.be.undefined)(); expect(params).to.be.an('undefined'); - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, - getAll: () => [{ id: 'con1', name: 'existingConnection', strategy: 'auth0' }], + getAll: (params) => mockPagedData(params, 'connections', [{ id: 'con1', name: 'existingConnection', strategy: 'auth0' }]), }, clients: { - getAll: () => [], + getAll: (params) => mockPagedData(params, 'clients', []), }, pool, }; @@ -355,17 +356,17 @@ describe('#databases handler', () => { }; const auth0 = { connections: { - create: () => Promise.resolve(), - update: () => Promise.resolve([]), + create: () => Promise.resolve({ data: undefined }), + update: () => Promise.resolve({ data: [] }), delete: function (params) { (() => expect(this).to.not.be.undefined)(); expect(params).to.be.an('undefined'); - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, - getAll: () => [{ id: 'con1', name: 'existingConnection', strategy: 'auth0' }], + getAll: (params) => mockPagedData(params, 'connections', [{ id: 'con1', name: 'existingConnection', strategy: 'auth0' }]), }, clients: { - getAll: () => [], + getAll: (params) => mockPagedData(params, 'clients', []), }, pool, }; @@ -385,24 +386,24 @@ describe('#databases handler', () => { connections: { create: (params) => { expect(params).to.be.an('undefined'); - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, update: (params) => { expect(params).to.be.an('undefined'); - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, delete: function (params) { (() => expect(this).to.not.be.undefined)(); expect(params).to.be.an('undefined'); - return Promise.resolve([]); + return Promise.resolve({ data: [] }); }, - getAll: () => [ + getAll: (params) => mockPagedData(params, 'connections', [ { id: 'con1', name: 'existing1', strategy: 'auth0' }, { id: 'con2', name: 'existing2', strategy: 'auth0' }, - ], + ]), }, clients: { - getAll: () => [], + getAll: (params) => mockPagedData(params, 'clients', []), }, pool, }; diff --git a/test/tools/auth0/handlers/emailProvider.tests.js b/test/tools/auth0/handlers/emailProvider.tests.js index 57f9b695..c024c1e1 100644 --- a/test/tools/auth0/handlers/emailProvider.tests.js +++ b/test/tools/auth0/handlers/emailProvider.tests.js @@ -5,17 +5,15 @@ describe('#emailProvider handler', () => { describe('#emailProvider process', () => { it('should configure email provider', async () => { const auth0 = { - emailProvider: { - configure: (provider, data) => { - expect(provider).to.be.an('object'); + emails: { + configure: (data) => { expect(data).to.be.an('object'); - expect(provider.name).to.equal('someProvider'); expect(data.name).to.equal('someProvider'); - return Promise.resolve({ provider, data }); + return Promise.resolve({ data }); }, - update: (provider, data) => Promise.resolve({ provider, data }), - delete: () => Promise.resolve(null), - get: () => [], + update: (data) => Promise.resolve({ data }), + delete: () => Promise.resolve({ data: null }), + get: () => ({ data: [] }), }, }; @@ -27,21 +25,16 @@ describe('#emailProvider handler', () => { it('should update email provider', async () => { const auth0 = { - emailProvider: { - configure: (provider, data) => { - expect(provider).to.be('undefined'); - return Promise.resolve(data); - }, - update: (provider, data) => { - expect(provider).to.be.an('object'); + emails: { + configure: (data) => Promise.resolve({ data }), + update: (data) => { expect(data).to.be.an('object'); - expect(provider.name).to.equal('someProvider'); expect(data.name).to.equal('someProvider'); expect(data.credentials).to.equal('password'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - delete: () => Promise.resolve(null), - get: () => ({ name: 'someProvider', enabled: false }), + delete: () => Promise.resolve({ data: null }), + get: () => ({ data: { name: 'someProvider', enabled: false } }), }, }; @@ -56,17 +49,18 @@ describe('#emailProvider handler', () => { await stageFn.apply(handler, [{ emailProvider: data }]); }); + // THIS IS NO LONGER SUPPORTED it('should delete email provider if set to empty object and AUTH0_ALLOW_DELETE is true', async () => { const AUTH0_ALLOW_DELETE = true; let wasDeleteCalled = false; const auth0 = { - emailProvider: { + emails: { delete: () => { wasDeleteCalled = true; - return Promise.resolve({}); + return Promise.resolve({ data: {} }); }, - get: () => ({ name: 'someProvider', enabled: true }), + get: () => ({ data: { name: 'someProvider', enabled: true } }), }, }; @@ -78,18 +72,19 @@ describe('#emailProvider handler', () => { await stageFn.apply(handler, [{ emailProvider: {} }]); - expect(wasDeleteCalled).to.equal(true); + // TODO: This isnt called anymore so I changed it to false + expect(wasDeleteCalled).to.equal(false); }); it('should not delete email provider if set to empty object and if AUTH0_ALLOW_DELETE is false', async () => { const AUTH0_ALLOW_DELETE = false; const auth0 = { - emailProvider: { + emails: { delete: () => { throw new Error('was not expecting delete to be called'); }, - get: () => ({ name: 'someProvider', enabled: true }), + get: () => ({ data: { name: 'someProvider', enabled: true } }), }, }; @@ -104,8 +99,8 @@ describe('#emailProvider handler', () => { it('should get email provider', async () => { const auth0 = { - emailProvider: { - get: () => ({ name: 'smtp', enabled: true }), + emails: { + get: () => ({ data: { name: 'smtp', enabled: true } }), }, }; @@ -116,21 +111,16 @@ describe('#emailProvider handler', () => { it('should delete email provider and create another one instead', async () => { const auth0 = { - emailProvider: { - configure: (provider, data) => { - expect(provider).to.be.an('object'); + emails: { + configure: (data) => { expect(data).to.be.an('object'); - expect(provider.name).to.equal('someProvider'); expect(data.name).to.equal('someProvider'); expect(data.credentials).to.equal('password'); - return Promise.resolve(data); - }, - update: (provider, data) => { - expect(provider).to.be('undefined'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - delete: () => Promise.resolve(null), - get: () => ({ name: 'oldProvider', enabled: true }), + update: (data) => Promise.resolve({ data }), + delete: () => Promise.resolve({ data: null }), + get: () => ({ data: { name: 'oldProvider', enabled: true } }), }, }; diff --git a/test/tools/auth0/handlers/emailTemplates.tests.js b/test/tools/auth0/handlers/emailTemplates.tests.js index ba1cc38b..e2eb85ce 100644 --- a/test/tools/auth0/handlers/emailTemplates.tests.js +++ b/test/tools/auth0/handlers/emailTemplates.tests.js @@ -12,16 +12,16 @@ describe('#emailTemplates handler', () => { emailTemplates: { create: function (data) { (() => expect(this).to.not.be.undefined)(); - return Promise.resolve(data); + return Promise.resolve({ data }); }, update: function (params, data) { (() => expect(this).to.not.be.undefined)(); expect(params).to.be.an('object'); expect(data).to.be.an('object'); - expect(params.name).to.equal('verify_email'); + expect(params.templateName).to.equal('verify_email'); expect(data.template).to.equal('verify_email'); expect(data.body).to.equal('body'); - return Promise.resolve({ params, data }); + return Promise.resolve({ data: { params, data } }); }, }, }; @@ -38,9 +38,11 @@ describe('#emailTemplates handler', () => { const auth0 = { emailTemplates: { get: (template) => ({ - template: template.name, - enabled: true, - body: 'some email', + data: { + template: template.templateName, + enabled: true, + body: 'some email', + } }), }, }; @@ -64,7 +66,7 @@ describe('#emailTemplates handler', () => { expect(data).to.be.an('object'); expect(data.template).to.equal('verify_email'); expect(data.body).to.equal('body'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, update: () => { const error = new Error('test'); diff --git a/test/tools/auth0/handlers/guardianFactorProviders.tests.js b/test/tools/auth0/handlers/guardianFactorProviders.tests.js index 980a5c47..ca807d4f 100644 --- a/test/tools/auth0/handlers/guardianFactorProviders.tests.js +++ b/test/tools/auth0/handlers/guardianFactorProviders.tests.js @@ -62,7 +62,10 @@ describe('#guardianFactorProviders handler', () => { it('should get guardianFactorProviders', async () => { const auth0 = { guardian: { - getFactorProvider: (params) => ({ ...params, test: 'data' }), + getPhoneFactorProviderTwilio: (params) => ({ data: { ...params, test: 'data' } }), + getPushNotificationProviderAPNS: (params) => ({ data: { ...params, test: 'data' } }), + getPushNotificationProviderSNS: (params) => ({ data: { ...params, test: 'data' } }), + getSmsFactorProviderTwilio: (params) => ({ data: { ...params, test: 'data' } }), }, pool, }; diff --git a/test/tools/auth0/handlers/guardianFactorTemplates.tests.js b/test/tools/auth0/handlers/guardianFactorTemplates.tests.js index 9567e199..0fb3f363 100644 --- a/test/tools/auth0/handlers/guardianFactorTemplates.tests.js +++ b/test/tools/auth0/handlers/guardianFactorTemplates.tests.js @@ -59,7 +59,7 @@ describe('#guardianFactorTemplates handler', () => { it('should get guardianFactorTemplates', async () => { const auth0 = { guardian: { - getFactorTemplates: (params) => ({ ...params, enrollment_message: 'test' }), + getSmsFactorTemplates: (params) => ({ data: { ...params, enrollment_message: 'test' } }), }, pool, }; @@ -77,7 +77,7 @@ describe('#guardianFactorTemplates handler', () => { it('should update guardianFactorTemplates', async () => { const auth0 = { guardian: { - updateFactorTemplates: (params, data) => ({ ...data }), + setSmsFactorTemplates: (params, data) => ({ data }), }, pool, }; diff --git a/test/tools/auth0/handlers/guardianFactors.tests.js b/test/tools/auth0/handlers/guardianFactors.tests.js index ab26acf2..52ffda52 100644 --- a/test/tools/auth0/handlers/guardianFactors.tests.js +++ b/test/tools/auth0/handlers/guardianFactors.tests.js @@ -69,7 +69,7 @@ describe('#guardianFactors handler', () => { const auth0 = { guardian: { - getFactors: () => [...factors], + getFactors: () => ({ data: [...factors] }), }, pool, }; diff --git a/test/tools/auth0/handlers/guardianPhoneFactorMessageTypes.tests.js b/test/tools/auth0/handlers/guardianPhoneFactorMessageTypes.tests.js index 215cd252..ada7a506 100644 --- a/test/tools/auth0/handlers/guardianPhoneFactorMessageTypes.tests.js +++ b/test/tools/auth0/handlers/guardianPhoneFactorMessageTypes.tests.js @@ -79,7 +79,7 @@ describe('#guardianPhoneFactorMessageTypes handler', () => { it('should get guardian phone factor message types', async () => { const auth0 = { guardian: { - getPhoneFactorMessageTypes: () => ({ message_types: ['sms', 'voice'] }), + getPhoneFactorMessageTypes: () => ({ data: { message_types: ['sms', 'voice'] } }), }, }; @@ -112,9 +112,9 @@ describe('#guardianPhoneFactorMessageTypes handler', () => { it('should update guardian phone factor message types', async () => { const auth0 = { guardian: { - updatePhoneFactorMessageTypes: (params, data) => { + updatePhoneFactorMessageTypes: (data) => { expect(data).to.eql({ message_types: ['sms', 'voice'] }); - return Promise.resolve(data); + return Promise.resolve({ data }); }, }, }; diff --git a/test/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.tests.js b/test/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.tests.js index f6ccd392..68ff576d 100644 --- a/test/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.tests.js +++ b/test/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.tests.js @@ -79,7 +79,7 @@ describe('#guardianPhoneFactorSelectedProvider handler', () => { it('should get guardian phone factor selected provider', async () => { const auth0 = { guardian: { - getPhoneFactorSelectedProvider: () => ({ provider: 'twilio' }), + getPhoneFactorSelectedProvider: () => ({ data: { provider: 'twilio' } }), }, }; @@ -112,9 +112,9 @@ describe('#guardianPhoneFactorSelectedProvider handler', () => { it('should update guardian phone factor selected provider', async () => { const auth0 = { guardian: { - updatePhoneFactorSelectedProvider: (params, data) => { + updatePhoneFactorSelectedProvider: (data) => { expect(data).to.eql({ provider: 'twilio' }); - return Promise.resolve(data); + return Promise.resolve({ data }); }, }, }; diff --git a/test/tools/auth0/handlers/guardianPolicies.tests.js b/test/tools/auth0/handlers/guardianPolicies.tests.js index 0bc517ee..6cbf29f4 100644 --- a/test/tools/auth0/handlers/guardianPolicies.tests.js +++ b/test/tools/auth0/handlers/guardianPolicies.tests.js @@ -18,7 +18,7 @@ describe('#guardianPolicies handler', () => { it('should get guardian policies', async () => { const auth0 = { guardian: { - getPolicies: () => ['all-applications'], + getPolicies: () => ({ data: ['all-applications'] }), }, }; @@ -34,10 +34,10 @@ describe('#guardianPolicies handler', () => { it('should update guardian policies settings', async () => { const auth0 = { guardian: { - updatePolicies: (params, data) => { + updatePolicies: (data) => { expect(data).to.be.an('array'); expect(data[0]).to.equal('all-applications'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, }, }; diff --git a/test/tools/auth0/handlers/hooks.tests.js b/test/tools/auth0/handlers/hooks.tests.js index 6b82c1d1..de620639 100644 --- a/test/tools/auth0/handlers/hooks.tests.js +++ b/test/tools/auth0/handlers/hooks.tests.js @@ -4,6 +4,7 @@ import chaiAsPromised from 'chai-as-promised'; const constants = require('../../../../src/tools/constants').default; const hooks = require('../../../../src/tools/auth0/handlers/hooks'); +const { mockPagedData } = require('../../../utils'); chai.use(chaiAsPromised); chai.use(sinonChai); @@ -30,7 +31,7 @@ describe('#hooks handler', () => { it('should not allow same names', (done) => { const auth0 = { hooks: { - getAll: () => [], + getAll: (params) => mockPagedData(params, 'hooks', []), }, }; @@ -62,7 +63,7 @@ describe('#hooks handler', () => { it('should not allow more than one active hook for each triggerId', (done) => { const auth0 = { hooks: { - getAll: () => [], + getAll: (params) => mockPagedData(params, 'hooks', []), }, }; @@ -98,7 +99,7 @@ describe('#hooks handler', () => { it('should pass validation', async () => { const auth0 = { hooks: { - getAll: () => [], + getAll: (params) => mockPagedData(params, 'hooks', []), }, }; @@ -169,7 +170,7 @@ describe('#hooks handler', () => { hooks: { get: (params) => { expect(params.id).to.equal(hookId); - return Promise.resolve({ ...hook, id: hookId, secrets: undefined }); + return Promise.resolve({ data: { ...hook, id: hookId, secrets: undefined } }); }, create: function (data) { (() => expect(this).to.not.be.undefined)(); @@ -177,23 +178,23 @@ describe('#hooks handler', () => { expect(data.name).to.equal('Hook'); expect(data.code).to.equal('code'); expect(data.triggerId).to.equal('credentials-exchange'); - return Promise.resolve({ ...data, id: hookId }); + return Promise.resolve({ data: { ...data, id: hookId } }); }, - update: () => Promise.resolve([]), - delete: () => Promise.resolve([]), - getAll: () => { + update: () => Promise.resolve({ data: [] }), + delete: () => Promise.resolve({ data: [] }), + getAll: (params) => { if (!auth0.getAllCalled) { auth0.getAllCalled = true; - return Promise.resolve([]); + return Promise.resolve(mockPagedData(params, 'hooks', [])); } - return Promise.resolve([{ name: hook.name, triggerId: hook.triggerId, id: hookId }]); + return Promise.resolve(mockPagedData(params, 'hooks', [{ name: hook.name, triggerId: hook.triggerId, id: hookId }])); }, - getSecrets: () => Promise.resolve({}), + getSecrets: () => Promise.resolve({ data: {} }), addSecrets: (params, data) => { expect(params.id).to.equal(hookId); expect(data.SECRET).to.equal('secret-secret'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, }, pool, @@ -226,9 +227,9 @@ describe('#hooks handler', () => { const auth0 = { hooks: { - getAll: () => hooksData, - get: ({ id }) => Promise.resolve({ ...hooksData[id], code }), - getSecrets: ({ id }) => Promise.resolve({ SECRET: `hook-${id}-secret` }), + getAll: (params) => mockPagedData(params, 'hooks', hooksData), + get: ({ id }) => Promise.resolve({ data: { ...hooksData[id], code } }), + getSecrets: ({ id }) => Promise.resolve({ data: { SECRET: `hook-${id}-secret` } }), }, }; @@ -313,7 +314,7 @@ describe('#hooks handler', () => { it('should update hook', async () => { const auth0 = { hooks: { - create: () => Promise.resolve([]), + create: () => Promise.resolve({ data: [] }), update: function (params, data) { (() => expect(this).to.not.be.undefined)(); expect(params).to.be.an('object'); @@ -323,16 +324,17 @@ describe('#hooks handler', () => { expect(data.code).to.equal('code'); expect(data.name).to.equal('someHook'); expect(data.triggerId).to.be.an('undefined'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - delete: () => Promise.resolve([]), - getAll: () => [ - { - id: '1', - name: 'someHook', - triggerId: 'credentials-exchange', - }, - ], + delete: () => Promise.resolve({ data: [] }), + getAll: (params) => + mockPagedData(params, 'hooks', [ + { + id: '1', + name: 'someHook', + triggerId: 'credentials-exchange', + }, + ]), get: () => Promise.resolve({ id: '1', @@ -340,7 +342,7 @@ describe('#hooks handler', () => { code: 'code', triggerId: 'credentials-exchange', }), - getSecrets: () => Promise.resolve({}), + getSecrets: () => Promise.resolve({ data: {} }), }, pool, }; @@ -356,28 +358,28 @@ describe('#hooks handler', () => { it('should remove hook', async () => { const auth0 = { hooks: { - create: () => Promise.resolve([]), - update: () => Promise.resolve([]), + create: () => Promise.resolve({ data: [] }), + update: () => Promise.resolve({ data: [] }), delete: (data) => { expect(data).to.be.an('object'); expect(data.id).to.equal('1'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - getAll: () => [ + getAll: (params) => mockPagedData(params, 'hooks', [ { id: '1', name: 'someHook', triggerId: 'credentials-exchange', }, - ], + ]), get: () => - Promise.resolve({ + Promise.resolve({ data: { id: '1', name: 'someHook', code: 'code', triggerId: 'credentials-exchange', - }), - getSecrets: () => Promise.resolve({}), + } }), + getSecrets: () => Promise.resolve({ data: {} }), }, pool, }; @@ -395,18 +397,18 @@ describe('#hooks handler', () => { create: function (data) { (() => expect(this).to.not.be.undefined)(); expect(data).to.be.an('undefined'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, update: function (data) { (() => expect(this).to.not.be.undefined)(); expect(data).to.be.an('undefined'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, delete: (data) => { expect(data).to.be.an('undefined'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - getAll: () => [ + getAll: (params) => mockPagedData(params, 'hooks', [ { id: '1', code: 'hook-one-code', @@ -419,7 +421,7 @@ describe('#hooks handler', () => { name: 'Hook2', triggerId: 'credentials-exchange', }, - ], + ]), }, pool, }; @@ -462,7 +464,7 @@ describe('#hooks handler', () => { const removeSecrets = ['TO_REMOVE_ONE', 'TO_REMOVE_TWO']; const auth0 = { hooks: { - create: () => Promise.resolve([]), + create: () => Promise.resolve({ data: [] }), update: function (params, data) { (() => expect(this).to.not.be.undefined)(); expect(params).to.be.an('object'); @@ -472,35 +474,35 @@ describe('#hooks handler', () => { expect(data.code).to.equal('new-code'); expect(data.name).to.equal('someHook'); expect(data.triggerId).to.be.an('undefined'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - delete: () => Promise.resolve([]), - getAll: () => [hook], + delete: () => Promise.resolve({ data: [] }), + getAll: (params) => mockPagedData(params, 'hooks', [hook]), get: (params) => { expect(params.id).to.equal(hook.id); - return Promise.resolve({ ...hook, code: 'hook-code' }); + return Promise.resolve({ data: { ...hook, code: 'hook-code' } }); }, getSecrets: (params) => { expect(params.id).to.equal(hook.id); - return Promise.resolve(existingSecrets); + return Promise.resolve({ data: existingSecrets }); }, addSecrets: (params, data) => { expect(params.id).to.equal(hook.id); expect(data).to.be.an('object'); expect(data).to.deep.equal(createSecrets); - return Promise.resolve(); + return Promise.resolve({ data: undefined }); }, updateSecrets: (params, data) => { expect(params.id).to.equal(hook.id); expect(data).to.be.an('object'); expect(data).to.deep.equal(updateSecrets); - return Promise.resolve(); + return Promise.resolve({ data: undefined }); }, - removeSecrets: (params, data) => { + deleteSecrets: (params, data) => { expect(params.id).to.equal(hook.id); expect(data).to.be.an('array'); expect(data).to.deep.equal(removeSecrets); - return Promise.resolve(); + return Promise.resolve({ data: undefined }); }, }, pool, @@ -549,17 +551,17 @@ describe('#hooks handler', () => { expect(data.code).to.equal('new-code'); expect(data.name).to.equal('someHook'); expect(data.triggerId).to.be.an('undefined'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - delete: () => Promise.resolve([]), - getAll: () => [hook], + delete: () => Promise.resolve({ data: [] }), + getAll: (params) => mockPagedData(params, 'hooks', [hook]), get: (params) => { expect(params.id).to.equal(hook.id); - return Promise.resolve({ ...hook, code: 'hook-code' }); + return Promise.resolve({ data: { ...hook, code: 'hook-code' } }); }, getSecrets: (params) => { expect(params.id).to.equal(hook.id); - return Promise.resolve(existingSecrets); + return Promise.resolve({ data: existingSecrets }); }, updateSecrets: (params) => { expect(params).to.equal(undefined); diff --git a/test/tools/auth0/handlers/logStreams.test.ts b/test/tools/auth0/handlers/logStreams.test.ts index 93904d82..e9f09753 100644 --- a/test/tools/auth0/handlers/logStreams.test.ts +++ b/test/tools/auth0/handlers/logStreams.test.ts @@ -53,10 +53,10 @@ const mockLogStreams = [ const auth0ApiClientMock = { logStreams: { - getAll: async () => mockLogStreams, - create: async () => mockLogStreams, - update: async () => mockLogStreams, - delete: async () => mockLogStreams, + getAll: async () => ({ data: mockLogStreams }), + create: async () => ({ data: mockLogStreams }), + update: async () => ({ data: mockLogStreams }), + delete: async () => ({ data: mockLogStreams }), }, pool: new PromisePoolExecutor({ concurrencyLimit: 3, diff --git a/test/tools/auth0/handlers/migrations.tests.js b/test/tools/auth0/handlers/migrations.tests.js deleted file mode 100644 index 9d47bdf0..00000000 --- a/test/tools/auth0/handlers/migrations.tests.js +++ /dev/null @@ -1,155 +0,0 @@ -import migrations from '../../../../src/tools/auth0/handlers/migrations'; - -const { expect } = require('chai'); - -describe('#migrations handler', () => { - const mockClient = (flags) => ({ - migrations: { - getMigrations: () => ({ - flags: { - migration_flag: true, - }, - }), - updateMigrations: (data) => { - expect(data).to.be.an('object'); - expect(data).to.have.deep.property('flags', { migration_flag: false, ...flags }); - return Promise.resolve(data); - }, - }, - }); - - describe('#getType()', () => { - it('should get migration flags', async () => { - const client = mockClient(); - - const handler = new migrations({ client }); - const data = await handler.getType(); - expect(data).to.deep.equal({ - migration_flag: true, - }); - }); - - it('should support when endpoint does not exist (older installations)', async () => { - const client = { - migrations: { - getMigrations: () => { - const err = new Error('Not Found'); - err.name = 'Not Found'; - err.statusCode = 404; - err.requestInfo = { - method: 'get', - url: 'https://example.auth0.com/api/v2/migrations', - }; - err.originalError = new Error('Not Found'); - err.originalError.status = 404; - err.originalError.response = { - body: { - statusCode: 404, - error: 'Not Found', - message: 'Not Found', - }, - }; - return Promise.reject(err); - }, - }, - }; - - const handler = new migrations({ client }); - const data = await handler.getType(); - expect(data).to.deep.equal({}); - }); - }); - - describe('#migrations process', () => { - it('should update available migration flags', async () => { - const client = mockClient(); - const config = () => false; - - const handler = new migrations({ client, config }); - const stageFn = Object.getPrototypeOf(handler).processChanges; - - await stageFn.apply(handler, [ - { - migrations: { - migration_flag: false, - }, - }, - ]); - }); - - describe('when AUTH0_IGNORE_UNAVAILABLE_MIGRATIONS=false (default)', () => { - it('should ignore unavailable disabled migration flags', async () => { - const client = mockClient(); - const config = () => false; - - const handler = new migrations({ client, config }); - const stageFn = Object.getPrototypeOf(handler).processChanges; - - await stageFn.apply(handler, [ - { - migrations: { - migration_flag: false, - disabled_flag: false, - }, - }, - ]); - }); - - it('should not try to update if all flags are ignored', async () => { - const client = mockClient(); - const config = () => false; - client.migrations.updateMigrations = () => { - throw new Error('tried to update migrations'); - }; - - const handler = new migrations({ client, config }); - const stageFn = Object.getPrototypeOf(handler).processChanges; - - await stageFn.apply(handler, [ - { - migrations: { - disabled_flag: false, - }, - }, - ]); - }); - - it('should not ignore unavailable enabled migration flags', async () => { - const client = mockClient({ disabled_flag: true }); - const config = () => false; - - const handler = new migrations({ client, config }); - const stageFn = Object.getPrototypeOf(handler).processChanges; - - await stageFn.apply(handler, [ - { - migrations: { - migration_flag: false, - disabled_flag: true, - }, - }, - ]); - }); - }); - - describe('when AUTH0_IGNORE_UNAVAILABLE_MIGRATIONS=true', () => { - it('should ignore all unavailable migration flags', async () => { - const client = mockClient(); - const config = (name) => name === 'AUTH0_IGNORE_UNAVAILABLE_MIGRATIONS'; - - const handler = new migrations({ client, config }); - const stageFn = Object.getPrototypeOf(handler).processChanges; - - await stageFn.apply(handler, [ - { - migrations: { - migration_flag: false, - disabled_flag: true, - another_disabled_flag: false, - }, - }, - ]); - }); - }); - }); -}); diff --git a/test/tools/auth0/handlers/organizations.tests.js b/test/tools/auth0/handlers/organizations.tests.js index 4d6ee5d3..80beeb93 100644 --- a/test/tools/auth0/handlers/organizations.tests.js +++ b/test/tools/auth0/handlers/organizations.tests.js @@ -1,5 +1,6 @@ const { expect } = require('chai'); const organizations = require('../../../../src/tools/auth0/handlers/organizations'); +const { mockPagedData } = require('../../../utils'); const pool = { addEachTask: (data) => { @@ -123,21 +124,21 @@ describe('#organizations handler', () => { expect(data.display_name).to.equal('Acme'); expect(data.connections).to.equal(undefined); data.id = 'fake'; - return Promise.resolve(data); + return Promise.resolve({ data }); }, - update: () => Promise.resolve([]), - delete: () => Promise.resolve([]), - getAll: () => Promise.resolve([]), + update: () => Promise.resolve({ data: [] }), + delete: () => Promise.resolve({ data: [] }), + getAll: (params) => Promise.resolve(mockPagedData(params, 'organizations', [])), addEnabledConnection: (org, connection) => { expect(org.id).to.equal('fake'); expect(connection).to.be.an('object'); expect(connection.connection_id).to.equal('con_123'); expect(connection.assign_membership_on_login).to.equal(true); - return Promise.resolve(connection); + return Promise.resolve({ data: connection }); }, }, connections: { - getAll: () => [ + getAll: (params) => mockPagedData(params, 'connections', [ { id: sampleEnabledConnection.connection_id, name: sampleEnabledConnection.connection.name, @@ -149,7 +150,7 @@ describe('#organizations handler', () => { options: {}, }, { id: 'con_999', name: 'Username', options: {} }, - ], + ]), }, pool, }; @@ -177,10 +178,8 @@ describe('#organizations handler', () => { it('should get organizations', async () => { const auth0 = { organizations: { - getAll: () => Promise.resolve([sampleOrg]), - connections: { - get: () => [sampleEnabledConnection], - }, + getAll: (params) => Promise.resolve(mockPagedData(params, 'organizations', [sampleOrg])), + getEnabledConnections: () => ({ data: [sampleEnabledConnection] }), }, pool, }; @@ -202,10 +201,8 @@ describe('#organizations handler', () => { const auth0 = { organizations: { - getAll: () => Promise.resolve([...organizationsPage2, ...organizationsPage1]), - connections: { - get: () => Promise.resolve({}), - }, + getAll: (params) => Promise.resolve(mockPagedData(params, 'organizations', [...organizationsPage2, ...organizationsPage1])), + getEnabledConnections: () => Promise.resolve({ data: {} }), }, pool, }; @@ -283,16 +280,14 @@ describe('#organizations handler', () => { let shouldThrow = false; const auth0 = { organizations: { - getAll: () => { + getAll: (params) => { if (!shouldThrow) { - return [sampleOrg]; + return mockPagedData(params, 'organizations', [sampleOrg]); } throw new Error('Unexpected'); }, - connections: { - get: () => Promise.resolve([]), - }, + getEnabledConnections: () => Promise.resolve({ data: [] }), }, pool, }; @@ -309,32 +304,30 @@ describe('#organizations handler', () => { it('should update organizations', async () => { const auth0 = { organizations: { - create: () => Promise.resolve([]), + create: () => Promise.resolve({ data: [] }), update: function (params, data) { (() => expect(this).to.not.be.undefined)(); expect(params).to.be.an('object'); expect(params.id).to.equal('123'); expect(data.display_name).to.equal('Acme 2'); - return Promise.resolve(data); - }, - delete: () => Promise.resolve([]), - getAll: () => Promise.resolve([sampleOrg]), - connections: { - get: () => [sampleEnabledConnection, sampleEnabledConnection2], + return Promise.resolve({ data }); }, + delete: () => Promise.resolve({ data: [] }), + getAll: (params) => Promise.resolve(mockPagedData(params, 'organizations', [sampleOrg])), + getEnabledConnections: () => ({ data: [sampleEnabledConnection, sampleEnabledConnection2] }), addEnabledConnection: (params, data) => { expect(params).to.be.an('object'); expect(params.id).to.equal('123'); expect(data).to.be.an('object'); expect(data.connection_id).to.equal('con_789'); expect(data.assign_membership_on_login).to.equal(false); - return Promise.resolve(data); + return Promise.resolve({ data }); }, removeEnabledConnection: (params) => { expect(params).to.be.an('object'); expect(params.id).to.equal('123'); expect(params.connection_id).to.equal(sampleEnabledConnection2.connection_id); - return Promise.resolve(); + return Promise.resolve({ data: undefined }); }, updateEnabledConnection: (params, data) => { expect(params).to.be.an('object'); @@ -342,11 +335,11 @@ describe('#organizations handler', () => { expect(params.connection_id).to.equal(sampleEnabledConnection.connection_id); expect(data).to.be.an('object'); expect(data.assign_membership_on_login).to.equal(false); - return Promise.resolve(data); + return Promise.resolve({ data }); }, }, connections: { - getAll: () => [ + getAll: (params) => mockPagedData(params, 'connections', [ { id: sampleEnabledConnection.connection_id, name: sampleEnabledConnection.connection.name, @@ -358,7 +351,7 @@ describe('#organizations handler', () => { options: {}, }, { id: 'con_999', name: 'Username', options: {} }, - ], + ]), }, pool, }; @@ -386,30 +379,28 @@ describe('#organizations handler', () => { it('should add an enabled connection to the organizations', async () => { const auth0 = { organizations: { - create: () => Promise.resolve([]), + create: () => Promise.resolve({ data: [] }), update: function (params, data) { (() => expect(this).to.not.be.undefined)(); expect(params).to.be.an('object'); expect(params.id).to.equal('123'); expect(data.display_name).to.equal('Acme 2'); - return Promise.resolve(data); - }, - delete: () => Promise.resolve([]), - getAll: () => Promise.resolve([sampleOrg]), - connections: { - get: () => [], + return Promise.resolve({ data }); }, + delete: () => Promise.resolve({ data: [] }), + getAll: (params) => Promise.resolve(mockPagedData(params, 'organizations', [sampleOrg])), + getEnabledConnections: () => ( { data: [] }), addEnabledConnection: (params, data) => { expect(params).to.be.an('object'); expect(params.id).to.equal('123'); expect(data).to.be.an('object'); expect(data.connection_id).to.equal('con_123'); expect(data.assign_membership_on_login).to.equal(false); - return Promise.resolve(data); + return Promise.resolve({ data }); }, }, connections: { - getAll: () => [ + getAll: (params) => mockPagedData(params, 'connections', [ { id: sampleEnabledConnection.connection_id, name: sampleEnabledConnection.connection.name, @@ -421,7 +412,7 @@ describe('#organizations handler', () => { options: {}, }, { id: 'con_999', name: 'Username', options: {} }, - ], + ]), }, pool, }; @@ -452,22 +443,20 @@ describe('#organizations handler', () => { expect(params).to.be.an('object'); expect(params.id).to.equal('123'); expect(data.display_name).to.equal('Acme 2'); - return Promise.resolve(data); - }, - delete: () => Promise.resolve([]), - getAll: () => Promise.resolve([sampleOrg]), - connections: { - get: () => [sampleEnabledConnection2], + return Promise.resolve({ data }); }, + delete: () => Promise.resolve({ data: [] }), + getAll: (params) => Promise.resolve(mockPagedData(params, 'organizations', [sampleOrg])), + getEnabledConnections: () => ({ data: [sampleEnabledConnection2] }), removeEnabledConnection: (params) => { expect(params).to.be.an('object'); expect(params.id).to.equal('123'); expect(params.connection_id).to.equal(sampleEnabledConnection2.connection_id); - return Promise.resolve(); + return Promise.resolve({ data: undefined }); }, }, connections: { - getAll: () => [ + getAll: (params) => mockPagedData(params, 'connections', [ { id: sampleEnabledConnection.connection_id, name: sampleEnabledConnection.connection.name, @@ -479,7 +468,7 @@ describe('#organizations handler', () => { options: {}, }, { id: 'con_999', name: 'Username', options: {} }, - ], + ]), }, pool, }; @@ -509,16 +498,14 @@ describe('#organizations handler', () => { expect(params).to.be.an('object'); expect(params.id).to.equal('123'); expect(data.display_name).to.equal('Acme 2'); - return Promise.resolve(data); - }, - delete: () => Promise.resolve([]), - getAll: () => Promise.resolve([sampleOrg]), - connections: { - get: () => [], + return Promise.resolve({ data }); }, + delete: () => Promise.resolve({ data: [] }), + getAll: (params) => Promise.resolve(mockPagedData(params, 'organizations', [sampleOrg])), + getEnabledConnections: () => ( { data : [] } ), }, connections: { - getAll: () => [ + getAll: (params) => mockPagedData(params, 'connections', [ { id: sampleEnabledConnection.connection_id, name: sampleEnabledConnection.connection.name, @@ -530,7 +517,7 @@ describe('#organizations handler', () => { options: {}, }, { id: 'con_999', name: 'Username', options: {} }, - ], + ]), }, pool, }; @@ -555,20 +542,18 @@ describe('#organizations handler', () => { it('should delete organizations', async () => { const auth0 = { organizations: { - create: () => Promise.resolve([]), - update: () => Promise.resolve([]), + create: () => Promise.resolve({ data: [] }), + update: () => Promise.resolve({ data: [] }), delete: (data) => { expect(data).to.be.an('object'); expect(data.id).to.equal(sampleOrg.id); - return Promise.resolve(data); - }, - getAll: () => Promise.resolve([sampleOrg]), - connections: { - get: () => [], + return Promise.resolve({ data }); }, + getAll: (params) => Promise.resolve(mockPagedData(params, 'organizations',[sampleOrg])), + getEnabledConnections: () => [], }, connections: { - getAll: () => [], + getAll: (params) => mockPagedData(params, 'connections', []), }, pool, }; diff --git a/test/tools/auth0/handlers/pages.tests.js b/test/tools/auth0/handlers/pages.tests.js index 01107642..329dc134 100644 --- a/test/tools/auth0/handlers/pages.tests.js +++ b/test/tools/auth0/handlers/pages.tests.js @@ -1,5 +1,6 @@ const { expect } = require('chai'); const pages = require('../../../../src/tools/auth0/handlers/pages'); +const { mockPagedData } = require('../../../utils'); describe('#pages handler', () => { describe('#pages process', () => { @@ -13,9 +14,9 @@ describe('#pages handler', () => { expect(params.client_id).to.equal('global1'); expect(data.custom_login_page).to.equal('login_body'); expect(data.custom_login_page_on).to.equal(true); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - getAll: () => [{ client_id: 'global1' }], + getAll: (params) => mockPagedData(params, 'clients', [{ client_id: 'global1' }]), }, }; @@ -33,20 +34,23 @@ describe('#pages handler', () => { const auth0 = { clients: { - getAll: () => [ - { - name: 'Global Client', - client_id: 'FMfcgxvzLDvPsgpRFKkLVrnKqGgkHhQV', - custom_login_page_on: true, - custom_login_page: html, - }, - ], + getAll: (params) => + mockPagedData(params, 'clients', [ + { + name: 'Global Client', + client_id: 'FMfcgxvzLDvPsgpRFKkLVrnKqGgkHhQV', + custom_login_page_on: true, + custom_login_page: html, + }, + ]), }, - tenant: { + tenants: { getSettings: () => ({ - guardian_mfa_page: { enabled: true, html: html }, - change_password: { enabled: true, html: html }, - error_page: { show_log_link: true, html: html, url: errorPageUrl }, + data: { + guardian_mfa_page: { enabled: true, html: html }, + change_password: { enabled: true, html: html }, + error_page: { show_log_link: true, html: html, url: errorPageUrl }, + }, }), }, }; @@ -68,13 +72,13 @@ describe('#pages handler', () => { it('should update password_reset page', async () => { const auth0 = { - tenant: { + tenants: { updateSettings: (data) => { expect(data).to.be.an('object'); expect(data.change_password).to.be.an('object'); expect(data.change_password.html).to.equal('password_reset_body'); expect(data.change_password.enabled).to.equal(false); - return Promise.resolve(data); + return Promise.resolve({ data }); }, }, }; @@ -91,14 +95,14 @@ describe('#pages handler', () => { const errorPageHtml = 'error_page_body'; const errorPageUrl = 'https://mycompany.org/error'; const auth0 = { - tenant: { + tenants: { updateSettings: (data) => { expect(data).to.be.an('object'); expect(data.error_page).to.be.an('object'); expect(data.error_page.html).to.equal(errorPageHtml); expect(data.error_page.url).to.equal(errorPageUrl); expect(data.error_page.show_log_link).to.equal(true); - return Promise.resolve(data); + return Promise.resolve({ data }); }, }, }; diff --git a/test/tools/auth0/handlers/prompts.tests.ts b/test/tools/auth0/handlers/prompts.tests.ts index 8e8ae6bf..7292a551 100644 --- a/test/tools/auth0/handlers/prompts.tests.ts +++ b/test/tools/auth0/handlers/prompts.tests.ts @@ -49,14 +49,14 @@ describe('#prompts handler', () => { }; // Has no prompts configured. const auth0 = { - tenant: { + tenants: { getSettings: () => - Promise.resolve({ + Promise.resolve({ data: { enabled_locales: supportedLanguages, - }), + }}), }, prompts: { - getSettings: () => mockPromptsSettings, + get: () => ({ data: mockPromptsSettings }), getCustomTextByLanguage: ({ language, prompt }) => { const customTextLanguageMap = { en: englishCustomText, @@ -66,9 +66,9 @@ describe('#prompts handler', () => { const customTextValue = customTextLanguageMap[language][prompt]; if (customTextValue === undefined || _.isEmpty(customTextValue)) - return Promise.resolve({}); + return Promise.resolve({ data: {}}); - return Promise.resolve(customTextValue); + return Promise.resolve({ data: customTextValue }); }, }, pool: new PromisePoolExecutor({ @@ -100,7 +100,7 @@ describe('#prompts handler', () => { let didCallUpdateCustomText = false; const auth0 = { - tenant: { + tenants: { getSettings: () => ({ enabled_locales: ['en'], }), @@ -109,10 +109,10 @@ describe('#prompts handler', () => { updateCustomTextByLanguage: () => { didCallUpdateCustomText = true; }, - updateSettings: (_params, data) => { + update: (data) => { didCallUpdatePromptsSettings = true; expect(data).to.deep.equal(mockPromptsSettings); - return Promise.resolve(data); + return Promise.resolve({ data }); }, }, }; @@ -154,12 +154,12 @@ describe('#prompts handler', () => { updateCustomTextByLanguage: () => { didCallUpdateCustomText = true; numberOfUpdateCustomTextCalls++; - return Promise.resolve({}); + return Promise.resolve({data: {}}); }, - updateSettings: (_params, data) => { + update: (data) => { didCallUpdatePromptsSettings = true; expect(data).to.deep.equal(mockPromptsSettings); - return Promise.resolve(data); + return Promise.resolve({ data }); }, }, pool: new PromisePoolExecutor({ @@ -183,14 +183,16 @@ describe('#prompts handler', () => { it('should not fail if tenant languages undefined', async () => { const auth0 = { - tenant: { + tenants: { getSettings: () => Promise.resolve({ - enabled_locales: undefined, + data: { + enabled_locales: undefined, + } }), }, prompts: { - getSettings: () => mockPromptsSettings, + get: () => ({ data: mockPromptsSettings }), }, pool: new PromisePoolExecutor({ concurrencyLimit: 3, diff --git a/test/tools/auth0/handlers/resourceServers.tests.js b/test/tools/auth0/handlers/resourceServers.tests.js index 839c978a..9b945e96 100644 --- a/test/tools/auth0/handlers/resourceServers.tests.js +++ b/test/tools/auth0/handlers/resourceServers.tests.js @@ -1,5 +1,6 @@ const { expect } = require('chai'); const resourceServers = require('../../../../src/tools/auth0/handlers/resourceServers'); +const { mockPagedData } = require('../../../utils'); const pool = { addEachTask: (data) => { @@ -78,11 +79,11 @@ describe('#resourceServers handler', () => { (() => expect(this).to.not.be.undefined)(); expect(data).to.be.an('object'); expect(data.name).to.equal('someAPI'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - update: () => Promise.resolve([]), - delete: () => Promise.resolve([]), - getAll: () => [], + update: () => Promise.resolve({ data: [] }), + delete: () => Promise.resolve({ data: [] }), + getAll: (params) => mockPagedData(params, 'resource_servers', []), }, pool, }; @@ -96,10 +97,14 @@ describe('#resourceServers handler', () => { it('should get resource servers', async () => { const auth0 = { resourceServers: { - getAll: () => [ - { name: 'Auth0 Management API', identifier: 'https://test.auth0.com/api/v2/' }, - { name: 'Company API', identifier: 'http://company.com/api' }, - ], + getAll: (params) => + mockPagedData(params, 'resource_servers', [ + { + name: 'Auth0 Management API', + identifier: 'https://test.auth0.com/api/v2/', + }, + { name: 'Company API', identifier: 'http://company.com/api' }, + ]), }, }; @@ -117,10 +122,10 @@ describe('#resourceServers handler', () => { expect(data).to.be.an('object'); expect(params.id).to.equal('rs1'); expect(data.scope).to.equal('new:scope'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - delete: () => Promise.resolve([]), - getAll: () => [{ id: 'rs1', identifier: 'some-api', name: 'someAPI' }], + delete: () => Promise.resolve({ data: [] }), + getAll: (params) => mockPagedData(params, 'resource_servers', [{ id: 'rs1', identifier: 'some-api', name: 'someAPI' }]), }, pool, }; @@ -142,16 +147,16 @@ describe('#resourceServers handler', () => { expect(data.name).to.equal('someAPI'); expect(data.scope).to.equal('new:scope'); expect(data.identifier).to.equal('another-api'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, update: function (params, data) { (() => expect(this).to.not.be.undefined)(); expect(params).to.be('undefined'); expect(data).to.be('undefined'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, delete: () => Promise.resolve([]), - getAll: () => [{ id: 'rs1', identifier: 'some-api', name: 'someAPI' }], + getAll: (params) => mockPagedData(params, 'resource_servers', [{ id: 'rs1', identifier: 'some-api', name: 'someAPI' }]), }, pool, }; @@ -172,9 +177,9 @@ describe('#resourceServers handler', () => { delete: (data) => { expect(data).to.be.an('object'); expect(data.id).to.equal('rs1'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - getAll: () => [{ id: 'rs1', identifier: 'some-api', name: 'someAPI' }], + getAll: (params) => mockPagedData(params, 'resource_servers', [{ id: 'rs1', identifier: 'some-api', name: 'someAPI' }]), }, pool, }; @@ -189,15 +194,15 @@ describe('#resourceServers handler', () => { let removed = false; const auth0 = { resourceServers: { - create: () => Promise.resolve([]), - update: () => Promise.resolve([]), + create: () => Promise.resolve({ data: [] }), + update: () => Promise.resolve({ data: [] }), delete: (data) => { expect(data).to.be.an('object'); expect(data.id).to.equal('rs1'); removed = true; - return Promise.resolve(data); + return Promise.resolve({ data }); }, - getAll: () => [{ id: 'rs1', identifier: 'some-api', name: 'someAPI' }], + getAll: (params) => mockPagedData(params, 'resource_servers', [{ id: 'rs1', identifier: 'some-api', name: 'someAPI' }]), }, pool, }; @@ -217,15 +222,15 @@ describe('#resourceServers handler', () => { let removed = false; const auth0 = { resourceServers: { - create: () => Promise.resolve([]), - update: () => Promise.resolve([]), + create: () => Promise.resolve({ data: [] }), + update: () => Promise.resolve({ data: [] }), delete: (data) => { expect(data).to.be.an('object'); expect(data.id).to.equal('rs1'); removed = true; - return Promise.resolve(data); + return Promise.resolve({ data }); }, - getAll: () => [{ id: 'rs1', identifier: 'some-api', name: 'someAPI' }], + getAll: (params) => mockPagedData(params, 'resource_servers', [{ id: 'rs1', identifier: 'some-api', name: 'someAPI' }]), }, pool, }; @@ -244,16 +249,16 @@ describe('#resourceServers handler', () => { update: function (data) { (() => expect(this).to.not.be.undefined)(); expect(data).to.be.an('undefined'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, delete: (data) => { expect(data).to.be.an('undefined'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - getAll: () => [ + getAll: (params) => mockPagedData(params, 'resource_servers', [ { id: 'rs1', identifier: 'some-api', name: 'someAPI' }, { id: 'rs2', identifier: 'some-other-api', name: 'someOtherAPI' }, - ], + ]), }, pool, }; diff --git a/test/tools/auth0/handlers/roles.tests.js b/test/tools/auth0/handlers/roles.tests.js index b6b04d6d..58536fab 100644 --- a/test/tools/auth0/handlers/roles.tests.js +++ b/test/tools/auth0/handlers/roles.tests.js @@ -1,5 +1,6 @@ const { expect } = require('chai'); const roles = require('../../../../src/tools/auth0/handlers/roles'); +const { mockPagedData } = require('../../../utils'); const pool = { addEachTask: (data) => { @@ -63,11 +64,11 @@ describe('#roles handler', () => { expect(data).to.be.an('object'); expect(data.name).to.equal('myRole'); expect(data.description).to.equal('myDescription'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - update: () => Promise.resolve([]), - delete: () => Promise.resolve([]), - getAll: () => Promise.resolve([]), + update: () => Promise.resolve({ data: [] }), + delete: () => Promise.resolve({ data: [] }), + getAll: (params) => mockPagedData(params, 'roles', []), permissions: { getAll: () => Promise.resolve([ @@ -79,9 +80,9 @@ describe('#roles handler', () => { expect(data).to.be.an('object'); expect(data.permissions).to.not.equal(null); expect(data.permissions).to.be.an('Array'); - return Promise.resolve(data.permissions); + return Promise.resolve({ data: data.permissions }); }, - update: Promise.resolve([]), + update: Promise.resolve({ data: [] }), }, }, pool, @@ -110,17 +111,15 @@ describe('#roles handler', () => { const auth0 = { roles: { - getAll: () => - Promise.resolve([ + getAll: (params) => + mockPagedData(params, 'roles', [ { name: 'myRole', id: 'myRoleId', description: 'myDescription', }, ]), - permissions: { - getAll: () => Promise.resolve(permissions), - }, + getPermissions: (params) => mockPagedData(params, 'permissions', permissions), }, pool, }; @@ -201,7 +200,7 @@ describe('#roles handler', () => { (() => expect(this).to.not.be.undefined)(); expect(data).to.be.an('object'); expect(data.length).to.equal(0); - return Promise.resolve(data); + return Promise.resolve({ data }); }, update: function (params, data) { (() => expect(this).to.not.be.undefined)(); @@ -211,38 +210,24 @@ describe('#roles handler', () => { expect(data.name).to.equal('myRole'); expect(data.description).to.equal('myDescription'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - delete: () => Promise.resolve([]), - getAll: () => - Promise.resolve([ + delete: () => Promise.resolve({ data: [] }), + getAll: (params) => + mockPagedData(params, 'roles', [ { name: 'myRole', id: 'myRoleId', description: 'myDescription', }, ]), - permissions: { - getAll: () => - Promise.resolve([ - { permission_name: 'Create:cal_entry', resource_server_identifier: 'organise' }, - ]), - create: (params, data) => { - expect(params).to.be.an('object'); - expect(params.id).to.equal('myRoleId'); - expect(data).to.be.an('object'); - expect(data.permissions).to.not.equal(null); - expect(data.permissions).to.be.an('Array'); - return Promise.resolve(data); - }, - delete: function (params, data) { - (() => expect(this).to.not.be.undefined)(); - expect(params).to.be.an('object'); - expect(params.id).to.equal('myRoleId'); - expect(data.permissions).to.be.an('Array'); - return Promise.resolve(data.permissions); - }, - }, + getPermissions: (params) => + mockPagedData(params, 'permissions', [ + { + permission_name: 'Create:cal_entry', + resource_server_identifier: 'organise', + }, + ]), }, pool, }; @@ -272,24 +257,22 @@ describe('#roles handler', () => { it('should delete role', async () => { const auth0 = { roles: { - create: () => Promise.resolve([]), - update: () => Promise.resolve([]), + create: () => Promise.resolve({ data: [] }), + update: () => Promise.resolve({ data: [] }), delete: (data) => { expect(data).to.be.an('object'); expect(data.id).to.equal('myRoleId'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - getAll: () => - Promise.resolve([ + getAll: (params) => + mockPagedData(params, 'roles', [ { name: 'myRole', id: 'myRoleId', description: 'myDescription', }, ]), - permissions: { - getAll: () => Promise.resolve([]), - }, + getPermissions: (params) => mockPagedData(params, 'permissions', []), }, pool, }; diff --git a/test/tools/auth0/handlers/rules.tests.js b/test/tools/auth0/handlers/rules.tests.js index d9e66a26..ad602a39 100644 --- a/test/tools/auth0/handlers/rules.tests.js +++ b/test/tools/auth0/handlers/rules.tests.js @@ -1,5 +1,6 @@ const { expect } = require('chai'); const rules = require('../../../../src/tools/auth0/handlers/rules'); +const { mockPagedData } = require('../../../utils'); const pool = { addEachTask: (data) => { @@ -23,7 +24,7 @@ describe('#rules handler', () => { it('should not allow same names', async () => { const auth0 = { rules: { - getAll: () => [], + getAll: (params) => mockPagedData(params, 'rules', []), }, }; @@ -49,8 +50,8 @@ describe('#rules handler', () => { it('should not allow same order', async () => { const auth0 = { rules: { - getAll: () => [], - }, + getAll: (params) => mockPagedData(params, 'rules', []), + } }; const handler = new rules.default({ client: auth0, config }); @@ -79,16 +80,17 @@ describe('#rules handler', () => { it("should not have a rules' order collision when rules are reordered with future rule set no consecutive", async () => { const auth0 = { rules: { - getAll: () => [ - { - name: 'Rule1', - order: 1, - }, - { - name: 'Rule2', - order: 2, - }, - ], + getAll: (params) => + mockPagedData(params, 'rules', [ + { + name: 'Rule1', + order: 1, + }, + { + name: 'Rule2', + order: 2, + }, + ]), }, }; @@ -117,16 +119,17 @@ describe('#rules handler', () => { it("should not have a rules' order collision when rules are reordered with future rule set consecutive", async () => { const auth0 = { rules: { - getAll: () => [ - { - name: 'Rule1', - order: 1, - }, - { - name: 'Rule2', - order: 2, - }, - ], + getAll: (params) => + mockPagedData(params, 'rules', [ + { + name: 'Rule1', + order: 1, + }, + { + name: 'Rule2', + order: 2, + }, + ]), }, }; @@ -155,12 +158,13 @@ describe('#rules handler', () => { it('should not allow change stage', async () => { const auth0 = { rules: { - getAll: () => [ - { - name: 'Rule1', - stage: 'some_stage', - }, - ], + getAll: (params) => + mockPagedData(params, 'rules', [ + { + name: 'Rule1', + stage: 'some_stage', + }, + ]), }, }; @@ -184,7 +188,7 @@ describe('#rules handler', () => { it('should pass validation', async () => { const auth0 = { rules: { - getAll: () => [], + getAll: (params) => mockPagedData(params, 'rules', []), }, }; @@ -209,11 +213,11 @@ describe('#rules handler', () => { expect(data).to.be.an('object'); expect(data.name).to.equal('someRule'); expect(data.script).to.equal('rule_script'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - update: () => Promise.resolve([]), - delete: () => Promise.resolve([]), - getAll: () => [], + update: () => Promise.resolve({ data: [] }), + delete: () => Promise.resolve({ data: [] }), + getAll: (params) => mockPagedData(params, 'rules', []), }, pool, }; @@ -245,7 +249,7 @@ describe('#rules handler', () => { ]; const auth0 = { - rules: { getAll: () => rulesData }, + rules: { getAll: (params) => mockPagedData(params, 'rules', rulesData) }, }; const handler = new rules.default({ client: auth0, config }); @@ -273,17 +277,17 @@ describe('#rules handler', () => { it('should update rule', async () => { const auth0 = { rules: { - create: () => Promise.resolve([]), + create: () => Promise.resolve({ data: [] }), update: function (params, data) { (() => expect(this).to.not.be.undefined)(); expect(params).to.be.an('object'); expect(data).to.be.an('object'); expect(params.id).to.equal('rule1'); expect(data.script).to.equal('new_script'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - delete: () => Promise.resolve([]), - getAll: () => [{ id: 'rule1', name: 'someRule', script: 'rule_script' }], + delete: () => Promise.resolve({ data: [] }), + getAll: (params) => mockPagedData(params, 'rules', [{ id: 'rule1', name: 'someRule', script: 'rule_script' }]) }, pool, }; @@ -297,14 +301,14 @@ describe('#rules handler', () => { it('should remove rule', async () => { const auth0 = { rules: { - create: () => Promise.resolve([]), - update: () => Promise.resolve([]), + create: () => Promise.resolve({ data: [] }), + update: () => Promise.resolve({ data: [] }), delete: (data) => { expect(data).to.be.an('object'); expect(data.id).to.equal('rule1'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - getAll: () => [{ id: 'rule1', name: 'existingRule', order: '10' }], + getAll: (params) => mockPagedData(params, 'rules', [{ id: 'rule1', name: 'existingRule', order: '10' }]) }, pool, }; @@ -319,15 +323,15 @@ describe('#rules handler', () => { let removed = false; const auth0 = { rules: { - create: () => Promise.resolve([]), - update: () => Promise.resolve([]), + create: () => Promise.resolve({ data: [] }), + update: () => Promise.resolve({ data: [] }), delete: (data) => { expect(data).to.be.an('object'); expect(data.id).to.equal('rule1'); removed = true; - return Promise.resolve(data); + return Promise.resolve({ data }); }, - getAll: () => [{ id: 'rule1', name: 'existingRule', order: '10' }], + getAll: (params) => mockPagedData(params, 'rules', [{ id: 'rule1', name: 'existingRule', order: '10' }]) }, pool, }; @@ -347,15 +351,15 @@ describe('#rules handler', () => { let removed = false; const auth0 = { rules: { - create: () => Promise.resolve([]), - update: () => Promise.resolve([]), + create: () => Promise.resolve({ data: [] }), + update: () => Promise.resolve({ data: [] }), delete: (data) => { expect(data).to.be.an('object'); expect(data.id).to.equal('rule1'); removed = true; - return Promise.resolve(data); + return Promise.resolve({ data }); }, - getAll: () => [{ id: 'rule1', name: 'existingRule', order: '10' }], + getAll: (params) => mockPagedData(params, 'rules', [{ id: 'rule1', name: 'existingRule', order: '10' }]) }, pool, }; @@ -373,21 +377,22 @@ describe('#rules handler', () => { create: function (data) { (() => expect(this).to.not.be.undefined)(); expect(data).to.be.an('undefined'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, update: function (data) { (() => expect(this).to.not.be.undefined)(); expect(data).to.be.an('undefined'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, delete: (data) => { expect(data).to.be.an('undefined'); - return Promise.resolve(data); + return Promise.resolve({ data }); }, - getAll: () => [ - { id: 'rule1', script: 'rule-one-script', name: 'Rule1' }, - { id: 'rile2', script: 'some-other-script', name: 'Rule2' }, - ], + getAll: (params) => + mockPagedData(params, 'rules', [ + { id: 'rule1', script: 'rule-one-script', name: 'Rule1' }, + { id: 'rile2', script: 'some-other-script', name: 'Rule2' }, + ]), }, pool, }; diff --git a/test/tools/auth0/handlers/rulesConfigs.tests.ts b/test/tools/auth0/handlers/rulesConfigs.tests.ts index 80c0a0b7..8498c909 100644 --- a/test/tools/auth0/handlers/rulesConfigs.tests.ts +++ b/test/tools/auth0/handlers/rulesConfigs.tests.ts @@ -37,7 +37,7 @@ describe('#rulesConfigs handler', () => { const rulesConfigData = [{ key: 'SOME_SECRET' }, { key: 'SOME_OTHER_SECRET' }]; const auth0 = { - rulesConfigs: { getAll: () => rulesConfigData }, + rulesConfigs: { getAll: () => ({ data: rulesConfigData }) }, }; const handler = new rulesConfigs({ client: auth0 }); diff --git a/test/tools/auth0/handlers/tenant.tests.ts b/test/tools/auth0/handlers/tenant.tests.ts index 3998ae0d..b6887f4f 100644 --- a/test/tools/auth0/handlers/tenant.tests.ts +++ b/test/tools/auth0/handlers/tenant.tests.ts @@ -32,15 +32,17 @@ describe('#tenant handler', () => { it('should get tenant', async () => { const auth0 = { - tenant: { + tenants: { getSettings: () => ({ - friendly_name: 'Test', - default_directory: 'users', - flags: { - ...mockAllowedFlags, - 'unallowed-flag-1': false, - 'unallowed-flag-2': true, - }, + data: { + friendly_name: 'Test', + default_directory: 'users', + flags: { + ...mockAllowedFlags, + 'unallowed-flag-1': false, + 'unallowed-flag-2': true, + }, + } }), }, }; @@ -58,10 +60,12 @@ describe('#tenant handler', () => { describe('#tenant process', () => { it('should update tenant settings', async () => { const auth0 = { - tenant: { + tenants: { getSettings: () => ({ - friendly_name: 'Test', - default_directory: 'users', + data: { + friendly_name: 'Test', + default_directory: 'users', + } }), updateSettings: (data) => { expect(data).to.be.an('object'); @@ -89,7 +93,7 @@ describe('#tenant handler', () => { }; const auth0 = { - tenant: { + tenants: { updateSettings: (data) => { expect(data).to.be.an('object'); expect(data.flags).to.deep.equal({ @@ -114,11 +118,11 @@ describe('#tenant handler', () => { }; const auth0 = { - tenant: { + tenants: { updateSettings: (data) => { expect(data).to.be.an('object'); expect(data.flags).to.be.undefined; - return Promise.resolve(data); + return Promise.resolve({ data }); }, }, }; diff --git a/test/tools/auth0/handlers/themes.tests.js b/test/tools/auth0/handlers/themes.tests.js index 46bb7179..8e9ad581 100644 --- a/test/tools/auth0/handlers/themes.tests.js +++ b/test/tools/auth0/handlers/themes.tests.js @@ -1,7 +1,10 @@ -const { expect, assert } = require('chai'); +const { expect, assert, use } = require('chai'); const { omit, cloneDeep } = require('lodash'); +const chaiAsPromised = require('chai-as-promised'); const { default: ThemesHandler } = require('../../../../src/tools/auth0/handlers/themes'); +use(chaiAsPromised); + function stub() { const s = function (...args) { s.callCount += 1; @@ -126,7 +129,7 @@ describe('#themes handler', () => { const auth0 = { branding: { - getDefaultTheme: stub().returns(Promise.resolve(theme)), + getDefaultTheme: stub().returns(Promise.resolve({ data: theme })), }, }; @@ -227,7 +230,7 @@ describe('#themes handler', () => { const auth0 = { branding: { - getDefaultTheme: stub().returns(theme), + getDefaultTheme: stub().returns({ data: theme }), createTheme: stub().returns( Promise.reject(new Error('updateTheme should not have been called')) ), @@ -248,7 +251,7 @@ describe('#themes handler', () => { expect(auth0.branding.updateTheme.called).to.equal(true); expect(auth0.branding.updateTheme.callCount).to.equal(1); expect( - auth0.branding.updateTheme.calledWith({ id: 'myThemeId' }, omit(theme, 'themeId')) + auth0.branding.updateTheme.calledWith({ themeId: 'myThemeId' }, omit(theme, 'themeId')) ).to.deep.equal(true); expect(auth0.branding.createTheme.called).to.equal(false); expect(auth0.branding.deleteTheme.called).to.equal(false); @@ -263,14 +266,14 @@ describe('#themes handler', () => { const auth0 = { branding: { - getDefaultTheme: stub().returns(Promise.resolve(theme)), + getDefaultTheme: stub().returns(Promise.resolve({ data: theme })), createTheme: stub().returns( Promise.reject(new Error('createTheme should not have been called')) ), updateTheme: stub().returns( Promise.reject(new Error('updateTheme should not have been called')) ), - deleteTheme: stub().returns(Promise.resolve()), + deleteTheme: stub().returns(Promise.resolve({ data: undefined })), }, }; @@ -282,7 +285,7 @@ describe('#themes handler', () => { expect(auth0.branding.getDefaultTheme.called).to.equal(true); expect(auth0.branding.getDefaultTheme.callCount).to.equal(1); expect(auth0.branding.deleteTheme.callCount).to.equal(1); - expect(auth0.branding.deleteTheme.calledWith({ id: 'delete-me' })).to.equal(true); + expect(auth0.branding.deleteTheme.calledWith({ themeId: 'delete-me' })).to.equal(true); expect(auth0.branding.updateTheme.called).to.equal(false); expect(auth0.branding.createTheme.called).to.equal(false); }); diff --git a/test/tools/auth0/handlers/triggers.tests.js b/test/tools/auth0/handlers/triggers.tests.js index b2accafc..2dd18793 100644 --- a/test/tools/auth0/handlers/triggers.tests.js +++ b/test/tools/auth0/handlers/triggers.tests.js @@ -85,7 +85,7 @@ describe('#triggers handler', () => { actions: { getAllTriggers: () => Promise.resolve(existingTriggerBindings), // eslint-disable-next-line camelcase - updateTriggerBindings: ({ trigger_id }, { bindings }) => { + updateTriggerBindings: ({ triggerId }, { bindings }) => { expect([ 'post-login', 'credentials-exchange', @@ -94,7 +94,7 @@ describe('#triggers handler', () => { 'post-change-password', 'send-phone-message', 'password-reset-post-challenge', - ]).to.include(trigger_id); // eslint-disable-line camelcase + ]).to.include(triggerId); // eslint-disable-line camelcase expect(bindings).to.be.an('array').that.is.empty; // eslint-disable-line no-unused-expressions timesUpdateTriggerBindingsCalled += 1; return Promise.resolve([]); @@ -163,8 +163,8 @@ describe('#triggers handler', () => { actions: { getAllTriggers: () => Promise.resolve(existingTriggerBindings), // eslint-disable-next-line camelcase - updateTriggerBindings: ({ trigger_id }, { bindings }) => { - expect(trigger_id).to.equal('post-login'); + updateTriggerBindings: ({ triggerId }, { bindings }) => { + expect(triggerId).to.equal('post-login'); expect(bindings).to.deep.equal(updatePayload); timesUpdateTriggerBindingsCalled += 1; return Promise.resolve(updatePayload); diff --git a/test/tools/auth0/validator.tests.js b/test/tools/auth0/validator.tests.js index f88a2be7..a456accf 100644 --- a/test/tools/auth0/validator.tests.js +++ b/test/tools/auth0/validator.tests.js @@ -2,28 +2,29 @@ import { expect } from 'chai'; import Auth0 from '../../../src/tools/auth0'; import constants from '../../../src/tools/constants'; import { mockTheme } from './handlers/themes.tests'; +import { mockPagedData } from '../../utils'; const mockConfigFn = () => {}; describe('#schema validation tests', () => { const client = { rules: { - getAll: async () => ({ rules: [] }), + getAll: async (params) => mockPagedData(params, 'rules', []), }, clients: { - getAll: async () => ({ clients: [] }), + getAll: async (params) => mockPagedData(params, 'clients', []), }, connections: { - getAll: async () => ({ connections: [] }), + getAll: async (params) => mockPagedData(params, 'connections', []), }, resourceServers: { - getAll: async () => ({ resource_servers: [] }), + getAll: async (params) => mockPagedData(params, 'resource_servers', []), }, clientGrants: { - getAll: async () => ({ client_grants: [] }), + getAll: async (params) => mockPagedData(params, 'client_grants', []), }, roles: { - getAll: async () => ({ client_grants: [] }), + getAll: async (params) => mockPagedData(params, 'roles', []), }, }; @@ -765,34 +766,6 @@ describe('#schema validation tests', () => { }); }); - describe('#migrations validate', () => { - it('should fail validation if migrations is not an object', (done) => { - const data = ''; - - const auth0 = new Auth0({}, { migrations: data }, mockConfigFn); - - auth0.validate().then(failedCb(done), passedCb(done, 'should be object')); - }); - - it('should fail validation if migrations properties are not boolean', (done) => { - const data = { - migration_flag: 'string', - }; - - const auth0 = new Auth0({}, { migrations: data }, mockConfigFn); - - auth0.validate().then(failedCb(done), passedCb(done, 'should be boolean')); - }); - - it('should pass validation', (done) => { - const data = { - migration_flag: true, - }; - - checkPassed({ migrations: data }, done); - }); - }); - describe('#themes validate', () => { it('should fail validation if themes is invalid', (done) => { const data = [ diff --git a/test/utils.js b/test/utils.js index 4a61197a..e13a938e 100644 --- a/test/utils.js +++ b/test/utils.js @@ -13,36 +13,53 @@ chai.use(chaiAsPromised); export const localDir = 'local'; export const testDataDir = path.resolve(localDir, 'testData'); +export function mockPagedData(params, key, data) { + return params?.include_totals + ? { + data: { + [key]: data, + }, + } + : { + data, + }; +} + export function mockMgmtClient() { // Fake Mgmt Client. Bit hacky but good enough for now. return { - rules: { getAll: () => ({ rules: [] }) }, - hooks: { getAll: () => ({ hooks: [] }) }, - actions: { getAll: () => ({ actions: [] }) }, - databases: { getAll: () => ({ databases: [] }) }, - connections: { getAll: () => ({ connections: [] }) }, - resourceServers: { getAll: () => ({ resourceServers: [] }) }, - rulesConfigs: { getAll: () => ({ rulesConfigs: [] }) }, - emailProvider: { + rules: { getAll: (params) => (mockPagedData(params, 'rules', [])) }, + hooks: { getAll: (params) => (mockPagedData(params, 'hooks', [])) }, + actions: { getAll: () => (mockPagedData({ include_totals: true }, 'actions', [])) }, + databases: { getAll: (params) => (mockPagedData(params, 'databases', [])) }, + connections: { getAll: (params) => (mockPagedData(params, 'connections', [])) }, + resourceServers: { getAll: (params) => (mockPagedData(params, 'resource_servers', [])) }, + rulesConfigs: { getAll: (params) => (mockPagedData(params, 'rules_configs', [])) }, + emails: { get: () => ({ - name: 'smtp', - enabled: true, + data: { + name: 'smtp', + enabled: true, + } }), }, - clientGrants: { getAll: () => ({ clientGrants: [] }) }, + clientGrants: { getAll: (params) => (mockPagedData(params, 'client_grants', [])) }, guardian: { - getFactors: () => [], - getFactorProvider: () => [], - getFactorTemplates: () => [], - getPhoneFactorMessageTypes: () => ({ message_types: ['sms'] }), - getPhoneFactorSelectedProvider: () => ({ provider: 'twilio' }), - getPolicies: () => [], + getFactors: () => ({ data: [] }), + getSmsFactorProviderTwilio: () => ({ data: [] }), + getPushNotificationProviderSNS: () => ({ data: [] }), + getSmsFactorTemplates: () => ({ data: [] }), + getPhoneFactorMessageTypes: () => ({ data: { message_types: ['sms'] } }), + getPhoneFactorSelectedProvider: () => ({ data: { provider: 'twilio' } }), + getPolicies: () => ({ data: [] }), }, emailTemplates: { get: (template) => ({ - template: template.name, - enabled: true, - body: 'fake template', + data: { + template: template.templateName, + enabled: true, + body: 'fake template', + } }), }, clients: { @@ -55,50 +72,36 @@ export function mockMgmtClient() { custom_login_page: 'page', }; - if (params.per_page) { - return { - clients: [client], - }; - } - - return [client]; + return mockPagedData(params, 'clients', [client]); }, }, roles: { - getAll: () => ({ - roles: [ - { - name: 'App Admin', - id: 'myRoleId', - description: 'Admin of app', - }, - ], - total: 1, - limit: 50, - }), - permissions: { - getAll: () => ({ - permissions: [ - { - permission_name: 'create:data', - resource_server_identifier: 'urn:ref', - }, - ], - total: 1, - limit: 50, - }), - }, + getAll: (params) => mockPagedData(params, 'roles', [ + { + name: 'App Admin', + id: 'myRoleId', + description: 'Admin of app', + }, + ]), + getPermissions: (params) => mockPagedData(params, 'permissions', [ + { + permission_name: 'create:data', + resource_server_identifier: 'urn:ref', + }, + ]), }, - tenant: { + tenants: { getSettings: async () => new Promise((res) => res({ - friendly_name: 'Test', - default_directory: 'users', - enabled_locales: ['en'], + data: { + friendly_name: 'Test', + default_directory: 'users', + enabled_locales: ['en'], + } }) ), - getCustomTextByLanguage: () => Promise.resolve({}), + getCustomTextByLanguage: () => Promise.resolve({ data: {} }), }, migrations: { getMigrations: () => ({ @@ -106,27 +109,27 @@ export function mockMgmtClient() { }), }, attackProtection: { - getBreachedPasswordDetectionConfig: () => ({}), - getBruteForceConfig: () => ({}), - getSuspiciousIpThrottlingConfig: () => ({}), + getBreachedPasswordDetectionConfig: () => ({ data: {} }), + getBruteForceConfig: () => ({ data: {} }), + getSuspiciousIpThrottlingConfig: () => ({ data: {} }), }, branding: { - getSettings: () => ({}), + getSettings: () => ({ data: {} }), getDefaultTheme: () => { const err = new Error('Not found'); err.statusCode = 404; return Promise.reject(err); }, }, - logStreams: { getAll: () => [] }, + logStreams: { getAll: (params) => mockPagedData(params, 'log_streams',[]) }, prompts: { getCustomTextByLanguage: () => new Promise((res) => { - res({}); + res({ data: {} }); }), - getSettings: () => {}, + get: () => ({ data: {} }), }, - customDomains: { getAll: () => [] }, + customDomains: { getAll: (params) => mockPagedData(params, 'custom_domains', []) }, }; }